Irie Pascal Programmer's Reference Manual

Author: Stuart King

TABLE OF CONTENTS

1 Introduction
    1.1 Preface
    1.2 Compliance statement
2 Language Elements
    2.1 What are language elements?
    2.2 Character literals
    2.3 Reserved words
    2.4 Separators
    2.5 Compiler directives
    2.6 Special symbols
    2.7 String literals
    2.8 Numbers
        2.8.1 Integers
            2.8.1.1 What are integers?
            2.8.1.2 Integers (Decimal notation)
            2.8.1.3 Integers (Hexadecimal notation)
            2.8.1.4 Integers (Binary notation)
        2.8.2 Real numbers
            2.8.2.1 What are real numbers?
    2.9 Identifiers
        2.9.1 What are identifiers?
        2.9.2 Built-in identifiers
        2.9.3 User defined/declared identifiers
        2.9.4 Directives
            2.9.4.1 What are directives?
            2.9.4.2 The external directive
            2.9.4.3 The forward directive
3 Labels
    3.1 What are labels?
4 Constants
    4.1 What are constants?
    4.2 Built-in Constant Identifiers
        4.2.1 What are built-in constant identifiers
        4.2.2 appendmode
        4.2.3 dir_bit
        4.2.4 false
        4.2.5 feature_calldll - calling DLLs supported?
        4.2.6 feature_closedir - closedir supported?
        4.2.7 feature_clrscr - clrscr supported?
        4.2.8 feature_delay - delay supported?
        4.2.9 feature_gotoxy - gotoxy supported?
        4.2.10 feature_idispatch - COM/ActiveX objects supported?
        4.2.11 feature_intr - intr supported?
        4.2.12 feature_keypressed - keypressed supported?
        4.2.13 feature_mysql - MySQL databases supported?
        4.2.14 feature_odbc - ODBC databases supported?
        4.2.15 feature_opendir - opendir supported?
        4.2.16 feature_popen - popen supported?
        4.2.17 feature_readdir - readdir supported?
        4.2.18 feature_readkey - readkey supported?
        4.2.19 feature_rewinddir - rewinddir supported?
        4.2.20 feature_textbackground - textbackground supported?
        4.2.21 feature_textcolor - textcolor supported?
        4.2.22 feature_wherex - wherex supported?
        4.2.23 feature_wherey - wherey supported?
        4.2.24 grp_r
        4.2.25 grp_w
        4.2.26 grp_x
        4.2.27 maxbyte
        4.2.28 maxchar
        4.2.29 maxint
        4.2.30 maxword
        4.2.31 nil
        4.2.32 oth_r
        4.2.33 oth_w
        4.2.34 oth_x
        4.2.35 platform_dos
        4.2.36 platform_error
        4.2.37 platform_fbsd
        4.2.38 platform_linux
        4.2.39 platform_os2
        4.2.40 platform_solaris
        4.2.41 platform_solaris_sparc
        4.2.42 platform_win32
        4.2.43 readmode
        4.2.44 rsdefault
        4.2.45 rsdynamic
        4.2.46 rsforward
        4.2.47 rskeyset
        4.2.48 rsstatic
        4.2.49 sql_tc_all
        4.2.50 sql_tc_ddl_commit
        4.2.51 sql_tc_ddl_ignore
        4.2.52 sql_tc_dml
        4.2.53 sql_tc_none
        4.2.54 true
        4.2.55 usr_r
        4.2.56 usr_w
        4.2.57 usr_x
        4.2.58 writemode
        4.2.59 Feature Constants
            4.2.59.1 The feature constants
        4.2.60 File Mode
            4.2.60.1 The file mode constants
        4.2.61 Permission Constants
            4.2.61.1 The permission constants
        4.2.62 Platform Constants
            4.2.62.1 The platform constants
        4.2.63 Recordset Type Constants
            4.2.63.1 The recordset type constants
    4.3 User Defined Constant Identifiers
        4.3.1 Constant definitions
