home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ipo-101.zip
/
user.txt
< prev
Wrap
Text File
|
1999-03-09
|
116KB
|
2,924 lines
Copyright (c) 1998, 1999 Stuart King. All rights reserved.
Welcome to the Irie Pascal for OS/2 User's Manual.
-----------------
Table Of Contents
-----------------
1 Introduction
1.1 How To Register
1.2 License/Redistribution Rights
1.3 Disclaimer - Agreement
1.4 How to install/uninstall
1.4.1 Minimum system requirements
1.4.2 Installing Irie Pascal
1.4.2.1 Installing from the zip file
1.4.3 Uninstalling Irie Pascal
1.5 Product support
1.6 Contacting the author
1.7 Compliance with Standard Pascal
2 Editing/Creating Pascal Programs
3 Using the Irie Pascal Compiler
3.1 Compiler messages
3.2 Compiler options
3.2.1 Compiler options list
3.3 Compiler directives
3.3.1 Compiler directives list
4 Using the Irie Virtual Machine Interpreter
5 Using the Irie Upgrade Utility
Appendix A. Deviations from ISO/IEC 7185
A.1 end-of-line characters
A.2 Termination of all lines in text files
A.3 new(p, c1..CN)
A.4 dispose(q, k1..kM)
A.5 Carriage returns
A.6 Documentation of extensions
Appendix B. Implementation limits
B.1 Length of source lines
B.2 Number and nesting of statement sequences
B.3 Nesting of functions/procedures
B.4 Range of variant selector's type & Number of variants
B.5 Range of case-index's type & Number of case-list-elements
B.6 Size of integer constants
B.7 Size of real constants
B.8 Size of code and data
B.9 Number of set elements
B.10 Nesting of statements
B.11 Stack size
Appendix C. Implementation-defined features
C.1 String-elements
C.2 Provision of tokens and delimiting characters
C.3 Size and precision of real values
C.4 Character set
C.5 Ordinal values of characters
C.6 Characters prohibited from text files
C.7 When I/O is performed
C.8 Value of maxint
C.9 Accuracy of real operations and functions
C.10 Default value of TotalWidth for integer-type
C.11 Default value of TotalWidth for real-type
C.12 Default value of TotalWidth for Boolean-type
C.13 Number of digits written in exponents
C.14 Use of "e" or "E" as exponent character on output
C.15 Case of characters used on output of Boolean values
C.16 Effect of built-in procedure "page"
C.17 Binding of file-type program-parameters
C.18 Effect of "reset" and "rewrite" on "input" and "output"
Appendix D. Implementation-dependent features
D.1 Effect of writing 'prohibited' characters
D.2 Order of evaluation of index-expressions
D.3 Order of evaluation of expressions of a member-designator
D.4 Order of evaluation of member-designators
D.5 Order of evaluation of operands of dyadic operators
D.6 Order of evaluation of actual-parameters for function calls
D.7 Order of evaluating components of assignment statements
D.8 Order of evaluation of actual-parameters for procedure calls
D.9 Effect of reading a text file to which "page" has been applied
D.10 Binding of non-file program-parameters
Appendix E. Errors
E.1 Array index out of bounds
E.2 Accessing inactive variant
E.3 Dereferencing nil pointers
E.4 Dereferencing undefined pointers
E.5 Dangling pointers
E.6 Altering file-variables
E.7 Using out-of-range value parameters
E.8 Using out-of-range set value parameters
E.9 Output to file not open for writing
E.10 Output to undefined file
E.11 Writing to middle of file
E.12 Using Put on undefined buffer-variables
E.13 Resetting undefined files
E.14 Input from file not open for reading
E.15 Input from undefined file
E.16 Reading past end-of-file
E.17 Reading out of range values
E.18 Writing out of range values
E.19 new(p, c1..cN) constraints violated
E.20 Incompatible use of dispose(p)
E.21 Incompatible use of dispose(p, k1..kM)
E.22 dispose(p, k1..kM) constraint violations
E.23 disposing nil pointer
E.24 disposing undefined pointer
E.25 new(p, c1..cN) constraints violated
E.26 Invalid use of pack
E.27 Invalid use of pack
E.28 Invalid use of pack
E.29 Invalid use of unpack
E.30 Invalid use of unpack
E.31 Invalid use of unpack
E.32 Square of large numbers
E.33 ln(x) and x <= 0
E.34 Square root of negative number
E.35 Problems with trunc
E.36 Problems with round
E.37 Problems with chr
E.38 Problems with succ
E.39 Problems with pred
E.40 Using eof on undefined files
E.41 Using eoln on undefined files
E.42 Using eoln at end-of-file
E.43 Using undefined variables
E.44 Division by zero
E.45 Division by zero
E.46 Modulus of zero or negative
E.47 Integer overflow/underflow
E.48 Returning undefined value from function
E.49 Assigning out of range ordinal values
E.50 Assigning out of range set values
E.51 Non-matching case index
E.52 For loops initial value out of range
E.53 For loops final value out of range
E.54 Reading invalid integer values
E.55 Reading out of range integer values
E.56 Reading invalid numeric values
E.57 Reading when file is not open
E.58 Writing with TotalWidth or FracDigits less than one
E.59 Problems with program-parameters
E.60 Problems with conformant arrays
Appendix F. I/O error codes
NoErrors I/O operation completed successfully
FileEraseFailure Attempt to erase a file failed
FileRenameFailure Attempt to rename a file failed
FileIsUndefined Attempt to operate on an undefined file
FileIsOpen Using assign, erase, or rename on an open file
FileIsNotOpen Attempt to perform I/O on a closed file
FileModeUndefined THIS SHOULD NEVER OCCUR
FileNameTooLong Attempt to give a file a name too long
FileNameNotDefined Attempt to erase or rename a file with no name
FilePosFailure Attempt to use pos on a file failed
FileSeekFailure Attempt to use seek on a file failed
NotOutputFile Attempt to write to a file not open for writing
UnexpectedEOF Attempt to read past end-of-file
WriteFailure Attempt to write to file failed
WidthTooLarge Attempt to write a field too wide
NotInputFile Attempt to read from a file not open for reading
ReadFailure Attempt to read from file failed
ClosingFailure Attempt to close a file failed
OpeningFailure Attempt to open a file failed
FileBufferIsEmpty Attempt to use put and the file-buffer is empty
ChDirFailure Attempt to change directory failed
FileExpandFailure Attempt to use "fexpand" failed
FileSplitFailure Attempt to use "fsplit" failed
FileSizeFailure Attempt to obtain size of file failed
FileOpenDirFailure Attempt to open directory failed
FileReadDirFailure Attempt to read directory entry failed
DirectoryIsUndefined Attempt to access directory variable failed
FileCloseDirFailure Attempt to close directory failed
FileRewindDirFailure Attempt to rewind directory failed
FileMkDirFailure Attempt to create directory failed
FileRmDirFailure Attempt to remove directory failed
FileGetDateFailure Attempt to get the date a file was last modified failed
FileGetModeFailure Attempt to get the "mode" of a file failed
FileGetTimeFailure Attempt to get the time a file was last modified failed
FileSetDateFailure Attempt to set the date a file was last modified failed
FileSetTimeFailure Attempt to set the time a file was last modified failed
FileRawReadFailure Attempt to use "rawread" failed
FileRawWriteFailure Attempt to use "rawwrite" failed
----------------
1 Introduction
----------------
Irie Pascal is designed for beginners, who want to learn to program in
Pascal, as well as for experienced programmers, who want to write small
to medium-sized scripts and utility programs.
Irie Pascal is highly compatible with Standard (ISO/IEC 7185) Pascal
(see "1.7 Compliance with Standard Pascal" below). This high level of
compatibility means that Irie Pascal shares Standard Pascal's strengths as
a first language for beginners. These strengths include readable syntax,
and extensive compile-time and run-time checking.
Irie Pascal supports extensions to Standard Pascal, particularly in the
areas of string and file/directory processing, which make it useful for
creating scripts and utilities. Irie Pascal's support for automatic
run-time checking make it useful for creating "quick and dirty" programs
(i.e. programs that are expected to be run only a few times or by only a
few people and may not be worth spending a lot of time on).
Irie Pascal consists of a compiler (called the Irie Pascal Compiler) and
an interpreter (called the Irie Virtual Machine Interpreter). The compiler
translates Pascal programs into Irie Virtual Machine executables (IVM
executables). IVM executables can not be directly executed but instead must
be executed by the interpreter. Most other compilers generate "native-code"
executables (i.e. executables which can be directly executed on a single
computer platform but usually can not be executed at all on any other
computer platform). The main advantage of IVM executables is that unlike
"native-code" executables, IVM executables can be run on any computer
platform on which the interpreter exists.
Currently the interpreter exists on five computer platforms:
1) Win32 (i.e. Win95/98/NT)
2) DOS
3) Linux
4) OS/2
5) FreeBSD
Another advantage to IVM executables is that they tend to be much smaller
than their "native-code" equivalents. I have found that IVM executables
tend to be roughly 20 times smaller than equivalent "native-code"
executables.
The main disadvantage to IVM executables is speed or rather the lack of it.
This is because IVM executables are not directly executed, but are executed
by the Interpreter. I have found that IVM executables tend to run roughly
50 times slower than equivalent "native-code" executables. While there are
many kinds of programs where this speed is perfectly acceptable, there are
others where this is just too slow. I expect Irie Pascal to be used mainly
to create utility programs, and programs for learning purposes (if you are
learning Pascal you don't need your test programs to be the fastest possible,
you probably need good compile-time and run-time diagnostics more).
You should be aware that although I claim Irie Pascal complies with
ISO/IEC 7185 Level 0 (since it does according to my tests) it has not been
formally certified by an external body.
Irie Pascal is shareware (see the file "sharewar.txt" which accompanies
this manual for more information) and as such there is an evaluation
version and a registered version. The evaluation version of Irie Pascal is
provided at not charge, for the purposes of evaluating Irie Pascal and
deciding whether to continue using it. Feel free to share the evaluation
version with your friends, but do not give it away altered or as part of
another system. You are not authorized to share the registered version.
The essence of "user-supported" software is to provide personal computer
users with quality software without high prices, and yet to provide an
incentive for programmers to continue to develop new products. If you find
the evaluation version of Irie Pascal useful and find that you are using
it and continue to use it after a reasonable trial period, you must
register it (See "1.1 How to Register").
The evaluation and registered versions of Irie Pascal are functionally
identical except for two differences. The first difference is that the
registered version uses an improved code generation technique to generate
smaller programs. The second difference is that programs compiled by the
evaluation version expire one day after they are compiled, while programs
compiled by the registered version never expire. These differences are
intended to encourage users of the evaluation version to pay the
registration fee and receive a copy of the registered version.
NOTE: Irie Pascal does not prevent users of the evaluation version from
recompiling expired programs as many times as they wish to keep them
running indefinitely.
-------------------
1.1 How To Register
-------------------
To register Irie Pascal complete the appropriate order form, and mail it
in along with a check or money order for the registration fee. If you wish
to pay the registration fee in US dollars then use the order form in
"orderus.txt". If you wish to pay the registration fee in Canadian dollars
then use the order form in "orderca.txt". If you wish to pay the
registration fee in UK pounds then use the order form in "orderuk.txt".
If you include an email address then I will email you when I ship the
registered version to you. I respect the privacy of my customers and will
NEVER sell or otherwise distribute any information you give me to anyone
without your consent.
The check or money order should be made out to "Stuart King" and sent to
Stuart King
MB #247
221 S. State Road 7
Ft. Lauderdale, Fl 33317
U.S.A.
Please do not send cash.
All registered users will receive a copy of the latest registered version
of Irie Pascal on 3 1/2" disks, so you will need a 3 1/2" floppy drive
to install Irie Pascal.
Registered users of Irie Pascal for OS/2 are entitled to receive
free (regular shipping and handling charges may apply) upgrades to all
registered versions of Irie Pascal for OS/2 released after they register.
Registered users of Irie Pascal for OS/2 may use the Irie Upgrade Utility
to upgrade to the latest registered version at any time. Whenever a new
registered version of Irie Pascal for OS/2 is released a special upgrade
file will be placed on the IrieTools Website. Registered users may download
this upgrade file without charge and perform the upgrade (see the User's
Manual "user.txt" for more information on using the Irie Upgrade Utility).
Registered users may also receive upgrades by mail. To receive upgrades
by mail, fill out the appropriate order form and mail in the completed
order form along with a check of money order for the shipping and handling
fee to the address above.
Educational institutions should enquire about the educational discount
(See "1.6 Contacting the author").
Commercial users of Irie Pascal must register and pay for their copies of
the Software within 30 days of first use or their license is withdrawn.
Site-License arrangements may be made by contacting the author
(see "1.6 Contacting the author").
Anyone distributing Irie Pascal for any kind of remuneration must first
contact the author (see "1.6 Contacting the author" below) for
authorization.
---------------------------------
1.2 License/Redistribution Rights
---------------------------------
Subject to payment of the registration fee, the author grants you the
following:
A non-exclusive license to use the number of copies of Irie Pascal
covered by the registration fee. The order forms indicate the fee per
copy of Irie Pascal as well as the shipping and handling charge. You must
treat the registered version just like a book. An example is that the
registered version may be used by any number of people and may be freely
moved from one computer location to another, so long as there is no
possibility of the number of copies in use at it one time exceeding the
number of copies covered by the registration fee.
A non-exclusive, royalty-free right to reproduce and distribute programs
compiled by Irie Pascal.
A non-exclusive, royalty-free right to reproduce and distribute unaltered
copies of the Irie Virtual Machine Interpreter.
--------------------------
1.3 Disclaimer - Agreement
--------------------------
Users of Irie Pascal must accept this disclaimer of warranty:
"Irie Pascal is supplied as is. The author disclaims all warranties,
expressed or implied, including, without limitation, the warranties of
merchantability and of fitness for any purpose. The author assumes no
liability for damages, direct or consequential, which may result from the
use of Irie Pascal."
----------------------------
1.4 How to install/uninstall
----------------------------
---------------------------------
1.4.1 Minimum system requirements
---------------------------------
- OS/2 2.0 or later
- 1 MB disk space
----------------------------
1.4.2 Installing Irie Pascal
----------------------------
Irie Pascal for OS/2 is distributed as a zip file "ipo-101.zip".
NOTE: Installing Irie Pascal requires manual modifications to your
config.sys. If you have never modified your config.sys or if you are
uncomfortable doing so then have someone who has done this before assist
you. If you decide to modify your config.sys remember to use a text
editor and not a word processor. You may wish to make a backup copy of
your config.sys before you begin making modifications to help you recover
from mistakes.
------------------------------------
1.4.2.1 Installing from the zip file
------------------------------------
The recommended installation procedure is as follows:
A) Create a directory (I suggest "C:\IRIE") to store Irie Pascal.
B) Copy the zip file into this directory.
C) Use your unzip utility to extract the files.
D) Add the directory created in A) to the path
(i.e. edit your config.sys).
E) Create a directory to store the sample pascal programs
(I suggest "C:\IRIE\SAMPLES").
F) Copy the zip file containing the samples "samples.zip" in to the
directory you just created.
G) Unzip the sample files.
H) Reboot your computer.
------------------------------
1.4.3 Uninstalling Irie Pascal
------------------------------
Irie Pascal does not make any behind the scenes modifications to your
system. Irie Pascal does not modify any system files or install files
on you hard disk so uninstalling is very simple. Just delete the
directory, you created to store Irie Pascal, and remove it from the path.
-------------------
1.5 Product support
-------------------
I am very interested in all your comments about Irie Pascal, but
most especially in your comments about its usefulness, any problems
you encounter installing or using Irie Pascal, and any changes you
would like to see.
The latest information and updates of Irie Pascal are available at
the Irie Tools web site at http://www.irietools.com
You can also contact me directly with your technical support
questions.
-------------------------
1.6 Contacting the author
-------------------------
For the quickest response contact me by e-mail at support@irietools.com
If you prefer you can contact me by regular mail (but this takes longer) at:
Stuart King
MB #247
221 S. State Road 7
Ft. Lauderdale, Fl 33317
U.S.A.
-----------------------------------
1.7 Compliance with Standard Pascal
-----------------------------------
Irie Pascal complies with the requirements of level 0 of ISO/IEC 7185,
with the following exceptions: (see "Appendix A").
------------------------------------
2.0 Editing/Creating Pascal Programs
------------------------------------
You will need to use a text editor to create and edit your Pascal
programs. Unfortunately Irie Pascal does not yet include a text editor
so you will need one from another source. Two basic text editors
"e" and "epm" are included with OS/2 and can be used with
Irie Pascal.
There are numerous other text editors (freeware, shareware, and commercial)
which can also be used with Irie Pascal.
----------------------------------
3.0 Using the Irie Pascal Compiler
----------------------------------
The Irie Pascal Compiler translates Pascal programs into Irie Virtual
Machine executables (IVM executables). The compiler should be run from
a command-line prompt.
Syntax: ipc [options] filename
or ipc ?
or ipc
where [options] modify the behavior of the compiler.
filename specifies the file to compile.
NOTE: [x] indicates that x is optional.
If you enter
ipc
then the compiler displays a brief help screen showing the proper syntax.
If you enter
ipc ?
then the compiler displays a more detailed help screen listing all the
options you can use.
If you enter
"ipc [options] filename"
then the compiler attempts to compile the file specified by "filename"
taking into account the options specified if any.
NOTE: "filename" can include path information.
If we ignore the compiler options for the time being then to
compile a program you enter "ipc filename".
For example to compile the sample "hello.pas" program enter
"ipc hello"
or
"ipc hello.pas"
(assuming of course that "hello.pas" is in the current directory).
The compiler will generate a file called "hello.ivm" which contains an
IVM executable. You can run it by entering
"ivm hello"
or
"ivm hello.ivm".
NOTE: If you do not specify a path for the executable (as in the example
above) the interpreter will first look in the current directory and if
not found the interpreter will search the path.
------------------------
3.1 Compiler messages
------------------------
The compiler can display four different classes of messages:
1) Fatal error messages
2) Error messages
3) Warning messages
4) Informatory messages
Fatal error messages are displayed when the compiler detects a problem
that is so serious it can not continue. After displaying a fatal error
message the compiler deletes the Irie Virtual Machine Executable if one
is being created and then stops immediately. For example if the compiler
runs out of memory it generates a fatal error message.
Error messages are displayed when the compiler detects a problem
that prevents it from generating a reliable executable. After displaying
an error message the compile deletes the Irie Virtual Machine Executable
and continues compiling in order to detect other problems. For example
if the compiler detects invalid syntax, it will generate an error message.
Warning messages are generated when the compiler detects something
which may indicate a problem with your program. For example if you
declare a variable and never use it, the compile displays a warning
message.
Informatory messages display information which may be interesting
but not really necessary. For example there are informatory messages
which show the speed of compilation.
Here is an example of what I mean.
If you compile the following program which is one of the sample programs
"bad.pas"
program bad(output);
begin
writelm('Hello') (* writelm used instead of writeln *)
end.
then the compiler produces the following output
Irie Pascal Compiler 1.01 for OS/2
Copyright (c) 1998, 1999 Stuart King. All rights reserved.
Error #76: "samples\bad.pas" (line 3, col 4): Procedure identifier expected.
writelm('Hello') (* writelm used instead of writeln *)
^
Warning #44: "samples\bad.pas" (line 1, col 13): Variable is never used.
program bad(output);
^
1 error(s) and 1 warning(s) were issued.
5 lines compiled in 0.020 seconds.
Compilation speed 249 lines/sec, 14940 lines/min.
The first two lines are the copyright notice.
The third line is an error message
The word "Error" indicates that this is an error or fatal error message.
The #76 is the message number.
Then comes the name of the file with the error.
Then comes the location where the error was detected
(line 3, column 4).
Finally the text of the message.
The fourth line shows the line where the error was detected.
The fifth line has a ^ pointing to the location in the fourth line where
the error was detected.
The sixth, seventh, and eigth lines display warning messages with
essentially the same layout as the error message.
The final three lines are informatory messages.
NOTE: The speed of compilation will vary.
Tip: Sometimes a single problem can confuse the compiler and make it
report problems later on that don't really exist. So pay special
attention to the problem reported by the first message and try to fix
this one first.
-----------------------
3.2 Compiler options
-----------------------
Compiler options are instructions to the compiler to somehow modify it's
behavior (usually they are instructions to enable or disable a particular
compiler feature). Compiler options are entered on the command-line when
you invoke the compiler (see "3.0 Using the Irie Pascal Compiler" above).
NOTE: Compile options are case-sensitive so for example "i" and "I" are
different options.
There are two kinds of compiler options
1) Flag options
2) Value options
Flag options are used to enable or disable a compiler feature.
To enable the feature use
-option or -option+
where
option is the particular compiler option.
To disable the feature use
-option-
For example the "nc" option is used to enable/disable the processing of
nested comments. So -nc or -nc+ is used to enable the processing of nested
comments and -nc- is used to disable the processing of nested comments.
Value options are used to specify the value of some quantity.
To specify a value option use
-optionVALUE
where
option is the particular compiler option
and
VALUE is the value being specified.
For example the "mw" option is used to specify the maximum number of
warnings that the compiler should process.
So -mw2 is used to set the maximum number of warnings to 2.
More than one option can be specified so if you want to compile
the program "bad.pas" using brief messages and nested comments then
you can enter "ipc -b -nc bad.pas".
Options can be combined so you can also enter
"ipc -bnc bad"
or
"ipc -ncb bad"
To turn off nested comment processing and brief message then
you can enter "ipc -nc- -b- bad" or "ipc -ncb- bad".
-------------------------------
3.2.1 Compiler options list
-------------------------------
Option: 'a'
Purpose: Specifies the maximum alignment used by the compiler.
Syntax: -aN Set maximum alignment to N.
Default: Maximum alignment 4.
Notes:
N must be between 0 and 8
N=0 is treated like N=1.
Some CPUs (including those in the 80x86 family) access data faster if it
is aligned on an address which is a multiple of the size of the data.
Suppose the CPU is accessing a real which is 8 bytes long then for
fastest access the real should be on an address which is a multiple
of 8 (for example 0, 8, 16, 24, 32, etc).
The compiler stores variables in memory at the lowest available address
which is a multiple of either the variable's size or the maximum alignment,
whichever is smaller.
For example suppose you compile the following program and the maximum
alignment is 4.
program x(output);
var
c : char;
i : integer;
b : boolean;
r : real;
begin
end.
The compiler needs to decide where to store the variables
"c", "i", "b" and "r".
The first variable "c" gets stored at address 0, and since "c" is
a char variable (which are 1 byte long) the available addresses are
from 1 upwards.
The second variable "i" is an integer variable (which are 4 bytes long).
The lowest available address which is a multiple of the variable size
is 4 and the lowest available address which is a multiple of the maximum
alignment is also 4. So the compiler stores "i" at address 4, and the
available address are from 8 upwards (since "i" is 4 bytes long).
The third variable "b" is a boolean variable (which are 4 bytes long).
The lowest available address which is a multiple of the variable size
is 8 and the lowest available address which is a multiple of the maximum
alignment is also 8. So the compiler stores "b" at address 8, and the
available address are from 12 upwards (since "b" is 4 bytes long).
The fourth variable "r" is a real variable (which are 8 bytes long).
The lowest available address which is a multiple of the variable size
is 16 but the lowest available address which is a multiple of the maximum
alignment is 12. So the compiler stores "r" at address 12 (since 12 is
less than 16).
In general if you set maximum alignment to 1 then you waste no memory
but you get fastest access only for chars. If you set the maximum alignment
to 4 you may waste memory when storing all variables except char, but
you get the fastest access to all variables except real. If you set the
maximum alignment to 8 you may waste memory when storing all variables
except char, but you get the fastest access to variables of all types.
If you are not sure about the setting of this option just leave the default.
------------------------------
Option: 'ao'
Purpose: Enables/disables assignment overflow checking.
Syntax: -ao[+|-]
Default: Enabled
Notes:
When assignment overflow checking is enabled the compiler generates code
to check that variables are large enough to contain the values
assigned to them. The generated code will display a run-time error
message and stop your program if an assignment overflow error is detected.
Assignment overflow errors are only possible when assigning to string
variables or set variables using the array representation
(See "B.9 Number of set elements" for more information).
I recommend you leave this option enabled.
------------------------------
Option: 'A'
Purpose: Enables/disables asserts.
Syntax: -A[+|-]
Default: Enabled
Notes:
This compiler option controls whether or not code is generated for the
built-in procedure assert.
NOTE: Since the compiler parses assert procedures whether or not this
option is enabled, compile-time errors in assert procedures are reported
regardless of the setting of this option (See "7.2.2 assert" in the
Irie Pascal Programmers Reference Manual for more information).
------------------------------
Option: 'b'
Purpose: Enables/disables the brief format for messages.
Syntax: -b[+|-]
Default: Disabled
Notes:
The verbose format for Fatal error and Error messages (which is used by
default) is
Error #nn: "name" (Line l, Col c): text
where
"nn" is a number identifying the message
"name" is the file where the problem as detected
"l" is the line where the problem was detected
"c" is the column where the problem was detected
"text" is the text of the message
The verbose format for warning messages is similar except that "Warning"
is used instead of "Error".
The brief format for Fatal error and Error messages is
Enn: "name" l:text
where
"nn" is a number identifying the message
"name" is the file where the problem as detected
"l" is the line number of the line where the problem was detected
"text" is the text of the message
The brief format for warning messages are similar except that "W" is
used instead of "E".
------------------------------
Option: 'C'
Purpose: Enables/disables case-sensitive compilation.
Syntax: -C[+|-]
Default: Disabled
Notes:
This compiler option controls whether or not the case of identifiers
is significant. So for example when case-sensitive compilation is
enabled "hi", "Hi", "hI", and "HI" are all different identifiers, but
when case-sensitive compilation is disabled then they are all the same
identifier.
This option is disabled by default since Pascal is normally not
case-sensitive. If you enable this option then remember to use all
lowercase for keywords and built-in identifiers
(e.g. var, integer, input, writeln).
------------------------------
Option: 'ead'
Purpose: Enables/disables auto-declaration of input and output.
Syntax: -ead[+|-]
Default: Enabled
Notes:
See also "B.9 Input & Output automatically declared" in the Programmers
Reference Manual.
------------------------------
Option: 'ebh'
Purpose: Enables/disables binary and hexadecimal integer constants.
Syntax: -ebh[+|-]
Default: Enabled
Notes:
See also "B.7 Binary integer constants" & "B.8 hexadecimal integer constants"
in the Programmers Reference Manual.
------------------------------
Option: 'eco'
Purpose: Enables/disables extended constants.
Syntax: -eco[+|-]
Default: Enabled
Notes:
See also "B.14 Extended constants" in the Programmers Reference Manual.
------------------------------
Option: 'ecr'
Purpose: Enables/disables constant ranges.
Syntax: -ecr[+|-]
Default: Enabled
Notes:
This compiler option enables and disables support for constant ranges.
See also "B.2 Constant ranges" in the Programmers Reference Manual.
------------------------------
Option: 'edq'
Purpose: Enables/disables double quoted literals.
Syntax: -edq[+|-]
Default: Enabled
Notes:
See also "B.10 Double-quoted literals" in the Programmers Reference Manual.
------------------------------
Option: 'efn'
Purpose: Enables/disables extended functions.
Syntax: -efn[+|-]
Default: Enabled
Notes:
See also "7.1 Built-in Functions" in the Programmers Reference Manual.
------------------------------
Option: 'enn'
Purpose: Enables/disables support for non-numeric statement labels.
Syntax: -enn[+|-]
Default: Enabled
Notes:
See also "B.5 Non-numeric statement labels" in the Programmers Reference
Manual.
------------------------------
Option: 'eop'
Purpose: Enables/disables support for extended operators.
Syntax: -eop[+|-]
Default: Enabled
Notes:
See also "8.1.1 Not operator", "8.1.6 And operator",
"8.1.7 and_then operator", "8.1.8 + operator", "8.1.10 or operator",
"8.1.11 or_else operator", "8.1.12 xor operator", 8.1.13 shl operator",
and "8.1.14 shr operator" in the Programmers Reference Manual.
------------------------------
Option: 'eow'
Purpose: Enables/disables support for otherwise.
Syntax: -eow[+|-]
Default: Enabled
Notes:
See also "B.3 Otherwise" in the Programmers Reference Manual.
------------------------------
Option: 'epr'
Purpose: Enables/disables extended procedures.
Syntax: -epr[+|-]
Default: Enabled
Notes:
See also "7.2 Built-in Procedures" in the Programmers Reference Manual.
------------------------------
Option: 'erd'
Purpose: Enables/disables relaxed declarations.
Syntax: -erd[+|-]
Default: Enabled
Notes:
See also "B.1 Relaxed declarations" in the Programmers Reference Manual.
------------------------------
Option: 'ety'
Purpose: Enables/disables extended types.
Syntax: -ety[+|-]
Default: Enabled
Notes:
See also "B.15 Extended types" in the Programmers Reference Manual.
------------------------------
Option: 'eui'
Purpose: Enables/disables underscores in identifiers.
Syntax: -eui[+|-]
Default: Enabled
Notes:
See also "B.6 Underscores in identifiers" in the Programmers Reference Manual.
------------------------------
Option: 'eva'
Purpose: Enables/disables extended variables.
Syntax: -eva[+|-]
Default: Enabled
Notes:
See also "B.16 Extended variables" in the Programmers Reference Manual.
------------------------------
Option: 'E'
Purpose: Enables/disables extensions.
Syntax: -E[+|-]
Default: Enabled
Notes:
This compiler option enables and disables support for all Irie Pascal
extensions to Standard Pascal.
------------------------------
Option: 'i'
Purpose: Enables/disables I/O trapping.
Syntax: -i[+|-]
Default: Enabled
Notes:
When I/O trapping is enabled the compiler generates code which checks each
I/O operation and issues a run-time error if an I/O error is detected.
------------------------------
Option: 'I'
Purpose: Enables/disables informatory messages.
Syntax: -I[nn][+|-]
Default: All informatory message enabled.
Notes:
Use -I or -I+ to enable all informatory messages.
Use -I- to disable all informatory messages.
Use -Inn or -Inn+ to enable the informatory message with message number "nn".
Use -Inn- to disable the informatory message with message number "nn".
------------------------------
Option: 'ln'
Purpose: Enables/disables line number information.
Syntax: -ln[+|-]
Default: Enabled
Notes:
When line number information is enabled, the compiler stores the address
of the code generated for each source line, inside the Irie Virtual
Machine Executable. Enabling line number information makes the executable
bigger, but allows for more meaningful run-time error messages since the
number of the source line that caused the error is displayed in the message.
When line number information is not enabled, the executable is smaller
but run-time error messages display only the address of the code that caused
the error, which is unlikely to be very useful to you.
I recommend leaving this option enabled unless you really need to make the
executable as small as possible.
------------------------------
Option: 'mb'
Purpose: Enables/disables Borland compatible messages
Syntax: -mb[+|-]
Default: Disabled
Notes:
When this compiler option is enabled the compiler displays messages
in the format used by Borland compilers. This option can be used to
make it easier to integrate the Irie Pascal Compiler with third-party
editors and IDE's which already know how to process Borland compiler
messages.
NOTE: This option automatically suppresses the 'mc' compiler option.
Related compiler option(s): 'mc', 'mm'.
------------------------------
Option: 'mc'
Purpose: Enables/disables message context information
Syntax: -mc[+|-]
Default: Enabled
Notes:
When this compiler option is enabled the compiler shows the position
in the source file referred to by error and warning messages.
NOTE: Some error and warning messages do not refer to a particular
position in the source file and therefore context information is not
displayed for those messages.
------------------------------
Option: 'me'
Purpose: Specifies that the compiler stop after N error messages.
Syntax: -meN
Default: N = 25
Notes:
Suppose you want the compiler to stop after 5 error messages then
use -me5
------------------------------
Option: 'mm'
Purpose: Enables/disables Microsoft compatible messages
Syntax: -mm[+|-]
Default: Disabled
Notes:
When this compiler option is enabled the compiler displays messages
in the format used by Microsoft compilers. This option can be used to
make it easier to integrate the Irie Pascal Compiler with third-party
editors and IDE's which already know how to process Microsoft compiler
messages.
NOTE: This option automatically suppresses the 'mc' compiler option.
Related compiler option(s): 'mb', 'mc'.
------------------------------
Option: 'mw'
Purpose: Specifies that the compiler stop after N warning messages.
Syntax: -mwN
Default: N = 100
Notes:
Suppose you want the compiler to stop after 5 warning messages then
use -mw5
------------------------------
Option: 'nc'
Purpose: Enables/disables nested comments.
Syntax: -nc[+|-]
Default: Disabled
Notes:
Nested comments are comments inside other comments.
For example
(* outer (* inner comment *) comment *)
When this compiler option is disabled the example comment above will
terminate at the first *) so only
(* outer (* inner comment *)
will be treated as a comment.
When this compiler option is enabled the compiler recognizes the end of
comments only when the number of close comment markers matches the number
of open comment markers. So the example comment above will terminate only
after the second *).
Both open comment markers (* and { are considered to be equivalent.
Both close comment markers *) and } are considered to be equivalent.
So attempting to trick the compiler into accepting nested comments with
something like
(* outer { inner comment } comment *)
will not work.
Nested comments are disabled by default since in Standard Pascal comments
do not nest.
------------------------------
Option: 'p'
Purpose: Enables/disables mandatory parentheses mode.
Syntax: -p[+|-]
Default: Disabled
Notes:
The one thing I dislike about Pascal is that parentheses are not used
when calling or declaring functions or procedures with no parameters.
So for example in the following statement
a := b;
it is not clear whether "b" is a function that takes no parameters or
whether "b" is a variable.
When mandatory parentheses mode is enabled then parentheses are required
when declaring or calling all functions and procedures even those with
no parameters. Parentheses are also required after the program name even
if there are no program parameters.
So for example to declare a procedure that takes no parameters you would
use the following
procedure name();
...
begin
...
end;
And when calling it you would use
name();
The problem with using this option is that your programs are not strictly
speaking Pascal programs any longer and they probably could not be compiled
by another compiler without being modified.
------------------------------
Option: 'r'
Purpose: Enables/disables range checking.
Syntax: -r[+|-]
Default: Enabled
Notes:
When range checking is enabled the compiler generates code to check
for range errors. The generated code will display a run-time error
message and stop your program if a range error is detected.
The possible causes of range errors are:
A) Attempts to assign or read in values which are not assignment
compatible with a particular type to a variable of that type.
e.g. given var bit : 0..1;
using bit := 2 is a range error.
B) Attempts to access element outside of array bounds.
e.g. given var x : array[-4..10] of integer;
using x[-5] is a range error
C) Attempts to use width or fraction specifiers in write/writeln
which are less than 1.
e.g.
writeln(1234.56677:x, y);
is a range error if x or y is less than 1.
------------------------------
Option: 's'
Purpose: Enables/disabled strict checking of var string parameters.
Syntax: -s[+|-]
Default: Enabled
Notes:
When strict checking is enabled it is an error to pass a string variable
by reference if the length of the variable's string type is not equal to
the length of the formal parameter's string type.
When strict checking is disabled you can pass a string variable by reference
even if the length of the string variable is not equal to the length of the
formal parameter.
For example if you compile the following program and strict checking is
enabled
program p(output);
type
string8 = string[8];
var
x : string16;
procedure print(var s : string8);
begin
writeln(s)
end;
begin
x := 'Hello';
print(x) (* Error only if strict checking is enabled *)
end.
then the compiler will report an error with the call print(x) since the
length of x's string type is 16 and the length of the formal parameter's
sting type is 8 (i.e. they are not equal). If strict checking is disabled
then no errors are reported.
------------------------------
Option: 'sc'
Purpose: Enables/disables short-circuit evaluation for "and" and "or"
Syntax: -sc[+|-]
Default: Enabled
Notes:
The Boolean operators "and" and "or" are both binary operators and
take two Boolean operands, one on the left and one on the right.
Like
left "and" right and left "or" right
where left and right are Boolean expressions.
Remember that the result of the "and" operator is true only if both the
left operand and the right operand are true. Short-circuit evaluation
takes advantage of the fact that if the left operand of "and" is
evaluated and found to be false then there is no need to evaluate the
right operand since the final result must be false.
Similarly the result of the "or" operator is false only if both the
left operand and the right operand are false. Short-circuit evaluation
takes advantage of the fact that if the left operand of "or" is evaluated
and found to be true then there is no need to evaluate the right operand
since the final result must be true.
You might want to disable short-circuit evaluation if you need the
side-effects of evaluating the right operand. For example suppose the
right operand is a call to a function which modifies some global variables
(a side-effect) in addition to returning a Boolean value. Then short-circuit
evaluation might cause the function not to be called and therefore the
global variables will not get modified. If you want to make sure that the
right operand is always evaluated then disable short-circuit evaluation.
On the other hand short-circuit evaluation is sometimes useful. For example
suppose you have a pointer to an integer and you want to perform some
calculations if the integer is greater than 100, but you don't know whether
the pointer is equal to Nil, then with short-circuit evaluation you can
write:
if (p <> Nil) and (p^ > 100) then ... perform calculations ...
If p is Nil then (p <> Nil) is false and the right operand (p^ > 100) is
not evaluated which is good since evaluating the (p^ > 100) will cause
an run-time error when p (which is equal to Nil) is dereferenced.
Without short-circuit evaluation you would have to write something like:
if p <> Nil then
if p^ > 100 then ... perform calculations ...
One solution is to disable short-circuit evaluation using this compiler
option and use "and_then" instead of "and" and "or_else" instead of "or"
when you want short-circuit evaluation.
See "Extensions to Pascal as specified by ISO/IEC 7185" for a
description of the "and_then" and "or_else" operators.
------------------------------
Option: 'so'
Purpose: Enables/disables detailed stack overflow checking
Syntax: -so[+|-]
Default: Disabled
Notes:
The interpreter automatically checks for stack overflow at the beginning
and end of each procedure/function call and when large values are placed
on the stack. These checks should suffice for most purposes, however you
can enable this option if you want the interpreter to check for stack
overflow before every statement is executed.
------------------------------
Option: 'S'
Purpose: Specifies the number of kilobytes to allocate for your program's
stack.
Syntax: -Snn
Default: nn = 64
Notes:
The default stack size (64K) should be more than enough for the vast
majority of programs. However if your program is heavily recursive or has
functions that need a large amount of space for local variables or
parameters then you can increase this value up to a maximum of 1024K (1MB).
On the other hand you can also use this options to reduce the size of your
program's stack (not really recommended).
------------------------------
Option: 'u'
Purpose: Enables/disables checking for undefined values.
Syntax: -u[+|-]
Default: Enabled
Notes:
When this option is enabled the compiler generates code which checks
each time your program gets a value from a variable to make sure that
the value is not undefined. If your program does get an undefined value
from a variable then the code generated by the compiler will issue a
run-time error message and terminate your program.
So for example if you compile and run the following program
program bad(output);
var
r : real;
begin
writeln(r) (* The value of "r" is undefined *)
end.
The program will terminate with a run-time error message because of the
attempt to print the value of "r" which is undefined.
Unfortunately not all variable accesses can be checked, checks are only
made for accesses to variables of the following types:
enumerated types (including boolean)
subranges of enumerated types
subranges of integer that do not include -1
file
list
pointer
real
set (array representation) (See "B.9 Number of set elements"
for more information).
Accesses to variables of types "char", "integer", "record" and "set"
(Bit set representation) are not checked.
Checking for undefined values is performed as follows:
A) All memory is initialized by setting all bits to 1.
B) When accessing a variable a check is performed to see if all bits
are set and if they are this variable is undefined.
This doesn't work for "char", "integer" or "set" (bit set representation)
variables since a value with all bits set is valid for these variables.
Record are not checked because they may contain fields which can not be
checked.
------------------------------
Option: 'v'
Purpose: Enables/disables variant checking.
Syntax: -v[+|-]
Default: Enabled
Notes:
When variant checking is enabled the compiler generates code to check each
reference to a variant to make sure the variant is active.
------------------------------
Option: 'W'
Purpose: Enables/disables warning messages.
Syntax: -W[nn][+|-]
Default: All warning messages enabled.
Notes:
Use -W or -W+ to enable all warning messages.
Use -W- to disable all warning messages.
Use -Wnn or -Wnn+ to enable warning message number nn.
Use -Wnn- to disable warning message number nn.
------------------------------
--------------------------
3.3 Compiler directives
--------------------------
Compiler directives are special comments that can be placed in a program
to enable or disable certain compiler features.
The compiler will treat any comment that begins with a '$' as a compiler
directive.
To enable the feature use
{$D+} or (*$D+*)
where
D specifies the particular compiler directive.
To disable the feature use
{$D-} or (*$D-*)
For example the '$I' directive is used to enable/disable I/O checking.
So use {$I+} or (*$I+*) to enable I/O checking and
use {$I-} or (*$I-*) to disable I/O checking.
----------------------------------
3.3.1 Compiler directives list
----------------------------------
Directive: '$B'
Purpose: Enables/disables short-circuit evaluation of "and" and "or".
Syntax: {$B+} or (*$B+*) or {$B-} or (*$B-*)
Notes:
see option "sc" in the compiler options list for more information on
short-circuit evaluation.
------------------------------
Directive: '$I'
Purpose: Enables/disables I/O checking.
Syntax: {$I+} or (*$I+*) or {$I-} or (*$I-*)
Notes:
When I/O checking is enabled the compiler generates code to check each
I/O operation. The generated code will display a run-time error message
and stop your program if an I/O error is detected.
------------------------------
Directive: '$P'
Purpose: Enables/disables mandatory parentheses mode.
Syntax: {$P+} or (*$P+*) or {$P-} or (*$P-*)
Notes:
see the "p" option in the compiler options list for more information.
------------------------------
Directive: '$R'
Purpose: Enables/disables range checking.
Syntax: {$R+} or (*$R+*) or {$R-} or (*$R-*)
Notes:
see the "r" option in the compiler options list for more information.
------------------------------
Directive: '$S'
Purpose: Enables/disabled strict checking of var string parameters.
Syntax: {$S+} or (*$S+*) or {$S-} or (*$S-*)
Notes:
see the "s" option in the compiler options list for more information.
------------------------------
Directive: '$U'
Purpose: Enables/disables checking for undefined values.
Syntax: {$U+} or (*$U+*) or {$U-} or (*$U-*)
Notes:
see the "u" option in the compiler options list for more information.
------------------------------
Directive: '$V'
Purpose: Enables/disables variant checking.
Syntax: {$V+} or (*$V+*) or {$V-} or (*$V-*)
Notes:
see the "v" option in the compiler options list for more information.
------------------------------
Directive: '$W'
Purpose: Enables/disables warning messages.
Syntax: {$W[nn]+} or (*$W[nn]+*) or {$W[nn]-} or (*$W[nn]-*)
Notes:
Use $W+ to enable all warning messages.
Use $W- to disable all warning messages.
Use $WnnWnn+ to enable warning message number nn.
Use $Wnn- to disable warning message number nn.
------------------------------
----------------------------------------------
4.0 Using the Irie Virtual Machine Interpreter
----------------------------------------------
The Irie Virtual Machine Interpreter is used to run Irie Virtual
Machine executables.
The interpreter should be run from a command-line prompt.
Syntax: ivm [filename] [arguments]
where
filename specifies the Irie Virtual Machine Executable to run.
and
[arguments] are program arguments passed to the executable.
NOTE: [x] indicates that x is optional.
For example if you compile the sample "hello.pas" program, the compiler
will generate a file called "hello.ivm" which contains an
Irie Virtual Machine Executable. You can run it by entering
"ivm hello" or "ivm hello.ivm".
NOTE: If you do not specify a path for the executable (as in the example
above) the interpreter will first look in the current directory and if
not found the interpreter will search the path.
----------------------------------
5.0 Using the Irie Upgrade Utility
----------------------------------
The Irie Patch Utility allows registered users to upgrade Irie Pascal
using special upgrade files available from the IrieTools website.
The syntax is
ivm upgrade upgrade-file
For example if you are a registered user of Irie Pascal 1.00 for OS/2
and you wish to upgrade to the latest version of Irie Pascal for OS/2,
you would download the upgrade for version 1.00
o-100.upg
and place it in the same directory as ipo-100.zip.
You then enter
ivm upgrade o-100.upg
The Irie Upgrade Utility will generate ipo-101.zip.
----------------------------------------
Appendix A. Deviations from ISO/IEC 7185
----------------------------------------
----------------------------------
A.1 end-of-line characters
----------------------------------
ISO/IEC 7185 requires that end-of-line characters read from text files
be converted to spaces. For example given
read(f, c)
where "f" is a file at end-of-line
and "c" is a character variable
then according to ISO/IEC 7185, if "f" is at end-of-line then after the
read above "c" should contain a space character rather than an end-of-line
character. Irie Pascal does not convert end-of-line characters read from
text file, so in the example above "c" will contain an end-of-line character
(i.e. a linefeed character, chr(10)).
-------------------------------------------------
A.2 Termination of all lines in text files
-------------------------------------------------
ISO/IEC 7185 requires that all lines in text files (except possibly the line
that is currently being written) should be terminated by an end-of-line.
In effect this means that after a text file is closed the last line
must be terminated by an end-of-line.
Irie Pascal does not automatically terminate the last line in a text file.
--------------------------
A.3 new(p, c1..cN)
--------------------------
ISO/IEC 7185 requires support for a form of the required procedure "new"
as follows:
new(p, c1..cN)
where "p" is a pointer to a variant record and "c1" thru "cN" are
case constants which correspond to the variants in p^.
Irie Pascal does not currently support this form of "new".
------------------------------
A.4 dispose(q, k1..kM)
------------------------------
ISO/IEC 7185 requires support for a form of the required procedure "dispose"
as follows:
dispose(q, k1..kM)
where "q" is a pointer to a variant record and "k1" thru "kM" are
case constants which correspond to the variants in q^.
Irie Pascal does not currently support this form of "dispose".
----------------------------
A.5 Carriage returns
----------------------------
ISO/IEC 7185 requires that all characters written to a file should
appear when the file is read (the exception to this is that
implementations are allowed to designate a set of characters
"prohibited from text files" and treat these characters specially).
Irie Pascal does not comply fully with this requirement, since
carriage return characters do not appear when individual characters
are read from text files. This treatment of carriage return characters
is intended to convert carriage return/line feed pairs (that are used
as end-of-line markers in some text files) into a single end-of-line
character (i.e. a line feed chr(10)).
---------------------------------------
A.6 Documentation of extensions
---------------------------------------
ISO/IEC 7185 requires that implementations be accompanied by a document
that SEPARATELY (my emphasis) describes all extensions. The Irie Pascal
documentation describes all extensions, but not in a separate section.
Instead Irie Pascal describes each extension in the section that it
logically belongs (i.e. the section for similar features).
If customers demand it, I will include an additional document that
just describes extensions, but I am trying to avoid this since having
extensions described in two separate places will be more difficult to
maintain.
---------------------------------
Appendix B. Implementation limits
---------------------------------
ISO/IEC 7185 allows implementations to impose limits on the size of a
program and its data. Irie Pascal imposes various limits on the size and
complexity of programs and their data, that it will process. These limits
have been set fairly high so as not to inconvenience the user.
----------------------------------
B.1 Length of source lines
----------------------------------
The maximum length of a source line is 400 characters.
If you exceed this limit the compiler will issue an error message.
-----------------------------------------------------
B.2 Number and nesting of statement sequences
-----------------------------------------------------
Statement sequences are the statements that occur between "begin" and "end"
and between "repeat" and "until". Statement sequences are nested when one
statement sequence is contained in another.
The maximum number of statement sequences in a function or procedure is
2,147,486,647.
If you exceed this limit the compiler issues a fatal error message
(See "3.1 Compiler messages").
Statement sequences can be nested to a maximum depth of 256.
If you exceed this limit the compiler issues a fatal error message
(See "3.1 Compiler messages").
-------------------------------------------
B.3 Nesting of functions/procedures
-------------------------------------------
Irie Pascal supports nested functions and procedures (i.e. functions
and procedures can contain other functions and procedures).
Functions and procedures can be nested to a maximum depth of 256.
NOTE: This does NOT mean that the total number of functions and
procedures in a program is 256. This limits applies only to the
depth of nesting.
If you exceed this limit the compiler issues a fatal error message
(See "3.1 Compiler messages").
-----------------------------------------------------------------
B.4 Range of variant selector's type & Number of variants
-----------------------------------------------------------------
A variant record is a record which contains a variant part.
The syntax for variant parts given below is taken from ISO/IEC 7185.
variant-part = 'case' variant-selector 'of' variant { ';' variant }
variant-selector = [ tag-field ':' ] tag-type
tag-field = identifier
tag-type = ordinal-type-identifier
variant = case-constant-list ':' '(' field-list ')'
case-constant-list = case-constant { ',' case-constant }
case-constant = constant
field-list = [ (fixed-part [ ';' variant-part] | variant-part) [';'] ]
fixed-part = record-section { ';' record-section }
record-section = identifier-list ':' type-denoter
identifier-list = identifier { ',' identifier }
Now the important part of the syntax above in plain English is :
A variant part consists of the word "case" followed by a variant-selector
(which is either an identifier followed by a colon and the tag-type or just
the tag-type), followed by the word "of", and followed by one or more
variants.
Irie Pascal limits the maximum range of the tag-type of a variant selector
to 1024. This also indirectly limits the number of variants in a
variant-part to 1024.
If you exceed this limit the compiler issues a warning message and the
following checks are not performed on the variant record which exceeded
the limit(s).
1. No case-constant should appears more than once.
2. Each value specified by the tag-type should appear as a case-constant.
3. Only active variants in variant records are accessed.
---------------------------------------------------------------------
B.5 Range of case-index's type & Number of case-list-elements
---------------------------------------------------------------------
A case-index is the expression that follows the word "case" in a
case statement.
case-list-elements are the choices in the case statement.
The syntax for case statements given below is taken from ISO/IEC 7185.
case-statement = 'case' case-index 'of' case-list-element
{ ';' case-list-element } [';' 'end' ]
case-index = expression
case-list-element = case-constant-list ':' statement
case-constant-list = case-constant { ',' case-constant }
case-constant = constant
Irie Pascal limits the maximum range of the case index's type to 1024.
This also indirectly limits the number of case-list-elements to 1024.
If you exceed this limit the compiler issues a warning message and the
following checks are not performed on the case statement which exceeded
the limit(s).
1. No case-constant should appears more than once.
2. Each value specified by the type of the case-index should appear as a
case-constant.
-------------------------------------
B.6 Size of integer constants
-------------------------------------
The maximum size of an integer constant is 2,147,486,647
If you exceed this limit the compiler will issue an error message.
----------------------------------
B.7 Size of real constants
-----------------------------------
The maximum size of an real constant is approximately 1e308
If you exceed this limit the compiler will issue an error message.
---------------------------------
B.8 Size of code and data
---------------------------------
The maximum size of the code in a program is 4GB
The maximum size of the data in a program is 4GB
If you exceed this limit the compiler will issue an error message.
----------------------------------
B.9 Number of set elements
----------------------------------
Irie Pascal uses two different representations for sets depending on
the range of the sets base type, or if the base type is a subrange type
depending on the range of the subranges host type.
Suppose you have the set types
"set of T"
and
"set of S"
where S is a subrange of T
then if T's range is less than or equal to 256 then both sets are represented
as bit sets, if T's range is greater than 256 then the sets are represented
using an array representation of fixed size.
Why am I telling you all this?
Well because the fixed size of the array representation means that there is
a limit (255) on the number of set elements that can fit in set variables
that use the array representation. If you assign a set value with more
elements than the limit then the set value will overflow and overwrite
the memory that follows the variable. If assignment overflow checking is
enabled (see the -ao compiler option) then the overflow will be detected.
---------------------------------
B.10 Nesting of statements
---------------------------------
Irie Pascal limits the maximum depth of nesting of statements to 256.
NOTE: This does NOT mean that the total number of statements in a program
is 256. This limits the depth of nesting (i.e. the depth to which
statements can contain other statements which can contain other statements
etc.).
If you exceed this limit the compiler issues a fatal error message
(see "3.1 Compiler messages").
----------------------
B.11 Stack size
----------------------
The default stack size is 64K but you can adjust this to any value from
1K to 1024K (1MB) using the -S compiler option.
If you exceed this limit the compiler will issue an error message.
-------------------------------------------
Appendix C. Implementation-defined features
-------------------------------------------
The Pascal Standard (ISO/IEC 7185) specifies that some features of the
Pascal language are implementation-defined. ISO/IEC 7185 further specifies
that each implementation (called a processor by ISO/IEC 7185) must provide
a definition of all implementation-defined features. The effect of this is
that the exact behavior of the implementation-defined features, may differ
between processors, but must be consistent for any particular processor.
Below is the definition of how this implementation/processor handles all
implementation-defined features.
Each definition has the following format:
First the official description of the feature is taken from ISO/IEC 7185
and placed in quotation marks.
This is followed by my interpretation of the official description if I
feel the official description is unclear or requires the reader to have
a copy of ISO/IEC 7185.
Finally a statement describing how this implementation/processor handles
the feature is at the end.
---------------------------
C.1 String-elements
---------------------------
"6.1.7 There shall be an implementation-defined one-to-one correspondence
between the set of alternatives from which string-elements are drawn and
a subset of the values of the required char-type".
In other words an implementation-defined subset of the character values
can be used to create character literals.
Irie Pascal allows character literals to be formed from any of the
"printable" characters from the IBM extended character set.
---------------------------------------------------------
C.2 Provision of tokens and delimiting characters
---------------------------------------------------------
"6.1.9 Provision of the reference tokens ^, [, and ], of the alternative
token @, and of the delimiting characters { and }, is
implementation-defined".
Irie Pascal provides the reference tokens, the alternative token, and the
delimiting characters.
---------------------------------------------
C.3 Size and precision of real values
---------------------------------------------
"6.4.2.2 b) The values of the real-type shall be an implementation-defined
subset of the real numbers denoted by signed-real".
The real numbers described by the ISO/IEC 7185 have infinite range and
infinite precision. Implementations are allowed to limit the maximum range
and precision of real numbers.
Irie Pascal uses 64 bit reals stored as specified by the following standard:
"IEEE standard for binary floating-point arithmetic (ANSI/IEC std 754-1985)".
-------------------------
C.4 Character set
-------------------------
"6.4.2.2 d) The values of char-type shall be the enumeration of a set of
implementation-defined characters, some possibly without graphic
representation".
Irie Pascal uses the enumeration of the IBM extended character set for
values of char-type.
----------------------------------------
C.5 Ordinal values of characters
----------------------------------------
"6.4.2.2 d) The ordinal numbers of each value of char-type are
implementation-defined".
Irie Pascal uses the position of each value of char-type, in the IBM
extended character set, as it's ordinal number.
So for example since the space character is at position 32 then
ord(' ') = 32.
------------------------------------------------
C.6 Characters prohibited from text files
------------------------------------------------
"6.4.3.5 There shall be an implementation-defined subset of the set of
char-type values, designated 'characters prohibited from text files'"
This seems to me to be a loophole provided by ISO/IEC 7185 to allow
implementations to get around the requirements specified for text files,
especially the requirement that all characters written to a text file
appear when the text file is read in.
Irie Pascal designates one character as "prohibited from text files". This
character is chr(26), also known as the EOF character.
NOTE: By prohibited I don't mean that you can't write EOF characters to
text files, but if you do then the text file will be terminated at
that point (i.e. characters written after the EOF will not appear when the
text file is read back in). Since this technically violates the standard
I have taken advantage of this loophole to "prohibit" EOF's from text
files and thus remain compliant.
---------------------------------
C.7 When I/O is performed
---------------------------------
"6.6.5.2 The point at which the file operations "rewrite", "put", "reset",
and "get" are actually performed is implementation-defined".
Irie Pascal implements "lazy I/O" (i.e. input operations are performed at
the latest opportunity and output operations are performed at the earliest
opportunity), which facilitates interactive terminal input and output.
So the four file operations are performed as specified below:
"append" - the file is opened but the file buffer is empty.
"rewrite" - the file is opened but the file buffer is empty.
"put" - the contents of the file buffer are appended to the file.
"reset" - the file is opened, but the file buffer is not filled until
it is accessed.
"get" - If the file buffer is full then the file buffer is emptied to
make room for the next file value (NOTE: In this case no I/O
is actually performed).
If the file buffer is empty then the next data value is skipped
(i.e. read and ignored). The file buffer remains empty.
---------------------------
C.8 Value of maxint
---------------------------
"6.7.2.2 The required constant-identifier maxint shall denote an
implementation-defined value of integer-type".
Irie Pascal uses 2,147,483,647 as the value of "maxint".
-----------------------------------------------------
C.9 Accuracy of real operations and functions
-----------------------------------------------------
"6.7.2.2 The accuracy of the approximation of the result of the real
operations and functions to the mathematical result is
implementation-defined".
Irie Pascal performs real operations as specified in
"IEEE standard for binary floating-point arithmetic (ANSI/IEC std 754-1985)"
the final results are stored in 64 bit reals.
--------------------------------------------------------
C.10 Default value of TotalWidth for integer-type
--------------------------------------------------------
"6.9.3.1 The default value of TotalWidth for integer-type is
implementation-defined".
When writing integer values to text files the default width of the
output field is implementation defined.
Irie Pascal uses 8 as the default value of TotalWidth for integer-type.
So for example
write('one=',1)
will cause
one= 1
to be written (i.e. the value "1" is written as seven spaces and a "1").
-----------------------------------------------------
C.11 Default value of TotalWidth for real-type
-----------------------------------------------------
"6.9.3.1 The default value of TotalWidth for real-type is
implementation-defined".
When writing real values to text files the default width of the
output field is implementation defined.
Irie Pascal uses 9 as the default value of TotalWidth for real-type.
--------------------------------------------------------
C.12 Default value of TotalWidth for Boolean-type
--------------------------------------------------------
"6.9.3.1 The default value of TotalWidth for Boolean-type is
implementation-defined".
When writing boolean values to text files the default width of the
output field is implementation defined.
Irie Pascal uses 8 as the default value of TotalWidth for Boolean-type.
-------------------------------------------------
C.13 Number of digits written in exponents
-------------------------------------------------
"6.9.3.4.1 ExpDigits is an implementation-defined value representing the
number of digit-characters written in an exponent".
Irie Pascal uses 3 as the value of ExpDigits.
So for example
write('one=', 1.0)
will cause
one= 1.0E+000
NOTE: The exponent "000" has three digits.
------------------------------------------------------
C.14 Use of "e" or "E" as exponent character on output
------------------------------------------------------
"6.9.3.4.1 The value of the exponent character ('e' or 'E') used on output
of values of real-type is implementation-defined".
Irie Pascal uses 'E' on output of values of real-types.
---------------------------------------------------------------
C.15 Case of characters used on output of Boolean values
---------------------------------------------------------------
"6.9.3.5 The case of each character of 'True' and 'False' used on output of
values of Boolean-type is implementation-defined".
Irie Pascal uses 'true' and 'false' on output of values of Boolean-type.
-----------------------------------------------
C.16 Effect of built-in procedure "page"
-----------------------------------------------
"6.9.5 The effect of the procedure "page" when applied to a text file which
is in generation mode is implementation-defined".
The procedure "page" causes a form feed character (i.e. chr(12)) to be
written to text files to which it is applied.
---------------------------------------------------
C.17 Binding of file-type program-parameters
---------------------------------------------------
"6.10 The binding of a file-type program-parameter is
implementation-defined".
See "10 Program parameters" in the Irie Pascal Programmers Reference Manual
for a description of how file-type program parameters are handled.
-------------------------------------------------------------------
C.18 Effect of "reset" and "rewrite" on "input" and "output"
-------------------------------------------------------------------
"6.10 The effect of "reset" and "rewrite" on the standard files "input" and
"output" is implementation-defined".
"reset" and "rewrite" have no effect on the standard files "input" and
"output".
---------------------------------------------
Appendix D. Implementation-dependent features
---------------------------------------------
The Pascal Standard (ISO/IEC 7185) does not completely define all features
of the language. Some features are implementation-dependent (i.e. possibly
differing between implementations and not necessarily defined for any
particular implementation).
Below is the definition of how this implementation/processor treats all
implementation-dependent features.
Each definition has the following format:
First the official description of the feature is taken from ISO/IEC 7185
and placed in quotation marks.
This is followed by my interpretation of the official description if I
feel the official description is unclear or requires the reader to have
a copy of ISO/IEC 7185.
Finally a statement describing how this implementation/processor handles the
feature is at the end.
-----------------------------------------------------
D.1 Effect of writing "prohibited" characters
-----------------------------------------------------
"6.4.3.5 For any text file t, the effect of attributing to a component of
either t.L or t.R a member of the characters prohibited from text files
is implementation-dependent".
In other words the effect of writing any of the characters, that
implementations are allowed to prohibit from text files, to a text file is
implementation-dependent.
Irie Pascal "prohibits" one character from text files, the character is
chr(26) the end-of-file character. Writing the end-of-file character to a
text file causes the file to be terminated (i.e. any characters written
after the EOF character will not appear when the file is read).
----------------------------------------------------
D.2 Order of evaluation of index-expressions
----------------------------------------------------
"6.5.3.2 The order of evaluation of the index-expressions of an
indexed-variable is implementation-dependent".
Irie Pascal evaluates index-expressions of indexed-variables from left to
right.
For example given
var x[1..10, 1..20] of integer;
and later on
x[i, j] := 20;
"i" will get evaluated before "j".
---------------------------------------------------------------------
D.3 Order of evaluation of expressions of a member-designator
---------------------------------------------------------------------
"6.7.1 The order of evaluation of expressions of a member-designator
is implementation-dependent".
Irie Pascal evaluates expressions of member-designators from left to right.
For example given
const low = 'a'; high = 'z';
var letter : set of char;
and later on
letter := [low..high];
"low" will be evaluated before "high".
-----------------------------------------------------
D.4 Order of evaluation of member-designators
-----------------------------------------------------
"6.7.1 The order of evaluation of the member-designators of a
set-constructor is implementation-dependent".
Irie Pascal evaluates member-designators of set-constructors from left to
right.
For example given
var yes : set of char;
and later on
yes := ['y', 'Y']'
"y" will be evaluated before "Y".
---------------------------------------------------------------
D.5 Order of evaluation of operands of dyadic operators
---------------------------------------------------------------
"6.7.2.1 The order of evaluation of the operands of a dyadic operator is
implementation-dependent".
In other words the order of evaluation of the operands of any of the
following operators is implementation-dependent:
* / div mod and + - or = <> < > <= >= in and_then or_else shr shl
(i.e. the operands can be evaluation left-to-right, right-to-left,
in parallel, or they may not both be evaluated).
Irie Pascal always evaluates the operands of the following operators from
left-to-right:
* / div mod + - = <> < > <= >= in shr shl
Irie Pascal always evaluates the operands of the following operators using
short-circuit evaluation:
and_then or_else
See the "sc" compiler option for more information on short-circuit
evaluation.
Irie Pascal evaluates the operands of the following operators, using
short-circuit evaluation if short-circuit evaluation is enabled,
or left-to-right if short-circuit evaluation is disabled:
"and" "or"
See the "sc" compiler option and the $B compiler directive for information
on enabling and disabling short-circuit evaluation.
-----------------------------------------------------------------------
D.6 Order of evaluation of actual-parameters for function calls
-----------------------------------------------------------------------
"6.7.3 The order of evaluation, accessing, and binding of the
actual-parameters of a function-designator is implementation-dependent".
In other words the order in which the actual-parameters are evaluated
and passed to the formal-parameters during a functions call is
implementation-dependent.
Irie Pascal evaluates and passes actual-parameters from left to right.
-------------------------------------------------------------------
D.7 Order of evaluating components of assignment statements
-------------------------------------------------------------------
"6.8.2.2 The order of accessing the variable and evaluating the expression
of an assignment-statement is implementation-dependent".
I am not sure what is meant by "accessing the variable" so all I
can say is that the address of the variable is calculated before the
expression is evaluated.
------------------------------------------------------------------------
D.8 Order of evaluation of actual-parameters for procedure calls
------------------------------------------------------------------------
"6.7.3 The order of evaluation, accessing, and binding of the
actual-parameters of a procedure-statement is implementation-dependent".
In other words the order in which the actual-parameters are evaluated
and passed to the formal-parameters during a procedure call is
implementation-dependent.
Irie Pascal evaluates and passes actual-parameters from left to right.
--------------------------------------------------------------------------
D.9 Effect of reading a text file to which "page" has been applied
--------------------------------------------------------------------------
"6.9.5 The effect of inspecting a text file to which the page procedure was
applied during generation is implementation-dependent".
Applying "page" to a text file during generation causes a form feed
character chr(12) to be written to the file. During inspection (i.e. when
the text file is read) the handling of the form feed character depends on
the type of data the program is trying to read. If the program is trying to
read in integer or real data then the form feed character is treated like a
space character and is therefore skipped. If the program is trying to read
in character or string data then the form feed character is read in like
any other character.
---------------------------------------------------
D.10 Binding of non-file program-parameters
---------------------------------------------------
"6.10 The binding of the non-file variables denoted by the
program-parameters to entities external to the program is
implementation-dependent".
See "10 Program parameters" in the Irie Pascal Programmers Reference Manual
for a description of the binding of program-parameters to entities external
to the program.
------------------
Appendix E. Errors
------------------
ISO/IEC 7185 defines an error as follows:
"A violation by a program of the requirements of this International
Standard that a processor is permitted to leave undetected".
ISO/IEC 7185 then goes on to add the following two notes:
"1. If it is possible to construct a program in which the violation or
non-violation of this International Standard requires knowledge of the
data read by the program or the implementation definition of
implementation-defined features, then violation of that requirement is
classified as an error. Processors may report on such violations of the
requirement without such knowledge, but there always remain some cases
that require execution, simulated execution, or proof procedures with the
required knowledge. Requirements that can be verified without such
knowledge are not classified as errors.
2. Processors should attempt the detection of as many errors as possible,
and to as complete a degree as possible. Permission to omit detection is
provided for implementations in which the detection would be an excessive
burden."
Below is the documentation of how this implementation/processor handles
all errors. Most of the time the documentation consists only of a statement
about whether or not the error is reported. The description of each error is
taken from ISO/IEC 7185.
-------------------------------------
E.1 Array index out of bounds
-------------------------------------
"6.5.3.2 For an indexed-variable closest-containing a single
index-expression, it is an error if the value of the index-expression is
not assignment-compatible with the index-type of the array-type."
In other words it is error to access an array component that does not exist.
For example given:
var a : array[1..20] of char;
then
a[0]
is an error since 0 is not assignment-compatible with 1..10.
NOTE: There is no 0th component of "a".
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
--------------------------------------
E.2 Accessing inactive variant
--------------------------------------
"6.5.3.3 It is an error unless a variant is active for the entirety of each
reference and access to each component of the variant."
This error is reported if the following two conditions are met:
1. Range checking is enabled
2. The range of the variant selector's type is less than or equal to the
implementation limit (i.e. 1024).
See also the "v" compiler option and the "$V" compiler directive.
--------------------------------------
E.3 Dereferencing nil pointers
--------------------------------------
"6.5.4 It is an error if the pointer-variable of an identified-variable
denotes a nil-value."
In other words it is an error to dereference a pointer variable which is
equal to nil (i.e. "p^" is an error if "p = nil").
This error is reported.
--------------------------------------------
E.4 Dereferencing undefined pointers
--------------------------------------------
"6.5.4 Is an error if the pointer-variable of an identified-variable is
undefined."
In other words it is an error to dereference a pointer-variable which is
undefined (i.e. "p^" is an error if "p" is undefined).
This error is reported.
-----------------------------
E.5 Dangling pointers
-----------------------------
"6.5.4 It is an error to remove from its pointer-type the identifying-value
of an identified-variable when a reference to the identified-variable
exists."
In other words it is an error to use "dispose" to free the memory allocated
for a pointer if other pointers to the same memory exists.
This error is not reported.
-----------------------------------
E.6 Altering file-variables
-----------------------------------
"6.5.5 It is an error to alter the value of a file-variable f when a
reference to the buffer-variable f^ exists."
According to ISO/IEC 7185 there are four ways of establishing a reference
to a variable.
1. Passing the variable by reference establishes a reference to the variable
for the life of the function/procedure call.
2. Using an assignment-statement to assign a value to the variable
establishes a reference to the variable starting either before or after
the expression on the right-hand side of the assignment statement is
evaluated, and lasting until the value has been assigned to the variable.
3. Using the variable on a with-statement establishes a reference to the
variable that exists during the execution of the statement in the
with-statement.
4. Establishing a reference to a component of the variable.
So for example it would be an error if you pass a file-buffer by reference
to a procedure, and that procedure performs I/O on the file associated
with the file-buffer.
This error is not reported.
-----------------------------------------------
E.7 Using out-of-range value parameters
-----------------------------------------------
"6.6.3.2 It is an error if the value of each corresponding actual value
parameter is not assignment-compatible with the type possessed by the
formal-parameter."
If you think about it this makes sense since passing a value to a function
or procedure is very much like assigning the value to the corresponding
formal parameter.
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
--------------------------------------------------
E.8 Using out-of-range set value parameters
--------------------------------------------------
"6.6.5.2 For a value parameter, it is an error if the actual-parameter
is an expression of a set-type whose value is not assignment-compatible
with the type possessed by the formal-parameter."
This is very similar to the previous error (E.7).
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
-----------------------------------------------
E.9 Output to file not open for writing
-----------------------------------------------
"6.6.5.2 It is an error if the file mode is not Generation immediately prior
to any use of put, write, writeln or page."
In other words it is an error to perform output on a file which is not
open for writing (i.e. either not open or open for reading).
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
------------------------------------
E.10 Output to undefined file
------------------------------------
"6.6.5.2 It is an error if the file is undefined immediately prior to any
use of put, write, writeln or page."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-------------------------------------
E.11 Writing to middle of file
-------------------------------------
"6.6.5.2 It is an error if end-of-file is not true immediately prior to
any use of put, write, writeln or page."
In other words all output must take place at the end of files.
Irie Pascal supports output in the middle of a file using the "seek"
procedure, and so does not consider this an error and therefore does not
report it.
---------------------------------------------------
E.12 Using Put on undefined buffer-variables
---------------------------------------------------
"6.6.5.2 It is an error if the buffer-variable is undefined immediately
prior to any use of put."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
------------------------------------
E.13 Resetting undefined files
------------------------------------
"6.6.5.2 It is an error if the file is undefined immediately prior to
any use of reset."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
------------------------------------------------
E.14 Input from file not open for reading
------------------------------------------------
"6.6.5.2 It is an error if the file mode is not inspection immediately
prior to any use of get or read."
In other words it is an error to perform input from a file which is not
open for reading (i.e. either not open or open for writing).
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-------------------------------------
E.15 Input from undefined file
-------------------------------------
"6.6.5.2 It is an error if the file is undefined immediately prior to
any use if get or read."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
------------------------------------
E.16 Reading past end-of-file
------------------------------------
"6.6.5.2 It is an error if end-of-file is true immediately prior to any
use of get or read."
In other words it is an error to attempt to read past the end of a file.
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
---------------------------------------
E.17 Reading out of range values
---------------------------------------
"6.6.5.2 For read, it is an error if the value possessed by the
buffer-variable is not assignment-compatible with the variable-access."
In other words it is an error to read a value into a variable, if the value
is outside the allowed range for the variable.
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
---------------------------------------
E.18 Writing out of range values
---------------------------------------
"6.6.5.2 For write, it is an error if the value possessed by the expression
is not assignment-compatible with the buffer-variable."
In other words it is an error to write a value to a file, if the value
is not outside the allowed range of the files component type.
For example given:
type
positive = 0..maxint;
var
f : file of positive;
then
write(f, -1);
is an error since "-1" is outside the range of "0..maxint".
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
-----------------------------------------------
E.19 new(p, c1..cN) constraints violated
-----------------------------------------------
"6.6.5.3 For new(p, c1..cN), it is an error if a variant of a variant-part
within the new variable becomes active and a different variant of the
variant-part is one of the specified variants."
In other words if you use this form of "new" and specify case-constants
c1 thru cN then it is an error if a variant other than those specified
by c1 thru cN become active.
Irie Pascal does not support this form of "new" so the error can not occur.
------------------------------------------
E.20 Incompatible use of dispose(p)
------------------------------------------
"6.6.5.3 For dispose(p), it is an error if the identifying-value had been
created using the form new(p, c1..cN)."
Irie Pascal does not support this form of "new" so the error can not occur.
--------------------------------------------------
E.21 Incompatible use of dispose(p, k1..kM)
--------------------------------------------------
"6.6.5.3 For dispose(p, k1..kM), it is an error unless the variable had
been created using the form new(p, c1..cN) and m is equal to n."
Irie Pascal does not support this form of "dispose" so the error can not
occur.
----------------------------------------------------
E.22 dispose(p, k1..kM) constraint violations
----------------------------------------------------
"6.6.5.3 for dispose(p, k1..kM), it is an error if the variants identified
by the pointer value of p are different from those specified by the
case-constants k1..kM."
Irie Pascal does not support this form of "dispose" so the error can not
occur.
---------------------------------
E.23 disposing nil pointer
---------------------------------
"6.6.5.3 For dispose, it is an error if the pointer variable has a
nil-value."
This error is reported.
---------------------------------------
E.24 disposing undefined pointer
---------------------------------------
"6.6.5.3 For dispose, it is an error if the pointer variable has an
undefined value."
This error is reported.
-----------------------------------------------
E.25 new(p, c1..cN) constraints violated
-----------------------------------------------
"6.6.5.3 It is an error if a variable created using the second form of new
is accessed by the identified-variable of the variable-access of a factor,
of an assignment-statement, or of an actual parameter."
Irie Pascal does not support this form of "new" so the error can not occur.
-------------------------------
E.26 Invalid use of pack
-------------------------------
"6.6.5.4 For pack, it is an error if the parameter of ordinal-type is not
assignment-compatible with the index-type of the unpacked array parameter."
This error is reported.
-------------------------------
E.27 Invalid use of pack
-------------------------------
"6.6.5.4 For pack, it is an error if any of the components of the unpacked
array are both undefined and accessed."
This error is not reported.
-------------------------------
E.28 Invalid use of pack
-------------------------------
"6.6.5.4 For pack, it is an error if the index-type of the unpacked array
is exceeded."
This error is reported.
---------------------------------
E.29 Invalid use of unpack
---------------------------------
"6.6.5.4 For unpack, it is an error if the parameter of ordinal-type is not
assignment-compatible with the index-type of the unpacked array parameter."
This error is reported.
---------------------------------
E.30 Invalid use of unpack
---------------------------------
"6.6.5.4 For unpack, it is an error if any of the components of the packed
array are undefined."
This error is not reported.
---------------------------------
E.31 Invalid use of unpack
---------------------------------
"6.6.5.4 For unpack, it is an error if the index-type of the unpacked array
is exceeded."
This error is reported.
-----------------------------------
E.32 Square of large numbers
-----------------------------------
"6.6.6.2 Sqr(x) computes the square of x. It is an error if such a value
does not exist."
In other words it is an error if sqr(x) is too large to be represented
by real.
This error is reported.
----------------------------
E.33 ln(x) and x <= 0
----------------------------
"6.6.6.2 For ln(x), it is an error if x is not greater than zero."
This error is reported.
------------------------------------------
E.34 Square root of negative number
------------------------------------------
"6.6.6.2 For sqrt(x), it is an error if x is negative."
This error is reported.
-------------------------------
E.35 Problems with trunc
-------------------------------
"6.6.6.3 For trunc(x), the value of trunc(x) is such that if x is positive
or zero then 0<=x-trunct(x)<1; otherwise 1<x-trunc(x)<=0. It is an error
if such a value does not exist."
In other words it is an error to use "trunc" to convert a real number to an
integer number if the real number is outside the range of integer numbers
supported by the implementation.
For example
trunc(maxint+1.0)
is an error.
This error is not reported.
-------------------------------
E.36 Problems with round
-------------------------------
"6.6.6.3 For round(x), if x is positive or zero then round(x) is equivalent
to trunc(x+0.5), otherwise round(x) is equivalent to trunc(x-0.5). It is an
error if such a value does not exist."
In other words it is an error to use "round" to convert a real number to an
integer number if the real number is outside the range of integer numbers
supported by the implementation.
For example
round(maxint+1.0)
is an error.
This error is not reported.
-----------------------------
E.37 Problems with chr
-----------------------------
"6.6.6.3 For chr(x), the function returns a result of char-type that is
the value whose ordinal number is equal to the value of the expression x
if such a character value exists. It is an error if such a character value
does not exist."
This error is reported.
------------------------------
E.38 Problems with succ
------------------------------
"6.6.6.4 For succ(x), the function yields a value whose ordinal number is
one greater than that of x, if such a value exists. It is an error if such
a value does not exist."
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
------------------------------
E.39 Problems with pred
------------------------------
"6.6.6.4 For pred(x), the function yields a value whose ordinal number
is one less than that of x, if such a value exists. It is an error if such
a value does not exist."
This error is reported if range checking is enabled.
See also the "r" compiler option and the '$R' compiler directive.
----------------------------------------
E.40 Using eof on undefined files
----------------------------------------
"6.6.6.5 When eof(f) is activated, it is an error if f is undefined."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-----------------------------------------
E.41 Using eoln on undefined files
-----------------------------------------
"6.6.6.5 When eoln(f) is activated, it is an error if f is undefined."
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-------------------------------------
E.42 Using eoln at end-of-file
-------------------------------------
"6.6.6.5 When eoln(f) is activated, it is an error if eof(f) is true."
This error is not reported.
-------------------------------------
E.43 Using undefined variables
-------------------------------------
"6.7.1 An expression denotes a value unless a variable denoted by a
variable-access contained by the expression is undefined at the time of
its use, in which case that use is an error."
In other words it is an error to use an undefined variable in an expression.
This error is reported only if checking for undefined values is enabled
and the variable's type is one of the supported types
(See the "u" compiler option and the "$U" compiler directive).
----------------------------
E.44 Division by zero
----------------------------
"6.7.2.2 A term of the form x/y is an error if y is zero."
In other words for real division, it is an error if the denominator is zero.
This error is reported.
----------------------------
E.45 Division by zero
----------------------------
"6.7.2.2 A term of the form i div j is an error if j is zero."
In other words for integer division, it is an error if the denominator is
zero.
This error is reported.
---------------------------------------
E.46 Modulus of zero or negative
---------------------------------------
"6.7.2.2 A term of the form i mod j is an error if j is zero or negative."
In other words for the modulus operation, it is an error if the right
operand is zero or negative."
This error is reported if the right operand is zero.
This error is not reported if the right operand is negative.
--------------------------------------
E.47 Integer overflow/underflow
--------------------------------------
"6.7.2.2 It is an error if an integer operation or function is not performed
according to the mathematical rules for integer arithmetic."
I think this means that it is an error if integer operations or functions
overflow or underflow. So for example
maxint+maxint
should be an error since
maxint = 2,147,486,647
but due to integer overflow
maxint+maxint = -2
This error is not reported.
---------------------------------------------------
E.48 Returning undefined value from function
---------------------------------------------------
"6.7.3 It is an error if the result of an activation of a function is
undefined upon completion of the algorithm of the activation."
In other words it is an error if result of a function call is undefined.
This error is reported if checking for undefined values is enabled and
the type of the functions result is one of the supported types
(See the "u" compiler option and the "$U" compiler directive).
-------------------------------------------------
E.49 Assigning out of range ordinal values
-------------------------------------------------
"6.8.2.2 For an assignment-statement, it is an error if the expression is of
an ordinal-type whose value is not assignment-compatible with the type
possessed by the variable or function-identifier."
In other words it is an error to assign an out of range ordinal value
to a variable or a function result.
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
---------------------------------------------
E.50 Assigning out of range set values
---------------------------------------------
"6.8.2.2 For an assignment-statement, it is an error if the expression is of
a set-type whose value is not assignment-compatible with the type
possessed by the variable."
In other words it is an error to assign an out of range set value
to a variable.
NOTE: The previous error said "... the variable or function-identifier"
but this one just says "... the variable". Which seems to imply that it
is not an error to assign an out of range set value to a function result.
I don't see the point of allowing such assignments so this implementation
treats them as errors also and reports both types of assignments.
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
-----------------------------------
E.51 Non-matching case index
-----------------------------------
"6.8.3.5 For a case-statement, it is an error if none of the case-constants
is equal to the value of the case-index upon entry to the case-statement."
NOTE: As an extension Irie Pascal supports the "otherwise" keyword which
matches the case-index if none of the case-constants match the case-index.
So technically in that situation this error is not reported.
(See the "E" compiler option).
This error is reported if the range of the case-index's type is less
than a certain implementation limit
(See "B.5 Range of case-index's type & Number of case-list-elements").
------------------------------------------------
E.52 For loops initial value out of range
------------------------------------------------
"6.8.3.9 For a for-statement, it is an error if the value of the
initial-value is not assignment-compatible with the type possessed by
the control-variable, if the statement of the for-statement is executed."
In other words it is an error if the initial value specified on a for
statement is not in the range specified by the type of the control variable
and the loop is started.
For example given:
type num = 1..100;
var n : num;
then the following are errors:
for n := 0 to 100 do writeln(n);
or
for n := 101 downto 1 do writeln(n);
But the following are not errors since the for loops are never started
(and therefore no assignments are made to "n").
for n := 101 to 1 do writeln(n);
or
for n := 0 downto 100 do writeln(n);
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
----------------------------------------------
E.53 For loops final value out of range
----------------------------------------------
"6.8.3.9 For a for-statement, it is an error if the value of the
final-value is not assignment-compatible with the type possessed by
the control-variable, if the statement of the for-statement is executed."
In other words it is an error if the final value specified on a for
statement is not in the range specified by the type of the control variable
and the loop is started.
For example given:
type num = 1..100;
var n : num;
then the following are errors:
for n := 1 to 101 do writeln(n);
or
for n := 100 downto 0 do writeln(n);
But the following are not errors since the for loops are never started
(and therefore no assignments are made to "n").
for n := 1 downto 101 do writeln(n);
or
for n := 100 to 0 do writeln(n);
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
------------------------------------------
E.54 Reading invalid integer values
------------------------------------------
"6.9.1 On reading an integer from a text file, after skipping preceding
spaces and end-of-lines, it is an error if the rest of the sequence does
not form a signed-integer."
In other words it is an error if the program attempts to read an integer
from a text file but the next characters to be read from the text file can
not form an integer.
For example if a text file contains the following "z" and you try
to read in an integer value from this file it is an error.
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-----------------------------------------------
E.55 Reading out of range integer values
-----------------------------------------------
"6.9.1 On reading an integer from a text file, it is an error if the value
of the signed-integer read is not assignment-compatible with the type
possessed by the variable-access."
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
------------------------------------------
E.56 Reading invalid numeric values
------------------------------------------
"6.9.1 On reading a number from a text file, after skipping preceding spaces
and end-of-lines, it is an error if the rest of the sequence does not form
a signed-number."
In other words it is an error if the program attempts to read an integer
or a real from a text file but the next characters to be read from the
text file can not form an integer or real.
For example if a text file contains the following "z" and you try
to read in an integer or real value from this file it is an error.
This error is reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
-----------------------------------------
E.57 Reading when file is not open
-----------------------------------------
"6.9.1 It is an error if the buffer-variable is undefined immediately prior
to any use of read."
The only way I can see this happening is if the file is not open or has
been opened for writing. In both cases reading from such a file will
cause an error to be reported if I/O checking is enabled.
See the "i" compiler option and the '$I' compiler directive.
---------------------------------------------------------------
E.58 Writing with TotalWidth or FracDigits less than one
---------------------------------------------------------------
"6.9.3.1 On writing to a textfile, the values of TotalWidth and FracDigits
are greater than equal to one; it is an error if either value is less
than one."
In other words if you have
write(100:w)
or
write(100.23:w:f)
it is an error if "w" or "f" is less than one.
This error is reported if range checking is enabled.
See the "r" compiler option and the '$R' compiler directive.
--------------------------------------------
E.59 Problems with program-parameters
--------------------------------------------
"6.10 The execution of any action, operation, defined to operate on a
variable, is an error if the variable is a program-parameter and, as a
result of the binding of the program-parameter, the execution cannot be
completed as defined."
The bindings of program-parameters used by Irie Pascal are so simple that
this error can not occur.
-------------------------------------------
E.60 Problems with conformant arrays
-------------------------------------------
"6.6.3.8 For a conformant array, it is an error if the smallest or largest
value specified by the index-type of the actual-parameter lies outside
the closed interval specified by the index-type-specification of the
conformant-array-schema."
Irie Pascal does not support conformant arrays so this error can not occur.
---------------------------
Appendix F. I/O error codes
---------------------------
The following I/O error codes may be returned from various I/O operations.
If I/O checking is enabled (the default situation) then the compiler
generates code to automatically check I/O operation for errors and
report any errors detected.
If you want more control on how errors are handled you can disable
I/O checking either globally using the "i" compiler option or
locally using the '$I' compiler directive and then use the function
IOResult to check the result of I/O operations.
Value Error Code Cause
0 NoErrors I/O operation completed successfully
1 FileEraseFailure Attempt to erase a file failed
2 FileRenameFailure Attempt to rename a file failed
3 FileIsUndefined Attempt to operate on an undefined file
4 FileIsOpen Using assign, erase, or rename on an open file
5 FileIsNotOpen Attempt to perform I/O on a closed file
6 FileModeUndefined THIS SHOULD NEVER OCCUR
7 FileNameTooLong Attempt to give a file a name too long
8 FileNameNotDefined Attempt to erase or rename a file with no name
9 FilePosFailure Attempt to use pos on a file failed
10 FileSeekFailure Attempt to use seek on a file failed
11 NotOutputFile Attempt to write to a file not open for writing
12 UnexpectedEOF Attempt to read past end-of-file
13 WriteFailure Attempt to write to file failed
14 WidthTooLarge Attempt to write a field too wide
15 NotInputFile Attempt to read from a file not open for reading
16 ReadFailure Attempt to read from file failed
17 ClosingFailure Attempt to close a file failed
18 OpeningFailure Attempt to open a file failed
19 FileBufferIsEmpty Attempt to use put and the file-buffer is empty
20 ChDirFailure Attempt to change directory failed
21 FileExpandFailure Attempt to use "fexpand" failed
22 FileSplitFailure Attempt to use "fsplit" failed
23 FileSizeFailure Attempt to obtain size of file failed
24 FileOpenDirFailure Attempt to open directory failed
25 FileReadDirFailure Attempt to read directory entry failed
26 DirectoryIsUndefined Attempt to access directory variable failed
27 FileCloseDirFailure Attempt to close directory failed
28 FileRewindDirFailure Attempt to rewind directory failed
29 FileMkDirFailure Attempt to create directory failed
30 FileRmDirFailure Attempt to remove directory failed
31 FileGetDateFailure Attempt to get the date a file was last modified failed
32 FileGetModeFailure Attempt to get the "mode" of a file failed
33 FileGetTimeFailure Attempt to get the time a file was last modified failed
34 FileSetDateFailure Attempt to set the date a file was last modified failed
35 FileSetTimeFailure Attempt to set the time a file was last modified failed
36 FileRawReadFailure Attempt to use "rawread" failed
37 FileRawWriteFailure Attempt to use "rawwrite" failed
END