home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / modula2 / compiler / taylmod2 / readme.txt < prev    next >
Text File  |  1988-06-30  |  26KB  |  762 lines

  1. TaylorModula-2 for MS-DOS: Demo Kit         Document Nr. MD2-DK-003-1988
  2. ------------------------------------------------------------------------
  3.  
  4.  
  5. This document describes the contents and possibilities of the
  6. TaylorModula-2 Demo Kit.
  7.  
  8.  
  9. 1. DEMO KIT INSTALLATION
  10.  
  11. The demo diskette contains the following files:
  12.  
  13.   DC.BAT       - Explains, compiles and executes Dhrystone 1.0 Benchmark.
  14.   DHRY.MOD     - Main module of Dhrystone 1.0 Benchmark.
  15.   DHRY1.DEF    - Definition module 1 of Dhrystone 1.0 Benchmark.
  16.   DHRY1.MOD    - Implementation module 1 of Dhrystone 1.0 Benchmark.
  17.   DHRY2.DEF    - Definition module 2 of Dhrystone 1.0 Benchmark.
  18.   DHRY2.MOD    - Implementation module 2 of Dhrystone 1.0 Benchmark.
  19.   DHRY3.DEF    - Definition module 3 of Dhrystone 1.0 Benchmark.
  20.   DHRY3.MOD    - Implementation module 3 of Dhrystone 1.0 Benchmark.
  21.   HELLO.MOD    - Very simple program example.
  22.   MOD.BAT      - Batch procedure compiling, linking, and executing a
  23.                  Modula-2 main module or compiling and storing a
  24.                  Modula-2 implementation module into a library.
  25.   README.TXT   - This text.
  26.   RUNTIME.DLB  - Definition library of runtime system modules,
  27.                  small memory model.
  28.   RUNTIME.ILB  - Implementation library of runtime system modules,
  29.                  small memory model.
  30.   RUNLARGE.DLB - Definition library of runtime system modules,
  31.                  large memory model.
  32.   RUNLARGE.ILB - Implementation library of runtime system modules,
  33.                  large memory model.
  34.   SIEVE.MOD    - Sieve of Eratosthenes Benchmark.
  35.   STANDARD.DLB - Definition library of standard library modules,
  36.                  small memory model.
  37.                  (limited).
  38.   STANDARD.ILB - Implementation library of standard library modules,
  39.                  small memory model.
  40.                  (limited).
  41.   STDLARGE.DLB - Definition library of standard library modules,
  42.                  large memory model.
  43.                  (limited).
  44.   STDLARGE.ILB - Implementation library of standard library modules,
  45.                  large memory model.
  46.                  (limited).
  47.   TLIB.EXE     - Librarian.
  48.   TLINK.EXE    - Linker.
  49.   TMODULA.EXE  - Compiler (limited).
  50.   TREE.MOD     - Binary Tree Benchmark.
  51.  
  52. To install the TaylorModula-2 demo kit, simply copy all files from the
  53. demo diskette into a subdirectory of your disk or onto a work diskette.
  54.  
  55. IMPORTANT: Your CONFIG.SYS file should allow DOS for at least 20 file
  56.            handles held open simultaneously. If necessary, insert the
  57.            line
  58.  
  59.              FILES=20
  60.  
  61.            into your CONFIG.SYS file.
  62.            If the number of files is too small, TaylorModula will
  63.            respond with "Cannot open file ..." error messages.
  64.  
  65.  
  66. To quickly compile and run your first TaylorModula-2 program, enter
  67.  
  68.   MOD HELLO
  69.  
  70. at the DOS prompt.
  71.  
  72.  
  73. 2. FILES AND LIBRARIES
  74.  
  75. TaylorModula-2 deals with the following file types:
  76.  
  77.   - Modula-2 sources of definition, implementation, and main modules.
  78.     They are standard ASCII text files.
  79.  
  80.   - Modula-2 objects of implementation and main modules as created by
  81.     the compiler.
  82.  
  83.   - Modula-2 definition libraries contain the 'objects' of definition
  84.     modules as created by the compiler. The compiler imports modules
  85.     from definition libraries and stores compiled definitions in them.
  86.     Definition libraries are created and managed by the librarian TLIB.
  87.  
  88.   - Modula-2 implementation libraries are a collection of implementation
  89.     or main module objects. The linker imports modules from
  90.     implementation libraries. Implementation libraries are created and
  91.     managed by the librarian TLIB.
  92.  
  93.   - Executable programs as created by the linker. They conform to the
  94.     MS-DOS .EXE-Format.
  95.  
  96. NOTE:
  97.  
  98. If you want to import from other libraries than STANDARD and RUNTIME
  99. (STDLARGE and RUNLARGE in the large memory model) or libraries not
  100. contained in the default drive and directory, you must set up a DOS
  101. environment variable TLIBS (small memory model) or TLIBL (large memory
  102. model) which contains the path names of all libraries from which you
  103. want to import in compiler and linker.
  104. If you do not end the list of libraries by a semicolon, you will be
  105. prompted for additional libraries by compiler and linker.
  106.  
  107. Example:
  108.  
  109. You have created your own libraries, MYLIB1 and MYLIB2 from which you
  110. want to import in the compiler (MYLIB1.DLB and MYLIB2.DLB) or the linker
  111. (MYLIB1.ILB and MYLIB2.ILB). All your libraries are stored in the \LIB
  112. directory. To set them up, enter:
  113.  
  114.   SET TLIBS=\LIB\MYLIB1 \LIB\MYLIB2 \LIB\STANDARD \LIB\RUNTIME;
  115.  
  116.  
  117. 3. OPERATING
  118.  
  119. The two steps necessary to convert Modula-2 sources to an executable
  120. .EXE file are:
  121.  
  122.   - First compile the necessary definition, implementation and main
  123.     modules.
  124.  
  125.   - Then link the necessary modules in order to get an executable
  126.     .EXE-file.
  127.  
  128.  
  129.    3.1  COMPILER
  130.  
  131. The compiler performs two different tasks:
  132.  
  133.   - It compiles definition modules and stores the compiled form in a
  134.     definition library.
  135.  
  136.   - It compiles main and implementation modules and stores the object in
  137.     a file.
  138.  
  139. The evocation format of the compiler is:
  140.  
  141. For code generating modules (main and implementation, not definition
  142. modules):
  143.  
  144.   TMODULA source object listing
  145.  
  146. For definition modules:
  147.  
  148.   TMODULA source library listing
  149.  
  150. source is the name of the source file to be compiled.
  151.  
  152. object is the name of the object file to be created.
  153.  
  154. library is the name of the definition library to store the compiled
  155.         definition module.
  156.  
  157. listing is the name of the listing file to be created. If you do not
  158.         want a listing to be created (which reduces compilation time),
  159.         specify NUL as listing file name.
  160.  
  161. Any missing or wrong (e.g. files not found) parameters must be entered
  162. via standard input.
  163.  
  164. Examples:
  165.  
  166. To compile the source SIEVE.MOD into an object code file SIEVE.COD
  167. and a listing SIEVE.LST, simply enter
  168.  
  169.   TMODULA SIEVE;
  170.  
  171. To compile the definition module DHRY1.DEF with the compiled definition
  172. stored in \LIB\MYLIB1.DLB and the listing sent directly to the printer,
  173. enter
  174.  
  175.   TMODULA DHRY1.DEF \LIB\MYLIB1 PRN
  176.  
  177.  
  178.    3.2  LINKER
  179.  
  180. The linker collects all code modules required to create an executable
  181. program. You can explicitly specify the modules to be linked or let the
  182. linker search them among the implementation libraries (STANDARD.ILB and
  183. RUNTIME.ILB or the ones specified in the TLIBS environment variable).
  184.  
  185. The evocation format of the linker is:
  186.  
  187.   TLINK mod1{+modi} exefile listing
  188.  
  189. mod1 and the (optional and repeatable) modi are the object code
  190.      modules to be linked explicitly. They must be separated by plus
  191.      signs.
  192.  
  193. exefile is the name of the .EXE file to be created.
  194.  
  195. listing is the name of the listing file to be created. If you do not
  196.         want a listing to be created (which reduces linkage time),
  197.         specify NUL as listing file name.
  198.  
  199. Any missing or wrong (e.g. files not found) parameters must be entered
  200. via standard input.
  201.  
  202. Examples:
  203.  
  204. To link the main module SIEVE.COD creating the program SIEVE.EXE and
  205. a listing SIEVE.LST, simply enter
  206.  
  207.   TLINK SIEVE;
  208.  
  209. To link the modules DHRY.COD, DHRY2.COD and DHRY3.COD without a listing
  210. and creating the program DHRY.EXE, enter
  211.  
  212.   TLINK DHRY+DHRY2+DHRY3,,NUL
  213.  
  214.  
  215.    3.3  LIBRARIAN
  216.  
  217. The librarian manages definition and implementation libraries. You can
  218. create, list and reorganize libraries and delete members. In
  219. implementation libraries, you can add and extract object code files. The
  220. librarian creates an optional library listing file containing the
  221. alphabetic list of modules contained in the library with their version
  222. and size, and how many percents of the library file size are actually
  223. occupied by its members. Although you add an object code file by its
  224. file name, all members in a library are identified by their module name.
  225. Remember that module names (like other identifiers) are case sensitive
  226. in Modula-2!
  227.  
  228. The evocation format of the librarian is:
  229.  
  230.   TLIB library[/C|/R] listing {op};
  231.  
  232. library is the definition or implementation library to be operated on.
  233.         Its default extension is .ILB for implementation libraries.
  234.         Specify .DLB for definition libraries.
  235.  
  236. listing is the name of the listing file to be created. If you do not
  237.         want a listing to be created (which reduces library management
  238.         time), specify NUL as listing file name.
  239.  
  240. op is a list of operations terminated by a semicolon. Operations
  241.    supported are:
  242.  
  243.     +file   - append the object file to the library or replace it (for
  244.               implementation libraries only). file is a DOS file name.
  245.  
  246.     -module - delete the module from the library. module is the module
  247.               name (an identifier).
  248.  
  249.     *module - extract the module from the library and create an object
  250.               file (for implementation libraries only). module is the
  251.               module name (an identifier).
  252.  
  253.   /C specifies that a new empty library be created. The library type
  254.   (definition or implementation library) is derived from the library
  255.   name extension.
  256.  
  257.   /R specifies that the library be reorganized. Reorganize your
  258.   libraries before the used space is less than 50 % (the listing will
  259.   show the percentage used).
  260.  
  261. Any missing or wrong (e.g. files not found) parameters must be entered
  262. via standard input.
  263.  
  264. Examples:
  265.  
  266. To create a new implementation library MYLIB1.ILB and add the object
  267. files DHRY2.COD and DHRY3.COD to it without creating a listing, enter
  268.  
  269.   TLIB MYLIB1/C NUL +DHRY2 +DHRY3;
  270.  
  271. To list the contents of the library STANDARD.DLB to the printer, enter
  272.  
  273.   TLIB STANDARD.DLB PRN;
  274.  
  275.  
  276.     3.4  BATCH PROCEDURE MOD
  277.  
  278. MOD is a simple batch procedure performing two different tasks:
  279.  
  280.   - It compiles, links and executes main modules. The modules required
  281.     for linkage are expected to reside in the libraries specified in the
  282.     environment variable TLIBS (or in STANDARD and RUNTIME).
  283.  
  284.   - It compiles implementation modules and stores the object in a
  285.     library.
  286.  
  287. The evocation format of the MOD procedure is:
  288.  
  289.   For main modules:
  290.  
  291.   MOD source
  292.  
  293.   For implementation modules:
  294.  
  295.   MOD source library
  296.  
  297.   source is the name of the source file to be compiled (the extension is
  298.          .MOD, you MUST NOT specify it).
  299.  
  300.   library is the name of the implementation library to store the
  301.           compiled implementation module.
  302.  
  303. Compiling modules with the MOD procedure does not create any listing at
  304. all.
  305.  
  306. Examples:
  307.  
  308. To compile, link and execute the source TREE.MOD, enter
  309.  
  310.   MOD TREE
  311.  
  312. To compile the implementation module DHRY2.MOD and store its
  313. implementation in library \LIB\MYLIB1.ILB, enter
  314.  
  315.   MOD DHRY2 \LIB\MYLIB1
  316.  
  317.  
  318. 4. METACOMMANDS
  319.  
  320. The compiler recognizes the following metacommands (embedded into source
  321. comments):
  322.  
  323.   $CaseCheck+/-       Enables or disables CASE range checking.
  324.   $Checks+/-          Enables or disables all runtime checks.
  325.   $LineNumbers+/-     Enables or disables error location saving.
  326.   $NilCheck+/-        Enables or disables NIL pointer checking.
  327.   $OverflowCheck+/-   Enables or disables integer overflow checking.
  328.   $RangeCheck+/-      Enables or disables range checking.
  329.   $StackCheck+/-      Enables or disables stack overflow checking.
  330.  
  331.   $LineSize:n         Sets listing line size to n.
  332.   $Page               Skips to a new listing page.
  333.   $PageSize:n         Sets listing page size to n.
  334.   $Title:"Title"      Sets listing title.
  335.  
  336.   $8087+/-            Enables or disables 80(2)87 code generation.
  337.   $Chip:iAPXNr        Selets instruction set (iAPXNr must be 86, 186 or
  338.                       286).
  339.   $Large+/-           Selects small or large memory model.
  340.   $LongReal+/-        Makes REAL a synonym of LONGREAL.
  341.   $OpenArrayCopy+/-   Enables or disables open array parameter copying.
  342.  
  343.   $EliminateCSE+/- ,
  344.   $KeepRegs+/- ,
  345.   $MergeTails1+/- ,
  346.   $MergeTails2+/- ,
  347.   $OptimizeJumps+/- ,
  348.   $RegVars+/- ,
  349.   $ReorderExpr+/- ,
  350.   $SimplifyExpr+/-    Enables or disables various optimizations.
  351.  
  352.   $Optimize+/-        Enables (default) or disables all optimizations.
  353.  
  354.  
  355. 5. LANGUAGE EXTENSIONS
  356.  
  357. - Standard types LONGINT (32 bit) and LONGREAL (64 bit).
  358.  
  359. - Multidimensional open array parameters (e.g. ARRAY OF ARRAY OF REAL)
  360.  
  361. - FORWARD declaration of procedures.
  362.  
  363. - Unsegmented (16-bit) and segmented (32-bit) addresses in the small
  364.   memory model:
  365.  
  366.     Unsegmented       Segmented
  367.     ------------      ----------------
  368.     POINTER TO t      LONGPOINTER TO t
  369.     NIL               LNIL
  370.     VAR               LVAR
  371.     ADDRESS           LONGADDRESS
  372.     ADR               LADR
  373.  
  374. - FAR declaration of procedures (for procedure variables and parameters):
  375.  
  376.   VAR    p: PROC;
  377.  
  378.   FAR PROCEDURE FarProc;
  379.   BEGIN
  380.   END FarProc;
  381.  
  382.   BEGIN
  383.     p := FarProc;
  384.     ...
  385.  
  386. - Fixed record offsets:
  387.  
  388.   TYPE   Both = RECORD
  389.                   i   [00]:  LONGINT;
  390.                   low [00],
  391.                   high [02]: CARDINAL
  392.                 END;
  393.  
  394.  
  395. 6. MODULE SYSTEM
  396.  
  397. The module SYSTEM could be defined as follows:
  398.  
  399. DEFINITION MODULE SYSTEM;
  400.  
  401. TYPE  BYTE, WORD, ADDRESS, LONGADDRESS;
  402.  
  403. PROCEDURE ADR (x: AnyType): ADDRESS;
  404. PROCEDURE LADR (x: AnyType): LONGADDRESS;
  405. PROCEDURE TSIZE (x: AnyType): CARDINAL;
  406. PROCEDURE NEWPROCESS (P: PROC; A: ADDRESS; n: CARDINAL;
  407.                       VAR new: ADDRESS);
  408. PROCEDURE TRANSFER (VAR source: ADDRESS; destination: ADDRESS);
  409.  
  410. END SYSTEM.
  411.  
  412.  
  413. 7. STANDARD LIBRARY
  414.  
  415. The Demo Kit standard library provides the following modules:
  416.  
  417. ------------------------------------------------------------------------
  418.  
  419. DEFINITION MODULE FileSystem;
  420.  
  421. (* This module supports random reading and writing from and to files. *)
  422.  
  423. FROM SYSTEM IMPORT BYTE, LONGADDRESS;
  424.  
  425. TYPE   StatusCode = (Ok, GeneralError, FileNotFound, PathNotFound,
  426.                      TooManyFiles, AccessDenied, UnopenedFile,
  427.                      DeviceFull);
  428.  
  429.        AccessMode = (Reading, Writing, Modifying);
  430.  
  431.        File = RECORD
  432.                 handle: CARDINAL;
  433.                 status: StatusCode
  434.               END;
  435.  
  436. PROCEDURE Open (VAR f: File; name: ARRAY OF CHAR; access: AccessMode);
  437. (* Opens file f for the specified access mode. *)
  438.  
  439. PROCEDURE Create (VAR f: File; name: ARRAY OF CHAR);
  440. (* Creates a new empty file with name "name". If such a file exists
  441.    already, it is replaced by the new one. *)
  442.  
  443. PROCEDURE Close (VAR f: File);
  444. (* Closes a file and updates its directory information. *)
  445.  
  446. PROCEDURE Length (VAR f: File): LONGINT;
  447. (* Returns the length of the file in bytes. *)
  448.  
  449. PROCEDURE SetPos (VAR f: File; pos: LONGINT);
  450. (* Sets current file position to pos. *)
  451.  
  452. PROCEDURE GetPos (VAR f: File; VAR pos: LONGINT);
  453. (* Gets current file position. *)
  454.  
  455. PROCEDURE ReadRec (VAR f: File; LVAR rec: ARRAY OF BYTE;
  456.                    VAR BytesRead: CARDINAL);
  457. (* Reads SIZE (rec) bytes from file f into rec. BytesRead is the actual
  458.    number of bytes read, i.e. if BytesRead < SIZE (rec), eof was
  459.    reached. The file position is moved forward BytesRead bytes. *)
  460.  
  461. PROCEDURE WriteRec (VAR f: File; rec: ARRAY OF BYTE);
  462. (* Writes SIZE (rec) bytes from rec to file f. The file position is
  463.    moved forward SIZE (rec) bytes. *)
  464.  
  465. PROCEDURE ReadBytes (VAR f: File; bytes: CARDINAL; buffer: LONGADDRESS;
  466.                      VAR BytesRead: CARDINAL);
  467. (* Reads 'bytes' bytes into storage at buffer from file f. BytesRead is
  468.    the actual number of bytes read, i.e. if BytesRead < bytes, eof was
  469.    reached. The file position is moved forward BytesRead bytes. *)
  470.  
  471. PROCEDURE WriteBytes (VAR f: File; bytes: CARDINAL; buffer: LONGADDRESS);
  472. (* Writes 'bytes' bytes from storage at buffer to file f. The file
  473.    position is moved forward 'bytes' bytes. *)
  474.  
  475. PROCEDURE Delete (name: ARRAY OF CHAR; VAR status: StatusCode);
  476. (* Deletes the file with name 'name'. If status = Ok on return, the
  477.    operation was successful. *)
  478.  
  479. PROCEDURE Rename (oldname, newname: ARRAY OF CHAR;
  480.                   VAR status: StatusCode);
  481. (* Renames the file with name 'oldname' to 'newname'. Full path names
  482.    are allowed for both names. If status = Ok on return, the operation
  483.    was successful. *)
  484.  
  485. END FileSystem.
  486.  
  487. ------------------------------------------------------------------------
  488.  
  489. DEFINITION MODULE InOut;
  490.  
  491. (* This module supports stream I/O on standard input and output. Program
  492.    controlled I/O redirection is possible via procedures OpenInput and
  493.    OpenOutput resp. CloseInput and CloseOutput. *)
  494.  
  495. CONST  EOL = 15C;  (* carriage return *)
  496.  
  497. VAR    Done:   BOOLEAN;
  498.        termCH: CHAR;
  499.  
  500. PROCEDURE OpenInput (defext: ARRAY OF CHAR);
  501. (* Prompt for a file name and open input file "in". Done := "file was
  502.    successfully opened". If open, subsequent input is read from this
  503.    file. If no extension is entered, defext is assumed. *)
  504.  
  505. PROCEDURE OpenOutput (defext: ARRAY OF CHAR);
  506. (* Prompt for a file name and create output file "out". Done := "file
  507.    was successfully created". If created, subsequent output is written
  508.    to this file. If no extension is entered, defext is assumed. *)
  509.  
  510. PROCEDURE CloseInput;
  511. (* Closes input file and returns input to terminal. *)
  512.  
  513. PROCEDURE CloseOutput;
  514. (* Closes output file and returns output to terminal. *)
  515.  
  516. PROCEDURE Read (VAR ch: CHAR);
  517. (* Reads a single character from "in". Done := NOT in.eof. *)
  518.  
  519. PROCEDURE ReadString (VAR s: ARRAY OF CHAR);
  520. (* Reads a string from "in", i.e. a sequence not containing blanks nor
  521.    control characters. Leading blanks are ignored. Input is terminated
  522.    by any character <= " "; this character is assigned to termCH. BS is
  523.    used for backspacing. Done := NOT in.eof. *)
  524.  
  525. PROCEDURE ReadLine (VAR s: ARRAY OF CHAR);
  526. (* Reads a line from "in", i.e. a sequence of characters up to a
  527.    terminating CR. When reading from terminal, control characters are
  528.    interpreted, and more than HIGH (s) + 1 characters are not allowed.
  529.    When reading from a file, control characters are not interpreted, and
  530.    superfloous characters are ignored. A LF following the CR is ignored.
  531.    Done := NOT in.eof. *)
  532.  
  533. PROCEDURE ReadInt (VAR x: INTEGER);
  534. (* Reads a string and converts it to an integer. Done := "integer was
  535.    read". *)
  536.  
  537. PROCEDURE ReadCard (VAR x: CARDINAL);
  538. (* Reads a string and converts it to a cardinal. Done := "cardinal was
  539.    read". *)
  540.  
  541. PROCEDURE Write (ch: CHAR);
  542. (* Writes a single character to "out". On terminal, control characters
  543.    are interpreted. Done := "device was not full"  *)
  544.  
  545. PROCEDURE WriteLn;
  546. (* Writes an EOL character, i.e. CR/LF. Done := "device was not full"
  547. *)
  548.  
  549. PROCEDURE WriteString (s: ARRAY OF CHAR);
  550. (* Writes a character string. On terminal, control characters are
  551.    interpreted. Done := "device was not full"  *)
  552.  
  553. PROCEDURE WriteInt (x: INTEGER; n: CARDINAL);
  554. (* Writes integer x with (at least) n characters to "out". If n is
  555.    greater than the number of digits needed, blanks are added preceding
  556.    the number. Done := "device was not full"  *)
  557.  
  558. PROCEDURE WriteCard (x, n: CARDINAL);
  559. (* Writes cardinal x with (at least) n characters to "out". If n is
  560.    greater than the number of digits needed, blanks are added preceding
  561.    the number. Done := "device was not full"  *)
  562.  
  563. PROCEDURE WriteHex (x, n: CARDINAL);
  564. (* Writes cardinal x encoded as hexadecimal number with (at least) n
  565.    characters to "out". If n is greater than the number of digits
  566.    needed, blanks resp. zeroes are added preceding the number. Done :=
  567.    "device was not full"  *)
  568.  
  569. END InOut.
  570.  
  571. ------------------------------------------------------------------------
  572.  
  573. DEFINITION MODULE LongInOut;
  574.  
  575. (* This module supports reading and writing of longint numbers via
  576.    InOut. *)
  577.  
  578. VAR    Done: BOOLEAN;
  579.  
  580. PROCEDURE ReadLong (VAR x: LONGINT);
  581. (* Reads a string and converts it to longint. Done := "longint was
  582.    read". *)
  583.  
  584. PROCEDURE WriteLong (x: LONGINT; n: CARDINAL);
  585. (* Writes x using n characters. If fewer than n characters are needed,
  586.    leading blanks are inserted. *)
  587.  
  588. END LongInOut.
  589.  
  590. ------------------------------------------------------------------------
  591.  
  592. DEFINITION MODULE RealInOut;
  593.  
  594. (* This module supports reading and writing of real numbers via InOut.
  595. *)
  596.  
  597. VAR    Done: BOOLEAN;
  598.  
  599. PROCEDURE ReadReal (VAR x: LONGREAL);
  600. (* Reads a string and converts it to longreal. Done := "longreal was
  601.    read". *)
  602.  
  603. PROCEDURE WriteReal (x: LONGREAL; n: CARDINAL);
  604. (* Writes x using n characters. If fewer than n characters are needed,
  605.    leading blanks are inserted. *)
  606.  
  607. END RealInOut.
  608.  
  609. ------------------------------------------------------------------------
  610.  
  611. DEFINITION MODULE Storage;
  612.  
  613. (* This module supports dynamic memory allocation in nonsegmented space.
  614. *)
  615.  
  616. FROM SYSTEM IMPORT ADDRESS;
  617.  
  618. PROCEDURE ALLOCATE (VAR a: ADDRESS; size: CARDINAL);
  619. (* Allocates an area of the given size (in bytes) and returns its
  620.    address in a. If no space is available, a runtime error occurs. *)
  621.  
  622. PROCEDURE DEALLOCATE (VAR a: ADDRESS; size: CARDINAL);
  623. (* Frees the area at address a of the given size (in bytes). Size must
  624.    be the same as on the call to ALLOCATE. NIL is assigned to a. *)
  625.  
  626. PROCEDURE Available (size: CARDINAL): BOOLEAN;
  627. (* Returns TRUE if size bytes could be allocated. *)
  628.  
  629. PROCEDURE GetHeap (VAR HeapEnd: ADDRESS);
  630. (* Gets the current heap end pointer to save the current heap state. *)
  631.  
  632. PROCEDURE SetHeap (HeapEnd: ADDRESS);
  633. (* Resets the heap to the state it had when GetHeap was called.
  634.    Allocations above HeapEnd will be lost. *)
  635.  
  636. END Storage.
  637.  
  638. ------------------------------------------------------------------------
  639.  
  640. DEFINITION MODULE Strings;
  641.  
  642. (* This module supports operations on strings. A string is an ARRAY OF
  643.    CHAR terminated by its upper bound or by 0C. *)
  644.  
  645. PROCEDURE Assign (source: ARRAY OF CHAR;
  646.                   LVAR destination: ARRAY OF CHAR);
  647. (* Copies the string source to the string destination. If Length
  648.    (source) > HIGH (destination) + 1, source is truncated to fit into
  649.    destination. *)
  650.  
  651. PROCEDURE Insert (source: ARRAY OF CHAR;
  652.                   LVAR destination: ARRAY OF CHAR; before: CARDINAL);
  653. (* Inserts the source into destination before destination[before]. If
  654.    before >= Length (destination), source is appended to destination. *)
  655.  
  656. PROCEDURE Delete (LVAR destination: ARRAY OF CHAR;
  657.                   start, length: CARDINAL);
  658. (* Deletes length characters of destination, starting with
  659.    destination[start]. If start >= Length (destination), no operation is
  660.    performed. If start + length > Length (destination), destination is
  661.    truncated to length start - 1. *)
  662.  
  663. PROCEDURE Pos (pattern, source: ARRAY OF CHAR): CARDINAL;
  664. (* Returns the index into source of the first occurence of pattern. If
  665.    pattern does not occur, HIGH (source) + 1 is returned. If Length
  666.    (pattern) = 0, 0 is returned. *)
  667.  
  668. PROCEDURE Copy (source: ARRAY OF CHAR; start, length: CARDINAL;
  669.                 LVAR destination: ARRAY OF CHAR);
  670. (* Copies length characters from source into destination, starting at
  671.    source[start]. If start + length > Length (source), or length > HIGH
  672.    (destination) + 1, the substring is truncated. *)
  673.  
  674. PROCEDURE Concat (left, right: ARRAY OF CHAR;
  675.                   LVAR destination: ARRAY OF CHAR);
  676. (* Concatenates the two strings left and right into destination. If
  677.    necessary, the resulting string is truncated. *)
  678.  
  679. PROCEDURE Length (source: ARRAY OF CHAR): CARDINAL;
  680. (* Returns the actual length of source, i.e. the position of the
  681.    terminating 0C or HIGH (source) + 1, if no 0C is found. *)
  682.  
  683. PROCEDURE CompareStr (left, right: ARRAY OF CHAR): INTEGER;
  684. (* Compares the two strings left and right. Returns the following
  685.    values:
  686.      -1 if left < right
  687.       0 if left = right
  688.       1 if left > right. *)
  689.  
  690. PROCEDURE Expand (LVAR destination: ARRAY OF CHAR);
  691. (* Expands destination to Length (destination) = HIGH (destination) + 1
  692.    by appending blanks. *)
  693.  
  694. END Strings.
  695.  
  696. ------------------------------------------------------------------------
  697.  
  698. DEFINITION MODULE Terminal;
  699.  
  700. (* This module supports simple terminal I/O. Under MS-DOS, I/O
  701.    redirection is supported. *)
  702.  
  703. PROCEDURE Read (VAR ch: CHAR);
  704. (* Reads a single character from the keyboard without echoing it. *)
  705.  
  706. PROCEDURE BusyRead (VAR ch: CHAR);
  707. (* Like Read, but returns 0C, if no character is waiting. *)
  708.  
  709. PROCEDURE ReadAgain;
  710. (* Causes the last character to be returned again upon the next call of
  711.    Read. *)
  712.  
  713. PROCEDURE Write (ch: CHAR);
  714. (* Writes a single character to the terminal. Control characters are
  715.    interpreted. *)
  716.  
  717. PROCEDURE WriteLn;
  718. (* Writes a CR-LF-sequence. *)
  719.  
  720. PROCEDURE WriteString (s: ARRAY OF CHAR);
  721. (* Writes a character string to the terminal. Control characters are
  722.    interpreted. *)
  723.  
  724. END Terminal.
  725.  
  726. ------------------------------------------------------------------------
  727.  
  728. 8. LIMITS OF THE DEMO KIT
  729.  
  730. The Demo Kit is limited by
  731.  
  732.   - The compiler allowing a maximum of about 600 symbols (identifiers,
  733.     numbers, keywords, delimiters) per source. If this limit is
  734.     exceeded, the message "Fatal Error F7: Internal limit exceeded" is
  735.     displayed.
  736.  
  737.   - The standard library providing only the modules listed in
  738.     paragraph 6. Other modules are:
  739.       Clock
  740.       Directory
  741.       Environment
  742.       Interrupts
  743.       LongStorage
  744.       LowTerminalIO  (with installable hardware dependent drivers)
  745.       LStrings
  746.       MathLib0  (8087/287 and software emulation version)
  747.       Memory
  748.       NumberConversion
  749.       Parameters
  750.       Processes
  751.       Programs
  752.       RealConversion
  753.       RS232  (two hardware dependent versions)
  754.       SystemCalls
  755.       TextFiles
  756.       TextNumbers
  757.  
  758.   - The missing ObjectConverter (for incorporation of assembly language
  759.     modules).
  760.  
  761.   - And of course the missing documentation.
  762.