5 Types
    5.1 What are types?
    5.2 Array types
    5.3 Enumerated types
    5.4 File types
    5.5 Integral types
    5.6 List types
    5.7 Ordinal types
    5.8 Pointer types
    5.9 Record types
    5.10 Set types
    5.11 String types
    5.12 Subrange types
    5.13 Variant Types
    5.14 Object Types
        5.14.1 What are object types?
        5.14.2 Generic objects
    5.15 Built-in Type Identifiers
        5.15.1 The built-in type identifiers
        5.15.2 address type
        5.15.3 binary type
        5.15.4 boolean type
        5.15.5 byte type
        5.15.6 char type
        5.15.7 dir type
        5.15.8 double type
        5.15.9 error type
        5.15.10 filename type
        5.15.11 integer type
        5.15.12 real type
        5.15.13 registers type
        5.15.14 regtype type
        5.15.15 shortint type
        5.15.16 shortword type
        5.15.17 single type
        5.15.18 text type
        5.15.19 word type
        5.15.20 Connection Type
            5.15.20.1 The connection type
            5.15.20.2 connection.close
            5.15.20.3 connection.execute
            5.15.20.4 connection.open
            5.15.20.5 connection.selectdatabase
            5.15.20.6 connection.databasename
            5.15.20.7 connection.dbmsname
            5.15.20.8 connection.dbmsver
            5.15.20.9 connection.dmver
            5.15.20.10 connection.odbcver
            5.15.20.11 connection.procedures
            5.15.20.12 connection.readonly
            5.15.20.13 connection.transactions
            5.15.20.14 connection.transsupport
        5.15.21 Recordset Type
            5.15.21.1 The recordset type
            5.15.21.2 recordset.close
            5.15.21.3 recordset.moreresults
            5.15.21.4 recordset.movenext
            5.15.21.5 recordset.open
            5.15.21.6 recordset.eof
            5.15.21.7 recordset.field
    5.16 User Defined Type Identifiers
        5.16.1 Type definitions
6 Variables
    6.1 What are variables?
    6.2 Named variables
    6.3 Anonymous variables
    6.4 Array variables
    6.5 Buffer variables
    6.6 File variables
    6.7 List variables
    6.8 Object variables
    6.9 Pointer variables
    6.10 Record variables
    6.11 Set variables
    6.12 String variables
    6.13 Built-in Variable Identifiers
        6.13.1 The built-in variable identifiers
        6.13.2 errors
        6.13.3 exitcode
        6.13.4 input
        6.13.5 null
        6.13.6 output
    6.14 User Declared Variable Identifiers
        6.14.1 Variable Declarations
