free_pascal_user_manual.pdf

(882 KB) Pobierz
42575949 UNPDF
FreePascal:
Users’manual
Users’manualforFreePascal,version2.2
Documentversion2.0
August2007
MichaëlVanCanneyt
FlorianKlämpfl
 
Contents
1Introduction 7
1.1Aboutthisdocument .................................. 7
1.2Aboutthecompiler ................................... 7
1.3Gettingmoreinformation. ............................... 8
2Installingthecompiler 9
2.1BeforeInstallation:Requirements ........................... 9
2.1.1Hardwarerequirements ............................. 9
2.1.2Softwarerequirements ............................. 9
UnderDOS ................................... 9
UnderUNIX .................................. 9
UnderWindows ................................ 10
UnderOS/2 ................................... 10
UnderMacOSX ................................ 10
2.2Installingthecompiler. ................................. 10
2.2.1 InstallingunderDOS,WindowsorOS/2 .................... 10
Mandatoryinstallationsteps. .......................... 10
OptionalInstallation:Thecoprocessoremulation ............... 11
2.2.2 InstallingunderLinux ............................. 12
Mandatoryinstallationsteps. .......................... 12
2.3Optionalconfigurationsteps .............................. 13
2.4Beforecompiling .................................... 14
2.5Testingthecompiler .................................. 14
3Compilerusage 15
3.1Filesearching ...................................... 15
3.1.1Commandlinefiles ............................... 15
3.1.2Unitfiles .................................... 15
3.1.3 Includefiles ................................... 17
3.1.4Objectfiles ................................... 18
3.1.5Configurationfile ................................ 18
1
CONTENTS
3.1.6Aboutlongfilenames .............................. 19
3.2Compilingaprogram .................................. 19
3.3Compilingaunit .................................... 19
3.4Units,librariesandsmartlinking ............................ 20
3.5Reducingthesizeofyourprogram ........................... 20
4Compilingproblems 21
4.1Generalproblems .................................... 21
4.2ProblemsyoumayencounterunderDOS ....................... 21
5Compilerconfiguration 22
5.1Usingthecommand-lineoptions ............................ 22
5.1.1Generaloptions ................................. 22
5.1.2Optionsforgettingfeedback .......................... 23
5.1.3Optionsconcerningfilesanddirectories .................... 23
5.1.4Optionscontrollingthekindofoutput. ..................... 24
5.1.5Optionsconcerningthesources(languageoptions) .............. 28
5.2Usingtheconfigurationfile ............................... 29
5.2.1#IFDEF ..................................... 30
5.2.2#IFNDEF .................................... 30
5.2.3#ELSE ..................................... 30
5.2.4#ENDIF ..................................... 31
5.2.5#DEFINE .................................... 31
5.2.6#UNDEF .................................... 31
5.2.7#WRITE .................................... 31
5.2.8#INCLUDE ................................... 32
5.2.9#SECTION ................................... 32
5.3Variablesubstitutioninpaths .............................. 32
6TheIDE 34
6.1FirststepswiththeIDE ................................. 34
6.1.1StartingtheIDE ................................ 34
6.1.2 IDECommandlineoptions .......................... 34
6.1.3TheIDEscreen ................................. 35
6.2NavigatingintheIDE .................................. 36
6.2.1Usingthekeyboard ............................... 36
6.2.2Usingthemouse ................................ 36
6.2.3Navigatingindialogs .............................. 37
6.3Windows ........................................ 37
6.3.1Windowbasics ................................. 37
6.3.2Sizingandmovingwindows .......................... 38
2
CONTENTS
6.3.3Workingwithmultiplewindows ........................ 38
6.3.4Dialogwindows ................................ 39
6.4TheMenu ........................................ 39
6.4.1Accessingthemenu .............................. 40
6.4.2TheFilemenu ................................. 40
6.4.3TheEditmenu ................................. 40
6.4.4TheSearchmenu ................................ 41
6.4.5TheRunmenu ................................. 42
6.4.6TheCompilemenu ............................... 42
6.4.7TheDebugmenu ................................ 43
6.4.8TheToolsmenu ................................. 43
6.4.9TheOptionsmenu ............................... 43
6.4.10TheWindowmenu ............................... 44
6.4.11TheHelpmenu ................................. 45
6.5Editingtext ....................................... 45
6.5.1 Insertmodes .................................. 45
6.5.2Blocks ..................................... 46
6.5.3Settingbookmarks ............................... 46
6.5.4 Jumpingtoasourceline ............................ 47
6.5.5Syntaxhighlighting ............................... 47
6.5.6CodeCompletion ................................ 48
6.5.7CodeTemplates ................................. 48
6.6Searchingandreplacing ................................. 50
6.7Thesymbolbrowser ................................... 51
6.8Runningprograms ................................... 53
6.9Debuggingprograms .................................. 54
6.9.1Usingbreakpoints ............................... 54
6.9.2Usingwatches ................................. 56
6.9.3Thecallstack .................................. 56
6.9.4TheGDBwindow ............................... 57
6.10UsingTools ....................................... 58
6.10.1Themessageswindow ............................. 58
6.10.2Grep ....................................... 58
6.10.3TheASCIItable ................................ 59
6.10.4Thecalculator .................................. 59
6.10.5Addingnewtools ................................ 60
6.10.6Metaparameters ................................ 61
6.10.7Buildingacommandlinedialogbox ...................... 63
6.11Projectmanagementandcompileroptions ....................... 66
6.11.1Theprimaryfile ................................. 66
3
CONTENTS
6.11.2Thedirectorydialog .............................. 66
6.11.3Thetargetoperatingsystem .......................... 67
6.11.4Compileroptions ................................ 67
6.11.5Linkeroptions ................................. 72
6.11.6Memorysizes .................................. 73
6.11.7Debugoptions ................................. 73
6.11.8Theswitchesmode ............................... 74
6.12CustomizingtheIDE .................................. 75
6.12.1Preferences ................................... 75
6.12.2Thedesktop ................................... 76
6.12.3TheEditor ................................... 77
6.12.4Mouse ...................................... 78
6.12.5Colors ...................................... 79
6.13Thehelpsystem ..................................... 80
6.13.1Navigatinginthehelpsystem ......................... 81
6.13.2Workingwithhelpfiles ............................. 81
6.13.3Theaboutdialog ................................ 82
6.14Keyboardshortcuts ................................... 82
7PortingandPortablecode 87
7.1TurboPascal ....................................... 87
7.1.1Thingsthatwillnotwork ............................ 87
7.1.2Thingswhichareextra ............................. 88
7.1.3TurboPascalcompatibilitymode ........................ 90
7.1.4Anoteonlongfilenamesunder DOS ..................... 92
7.2PortingDelphiCode .................................. 92
7.2.1Missinglanguageconstructs .......................... 92
7.2.2Missingcalls/APIincompatibilities ...................... 93
7.2.3Bestpracticesforporting ............................ 94
7.3Writingportablecode .................................. 94
8UtilitiesthatcomewithFreePascal 96
8.1Demoprogramsandexamples ............................. 96
8.2fpcmake ......................................... 96
8.3fpdoc-PascalUnitdocumenter ............................. 96
8.4h2pas-CheadertoPascalUnitconverter ....................... 97
8.4.1Options ..................................... 97
8.4.2Constructs ................................... 97
8.5h2paspp-preprocessorforh2pas ............................ 99
8.5.1Usage ...................................... 99
8.5.2Options ..................................... 99
4
Zgłoś jeśli naruszono regulamin