                      ADDITIONS TO THE Conversions module

  CONST
    Hex = 16;  (* hexadecimal; base 16 *)
    Dec = 10;  (* decimal; base 10     *)
    Oct = 8;   (* octal; base 8        *)
    Bin = 2;   (* binary; base 2       *)


  PROCEDURE ConvertRealToString(r: REAL; VAR s: ARRAY OF CHAR; n: CARDINAL;
                                VAR done: BOOLEAN);
    (* converts a real number into a printable string.

       r: the real number to convert.
       s: the resulting string (right justified), at least n characters long.
       n: the field width.
       done = converted OK. *)

  PROCEDURE ConvertRealFromString(VAR r: REAL; VAR s: ARRAY OF CHAR;
                                  VAR done: BOOLEAN);
    (* converts a real number in string form to internal representation

       r: the read value, if done = TRUE
       s: the string to convert from
       done: "the real number was read OK" (i.e. conforms to syntax,
               and its not too large *)

  PROCEDURE ConvertRealToStringOct(x: REAL; VAR s: ARRAY OF CHAR;
                                   VAR done: BOOLEAN);
    (* converts a real number to its octal representation.

       x: the number to convert
       s: the resulting string, at least 15 characters long.
       done: FALSE => s too short; TRUE => s is valid *)


  (* 0.01a - LONGREAL support *)
  PROCEDURE ConvertLongRealToString(x : LONGREAL ; VAR s : ARRAY OF CHAR ;
                                    n : CARDINAL ; VAR done : BOOLEAN) ;
    (* converts a LONGREAL number to its decimal representation.

       x : The number to convert
       s : The resulting string, at least 20 characters long.
       n: the field width.
       done : FALSE => s too short; TRUE => s is valid *)

  PROCEDURE ConvertLongRealFromString(VAR r : LONGREAL ; VAR s : ARRAY OF CHAR;
                                      VAR done : BOOLEAN) ;
    (* converts a LongReal number in string form to internal representation

       r: the read value, if done = TRUE
       s: the string to convert from
       done: "the real number was read OK" (i.e. conforms to syntax,
               and its not too large *)



                              ADDITIONS TO RealInOut


  PROCEDURE ReadLongReal(VAR x: LONGREAL) ;
    (* Read LONGREAL number x according to syntax:

         ["+"|"-"] digit {digit} ["." digit {digit}]
         ["E" ["+"|"-"] digit {digit}]

       Done := "a number was read"
       At most 15 digits are significant, leading zeroes not
       counting, Maximum exponent is 307. Input terminates
       with a blank or any control character. DEL isused
       for backspacing *)

  PROCEDURE WriteLongReal(x: LONGREAL ; n: CARDINAL) ;
    (* Write x using n characters. If fewer than n characters
       are needed, leading blanks are inserted *)
   
                      Changes in Storage Module

PROCEDURE ALLOCATE  ( VAR Addr   : ADDRESS ; Amount : LONGCARD );
(* Allocates the requested amount of memory (in bytes) and returns 
   the starting address . If amount requested is not available,
   NIL is returned if the heap was created with 'GiveNIL' TRUE,
   otherwise HALT *)

PROCEDURE DEALLOCATE ( VAR Addr   : ADDRESS ; Amount : LONGCARD);
(* Deallocates the given amount of memory (in bytes). HALT if the
   memory hasn't been allocated by ALLOCATE *)

PROCEDURE CreateHeap  ( Amount : LONGCARD ; GiveNIL : BOOLEAN ) : BOOLEAN ;
(* Create a heap of size 'Amount', in bytes.
   If CreateHeap is not called, the first call to ALLOCATE creates
   a default heap.
   If 'GiveNIL' is TRUE, Allocate returns NIL when amount requested
   is not available. *)
  
                  
                            changes to xbios


PROCEDURE ConfigurePrinter(config: PrtConfigSet): PrtConfigSet;  (*0.10a*)
  (* configure printer.

     config: the new printer configuration.
     returns: old printer configuration.

     NOTE: ConfigurePrinter(NoAlter) does not alter the old setting. *)


                           changes to gemx



  BasePageType = RECORD       (* GEMDOS base page format *)
                   LowTPA   : ADDRESS ;
                   HiTPA    : ADDRESS ;
                   CodeBase : ADDRESS ;
                   CodeLen  : LONGCARD ;
                   DataBase : ADDRESS ;
                   DataLen  : LONGCARD ;
                   BssBase  : ADDRESS ;
                   BssLen   : LONGCARD ;
                   DtaPtr   : ADDRESS ;                         (*3.20a*)
                   ParentBasePage : ADDRESS ;                   (*3.20a*)
                   resvd1   : LONGCARD ;                        (*3.20a*)
                   EnvPtr   : POINTER TO ARRAY [0..79] OF CHAR ;
                   resvd2   : ARRAY [30H..7FH] OF CHAR ;        (*3.20a*)
                   CmdLine  : ARRAY [0..79] OF CHAR ;
                 END ;


Misc Additions and Changes:

MAX and MIN have been implemented. MAX returns the maximal value
of a subrange, enumeration or standard type. MIN returns the minimal
value. Example:

  TYPE
    subrange = [1..100];
    enum = (a,b,c,d,e);

  MIN(INTEGER) = -32768   MIN(subrange) = 1
  MIN(enum)    = a        MIN(CARDINAL) = 0

  MAX(INTEGER) = 32767    MAX(subrange) = 100
  MAX(enum)    = e        MAX(CARDINAL) = 65535


The compiler now accepts SET OF CARDINAL, e.g.

  TYPE bigset = SET OF CARDINAL;

Compiler options:

The $F compiler option has been removed. In its place, three further
options have added. The equivalent of $F+ would be $V+,$R+,$N+.
The options give greater control over the code produced.

$V:  generate overflow-checking code; initially $V- which does not
     check for overflow.

        e.g.

          VAR x, y: CARDINAL;

          BEGIN
            x := 1000;
            y := x * x;       (*would generate an overflow trap*)

$R:  generate range-checking code (distinct from the $T option);
     initially $R- (i.e. no code). This option generates code to
     check values assigned to subranges, cardinal/integer cross-
     assignment and other critical code parts.

        e.g.

           VAR x: CARDINAL; y: INTEGER; z: [1..100];

           BEGIN
             y := -1;         (*o.k.*)
             x := y;          (*would generate a range trap*)
             x := 0; z := x;  (*would generate a range trap*)
           END;

$N:  generate nil-checking code; initially $N- (i.e. no code).
     This will not allow dereferencing of NIL pointers:

        e.g.

        VAR x: POINTER TO CHAR; c: CHAR;

        BEGIN
          x := NIL;
          c := x^;     (*would generate a NIL-dereference trap*)



- The suffix "D" may be appended to a decimal number to signify that it is
  a long constant; this allows programs written for the ETH single-pass
  compiler to be ported directly to the TDI native Modula-2 compiler.