7 Functions And Procedures
    7.1 What are functions and procedures?
    7.2 Built-in Functions
        7.2.1 The built-in functions
        7.2.2 The abs function
        7.2.3 The addr function
        7.2.4 The arctan function
        7.2.5 The chr function
        7.2.6 The concat function
        7.2.7 The copy function
        7.2.8 The copyword function
        7.2.9 The cos function
        7.2.10 The cosh function
        7.2.11 The countwords function
        7.2.12 The createobject function
        7.2.13 The dirsep function
        7.2.14 The eof function
        7.2.15 The eoln function
        7.2.16 The exp function
        7.2.17 The fexpand function
        7.2.18 The filematch function
        7.2.19 The filepos function
        7.2.20 The filesize function
        7.2.21 The frac function
        7.2.22 The getenv function
        7.2.23 The getlasterror function
        7.2.24 The hex function
        7.2.25 The int function
        7.2.26 The ioresult function
        7.2.27 The isalpha function
        7.2.28 The isalphanum function
        7.2.29 The isdigit function
        7.2.30 The islower function
        7.2.31 The isnull function
        7.2.32 The isprint function
        7.2.33 The isspace function
        7.2.34 The isupper function
        7.2.35 The isxdigit function
        7.2.36 The keypressed function
        7.2.37 The length function
        7.2.38 The ln function
        7.2.39 The log function
        7.2.40 The locase function
        7.2.41 The lowercase function
        7.2.42 The odd function
        7.2.43 The ord function
        7.2.44 The paramcount function
        7.2.45 The paramstr function
        7.2.46 The pi function
        7.2.47 The platform function
        7.2.48 The pos function
        7.2.49 The pred function
        7.2.50 The ptr function
        7.2.51 The random function
        7.2.52 The readkey function
        7.2.53 The reverse function
        7.2.54 The round function
        7.2.55 The sin function
        7.2.56 The sinh function
        7.2.57 The sizeof function
        7.2.58 The sqr function
        7.2.59 The sqrt function
        7.2.60 The stopserverviceevent function
        7.2.61 The succ function
        7.2.62 The supported function
        7.2.63 The swap function
        7.2.64 The system function
        7.2.65 The tan function
        7.2.66 The tanh function
        7.2.67 The trim function
        7.2.68 The trunc function
        7.2.69 The unixplatform function
        7.2.70 The upcase function
        7.2.71 The uppercase function
        7.2.72 The urldecode function
        7.2.73 The version function
        7.2.74 The wait function
        7.2.75 The wherex function
        7.2.76 The wherey function
    7.3 User Declared Functions
        7.3.1 Function declarations
    7.4 Built-in Procedures
        7.4.1 The built-in procedures
        7.4.2 The append procedure
        7.4.3 The assert procedure
        7.4.4 The assign procedure
        7.4.5 The chdir procedure
        7.4.6 The close procedure
        7.4.7 The closedir procedure
        7.4.8 The clrscr procedure
        7.4.9 The crc32 procedure
        7.4.10 The dec procedure
        7.4.11 The delay procedure
        7.4.12 The delete procedure
        7.4.13 The dispose procedure
        7.4.14 The erase procedure
        7.4.15 The exec procedure
        7.4.16 The exit procedure
        7.4.17 The fill procedure
        7.4.18 The flush procedure
        7.4.19 The fsplit procedure
        7.4.20 The get procedure
        7.4.21 The getdate procedure
        7.4.22 The getfiledate procedure
        7.4.23 The getfilemode procedure
        7.4.24 The getfiletime procedure
        7.4.25 The gettime procedure
        7.4.26 The gotoxy procedure
        7.4.27 The halt procedure
        7.4.28 The inc procedure
        7.4.29 The insert procedure
        7.4.30 The intr procedure
        7.4.31 The mkdir procedure
        7.4.32 The move procedure
        7.4.33 The msdos procedure
        7.4.34 The new procedure
        7.4.35 The open procedure
        7.4.36 The opendir procedure
        7.4.37 The pack procedure
        7.4.38 The page procedure
        7.4.39 The popen procedure
        7.4.40 The put procedure
        7.4.41 The randomize procedure
        7.4.42 The rawread procedure
        7.4.43 The rawwrite procedure
        7.4.44 The read procedure
        7.4.45 The readdir procedure
        7.4.46 The readln procedure
        7.4.47 The rename procedure
        7.4.48 The reset procedure
        7.4.49 The rewinddir procedure
        7.4.50 The rewrite procedure
        7.4.51 The rmdir procedure
        7.4.52 The seek procedure
        7.4.53 The setfiledate procedure
        7.4.54 The setfiletime procedure
        7.4.55 The sleep procedure
        7.4.56 The str procedure
        7.4.57 The textbackground procedure
        7.4.58 The textcolor procedure
        7.4.59 The traperrors procedure
        7.4.60 The unpack procedure
        7.4.61 The val procedure
        7.4.62 The write procedure
        7.4.63 The writeln procedure
    7.5 User Declared Procedure
        7.5.1 Procedure declarations
    7.6 External Functions And Procedures
        7.6.1 Calling external functions and procedures
8 Expressions
    8.1 What are expressions?
    8.2 Set constructors
    8.3 Type Conversion Rules
        8.3.1 What are type conversion rules
        8.3.2 Numeric type conversion rules
        8.3.3 Char/String type conversion rules
    8.4 Operators
        8.4.1 What are operators?
        8.4.2 Arithmetic Operators
            8.4.2.1 The arithmetic operators
            8.4.2.2 Addition (+)
            8.4.2.3 Unary plus (+)
            8.4.2.4 Subtraction (-)
            8.4.2.5 Unary minus (-)
            8.4.2.6 multiplication (*)
            8.4.2.7 Real division (/)
            8.4.2.8 Integer division (div)
            8.4.2.9 Modulus (mod)
        8.4.3 Equality Operators
            8.4.3.1 The equality operators
            8.4.3.2 Is equal
            8.4.3.3 Is not equal
        8.4.4 Relational Operators
            8.4.4.1 The relational operators
            8.4.4.2 Is less than
            8.4.4.3 Is less than or equal
            8.4.4.4 Is greater than
            8.4.4.5 Is greater than or equal
        8.4.5 Boolean Operators
            8.4.5.1 The boolean operators
            8.4.5.2 not (boolean)
            8.4.5.3 and (boolean)
            8.4.5.4 and_then (boolean)
            8.4.5.5 or (boolean)
            8.4.5.6 or_else (boolean)
            8.4.5.7 xor (boolean)
        8.4.6 String Operators
            8.4.6.1 The string operators
            8.4.6.2 String concatenation (+)
        8.4.7 Set Operators
            8.4.7.1 The set operators
            8.4.7.2 Set union (+)
            8.4.7.3 Set difference (-)
            8.4.7.4 Set intersection (*)
            8.4.7.5 Set inclusion (in)
        8.4.8 Bitwise Operators
            8.4.8.1 The bitwise operators
            8.4.8.2 not (bitwise)
            8.4.8.3 and (bitwise)
            8.4.8.4 or (bitwise)
            8.4.8.5 xor (bitwise)
            8.4.8.6 Bit shift left (shl)
            8.4.8.7 Bit shift right (shr)
