1 05/01/90 pascal.changes
2
3 This infoseg describes differences between versions of the Pascal
4 compiler.
5
6
7 05/01/90:
8
9 This section describes the changes between Pascal 8.03 and Pascal 8.04a .
10
11
12 1 - Changes to Pascal IO implementation:
13
14 1.1 - Pascal 8.3 would round a value of the form -x.5 to -x, rather
15 than -x+1. Pascal 8.4 no longer deviates in this manner.
16
17
18 Examples:
19
20 !pr test.pascal
21 test.pascal 04/26/90 1756.7 mdt Thu
22
23 program test input output;
24 const posval = 3.5;
25 negval = -3.5;
26 var rounded : real;
27 begin
28 rounded := round posval;
29 writeln rounded;
30 rounded := round negval;
31 writeln rounded;
32 end.
33
34
35 !test
36 4.00000000000000000E+00
37 -3.00000000000000000E+00
38
39 !in exe>pascal_io_ -fc -a
40 !test
41 4.00000000000000000E+00
42 -4.00000000000000000E+00
43
44
45 08/04/86:
46
47 This section describes changes between Pascal 8.01 and Pascal 8.03.
48
49
50 1 - Changes to implemented language:
51
52 1.1 - The following restrictions or deviances have been lifted
53
54 o No check is performed when a label is used it must only
55 have been declared in the current block or in a containing
56 block. For instance, "goto" a branch of an "if"
57 statement or a "case" statement from out of this statement
58 or from another branch of this statement is not controlled
59 6.8.1.
60
61
62 Examples:
63
64
65 PROGRAM test_labels ;
66 LABEL 1 ;
67 VAR
68 i : integer ;
69 BEGIN
70 IF i = 0 THEN
71 1 : i := i + 1
72 ELSE
73 BEGIN
74 i := 4 ;
75 GOTO 1 ; Illegal reference to label 1 :
76 Accepted by 8.01 rejected by 8.03
77 END ;
78 END.
79
80
81 o Each occurrence of an identifier is associated with the last
82 declaration in the current or including block until it is
83 modified by an other declaration in the current block
84 6.2.2 6.3 6.4.1 6.6.1.
85
86
87 Examples: #1
88
89 PROGRAM test_dcl_scope_1 ;
90 TYPE
91 type_1 = ^integer ;
92 PROCEDURE p VAR param_1 : type_1 ;
93 TYPE
94 ptr_1 = ^type_1 ; In Pascal 8.01 prt_1 is considered
95 as a pointer to an integer. This is a deviation. In Pascal 8.03
96 "type_1" is considered as a reference to the type "type_1" declared in
97 the same block and not to the type "type_1" previously declared in
98 the text of the program.
99 type_1 = real ;
100 VAR
101 p1 : ptr_1 ;
102
103
104 BEGIN
105 new p1 ;
106 p1 := param_1 ; accepted by Pascal 8.01
107 rejected type conflict by 8.03
108 END ;
109 BEGIN
110 END.
111
112
113 Examples: #2
114
115
116 PROGRAM test_dcl_scope_2 ;
117 CONST
118 a = 1 ;
119 PROCEDURE internal ;
120 CONST
121 b = -a ;
122 a = 2 ; Defining point of "a" for this level.
123 Previous reference previous line is
124 illegal. Accepted by 8.01 rejected by
125 8.03
126 BEGIN
127 END ;
128 BEGIN
129 END.
130
131
132 o The compiler checks if there is at least one occurrence of
133 the assignment of the function in a function procedure, but
134 it does not check at the execution time if you return from
135 the function without giving it a value 6.6.2.
136
137 In Pascal 8.03 a pascal_error is signalled when there is an attempt to
138 return from a function without giving the result a value.
139
140
141 1.2 - Descriptors can be passed now to external procedures written in
142 PL/1 or FORTRAN.
143
144 see pascal_separate_comp.gi.info
145
146
147 1.3 - Extension to SWRITE predeclared function:
148
149 If VALUE is a data of enumerated type and STR a character string, the
150 statement
151
152 I := SWRITE STR J VALUE : N ;
153
154 causes the symbolic value of VAL to be written on N characters, beginning at
155 the Jth charecter of STR. If N is not given, the default length is 32
156 characters max length for a Multics Pascal identifier.
157
158 1.4 - Strings are implemented.
159
160 see pascal_strings.gi.info
161
162
163 1.5 - Expressions are allowed in declarations of constants.
164
165 Any expression is allowed. This expression must be evaluatable at compilation
166 time, without code generation, and, of course, be of a type allowed for a
167 Pascal constant.
168
169 Examples:
170
171 CONST
172 two = 2;
173 four = two * two;
174 bell = chr 5 + two;
175
176
177 2 - Changes to "pascal" command:
178
179 "-interactive" control argument is the default.
180 "-table" control argument is the default.
181 "-extended_character_set" and "-no_compilation_warnings"
182 have been added. see pascal.info
183
184
185 3 - Changes to Pascal IO implementation:
186
187
188 3.1 - In interactive mode, when the file is attached via an IO module which is
189 not "vfile_", physical output is performed after each write statement.
190 Implicit "flush".
191
192 3.2 - If input text file does not end with a new_line, this new line is
193 simulated by pascal_io_, as required by the Standard.
194
195 3.3 - When Pascal closes an output text file, and if last statement
196 was not a writeln, the current contents of the output buffer are
197 wrttten to the file but no implicit writeln is performed, as specified
198 by the Standard.
199
200 3.4 - It is not necessary to call the main of an external procedure to
201 initialize global files status blocks. This initialisation is done by first
202 reference trap.
203
204
205 Examples:
206
207 ! pr caller.pascal -nhe
208 PROGRAM caller ;
209 $IMPORT
210 'called pascal' : open, out_nl, close $
211 TYPE
212 output_type = discard terminal ;
213 PROCEDURE open
214 file_type : output_type ; EXTERNAL ;
215 PROCEDURE out_nl
216 str : PACKED ARRAY a..b : integer OF char ; EXTERNAL ;
217
218
219 PROCEDURE close ; EXTERNAL ;
220 BEGIN
221 open terminal ;
222 out_nl 'This is a line.' ;
223 close ;
224 END.
225 ! pr called.pascal -nhe
226 PROGRAM called ;
227 $EXPORT
228 open, out_nl, close $
229 TYPE
230 output_type = discard terminal ;
231 VAR
232 output_file : text ;
233
234
235 PROCEDURE open
236 file_type : output_type ;
237 BEGIN
238 CASE file_type OF
239 discard :
240 fconnect output_file 'discard_' ;
241 terminal :
242 fconnect output_file 'syn_ user_output' ;
243 END ;
244 rewrite output_file
245 END ;
246
247
248 PROCEDURE out_nl
249 str : PACKED ARRAY a..b : integer OF char ;
250 BEGIN
251 writeln output_file str
252 END ;
253 PROCEDURE close ;
254 BEGIN
255 fclose output_file
256 END ;
257 BEGIN
258 END.
259 ! >unb>pascal caller called
260 PASCAL 8.01
261 PASCAL 8.01
262 ! caller
263
264
265 Error: Attempt by >udd>PASCAL>JMAthane>v8w>called$open|31
266 to reference through null pointer
267 ! rl
268 ! >exl>pascal>e>pascal caller called
269 Pascal 8.03
270 Pascal 8.03
271 ! caller
272 This is a line.
273
274
275 3.5 - Boolean output:
276 The default length for true boolean value is 4, as required by
277 the standard. It was 5 before like for "FALSE". When the program
278 has been written with french keywords, "VRAI" and "FAUX" is printed,
279 instead of "TRUE" and "FALSE".
280
281
282 4 - New tools:
283
284
285 4.1 - pascal_cref: Improves the validity of Pascal separate compilations,
286 and provides a language oriented cross-reference listing. see
287 "pascal_cref.info".
288
289
290 4.2 - pascal_display: Traces the Multics stack and gives the values of
291 all the variables declared or referenced by the active Pascal
292 procedures. see "pascal_display.info".
293
294
295 5 - probe and Pascal:
296
297 Under probe, if the current language is Pascal, the notation:
298
299 p -> type_id
300
301 denotes a value of type type_id located at p p may be any Pascal
302 typed pointeror probe pointer variable or pointer constant.
303 The probe statement:
304
305 let p1 = p2
306
307 is allowed for p1 and p2 being any kind of pointer value Pascal typed pointer
308 pointer constant p2 only! probe pointer variable.
309
310
311 These extensions have been implemented in order to give users the
312 possibility of writing such probe statements:
313
314 dcl p ptr
315 let p = first
316 while p <> nil : v p -> data; let p = p -> data.next
317
318 which can be useful if you want to display a list of records of type
319 "data", chained by their field "next".
320
321
322 6 - Utilities:
323 Some system oriented subprograms are available, which allow a better
324 integration of Pascal programs to Multics environment.
325 see pascal_util_.info