Standard Units Reference Guide

Standard Units Reference Guide

Free Pascal : Reference guide. Reference guide for Free Pascal, version 1.0.6 1.9 April 2002 Michaël Van Canneyt Contents I The Pascal language 12 1 Pascal Tokens 13 1.1 Symbols ......................................... 13 1.2 Comments ........................................ 13 1.3 Reserved words ..................................... 14 Turbo Pascal reserved words .............................. 14 Delphi reserved words ................................. 15 Free Pascal reserved words ............................... 15 Modifiers ........................................ 15 1.4 Identifiers ........................................ 15 1.5 Numbers ......................................... 16 1.6 Labels .......................................... 16 1.7 Character strings .................................... 17 2 Constants 18 2.1 Ordinary constants ................................... 18 2.2 Typed constants ..................................... 18 2.3 Resource strings ..................................... 19 3 Types 21 3.1 Base types ........................................ 21 Ordinal types ...................................... 22 Integers ..................................... 22 Boolean types .................................. 23 Enumeration types ............................... 23 Subrange types ................................. 25 Real types ........................................ 26 3.2 Character types ..................................... 26 Char ........................................... 26 Strings .......................................... 26 Short strings ....................................... 27 1 CONTENTS Ansistrings ....................................... 27 Constant strings ..................................... 28 PChar .......................................... 29 3.3 Structured Types .................................... 30 Arrays .......................................... 30 Record types ...................................... 31 Set types ......................................... 34 File types ........................................ 35 3.4 Pointers ......................................... 35 3.5 Procedural types ..................................... 37 4 Objects 39 4.1 Declaration ....................................... 39 4.2 Fields .......................................... 40 4.3 Constructors and destructors .............................. 41 4.4 Methods ......................................... 42 4.5 Method invocation ................................... 42 Static methods ................................. 43 Virtual methods ................................. 43 Abstract methods ................................ 44 4.6 Visibility ........................................ 45 5 Classes 46 5.1 Class definitions ..................................... 46 5.2 Class instantiation .................................... 47 5.3 Methods ......................................... 48 invocation ........................................ 48 Virtual methods ..................................... 48 Message methods .................................... 48 5.4 Properties ........................................ 50 6 Expressions 54 6.1 Expression syntax .................................... 55 6.2 Function calls ...................................... 56 6.3 Set constructors ..................................... 57 6.4 Value typecasts ..................................... 58 6.5 The @ operator ..................................... 59 6.6 Operators ........................................ 59 Arithmetic operators .................................. 59 Logical operators .................................... 60 Boolean operators .................................... 60 2 CONTENTS String operators ..................................... 61 Set operators ...................................... 61 Relational operators ................................... 62 7 Statements 63 7.1 Simple statements .................................... 63 Assignments ....................................... 63 Procedure statements .................................. 64 Goto statements ..................................... 65 7.2 Structured statements .................................. 65 Compound statements .................................. 66 The Case statement .................................. 66 The If..then..else statement .......................... 67 The For..to/downto..do statement ....................... 68 The Repeat..until statement ........................... 69 The While..do statement .............................. 70 The With statement .................................. 70 Exception Statements .................................. 72 7.3 Assembler statements .................................. 72 8 Using functions and procedures 74 8.1 Procedure declaration .................................. 74 8.2 Function declaration .................................. 75 8.3 Parameter lists ...................................... 75 Value parameters .................................... 75 Variable parameters ................................... 76 Constant parameters ................................... 76 Open array parameters ................................. 77 Array of const ...................................... 77 8.4 Function overloading .................................. 79 8.5 Forward defined functions ............................... 80 8.6 External functions .................................... 81 8.7 Assembler functions .................................. 82 8.8 Modifiers ........................................ 82 alias ........................................... 82 cdecl ........................................... 83 export .......................................... 84 inline .......................................... 84 interrupt ......................................... 84 pascal .......................................... 84 popstack ......................................... 84 3 CONTENTS public .......................................... 84 register ......................................... 85 saveregisters ....................................... 85 safecall ......................................... 85 stdcall .......................................... 85 8.9 Unsupported Turbo Pascal modifiers .......................... 85 9 Operator overloading 87 9.1 Introduction ....................................... 87 9.2 Operator declarations .................................. 87 9.3 Assignment operators .................................. 88 9.4 Arithmetic operators .................................. 90 9.5 Comparision operator .................................. 91 10 Programs, units, blocks 93 10.1 Programs ........................................ 93 10.2 Units ........................................... 94 10.3 Blocks .......................................... 95 10.4 Scope .......................................... 96 Block scope ....................................... 96 Record scope ...................................... 97 Class scope ....................................... 97 Unit scope ........................................ 97 10.5 Libraries ......................................... 98 11 Exceptions 99 11.1 The raise statement ................................... 99 11.2 The try...except statement ................................ 100 11.3 The try...finally statement ................................ 101 11.4 Exception handling nesting ............................... 102 11.5 Exception classes .................................... 102 12 Using assembler 103 12.1 Assembler statements ................................. 103 12.2 Assembler procedures and functions .......................... 103 II Reference : The System unit 104 13 The system unit 105 13.1 Types, Constants and Variables ............................. 105 Types .......................................... 105 4 CONTENTS Constants ........................................ 108 Variables ........................................ 111 13.2 Function list by category ................................ 112 File handling ...................................... 112 Memory management .................................. 113 Mathematical routines ................................. 114 String handling ..................................... 114 Operating System functions ............................... 115 Miscellaneous functions ................................ 115 13.3 Functions and Procedures ................................ 115 Abs ........................................... 115 Addr ........................................... 116 Append ......................................... 116 Arctan .......................................... 117 Assign .......................................... 117 Assigned ........................................ 118 BinStr .......................................... 118 Blockread ........................................ 119 Blockwrite ........................................ 120 Break .......................................... 120 Chdir .......................................... 121 Chr ........................................... 121 Close .......................................... 122 CompareByte ...................................... 122 CompareChar ...................................... 123 CompareDWord ..................................... 124 CompareWord ...................................... 125 Concat .......................................... 126 Continue ......................................... 127 Copy ........................................... 128 Cos ........................................... 128 CSeg

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    189 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us