9 Statements
    9.1 What are statements?
    9.2 Empty statement
    9.3 Assignment statement
    9.4 Procedure statement
    9.5 Goto statement
    9.6 Compound statement
    9.7 If statement
    9.8 Case statement
    9.9 Repeat statement
    9.10 While statement
    9.11 For statement
    9.12 With statement
    9.13 Procedure method statement
10 Pascal Compatibility Rules
    10.1 Compatible types
    10.2 Assignment Compatibilty
        10.2.1 What is assignment compatibility?
        10.2.2 Assignment compatibility with array indexing
        10.2.3 Assignnment compatibility with value parameters
        10.2.4 Assignment compatibility with "read"
        10.2.5 Assignment compatibility with assignment statements
        10.2.6 Assignment compatibility with "for"
        10.2.7 Assignment compatibility with transfer procedures
11 Program Parameters
    11.1 What are program parameters?
12 The Windows Sockets Library (WinSock2)
    12.1 What are sockets?
    12.2 Introducing The WinSock2 library
    12.3 Initializing the WinSock2 library
    12.4 Cleaning up WinSock2
    12.5 Checking for errors
    12.6 Creating Sockets
        12.6.1 Creating data sockets
        12.6.2 Creating listening sockets
    12.7 Binding Sockets
        12.7.1 The bind function
    12.8 Converting Data Sockets Into Listening Sockets
        12.8.1 The listen function
    12.9 Blocking
        12.9.1 Dealing with blocking
        12.9.2 The ioctlsocket function
        12.9.3 The select function
    12.10 Accepting Connections
        12.10.1 The accept function
    12.11 Making Connections
        12.11.1 The connect function
    12.12 Reading Data
        12.12.1 The recv function
        12.12.2 The recvfrom function
    12.13 Sending Data
        12.13.1 The send function
        12.13.2 The sendto function
    12.14 How To Covert Names and IP Addresses
        12.14.1 The gethostbyname function
        12.14.2 The gethostbyaddr function
    12.15 Closing Sockets
        12.15.1 The shutdown function
        12.15.2 The closesocket function
    12.16 Some Other WinSock2 functions
        12.16.1 The gethostname function
        12.16.2 The getpeername function
        12.16.3 The getsockname function
        12.16.4 The getsockopt function
        12.16.5 The htonl function
        12.16.6 The htons function
        12.16.7 The inet_addr function
        12.16.8 The inet_ntoa function
        12.16.9 The ntohl function
        12.16.10 The ntohs function
        12.16.11 The setsockopt function
13 Appendix A - Extensions to Pascal as specified by ISO/IEC 7185
    13.1 What are extensions?
    13.2 Allow relaxed declarations
    13.3 Allow constant ranges
    13.4 Allow 'otherwise'
    13.5 Allow relaxed parameter list congruity
    13.6 Allow non-numeric statement labels
    13.7 Allow underscores in identifiers
    13.8 Allow binary and hexadecimal integers
    13.9 Auto-declare Input and Output
    13.10 Allow double-quoted literals
    13.11 Enable non-standard operators
    13.12 Enable non-standard constants
    13.13 Enable non-standard types
    13.14 Enable non-standard variables
    13.15 Enable non-standard functions
    13.16 Enable non-standard procedures
14 Appendix B - Deviations from ISO/IEC 7185
    14.1 Deviations from ISO/IEC 7185
    14.2 end-of-line char
    14.3 Termination of all lines in text files
    14.4 new(p, c1..cN)
    14.5 dispose(q, k1..kM)
    14.6 dispose(pointer value)
    14.7 Carriage returns
