Welcome to the Irie Pascal for DOS User's Manual. Copyright (c) 1998-2001 Stuart King. All rights reserved. ----------------- Table Of Contents ----------------- 1 Introduction 1.1 What's new in version 2.00 1.2 Info 1.3 Editions 1.4 Compliance 1.5 Shareware 1.6 Prices 1.7 How To Register 1.8 License/Redistribution Rights 1.9 Disclaimer - Agreement 1.10 How to install/uninstall 1.10.1 Minimum system requirements 1.10.2 Installing Irie Pascal 1.10.2.1 Installing from the zip file 1.10.2.2 Installing from the self-extracting archive 1.10.2.3 Modifying your autoexec.bat 1.10.2.3.1 NO AUTOEXEC.BAT 1.10.2.3.2 HAVE AUTOEXEC.BAT 1.10.3 Uninstalling Irie Pascal 1.11 Product support 1.12 Contacting the author 2 Editing Pascal Programs 3 Compiling Pascal programs 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 Utilities 5.1 Using the Irie Upgrade Utility 5.2 Using the Irie Header 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 B.12 Number of source lines 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 FileInternalFailure, THIS SHOULD NEVER OCCUR DatabaseFailure, Attempt to access database failed ObjectCreateFailure, Attempt to create an object failed ObjectGetOrFuncFailure, Attempt to call an object method or get an object property failed ObjectFuncFailure, Attempt to call an object method function failed ObjectProcFailure, Attempt to call an object method procedure failed ObjectPutFailure, Attempt to set an object property failed ObjectGenericFailure, Attempt to access a generic object failed MemoryAllocationFailure, Attempt to allocate memory failed InvokeException An object being accessed raised an exception ---------------- 1 Introduction ---------------- ------------------------------ 1.1 What's new in version 2.00 ------------------------------ The major changes in Irie Pascal version 2.00 are as follows: First the bad news. The alignment of string fields in unpacked records has been changed. This affects applications that read or write binary files of unpacked records that contain string fields. Applications compiled with this version of Irie Pascal will not be able to read such binary files written by applications compiled with previous versions of Irie Pascal and vice-versa. If you use such applications you should convert your files before upgrading to this version. It might be simpliest to write simple programs using a previous version of Irie Pascal to read in the unpacked records and assign them to packed records (a field at a time) and write out the packed records to a new file. You would then need to change your applications to read and write packed records. If you are unsure whether you are affected by this change please don't hesitate to contact me for clarification (See "1.12 Contacting the author" below). The behaviour of the built-in procedures write, and writeln has been slightly altered to fully comply with Standard Pascal. These procedures now output only the specified number of characters from a string if you specify a width that is shorter than the string actually is. For example write('This is a string':7) will output only the first 7 characters like so This is because the width specified is 7. Previous version of Irie Pascal would output the entire string regardless of the width specified. If you have applications that rely on the behaviour of the previous versions of Irie Pascal then these applications will have be modified if you upgrade to this version. Now for the good news. Irie Pascal for Windows now includes an Integrated Development Environment (IDE). The IDE features a standard Windows interface that allows you to edit, compile, and run your pascal programs, all in one place. The IDE also includes detailed on-line help. A standard Windows setup applications is now included with Irie Pascal for Windows making installing and uninstalling Irie Pascal for Windows much simplier than before. Irie Pascal for Windows now supports using COM objects. Applications running under the Windows edition can call methods, get and set properties in COM objects that support late-binding. If you are in doubt about whether a particular COM object supports late-binding then note that COM objects that support scripting languages such as VBScript and JavaScript also support late binding, and can probably used by Irie Pascal applications. NOTE: All COM objects generated by Visual Basic support late-binding. Irie Pascal now supports database programming (ODBC and MySQL). Applications running under the Windows edition can access databases via ODBC. This allows Irie Pascal applications to access almost all Windows databases, since almost all major Windows database engines support ODBC (including MS SQL Server, Oracle, and MS Access). Applications running under the Linux, FreeBSD, and Solaris editions can access MySQL databases. Declarations of list type can now refer to types that have not yet been defined. So for example list of t is allowed even if t has not yet been declared. NOTE: The declaration of t must follow later. The -oName compiler option has been added to the command-line version of the compiler and allows you to specify the name of the executable generated by the compiler. The -hHeader compiler option has been added to the command-line version of the compiler and allows you to specify a #! header to be placed in front of the generated executable. This header should point at the location of the interpreter, so that the executable can be run under "UNIX-like" operating systems (such as Linux, FreeBSD, and Solaris) by just typing the name of the executable. NOTE: You also need to set the permissions for this to work. This header is ignored under "non UNIX-like" operating systems so including this header does not prevent the executable from running under any supported operating system. A built-in function called "UnixPlatform" is now supported. This built-in function allows applications to detect whether they are running under a UNIX-like operating system (currently Linux, FreeBSD, or Solaris). A built-in procedure called TrapErrors is now supported. This built-in procedure can be used to control whether errors are automatically trapped at run-time. Applications that perform custom error handling would turn error trapping off (with TrapErrors(false)) before executing code that may cause an error. The application would then call "GetLastError" to determine what error if any occured. New applications should use "TrapErrors" instead of the (*$I-*) compiler directive which does the same thing. The (*I-*) compiler directive continues to be supported for compatibility reasons only. A built-in function called "GetLastError" is now supported. This built-in function can be used to retrieve the code of the last error that occured (assuming error trapping has been turned off). New applications should use "GetLastError" instead of "IOResult", which does the same thing. "IOResult" continues to be supported for compatibility reasons only. The ordering of global declarations has been further relaxed. When relaxed declarations is in effect (see the -erd compiler option) global declarations can be made in any order (i.e. global label, constant, type, and variable declarations can occur after global function and procedure declarations. Added support for // comments. A built-in function called "supported" is now supported. This built-in function allows applications to detect whether particular features are supported under the current platform and take appropriate action. For example applications should check whether ODBC support is available before attempting to use ODBC to connect to a database, like so if supported(feature_odbc) then begin //Use ODBC to connect to the database end else if support(feature_mysql) then begin //Connect to the MySQL database end else begin //Proceed with no database support or abort end A built-in function called "PlatformVersion" is now supported. This built-in function can be used to determine the version of the current platform. Here platform refers to the Irie Virtual Machine Interpreter not the operating system. Applications can use this function to determine whether particular built-in functions or procedures are available before attempting to use them. A built-in functions called "FileMatch" is now supported. This built-in function can be used to determine if a particular filename matches a file specification (the file specification can contain wild cards). A built-in procedure called "crc32" is now supported. This built-in procedure can be used to generate 32-bit CRCs (Cyclic Redundancy Check). CRCs are usful for checking the integrity of files. A built-in procedure called "popen" is now supported. This built-in procedure can be used to execute a program and open a pipe to it at the same time. You can then write to or read from the pipe to exchange information between the executing program and your application. For example this procedure can be used to send email on "UNIX like" platforms by executing "sendmail" and open a pipe to it. You can then write the email you want to send through the pipe to the "sendmail" program. Turbo Pascal style character constants #charcode are now supported. For example const LineFeed = #10 is now supported. A built-in file type named "binary" is now supported. Applications can read and write data of almost any type to and from files of this type. A built-in type called "cstring" is now supported. This type stores strings in C format (i.e. null terminated char arrays). This type is useful for passing string data to and from external functions written in C. The warning 'id defined but never used' is suppressed for ids declared when this warning is turned off. (i.e. this allows you to use the $W44- compiler directive to suppress this warning for one or more identifiers). This is useful when including libraries with many declarations most of which you don't use. -------- 1.2 Info -------- 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 programs (including CGI scripts). Irie Pascal is highly compatible with Standard (ISO/IEC 7185) Pascal. 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 many extensions to Standard Pascal, particularly in the areas of string, file/directory processing, and database programming, 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 includes a compiler, and an interpreter. The compiler translates Pascal programs into Irie Virtual Machine (IVM) executables, which are then executed by the interpreter. The IVM is an abstract computer platform that is implemented in software (by the interpreter), and runs executables on many different computer platforms. The IVM has been implemented on seven computer platforms (Win95/98/NT, DOS, OS/2, Linux, FreeBSD, Solaris/x86, and Solaris/Sparc) so far. IVM executables developed on any platform, run on all seven platforms. Irie Pascal's ability to generate executables which run on multiple platforms make it ideally suited for creating internet applications. The Common Gateway Interface (CGI) is a simple but powerful protocol for creating server side internet applications. Irie Pascal assists the creation of CGI scripts with built-in support for decoding and parsing URL encoded strings, as well as support for databases, and sending email. Irie Pascal also supports the UNIX #! trick that allows the location of the interpreter to be embedded inside the script making it easier to execute the script from a URL, since the URL need only refer to the script and not the interpreter. See the "CopyWord", "CountWords", and "URLDecode" procedures in the Programmer's Reference Manual. ------------ 1.3 Editions ------------ Irie Pascal is distributed in seven editions, which are: 1. Irie Pascal for Windows (requires Win95 or later) 2. Irie Pascal for DOS (requires DOS 5.0 or later) 3. Irie Pascal for Linux 4. Irie Pascal for FreeBSD 5. Irie Pascal for OS/2 (requires OS/2 2.0 or later) 6. Irie Pascal for Solaris 7. Irie Pascal Universal Irie Pascal for Solaris includes both a compiler and an interpreter for Solaris/x86, but just an interpreter for Solaris/Sparc. As a result you can compile and execute programs on Solaris/x86, but you can only execute programs on Solaris/Sparc. Irie Pascal Universal is a collection of all the other editions. If you plan to use Irie Pascal on more than one operating system platform then it is more economical to register the Universal edition, rather than registering more than one of the other editions. -------------- 1.4 Compliance -------------- Irie Pascal complies with the requirements of level 0 of ISO/IEC 7185, with the following exceptions: (see Appendix A Deviations from ISO/IEC 7185). NOTE: 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. ------------- 1.5 Shareware ------------- Irie Pascal is shareware and as such there is an evaluation version and a registered version. The evaluation version of Irie Pascal is provided at no charge so you can try it before you buy. 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. 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 executables. The second difference is that programs compiled by the evaluation version expire the next day, while programs compiled by the registered version never expire. These differences are intended to encourage users of the evaluation version to register and receive a copy of the registered version. NOTE: Irie Pascal does not prevent users of the evaluation version from recompiling expired programs to keep them running. ---------- 1.6 Prices ---------- The registration fee for the Windows, DOS, OS/2, Linux, FreeBSD, and Solaris editions is US$25.00, or UK 15.00 Pounds, or CA$39.00 each. The registration fee for the Universal edition is US$40.00, or UK 24.00 Pounds, or CA$62.00. When registering, please remember to include the shipping and handling fee which is US$5.00, or UK 3.00 Pounds, or CA$8.00. ------------------- 1.7 How To Register ------------------- Irie Pascal can be registered using the IrieTools website at: www.irietools.com If you pay the registration fee by credit card you have the option of taking advantage of our Electronic Software Delivery (ESD) service. The ESD service allows you to download the registered version Irie Pascal immediately after you pay the fee, avoiding the wait for it to arrive in the mail, and also avoiding the shipping and handling fee). You also have the option of receiving the registered version of Irie Pascal through the mail. If you prefer to pay the registration fee by check or money order you can still register using the IrieTools website, in this case the website will generate an order form for you, which you can then print out from your browser. The check or money order should be made out to "Stuart King" and sent, along with the order form, to: Stuart King MB #247 221 S. State Road 7 Ft. Lauderdale, Fl 33317 U.S.A. Please do not send cash. You can also register Irie Pascal using one of the order forms that are included with the evaluation version. Just complete the appropriate order form and mail it in along with a check or money order for the registration fee. Again 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. 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 you will receive an email notice when the registered version of Irie Pascal is mailed 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. 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 DOS are entitled to receive free (regular shipping and handling charges may apply) upgrades to all registered versions of Irie Pascal for DOS released after they register. Registered users of Irie Pascal for DOS 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 DOS 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.12 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.12 Contacting the author"). Anyone distributing Irie Pascal for any kind of remuneration must first contact the author (see "1.12 Contacting the author" below) for authorization. --------------------------------- 1.8 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. 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 that you have compiled using Irie Pascal. A non-exclusive, royalty-free right to reproduce and distribute unaltered copies of the Irie Virtual Machine Interpreter, for the sole purpose of allowing the execution of programs you have compiled using Irie Pascal. A non-exclusive, royalty-free right to use the utility programs that are included with Irie Pascal. -------------------------- 1.9 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.10 How to install/uninstall ---------------------------- --------------------------------- 1.10.1 Minimum system requirements --------------------------------- - DOS 5.0 or later - 17 MB disk space ---------------------------- 1.10.2 Installing Irie Pascal ---------------------------- Irie Pascal for DOS is distributed as a self-extracting archive ("ipd-200.exe") or as a zip file ("ipd-200.zip"). The zip file is smaller than the self extracting achive but requires you to have an unzip utility to extract the files. The self-extracting archive is larger than the zip file but you don't need an unzip utility (you just run it to extract the files). NOTE: The self-extracting archive is actually a Windows 3.1 program so you will need to run it from windows. NOTE: Installing Irie Pascal requires making modifications to your autoexec.bat file. If you have never modified your autoexec.bat or if you are uncomfortable doing so then have someone who has done this before assist you. If you decide to modify your autoexec.bat please remember to use a text editor and not a word processor (I recommend using the "edit" command). You may wish to make a backup copy of your autoexec.bat before you begin making modifications, to help you recover from mistakes. The section "1.10.2.3 Modifying your autoexec.bat" gives more information about how and why you should modify your autoexec.bat. ------------------------------------ 1.10.2.1 Installing from the zip file ------------------------------------ If you have the zip file (ipd-200.zip) 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. modify your autoexec.bat See "1.10.2.3 Modifying your autoexec.bat"). 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" into the directory you just created. G) Unzip the sample files. H) Reboot your computer. --------------------------------------------------- 1.10.2.2 Installing from the self-extracting archive --------------------------------------------------- If you have the self-extracting archive the recommended installation procedure is as follows: A) Run the archive, it will prompt you for a directory to store the files (I suggest you store the files in c:\irie). B) Add the directory created in A) to the path. (i.e. modify your autoexec.bat See "1.10.2.3 Modifying your autoexec.bat"). C) Run the self-extracting archive containing the sample pascal programs, it will prompt you for a directory to store the files (I suggest you store the sample files in c:\irie\samples). D) Reboot your computer. ----------------------------------- 1.10.2.3 Modifying your autoexec.bat ----------------------------------- The reason for modifying your autoexec.bat file is to add the directory you installed Irie Pascal into to the path. When you try to execute a program from the command line, and you don't specify where it's located, DOS will search for the program, first in the current directory and then in the directories listed in the path. So by adding the directory you installed Irie Pascal into to the path, you can execute it from any directory. Please make sure you have read the NOTE: in "1.10.2 Installing Irie Pascal" before proceeding. If you decide to modify your autoexec.bat then you can do the following: Enter EDIT c:\autoexec.bat at a dos prompt. If you don't have an autoexec.bat then you will get a blank file. Proceed to "NO AUTOEXEC.BAT" below. If you have an autoexec.bat, Edit will open it so proceed to "HAVE AUTOEXEC.BAT" below. ------------------------- 1.10.2.3.1 NO AUTOEXEC.BAT ------------------------- If you don't have an autoexec.bat file then enter the following line PATH C:\IRIE in the blank edit window (change C:\IRIE to whatever directory you installed Irie Pascal into). Save the file, by selecting "Save" from the "File" menu. Exit Edit (select "Exit" from the "File" menu) and you're done. Continue with the installation. --------------------------- 1.10.2.3.2 HAVE AUTOEXEC.BAT --------------------------- If Edit has opened your autoexec.bat then then search the file for one or more lines beginning with PATH or SET PATH= If there are no such lines then add the following line PATH C:\IRIE (change C:\IRIE to whatever directory you installed Irie Pascal into) Save file by selecting "Save" from the "File" menu. Exit Edit (select "Exit" from the "File" menu) and you're done. Continue with the installation. If you see a line (or more than one) that begins with PATH or SET PATH= then add ;C:\IRIE to the end of one of the lines (change C:\IRIE to whatever directory you installed Irie Pascal into). For example the PATH in my autoexec.bat looks like PATH C:\WINDOWS;C:\DOS;C:\BIN;C:\IRIE Save file by selecting "Save" from the "File" menu. Exit Edit (select "Exit" from the "File" menu) and you're done. Continue with the installation. ------------------------------ 1.10.3 Uninstalling Irie Pascal ------------------------------ Irie Pascal for DOS 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.11 Product support -------------------- All your comments about Irie Pascal are welcome. Especially 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 IrieTools web site at http://www.irietools.com You can also contact me directly with your technical support questions. -------------------------- 1.12 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. --------------------------- 2.0 Editing Pascal Programs --------------------------- You will need to use a text editor to create and edit your Pascal programs. Unfortunately Irie Pascal for DOS does not yet include a text editor so you will need one from another source. A basic editor "edit" is included with DOS and can be used with Irie Pascal. "Edit" is accesed by entering "edit" at a command-line prompt. There are numerous other text editors (freeware, shareware, and commercial) which can also be used with Irie Pascal. ----------------------------- 3.0 Compiling Pascal programs ----------------------------- Computer processors are built to execute programs made up streams of numeric codes. These numeric codes make up what are called low-level or machine languages. Humans prefer, and are much better at, using languages made of words and symbols. These languages are called high-level languages, of which Pascal is one. However computers don't generally understand high-level languages and so we have a problem. One the one hand we have computers that can only execute programs written in low-level languages, and on the other hand we have humans who are much better at creating programs in high-level languages. There are three common solutions to this problem. The first solution is to write a program that will translate programs written in a high-level language into equivalent programs written in a low-level language. Then instead of trying to execute the program written in the high-level language, the computer processor executes the equivalent low-level language program. The process of translating a high-level language program into its low-level equivalent is called compiling, and the program that does the translation is called a compiler. The main advantage of this solution is that the translation from high-level language to low-level language takes place BEFORE the program is executed so the low-level language program runs at full-speed. The main disadvantage of this solution is that not all computer processors understand the same low-level language. As a result the low-level language program generated by the compiler will run on some computer processors but not on others. The second solution is to write a program that reads a program written in a high-level language and performs the equivalent actions specified by the high-level program. This process is called interpreting and the program that does this is called an interpreter. The main advantage of this solution is that the high-level language programs can be executed on almost any computer as long as an interpreter for that high-level language is on that computer. The main disadvantage of this solution is that the high-level language program is being indirectly executed by the computer processor, and this slows things down considerably. One way to think of it is that the translation from high-level language to low-level language is taking place WHILE the program is running. The third solution is to write a program that will translate programs written in a high-level language into equivalent programs written in a low-level language for an idealized imaginary computer (called a virtual machine). The low-level language programs are then executed by an interpreter. This solution preserves the main advantage of the second solution because programs compiled into their low-level equivalent can be executed on almost any computer as long as an interpreter for the low-level language exists on the computer. This solution also reduces some of the disadvantage of the second solution because interpreting a program written in a low-level language is considerably faster then interpreting a program written in a high-level language. Basically with a low-level language the interpreting doesn't have to spend alot of time trying to recognize words and symbols. Irie Pascal uses the third solution and includes both a compiler and an interpreter. NOTE: I'm not suggesting that any solution, even the one used by Irie Pascal, is best in all cases. The Irie Pascal Compiler translates Pascal programs into Irie Virtual Machine executables (IVM executables). 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 2.00 for DOS Copyright (c) 1998-2000 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 'output' 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 is at the end. 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 first message and try to fix the problem causing that message 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 Compiling Pascal programs" 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 that 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: This compiler option controls support for the the following operators: "and_then", "or_else", "xor", "shl", and "shr". In addition this compiler option also controls whether the following operators can be used to perform bitwise operations: "and", "or", "not", and "xor". And finally this compiler option also controls whether the "+" operator can be used to perform string concatenation. 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: 'h' Purpose: Specifies a #! header to be placed in front of the executable Syntax: -hHeader Default: No header specified Notes: UNIX-like operating system (such as Linux, FreeBSD, and Solaris) use #! headers to locate the interpreters that should be used to execute programs. When a UNIX-like operating system attempts to execute a program and the first two characters in the program are #!, the operating system will assume that the program needs to be interpreted, and it will expect the location of the interpreter to follow the #!. So for example if the interpreter was installed in "/usr/local/bin", you would store "#!/usr/local/bin/ivm" in front of the program. If you were compiling a file named "hello.pas" you could enter ipc hello -h/usr/local/bin/ivm which would generate an executable named hello.ivm which has "#!/usr/local/bin/ivm" in front (the "#!" is automatically inserted). After setting the execution permissions on "hello.ivm" ("chmod a+x hello.ivm" for example). you can then execute "hello.ivm", by entering "hello.ivm" or "./hello.ivm" (if the current directory is not in the system path). There is no need to specify the interpreter like "ivm hello.ivm" or "ivm ./hello.ivm" which would normally be required if there was no #! header in front of "hello.ivm". ------------------------------ 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. You should leave 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: 'o' Purpose: Specifies the name of the output executable Syntax: -oNAME Default: The name of the output executable is derived from the name of the input file by changing the extension to .ivm. Notes: Suppose you have a file called 'hello.pas' but you want the executable to be 'greeting.ivm'. You could use this option as follows ipc hello.pas -ogreeting.ivm ------------------------------ 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/disables 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 string16 = string[16]; 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. The use of this directive is no longer recommended. New programs should use the "TrapErrors" procedure instead. The $I directive continues to be supported for compatibility reasons only. ------------------------------ Directive: '$I' Purpose: The compiler replaces the include directive with the contents of a file. Syntax: {$I filename} Notes: "filename" specifies the file which should be 'included'. ------------------------------ 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/disables 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. You can use (*W44-*) to suppress the "id declared but not used" warning for particular identifiers (i.e. this particular warning will never be issued for identifiers declared when this warning message is disabled). This is intended to allow libraries of declarations to be included in program, without any warnings being issued about particular declarations not being used, since usually when a library is included in a program not all the declarations are actually used by the program. ------------------------------ ---------------------------------------------- 4.0 Using the Irie Virtual Machine Interpreter ---------------------------------------------- The Irie Virtual Machine Interpreter is used to run Irie Virtual Machine executables. 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 Utilities ---------------------------- ---------------------------------- 5.1 Using the Irie Upgrade Utility ---------------------------------- The Irie Upgrade 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.10 for DOS and you wish to upgrade to the latest version of Irie Pascal for DOS, you would download the upgrade for version 1.10 d110exe.upg and place it in the same directory as ipd-110.exe. You then enter ivm upgrade d110exe.upg The Irie Upgrade Utility will generate ipd-200.exe. --------------------------------- 5.2 Using the Irie Header Utility --------------------------------- The Irie Header Utility can be used to create IVM executables with #! headers. #! headers can be used by UNIX like operating systems (such as Linux, FreeBSD, or Solaris) to locate the interpreters that should be used to execute programs. When a UNIX like operating system attempts to execute a file and the first two characters in the file are #!, the operating system will assume that the file needs to be interpreted, and it will expect the location of the interpreter to follow the #!. The syntax is: ivm header input-executable output-executable [location] where input-executable - is the ivm executable you want to use to create the new executable from. output-executable - is the ivm executable you want to create location - if specified is the location of the interpreter to put in the #! header. So for example if the interpreter was installed in "/usr/local/bin", you would store "#!/usr/local/bin/ivm" in front of the executable. So for example if you had an IVM executable named "hello.ivm" you could enter "ivm header hello.ivm hello /usr/local/bin/ivm", which creates a new executable called "hello" which has "#!/usr/local/bin/ivm" in front (the "#!" is automatically inserted). In order to be able to execute "hello" you also need to set the executable permissions on (using "chmod a+x hello" for example). --------------------------------------- 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) 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 by some operating systems) 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). -------------------------------- 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 you. NOTE: These limits are not set in stone so in the unlikely event that any of these limits do in fact inconvenience you than don't hesitate to complain about it (just email support@irietools.com). -------------------------- B.1 Length of source lines -------------------------- The maximum length of a source line is 400 characters. If you exceed this limit the compiler issues a fatal 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 as illustrated below: begin ... begin ... end ... end 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 maximum 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 can be 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 4,294,967,295 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. --------------------------- B.12 Number of Source Lines --------------------------- Irie Pascal limits the maximum number of source lines that can be compiled to 4,294,967,295. If you exceed this limit the compiler will issue a fatal error message. (see "3.1 Compiler messages"). ------------------------------------------ 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 double 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 in the 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 set of characters in the execution character set (usually ASCII or ANSI) as the values of the 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 execution 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 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 End-Of-File (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. This reduces the likelihood that your program will be waiting for the user to type in some data (input operation), but the prompt telling the user what to type in has not yet appeared on the screen (output operation). 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 output 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 exist. 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 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-trunc(x)<1; otherwise -1