05/01/90  pascal.changes

This infoseg describes differences between versions of the Pascal
compiler.


05/01/90:

This section describes the changes between Pascal 8.03 and Pascal 8.04a .


1 - Changes to Pascal IO implementation:

1.1 - Pascal 8.3 would round a value of the form -x.5 to -x, rather
      than -(x+1). Pascal 8.4 no longer deviates in this manner.


Examples:

!pr test.pascal
		test.pascal	04/26/90  1756.7 mdt Thu

program test (input, output);
const	posval	=	3.5;
	negval	=	-3.5;
var	rounded	:	real;
begin
     rounded := round (posval);
     writeln (rounded);
     rounded := round (negval);
     writeln (rounded);
end.


!test
 4.00000000000000000E+00
-3.00000000000000000E+00

!in exe>pascal_io_ -fc -a
!test
 4.00000000000000000E+00
-4.00000000000000000E+00


08/04/86:

This section describes changes between Pascal 8.01 and Pascal 8.03.


1 - Changes to implemented language:

1.1 - The following restrictions or deviances have been lifted

   o No check is performed when a label is used (it must only
      have been declared in the current block or in a containing
      block).  For instance, "goto" a branch of an "if"
      statement or a "case" statement from out of this statement
      or from another branch of this statement is not controlled
      (6.8.1).


Examples:


   PROGRAM test_labels ;
       LABEL 1 ;
       VAR
          i :  integer ;
       BEGIN
          IF i = 0 THEN
  1 :  	       i := i + 1
          ELSE
             BEGIN
                i := 4 ;
                GOTO 1 ; { Illegal reference to label 1 :
                              Accepted by 8.01, rejected by 8.03 }
             END ;
       END.


   o Each occurrence of an identifier is associated with the last
      declaration in the current (or including) block until it is
      modified by an other declaration in the current block
      (6.2.2, 6.3, 6.4.1, 6.6.1).


Examples: #1

    PROGRAM test_dcl_scope_1 ;
       TYPE
          type_1 = ^integer ;
       PROCEDURE p (VAR param_1 :  type_1) ;
          TYPE
             ptr_1 = ^type_1 ; { In Pascal 8.01, prt_1 is considered
as a pointer to an integer.  This is a deviation.  In Pascal 8.03,
"type_1" is considered as a reference to the type "type_1" declared in
the same block, and not to the type "type_1" previously declared in
the text of the program.  }
             type_1 = real ;
          VAR
             p1 :  ptr_1 ;


          BEGIN
             new (p1) ;
             p1 := param_1 ; {accepted by Pascal 8.01,
                                   rejected (type conflict) by 8.03 }
          END ;
       BEGIN
       END.


Examples: #2


   PROGRAM test_dcl_scope_2 ;
       CONST
          a = 1 ;
       PROCEDURE internal ;
          CONST
             b = -a ;
             a = 2 ; { Defining point of "a" for this level.
                              Previous reference (previous line) is
                              illegal.  Accepted by 8.01, rejected by
                              8.03 }
          BEGIN
          END ;
       BEGIN
       END.


   o The compiler checks if there is at least one occurrence of
      the assignment of the function in a function procedure, but
      it does not check at the execution time if you return from
      the function without giving it a value (6.6.2).

In Pascal 8.03 a pascal_error is signalled when there is an attempt to
return from a function without giving the result a value.


1.2 - Descriptors can be passed now to external procedures written in
PL/1 or FORTRAN.

   (see pascal_separate_comp.gi.info)


1.3 - Extension to SWRITE predeclared function:

   If VALUE is a data of enumerated type and STR a character string, the
statement

          I := SWRITE (STR, J, VALUE :  N) ;

causes the symbolic value of VAL to be written on N characters, beginning at
the Jth charecter of STR.  If N is not given, the default length is 32
characters (max length for a Multics Pascal identifier).

1.4 - Strings are implemented.

  (see pascal_strings.gi.info)


1.5 - Expressions are allowed in declarations of constants.

   Any expression is allowed. This expression must be evaluatable at compilation