15 Appendix C - Implementation limits
    15.1 Implementation limits
    15.2 Length of source lines
    15.3 Number and nesting of statement sequences
    15.4 Nesting of functions/procedures
    15.5 Range of variant selector's type & Number of variants
    15.6 Size of integer constants
    15.7 Size of real constants
    15.8 Size of code and data
    15.9 Number of set elements
    15.10 Nesting of statements
    15.11 Nesting of include directives
    15.12 Stack size
    15.13 Number of Source Lines
16 Appendix D - Implementation-defined features
    16.1 Implementation-defined features
    16.2 String-elements
    16.3 Provision of tokens and delimiting characters
    16.4 Size and precision of real values
    16.5 Character set
    16.6 Ordinal values of characters
    16.7 Characters prohibited from text files
    16.8 When I/O is performed
    16.9 Value of "maxint"
    16.10 Accuracy of real operations and functions
    16.11 Default value of TotalWidth for integer-type
    16.12 Default value of TotalWidth for real-type
    16.13 Default value of TotalWidth for boolean-type
    16.14 Number of digits written in exponents
    16.15 Use of "e" or "E" as exponent character on output
    16.16 Case of characters used on output of boolean values
    16.17 Effect of built-in procedure "page"
    16.18 Binding of file-type program-parameters
    16.19 Effect of "reset" and "rewrite" on "input" and "output"
17 Appendix E - Implementation-dependent features
    17.1 Implementation-dependent features
    17.2 Effect of writing "prohibited" characters
    17.3 Order of evaluation of index-expressions
    17.4 Order of evaluation of expressions of a member-designator
    17.5 Order of evaluation of member-designators
    17.6 Order of evaluation of operands of dyadic operators
    17.7 Order of evaluation of actual-parameters for function calls
    17.8 Order of evaluating components of assignment statements
    17.9 Order of evaluation of actual-parameters for procedure calls
    17.10 Effect of reading a text file to which "page" has been applied
    17.11 Binding of non-file program-parameters
18 Appendix F - Errors
    18.1 What are errors?
    18.2 Array index out of bounds
    18.3 Accessing inactive variant
    18.4 Dereferencing nil pointers
    18.5 Dereferencing undefined pointers
    18.6 Dangling pointers
    18.7 Altering file-variables
    18.8 Using out-of-range value parameters
    18.9 Using out-of-range set value parameters
    18.10 Output to file not open for writing
    18.11 Output to undefined file
    18.12 Writing to middle of file
    18.13 Using Put on undefined buffer-variables
    18.14 Resetting undefined files
    18.15 Input from file not open for reading
    18.16 Input from undefined file
    18.17 Reading past end-of-file
    18.18 Reading out of range values
    18.19 Writing out of range values
    18.20 new(p, c1..cN) constraints violated
    18.21 Incompatible use of dispose(p)
    18.22 Incompatible use of dispose(p, k1..kM)
    18.23 dispose(p, k1..kM) constraint violations
    18.24 disposing nil pointer
    18.25 disposing undefined pointer
    18.26 new(p, c1..cM) constraint violated
    18.27 Invalid use of pack (1)
    18.28 Invalid use of pack (2)
    18.29 Invalid use of pack (3)
    18.30 Invalid use of unpack (1)
    18.31 Invalid use of unpack (2)
    18.32 Invalid use of unpack (3)
    18.33 Square of large numbers
    18.34 ln(x) and x is less than or equal to 0
    18.35 Square root of negative number
    18.36 Problems with trunc
    18.37 Problems with round
    18.38 Problems with chr
    18.39 Problems with succ
    18.40 Problems with pred
    18.41 Using eof on undefined files
    18.42 Using eoln on undefined files
    18.43 Using eoln at end-of-file
    18.44 Using undefined variables
    18.45 Real division by zero
    18.46 Integer division by zero
    18.47 Modulus of zero or negative
    18.48 Integer overflow/underflow
    18.49 Returning undefined value from function
    18.50 Assigning out of range ordinal values
    18.51 Assigning out of range set values
    18.52 Non-matching case index
    18.53 For loops initial value out of range
    18.54 For loops final value out of range
    18.55 Reading invalid integer values
    18.56 Reading out of range integer values
    18.57 Reading invalid numeric values
    18.58 Reading when file is not open
    18.59 Writing with TotalWidth or FracDigits less than one
    18.60 Problems with program-parameters
    18.61 Problems with conformant arrays
19 Appendix G - I/O error codes
    19.1 I/O error codes
20 Appendix H - Irie Pascal Grammar
    20.1 Grammar notation
    20.2 Irie Pascal grammar