|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 232704 (0x38d00) Types: TextFile Names: »D27«
└─⟦4233bed4d⟧ Bits:30005867/disk04.imd Dokumenter (RCSL m.m.) └─⟦this⟧ »D27«
\f Table to 3.3.3. Standard error actions. The status bits remaining after extraction of the user"s bits get a special treatment depending on the kind used in the call of open. This treatment is shown in shorthand in the table below. identification of actions for the different kinds status bit magtape card reader line printer papertape paper tape typewriter bs areainternal bit algol name 18 16141210840 no. equivalent 0 1 shift 23 intervention ignoreignore ignore ignore ignore ignore give up give up 1 1 shift 22 parity error repeat 5 ignore give up give up ignore give up give up give up times 2 1 shift 21 timer give up give up give up give up give up give up give up give up or repeat 3 1 shift 20 data overrun repeat give up error error error error give up give up all 4 1 shift 19 block length give up error error error error error error give up error 5 1 shift 18 end document give up ignore change change ignore give up extend give up or EMor EMor EMor EM 6 1 shift 17 load point ignore ignore error error ignore error error give up 7 1 shift 16 tapemark or EM ignore error error ignore ignore error give up attention 8 1 shift 15 writing ignore error error error error error give up give up enabled 9 1 shift 14 mode error give up error error error error error give up give up 10 1 shift 13 read error error ignore error error ignore error give up give up 11 1 shift12 card reject error ignore error error ignore error give up give up or disk error 12 1 shift 11 checksum error error error error error error error error error *) \f 13 1 shift 10 bit 13 error error error error error error error error 14 1 shift 9 bit 14 error error error error error error error error 15 1 shift 8 stopped repeat error repeat repeat error repeat repeat repeat all or ring rest rest rest all rest 16 1 shift 7 word defect repeat 5 error error error error error error error times 17 1 shift 6 position give up error error error error error error error error 18 1 shift 5 proc. does mount give up give up give up give up give up create give up not exist 19 1 shift 4 disconnected mount give up give up give up give up give up give up give up 20 1 shift 3 unintelli- give up give up give up give up give up give up give up give up gible 21 1 shift 2 rejected reserve give up give up give up give up give up create give up 22 1 shift 1 normal ignore ignore ignore ignore ignore ignore ignore ignore 23 1 shift 0 hard * The "checksum error" bit is not generated by the Algol check routines, but by invar. It will not be explained in this section. The entries "give up" and "error" in the table above means that the hard error bit will be set and the give up action - the block procedure - will be called. If the entry says "give up", it means that this status bit may occur for the kind specified, but no standard action has been invented. If it says "error", it mean that you have opened with a wrong kind or that the system has been misused in some other way. The entry "ignore" means that no action is taken for this status. This may either be because the status is normal for the device (write enable for magtape or normal answer) or because it occurs together with another status.\f F_ 1 INTRODUCTION 1.1 How to use the manual The scope of this manual is to give a description of all elements in ALGOL 7 and detailed function description of some elements which are not in ALGOL 60. Therefore reading this book implies knowledge about ALGOL 60. The syntaxtical definition of the language is given in ALGOL 7 Reference Manual ref. 14. Chapter 2, 3 and 4 describes some special ALGOL 7 concepts. The chapter 2 Fields and chapter 3 input/output system shouldbe read by anyone who wants to use ALGOL 7. Chapter 4 is only necessary if you are interested in handling of terminals or coding of coroutines. Chapter 5 describes how texts are handled in ALGOL7. Chapter 6 gives a list of available procedures and chapter 7 gi- ves a list of available operators and standard procedures working as operators. Chapter 8 gives a list and a short description of ALGOL 7 elements not mentioned in the other chapters. Chapter 9 shows an example of how ALGOL 7 can be used to code an operating system. This chapter implies knowledge of chapter 3. Chapter 10 gives a description of how the programs are structured, translated and run. List of error messages are included. Chapter 11 contains an alphabetic list of all elements in ALGOL 7. The elements are described with syntax, function and examples. \f F_ 2 FIELDS Field variables is a tool in ALGOL 7 which makes it easy to address all types of variables in a zone record or an array. 2.1 Field, record and field A field on a document (e.g. a backing storage area) may consist of a set of records. A record may be regarded as a set of fields, where a field is the smallest entity which in some connection is considered as a unit of data. The terms field, record and file will only have a meaning when they are defined together with specific data set and the opera- tions on it. A normal use of these concepts will be read a record from a file by means of the high level record procedures (cf. chapter 3) change some of the variables using fields to specify the type and length of the record elements, and finally write the record back or to another file. T_ Example 1. begin coments insert record numbers in all records in a file; integer field recordno, rlength; zone zin, zout (128, 1, stderror); integer i; open (zin, 4, :input:', 0); open (zout, 4, :output:', 0); rlength: = 2; recordno: = 6; end value: = 10; i: = 1; *the field has an end record as the last record*' repeat invar (zin); zin.recordno: = i; i: = i + 1 &_ until sin.end value = 9999999; T_ close (zin, true); close (zout, true); &_ end; \f T_ Example 2: A zone record describes a simple invoice and have the following &_ structure: T_ Note: z (1) contents length and check sum zone field length in field variablefield elements name halfwords type value customer no 2 integer 6 z(2) internal-cust1boolean7 empty1 z(3)-z(5) customer 12 long array 8 z(6) first word zip code 2 integer 22 z(6) sec. word customer 16 22 to z(10) first word address long array z(11) first word item no 2 integer 2 z(11) sec. word no ordered2integer 44 z(12) price 4long48 z(13) discount 4 long52 &_ z(14) amount 4 long 56 z.fieldname will address the wanted part of the zone record. The field variable should point to the highest halfword in the requi- red zone part if it is a simple field. If it is an array the field value should point to its preceading halfword. The addressing of this zone record with fields is shown in the following shema:\f T_ record field name halfword initialized elements numbering value of the filedvariable record _length2 z(1) check _sum4 customer _no 6customer _no z(2) internal _customerinternal _customer -not used- 8customer _name z(3) 10 customer 12 z(4) 14 name 16 z(5)18 20 zip _code zip _code22customer _address z(6) 24 z(7) customer 26 28 address z(8)30 32 z(9)34 36 38 z(10) -not used-40 item _no42item _no z(11) no _ordered44no _ordered 46 z(12)price48price 50 z(13) discount52discount 54 z(14) amount &_ 56amount\f The following program will read a record like this and write some elements on current out. T_ begin integer i; zone z(128,1,stderror); *declaration of field variables *' integer field customer_no, article _no, number _order; boolean field internal_cust; real field price, discount, amount; long array filed customer_name, customer_addr; * initialization of field variables done relative to make a change is easy *' customer_no : = i: = 6 i: = i + 1; internal_cust: = i: = i + 1; customer_name: = i: = i; i: = i + 12; zip_code : = i: = i + 2; customer_addr: = i: = i; i: = i + 16; item_no: = i: = i + 2; no-_ordered: = i: = i + 2; price: = i: = i + 4; discount : = i: = i + 4; amount : = i: = i + 4; * end init *' open (z,4,:record:',0); * open to backing storage with records created with outvar *' invar(z); &_ * now a zone record is available*' T_ write (out,nl,1:customer number :' dddddd',z.customer_no, nl,1customer name :', z.customer _name, nl,1customer address :', z.customer addr, nl,1:item number :', dddddd', z.item_no, : total sales price :', dddddddd', z.amount); close (z,true); &_ end; T_ 2.2 Field elements. &_ A f_i_e_l_d_ _r_e_f_e_r_e_n_c_e_ consists of a f_i_e_l_d_ _b_a_s_e_ and a f_i_e_l_d_ _v_a_r_i_a_b_l_e_ separated by a periode. A field reference is either a s_i_m_p_l_e_ f_i_e_l_d_ or an a_r_r_a_y_ _f_i_e_l_d_. \f T_ 2.2.1 F_i_e_l_d_ _b_a_s_e_. The field base is the array or zone record in which the field &_ should be found. Note the array may be an array field. T_2.2.2 F_i_e_l_d_ _v_a_r_i_a_b_l_e_. The field variables are the pointers to the wanted part of the field base. A field variable can be a s_i_m_p_l_e_ _f_i_e_l_d_ _v_a_r_i_a_b_l_e_ or an &_ a_r_r_a_y_ _f_i_e_l_d_ _v_a_r_i_a_b_l_e_. A simple field variable used as reference in the field base will give a simple field, and an array field variable used as referen- ce will give an array field. T_2.2.3 S_i_m_p_l_e_ _f_i_e_l_d_ _v_a_r_i_a_b_l_e_. A simple field variable points to a single element of the field &_ base. This element is specified to be of type boolean, integer, long or real by the type of the simple field variable. This type specifies therefore the f_i_e_l_d_ _l_e_n_g_t_h_ of the element as follows: T_ simple field variable typelength of simple field in halfwords boolean1 integer2 long4 &_ real4 2.2.3.1 V_a_l_u_e_ _o_f_ _a_ _s_i_m_p_l_e_ _F_i_e_l_d_ _V_a_r_i_a_b_l_e_. The value of the simple field variable is of type integer independent of the type of the vari- able. This integer value is a halfword pointer in the field ba- se, which selects the wanted element. The value of the pointer depends on the type of the simple field variable. The halfword numeration is the lexicographic ordering of the array (zone record) (cf. ref. 14.). The halfword with number 0 (zero) is the last byte in the (possib- ly fictive) element with subscripts (0,... ,0). Boolean fields are addressed by their halfword number. Integer fields are addressed by one of the 2 halfwords of the in- teger word. Long or real fields are addressed by one of the 2 halfwords in the right hand word. \f The field reference is only valid if the simple fields is inside the bounds of the field base. A simple field variable can be assigned values throughout the program. T_ Example 1. begin * declaration of the filed variables*' integer field if1, if2; long field lf1; real field rf1 * field base a *' array a (1:100); * initialization of fields*' if1 : = i: = 2; if2 : = i: = + 2; lf1 : = i: = i + 4; rf1 : = i: = i + 4:, * simple field references *' a.if1: = ;a.if2: = ; a.if1: = ; a.rf1: = ; &_ end T_ The first 12 halfwords of the array a are assigned a.if1a.if2a.lf1a.rd1 halfword:0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 &_ a(0) a(1)a(2)a(3) a(4) a.if1 will address first word of a(1) a.if2 will address second word of a(1) a.lf1 will address a(2) a.rf1 will address a(3) T_ Example 2: If a program contains the declarations real array Ra(1:3); long array LA(1:3); &_ integer array IA(1:5); boolean array BA(1:11); \f T_ Then the halfword numeration is according to this scheme: RA(1)RA(2)RA(3) 1 2 3 4 5 6 7 8 9 10 11 12 LA(1)LA(2)LA(3) IA(1)IA(2)IA(3)IA(4)IA(5) 1 2 3 4 5 6 7 8 9 10 BA(1) BA(2)BA(3) BA(4) BA(5) BA(6) BA(7) BA(8) BA(9) BA(10) BA(11) &_ 1 2 3 4 5 6 7 8 9 10 11 T_ Example 3: If a program contains the declaration real array B(1:2,0:1), &_ the array may be numbered like this T_ lexicographical index 012345 B(0,0)B(0,1)B(1,0)B(1,1)B(2,0)B(2,1) halfword ... 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 non existentlower boundupper bound &_ halfwordhalfword T_ 2.2.4 A_r_r_a_y_ _f_i_e_l_d_ _v_a_r_i_a_b_l_e_s_. An array field variable will point to an array within the field &_ base. The elements of this array are specified to be of type boolean, integer, long or real by the type of the array field variable. This type specifies the length of the array elements (see 2.2.2). The array field variable is considered declared one dimensional. 2.2.4.1 V_a_l_u_e_ _o_f_ _a_n_ _a_r_r_a_y_ _f_i_e_l_d_ _v_a_r_i_a_b_l_e_. The value of the array field variable is an integer independent of the type of the variable. This integer value is a halfword pointer in the field base which selects the wanted part. The value should be the halfword number in the field base which defines the possibly fictive element (0) of the array field. As the latter is always one dimensional the pointer should be the halfword number of the subscript 0 (zero) of the array field. \f T_2.2.4.2 B_o_u_n_d_s_ _o_f_ _a_r_r_a_y_ _f_i_e_l_d_s_. The array field must be within the field base . No check is made that the subscripts are outside the array &_ field. T_ lower bound of array field = lower bound of field base - array field variable upper bound of array field = &_ upper bound of field base - array field variable T_ Example 4: begin * declaration of field variables *' integer field length, a1; long array field laf; boolean array field baf; * field base a *' long array a (1:5); * initialization of fields *' length : = 2; a1 : = 5; laf : = 0; baf : = 12; &_ * array field referrences *' T_ a.laf (3) : = a.laf.length : = a.baf (12): =a.baf.a1 : = a.baf (-11)a.baf(0) a.laf.lengtha.laf.a1a.laf(3)a.baf(2) a.baf.a1 &_halfword:0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 a(0) a(1) a(2)a(3) a(4) a(5) T_ Example 5: The index bounds for the array field baf from the above example &_ are as if it was "declared". T_2.2.5 F_i_e_l_d_s_ _a_s_ _p_a_r_a_m_e_t_e_r_s_ _t_o_ _p_r_o_c_e_d_u_r_e_s_. Note that field variables may be used as actual parameters to &_ procedures. They behave as integers. Formal parameters may be specified as field variables, but they must n_o_t_ be called by value. The actual must be integer. In the procedure body they act as field variables. \f Simple fields as actual parameters are handled in the same way as subscripted variables. This means that if the corresponding formal is not called by value, the field will be evaluated each time the formal is referred (Jensen"s Device). Array fields are evaluated and a description of the array field as an array is set up before the procedure is entered. This de- scription, local to the procedure is made so that references to the array parameter are just as effective as references to an array declared local in the procedure body. If you restrict yourself to using actual array field references where the reference halfword index is a multiple of the type length, and the field base is one dimensional with lowerbound 1, you will hardly run into trouble. Otherwise the formal array may be "cut" in order to ease and secure index check in the procedure body. The "cutting" is made so that the number of halfword between the reference halfword of the array field and the first accessible halfword of the formal array is a multiple of the type length. The term "between" is to be understood so that T_ (address(ref byte) - address(lowert bound byte) - 1) mod typelength = 0 &_ is true. T_ Example 6: Consider a program like this: ... long array LA(1:2); long array field laf; procedure test (la); long array la ; begin boolean field bf; integer i; .... ... la(i) ... la.bf ... end; ... test(LA.laf); &_ ... \f For some values of laf, the accessible parts of the formal array la may be sketched like this T_ lafinterval interval of iof bf -4 5 6 7 8_ 9 10 11 1_2_ 2:3 5:12 -3 5 6 7 8_ 9 10 11 2:2 5:11 -2 5 6 7 8_ 9 10 2:2 5:10 -1 5 6 7 8_ 9 2:2 5:11 01 2 3 4_ 5 6 7 8_ 1:2 1:8 1 1 2 3 4_ 5 6 7 1:1 1:7 2 1 2 3 4_ 5 6 1:1 1:6 3 1 2 3 4_ 5 1:1 1:5 &_ 4 -3-2-10_1234_0:1-3:4 Halfword with equal locations are shown in the same column. The reference halfword numbers corresponding to indexing in la are underlined, and the halfword accessible by direct indexing are double underlined. The word boundaries are shown as lines going from line to line. In arrays which are actually fields, the word boundaries are only between an even numbered byte and its odd numbered successor, if the value of the field variable is even. If an actual array in a procedure call is a multiple fielded array or record, only the type length associated with the last array field variable is used in a possbile "cutting" of the lower bound. \f F_ 3 INPUT/OUTPUT SYSTEM This chapter describes the use of zones for input/output to any document (device). Zones can be used for programming an operating system in ALGOL. This is described in chapter 9. A zone array is a group of zones with identical declarations. The following details refers to a zone or to a zone within a zone array. The ALGOL system contains a set of standard procedures - the high level zone procedures - which take care of normal input/output functions. The primitive level zone procedures are described in chapter 9. T_3.1 High level zone procedures The high level zone procedures are logically split into three &_ groups T_ control procedures character procedures &_ record procedures See further description of the mentioned procedures in chapter 13. T_3.1.1 Z_o_n_e_ _c_o_n_t_r_o_l_ _p_r_o_c_e_d_u_r_e_s_. The control procedures will take care of connecting, releasing and positioning on the document by means of a zone. The following &_ procedures are available. open Moves the document name, the modehind and the giv up mask to the zone, and divides the buffer area into shares of equal size. Specifies how the handling of the document is performed (mode, kind). close Terminates the current use of a zone including emptying of output buffers and possible releasing of the docu- ment. \f T_ set- position Terminates the current use of a zone including emptying &_ of output buffers. A magnetic tape or a backing storage area is then positioned to the file and block specified. The positioning takes no time on backing storage area, but it may involve a lot of tape moving operations for a magnetic tape. T_ get- position Gets the file and block number corresponding to the &_ position current logical position of the document. T_ Example 1, control procedures. write something on file 3 on a magnetic tape begin zone z(200,2,stderror); * open will tell the operating system that this programwill use the tape 471100 in connection with zone z *' open (z,18,:mt471100:',0): * on magnetic tape a setposition must be performed after an open *' setposition (z,3,0); * position to file 3 *' write (z,:something --- :' ; write (z,:lastword:' ; * empty buffers and terminate run *' close (z,true); * suspend tape *' &_ end T_3.1.2 C_h_a_r_a_c_t_e_r_ _i_n_p_u_t_/_o_u_t_p_u_t_ _p_r_o_c_e_d_u_r_e_s_. The character input/output procedures are used for text handling &_ of input/output where the zones are used as buffers. A conversion is performed for numbers. They are read as decimal numbers and converted to binary numbers in "write" and analog conversion takes place i.e. binary number to decimal number. read Inputs a sequence of numbers given in character from a document. readchear Inputs one non-blind character from a document. \f read- string Inputs a text string given as characters on a document. readall Inputs a mixture of numbers, single characters, and text strings from a document. T_ repeat- char Makes the latest character read from the document availb- &_ le for reading once more. intable Exchanges the current input alphabet with an alphabet specified in the program. T_ table- &_ index Used in connection with intable to define the alphabet. write Prints texts, numbers, and single characters on a docu- ment. T_ Example 1, Read with test on terminator. program part: integer number, term; integer array a(1:3); * read number, a(1), a(2), a(3) and terminator *' read (in,number,a); * get terminator *' repeatchar (in); * read terminator once more *' &_ readchar (in,term); T_ data: 47. 18p30x 4;5 result: number = 47 a(1) = 18 a(2) = 30 a(3) = 4 &_ term = 59 (59 is the ISO value of ;) \f T_ Example 2, Skip characters until digit occurs. Program part: * read a number all leading digit characters are skipped *' * read all leading non-digits *' repeat class: = readdchar (z,class) until class '2; * repeat first digit *' repeatchar (z); read (z,number); . . . data: a + b = 487 &_ result: number = 487 T_ Example 3, Read string, use of intable begin integer array alphabet (0:255); real arry arr (1:5); * set space to be a text part class 6 *' alphabet ( ... * the rest of the alphabet is set cf. intable example *' alphabet (32) : = 6 shift 12 + 32; alphabet (i ..... intable (alphabet); * now we have a new alphabet *' j: = readstring (z,arr,2); &_ end data: ,,,,,,peter brown T_ result j = 2 arr(2) contains: peter add 32 &_ arr(3) contains: brown T_ Normally space is a terminator and the result will be: j = 1 &_ arr(2) contains: peter \f T_ Example 4, Readall. * read numbers, strings and delimiters into the array ia and kind *' &_ i: = readall (in,ia,kind,1); data: ab:a1.2c, 17.56 12345678nl' T_ stored: i contains 11 index 1 2 3 4 5 6 7 8 9 10 11 12 ia ab 0 58 a1. 2c 44 32 32 18 31 great 10 kind 6 6 7 6 6 7772718 &_ dataab:a1.2c,spsp sp 17.56 sp12345678nl T_ Example 5, Write program part: sp: = flase add 32; i: = write (out,la); write (out,sp,18-i, :age:',ddd',la (4), :kilos:', ddd.d',la (5)/1000, &_ sp,2,string la(6) ) ; T_ data: la(1:3) = peter brown:' la(4) = 36 la(5) = 81350 &_ la(6) = :m:' T_ Output &_ peter brown age 36 kilos 81.4 m 3.1.2.1 S_t_a_n_d_a_r_d_ _z_o_n_e_s_ _i_n_ _a_n_d_ _o_u_t_. Two standard zones, "in" and "out", exist. "i" is used for input on character level, "out" is used for output by means of write. The documents connected to in and out are determined when the run starts, i.e. in the FP commands before calling the program. \f They are declared with length of 512 halfwords and 1 share the blockprocedure is stderror. These standard zones are stored in the top of the core area occupied by the job. Example: This example will show use of FP commands to direct in and out. (see ref. 6). T_ Note: This job is run under the operating system BOSS. Input from a magnetic tape file 1 and a backing storage area data 1. Output to a convert area convertout. &_ The program name examp1. T_ convertout = set 1 ; create convert area file1 = set mto mt123456 0 1;file describes file1 on magtape mt 123456 o convert ; output to convertout ; call of program out will write on convertout ; and examp1 file1 ; connect input to magtape. The zone in will read from file1. examp1 data1 ; connect input to the area data. The zone in will read from data1. o c ; output console/terminal convert convertout ; will print the convertout on the printer. &_ ; end FP commands. T_ 3.1.3 R_e_c_o_r_d_ _i_n_p_u_t_/_o_u_t_p_u_t_ _p_r_o_c_e_d_u_r_e_s_. These procedures performs input/output at block level. The zones are used as buffers, but only one record is available for proces- &_ sing at a time. inrec6 Gets a sequence of the requested number of halfwords from a document and makes them available as a zone record. outrec6 Creates a zone record with the requested number of halfword. The contents is initially undefined. The program may then assign values to the record variables, the record will later be output to the document. swoprec6 Geta sequence of the requested number of halfwords from\f a backing storage area and makes them available as a zone record. The program may then modify the record, which later is transferred back to the backing storage area. T_ change- rec6 Regrets the former record and replaces it by a new one. &_ The function of changerec6 depends on which of the procedures inrec6, outrec6, or swoprec6 was last called i.e. the use of the document. T_ Example 1, Inrec and Outrec. begin integer i; * move 10 records from area "old" to area "new" *' zone zin,zout (128,1,stderror); open (zin,4,:old:',0); open (zout,4,:new:',0); * open to both areas "old" and "new" *' &_ for i: = 1 step 1 until 10 do T_ begin inrec6 (zin,100); * reads a record from "old" with 100 halfwords *' outrec6 (zout,100); * make space for record with 100 halfwords *' tofrom (zout,zin,100); * move 100 halfwords to zout form zin *' end; close (zin,true); close (zout,true); &_ end \f T_ Example 2, Inrec6, change ofshare (block). begin zone z (2*128,2,stderror); record 1* 2 shares of 128*4 = 512 halfwords *' shared record 2 open (z,4,:mine:',0); 512 record 3 inrec6 (z,100); halfwords * 1 record length 100 *' record 4 ... * use the record *' inrec6 (z,90); 12 halfs left * record length 90 *' record 5 ... shared 2 . inrec6 (z,110); 512 . * 3 record lenth 110 *' halfwords . ... inrec6 (z,200); * 4 record length 200 *' ... inrec6 (z,70); * only 12 halfwords left, therefore next sharee is used. Record length 70 *' . . &_ . After inrec6 (z,4*n) elements no. z(1) z(n) may be addressed. T_ Example 3, Outrec. begin zone z(2*128,2,stderror); shared record 1 open (z,4,:new',0); 512 outrec6 (z,200); * fill (z,200); 1 *' halfwords record 2 outrec6 (z,300); * fill (z,300); 2 *' outrec6 (z,100); * fill (z,100); 3 *' 12 halfs left. share 2 record 3 . 512 . halfwords . . &_ . After outrec6 (z,4*n) elements no. z(1) ... z(n) may be stored. \f T_ Example 4, Changerec. outrec6 (z,100); record 1 * make speace for 100 halfwords *' ... share change60 rec 2outrec6 (z,200); ... ... * now we regret last outrec6 and want it replaced by outrec6 (z,60) *' &_ changerec6 (z,60); invar Gets a sequence of halfwords from a document as inrec6, but the number of halfwords is given as the first word in the record. A check sum stored in the second word may be checked. outvar Creates a zone record of a specified length and stores data from an arry or another record. The length is stored in the first word of the record. A checksum is generated and stored in the second word of the record. changevar Changes the lenth of an existing record generated by means of outvar. The checksum is computed. chechvar Generates a checksum in an exsiting record. T_ Example 5, Invar, outvar. copy 100 records from the area bsfile1 to area bsfile2 begin integer i; zone zin,zout (128,1,stderror); * open to both areas. Note that setposition is not re- quired *' open (zin,4,:bsfile1:',0); open (zout,4,:bsfile2:',0); for i: = 1 step 1 until 100 do &_ * copy 100 records *' \f T_ begin invar (zin); outvar (zout,zin); end * empty buffers and terminate run *' close (zin,true); close (zout,true); &_ end T_ Example 6, invar. Same input as in example 2 (inrec) will give same result. begin integer field length, checksum; zone z(128*2,2,stderror); length: = 2; checksum: = 4; * record lenth and record checksum are stored in first record element *' open (z,4,:mine:',0); invar (z); * 1 use (z,z.length); *' ... invar (z); * 2 use (z,z.length); *' ... invar (z); * 3 use (z,z.length); *' ... invar (z); * 4 use (z,z.length);*' ... invar (z); * 5 use (z,z.length); * ' . . &_ . \f T_ Example 7, outvar. begin integer field length; zone z(128*2,2,stderror); array a(1:100); length: = 2; open (z,4,:mine:',0); a.length: = 200; a .... outvar (z,a); a.length: = 300; a .... outvar (z,a); a.length: = 100; a .... outvar (z,a,); . . &_ . T_ Example 8, Changevar begin integer field length; array a(1:100) zone z(128,1,stderror); a.length: = 40; outvar (z,a,); ... ... * now we want to change the length of the above re- cord *' a.length: = 60; changevar (z,a); * NB: the checksum, is recalculated *' . . &_ . T_ Changevar is only allowed after outvar, since it would be &_ senseless after invar. \f T_ Example 10, Checkvar. program part: a.length: = 40; ..... outvar (z,a,); ... ... z.count: = z.count + incr; * now the checksum does not correspond to the record *' checkvar (z); &_ * now it does *' T_3.2 Zone elements. Every zone consists of a b_u_f_f_e_r_ _a_r_e_a_ or z_o_n_e_ _b_u_f_f_e_r_ a z_o_n_e_ _d_e_s_c_r_i_p_t_o_r_ &_ one or more s_h_a_r_e_ _d_e_s_c_r_i_p_t_o_r_s_ or s_h_a_r_e_s_. T_3.2.1 B_u_f_f_e_r_ _a_r_e_a_. The length of the buffer area is specified with the zone &_ declaration. The length is in reals (each real is 4 halfwords). T_ This buffer area can be used as a real array with &_ 1_subscript _length Such as subscripted variable is called a r_e_c_o_r_d_ _v_a_r_i_a_b_l_e_. The z_o_n_e_ _r_e_c_o_r_d_ defines which part of the buffer area is avaialble for subscription. The buffer area is split up into s_h_a_r_e_s_ usually of equal length. T_ 3.2.2 Z_o_n_e_ _d_e_s_c_r_i_p_t_o_r_. A zone descriptor consists of the following set of quantities, &_ which specifies a process or a document (see ref. 3) connected to the zone and the state of this process: \f T_ set by procedure process name A text string specifying the name open of a process or a document connec- ted to the zone. mode and kindAn integer specifying mode and kind open for a doucment (see open). logical position A set of integers specifying the cur- rent position of a document. give up mask An integer containing ones in posi- open tions where a resulting status bit should be call the block procedure instead of the standard error action. open state An integer specifying the latest opera- tion on the zone. (see get zone 6). record Two integers specifying the part of the buffer area nominated as the zone re- cord (see 8.2.2.1). used share An integer specifying the share descrip- tor within the zone, which is used for the moment. last byte An integer specifying the end of a phy- sical block document. block procedure The procedure block proc is the third parameter in the zone declaration. It when is a procedure which is called when andeclared error occurs on the document and the corresponding bit is set in the give up &_ mask. 3.2.2.1 Z_o_n_e_ _r_e_c_o_r_d_. A number of consecutive halfwords of the buffer area may at run time be nominated as the zone record. The halfwords of the zone record may be available as r_e_c_o_r_d_ _v_a_r_i_a_b_l_e_s_, which may be thought of as a kind of real subscripted variables. The record variables are numbered 1, 2...., record length. \f All halfwords of the record may be referenced by means of field references, as the zone may be used as a field base. The position and length of the zone record will be specified by the record input/output procedures. When the character input/output procedures are used the zone record will be a b_l_o_c_k_, this is the actual amount of information transferred to or form the share in one operation. T_3.2.3 S_h_a_r_e_ _d_e_s_c_r_i_p_t_i_o_n_ _o_r_ _s_h_a_r_e_s_. A zone buffer is split into a number of share descriptors. This &_ number is specified in the zone declaration. A share descriptor consists of a set of quantities which describe a transfer of data between a document (parallel process) and a part of the buffer area. The set of quantities forming one share descriptor is: T_ share state An integer describing the kind of activity going &_ on in the shared area. (see getshare6). T_ shared area Two integer specifying the part of the buffer area &_ shared with the process controlling the document. T_ operation Specifies the latest operation performed by means &_ of the share descriptor (see ref.3). The amount of information transferred to or from a share in one operation is called a block. On a magnetic tape, a block is a physical block or a tape mark. On a backing storage area, a block is one or more segments. On a paper tape reader, a block is usually one share of characters. The advantage of splitting the zone buffer into shares is, that one or more shares can be occupied by input/output while another is used for processing.There is only one buffer available for transferring of data and processing of data. That means in case of single share input/output the program has to wait for a data transfer before the processing may continue. For choice of number of shares see 3.6.2. \f T_ Tapemark: Tapemark is ignored after a sense or a move operation. If tapemark occurs after an input operation, the standard action is &_ to simulate a block of 2 bytes containing :25'25'25':'. T_ Stopped (during output): If the "ring" bit is set, the output is repeated. Otherwise a &_ message is sent to the parent requisting a write enable ring to be mounted. When the job is restarted after mounting of the ring, the output is repeated. T_ Does not exist: This bit is ignored after a sense operation of a move operation. In other cases, a mount-tape-message is sent to the parent. Next, &_ the tape is reserved for exclusive access and if this goes wrong, the mount-tape-message is sent again. Third, the tape is positio- ned according to file and block count and the operation is re- peated. T_ Rejected: Handled as "does not exist", except that the mount-tape-message &_ is not sent. T_ Parent message The parent message (i.e. the operating system for your job) may either handle a message according to its own rules, or it may &_ pass the request on to the operator. The job may ask the parent to stop the job temporarily until the operation has been per- formed. The exact rules depend on the operation system in que- stion. T_3.2.4 Z_o_n_e_ _a_f_t_e_r_ _d_e_c_l_a_r_a_t_i_o_n_. When a zone is declared, the following parts of the zone descrip- &_ tor is defined: used shareis the first share which contains the entire zone buffer area. T_ zone record is the entire buffer area as one record. The whole buffer can be accessed as a real array, where the elements are numbered 1, 2, 3, ..., length declared. The zone record can be used as a real array everywhere in the program (e.g. in a procedure &_ call). \f T_ block procedurethe block procedure is defined but will not have any proctical effect before a high level zone &_ procedure is called. T_ Example: begin integer i; zone z(128,1,stderror); comment now iti is possible to ise the whole zone buffer area or the zone record as a real array z(1:128); for i: = 1 step 1 until 128 do z(i): = i; &_ end T_3.2.5 Z_o_n_e_ _a_f_t_e_r_ _o_p_e_n_. Opening a zone with the high level procedure open (zone',mode kind', name string', give up mask') (see open and 3.2.2) will &_ cause the following, process nameis the name specified in the call of open for a documentwhich should be connected to the zone. mode and kindis set to mode kind from the call. Specifying the mode andkind for the document (see open). Kind is as a rule only used in connection with errorhandling of the document. Mode specifies how input or output from the document(i.e. even or odd parity) T_ logical &_ position just before the first element of block 0 file 0. give up mask is set to give up from the call used to specify thestatus bits, the block procedure should take care off.Normally give up mask is 0, meaning the blockprocedure is only called if harderror (1 shift 0) is detected in the status word. zone state is set to after open. shares the buffer area is divided evenly among theshares.\f The zone is now ready for high level input/output to the specified document. Note: The document is not connected physically (i.e. the entry on a backing storage is not looked up). Therefore a call of open to a non existing document will not cause error, but the first call of a high level input/output procedure will show the document as disconnected. Zone record. There is no elements in the zone record. A reference to a zone variable will cause an alarm: index, field or the like. A high level input/output procedure should be called before a zone record is available. T_ Example: begin zone (128,1,stderror); * the zone is declared and the zone is the entire buffer area z(1) -z(128) *' open (z,4,:bsfile:',0); * now the zone is opened to the area bsfile, no zone record exists *' invar (z); * now the first record from bsfile is transferred to the zone record z(1) -z(record length) *' . . . close (z,true); * now the zone is no longer connected to the bs area, as after declaration *' &_ end T_ 3.3 Error handling/checking Any input/output operation to a document will r_e_s_u_l_t_ _i_n_ an answer to the program containing a 24 bit logical status word. This sta- &_ tus word will describe the success of the operation. If an error occurs (status word ' 0) a check routine in algols running\f system will perform a standard error action depending on the bits set in the status word. A list of the normal meaning of the status bits is given in 3.3.3. T_3.3.1 B_l_o_c_k_ _p_r_o_c_e_d_u_r_e_ _a_n_d_ _g_i_v_e_ _u_p_ _m_a_s_k_. A call of the block procedure specified in the zone declaration &_ will take place in the following cases. T_ 1. When some of the bits set in the give up mask occuredin the logical status word. 2. When the standard error action classifies the &_ situation as a hard error (give up). T_ The following figure should explain when the block procedure is called: input/output operation set status NO 1 inYES give up mask standard error action OK NO (hard error)call Block procedure YESReturn &_ \f The block procedure is called with 3 parameters: T_ block _proc. (z,s,b) z is the zone. The record of z is the entire shared areaavailable for the transfer. s is an integer containing the logical status word. b is the number of halfwords transferred in the &_ operation. You can tell the difference between the call reasons by means of the last bit in the logical status word. Normally the giveup mask should be 0 and the block procedure stderror. But if a special block procedure is wanted, let the stderror procedure take care of as much as possible. Purpose and return. In the block procedure, you can do anything to the zone by means of the primitive zone procedures and the high level zone proce- dures (in the latter case you must be prepared for a recursive call of the block procedure). To make sense, the effect should be an improved check or error recovery of that operation, which caused the block procedure to be called. You may also avoid a standard error action by means of the give up mask and instead perform your own checking of the transfer. You signal the result of the checking back to the high level zone procedure by means of the final block length, b. The value of b has no effect when an output operation is checked, but after an input operation you may signal a longer or shorter block or even an empty block (b = 0). However, the value of b at return, must correspond to a block which is inside the shared area specified by the value of used _shared at return. Otherwise, the run is ter- minated with an index alarm. Further details may be found in 3.4. T_3.3.2 E_x_a_m_p_l_e_s_. Example 1, Reading a file on a magnetic tape. Instead of creating a block procedure to take care of tapemark, a stop record should &_ be created as the last record in the file.\f T_ Example 2, rejecting part of a block. A block procedure which tries to repair an input block after per- &_ sistent parity error looks like this: T_ procedure repair (z,s,b); zone z; integer s,b; if s shift (-22) extract 1 = 1 then begin comment handling of persistent parity error; integer to, from; to: = 0; for from: = 1 step 1 until b//4 do if z(from) is o.k. then begin to: = to + 1; z(to): = z(from); end; comment the defect items of the block are squeezed out. The newlength is signalled back; b: = to*4; end &_ else stderror (z,s,b); T_ Example 3, copy input. A block procedure which copies everything read from "z" to the &_ zone "test" may look like this: T_ procedure copy (z,s,b); zone z; integer s,b; if s extract 1 = 1 then stderror (z,s,b) else begin comment this code also works for b = 0; outrec6 (test,b); tofrom (test,z,b); &_ end; The zone "z" must be opened with a give up mask of 2 (normal answer). Inrec6, invar and read take action on nothing trans- ferred (maybe stopped). T_ Example 4, file number checking on magnetic tape. This example has no relevance in system 3, if your parent (opera- &_ ting system) is BOSS. The safety of magnetic tape positioning can be improved by means of file labels. Each of the logical files on the tape are separa- ted by two tape marks surrounding one label block. This block\f contains the logical file number in the text form. T_ The positioning to block 0 of a logical file (counted 1, 2, ...) is started with this procedure: porcedure logpos (z,f); zone z; integer f; &_ setposition (z,f*2 - 2,0); The procedure cannot check the lable, because simultaneous positioning then would be impossible. Instead the block procedure may check the lable: T_ procedure labelcheck (z,s,b); zone z; integer s,b; if s extract 1 = 1 then stderror (z,s,b) else begin integer array ia (1:20); intefer op,f,bl,lab; own boolean next; comment next indicates whether the procedure was calledfrom labelcheck itself; getzone6 (z,ia); getshare6 (z,ia,ia(17)); comment the operation checked is used_share, which nowis moved to ia; op: = ia(4) shift (-12) extract 12; &_ if (op = 0 or op = 8) and -; next then T_ begin comment positioning operation not called from labelcheck was completed; next: = true; getposition (z,f,bl); setposition (z,f,bl); if read (z,lab,op) ' 1 or lab ' f//2 + 1 then system (9,f//2 + 1,:10'position:'); comment if label did not contain exactly one number or the file number recorded is wrong, the run is terminated with an alarm; setposition (z,f + 1,0); b: = 0; next: = false; end &_ end; The zone must be opened with a give up mask of 2 (normal answer). \f T_ Example 5, test on end of file. zone ztape (300,3,ztape_block_procedure); porcedure ztape_block_procedure (ztape,status,bytes); zone ztape; integer status bytes; * if the status is tapemark then nextfile else stderror*' if status shif 7 0 then goto next_file else stderror (ztape,status,bytes); * the zone is opened with tapemark in give up mask *' open (ztape,18,:tapename:', 1 shift 16); setposition (ztape,1,0); &_ for i: = ..... T_ begin invar (ztape); . . . end; &_ next_file: Example 6, See example 2 of invar. T_ 3.3.2 D_o_c_u_m_e_n_t_s_. The high level procedures assume that all peripheral devices scan document. For instance, a document scanned by a paper tape reader &_ is a roll of paper tape, a document scanned by a magnetic tape station is a reel of magnetic tape. The documents are at run time addressed by names appearing as text strings in algol. A document may be thought of as a string of information, either a string of 8-bit characters or a string of real variables (e_l_e_m_e_n_t_s_). The string is on documents broken into physical blocks (e.g. on magnetic tapes and backing storage areas). The procedures for input/output on character level and record level keep track of the current l_o_g_i_c_a_l_ _p_o_s_i_t_i_o_n_ of the document. The logical posi- tion points to the boundary between two characters or two ele- ments. During normal sequential use of the document, the logical position moves along the document corresponding to the calls of the input/output procedures. For documents consisting of physical blocks, the logical posi- tion is given by a position within the physical block, plus a b_l_o_c_k_ _n_u_m_b_e_r_, plus (for magnetic tapes) a f_i_l_e_ _n_u_m_b_e_r_. Note that\f the block number is ambiguos in the case where the logical posi- tion points to the boundary between two physical blocks. This ambiguity is resolved explicitly in the description of the indi- vidual procedures: The term "the logical position is just after or just before a certain item" implies that the block number is the block number of that item. The following sections give a survey of some documents and the way they transfer information to and from the zone buffer. The rules for protection of documents and further details are found in ref. 1, ref. 2, and ref. 3. The kinds and modes mentioned below are explained under open. T_ I_n_t_e_r_n_a_l_ _p_r_o_c_e_s_s_ _(_k_i_n_d_ _0_)_. An internal process (another program executed at the same time as &_ your job) may receive or generate a document. If the process just transmits the information to or from a peripheral device, the rules above for that device will hold for the communication with the document too. The kind specified in "open" should then be the kind of the document. The internal process may also handle the information in its own way, and then no general rules can be given, but usually, the end of the document is signalled as explained in section 8.2.4.3. T_ B_a_c_k_i_n_g_ _s_t_o_r_a_g_e_ _(_k_i_n_d_ _4_)_. The backing storage consists of a drum or a disc or both. You &_ have no direct access to the entire backing storage, but only to documents which are b_a_c_k_i_n_g_ _s_t_o_r_a_g_e_ _a_r_e_a_s_ consisting of a number of "consecutive" s_e_g_m_e_n_t_s_ (only logical not physically). Each segment contains 512 bytes (or 128 real variables). The segments are numbered 0, 1, 2, ... within the area, and the block numbers mentioned above are exactly these segments numbers. File numbers are irrelevant. One or more segments may be transferred directly as bit patterns to or from the core stored in one operation. The number of segments transferred is the maximum number that fits into the shared used. The physical backing storage may be a drum or a disc. Details about the various types of devices may be found in ref. 3. \f T_ T_y_p_e_w_r_i_t_e_r_ _(_k_i_n_d_ _8_)_. A typewriter may be used both for input and output. The sequence &_ of characters input forms one document (infinitely long), and the sequence of characters output forms another document. File number and block number are irrelevant on a typewriter. One input operation transfers one line of characters (including the terminating New Line character) to the share. If the share is too short, less than a line is transferred, but that is an situation. The characters are packed in ISO 7-bit from with 3 characters to one word, and last word is filled up with binary nulls. One output operation transfer characters packed in the same form to the typewriter. Several lines may be output by one operation. T_ P_a_p_e_r_ _t_a_p_e_ _r_e_a_d_d_e_r_ _(_k_i_n_d_ _1_0_)_. A document consists of one roll of paper tape. It may be read in &_ various modes: with even parity, with odd parity, without parity, or with transformation from flexowriter code to ISO code. File number and block number are irrelevant for a paper tape. One output operation will usually fill the share with characters packed 3 per word, but fewer characters may also be transferred, for instance at the tape end. In such cases, the last word is filled up with null characters. The characters are not necessari- ly ISO characters, that depends on the meaning you assign to them. T_ P_a_p_e_r_ _t_a_p_e_ _p_u_n_c_h_ _(_k_i_n_d_ _1_2_)_. A document is from the programs point of view infinitely long, &_ even when the operator divides the output into more paper tapes. A paper tape may be punched in various modes: with even parity, with odd parity, without parity, or with transformation from ISO to flexowriter code. File number and block number are senseless for a tape punch. One output operation may punch any number of characters packed 3 per word. In all modes, except the mode without parity, only the last 7 bits of the characters are output and extended with a pa- rity bit. T_ L_i_n_e_ _p_r_i_n_t_e_r_ _(_k_i_n_d_ _1_4_)_. A document is from the program point of view infinitely long. &_ Filenumber and block number are senseless on a printer. One output operation may print any number of characters packed 3\f per word. The characters must be in ISO 7-bit code. T_ C_a_r_d_ _r_e_a_d_e_r_ _(_k_i_n_d_ _1_6_)_. &_ A document is one deck of cards. One input operation will fill the share with an integral number of cards. Usually jobs let the operating system read all necessary card decks before they are started. The cards may then be read as a normal ISO text stored on backing store (see ref. 7 for further details). T_ M_a_g_n_e_t_i_c_ _t_a_p_e_ _(_k_i_n_d_ _1_8_)_. A document is one reel of tape. It consists of a sequence of f_i_l_e_s_ &_ separated by a single file mark. Each file consists of physical blocks possibly with variable lengths. The blocks may be input or output in even or odd parity. The files and blocks are numbered 0, 1, 2, ... as shown in the figure. T_ Magnetic tape document: load point file 0 tape mark file 1 tape mark end of tape &_ block 0 block 1 ... block 0 block 1 ... Two kinds of tape stations exist: 7-track stations where a block consists of a sequence of 6-bits bytes; one word of the share is here transferred as 4 6-bits bytes. 9-track stations where a block consists of a sequence of 8-bit bytes; one word of the share is here transferred as 3 8-bit bytes. This difference causes no troub- le as long as the tapes are written and read on RC 8000. But if you try to move a 7-track tape to another computer (or to an off- line converter), you should remember that the read and write pro- cedures of algol work with 8-bit characters packed 3 to a word, which means that the physical 6-bit bytes on the tape have a strange relation to the logical 8-bit characters. You may, how- ever, read or write 6-bit characters by means of the operators shift, add, extract and the procedures inrec6 and outrec6. The share length you use for output to a magnetic tape determines the physical block length. As the blocks are separated by a block gaps, the share length has influence on the amount of information the tape can hold and also on the maximum transfer speed. \f If you use a share length of 600 elements (2400 halfwords), 10/11 of the tape would be used for data and the transfer rate would be close to the maximum possible. Details on actual transfer rates and possible densities is found in ref.3 and the device manuals. Some peripheral devices, for instance the clock, do not scan do- cuments, and they cannot be handled by the high level zone proce- dures. However, the primitive input/output level may handle such devices too. T_3.3.3 S_t_a_n_d_a_r_d_ _e_r_r_o_r_ _a_c_t_i_o_n_s_ _a_n_d_ _m_o_d_e_k_i_n_d_. Each standard error action is mainly concerned with a single bit of the remaining bits in the logical status word. The logical status word is 24 bits generated at the end of an operation on &_ the document, it is available as a parameter when the check algo- rithme has called the block procedure. The first bits until "1 shift 12" are taken from the monitor, which takes most of the bits from the hardware. The last bits are a transformation of the result supplied by the monitor, while bits 1 shift 8, 1 shift 7 and 1 shift 6 are generated by wait transfer routine (see 8.6.4). The meaning of the bits is as follows: Logical status word T_ 1 shift 23: I_n_t_e_r_v_e_n_t_i_o_n_. The device was set in local mode du- ring the operation, presumably because the operator &_ change the paper of the like. T_ 1 shift 22: P_a_r_i_t_y_ _e_r_r_o_r_. A parity error was detected during &_ the block transfer. T_ 1 shift 21: T_i_m_e_r_. The operation was not completed within a &_ certain time defined in the hardware. T_ 1 shift 19: B_l_o_c_k_ _l_e_n_g_t_h_. A block input from magnetic tape was &_ longer than the buffer area followed for it. \f T_ 1 shift 18: E_n_d_ _o_f_ _d_o_c_u_m_e_n_t_. Means various things, for instan- ce: Reading or writing the backing storage area was attempted, the paper tape reader was empty, the end of tape was sensed on magnetic tape, the paper supply was low on the printer. See ref. 1 and ref. 3 for further details. T_ 1 shift 17: L_o_a_d_ _p_o_i_n_t_. The load point was sensed after an ope- &_ ration on the magnetic tape. T_ 1 shift 16: T_a_p_e_ _m_a_r_k_ _o_r_ _A_t_t_e_n_t_i_o_n_. A tape mark was sensedor written on the magnetic tape or the attention but- &_ ton was pushed during the typewriter i/o. T_ 1 shift 15: W_r_i_t_e_-_e_n_a_b_l_e_. A write-enable ring is mounted on &_ the magnetic tape. T_ 1 shift 14: M_o_d_e_ _e_r_r_o_r_. It is attempted to handle a magnetic &_ tape in a wrong mode (NRZ or PE). 1 shift 13: R_e_a_d_ _e_r_r_o_r_.Card reader error. See ref.3. T_ 1 shift 12: C_a_r_d_ _r_e_j_e_c_t_ _o_r_ _D_i_s_k_ _e_r_r_o_r_. Card reader or disk &_ error. See ref.3. T_ 1 shift 8: S_t_o_p_p_e_d_. Generated by the check routine when less than wanted was output to a document of any kind &_ or zero were input from a backing storage area. T_ 1 shift 7: W_o_r_d_ _d_e_f_e_c_t_. Generated by the check routine when the number of characters transferred to or from a magntic tape is not divisible by the number of words transferred, i.e. when only a part of the last word was transferred. T_ 1 shift 6: P_o_s_i_t_i_o_n_ _e_r_r_o_r_. Generated by the check routine after magnetic tape operations, when the monitors count of file and block number differs from the expected value in the zone descriptior (see &_ getzone6) T_ 1 shift 5: P_r_o_c_e_s_s_ _d_o_e_s_ _n_o_t_ _e_x_i_s_t_. The process communicating with the document is unknown to the monitor, i.e. &_ an area process or a driver. \f T_ 1 shift 4: D_i_s_c_o_n_n_e_c_t_e_d_. The power is switched off on the &_ device. T_ 1 shift 3: U_n_i_n_t_e_l_l_i_g_i_b_l_e_. The operation attempted is illegal &_ on that device, e.g. input from a printer. T_ 1 shift 2: R_e_j_e_c_t_e_d_. The program may not use the document, or &_ it should be reserved first. T_ 1 shift 1: N_o_r_m_a_l_ _a_n_s_w_e_r_. The device has attempted to excute the operation, i.e. "1 shift 5" to "1 shift 2" are &_ not set. T_ 1 shift 0: H_a_r_d_ _e_r_r_o_r_. The standard error action has classified the transfer as a hard error (see &_ 8.6.4), i.e. the error recovery could not succed. The standard error action for "stopped" cannot be performed suc- cessfully if "users _bit" (see 8.6.4) contain any one of the fol- lowing bits: 1 shift 22, 21, 20, 19, 18, 17, 16, 7, 5, 4, 3, or 2. As a consequence, the stopped-bit is ignored by the standard error actions in this case. The bit"normal answer" is always ignored, the remaining standard error actions depend on the document kind given in "open" as shown below. This kind has not necessarily any relation to the actual physical kind. Situations not covered by the description are h_a_r_d_ _e_r_r_o_r_s_. As table in this section, you will find a quick index on how the standard error actions work for the different devices and status bits. You will also find the translation of the status bits to the messages from FP when the Algol program stops because of de- vice errors (stderror is called). Below follows a more elaborate description of the actions. Details of handling of device status. T_ I_n_t_e_r_n_a_l_ _p_r_o_c_e_s_s_ _(_k_i_n_d_ _0_)_. Any status bit except "1 shift 1", normal answer, is treated by &_ calling the block procedure. The special actions to be taken must be defined by a special agreement between your program and the internal process. \f T_ End of document: This will only make sense during input. If anythinghas been in- &_ put, the bit will be ignored. Otherwise the empty block will be replaced by 1 word containg the text :25'25'25':'. If this bit appears during any other operations, it will cause the block procedure to be called. T_ Stopped (during output): The output operation will be repeated for the remaining part of the buffer. This action may compensate for differences in share &_ sizes in your program and in the internal process. T_ B_a_c_k_i_n_g_ _s_t_o_r_a_g_e_ _a_r_e_a_ _(_k_i_n_d_ _4_)_. The monitor usually repeats defect transports to or from backing storage areas. Therefore most error bits are treated as hard er- &_ rors. Only the bits "1 shift 18", end of area, "1 shift 8", stopped, "1 shift 5", process does not exist, and "1 shift 2", rejected are given special treatment. T_ End of document (i.e. area): If this happens during input, and if nothing has been transferred, &_ the empty block is replaced by 2 halfwords containing the text :25'25'25'.', otherwise the bit is ignored. During output, the standard action is to try to extend the area (not all possible in system 2). If it is impossible to extend, the block procedure is called, otherwise the output operation is repeated. T_ Stopped: This staus may appear both during input and during output. The transfer is repeated, except if it has been overruled by the &_ action for end of area, or the two actions below. T_ Process does not exist: An area process is created. If the creation is not successfull. &_ the action gives up and calls the block procedure. If the opera- tion is output, the area process is reserved for exclusive acc- ess. If this is not possible, the action gives up and calls the block procedure. Now the transfer is repeated. T_ Rejected: &_ Handled exactly as "process does not exist". Note that the status messages "process does not exist" or "rejec- ted" may be caused by the fact that you have exceeded your area claims. \f T_ T_y_p_e_w_r_i_t_e_r_ _(_k_i_n_d_ _8_)_. Between the status bits concerning the hardware only the timer &_ status, "1 shift 21" has been given special treatment. The igno- red hardware bits will either generate disconnected status, i.e. "1 shift 4" or "1 shift 8", stopped output. T_ Timer: If this status happens as a result of an output message, the block procedure is called. After an input operation it is ignored if anything has been input, otherwise the input operation is repeate T_ Stopped (during output): If this bit is generate together with the ignored bits, the rest &_ of the buffer is output. T_ P_a_p_e_r_ _t_a_p_e_ _r_e_a_d_e_r_ _(_k_i_n_d_ _1_0_)_. Only end document status "1 shift 18" gets a special treatment &_ from the check system. If a parity error occurs, the monitor will substitute the defect character by a substitute character, deci- mal value 26. Intervention status is ignored. T_ End of document (i.e. end of paper tape): If anything has been input the status is ignored, otherwise a &_ block of 2 halfwords :25'25'25':' is simulated. T_ P_a_p_e_r_ _t_a_p_e_ _p_u_n_c_h_ _(_k_i_n_d_ _1_2_)_. If something has been punched with parity error, the action is to give up, and call the block procedure. The same thing happens &_ after a timer status as this usually is caused by the punch run- ning out of paper tape without having given "end of document" status. This is either caused by hardware malfunction of by mis- use of the punch. T_ End of doucment (i.e. no more tape): A message is sent to the parent, requesting that the paper is changed in the punch and that the job is stopped until the opera- &_ tor tells that he has done so. T_ Stopped (during output): &_ The remaining part of the share is output. \f T_ L_i_n_e_ _p_r_i_n_t_e_r_ _(_k_i_n_d_ _1_4_)_. If a parity error occurs during printing, the standard action is to give up. The end of document status means that the paper has &_ run out. T_ End of document (i.e. no more paper): A message is sent to the parent requesting that the paper is chan- ged and that the job is stopped until the operator tells that he &_ has done so. T_ Stopped (during output): &_ The remaining part of the share is output. T_ C_a_r_d_ _r_e_a_d_e_r_ _(_k_i_n_d_ _1_6_)_. A parity error status, signalling an error in the conversion, is ignored by the standard error actions, as the monitor substitute the wrong combination by a substitute character corresponding to the conversion (see details in ref. 8). The "end of document" &_ status shows end of card deck. T_ End of document (i.e. end of deck): If anything has been input, the status is ignored, otherwise a &_ block of 2 halfwords containg :25'25'25':' is simulated. T_ M_a_g_n_e_t_i_c__t_a_p_e_ _(_k_i_n_d_ _1_8_)_. The actions for magnetic tapes are made so that a tape may be unloaded and remounted during the run without harming the job &_ using the tape. Label check is not included, it is expected that the operating system (or the machine staff) performs this. The action on mode error is to give up and call the block procedure. T_ Parity error: The stopped bit is ignored in this case. An input operation is repeated up to 5 times, but if the parity error persists, the &_ error, is a hard one. An output is repeated up to 5 times, pre- ceded by 1 erase operation the first time, 2 erase operation the second time and so on. If the parity error persists, the standard actions give up and call the block procedure. T_ Word defect: The actions are as for parity error. Note that if you suppress the "word defect" action by setting "1 shift 7" in your give up &_ mask, you can read tapes not written on the RC 8000 or tapes written with trail '(see open). Of course your block procedure will be called each time the bit occurs. In case of "word defect",\f unused character positions are filled with binary nulls. T_ Tapemark: Tapemark is ignored after a sense or a move operation If tapemark occurs after an input operation, the standard action is to simu- &_ late a block of 2 halfwords :25'25'25':'. T_ Stopped (during output): If the "ring" bit is set, the output is repeated. Otherwise a &_ message is sent to the parent requesting a write enable ring to be mounted. When the job is restarted after mounting of the ring, the output is repeated. T_ Does not exist: This bit is ignored after a sense operation or a move operation. In other cases, a mount-tape-message is sent to the parent. Next, the tape is reserved for exclusive access and if this goes wrong, the mount-tape-,message is sent again. Third, the tape is positio- ned according to file and block count and the operation is repea- &_ ted. T_ Rejected: Handled as "does not exist", except that the mount-tape-message &_ is not sent. T_ Parent message: The parent (i.e. the operating system for your job) may either handle a message according to its own rules, or it may pass the request on to the operator. The job may ask the parent to stop the job temporarily until the operation has been performed. The &_ exact rules depend on the operating system in question. \f F_ Table 3.3.3 \f F_ Table 3.3.3 rfere (forsat) ples of\f F_ 3.4 Multi buffering and checking T_3.4.1 M_u_l_t_i_s_h_a_r_e_ _i_n_p_u_t_/_o_u_t_p_u_t_. Input. During input from a document via a zone with sh shares, the sys- &_ tem uses one of the shares for unpacking of information and the remaining sh-1 shares for uncompleted input of later blocks. The following picture shows the state of the blocks of the document. T_ I_n_p_u_t_,_ _s_h_ _=_ _3_ logical positionphysical posi- begin oftion if close &_ document completed transfers uncompleted transferswere called Note that when the document is closed, the physical position of the document is far ahead of the logical position. This is par- ticularly important at the end of magnetic tapes where the "wawed" blocks may be absent and the tape then comes off the reel. T_ Output. During output to a document via a zone with sh shares, one share &_ is used for packing information, and 0 to sh-1 of the remaining shares are used for uncompleted output of previous blocks. The following picture shows the state of the blocks in the output stream. T_ O_u_t_p_u_t_,_ _s_h_ _=_ _3_ logical positionphysical posi- begin oftion if close document completed transfers uncompleted transferswerecalled &_for packing Note that when the document is closed, the physical position is must after the block corresponding to the logical position. T_ Swoprec6. The procedure swoprec6 utilizes the shares as follows: One share &_ is used for packing and unpacking of information. If sh ' 1, another share is used for uncompleted output. Remaining shares are used for uncompleted input of later blocks. \f T_ 3.4.2 C_h_o_i_c_e_ _o_f_ _n_u_m_b_e_r_ _o_f_ _s_h_a_r_e_s_. The advantage of the multishare input/output is that differences in speed between the program and the device may be smoothed to any &_ degree. The most frequent choice is between single or double buf- fer input/output. Use single buffering, normal larger share size (blocking) will speed up the transfer time. The following rule of thumb may help you to choose in cases where you scan a document sequentially: T_ th = time spent by the program with handling of the information in a block. td= time spent by the device with transfer of a block. td + th is the total time in single buffer mode (sh = 1) &_ max(td,th) is the total time in double buffer mode (sh = 2). If th varies from block to block, the situation is more complica- ted and sh ' 2 pay. The following rule of thumb concers the sequential use of swoprec: T_ th + 2*td is the total time per block with sh = 1, max(th,td) + td is the total time per block with sh = 2, &_ max(th,2*td) is the total time per block with sh = 3. You should always use s_i_n_g_l_e_ _b_u_f_f_e_r_i_n_g_ _o_n_ _p_r_i_n_t_e_r_,_ _p_l_o_t_t_e_r_,_ _a_n_d_ p_u_n_c_h_, except if you know for sure that your job is not stopped and started by the operating system. The reason is that an output operation may not be terminated when the job is stopped, and then if sh ' 1 the next output operation is started before the first is checked and output again. You should always use s_i_n_g_l_e_ _b_u_f_f_e_r_i_n_g_ _f_o_r_ _t_y_p_e_w_r_i_t_e_r_ _o_u_t_p_u_t_, because the operator at any moment may stop the output operation to send a console message. T_3.4.3 M_e_s_s_a_g_e_ _b_u_f_f_e_r_s_ _o_c_c_u_p_i_e_d_. Input/output by means of sh shares permanently sh-1 of the message buffers available for the job (see ref. 1). From the moment setposition has been called for a magnetic tape and until the first input/output is performed, one message buffer is occupied (even when sh = 1). 3.4.4 A_l_g_o_r_i_t_h_m_s_ _f_o_r_ _m_u_l_t_i_s_h_a_r_e_ _i_n_p_u_t_/_o_u_t_p_u_t_. &_ The following algorithms are part of ALGOL 7 input/output system.\f T_ You must know about these algorithms if you want to interfere with the system in the block procedure of the zone (examples of block procedures are given in 1, ref.3). Ref. 3.3.1 and explained the rules behind the communication with device &_ Below sh denotes the number of shares in the zone. S_n_a_p_s_h_o_t_s_ _o_f_ _s_h_a_r_e_s_ _i_n_ _t_y_p_i_c_a_l_ _s_i_t_u_a_t_i_o_n_s_ _(_s_h_ _=_ _3_ . Just after setposition on a magnetic tape: share 1 share 2 share 3 moved operation free free for positioning use only share 1 After inrec: share 1share 2share 3 record input free input (used share) After several outrec: share 1share 2share 3 record outputfreeoutput &_ (used share) T_ Change of block at input: rep: if share_start (used_share) = free then begin start transfer (input) used_start: = used_share mod sh + 1 goto rep &_ end; T_ comment now all shares are busy with transfers except after a positioning; wait_transfer (used_share); comment share becomes free. The operation checked might be a positioningoperation; last _byte: = top _transferred (used _share) - 1; &_ comment now the share contains data from record base to \f T_ Change of block output. if share_state (used_share) ' free then begin wait_transfer (used_share); comment a positioning operation might be uncompleted; end; &_ start transfer (output); T_ use_share: = used_share mode sh + 1; comment one or more shares behind used_share are busy with transfers; wait_transfer (used_share); comment share state becomes free and the share may be &_ filled from record base to last byte; T_ Start transfer (operation). This procedure works only on used share. It sets a part of the &_ message and sends it. T_ first absolute address of block: = abs address of first shared; segment number of message: = segment count; update segment count for next transfer; operation in message: = operation; comment the mode is left unchanged; send message; &_ share state: = uncompleted transfer; T_ Wait transfer: This procedurewaits for the answer from a transfer or tape positioning, checks it, and performs the standard error actions (error recovery). Finally it may call the block procedure of the &_ zone. In details this works as follws: T_ record_base: = abs address of first _shared (used_share) - 1; last _byte: = abs address of last_shared (used_share) + 1; record_length: = last_byte - record_base; st: = share_state (used_share); if st ' running child process then share_state (used_share): = free; &_ if st ' uncompleted transfer then goto return; \f T_ wait _answer (st); if kind = mangetic tape then begin if some words were transferred then block_count: = block_count + 1; if tape mark sensed and operation is input or output markthen begin file_count: = file_count + 1 ; block_count: = 0 end &_ end; computer logical status word; comment the logical status word is 24 bits describing the error conditions of the transfer; (cf. 3.3.3); T_ top_tranferred (used_share): = if operation = io then 1 + address_of_last_byte_transferred else first_shared (used_share); &_ users_bits: = logical_status - users_bits; Perform standard error actions for all ones in remaining bits (cf. 3.3.3); T_ if a hard error is detected then logical_status: = logical_status + 1; if hard error is detected or users bits ' 0 then begin b: = top_transferred (used_share) - 1 - record _base; let record described the entire shared area from the first shared to last shared; save: = zone_state; blockproc (z,logical_status,b); zone_state: = save; if b 0 or b + record_base ' last_byte then index _alarm; top_transferred (used_share): = b + 1 + record_base; &_ return: end;\f F_ 4 CONTEXT BLOCKS The context concept is a very usefule tool in application pro- grams handling on-line terminal systems, and for programming of coroutines (cf. 5.2). A program that is to serve several terminals does not know from which terminal the input is taken at a given time. This is not known until the input operation is completed, which means that the communication initiative is taken by the terminal operator, and not be the program. Two sequential transactions may thus quite well originate from different terminals, which circumstance makes it difficult to express the processing of a sequence of transactions from the same terminals. In such a program the terminals usually have a set of terminal variables. These variables describes the state, function, type and the like of the operatons performed on the terminal in que- stion. These variables are normally the same for all the termi- nals in the system. Therefore a set of equal defined variables is needed. It should be easy for the application program to access the ter- minal variables for the terminal which input is actually read. The context blocks will solve this problems. A declaration of context block will make the context variables available in a number of incarnations i.e. one pr terminal. When the context block is entered the variables of one of the terminal incarnations is selected for processing. T_ E_x_a_m_p_l_e_. T_r_a_n_s_a_c_t_i_o_n_ _S_e_r_i_e_s_ _f_r_o_m_ _O_n_e_ _D_i_s_p_l_a_y_ _T_e_r_m_i_n_a_l_. &_ In the following example two procedures are assumed to exist: Wait_trans (z, device, ...); and read _file (z, ...). Wait_trans awaits the arrival of a transaction from zone z; by jump-out, the value of device is the identification of the terminal from which the input was received, whereas the zone, z, is positioned to the first character of the transaction. read file positions to the first character of the next field of the transaction procedure by calling wait _trans. The example is now\f as follows: next _transaction: T_ wait_trans (in, device' ...); ... begin context (device, 10 mode); integer array a (1:20); read x,y; integer i,j,k; long 1; &_ ... T_ next_file: read _file (in, ...); read (in,x,y,i,j,k,l,); read string (in,a,1,); ... if more fields' then goto next_file; ... end context block; &_ goto next_transaction; After the call of wait_trans the device number is defined. This points out an incarnation of the context block shown, which has thus one incarnation for each 10 terminals. The example outlines the manner of programming processing of a sequence of transactions from the same terminal. T_4.1 Context block elements. A c_o_n_t_e_x_t_ _b_l_o_c_k_ is an ordinary Algol block. semantically extended with certain properties. A context block is d_e_c_l_a_r_e_d_ as follows: begin context (incarnation, no of incarnations, mode); declaration of simple variables, arrays, etc.' ... &_ end; An ordinary Algol block and a context block differ in the following manners: T_ Immediately after the block "begin" follows the c_o_n_t_e_x_t_ d_e_c_l_a_r_a_t_i_o_n_: context (incarnation, no of incarnations, &_ context mode); where the declaration p_a_r_a_m_e_t_e_r_s_: incarnation, no of\f incarnations, and context mode are all integer expressions, the values of these expressions must be defined at the block entry. T_ Declaration of zones and zone arrays in the head of the &_ block is n_o_t_ permitted. T_ The context declaration is not permitted to appear more &_ than once in the head of the block. The local variables (simple as well as arrays) declared in the head of a context block are also called c_o_n_t_e_x_t_ _v_a_r_i_a_b_l_e_s_. Con- text blocks are permitted anywhere in an Algol program (or exter- nal procedure), where ordinary blocks are permitted. The context declaration specifies the number of incarnations of the context variables, the variable which specify the actual incarnation and the way the context variables should be handled when the context block is entered and left. T_ E_x_a_m_p_l_e_: begin context (i,n,3); * context variables: s,t,x,a, and b*' read x; integer s,t; array a,b(1:m); ... begin real y,z; array p (1:20); zone z (128,1,stderror); &_ ... T_ begin context (j,10,mode); * context variables: s,t1, and 1*' integer s,t1; long 1; ... end; ... end; ... &_ end; In this example all block declarations are permissible construc- tions. Note that the zone declaration in the 2nd block is per- missible, because, it does not appear among context variables. \f T_4.1.1 I_n_c_a_r_n_a_t_i_o_n_s_. The context declaration defines a number of i_n_c_a_r_n_a_t_i_o_n_s_ of the &_ declared block; these incarnations are numbered: 1, 2, 3, ..., no of incarnations'. The declaration parameter incarnation' re- presents such incarnation number. To each execution of a context block is related an incarnation number. If two different execu- tions of a context block have the same incarnation number, they define t_h_e_ _s_a_m_e_ incarnation of the context block. The number of different incarnations is thus equal to the value of the declara- tion parameter: no of incarnations'. T_4.1.2 I_n_c_a_r_n_a_t_i_o_n_ _i_n_t_e_r_v_a_l_. When a context block is executed first time, the actual value of &_ no of incarnations' defines the number of different incarnations of the block. This value will then remain frozen for the rest of the program run, although the value may be changed by the program during the run. The value can be changed using the context mode "new block bit" in a later execution of the context block (cf. 5.1.4). The i_n_c_a_r_n_a_t_i_o_n_ _i_n_t_e_r_v_a_l_: 1 = incarnation = no of in- carnation is then defined. T_4.1.3 C_o_n_t_e_x_t_ _v_a_r_i_a_b_l_e_s_. The context variables are the local variables declared in the head of a context block. Zones cannot be declared as context va- &_ riables. When a context block is declared space for the context variables are reserved number of incarnations times, but only of the incar- nations is accessable at a time. The context variables of the context block are initialized to values depending on the incarnation before the first Algol state- ment in the block is executed. When the block is left (via the last end in the block or by means of a goto statement) the values of its context variables are stored, in such a manner that these variables will be initialized to the stored values in the follow- ing execution of the same incarnation of the block. The declara- tion parameter: context mode' affects the initialization and storing of context variables (cf. 5.1.4). T_4.1.3.1 I_n_i_t_i_a_l_i_z_a_t_i_o_n_ _o_f_ _c_o_n_t_e_x_t_ _v_a_r_i_a_b_l_e_s_. A the entry point of a context block, and before the first Algol statement is executed, &_ the following is done: a) The value of incarnation' is derived, and it is verified\f that it is within the incarnation interval. This value remains unchanged throughout the execution of the contect block, although it may be changed through assignments, etc., (it has thus the same status as value parameters in proce- dures). In this manner an incarnation of the context block is defined. To the incarnation is related just one record, the fields of which are identical with the context variables of the block. To each context block are thus connected no of incarnation' records. Such records are called c_o_n_t_e_x_t_ r_e_c_o_r_d_. b) The context variables of the block are then initialized. If the block incarnation concerned has been executed before, the contents of the relevant context record will be trans- ferred to the context variables of the block. If it is a first time execution of the incarnation concerned, all of the context variables of the block are zero-set (binary 0). This zero-set of the variables is performed when "new incarnation bit" is specified, too. The topical array lengths define at the same time the maximum array lengths, in all subsequent runs of this incarnation, shall be less that or equal to the maximum length. Transfers of values between context records and context variables is done in accordance with the common lexicographis procedure. T_4.1.3.2 S_t_o_r_a_g_e_ _o_f_ _c_o_n_t_e_x_t_ _v_a_r_i_a_b_l_e_s_. At the exit point of a context block (via the last end in the block, an exit operator, or to goto statement) the context variables of the block are stored in &_ the context record belonging to the incarnation, as follows: T_ . Where the incarnation is executed first time this meansthat the corresponding context record does not exist. Such record is now established in the &_ virtual store connected with the program (cf. 5.4). T_ . The values of the context variables of the block are are transferred to the context record belonging &_ to the block and its incarnation. If several context blocks are nested into one another, and if jump-outs occur from several block levels, the process described above will develop for each of the context blocks thus beingleft.\f T_ 4.1.4 C_o_n_t_e_x_t_ _m_o_d_e_. The actual value of context mode' affects the process described under 4.1.2, 4.1.3.1 and 4.1.3.2. The value is regarded as a bit &_ pattern: T_ Read bit: 1 shift 0 The process described under 4.1.3.1b is not exe- cuted unless "read bit" is set. If "read bit" is not set, solely the zero-setting of context vari- &_ ables is performed. T_ Write bit: 1 shift 1 The process described under 4.1.3.2 is not execu- ted unless "write bit" is set. "Write bit" = 0 is therefore usable for references to and searching &_ in context records. T_ Save bit: 1 shift 2 The context record is written into the file consti- tuting the virutal store every time the context &_ block is left (cf. 4.5) T_ New block bit: 1 shift 3 If "new block bit" is set, the function is as if this context block was executed first time; even in the case of context records already having been &_ established, such records are ignored. T_ New incarnation bit: 1 shift 4 If "new incarnation bit" is set, the function is &_ as if this incarnation was executed first time. T_4.2 Coroutines With the context concept are connected two c_o_n_t_e_x_t_ _o_p_e_r_a_t_o_r_s_ permitting that a context block be considered as a coroutine in &_ max. no of incarnations' incarnations. These two operators are: \f T_4.2.1 E_x_i_t_. The exit statement is a goto statement, which leaves a context block in such a manner that the same incarnation can start the execution next time with the Algol statement immediately following &_ the exit call. T_ The syntax is: &_ exit (designation expression') T_ Here it is required that: &_ The statement shall be found in a context block only. T_ The block level at which an exit statement is found &_ shall be identical with the level of the context block. T_ The operator shall be found outside for-statements em- &_ bedded in context blocks. T_ The exit statement has the following effect: The return point (also known as the c_o_n_t_i_n_u_e_ _p_o_i_n_t_), &_ i.e. the logical address for the Algol statement follow- ing immediately after the exit statement, is stored in an anonymous context variable. This variable is know as the c_o_n_t_e_x_t_ _l_a_b_l_e_ belonging to theincarnation. Jumping to the value of designational expression', is done exactly in the same manner as via a gotostate- ment. That is to say the process described under 4.1.3.2 is performed. Sveral exit statement are permitted in the same context block, and each incarnation has its specific c_o_n_t_e_x_t_ _l_a_b_e_l_. T_ The value of a context label is either a continue point or 0 (zero). A continue point can be defined solely by exit. The zero value can be obtained in the following manner: . First time this incarnation is executed. . When read bit h_a_s_ _n_o_t_ _b_e_e_n_ set. . When "new block bit" or "new incarnation bit" is &_ set. \f T_ 4.2.2 C_o_n_t_i_n_u_e_. The context statement continue is a goto statement that jumps to a context label. The syntax is: &_ continue where it is required that the statement is found in a context block only. The block level at which it is found may be different from the context block level (i.e. inner block). The operators has the following effect: . If the context level belonging to the incarnation is zero the operator is blind. This means that the block goes on with the next Algol statement. . If the context lable belonging to the incarnation has the value of a continue point, the block jumps to the point concerned. T_4.2.3 R_e_s_u_m_e_. The standard procedure resume, works as the context statement " continue", except that the context label is cleared (zero-set) after execution. This means the same context label can only be &_ used once. T_4.2.4 E_x_a_m_p_l_e_. next: . . . &_ begin context (i,n,mode); \f T_ array a(1:10); read x,y; . . . continue; . . . exit (next); . . . exit (next); . . . &_ end context block; T_ 4.3 Examples &_ In the following are given a number of examples of context blocks. T_4.3.1 R_e_l_a_t_i_o_n_ _t_o_ _t_h_e_ _o_w_n_ _c_o_n_c_e_p_t_. In the following example: begin context (1,1,3); real x,y; array a(1:n); ... &_ end; the context declaration has the same effect as o_w_n_ declaration of x, y, and a (incl. arrays). The context concept can thus be con- sidered as a generalization of the own concept in the Algol 60 sense. (Cf. waning in example 4.3.3, however). T_4.3.2 C_o_n_t_e_x_t_ _r_e_c_o_r_d_s_. The following example illustrates the interrelation between &_ context variables and context records: \f T_ begin context (i,3,3); pcontext record integer p,q; real x; q belonging to in- array a(1:n);xcarnation no.1 ...a(1) end; pcontext record qbelonging to in- To the context blockxcarnation no.2 shown are connected 3a(1) context records of dif-a(2) ferent lengths. Both read bit and write bit are set. pcontext record qbelonging to in- xcarnation no.3 a(1) a(2) &_a(3) T_ 4.4.3 R_e_c_o_r_d_ _c_l_a_s_s_e_s_. The following is an example of the use of context blocks in con- &_ nection with handling of record classes with appurtenant code: T_ integer procedure next _record (action, record, last_record); &_ integer action, record, last_record; T_ begin integer mode; mode: = case action of (3,1,3,2, ...); begin context (recordd, 1000, mode); array text (1:50); &_ integer version, chars, chain; \f T_ case action of begin comment, only 4 actions shown; * 1*' begin version: = version + 1; chars: = read_string (in,text,1); next _record (3, last_record, record); end; * 2 *' begin write (out,:10'version: :', version,:10':'); outtext (out, chars, text, 1); end; * 3 *' chain: = last_record; * 4 *' * dummy action = clear record *' * 5 *' ... end case; next_record: = chain; end context block; &_ end procedure next _record; The procedure defines a class consisting of 1000 records. A re- cord contains a text file (array text), a version no. (version) and a chain to the next record (chain). The 1000 records consti- tute a number of the following record in chain. T_ The following statements will output the chain of records start- ing with no. first _record' and ending with a record having no successor: next: = first_record; &_ for next: = next_record (2, next, 0) while next ' 0do; T_ The statement: &_ next_record (1,n,m,); will change the contents of record no. (or establish one, if it is not found), and link it to the chain, so that it follows after record no. m, and increase the version number by 1. Note that action no. 1 in the context block calls the procedure recursively. T_ C_a_u_t_i_o_n_: If the procedure is called recursively by t_h_e_ _s_a_m_e_ in- carnation, the relation to own variables referred to in example &_ 5.3.1 will no longer be applicable, because a context record is\f not updated until block-exit. Own variables are in fact always directly updated (in assigments, etc.), whereas the fields in context records are updated in context variables which during the updating, are separated from the record. Only in connection with block-exit these variables are transferred to the record. Recursive calls of context blocks, using the same incarnation, if applied should therefore be subject to caution. T_4.4 Virtual store All context records in the Algol program are kept in a Virtual Store, related with the program. When the program is called, this &_ virtual store is the natural extension of the program file pro- per. Segment transfers to and from this store are integrated into paging algorithm that is used for transfer of program segments. The program is thus, in a way, selfmodifying. The file constituting the program must have a SCOPE permitting writing in the file. The upper limit of the volume of the virtual store (program not included) is 24,000,000 characters (= 24M bytes). T_4.4.1 O_p_e_n_v_i_r_t_u_a_l_. Another backing store file can be connected to the program by means of the procedure: openvirtual (name_of_file); string name_of_file; where name_of_file is the name of the file it is desired to use a &_ virtual store. T_ The function is as follows: The file concerned, with virtual store, is closed, i.e. all own &_ variables, internal descriptions, etc., are transferred into the file. The new file is then connected to the program in a way de- pending on the contents of the appurtenant catalog entry (cf. ref. 6): T_ Content = 0: The file is considered as a file that has n_o_t_ previouslybeen used as a virtual store inconnec- &_ tion with context. "Openvirtual" is to be called\f b_e_f_o_r_e_ executing of any context block. The catalog entry belonging to the file gets content = 9, and any own variables, internal descriptions, etc., are written at the start of the file. Thereafter the file concerned will be the virtual store be- longing to the program. T_ Content = 2: The file is considered as an Algol program having as an extension the virtual store of this program. &_ The own variables and internal descriptions of the calling program are initialized to values that are fetched from this virtual store. It is aprere- quisting hereof that the structures of ownvariabl- es and context blocks are equal in the twoprograms. After "openvirtual" having been called, thecall- ing program will continue with the new virtual store; i.e. context records established by the other programs are now used by the program in cur- rent use. T_ Content = 9: The file is considered as a virtual store that has previously been used by this program (or other programs) in connection with context. The function &_ is, otherwise, the same as under content = 2. N_O_T_E_: "Openvirtual" is not be called within a context block. T_4.5 Program restart It is guaranteed in the implementation that a context record is explicitly written into the file constituting the virtual store, p_r_o_v_i_d_e_d_ that write bit and save bit are set, even if the seg- &_ ments concerned, in which the record is stored, are found in the core store. The virtual store, which is thus currently updated, survives the end of the program run. When the program is later on called in the normal way, it will be in a position to continue with the virtual store in its most recent updated condition, thus restored. If s_a_v_e_ _b_i_t_ _i_s_ _n_o_t_ set, only written into the file is done when the paging algorithm of the runtime system requires segment space in the core store.\f F_ 5 TEXT HANDLING Text or string variables are not implemented in Algol 7, but strings can be parameters in procedure calls (i.e. open). 5.1 Storing of texts. Texts are split up in two groups short texts and long texts (cf. ref. 14). S_h_o_r_t_ _t_e_x_t_s_ are texts with less than 6 characters, they can be stored in a long or a real variable. The last position of the text is a null character. L_o_n_g_ _t_e_x_t_s_ are texts with more than 5 characters, they can be stored in an array usually of type long. All texts are stored with 3 characters pr. word. The standard procedures readall and readstring will store a text string in an array. The operators add, long and real may help to store a text directly in a variable. T_ E_x_a_m_p_l_e_. The following prece of code will cause the variable time to con- &_ tain the text "time", the variable number to contain the text "number" and the array "address" to contain the text "falkoner- alle 1, Copenhagen". T_ begin long time, number long array address (1:5); time: = long :time:'; number: = long :number:' add * r *' 114; * 114 is the value of the letter r, this letter is &_ added to the position of the null character *' \f T_ address (1): = long :Falko:' add * n *' 110; address (2): = long :er al:' add * 1 *' 108; address (3): = long :e 1, :' add * *' 32; address (4): = long :copen:' add * h *' 104; address (5): = long :agen:'; &_ end N_o_t_e_ if the array address had been of type real the standard procedure movestring could be used as follows: movestring (address, 1 :Falkoner alle 1, Copenhagen:'); which will do the same as the 5 assignments above. It is more conve- nient to have the text in a long array as the standard procedure write may print text directly from long arrays. T_5.2 Isolation of text parts. Fields can be used to isolate parts of a text string stored in an &_ array. If a part of a text stored in a long or real variable is wanted moved to another variable this must be done by use of the opera- tors : shift and extract. T_ E_x_a_m_p_l_e_. let the long varibale number contain : ab1234 where ab is a item specification and 1234 is a serial number these two parts of a number is wanted split into two variables an integer &_ item and a long partnr. T_ begin integer item; long partnr; &_ * number is assigned outside this block *' T_ item: = number shift (-24) extract 24; partnr: = number shift 16; * Note, this is a textstring not a number *' &_ end \f T_5.3 Comparison of texts As a text constant - string literal - is referred to with an address in the compiler, a simple compare between long texts is not possible. The texts must be stored in a variable and the &_ variables can then be compared. T_ Example Test that the long partnr is equal to the text :1234:' &_ if the partnr = long :1234:' then....else....; T_ if the text is made with an integer the followingstatement will work if item = long :ab:' shift (-24) extract (24) &_ then....else.... T_ Example A test like the following will never be true t: = long :a12345:'; * long string *' . . . if t = long a12345:' then goto equal; . . &_ . T_ In this case it is necessary to move both text strings to arrays: real array ra1, ra2, (1:n); movestring (ra1, 1, :a12345:'); . . . . &_ . \f T_ movestring (ra2, 1, :a12345:'); . . . if ra1 (1) then begin if ra1(2) = ra2 (2) then goto equal end; . . &_ . \f F_ 6 MATHEMATICAL PROCEDURES In this chapter is shown a list and a short description of the avaliable mathematical procedures within the ALGOL 7 system. See further descriptions in chapter 13. The standard RC 8000 software mathematical and statistical package ref. 15. will contain additional procedure. arcsin Is the mathematical function arcsin(r). arctan Is the mathematical function arctan(r). arg Is the argument in radians of the complex number (u,v). cos Is the mathematicalfunction cos(r). exp Is the exponential function e**r. ln Is the natural logarithm function ln(r). base e. random Computers two pseudo-random numbers a real integer and an integer. sgn Yields -1 or 1 according to the sign of the parameter. sign As sgn but = 0 if parameter is 0. sin Is the mathematical function sin(r). sinh Is the mathematical function sinh(r). sqrt Is the squar root function sqrt(r). \f F_ 7 OPERATORS AND STANDARD PROCEDURES WORKING AS OPERATORS In this chapter there will be a list and a short description of the avaliable operators defined in the language. Furthermore standard procedures with related functions are listed. See further description in chapter 11. T_7.1 Arithmetic operators The arithmetric operators. + plus - minus * multiply / divide // integer divide ** exponentiation &_ have their usual meaning. T_ Operators performing arithmetic operations. abs This operator yields the absolute value ofinteger, &_ long or real expressions. T_ entire This operator transfers a real expression tothe largest &_ integer not greater than the expression. T_ mod This operator yields the remainder corresponding to an &_ integer division. T_ 7.1.1 T_r_a_n_s_f_e_r_ _f_u_n_c_t_i_o_n_s_. The transfer functions will cause a type change of the operand. Assignment of a variable to an expression of different type, will &_ cause a type transfer. Note this is not working for type boolean. T_ extend This operator converts an integer expression intoaty- &_ pe long. T_ extract This pattern operator extracts a number of theright- &_ most bits the result is of type integer. \f T_ long This operator changes the type of a string orreal &_ expression into type long. T_ real This operator changes the type of a string orlong &_ expression into type real. T_ round This operator rounds the value of a real orlong ex- &_ pression to the nearest integer. T_ string This operator changes type of a real or longinto type &_ string. T_7.2 Logical operators The logical or boolean operators and logical or logical or implication == equivalence -, not &_ have their usual meaning. Standard procedures performing logical operations. exor Is the logical function exclusive or. T_ logand Is the logical function and. More types can beused as &_ operands. T_ logor Is the logical function or. More types can beused as &_ operands. T_7.3 Pattern operators These operators can be used in both arithmetic and boolean expressions. add This dyadic pattern operator will perform abinary addi- tion.The type of the left hand operands will yield the &_ type of the result. \f T_ extract This pattern operator extracts a number of theright- &_ most bits the result is of type integer. T_ shift This pattern operator will perform a logical shift of the &_ left hand operand. T_7.4 Relational operators The relational operators less than = less than or equal = equal '= greater than or equal ' greater than ' not equal &_ have their usual meaning.\f F_ 8 STANDARD IDENTIFIERS AND PROCEDURES This chapter will contain a short description of the standard identifiers and procedures not mentioned in the previuos chapters. Further description in chapter 11. The elements are listed after functions. 8.1 Run time survey Procedures to control the program at run time. systime Systime gives access to the real time clock inthe mo- nitor and to the CPU time used by the job. trap A standard procedure changing the traplabel inan ALGOL block. The traplabel defines the program returnpoint in case of an error detcted in ALGOLS check routine. alarm- cause an error detected in ALGOLS check routine is signalled in this variable. trapmode This bitpattern may cause the output of an alarm cause error message to be ignored. T_ errorbits The value defines the "end program condition" when &_ returning to the File Processor. T_ overflows This integer variable controls the actions on floating &_ point overflow. T_ underflow This integer variable controls the action in floating &_ point underflows. T_ blocks- read This integer variable counts the number ofsegments &_ transferred from the backing storage T_ blocksout This integer variable counts the number of segments &_ transferred from virtual store to the backing store. \f T_8.2 Lock of segments in core lock Transfers a number of program segments to core and lock them i.e. they will not be overwritten by other program &_ segments. T_ locked Transfers the segment numbers of the segments locked &_ for the moment to an integer array. T_ progmode This standard variable specified whether the current &_ segment should be locked or not. T_8.3 Miscellaneous increase This procedure will automatically increase the argument &_ with 1. T_ move- &_ string Copies a text string to an array. T_ tofrom The procedure will copy a set of data from one array or &_ zone record to another. T_8.4 Procedures for system communication monitor This procedure is the ALGOL equivalent to the monitor procedures. system This procedure gives access to various system and job &_ parameters. T_ 8.5 Program to program communication. fpmode Test a fpmode bit from the program. setfp- &_ mode Sets or removes a fp mode bit from the program. \f F_ 9 ALGOL 7 CREATED IN OPERATING SYSTEM 9.1 Primitive level zone procedures. When you use zones on the primitivelevel, you can change the va- lues of the zone descriptor and the share descriptors in nearly any way. In this way you may handle the peripheral devices in non-standard ways. You may also use the full principle of sharing buffer area with other processes to creater child processes and let the algol program work as an operating system to these child processes. The following standard procedures are known as the primitive le- vel zone procedures: getzone6 Tranfers the contents of a zone descriptor toan array. setzone6 Transfers the contents of an array to a zonedescriptor. getshare6 Transfers the contents of a share descriptor ina zone to an array. setshare6 Transfers the contents of an arrray to a sharedescrip- tor in the zone. initzones May change the buffersize and number of sharesof each zone in a zone array. T_ monitor This procedure is the algol equivalent to allfunctions of the monitor. It looks up, changes,creates orremo- ves catalog entries, it starts and stops communication with peripheral devices it creates starts, stops, and &_ removes child processes, etc. blockproc Calls the block procedure of a given zone. T_ check Checks a transfer to or from a document in theway used &_ by the high level zone procedures. T_9.2 Document driver You may let the algol program control a document to which other &_ processes in the computer send output. \f T_ 1. Use entry 20 (or entry 24) in "monitor" to waitfor messages sent to the algol program. The sender of the &_ message assumes that the algol program is a document. T_ 2. Copy the block of information described in themessage into a zone buffer area by means of"system", entry 5, &_ or use entry 70 in "monitor" T_ 3. Send the answer to the message by means of entry 22 in &_ "monitor". 4. Output the block of information to the document. Under special circumstances, for instance when the algol program is the operating system for these other processes, it is possible to control input and output from a document, even without copying the block of information from one buffer to another. That is possible because both the sender process and the buffer for the document may be parts of the same zone buffer area. T_9.3 Operating system You may let the algol program create, start, stop and, remove a &_ child process in this way. T_ 1. Use entry 56 in "monitor" to create the child process in a zone buffer area. It may be necessary to use entry 72 in "monitor" to set your own catalog base in order &_ to define the base of the process name. T_ 2. Include the process as a user of some peripheral de- vices by means of entry 12 in "monitor", and give the process access to the backing store by &_ means of entry 78 in "monitor". T_ 3. Initialise the child process area with a suitablebi- nary program, for example the File Processor code which may be read directly from the backing storage area, fp &_ into the zone buffer area. T_ 4. Set the machine registers of the child process by means &_ of entry 62 in "monitor". See ref. 6, if FP is used. \f T_ 5. Start the child process by means of entry 58 in"moni- tor". Now, the child process starts executing thein- &_ structions of the binary program. We say that it runs in parallel with the other processes in the computer (including your algol program). If FP is executivesys- tem the user base is communicated so that this is the catalog base at which the child process was started. FP will as its first action set the catalog base tostan- dard. T_ 6. When you want to stop the child, use entry 60 in"moni- &_ tor". T_ 7. Wait for the completion of the stop by means of entry 18 or 24 in "monitor". Now, all modifications of the child process area are ceased, and you may for instance &_ store the area on the backing storage, use the area for something else, later reestablish the process area and start the child process again by means of entry 58 in "monitor" so that is continues as if nothing hashappend. T_ 8. When youwant to get rid of the child and withdraw its resources, you use entry 64 of "monitor". Remember the &_ process must be stopped first. In order to make an operating system which handles several child processes, serves as a driver for peripheral devices, and communi- cates with the operator, you have to mix the principles of 10.1, 10.2, and 10.3. In this mixing, entry 24 of "monitor" is very useful to help the program serving the first arriving event first. An event is here the arrival of a message or an answer, or the completion of a stop. \f F_ 10 PROGRAM TRANSLATION AND EXECUTION This chapter describes the structure of ALGOL programs, the ALGOL compiler and the execution system. 10.1 Translatable ALGOL structures Only programs and external procedures can be translated. T_10.1.1 P_r_o_g_r_a_m_ _s_t_r_u_c_t_u_r_e_. An ALGOL program is a block. The syntax of a program is: begin D1; --- DM; S1; . . . . SN; &_ end Where S1,..., SN are ALGOL statements, which therefore may be blocks (cf. ref. 14.), and D1, --- DM are declarations. T_10.1.2 E_x_t_e_r_n_a_l_ _p_r_o_c_e_d_u_r_e_s_ _s_t_r_u_c_t_u_r_e_. An external procedure in Algol is a separately translated proce- dure, including in the catalog. It can be used as a standard &_ procedure for later translated programs and externals. T_ External procedure syntax: external procedure declaration' ; &_ end Where procedure declaration' is a declaration of a procedure, (cf. ref. 14). \f T_ 10.1.3 E_x_a_m_p_l_e_s_. Example 1: external procedure heading (line, page, data); value data; integer line, page; long array date; * data contains yyyy.mm.dd *' begin &_ boolean nl, sp, ff; T_ nl: = false add 10; * new line *' sp: = false add 32; * space *' ff: = false add 12; * form feed *' write (out, ff, 1, date, sp, 20, : A/S REGNECENTRALEN : ' sp, 20, bddd', page, nl, 3); page: = page + 1; line: = 4; end; &_ end T_ Example 2: This is an example of an ALGOL 7 program. It reads some records and write a message depending on record type. The external &_ procedure from Example 1 is used. T_ begin * declarations *' boolean nl; &_ integer line, page, maxlines, stop _element; T_ long array data (1:2); long array field rec_name; integer field record_type, rec_ident, update_type; zone zin (128, 1, stderror); procedure insert; .... procedure delete; .... procedure update; .... * initialization *' nl: = false add 10; &_ maxlines: = 50; \f T_ stop _element: = 999999; page: = 1; line: = maxlines; rec_name: = 8; record type: = 4; rec_ident: = 5; update_type: = 6; data (1): = long :1978.:' add * 0 *' 48; data (2): = long :4.05:'; * program start *' * open the zone to the area :records:' *' &_ open (zin, 4 : records:' 0); T_repeat invar (zin); if line ' = maxlines then heading (line, page, date); else line: = line + 1 &_ case zin.record_type of T_ begin begin * record-type = 1:insert *' write (out, nl, 1, :insert record: : ', zin.rec_ident, sp, 3, zin.rec_name); * call insert procedure *' insertion; &_ end * record_type = 1 *' T_ begin * record_type = 2:deletion *' write (out, nl, 1, :delete record: :', zin.rec_ident, sp, 3, zin.rec_name); * call delete procedure *' delete; &_ end * record_type = 2 *' T_ begin * record_type = 3: update *' write (out, nl,1, :update record: :'; zin.rec_ident, sp, 3, zin.rec_name, sp, 3, zin.update_type); * call update procedure *' update; end * record_type = 3 *' end case; until zin.record_type = stop_element; close (zin, true); &_ end program; \f T_ 10.2 Translation The compiler works in your job process and you start the transla- tion by means of an FP-command specifying the source text i.e., the compilation variants, and the file where the resulting object &_ program should end (see app.B). The result of the translation is either a complete, self-contai- ned, binary program or a binary external procedure. In the first case, the program may be executed as described in 8.3; in the se- cond case, the procedure may be used as a standard procedure in later translations. If you permanent the program or the procedure (give it scope user or scope project), you can use it in later jobs. T_10.2.1 T_h_e_ _c_o_m_p_i_l_e_r_. The compiler occupies about 13000 instructions divided into 12 passes, either on backing storage or on magnetic tape. In the first case, it may be used for simultaneous translation in seve- &_ ral job processes. The 12 passes of the compiler perform the following tasks: Pass 0 is a common administration routine. Pass 1 to 8 perform the trans- lation into binary code by means of 8 scans of the source program. The intermediate program text is stored in the place later occu- pied by the binary program. Pass 9 rearranges the binary program, insert references to standard procedures, and includes the run time administrative sytstem (RS). When an external procedure is translated. pass 9 only rearranges the binary procedure and RS is not included. Pass 11 does not exist, but a pass 12 may make crossreferences of where the different names are used. T_10.2.2. C_a_l_l_ _o_f_ _c_o_m_p_i_l_e_r_. 10.2.2.1 S_y_n_t_a_x_. Here is shown the File Processor commands used in connection with &_ call of the compiler. T_ Further description of the File Processor is given in ref. 6. s' source' bs file' = algol &_ s' modifier' \f T_ source' :: = text file' bossline index spill list . yes message no survey on list. off * copy .copy sources' 1 yes modifier' :: =stop. no last pass' no xref. yes connections' .intervals' 1 1 .sortarea' 0 0 yes details. no first pass'.last pass' first pass'.last pass' &_ .first line'.last line' T_ copysources' :: = name' all* connections' :: = declare assign use 1 intervals' :: = first line'.last line' 1 .first name line'.last name line' &_0 \f T_ first line' last line' first name line':: = integer' last name line' first pass' last pass' &_ sortarea' :: = name' T_10.2.2.2 S_e_m_a_n_t_i_c_s_. bs file' A file descriptor describing a backing storage area. It is used as working area for the compiler, and the ob- ject code ends here and is described in the file descrip- &_ tor. If bs file' does not exist an area is created, preferably on drum. If the job has no drum resources, the area is created on the disc where the job has maxi- mum temporary resources. After a possible creation, the area is made as large as possible leaving 1 slice on the device. An existing area is never cut, however. In system 2 a creation of an area is only made if bs file' is an empty note. In this case a working area of 100 segments is created. If the translation is success- ful, bs file' will contain a complete object program or an external procedure (a standard procedure). In system 3, and in system 2 with translation into an empty note, the area is cut to the segments necessary. T_ source' The list of sources specifies the input files to the compiler. If no source is specified, the compiler reads &_ the source from current input. T_ modifier'The list of modifiers is scanned from left to right. Each modifier changes the variables that controls the compilation. When the scan starts, the variables are &_ initialised to the value explained below. T_ bosslines Implies that listing or messages besides the linenumber will state the BOSS linenumber &_ The initial setting is bosslines.no. T_index.no Code for dynamis check of subscripts against bounds is &_ omitted. The initial setting is index.no. \f T_ spill.yes Dynamic check of integer overflow is performed. Even if the external procedures referenced were translated with &_ spill.no, a partial check of integer overflow is performed when they are executed. The initial setting is spill.no. T_ list.yes The entire source text is listed on current output with line numbers in front of each line. See further de- scription in 10.2.2.4. The initial setting is list.no. T_ list.no The following source text is listed in current output with line numbers in front of each line. See further description in 10.2.2.4. The initial setting is &_ list.off. T_ mes- sage.no Normally, the textpreceding the first begin and all comments denoted by message in the source text are listed with the line numbers. With "message.no" this &_ listing is omitted. The initial setting is message.yes. T_ sur- vey.yes A summary is printed on current output after the completion of each pass of the translation. The meaning of the summary is explained in ref. 10. The initial &_ setting is survey.no. T_ stop.last pass' The translation is terminated after the pass specified. Stop.yes terminates the translation after the last &_ pass. The translation is regarded as unsuccessful. The following is useful in case of large programs and/or slow machines. If only a listing and a xreference is wanted the translation can be stopped after second pass stop.2. If error messages are wanted stop after pass 6. The initial setting is stop.no. T_ xref.yes A crossreference list (xref-list) is printed on current output after a possible listing. The xref-list is a listing of the identifiers used in the program. The\f list contains an occurrence list for each identifier. Further description in 10.2.2.5. The initial setting is &_ xref.no. T_ details.yes only used for compiler debugging Intermediate output from all the passes of the compiler is printed on current output. The output may be re- &_ stricted to an interval of pass numbers and to an inter- val of line numbers. The output from pass 8 (for in- stance caused by "details.8.8") consists of a list of those line numbers which correspond to a segment boun- dary in the object program. The initial setting is details.no. T_ copy.copy sources' This parameter will make it possible to copy the spe- cified copy sources' into the main source text. Further &_ description in 10.2.2.3. T_ 10.2.2.3 T_h_e_ _a_l_g_o_l_ _a_n_d_ _c_o_p_y_ _c_o_n_c_e_p_t_. The parameter * copy copysources' &_1 make it possible to copy the specified copysource' into the main source text. The source text will specify when the copy takes place. T_ The following compiler directive is used. on 1copysources' 1 algol list. copy. off 0integer'0 &_ copysource' :: = name' T_ In case of &_ copy.copysource' The content of the specified copysource will be copied to the place of the compiler directive. \f T_ In case of &_ copy.integer' The integer parameter is matched with the copy parameters of the call which are numbered 1, 2, .... . The matched copysource is copied to the place of the compiler directive. The delimiter algol is treated as message, i.e. it is listed un- less the parameter message.no is specified, and the delimiter must follow either begin or semicolon, further is must be termi- nated by semicolon. Description of the modifier "list" cf. 10.2.2.4. T_ Example &_ See example 3 of 10.2.2.4 T_ 10.2.2.4 D_e_t_a_i_l_s_ _o_n_ _l_i_s_t_i_n_g_. There are three levels in a possible listing &_ of an algol program. T_ 1. yes list. no list.yes the total source text is listed. list.no nothing is listed. yes &_ The last (right most) list. nomodifier in the call is used. T_ 2. on list. off yes &_ This modifier is blind if list. nois used. list.on: will cause the listing of the following source texts, until a possible list.off is met. list.off: will cause no listing of the following source texts, until a possible list.on is met. \f T_ Default value depends on the File processor mode bit yes listing. &_no T_ list &_ ing.yes everything is listed until a list.off is met. T_ list- &_ ing.no nothing is listed until a list.on is met. The initial setting is listing.no. T_ 3. This specification is written in the program on1copysource' 1 algol list. copy. off0 integer' 0 &_ description of copy cf. 10.2.2.3. If a list parameter is n_o_t_ followed by a copysource, it means that the listmode of the actual source is changed. If a listparameteris followed by a copysource, the list parame- ter relates only to the copysource. If no listparameter is specified for the copysource, the copy- source will be listed in case the actual source is listed. A listparameter in front of copy.integer' will be blind. The list mode specified in the call wil be used. In case the text is not listed, and the algol call does not spe- cify message.no, message is given for end medium. T_ Example 1 p = algol text1 text2 &_ nothing is listed T_ p = algol text 1 text2 list.yes everything is listed \f T_ Example 2 p = algol text1 list.no text2 If fpmode listing.no text2 is listed &_ if fpmode listing.yes text1 and text2 is listed. T_ Example 3 prog = algol list.no copy.t1.t2 list.off copy.t3 t0 bossline.yes source 1= t0 copysource 1 =t1 copysource 2 = t2 &_ copysource 3 = t3 T_ File Content Note t0: begin listed comment 0; not listed algol list.no; not listed, but message comment 1; listed algol list.off; listed commen 2; not listed algol copy.1 *t1*'; not listed, but message comment 3; not listed algol list.on copy.t4; not listed, but message comment 4; not listed algol copy.2 *t2*'; not listed, but message algol copy.3 *t3*'; not listed, but message comment 5; not listed end not listed t1: comment copysource no. 1; listed t2: comment copysource no. 2; listed t3: comment copysource no. 3; not listed &_ t4: comment copysource t4; listed T_ Output from example 3 &_ prog = algol list.on copy.t1.t2 list.off copy.t3 t0 bossline.yes \f T_ t0 2401.75 14.36 10 1 begin 1. line 30 3 algol list.on; 40 4 comment 1; 50 5 algol list.off; line 70 7 algol copy.1 *t1*'; t12401.75 14.33 10 7 comment copysource no.1; &_ 20 8 T_ t0 line909 algol list.on copy.t4; t42401.7514.33 109 comment copysource t4; &_ 2010 T_ t0 line11011algol copy.2 *t2*'; t2 2401.7514.33 1011comment copysource no.2; &_ 20 12 T_ t0 line 12012 algol copy.3 *t3*'; t32401.7514.33 line2013 end medium t0 &_ algol end 9 T_ 10.2.2.5 D_e_t_a_i_l_s_ _o_n_ _x_r_e_f_e_r_e_n_c_e_. The xreference list (xref-list) is a list- ing of the identifiers used in the program. The list contains an &_ occurence list for each identifier listing the linenumbers in which it is represented. These linenumbers are split up in 3 dif- ferent groups each group starts with a group letter in the listing. T_ D: meaning the identifier is found in a declaration or specifi- &_ cation. T_ A: meaning the identifier occurred in front of :=. A switch &_ declaration is indicated with a D. U: meaning all other occurrences. The xref-list is made with no regard to the block structure or the program. The identifier names are sorted according to the collat- ing sequence \f T_ abcdefghijklmnopqrstuvwxyzæøå ABCDEFGHIJKLMNOPQRSTUVWXYZ@ØÅ &_ 0123456789 T_ C_o_n_n_e_c_t_i_o_n_s_ _a_n_d_ _i_n_t_e_r_v_a_l_s_. The modifier xref.yes will list all groups of occurrences. But it &_ is possible to select serten groups of occurrences, to specify which parts of the program and which part of the identifiers the xref-list should contain. T_ Select occurrence group: connections declare assign use The occurrence-list will only contain the specified &_ groups D, A, U respectively. T_ all This connection is equivalent to the connectionsdeclar- ed.asssign.use. &_ xref.yes is equivalent to xref.all. T_ Select program and identifier interval: first line'.last line' The occurrence.lists will only contain line numbers belonging to the specified interval. If not specified, &_ the line interval will include the entire program. T_ first name line'.last name line' Only those identifier names, that appear in thespeci- fied part of the program, are listed in thexref-list. &_ This parameter restricts the set ofidentifier names in the xref-list. If not specified, the name line interval will include the entire program. T_ Examples cf. 10.2.2.6. The s_o_r_t_a_r_e_a_ is usually created by the compiler. This area is used for sorting the occurrences of the identifiers. In system 3 a part of the area used for compilation of the program is taken. &_ In system 2 a sort area of 100 segments is created. 1 segment can hold approximately 100 occurrences. For very large programs it may be necessary to create a specific sort area. The name of this area may then be specified at the end of the list of modifica- tions to the xref-request. \f T_ 10.2.2.6 E_x_a_m_p_l_e_s_. o lp &_ sl1 = algol list.yes s12 s13 T_ The final program is stored in sl1. The source is taken from the file described in s followed by the file s13. The entire source text and all error messages appear on lp. &_ sl1 = algol list.yes stop.1 The source text is read from current input and listed on current output. The translation stops after pass 1, i.e. just after the listing. If xref was wanted too stop.2 should be specified. The following examples shown the calles of the compiler with xref-modification, and the corresponding output. The underlined lines are the commands. T_ a_l_g_o_l_ _t_e_x_t_ _l_i_s_t_._y_e_s_ _x_r_e_f_._y_e_s_ begin integer i, j; 2 procedure pip (a,b); 3 value a; 4 real a; integer array b; 5 b (a): = a; 6 6 switch b: = A; 7 integer array ia (1:2); 8 8 goto b (increase (1)); 9 A: pip (i, ia); 10 end &_ a FF character is printed here' T_ a D: 4 U: 2 5 b D: 4 6 A: 5 U: 2 8 i D: 1 U: 9 ia D: 7 U: 9 increase U: 8 j D: 1 \f pip D: 2 U: 9 A D: 9 U: 6 &_ algol end 11 T_ a_l_g_o_l_ _t_e_x_t_ _x_r_e_f_._a_s_s_i_g_n_ begin a FF character is printed here' a b A: 5 i ia increase j pip A &_ algol end 11 T_ A_l_g_o_l_ _t_e_x_t_ _x_r_e_f_._a_l_l_._2_._1_0_._1_._1_ begin a FF character is printed here' i U: 9 j &_ algol end 11 T_ a_l_g_o_l_ _t_e_x_t_ _x_r_e_f_._a_l_l_._4_._7_._6_._6_ begin a FF character is printed here' b D: 4 6 A: 5 A U: 6 &_ algol end 11 T_ 10.2.3 S_t_o_r_a_g_e_ _r_e_q_u_i_r_e_m_e_n_t_s_,_ _e_t_c_._ The compiler requires a job with a core area of 12 800 bytes with 4 message buffers and with 6 area processes (4 if current input &_ and output are not backing storage). The minimum core area may cause the translation to terminate with the alarm "stack". This is due to the limited size of the table identifiers in pass 2 and 5, and the table of labels, caseele- ments, and procedures in pass 8. A greater core area will remedy the problem: just 1000 bytes more give room for about 250 identi- fiers. \f T_ 10.2.4 S_p_e_e_d_,_ _l_e_n_g_t_h_ _o_f_ _o_b_j_e_c_t_ _c_o_d_e_. After basic time of 2 seconds (compiler on drum), the total trans- lation speed is about 1000 characters/second or 500 final instruc- &_ tions per second for an average program. The final program consists of the code corresponding to the sour- ce text, plus 12 segments for the running system (RS), plus the length of the standard procedures incorporated. The length of the code corresponding to the source text is about 1.5 the length of the source text. T_10.2.5 E_r_r_o_r_ _c_h_e_c_k_i_n_g_. The compiler performs extensive syntax and type checking, but a &_ few errors may pass undetected as described in 10.3.6.3. Except for some rare errors concerning communication with the surrounding system, no error can stop the compilation, and most of the errors will be detected in the first translation. Suitab- le mechanisms are included to prevent one error from generating several error messages. Whenever the translation has worked to the end, the program may be executed until the first point where a syntax error was detec- ted or until the first point where an undeclared or double decla- red identifier is used. The run is then terminated with the mes- sage "syntax line...". T_10.2.6 M_e_s_s_a_g_e_ _f_r_o_m_ _t_h_e_ _c_o_m_p_i_l_e_r_. Four formats of error messages exist: 1. pass number' line line number'.operand number' text' (e.g. 6. line 12.6 type) 2. pass number' text'(e.g. 8. program too big) 3. pass 9' name' text'(e.g. 9. write program toobig) &_ 4. *** algol text' (e.g. ***algol param) Below, the error messages are sorted according to text'. The messages are classified as: T_ (alarm) The translation is terminated immediately as anunsuc- &_ cessful execution. The program cannot beexecuted. T_ (warning) The message has no effect. The erroneous construction &_ is skipped. T_ Nothing The message allows the translation to continue and the program to be executed until the erroneous construction\f is met or until an undeclared or doubly declared &_ identifier is used. T_10.2.6.1 L_i_n_e_ _a_n_d_ _o_p_e_r_a_n_d_ _n_u_m_b_e_r_s_. The lines of the program are counted 1, 2, 3, ... where line 1 contains the first "begin" or "external". &_ Only lines containing visible (printing) symbols are counted. The operands within a line are counted 1 2, 3, ... An operand is an identifier, a constant, or a string. The print of the program where an error of form 1 is detected, is specified by the line number and the number of operands passed within the line, for example: T_ source line 12: if a = 1.5 b (i): = real :cd:';else operand numbers: 1 2 3 4 5 &_ error message: 6. line 12.5 termination T_10.2.6.2 A_l_p_h_a_b_e_t_i_c_ _l_i_s_t_ _o_f_ _e_r_r_o_r_ _t_e_x_t_s_. algol end i' This is not an error message. The algol program has been translated. The object code occupies i' &_ segments. The ok-bit (see ref. 6) is set to yes. The warning-bit is set to no if no error messages have occurred, otherwise it is set to yes. T_ algol sorry i'An alarm has occurred. The ok-bit is set to no (see ref.6). The integer i shows the number of &_ segments the compiler has attempted to make. T_ block proc (pass 6). The integer procedure of a zone is &_ declared wrongly. blocks (alarm, pass 5). More than 62 nested blocks. T_ call (pass 6). A procedure call has a wrong number of &_ parameters. T_ catalog (alarm, pass 2). Trouble with reading the backing storage catalog. May be caused by too few are &_ claims. (alaram, pass 9). Trouble with catalog lookup, for instance because a standard identifier has dis- appeared. The result of the lookup is printed.\f catalog 3: may be caused by an old translated external procedure or a code procedure containing procedure references which has be- en changed. Remedy re-translate the external procedure. catalog 4: entry not in compress library area, base trouble. T_ name' unknown name' not textfile(content key' 0) name'.integer' not magtape name' illegal kind name' connect error (hard error) name' not text name' hard error device status name' &_ cause' T_ char or illegal (warning, pass 6). Illegal character or wrong use of a graphic. comment (pass 6). comment or message not after begin or &_ semicolon. T_ constant (pass 6). Syntactical error in a constant num- ber. context zone (pass 6). A zone is declared among context va- &_ riables. T_ context label (pass 6). The exit operator is at an erroneous block level or in a for-statement located within a context block. T_ + declaration (pass 6). Identifier declared twice or more ti- mes in the same block. The message appears at &_ each place of declaration. T_ delimiter (pass6 ). Impossible sequence of delimiters. - delimiter (pass 6). Two operands follow each other. entry (alarm, pass 9). A standard identifier has been &_ changed in the catalog during pass 9. T_ error at source (alarm, pass 1). Trouble with input from the source file specified. ext param (alarm, pass 5). More than 7 parameters in an &_ external procedure. T_ external (pass 6). External-end does not surround a pro- cedure declaration. for label (pass 6). Label which labels a statement inside &_ a for statement is used outside. T_ head (pass 6). Impossible procedure head. The line\f &_ number points to the first symbol of the procedure body. kind (alarm, pass 9). A standard identifier has been changed in the catalog since the translation started. This is most likely to happen in connection with an external procedure which was translated assuming a certain standard identifier, but now this identifier has been changed in the catalog. T_ layout (pass 6). Impossible layout. local (pass 6). Local variable used in array or zone declara- tion. &_ not text (pass 1). A source text contains a character ' 127. T_ obejct area (alarm, ***algol). The file specified for the object code does not exist, cannot be used, or cannot be crea- &_ ted (empty note, see B.1.2) T_ operand (pass 6). Operand appears in wrong context or is miss- ing. - operand (pass 6). Operand missing at end of construction. overflow (pass 7). Integer or real overflow during evaluation of &_ a constant expression. T_ param (warning, ***algol). Illegal parameter in the FP-com- mand. The parameter is ignored. pass trouble (alarm, pass 1-12). The job area is too small to load &_ the next pass or the next pass has been destroyed. T_ program err 1 pass 7 (alarm, pass 7). An undetected error in the algol com- piler. program too big (alarm, pass 1-12). The backing storage area specified &_ cannot hold the object code. T_ relative (alarm, pass 9). An un-debugged code procedure is ass- embled. The procedure contains a relative reference outsiode the interval 0 = r = 510. right par improper (pass 6). The construction ) letter string' is not &_ followed by :(. T_ sorry i' (alram, ***algol). The translation is unsuccessful, because of an alarm or because the FP-parameter "stop" &_ was used. See also "algol sorry i'". T_ source ex- hausted (pass 1). The source text is exhausted before the pro- gram was complete. A clue to the missing termination is printed in comment, in comment string, in string. ends &_ missing is output.\f T_ sort area (alarm, pass 12). Cross references could not be made be- cause the sort area could not be created or connected. stack (alarm, pass 2-12). The job area is too short for the &_ translation tables (see 10.2.3). T_ sub- scripts (pass 6). A subscripts variable has a wrong number of subscripts. termina- tion (pass 6). Parantheses or bracket like structures do not &_ match. T_ text (warning, pass 6). Illegal constituent of text string, usually : or digits in '. type (pass 6). The declaration or type of an operand is not &_ in accordancewith its use. T_ unde- clared (pass 6). The identifier is not declared. Lateroccur- rences of the identifier in the same block will not &_ print a message. T_ variables (alarm, pass 2). The program contains more than 3484 distinct names of identifiers. (alarm, pass 5). More than 1951 bytes of simple vari- ables and simple zones in one block, or more than 2047 bytes of owns in entire source text, or more than 2047 &_ labels and procedures in entire source text. T_ works (alarm, pass 7). More than 96 bytes of working loca- tions in one block. xref too big (alarm, pass 12). The area used for something is not &_ large enough. T_ zone (pass 6). Wrong number of subscripts after zone or zone array. zone de- claration (pass 6). Wrong number of commas in zone array declara- &_ tion. T_10.2.7 A_s_s_e_m_b_l_y_,_ _i_n_d_e_x_,_ _s_p_i_l_l_. Pass 9 performs the assembly of standard procedures into the main &_ program and if these standard procedures reference other standard procedures the assembly continues resursively. All standard iden- tifiers must exist in the catalog at this stage. At run time, subscript check will be omitted during the execution of all program parts compiled with index.no. All standard proce- dures may be thought of as compiler with index.yes \f If the main program is compiled with spill.yes, a partial check of integer overflow is performed in procedures compiled with spill.no. If the main program is compiled with spill.no, integer overflow at multiplication will still be detected in subroutines complied with spill.yes. None of the standard procedures can cause an integer overflow. T_10.3 Execution A binary object program is executed in the job process and start- ed by means of an FP-command as described in 10.3.2. The program &_ must at that moment exist in a backing storage area. T_10.3.1 S_e_g_m_e_n_t_a_t_i_o_n_. The object consist of independent program segments of 512 half- words. Whenever the running program, demands a program segment &_ which is not in the core store, it is transferred from the back- ing storage possibly replacing another segment in the core store. The number of segments held in the core store is encreased gradu- ally until the limit posed by the variables is met. If more vari- ables are declared, some segmenmts will be released from the core store. This scheme works satisfactorily as long as the program segments invloved in the current part of the algorithm are kept in the co- re store. Under these circumstances a jump to another segment is perform in 7 microseconds, while a jump within one segment is per- formed in 3 microseconds. When the number of variables is encreased so that the active seg- ments cannot stay in core, the program can still run, but a jump to another segment will often cause a transfer from the backing storage resulting in a jump of 18 000 microseconds. The standard identifier blocksread shows how these situations may be detected. You will see from this that it is very important to avoid crowd- ing the job area with variables. As a rule, you should have room for at least 8 segments in the core store, corresponding to 4000 bytes. As further aid, the compiler may print a list of line numbers cor- responding to the segment boundaries in the object program. The list is printed if the compiler is called with details cf. 10.2.2.2.\f T_ 10.3.2 C_a_l_l_ _o_f_ _o_b_j_e_c_t_ _p_r_o_g_r_a_m_. 10.3.2.1 S_y_n_t_a_x_ 1empty' name' = bs file' s' source' anything' 0s' integer' s' param' anything' integer' integer' param' :: =. &_ name'name' T_10.3.2.2 S_e_m_a_n_t_i_c_s_. name' = Has no direct significance. However, name' may be &_ accessed from the running program by means of "system". T_ bs file' A file decriptor describing a backing storage area which contains an object program from an algol translation. empty' The program is called with "in" as current input. source' Specifies a text file to be used as "in". Current input &_ is not touched in this case. T_ integer' FP is clared from the process. The program cannot use "in" and "out" and it cannot print error messages. When the program terminates, it sends a parent message &_ corresponding to a "break" and specifying the cause of the termination. On the other hand, 3000-4000 bytes more are available in this way. This possibility is mainly intended for operating systems, which "never" are terminated, never use "in" and "out", and work satisfactorily in a very short core area. T_ param' Works as empty'. The command parameters param' and anything' may be accessed from the running program by means of "system" and interpreted in any way. &_ anything'See param'.l T_10.3.2.3 E_x_a_m_p_l_e_s_. s = algol s12 s s13 &_ s Translates the source program in s12. Executes it once with input from s13 and once with input from current input. \f T_ 10.3.3 S_t_o_r_a_g_e_ _r_e_q_u_i_r_e_m_e_n_t_s_. &_ During program execution, the job area is organized in this way: T_ Length in halfwords:Contents 1536 File Processor 3072 RS Depends on program Own variables for entire program. 2*L Segment table, L = total number of program segments. minimum: 1024 reasonable: 4096 Room for program segments currently in core store. Room for variables, arrays, zones. &_ 1024 Buffers for in and out. When the program is called with the parameter 0 (cf. 10.3.2.2), the space occupied by File Processor and buffers for in and out becomes 16 halfwords. The space occupied by variables at any moment of the execution is the sum of the reservations made at entires to all the blocks and procedure bodies which are active. Lengths of core store are usually given in halfwords (one half- word = 12 bits), sometimes in w_o_r_d_s_ or double words (4 halfwords = 2 words = 1 double word). The reservations made at block entry be derived from the declara- tions of the block as follows: T_ Quantity: Number of halfwords reserved: Simple boolean variable, field variable, simple integer variable2 Simple long variable, &_ simple real variable 4 T_ Array segment 2* (number of array identifiers + 1 + number of subscripts) + space for total number of array elements. Array element, boolean 1 Array element, integer 2 \f Array element, real or long 4 Zone 50 + 24*number ofshares + 4*buf- &_ ferlength. T_ Zone array 2 + space for all the zones. Working locations Depends on structure of program, usually about 10 for each block. Block, procedure body 2*number of statically surrounding blocks + (if normal block then 4 elseif type procedure then 14 else 10); Parameter 8 if the actual parameter is &_ constant, 4 otherwise. T_10.3.4 M_e_s_s_a_g_e_ _b_u_f_f_e_r_s_,_ _a_r_e_a_ _p_r_o_c_e_s_s_e_s_,_ _e_t_c_._ The job process must have been created with a sufficient number &_ of message buffers and area processes. The number of message buf- fers occupied at any moment during the execution of the program is derived as follows: T_ Reserved for RS 1 Each n-shared zone used for high level input/ouput ("in" and "out" count as 1-shared zones) n-1 Each zone busy with position- ing a magnetic tape (then it is not used for input/output) 1 Zones used on primitive level, each share describing an un- &_ completed transfer. 1 The number of area processes occupied at any moment is 2 + the number of backing storage areas opened for input/output. Remember to include possible _area processes used by "in" and "out". T_10.3.5 E_x_e_c_u_t_i_o_n_ _t_i_m_e_s_. The times given below represent the total physical times in mi- &_ croseconds of algorithmic constituents on the RC 8000/45 compu- ter. The total time to execute a program part is the sum of the time for the consituents. The time are only valid under the fol- lowing assumptions: T_ 1. The time for transfer of program segments from the backing &_ storage is neglibile (cf. 10.3.1). 2. The program is not waiting for peripheral devices (cf. 4.2.4.2). 3. The time slice interval is 25.6 milliseconds or more(see ref.1).\f T_ 4. The program is the only internal process running in the com- &_ puter. T_10.3.5.1 O_p_e_r_a_n_d_ _r_e_f_e_r_e_n_c_e_s_. Reference to local identifiers and constants Reference to non-local identifiers (variable, zone, or &_ array) T_ An array parameter is referenced as if it was declared locally in the outermost block of the &_ procedure. T_ If a sequence of identifiers from the same non-local block are referenced without intervening references to other non-local blocks, the first reference costs 4 microseconds and the later one &_ usually 0. T_ Reference to name parameter, actual is simple Reference to name parameter, actual is composite &_ Reference to own variable. T_10.3.5.2 C_o_n_s_t_a_n_t_ _s_u_b_e_x_p_r_s_s_i_o_n_s_. Operations are performed during the trans- lation and thus do not contribute to the execution time in the following cases: +-*/shift extend working on constant operands. conversion of an integer constant to a real constant, or vice versa. &_ real string long working on all operands. The result of an operation performed during translation is again treated as a constant. Examples: T_ A (-2 + 6/5) is reduced to A (-1) 1 + o.5 -0.25is reduced to 1.25 p + 1/2 - 1/4 is only reduced to p + 0.5 - 0.25 &_ becausep + 0.5 must be evaluated first. T_10.3.5.3 S_a_v_i_n_g_ _i_n_t_e_r_m_e_d_i_a_t_e_ _r_e_s_u_l_t_s_. By the term "composite expression" we shall mean any expression involving operations to be executed at run time. Examples: A (2)b + 1 a shift 8 pr (i,i,:ab:') are composite 11.5 real:ab:' 5 shift 20 are not com- &_ posite. During the evaluation of expressions, one intermediate result is\f saved in the following cases: T_ +, *, and, or, all relations, shift, extract when working on 2 composite expressions. -, /, //, mod when the right hand expression is composite. add whne both operands are composite or when the &_ left hand operand is a composite real. T_ The saving of one intermediate result takes integer or boolean value saved......................5 &_ real value saved....................................8 T_ Examples: A (i) + B (i) + C(i) uses 2 savings (+, +) ab and bd uses 1 saving (and) ab = c and t uses 0 savings a + b + 2 - e uses 0 savings &_ a - f* (g + h) uses 1 saving (-) T_10.3.5.4 O_p_e_r_a_t_o_r_s_. integer + integer, integer-integer..................3 long + long, long-long..............................4 real + real, real-real.............................14 and, or.............................................2.5 integer*integer, spill.no...........................8.5 integer*integer, spill.yes.........................13.5 integer//integer, integer mod integer..............14.5 real*real..........................................34 real/real..........................................26 long*long.........................................139.5 &_ long//long, long mod long.........................153.5 T_ p extract constant'................................2.5 p extract i.....................................7 + i/2 real add i, long add i, string add i................4 integer add i, boolean add i........................3 real shift i, integer shift i...........3.5 + abs (i)/2 &_ boolean shift i..................................... T_ entire real........................................22.5 round real..........................................9 round long......................................... 1.5 extend integer......................................2 \f abs real...........................................35.5 abs integer.........................................3 &_ abs long...........................................10 T_ subscripted variable with check against bounds, one subscript......................................19.5 subscripted variable without check against bounds, one subscript......................................10.5 &_ subscripted variable for each extra subscript add T_ integer: = integer..................................5 integer: = long, spill.yes.........................11.5 integer: = long, spill.no...........................6.5 integer: = real....................................14 long: = integer....................................10 long: = long........................................8 long: = real.......................................60.5 real: = integer.................................... real: = long.......................................76.5 &_ real: = long........................................8 T_ goto local label....................................7 for i: = 1 step constant' until n do, each loop...15 ij, other connections..............................6.5 rq, other connections.............................18.5 &_ case i of..........................................17.5 T_ call of procedure with empty body, no parameters..115 parameter, for each value parameter add............26 &_ parameter, for each name parameter add..............6.5 T_10.3.5.5 E_x_e_c_u_t_i_o_n_ _t_i_m_e_s_ _f_o_r_ _c_e_r_t_a_i_n_ _s_t_a_n_d_a_r_d_ _p_r_o_c_e_d_u_r_e_s_. arcsin............................................613.5 arctan............................................354 arg...............................................687 cos...............................................628.5 exor..............................................228.5 exp...............................................564.5 ln................................................485.5 logand............................................226 logor.............................................226 random............................................176.5 sgn,sign..........................................154.5 sin...............................................625.5\f sinh..............................................649 sqrt..............................................274.5 &_ tofrom.....................318 + 7.8*double words moved T_ E_x_a_m_p_l_e_: We show the computation of the time for the following loop: for i: = n step -1 until j + 1 do 15 (for do) 3 (j + 1) if ia (i) = 3 and19.5 (ia (i)) 6.5 (= 3) 7.5 (save, and) ra (i + 1)'1 then 22.5 (ra(i + 1), +) 18.5 ('1) (5-) _ _6_._5_ _(if then) 99 p: = p + ra (i + 1); 22.5 (ra(i + 1), +) 14 (real +) __8_ _ _ _(p: =) &_ 143.5 The result is that the loop takes about 143 microseconds when the last statement is executed, 99 otherwise. T_10.3.6 M_e_s_s_a_g_e_s_ _f_r_o_m_ _r_u_n_n_i_n_g_ _p_r_o_g_r_a_m_. 10.3.6.1 I_n_i_t_i_a_l_ _a_l_a_r_m_. Before the first begin of the program is entered, the alarm &_ ***program name' call may appear. It is due to either: the program is not on backing storage, the source is not a text, or the job process is too short. T_10.3.6.2 N_o_r_m_a_l_ _f_o_r_m_. When the program is called with program' integer', &_ a run time alarm appears as a parent message (cf. 10.3.2.2). In the normal case, a run time alarm terminates the program with a message of the form: T_ cause' alarm address' called from alarm address' &_ called from ... A list of the possible alarm causes is given in 10.3.6.4. The\f program is terminated unsuccessfully except after the message "end". An alarm address shows where the error occurred. If this is a procedure or a name parameter, a line specifying the call address or the point where the name parameter was referenced is printed too. The process is repeated if several calls or references were active at the time of the alarm. If more than 10 calls or referen- ces are active, the process stops after having printed the last "called from", but before the last alarm address is printed. T_ An alarm address may take 3 forms: 1. name of standard procedure or a set of standard procedures. 2. line first line' - last line' &_ 3. ext first line' - last line' Form 2 specifies a line interval in the source text of the main program. Form 3 specifies a line interval in an external algol procedure. The accuracy of a line interval corresponds to about 16 instructions of generated code. The first line number may sometimes be 1 too great if the line is not terminated with a delimiter. The line number of a procedure call points to the end of the paranthesis. The following alarm addresses from standard procedures are used: T_ char input(read, readall, readchar, readstring, repeatchar, intable) check (All high level zone procedures,use the check &_ procedure) checkspec (The standard error actions in the check procedure) ch/outvar (changevar, checkvar, outvar) invar (invar) T_ algolcheck (The subprocedure in the check procedure calling the user"s block procedure. May also be the code &_ performing certain operations on long) monitor (monitor) open (open) outchar (write, outvar, outtext, outinteger) position (close, getposition, setposition) recprocs (changerec, inrec, outrec, swoprec) recproc6 (chnegerec6, inrec6, outrec6, swoprec6) stand.fct.1 (exp, ln, sinh) \f stand.fct.2 (arctan, arg, sin,cos) stand.fct.3 (arcsin, sqrt) alaram segm1 (The code giving up the run of the algol program) system (system, increase) system10 (system, entries 10 and 11) systime (systime, logand, logor, exor) tofrom (tofrom) zone declar (The code that declares zones and zone arrays) zone share (getzone, getshare, setzone, setshare) zone share6 (getzone6, getshare6, setzone6, setshare6) T_10.3.6.3 U_n_d_e_t_e_c_t_e_d_ _e_r_r_o_r_s_. If all parts of a program have been translated with index.yes and spill.yes, the following errors may still pass &_ undetected: T_ 1. Parameters in the call of a procedure which is a formal parameter do not match the declaration of the corresponding &_ actual procedure. Any reaction may result. T_ 2. Number of subscripts of a formal array do not match the num- ber of subscripts of the actual array. Wrong results may be &_ produced, but the control of the program remains intact. T_ 3. A subscript may exceed the bounds in an array declaration with more dimensions as long as the lexicographical index is &_ inside its bounds. The control of the program remains intact. T_ 4. The program may write into the backing storage area occupied by the program itself. Any reaction may result. 5. Undebugged standard procedures in machine language may cause &_ any reaction. The monitor and the operating system will usually limit the con- sequences of errors in such a way that no other job or process in the computer can be harmed (see ref. 1). T_10.3.6.4 A_l_p_h_a_b_e_t_i_c_ _l_i_s_t_ _o_f_ _a_l_a_r_m_ _c_a_u_s_e_s_. The error messages below cover only the standard procedures described in this manual. The set of messages is expected to grow in step with the growth of the stand- &_ ard procedure library. arcsin 0 Illegal argument to arcsin. T_ block i' Too long record in call of changerec6, inrec6, &_ outrec6 or swoprec6. The block length is shown. break i' An internal interrupt is detected. i' is the cause of the interrupt, usually meaning: 0 index error in program translated with index.no 6 too many message buffers used (10.3.4). \f 8 program breaked by the parent, often because it is looping endlessly. In this case, the alarm address should be taken with some reservation. The break alarm will often be called as a result of the undetected errors described in 10.3.6.3. bufsize i' Init-zones the original total buffer size for za is exceeded by allocating space for za(i), or buf- fersize (i) = 0, or shares (i) = 0. case i' Case index outside range. The index is shown, The line number points to "of". connect Open virtual no. of owns in calling program dif- ferent from no. of owns defined in the file. context Open virtual. The procedure is called inside a context block. create Open virtual. A file is attempted created as vir- tual store after some context blocks in the cal- ling program have been executed. c.array Actual array length in a context block exceeds the maximum. c.expand The file containing the virtual store can not be extended, i.e. there is no space available for further context records. c.incarn Incarnation no. not positive, or exceeds no. of incarnations. end i' The program has passed the final end. The integer printed after end shows the value of the standard identifier "blocksread" as the program terminated. This is not an error message. entry i' Illegal function code or entry conditions in a call of monitor, system, or systime. The function codeshown. exp 0 Illegal argument to exp. field i' Field reference outside bounds. The illegal half- word address is shown. givup i' Printed by stderror. The number of bytes transfer- red is shown. The File Processor prints the name of the document and the logical status word. index i' Subscript outside bounds. The lexicographical index is shown. This message occurs also for sub- scripted zones or record variables. The character input procedures call the index alarm if they can- not assign a single result to their return parame- ters or if a character outside the current alpha- bet is met. The procedure "check" calls theindex alarm if a block procedure specifies a too long\f block. In this case, the value of the parameter "b" is shown. integer Integer overflow. kind i' Illegal modekind in call of open. The kind is shown. length i' Negative record length in call of inrec6, outrec6, or swoprec6. The length is shown. ln 0 Argument to ln is = 0. kind i' Illegal modekind in call of open. The kind is shown. movesize i' Tofrom is called with the number of halfwords to be moved 0. The size is shown. movefld i' Tofrom is called with an array where the halfword numbered 1 or the halfword numbered size does not exist. oddfield i' Toform was called with an array where the word boundaries are not between an even numbered half- word and its odd numberes successor. The wrong parameter number (1 or 2) is shown. param Wrong type or kind of a parameter. T_ param n' lock Means that an inconsistent set of parameters is used, or a segmentnumber specified = 5 or ' num- ber of segments in program. The value of n' de- signates the type of the parameter causing the er- ror: 1. integer 2. label 3. procedure 4. parameter list exhausted &_ 5. type not integer or label. reclen i' Changevar or outvar was called with a length word 0 or 0 length word 4. real Floating point overflow or underflow. segment A text seems to be a long string but could not be found as a text constant. share i' An illegal share number is specified. The share number is shown. T_ sh.state i' A share in an illegal state is specified. The sha- re state is shown. ' message buffer address for an uncompleted transfer or a stopping child process. 0-process description address for a running child process. =0 for a free share &_ =1 for a ready share. sinh 0 Illegal argument to sinh.\f stack i' The number of variables exceeds the capacity of the job area, or an array or a zone is declared with a nonpositive number of elements. The number of halfwords in the reservation of storage is shown. syntax The program is terminated at a point where an error was detected during the translation. value i' The contents of ia (i) in setzone (z, ia) or setshare (z, ia, sh) is illegal. The value is shown. z.kind Swoprec is not used on a backing storage area. z.length i' The buffer length is too short. The actual buffer length is shown. z.state i' A high level zone procedure is called in an illegal zone state. The actual state is shown. Init-zones is called with zonestate not equal to 4. T_ zone state = 0 positioned after open 1 after character reading 2 after repeatchar. 3after character printing 4 after declaration 5 after record input 6 after record output. 7 after record swop. 8 after open on magnetic tape. &_ '_ 9 after some special procedure. \f Diskette 27 81.09.24 1 HEAD.0 29 781.26 59 781.56 89 781.86 30 781.27 60 781.57 90 781.87 1 SIDE111.0 31 781.28 61 781.58 91 781.88 2 SIDE112.0 32 781.29 62 781.59 92 781.89 3 781.0 33 781.30 63 781.60 93 781.90 4 781.1 34 781.31 64 781.61 94 781.91 5 781.2 35 781.32 65 781.62 95 781.92 6 781.3 36 781.33 66 781.63 96 781.93 7 781.4 37 781.34 67 781.64 97 781.94 8 781.5 38 781.35 68 781.65 98 781.95 9 781.6 39 781.36 69 781.66 99 781.96 10 781.7 40 781.37 70 781.67 100 781.97 11 781.8 41 781.38 71 781.68 101 781.98 12 781.9 42 781.39 72 781.69 102 781.99 13 781.10 43 781.40 73 781.70 103 781.100 14 781.11 44 781.41 74 781.71 104 781.101 15 781.12 45 781.42 75 781.72 105 781.102 16 781.13 46 781.43 76 781.73 106 781.103 17 781.14 47 781.44 77 781.74 107 781.104 18 781.15 48 781.45 78 781.75 108 781.105 19 781.16 49 781.46 79 781.76 109 781.106 20 781.17 50 781.47 80 781.77 110 781.107 21 781.18 51 781.48 81 781.78 111 781.108 22 781.19 52 781.49 82 781.79 23 781.20 53 781.50 83 781.80 1 INDEX.0 24 781.21 54 781.51 84 781.81 25 781.22 55 781.52 85 781.82 26 781.23 56 781.53 86 781.83 27 781.24 57 781.54 87 781.84 28 781.25 58 781.55 88 781.85\f «eof»