free_pascal_programer_manual.pdf

(772 KB) Pobierz
42579175 UNPDF
FreePascal
Programmers’manual
Programmers’manualforFreePascal,version2.2
Documentversion2.0
August2007
MichaëlVanCanneyt
 
Contents
0.1Aboutthisdocument .................................. 12
1Compilerdirectives 13
1.1Localdirectives ..................................... 13
1.1.1 $A or $ALIGN :AlignData .......................... 13
1.1.2 $ASMMODE :Assemblermode(Intel80x86only) ............... 13
1.1.3 $B or $BOOLEVAL :Completebooleanevaluation .............. 14
1.1.4 $C or $ASSERTIONS :Assertionsupport ................... 14
1.1.5 $CALLING :Specifycallingconvention .................... 14
1.1.6 $CHECKPOINTER :Checkpointervalues ................... 15
1.1.7 $CODEALIGN :Setthecodealignment .................... 15
1.1.8 $COPERATORS :AllowClikeoperators ................... 16
1.1.9 $DEFINE :Defineasymbol .......................... 16
1.1.10 $ELSE :Switchconditionalcompilation ................... 17
1.1.11 $ELSEC :Switchconditionalcompilation ................... 17
1.1.12 $ENDC :Endconditionalcompilation ..................... 17
1.1.13 $ENDIF :Endconditionalcompilation .................... 17
1.1.14 $ERROR :Generateerrormessage ....................... 17
1.1.15 $EXTENDEDSYM :Ignored ........................... 17
1.1.16 $F :Farornearfunctions ........................... 18
1.1.17 $FATAL :Generatefatalerrormessage .................... 18
1.1.18 $FPUTYPE :Selectcoprocessortype ..................... 19
1.1.19 $GOTO :Support Goto and Label ...................... 19
1.1.20 $H or $LONGSTRINGS :UseAnsiStrings .................. 19
1.1.21 $HINT :Generatehintmessage ........................ 19
1.1.22 $HINTS :Emithints .............................. 20
1.1.23 $HPPEMIT :Ignored .............................. 20
1.1.24 $IF :Startconditionalcompilation ...................... 20
1.1.25 $IFC :Startconditionalcompilation ..................... 20
1.1.26 $IFDEFName :Startconditionalcompilation ................ 20
1.1.27 $IFNDEF :Startconditionalcompilation ................... 20
1
CONTENTS
1.1.28 $IFOPT :Startconditionalcompilation .................... 20
1.1.29 $IMPLICITEXCEPTIONS :Donotgeneratefinalizationcode ....... 21
1.1.30 $INFO :Generateinfomessage ........................ 21
1.1.31 $INLINE :Allowinlinecode. ......................... 21
1.1.32 $INTERFACES :SpecifyInterfacetype. ................... 21
1.1.33 $I or $IOCHECKS :Input/Outputchecking .................. 22
1.1.34 $I or $INCLUDE :Includefile ........................ 22
1.1.35 $I or $INCLUDE :Includecompilerinfo ................... 23
1.1.36 $I386_XXX :Specifyassemblerformat(Intel80x86only) ......... 23
1.1.37 $J or $WRITABLECONSTS :Allowtypedconsts .............. 24
1.1.38 $L or $LINK :Linkobjectfile ......................... 24
1.1.39 $LINKLIB :Linktoalibrary ......................... 24
1.1.40 $M or $TYPEINFO :Generatetypeinfo .................... 25
1.1.41 $MACRO :Allowuseofmacros. ........................ 25
1.1.42 $MAXFPUREGISTERS :MaximumnumberofFPUregistersforvariables . 25
1.1.43 $MESSAGE :Generateinfomessage ...................... 26
1.1.44 $MMX :IntelMMXsupport(Intel80x86only) ................ 26
1.1.45 $NODEFINE :Ignored ............................. 27
1.1.46 $NOTE :Generatenotemessage ........................ 27
1.1.47 $NOTES :Emitnotes .............................. 27
1.1.48 $OBJECTCHECK :CheckObject ....................... 27
1.1.49 $OUTPUT_FORMAT :Specifytheoutputformat ............... 27
1.1.50 $PACKENUM :Minimumenumerationtypesize ................ 27
1.1.51 $PACKRECORDS :Alignmentofrecordelements ............... 28
1.1.52 $Q$OVERFLOWCHECKS :Overflowchecking ................ 29
1.1.53 $R or $RANGECHECKS :Rangechecking ................... 29
1.1.54 $R or $RESOURCE :Includeresource ..................... 29
1.1.55 $SATURATION :Saturationoperations(Intel80x86only) .......... 30
1.1.56 $SETC :Defineandassignavaluetoasymbol ................ 30
1.1.57 $STATIC :Allowuseof Static keyword. ................. 30
1.1.58 $STOP :Generatefatalerrormessage ..................... 30
1.1.59 $T or $TYPEDADDRESS :Typedaddressoperator(@) ........... 30
1.1.60 $UNDEF :Undefineasymbol ......................... 31
1.1.61 $V or $VARSTRINGCHECKS :Var-stringchecking ............. 31
1.1.62 $W or $STACKFRAMES :Generatestackframes ................ 31
1.1.63 $WAIT :Waitforenterkeypress ....................... 31
1.1.64 $WARNING :Generatewarningmessage ................... 31
1.1.65 $WARNINGS :Emitwarnings ......................... 32
1.2Globaldirectives .................................... 32
1.2.1 $APPID :SpecifyapplicationID. ....................... 32
2
CONTENTS
1.2.2 $APPID :Specifyapplicationname. ..................... 32
1.2.3 $APPTYPE :Specifytypeofapplication. ................... 32
1.2.4 $CALLING :Defaultcallingconvention .................... 33
1.2.5 $CODEPAGE :Setthesourcecodepage .................... 34
1.2.6 $COPYRIGHT specifycopyrightinfo ..................... 34
1.2.7 $D or $DEBUGINFO :Debuggingsymbols .................. 34
1.2.8 $DESCRIPTION :Applicationdescription .................. 34
1.2.9 $D$DEBUGINFO :Includedebuginfo .................... 34
1.2.10 $E :Emulationofcoprocessor ......................... 34
Intel80x86version ............................... 34
Motorola680x0version ............................ 35
1.2.11 $G :Generate80286code ........................... 35
1.2.12 $INCLUDEPATH :Specifyincludepath. ................... 35
1.2.13 $INTERFACES :Defaultinterfacetype .................... 35
1.2.14 $L or $LOCALSYMBOLS :Localsymbolinformation ............ 35
1.2.15 $LIBRARYPATH :Specifylibrarypath. .................... 36
1.2.16 $M or $MEMORY :Memorysizes ........................ 36
1.2.17 $MODE :Setcompilercompatibilitymode ................... 36
1.2.18 $N :Numericprocessing ........................... 37
1.2.19 $O :Overlaycodegeneration ......................... 37
1.2.20 $OBJECTPATH :Specifyobjectpath. ..................... 37
1.2.21 $P or $OPENSTRINGS :Useopenstrings .................. 37
1.2.22 $PROFILE :Profiling ............................. 37
1.2.23 $S :Stackchecking .............................. 37
1.2.24 $SCREENNAME :Specifyscreenname .................... 38
1.2.25 $SMARTLINK :Usesmartlinking ....................... 38
1.2.26 $THREADNAME :SetthreadnameinNetware ................. 38
1.2.27 $THREADING :Allowuseofthreads. ..................... 38
1.2.28 $UNITPATH :Specifyunitpath. ....................... 38
1.2.29 $VERSION :SpecifyDLLversion. ...................... 39
1.2.30 $WEAKPACKAGEUNIT :ignored ....................... 39
1.2.31 $X or $EXTENDEDSYNTAX :Extendedsyntax ................ 39
1.2.32 $Y or $REFERENCEINFO :InsertBrowserinformation ........... 40
2Usingconditionals,messagesandmacros 41
2.1Conditionals ....................................... 41
2.1.1Predefinedsymbols ............................... 42
2.2Macros ......................................... 42
2.3Compiletimevariables ................................. 44
2.4Compiletimeexpressions ................................ 44
3
CONTENTS
2.4.1Definition .................................... 44
2.4.2Usage ...................................... 45
2.5Messages ........................................ 49
3UsingAssemblylanguage 51
3.1Usingassemblerinthesources ............................. 51
3.2Intel80x86Inlineassembler .............................. 52
3.2.1 Intelsyntax ................................... 52
3.2.2AT&TSyntax .................................. 55
3.3Motorola680x0Inlineassembler ............................ 56
3.4Signalingchangedregisters ............................... 57
4Generatedcode 58
4.1Units ........................................... 58
4.2Programs ........................................ 59
5IntelMMXsupport 60
5.1Whatisitabout? .................................... 60
5.2Saturationsupport .................................... 61
5.3RestrictionsofMMXsupport .............................. 61
5.4SupportedMMXoperations .............................. 62
5.5OptimizingMMXsupport ............................... 62
6Codeissues 63
6.1RegisterConventions .................................. 63
6.1.1accumulatorregister .............................. 63
6.1.2accumulator64-bitregister ........................... 63
6.1.3floatresultregister ............................... 63
6.1.4 selfregister ................................... 63
6.1.5 framepointerregister .............................. 63
6.1.6 stackpointerregister .............................. 64
6.1.7 scratchregisters ................................. 64
6.1.8Processormappingofregisters ......................... 64
Intel80x86version ............................... 64
Motorola680x0version ............................ 64
6.2Namemangling ..................................... 65
6.2.1Manglednamesfordatablocks ........................ 65
6.2.2Manglednamesforcodeblocks ........................ 66
6.2.3Modifyingthemanglednames ......................... 68
6.3Callingmechanism ................................... 68
6.4Nestedprocedureandfunctions ............................. 69
4
Zgłoś jeśli naruszono regulamin