The GNU Pascal Manual (original) (raw)
Table of Contents
- GNU Pascal
- Welcome to GNU Pascal ...
- 1 Some of GPC's most interesting features.
- 2 New Features of GNU Pascal.
- 3 The GNU Pascal Frequently Asked Questions List.
- 3.1 GNU Pascal
* 3.1.1 What and why?
* 3.1.2 What is the current version?
* 3.1.3 Is it compatible with Turbo Pascal (R)?
* 3.1.4 Which platforms are supported by GNU Pascal? - 3.2 Installing GPC
* 3.2.1 What to read next
* 3.2.2 Which components do I need to compile Pascal code?
* 3.2.3 How do I debug my Pascal programs?
* 3.2.4 What additional libraries should I have?
* 3.2.5 Contributed units
* 3.2.6 Can you recommend an IDE? - 3.3 GNU Pascal on the DJGPP (MS-DOS) platform
* 3.3.1 What is DJGPP?
* 3.3.2 If you need more information
* 3.3.3 What do I download?
* 3.3.4 How do I install the compiler?
* 3.3.5 I cannot read the Info documentation!
* 3.3.6 GPC says: no DPMI
* 3.3.7 I have troubles with assembly code
* 3.3.8 Tell me how to do DPMI, BIOS and other DOS related things.
* 3.3.9 I got an exception when accessing an array [1 .. 4000000] of Byte. - 3.4 Strings
* 3.4.1 What's this confusion about strings?
* 3.4.2 Overlaying strings in variant records
* 3.4.3 Why does s[0] not contain the length?
* 3.4.4 Watch out when using strings as parameters
* 3.4.5 Support for BP compatible short strings
* 3.4.6 What about C strings? - 3.5 Getting Help
- 3.6 Miscellaneous
* 3.6.1 I want to contribute; where do I start?
* 3.6.2 Where is the GNU Pascal web site?
* 3.6.3 About this FAQ
- 3.1 GNU Pascal
- 4 How to download, compile and install GNU Pascal.
- 4.1 Where and what to download
- 4.2 Installation instructions for a GPC binary distribution
- 4.3 Compiling GPC
- 4.4 Compilation notes for specific platforms
* 4.4.1 MS-DOS with DJGPP
* 4.4.2 MS-DOS or OS/2 with EMX
* 4.4.3 MS Windows 95/98/NT - 4.5 Building and Installing a cross-compiler
- 4.6 Crossbuilding a compiler
- 5 Command Line Options supported by GNU Pascal.
- 6 The Programmer's Guide to GPC
- 6.1 Source Structures
* 6.1.1 The Source Structure of Programs
* 6.1.2 Label Declaration
* 6.1.3 Constant Declaration
* 6.1.4 Type Declaration
* 6.1.5 Variable Declaration
* 6.1.6 Subroutine Declaration
* 6.1.6.1 The Procedure
* 6.1.6.2 The Function
* 6.1.6.3 The Operator
* 6.1.6.4 Subroutine Parameter List Declaration
* 6.1.7 Statements
* 6.1.7.1 Assignment
* 6.1.7.2 begin end Compound Statement
* 6.1.7.3 if Statement
* 6.1.7.4 case Statement
* 6.1.7.5 for Statement
* 6.1.7.6 while Statement
* 6.1.7.7 repeat Statement
* 6.1.7.8 asm Inline
* 6.1.7.9 with Statement
* 6.1.7.10 goto Statement
* 6.1.7.11 Procedure Call
* 6.1.7.12 The Declaring Statement
* 6.1.7.13 Loop Control Statements
* 6.1.8 Import Part and Module/Unit Concept
* 6.1.8.1 The Source Structure of ISO 10206 Extended Pascal Modules
* 6.1.8.2 The Source Structure of UCSD/Borland Pascal Units - 6.2 Data Types
* 6.2.1 Type Definition
* 6.2.2 Ordinal Types
* 6.2.3 Integer Types
* 6.2.3.1 The CPU's Natural Integer Types
* 6.2.3.2 The Main Branch of Integer Types
* 6.2.3.3 Integer Types with Specified Size
* 6.2.3.4 Integer Types and Compatibility
* 6.2.3.5 Summary of Integer Types
* 6.2.4 Built-in Real (Floating Point) Types
* 6.2.5 Strings Types
* 6.2.6 Character Types
* 6.2.7 Enumerated Types
* 6.2.8 File Types
* 6.2.9 Boolean (Intrinsic)
* 6.2.10 Pointer (Intrinsic)
* 6.2.11 Type Definition Possibilities
* 6.2.11.1 Subrange Types
* 6.2.11.2 Array Types
* 6.2.11.3 Record Types
* 6.2.11.4 Variant Records
* 6.2.11.5 EP's Schema Types including String
* 6.2.11.6 Set Types
* 6.2.11.7 Pointer Types
* 6.2.11.8 Procedural and Functional Types
* 6.2.11.9 Object Types
* 6.2.11.10 Initial values to type denoters
* 6.2.11.11 Restricted Types
* 6.2.12 Machine-dependencies in Types
* 6.2.12.1 Endianness
* 6.2.12.2 Alignment - 6.3 Operators
* 6.3.1 Built-in Operators
* 6.3.2 User-defined Operators - 6.4 Procedure And Function Parameters
* 6.4.1 Parameters declared as protected or const
* 6.4.2 The Standard way to pass arrays of variable size
* 6.4.3 BP's alternative to Conformant Arrays - 6.5 Accessing parts of strings (and other arrays)
- 6.6 Pointer Arithmetics
- 6.7 Type Casts
- 6.8 Object-Oriented Programming
- 6.9 Compiler Directives And The Preprocessor
- 6.10 Routines Built-in or in the Run Time System
* 6.10.1 File Routines
* 6.10.2 String Operations
* 6.10.3 Accessing Command Line Arguments
* 6.10.4 Memory Management Routines
* 6.10.5 Operations for Integer and Ordinal Types
* 6.10.6 Complex Number Operations
* 6.10.7 Set Operations
* 6.10.8 Date And Time Routines - 6.11 Interfacing with Other Languages
* 6.11.1 Importing Libraries from Other Languages
* 6.11.2 Exporting GPC Libraries to Other Languages - 6.12 Notes for Debugging
- 6.13 How to use I18N in own programs
- 6.14 Pascal declarations for GPC's Run Time System
- 6.15 Units included with GPC
* 6.15.1 BP compatibility: CRT & WinCRT, portable, with many extensions
* 6.15.2 BP compatibility: Dos
* 6.15.3 Overcome some differences between Dos and Unix
* 6.15.4 Higher level file and directory handling
* 6.15.5 Arithmetic with unlimited size and precision
* 6.15.6 Turbo Power compatibility, etc.
* 6.15.7 Primitive heap checking
* 6.15.8 Internationalization
* 6.15.9 MD5 Message Digests
* 6.15.10 BP compatibility: Overlay
* 6.15.11 Start a child process, connected with pipes, also on Dos
* 6.15.12 BP compatibility (partly): Port, PortW arrays
* 6.15.13 BP compatibility: Printer, portable
* 6.15.14 Regular Expression matching and substituting
* 6.15.15 BP compatibility: Strings
* 6.15.16 Higher level string handling
* 6.15.17 BP compatibility: System
* 6.15.18 Some text file tricks
* 6.15.19 Trap runtime errors
* 6.15.20 BP compatibility: Turbo3
* 6.15.21 BP compatibility: WinDos
- 6.1 Source Structures
- 7 A QuickStart Guide from Borland Pascal to GNU Pascal.
- 7.1 BP Compatibility
- 7.2 BP Incompatibilities
* 7.2.1 String type
* 7.2.2 Qualified identifiers
* 7.2.3 Assembler
* 7.2.4 Move; FillChar
* 7.2.5 Real type
* 7.2.6 Graph unit
* 7.2.7 OOP units
* 7.2.8 Keep; GetIntVec; SetIntVec
* 7.2.9 TFDDs
* 7.2.10 Mem; Port; Ptr; Seg; Ofs; PrefixSeg; etc.
* 7.2.11 Endianness assumptions
* 7.2.12 - -borland-pascal - disable GPC extensions
* 7.2.13 -w - disable all warnings
* 7.2.14 - -uses=System - Swap; HeapError; etc.
* 7.2.15 -D__BP_TYPE_SIZES__ - small integer types etc.
* 7.2.16 - -pack-struct - disable structure alignment
* 7.2.17 -D__BP_RANDOM__ - BP compatible pseudo random number generator
* 7.2.18 -D__BP_UNPORTABLE_ROUTINES__ - Intr; DosVersion; etc.
* 7.2.19 -D__BP_PARAMSTR_0__ - BP compatible ParamStr (0) behaviour - 7.3 IDE versus command line
- 7.4 Comments
- 7.5 BP Compatible Compiler Directives
- 7.6 Units, GPI files and Automake
- 7.7 Optimization
- 7.8 Debugging
- 7.9 Objects
- 7.10 Strings in BP and GPC
- 7.11 Typed Constants
- 7.12 Bit, Byte and Memory Manipulation
- 7.13 User-defined Operators in GPC
- 7.14 Data Types in BP and GPC
- 7.15 BP Procedural Types
- 7.16 Files
- 7.17 Built-in Constants
- 7.18 Built-in Operators in BP and GPC
- 7.19 Built-in Procedures and Functions
- 7.20 Special Parameters
- 7.21 Miscellaneous
- 7.22 BP and Extended Pascal
- 7.23 Portability hints
- 8 The Alphabetical GPC Language Reference
- Abs
- absolute
- abstract
- Addr
- AlignOf
- all
- and
- and then
- and_then
- AnsiChar
- AnyFile
- Append
- ArcCos
- ArcSin
- ArcTan
- Arg
- array
- as
- asm
- asmname
- Assert
- Assign
- Assigned
- attribute
- begin
- Bind
- bindable
- Binding
- BindingType
- BitSizeOf
- BlockRead
- BlockWrite
- Boolean
- Break
- Byte
- ByteBool
- ByteCard
- ByteInt
- c
- Card
- Cardinal
- case
- CBoolean
- CCardinal
- Char
- ChDir
- Chr
- CInteger
- c_language
- class
- Close
- Cmplx
- Comp
- CompilerAssert
- Complex
- Concat
- Conjugate
- const
- constructor
- Continue
- Copy
- Cos
- CString
- CString2String
- CStringCopyString
- CurrentRoutineName
- CWord
- Cycle
- Date
- Dec
- DefineSize
- Delete
- destructor
- Discard
- Dispose
- div
- do
- Double
- downto
- else
- Empty
- end
- EOF
- EOLn
- EpsReal
- EQ
- EQPad
- Erase
- Exclude
- Exit
- Exp
- export
- exports
- Extend
- Extended
- external
- Fail
- False
- far
- file
- FilePos
- FileSize
- FillChar
- finalization
- Finalize
- Flush
- for
- FormatString
- forward
- Frac
- FrameAddress
- FreeMem
- function
- GE
- GEPad
- Get
- GetMem
- GetTimeStamp
- goto
- GT
- GTPad
- Halt
- High
- if
- Im
- implementation
- import
- in
- Inc
- Include
- Index
- inherited
- initialization
- Initialize
- InOutRes
- Input
- Insert
- Int
- Integer
- interface
- interrupt
- IOResult
- is
- label
- LastPosition
- LE
- Leave
- Length
- LEPad
- library
- Ln
- LoCase
- LongBool
- LongCard
- LongestBool
- LongestCard
- LongestInt
- LongestReal
- LongestWord
- LongInt
- LongReal
- LongWord
- Low
- LT
- LTPad
- Mark
- Max
- MaxChar
- MaxInt
- MaxReal
- MedBool
- MedCard
- MedInt
- MedReal
- MedWord
- Min
- MinReal
- MkDir
- mod
- module
- Move
- MoveLeft
- MoveRight
- name
- NE
- near
- NEPad
- New
- NewCString
- nil
- not
- Null
- object
- Odd
- of
- only
- operator
- or
- Ord
- or else
- or_else
- otherwise
- Output
- Pack
- packed
- Page
- PAnsiChar
- ParamCount
- ParamStr
- PChar
- Pi
- PObjectType
- Pointer
- Polar
- Pos
- Position
- pow
- Pred
- private
- procedure
- program
- property
- protected
- PtrCard
- PtrDiffType
- PtrInt
- PtrWord
- public
- published
- Put
- qualified
- Random
- Randomize
- Re
- Read
- ReadLn
- ReadStr
- Real
- record
- Release
- Rename
- repeat
- Reset
- resident
- restricted
- Result
- Return
- ReturnAddress
- Rewrite
- RmDir
- Round
- RunError
- Seek
- SeekEOF
- SeekEOLn
- SeekRead
- SeekUpdate
- SeekWrite
- segment
- Self
- set
- SetFileTime
- SetLength
- SetType
- shl
- ShortBool
- ShortCard
- ShortInt
- ShortReal
- ShortWord
- shr
- Sin
- Single
- SizeOf
- SizeType
- SmallInt
- Sqr
- SqRt
- StandardError
- StandardInput
- StandardOutput
- StdErr
- Str
- String
- String2CString
- SubStr
- Succ
- Text
- then
- Time
- TimeStamp
- to
- to begin do
- to end do
- Trim
- True
- Trunc
- Truncate
- type
- type of
- TypeOf
- Unbind
- unit
- Unpack
- until
- UpCase
- Update
- uses
- Val
- value
- var
- view
- virtual
- Void
- while
- with
- Word
- WordBool
- Write
- WriteLn
- WriteStr
- xor
- 9 Pascal keywords and operators supported by GNU Pascal.
- 10 Where to get support for GNU Pascal; how to report bugs.
- 11 The GNU Pascal To-Do List.
- 12 The GPC Source Reference
- 12.1 The Pascal preprocessor
- 12.2 GPC's Lexical Analyzer
* 12.2.1 Lexer problems
* 12.2.2 BP character constants
* 12.2.3 Compiler directives internally - 12.3 Syntax parsing: GPC's Parser
* 12.3.1 Conflicts in the Pascal syntax
* 12.3.2 So many keywords, so many problems ...
* 12.3.3 forward, near and far as weak keywords - 12.4 Tree Nodes
- 12.5 Parameter Passing
- 12.6 GPI files – GNU Pascal Interfaces
- 12.7 GPC's Automake Mechanism – How it Works
- 12.8 Files that make up GPC
- 12.9 Planned features
- Appendix A GNU GENERAL PUBLIC LICENSE
- Appendix B GNU LESSER GENERAL PUBLIC LICENSE
- Appendix C DEMO COPYING
- Appendix D Contributors to GNU Pascal.
- Appendix E Resources For Use With GPC.
- Appendix F The GNU Project.
- F.1 The GNU Manifesto
* F.1.1 What's GNU? Gnu's Not Unix!
* F.1.2 Why I Must Write GNU
* F.1.3 Why GNU Will Be Compatible with Unix
* F.1.4 How GNU Will Be Available
* F.1.5 Why Many Other Programmers Want to Help
* F.1.6 How You Can Contribute
* F.1.7 Why All Computer Users Will Benefit
* F.1.8 Some Easily Rebutted Objections to GNU's Goals - F.2 Funding Free Software
- F.1 The GNU Manifesto
- Index-GPC
GNU Pascal
This manual documents how to run, install and maintain the GNU Pascal Compiler (GPC), as well as its new features and incompatibilities, and how to report bugs. It corresponds to GPC 20050331 (GCC 2.8.1, 2.95.x, 3.2.x, 3.3.x or 3.4.x).
Introduction:
Installation:
Using GNU Pascal:
Development:
Licenses:
Appendix: