Include a file: Difference between revisions

m
{{out}}
m ({{out}})
Line 19:
The formal definition of Algol68 make numerous references to the standard '''prelude''' and '''postlude'''.
 
At the time the language was formally defined it was typical for code to be stored on decks of [[wp:Punched card|punched cards]] (or [[wp:Punched tape|paper tape]]). Possibly because storing code on [[wp:Hard disk drive|disk]] (or [[wp:Drum memory|drum]]) was expensive. Similarly card decks can be read sequentially from ''just'' one [[wp:Punched card input/output|card reader]]. It appears the Algol68 "standard" assumed all cards could be simply stacked before and after the actual ''source code'', hence the references "prelude" and "postlude" in the formal standard.
Possibly because storing code on [[wp:Hard disk drive|disk]] (or [[wp:Drum memory|drum]]) was expensive.
Similarly card decks can be read sequentially from ''just'' one [[wp:Punched card input/output|card reader]].
It appears the Algol68 "standard" assumed all cards could be simply stacked before and after the actual ''source code'', hence the references "prelude" and "postlude" in the formal standard.
 
==={{header|ALGOL 68G}}===
In the simplest case a file can be included as follows:
Line 44 ⟶ 48:
PR read "prelude/test.a68" PR;
printf($4x"Hello, world!"l$);
PR read "postlude/test.a68" PR</lang>'''Output:'''
{{out}}
<pre>
Prelude test:
Line 52 ⟶ 57:
 
'''Other implementations: e.g. [[ALGOL 68RS]] and [[ALGOL 68G]]'''<br>
Note that actual ''source code'' inclusion with parsing can be avoided because of a more generalised separate compilation method storing declaration specifications in a ''[[wp:data dictionary|data dictionary]]''. Different to '''#include''' found in [[C]] where the include file needs to be parsed for each source file that includes it.
Different to '''#include''' found in [[C]] where the include file needs to be parsed for each source file that includes it.
 
==={{header|ALGOL 68RS}}===
Line 138 ⟶ 144:
RUN</lang>
 
{{out}}
Output:
<pre>
12
Line 773 ⟶ 779:
DateOut(0, GetDate)</lang>
 
{{out}}
Example output:
<pre>
09-28-12
Anonymous user