time, without code generation, and, of course, be of a type allowed for a
Pascal constant.

   Examples:

      CONST
	two = 2;
        	four = two * two;
	bell = chr (5 + two);


2 - Changes to "pascal" command:

"-interactive" control argument is the default.
"-table" control argument is the default.
"-extended_character_set" and "-no_compilation_warnings"
 have been added. (see pascal.info)


3 - Changes to Pascal IO implementation:


3.1 - In interactive mode, when the file is attached via an IO module which is
not "vfile_", physical output is performed after each write statement.
(Implicit "flush").

3.2 - If input text file does not end with a new_line, this new line is
simulated by pascal_io_, as required by the Standard.

3.3 - When Pascal closes an output text file, and if last statement
was not a writeln, the current contents of the output buffer are
wrttten to the file but no implicit writeln is performed, as specified
by the Standard.

3.4 - It is not necessary to call the main of an external procedure to
initialize global files status blocks.  This initialisation is done by first
reference trap.


Examples:

 !  pr caller.pascal -nhe
     PROGRAM caller ;
        $IMPORT
          'called (pascal)' :  open, out_nl, close $
        TYPE
          output_type = (discard, terminal) ;
        PROCEDURE open
          (file_type :  output_type) ; EXTERNAL ;
        PROCEDURE out_nl
          (str :  PACKED ARRAY [a..b :  integer] OF char) ; EXTERNAL ;


        PROCEDURE close ; EXTERNAL ;
        BEGIN
          open (terminal) ;
          out_nl ('This is a line.') ;
          close ;
        END.
 !  pr called.pascal -nhe
     PROGRAM called ;
        $EXPORT
          open, out_nl, close $
        TYPE
          output_type = (discard, terminal) ;
        VAR
          output_file :  text ;


        PROCEDURE open
             (file_type :  output_type) ;
          BEGIN
             CASE file_type OF
                discard :
                   fconnect (output_file, 'discard_') ;
                terminal :
                   fconnect (output_file, 'syn_ user_output') ;
             END ;
             rewrite (output_file)
          END ;


        PROCEDURE out_nl
             (str :  PACKED ARRAY [a..b :  integer] OF char) ;
          BEGIN
             writeln (output_file, str)
          END ;
        PROCEDURE close ;
          BEGIN
             fclose (output_file)
          END ;
        BEGIN
        END.
 !  >unb>pascal (caller called)
 PASCAL 8.01
 PASCAL 8.01
 !  caller


 Error:  Attempt by >udd>PASCAL>JMAthane>v8w>called$open|31
 to reference through null pointer
 !  rl
 !  >exl>pascal>e>pascal (caller called)
 Pascal 8.03
 Pascal 8.03
 !  caller
 This is a line.


3.5 - Boolean output:
      The default length for true boolean value is 4, as required by
the standard.  (It was 5 before, like for "FALSE").  When the program
has been written with french keywords, "VRAI" and "FAUX" is printed,
instead of "TRUE" and "FALSE".


4 - New tools:


4.1 - pascal_cref: Improves the validity of Pascal separate compilations,
and provides a language oriented cross-reference listing.  (see
"pascal_cref.info").


4.2 - pascal_display: Traces the Multics stack and gives the values of
all the variables declared or referenced by the active Pascal
procedures.  (see "pascal_display.info").


5 - probe and Pascal:

   Under probe, if the current language is Pascal, the notation:

          p -> type_id

denotes a value of type type_id located at p (p may be any Pascal
typed pointer,or probe pointer variable or pointer constant).
   The probe statement:

          let p1 = p2

is allowed for p1 and p2 being any kind of pointer value (Pascal typed pointer,
pointer constant (p2 only!), probe pointer variable).


   These extensions have been implemented in order to give users the
possibility of writing such probe statements:

          dcl p ptr
          let p = first
          while p <> nil :  (v p -> data; let p = p -> data.next)

which can be useful if you want to display a list of records of type
"data", chained by their field "next".


6 - Utilities:
    Some system oriented subprograms are available, which allow a better
integration of Pascal programs to Multics environment.
    (see pascal_util_.info)
