View
57
Download
1
Embed Size (px)
DESCRIPTION
Programmer manual
Free PascalProgrammers Guide
Programmers Guide for Free Pascal, Version 2.6.0Document version 2.6
December 2011
Michal Van Canneyt
Contents
1 Compiler directives 141.1 Local directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.1.1 $A or $ALIGN : Align Data . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.1.2 $A1, $A2,$A4 and $A8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.1.3 $ASMMODE : Assembler mode (Intel 80x86 only) . . . . . . . . . . . . . . . 15
1.1.4 $B or $BOOLEVAL : Complete boolean evaluation . . . . . . . . . . . . . . 16
1.1.5 $C or $ASSERTIONS : Assertion support . . . . . . . . . . . . . . . . . . . 16
1.1.6 $BITPACKING : Enable bitsize packing . . . . . . . . . . . . . . . . . . . 16
1.1.7 $CALLING : Specify calling convention . . . . . . . . . . . . . . . . . . . . 17
1.1.8 $CHECKPOINTER : Check pointer values . . . . . . . . . . . . . . . . . . . 17
1.1.9 $CODEALIGN : Set the code alignment . . . . . . . . . . . . . . . . . . . . 17
1.1.10 $COPERATORS : Allow C like operators . . . . . . . . . . . . . . . . . . . 18
1.1.11 $DEFINE or $DEFINEC : Define a symbol . . . . . . . . . . . . . . . . . . 19
1.1.12 $ELSE : Switch conditional compilation . . . . . . . . . . . . . . . . . . . 19
1.1.13 $ELSEC : Switch conditional compilation . . . . . . . . . . . . . . . . . . . 19
1.1.14 $ELSEIF or $ELIFC : Switch conditional compilation . . . . . . . . . . . 19
1.1.15 $ENDC : End conditional compilation . . . . . . . . . . . . . . . . . . . . . 20
1.1.16 $ENDIF : End conditional compilation . . . . . . . . . . . . . . . . . . . . 20
1.1.17 $ERROR or $ERRORC : Generate error message . . . . . . . . . . . . . . . 20
1.1.18 $EXTENDEDSYM: Ignored . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.1.19 $F : Far or near functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.1.20 $FATAL : Generate fatal error message . . . . . . . . . . . . . . . . . . . . 21
1.1.21 $FPUTYPE : Select coprocessor type . . . . . . . . . . . . . . . . . . . . . 21
1.1.22 $GOTO : Support Goto and Label . . . . . . . . . . . . . . . . . . . . . . 22
1.1.23 $H or $LONGSTRINGS : Use AnsiStrings . . . . . . . . . . . . . . . . . . 22
1.1.24 $HINT : Generate hint message . . . . . . . . . . . . . . . . . . . . . . . . 22
1.1.25 $HINTS : Emit hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.1.26 $HPPEMIT: Ignored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.1.27 $IF : Start conditional compilation . . . . . . . . . . . . . . . . . . . . . . 23
1.1.28 $IFC : Start conditional compilation . . . . . . . . . . . . . . . . . . . . . 23
1
CONTENTS
1.1.29 $IFDEF Name : Start conditional compilation . . . . . . . . . . . . . . . . 23
1.1.30 $IFNDEF : Start conditional compilation . . . . . . . . . . . . . . . . . . . 23
1.1.31 $IFOPT : Start conditional compilation . . . . . . . . . . . . . . . . . . . . 23
1.1.32 $IMPLICITEXCEPTIONS : Implicit finalization code generation . . . . . . 24
1.1.33 $INFO : Generate info message . . . . . . . . . . . . . . . . . . . . . . . . 24
1.1.34 $INLINE : Allow inline code. . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.1.35 $INTERFACES : Specify Interface type. . . . . . . . . . . . . . . . . . . . 24
1.1.36 $I or $IOCHECKS : Input/Output checking . . . . . . . . . . . . . . . . . . 25
1.1.37 $I or $INCLUDE : Include file . . . . . . . . . . . . . . . . . . . . . . . . 25
1.1.38 $I or $INCLUDE : Include compiler info . . . . . . . . . . . . . . . . . . . 26
1.1.39 $I386_XXX : Specify assembler format (Intel 80x86 only) . . . . . . . . . 26
1.1.40 $J or $WRITEABLECONST : Allow assignments to typed consts . . . . . . 27
1.1.41 $L or $LINK : Link object file . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.1.42 $LINKFRAMEWORK : Link to a framework . . . . . . . . . . . . . . . . . . 27
1.1.43 $LINKLIB : Link to a library . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.1.44 $M or $TYPEINFO : Generate type info . . . . . . . . . . . . . . . . . . . . 28
1.1.45 $MACRO : Allow use of macros. . . . . . . . . . . . . . . . . . . . . . . . . 29
1.1.46 $MAXFPUREGISTERS : Maximum number of FPU registers for variables . 29
1.1.47 $MESSAGE : Generate info message . . . . . . . . . . . . . . . . . . . . . . 29
1.1.48 $MINENUMSIZE : Specify minimum enumeration size . . . . . . . . . . . . 29
1.1.49 $MINFPCONSTPREC : Specify floating point constant precision . . . . . . . 29
1.1.50 $MMX : Intel MMX support (Intel 80x86 only) . . . . . . . . . . . . . . . . 30
1.1.51 $NODEFINE : Ignored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.1.52 $NOTE : Generate note message . . . . . . . . . . . . . . . . . . . . . . . . 31
1.1.53 $NOTES : Emit notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.1.54 $OBJECTCHECKS : Check Object . . . . . . . . . . . . . . . . . . . . . . 31
1.1.55 $OPTIMIZATION : Enable Optimizations . . . . . . . . . . . . . . . . . . 31
1.1.56 $OUTPUT_FORMAT : Specify the output format . . . . . . . . . . . . . . . 32
1.1.57 $PACKENUM or $Z : Minimum enumeration type size . . . . . . . . . . . . 32
1.1.58 $PACKRECORDS : Alignment of record elements . . . . . . . . . . . . . . . 33
1.1.59 $PACKSET : Specify set size . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.1.60 $POP : Restore compiler settings . . . . . . . . . . . . . . . . . . . . . . . 34
1.1.61 $PUSH : Save compiler settings . . . . . . . . . . . . . . . . . . . . . . . . 34
1.1.62 $Q or $OV or $OVERFLOWCHECKS: Overflow checking . . . . . . . . . . . 34
1.1.63 $R or $RANGECHECKS : Range checking . . . . . . . . . . . . . . . . . . . 35
1.1.64 $R or $RESOURCE : Include resource . . . . . . . . . . . . . . . . . . . . . 35
1.1.65 $SATURATION : Saturation operations (Intel 80x86 only) . . . . . . . . . . 35
1.1.66 $SETC : Define and assign a value to a symbol . . . . . . . . . . . . . . . . 35
1.1.67 $STATIC : Allow use of Static keyword. . . . . . . . . . . . . . . . . . 36
1.1.68 $STOP : Generate fatal error message . . . . . . . . . . . . . . . . . . . . . 36
2
CONTENTS
1.1.69 $T or $TYPEDADDRESS : Typed address operator (@) . . . . . . . . . . . 36
1.1.70 $UNDEF or $UNDEFC : Undefine a symbol . . . . . . . . . . . . . . . . . . 36
1.1.71 $V or $VARSTRINGCHECKS : Var-string checking . . . . . . . . . . . . . 37
1.1.72 $W or $STACKFRAMES : Generate stackframes . . . . . . . . . . . . . . . . 37
1.1.73 $WAIT : Wait for enter key press . . . . . . . . . . . . . . . . . . . . . . . 38
1.1.74 $WARNING : Generate warning message . . . . . . . . . . . . . . . . . . . 38
1.1.75 $WARNINGS : Emit warnings . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.1.76 $Z1, $Z2 and $Z4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.2 Global directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.2.1 $APPID : Specify application ID. . . . . . . . . . . . . . . . . . . . . . . . 38
1.2.2 $APPNAME : Specify application name. . . . . . . . . . . . . . . . . . . . . 39
1.2.3 $APPTYPE : Specify type of application. . . . . . . . . . . . . . . . . . . . 39
1.2.4 $CALLING : Default calling convention . . . . . . . . . . . . . . . . . . . . 40
1.2.5 $CODEPAGE : Set the source codepage . . . . . . . . . . . . . . . . . . . . 40
1.2.6 $COPYRIGHT specify copyright info . . . . . . . . . . . . . . . . . . . . . 40
1.2.7 $D or $DEBUGINFO : Debugging symbols . . . . . . . . . . . . . . . . . . 40
1.2.8 $DESCRIPTION : Application description . . . . . . . . . . . . . . . . . . 41
1.2.9 $E : Emulation of coprocessor . . . . . . . . . . . . . . . . . . . . . . . . . 41
Intel 80x86 version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Motorola 680x0 version . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.2.10 $G : Generate 80286 code . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.2.11 $INCLUDEPATH : Specify include path. . . . . . . . . . . . . . . . . . . . 41
1.2.12 $INTERFACES : Default interface type . . . . . . . . . . . . . . . . . . . . 42
1.2.13 $L or $LOCALSYMBOLS : Local symbol information . . . . . . . . . . . . 42
1.2.14 $LIBRARYPATH : Specify library path. . . . . . . . . . . . . . . . . . . . . 42
1.2.15 $M or $MEMORY : Memory sizes . . . . . . . . . . . . . . . . . . . . . . . . 42
1.2.16 $MODE : Set compiler compatibility mode . . . . . . . . . . . . . . . . . . . 43
1.2.17 $MODESWITCH : Select mode features . . . . . . . . . . . . . . . . . . . . 43
1.2.18 $N : Numeric processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.2.19 $O : Level 2 Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.2.20 $OBJECTPATH : Specify object path. . . . . . . . . . . . . . . . . . . . . . 45
1.2.21 $P or $OPENSTRINGS : Use open strings . . . . . . . . . . . . . . . . . . 45
1.2.22 $PASCALMAINNAME : Set entry point name . . . . . . . . . . . . . . . . . 45
1.2.23 $PIC : Generate PIC code or not . . . . . . . . . . . . . . . . . . . . . . . 45
1.2.24 $PROFILE : Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
1.2.25 $S : Stack checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
1.2.26 $SCREENNAME : Specify screen name . . .