home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PASTUT34 / COMPDIR.TXT < prev    next >
Text File  |  1993-01-15  |  3KB  |  68 lines

  1.                        COMPILER DIRECTIVES.
  2.                        --------------------
  3.  
  4. When a program is compiled, certain features such as range checking or the
  5. generation of debug information, can be controlled through 'Compiler
  6. Directives'. A compiler directive is a comment with a special syntax.
  7. Comments are written within braces { and } , and compiler directives all
  8. start with $ followed by a name of one or more letters and then possibly
  9. + or - or filename.
  10.  
  11. The current default directives are automatically listed at the top of any
  12. program by means of the key sequence CTRL O followed by O (alone). Typical
  13. values are shown below:
  14.  
  15. {$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,R-,S+,V+,X-}        {The switch directives}
  16. {$M 16384,0,655360}                            {The memory size directives}
  17.  
  18. Compiler directives can be set locally within the program and then reset
  19. when required, so that {$I-} switches input/output checking off and then
  20. {$I+} switches it back on again.
  21.  
  22. Alternatively, the default values can be changed by choosing the Options
  23. Menu in the Integrated Development Environment (IDE) and then selecting
  24. Compiler from the sub-menu. A dialog box is then displayed and each option
  25. can be toggled by means of the space bar. Successive option are selected
  26. by using the arrow keys, whilst movement to the different sub-boxes is
  27. achieved by using the tab key. Conditional defines can also be entered.
  28.  
  29.  
  30. There are three types of directives:
  31.  
  32. Switch Directives.
  33. ------------------
  34.  
  35. These turn particular compiler features on or off by specifying + or -
  36. immediately after the directive name.
  37.  
  38. e.g. {$R-}    {Turn off range-checking}
  39.  
  40. Parameter Directives.
  41. ---------------------
  42.  
  43. These specify parameters that affect the compilation, such as file names
  44. and memory sizes.
  45.  
  46. e.g. {$I filename}            {Include the named file in the compilation}
  47.                               {at this point in the current program.    }
  48.  
  49. Conditional Directives.
  50. -----------------------
  51.  
  52. These control conditional compilation of parts of the source text, based
  53. on user-definable conditional symbols.
  54.  
  55. e.g. {$DEFINE Debug}       {Defines Debug}
  56.      {IFDEF Debug}         {If debug defined, as above, then the program
  57.       ........              statements located in the lines up to the
  58.       ........              final directive are compiled}
  59.      {$ENDIF}              {Ends the conditional directive}
  60.  
  61.  
  62.  
  63. Compiler directives are described in detail in Chapter 21 (pages 261 - 280)
  64. of the Programmer's Guide (version 6.0).
  65.  
  66.  
  67.  
  68.