Trailing-Edge
-
PDP-10 Archives
-
decuslib10-04
-
43,50323/gnosis.lst
There are no other files named gnosis.lst in the archive.
DECsystem 10 ALGOL-60, Version 7(717) 02-JUN-78 05:16:08
Command string: G,G/C=G.ALG
LINK!
1 000000 1 COMMENT -------------------------------------------------
2 000000 2
3 000000 3 GNOSIS provides a simple CAI authoring language which makes
4 000000 4 it easy for any teacher with a basic understanding of
5 000000 5 "programmed" textbooks to develop computerized tutorials for
6 000000 6 his students. Although material already written in such a
7 000000 7 format can be transformed virtually as-is by GNOSIS into a
8 000000 8 form suitable for computer delivery, the teacher would
9 000000 9 normally be writing his own "script." This script, because
10 000000 10 it simulates the dialogue one might overhear if that teacher
11 000000 11 were tutoring a student in private, can be made to "come to
12 000000 12 life" on a computer terminal by the addition of a few simple
13 000000 13 GNOSIS command words. The computer driven tutorial is, in
14 000000 14 reality, a compiled version of the ALGOL program GNOSIS
15 000000 15 writes in response to the script prepared by the teacher.
16 000000 16
17 000000 17 As in the ordinary tutoring environment, the student's path
18 000000 18 through the material can be guided in various and subtle
19 000000 19 ways, e.g., by routing students having difficulty to
20 000000 20 supplementary material. The program qua tutor can also
21 000000 21 react in helpful ways to a variety of anticipated false
22 000000 22 answers to questions, e.g., by giving appropriate diagnostic
23 000000 23 commentary or hints, followed by a repetition of the wrongly
24 000000 24 answered question. Although unanticipated responses can be
25 000000 25 saved for inclusion in the teacher reports (along with
26 000000 26 statistics on individual student performance), the data
27 000000 27 which are generated exist for the sake of improving the
28 000000 28 lesson pedagogically. This is in keeping with the general
29 000000 29 design philosophy that GNOSIS should be a TEACHING system
30 000000 30 rather than a TESTING system.
31 000000 31
32 000000 32 If anyone makes any additions or modifications to the GNOSIS
33 000000 33 translator, then please send a copy either to (1)Jacob
34 000000 34 Palme, Research Institute of National Defense, S-10450
35 000000 35 Stockholm 80, Sweden, or (2)Dr. Walter Maner, Department of
36 000000 36 Philosophy, Old Dominion University, Norfolk, Virginia
37 000000 37 23508, USA. With your cooperation, we can prepare more
38 000000 38 powerful versions of GNOSIS for distribution to GNOSIS users
39 000000 39 like yourself. THANK YOU.
40 000000 40
41 000000 41
42 000000 42 ALPHABETICAL LIST OF GLOBAL VARIABLES
43 000000 43 =====================================
44 000000 44
45 000000 45 NAME TYPE CONTENT
46 000000 46 -------------------------------------------------------------------
47 000000 47
48 000000 48 A INTEGER A
49 000000 49 ALLNEUTRAL BOOLEAN TRUE IF ALL ANSWER PATTERNS SO FAR TO THIS
50 000000 50 . QUESTION HAVE BEEN NEUTRAL. THIS INFLUENCES
51 000000 51 . THE WORDING OF MESSAGES FOR UNEXPECTED STUDENT
52 000000 52 . ANSWERS.
53 000000 53 ANSWER STRING BUFFER FOR INPUT LINES OF THE LESSON. ONE LINE
54 000000 54 . AT A TIME IS STORED IN THIS BUFFER.
55 000000 55 ANSWERLENGTH INTEGER LENGTH OF LESSON LINE.
56 000000 56 BELL BOOLEAN TRUE IF LESSON CONTAINS A %BELL COMMAND
57 000000 57 . RINGS BELL ON STUDENT'S TERMINAL WHEN INPUT
58 000000 58 . FROM HIM IS REQUIRED.
59 000000 59 BLANK INTEGER
60 000000 60 CARRIAGERETURN INTEGER 13
61 000000 61 CHARVALUE INTEGER TEMPORARY STORAGE OF INTEGRAL VALUE OF ONE
62 000000 62 . CHARACTER IN A STRING WHICH IS
63 000000 63 . BEING OUTPUTTED.
64 000000 64 COLON INTEGER :
65 000000 65 CONTROLCHAR INTEGER BINARY VALUE OF THE FIRST CHARACTER IN THE
66 000000 66 . LESSON. THIS CHARACTER BEGINS ALL COMMAND
67 000000 67 . LINES. IT IS USUALLY = "%".
68 000000 68 CONTROLINLINE BOOLEAN CONTROLCHAR INSIDE INPUT LINE.
69 000000 69 CONTROLSTART STRING SUBSTRING OF CHARACTER 2-4 OF COMMAND.
70 000000 70 COPYRIGHT STRING LESSON AUTHOR'S COPYRIGHT NOTICE
71 000000 71 DISK BOOLEAN TRUE IF LESSON CONTAINS A %DISK COMMAND.
72 000000 72 . SENDS TEACHER REPORT TO A DISK FILE
73 000000 73 . WITH THE NAME "LESSONNAME.DTA".
74 000000 74 DOT INTEGER .
75 000000 75 DOUBLEQUOTE INTEGER "
76 000000 76 EMPTY BOOLEAN TRUE IF TEACHER ANSWER PATTERN IS EMPTY.
77 000000 77 EQUALSIGN INTEGER =
78 000000 78 ERRLINES INTEGER COUNTER OF LINES TO BE PRINTED AFTER ERROR.
79 000000 79 EXCLAMATION INTEGER !
80 000000 80 EXTRA BOOLEAN ARE EXTRA WORDS PERMITTED IN STUDENT ANSWERS?
81 000000 81 FIRSTRIGHT STRING FIRST RIGHT ANSWER TO A QUESTION.
82 000000 82 FORMFEED INTEGER 12
83 000000 83 IFSET BOOLEAN ARRAY IF ON GNOSIS-TIME SWITCH IS ACTIVE.
84 000000 84 IFVAL BOOLEAN ARRAY VALUE OF IF ON GNOSIS-TIME SWITCH.
85 000000 85 INFILE STRING FILENAME WITH EXTENSION OF INPUT FILE.
86 000000 86 JUSTIFY BOOLEAN TRUE IF TEXT BLOCKS ARE TO BE RIGHT
87 000000 87 . JUSTIFIED ("RAGGED RIGHT") AT COLUMN 72
88 000000 88 KEEP BOOLEAN KEEP TEACHER REPORTS AT COMPUTING CENTER,
89 000000 89 . DO NOT ASK THE STUDENT TO SEND THEM IN.
90 000000 90 LAB STRING USED FOR GENERATION OF LABELS IN THE PRODUCED
91 000000 91 LABELCOUNT INTEGER COUNTER OF NUMBER OF MAINLABS.
92 000000 92 LACK BOOLEAN TRUE AFTER A %LACK COMMAND.
93 000000 93 LANGUAGE INTEGER LANGUAGE = 1 -> LESSON IS IN ENGLISH,
94 000000 94 . (ENGLISH IS THE DEFAULT)
95 000000 95 . LANGUAGE = 2 -> LESSON IS IN SWEDISH.
96 000000 96 LCAA INTEGER } = BINARY VALUE OF SWEDISH LETTER
97 000000 97 LCAE INTEGER {
98 000000 98 LCE INTEGER e
99 000000 99 LCOE INTEGER `
100 000000 100 LEFTSQUARE INTEGER [
101 000000 101 LESSONNAME STRING FILENAME OF THE LESSON WITH EXTENSION REMOVED.
102 000000 102 . THIS NAME WITH THE EXTENSION ".ALG" IS THE
103 000000 103 . NAME OF THE OUTPUT FILE.
104 000000 104 LINEFEED INTEGER 10 = BINARY VALUE OF ASCII CHARACTER
105 000000 105 LINENUMBER STRING LINENUMBER FOR LINENUMBERED FILES.
106 000000 106 LINENUMBERED BOOLEAN THE GNOSIS TEXT IS A LINE-NUMBERED FILE.
107 000000 107 LOCK BOOLEAN TRUE IF LESSON CONTAINS A %LOCK COMMAND.
108 000000 108 . DISABLES BACKSTEPPING AND SKIPPING
109 000000 109 . PROVISIONS OF GNOSIS.
110 000000 110 MAINLAB STRING USED FOR GENERATION OF LABELS IN THE PRODUCED
111 000000 111 . ALGOL PROGRAM, TO BE USED FOR BACKSTEPPING.
112 000000 112 NAME BOOLEAN TRUE IF LESSON CONTAINS A %NAME COMMAND.
113 000000 113 . STUDENT'S FIRST NAME USED FOR I/O AND
114 000000 114 . HIS FULL NAME GOES TO TEACHER REPORT (IF ANY).
115 000000 115 NEUTRAL BOOLEAN TRUE FOR A %NEUTRAL COMMAND.
116 000000 116 OPENED BOOLEAN TRUE WHEN THE OUTPUT FILE FROM GNOSIS
117 000000 117 . HAS BEEN OPENED AND THE PREAMBLE OF THE
118 000000 118 . ALGOL TRANSLATION OF THE LESSON HAS BEEN
119 000000 119 . OUTPUTTED.
120 000000 120 ORDER BOOLEAN MUST STUDENT ANSWER WORDS BE IN ORDER?
121 000000 121 POS INTEGER POSITION IN THE TEXT OF THE LESSON LINE.
122 000000 122 POS2 INTEGER POSITION IN THE TEXT OF THE LESSON LINE.
123 000000 123 PREVIOUSLAB STRING LABEL FOR PREVIOUS TEXT OR QUESTION. GNOSIS
124 000000 124 . WRITES INTO LESSON A GOTO STATEMENT WITH THIS
125 000000 125 . LABEL AS ARGUMENT SO STUDENT MAY BACK UP IN
126 000000 126 . THE LESSON ONE ITEM AT A TIME.
127 000000 127 PUT BOOLEAN TRUE IF THE LESSON CONTAINED A %TEACHER COMMAND,
128 000000 128 . SO THAT TEACHER REPORTS ARE TO BE GENERATED.
129 000000 129 QCOUNT INTEGER COUNTER OF THE NUMBER OF QUESTIONS
130 000000 130 . (%QUESTION COMMANDS) IN THE LESSON.
131 000000 131 QUESTION STRING QUESTION IDENTIFICATION WHICH IS OUTPUT
132 000000 132 . ON THE TEACHER REPORTS TO SHOW HIM WHICH
133 000000 133 . QUESTION GAVE UNEXPECTED ANSWERS.
134 000000 134 . ALGOL PROGRAM, TO BE USED INSIDE QUESTIONS.
135 000000 135 RIGHT BOOLEAN TRUE FOR A %RIGHT COMMAND, FALSE FOR
136 000000 136 . A %WRONG COMMAND.
137 000000 137 RIGHTFOUND BOOLEAN TRUE IF ANY RIGHT ANSWER HAS BEEN FOUND
138 000000 138 . TO THE CURRENT OR PREVIOUS QUESTION.
139 000000 139 RIGHTSQUARE INTEGER ]
140 000000 140 SAME STRING LABEL TO JUMP TO IF A %SAME COMMAND IS
141 000000 141 . ENCOUNTERD.
142 000000 142 SAVEANLEN INTEGER SAVED VALUE OF ANSWERLENGTH.
143 000000 143 SEMICOLON INTEGER ; COMMENT
144 000000 144 SGNOSIS BOOLEAN DO NOT PRINT INITIAL MESSAGE TELLING THE
145 000000 145 . STUDENT THAT HE IS RUNNING GNOSIS.
146 000000 146 SKIP BOOLEAN SKIP INPUT LINES BECAUSE OF GNOSIS-TIME
147 000000 147 . SWITCH SETTINGS.
148 000000 148 SWITCHCOUNT INTEGER NUMBER OF GNOSIS-TIME SWITCHES.
149 000000 149 SWITCHNAME STRING ARRAY NAME OF ALL GNOSIS-TIME SWITCHES.
150 000000 150 SWITCHNUMBER INTEGER INDEX OF ONE GNOSIS-TIME SWITCH.
151 000000 151 SWITCHVAL BOOLEAN ARRAY SETTING OF GNOSIS-TIME SWITCH VALUES.
152 000000 152 SWITCHWORD STRING NAME OF ONE GNOSIS-TIME SWITCH.
153 000000 153 TEACHER STRING NAME AND ADDRESS OF THE TEACHER.
154 000000 154 TEMP TEMPORARY STRING.
155 000000 155 TEXCOUNT INTEGER COUNTER OF THE NUMBER OF TEXT SEGMENTS
156 000000 156 . (%TEXT COMMANDS) IN THE LESSON
157 000000 157 UCAA INTEGER $
158 000000 158 UCAE INTEGER #
159 000000 159 UCE INTEGER E
160 000000 160 UCOE INTEGER @
161 000000 161 UPARROW INTEGER ^
162 000000 162 WORD STRING ONE WORD FROM A TEACHER ANSWER PATTERN.
163 000000 163 WPOS INTEGER POSITION IN THE TEXT OF THE LESSON LINE.
164 000000 164 Z INTEGER Z
165 000000 165 ZEROPRINTED BOOLEAN A TEST FOR EMPTY STUDENT ANSWERS
166 000000 166 . HAS BEEN PRINTED FOR THIS QUESTION.
167 000000 167 -------------------------------------------------------------------
168 000000 168 ;
169 000000 169
170 000000 170
171 000000 171
172 000000 172
173 000000 173
174 000000 174
175 000000 175
176 000000 176
177 000004 B1 177 BEGIN
178 000004 178
179 000005 179 INTEGER
180 000005 180 controlchar, language, carriagereturn, linefeed, tabchar, blank, exclamation,
181 000005 181 answerlength, saveanlen, pos, pos2, wpos, charvalue, doublequote,
182 000005 182 a, z, formfeed, dot, qcount, texcount, semicolon, colon, equalsign, errlines, labelcount,
183 000005 183 linecount, leftsquare, rightsquare, switchcount, switchnumber, rightmargin,
184 000005 184 lcaa, lcae, lcoe, ucaa, ucae, ucoe, lce, uce;
185 000005 185
186 000005 186 STRING
187 000005 187 controlstart, word, lessonname, copyright, teacher, answer, firstright, previouslab,
188 000005 188 nextlesson, temp, question, lab, mainlab, same, infile, switchword, linenumber;
189 000005 189
190 000005 190 STRING ARRAY
191 000007 191 switchname[1:9];
192 000007 192
193 000014 193 BOOLEAN
194 000014 194 extra, empty, order, right, neutral, allneutral, opened, put, sgnosis,
195 000014 195 nocontrolc, transferlesson, justify, controlinline, bell, name, lock, disk,
196 000014 196 lack, zeroprinted, keep, rightfound, skip, linenumbered;
197 000014 197
198 000014 198 BOOLEAN ARRAY
199 000034 199 switchval[1:9], ifset[0:9], ifval[1:9];
200 000034 200
201 000034 201
202 000041 202 FORWARD PROCEDURE makemainlab, getcontrolstart, upcase, pastoperation;
203 000041 203
204 000041 204
205 000041 205
206 000041 206 FORWARD STRING PROCEDURE getword;
207 000041 207
208 000041 208
209 000041 209
210 000045 210 PROCEDURE delet(s);
211 000051 211 STRING s;
212 000051 212 COMMENT -------------------------------------------------
213 000051 213 Delet will delete non-empty STRINGs, but will not (like
214 000051 214 Delete) cause an error if an attempt is made to delete an
215 000051 215 empty string.
216 000051 216 -----------------------------------------------------------;
217 000057 217 IF Length(s) > 0 THEN Delete(s);
218 000057 218
219 000057 219
220 000057 220
221 000067 221 PROCEDURE errmess(toggle, message);
222 000073 222 BOOLEAN toggle;
223 000073 223 VALUE message;
224 000073 224 STRING message;
225 000073 225 COMMENT -------------------------------------------------
226 000073 226 This procedure causes a GNOSIS error (or warning) message to
227 000073 227 be displayed. The troublesome line and the next three lines
228 000073 228 of the lesson are displayed on the terminal. If the souce
229 000073 229 file contains line numbers, these will be displayed as
230 000073 230 reference points. If it does not, then the APPROXIMATE line
231 000073 231 numbers which are generated by the 'getline' PROCEDURE will
232 000073 232 be displayed. The identification number of the GNOSIS error
233 000073 233 message corresponds to the line in THIS file (i.e.,
234 000073 234 GNOSIS.ALG) from which this error procedure was called.
235 000073 235 This is useful for debugging purposes since same kind of
236 000073 236 error can occur at many different points (e.g., errors in
237 000073 237 precedence).
238 000073 238 -----------------------------------------------------------;
239 000075 B2 239 BEGIN
240 000075 240 Selectoutput(0);
241 000100 241 IF errlines = 0 THEN
242 000103 B3 242 BEGIN
243 000103 243 IF linenumbered THEN
244 000105 B4 244 BEGIN
245 000105 245 temp:= Copy(linenumber);
246 000116 246 Write(temp);
247 000121 247 delet(temp)
248 000121 E4 248 END
249 000124 249 ELSE
250 000125 B5 250 BEGIN
251 000125 251 Write("LINE ");
252 000135 252 Print(linecount - 1, 5);
253 000141 253 Write(": ")
254 000144 E5 254 END;
255 000144 255 temp:= Copy(answer,1,answerlength);
256 000157 256 Write(temp);
257 000162 257 Newline;
258 000167 258 IF answerlength > 0 THEN delet(temp)
259 000172 E3 259 END;
260 000172 260 errlines:= 3;
261 000202 261 IF toggle THEN Write("****** ERROR Message No. ") ELSE Write("****** WARNING Message No. ");
262 000205 262 Write(message);
263 000210 263 Newline;
264 000212 264 Selectoutput(2)
265 000215 E2 265 END of PR*CEDURE errmess;
266 000215 266
267 000215 267
268 000215 268
269 000216 269 PROCEDURE getline;
270 000216 270 COMMENT -------------------------------------------------
271 000216 271 'Getline' reads in a line of the lesson script. Any
272 000216 272 sequence of characters (including the null sequence) which
273 000216 273 is terminated by a <CR><LF> or <FF> constitutes a line. A
274 000216 274 <FF> immediately after a <LF> will not cause any blank line.
275 000216 275
276 000216 276 This procedure ignores any line beginning with a '!' in
277 000216 277 column one, thus conforming to DEC comment conventions.
278 000216 278 -----------------------------------------------------------;
279 000226 B6 279 BEGIN
280 000227 280 INTEGER s, t, i;
281 000227 281 BOOLEAN taberror;
282 000227 282
283 000227 283 getnextline:
284 000241 284 linecount:= linecount+1;
285 000244 285 taberror:= FALSE;
286 000245 286 IF linenumbered THEN
287 000247 B7 287 BEGIN
288 000251 288 FOR i:= 1 STEP 1 UNTIL 5 DO
289 000255 B8 289 BEGIN
290 000255 290 Insymbol(t);
291 000260 291 linenumber.[i]:= t
292 000265 E8 292 END;
293 000266 293 Insymbol(t);
294 000271 294 taberror:= t > 32
295 000276 E7 295 END;
296 000276 296 controlinline:= FALSE;
297 000301 297 FOR i:= 1 STEP 1 UNTIL 133 DO
298 000305 B9 298 BEGIN
299 000305 299
300 000305 300 loop:
301 000315 301 Insymbol(t);
302 000320 302 answer.[i]:= t;
303 000325 303 IF t = controlchar THEN
304 000330 B10 304 BEGIN
305 000333 305 IF i # 1 THEN controlinline:= TRUE
306 000334 E10 306 END;
307 000337 307 IF t = linefeed THEN GOTO out;
308 000340 308 IF t = formfeed THEN
309 000343 B11 309 BEGIN
310 000343 310 Outsymbol(t);
311 000351 311 IF i = 1 THEN GOTO loop;
312 000352 312 i:= i+1;
313 000355 313 GOTO out
314 000355 E11 314 END
315 000356 E9 315 END;
316 000357 316 errmess(FALSE, "0316: Long input line will be truncated to 132 characters.");
317 000357 317
318 000357 318 out:
319 000373 319 answerlength:= i-2;
320 000404 320 IF answer.[1] = exclamation THEN GOTO getnextline;
321 000405 321 IF taberror THEN
322 000407 322 errmess(FALSE, "0322: Character after line-number is not TAB.") ELSE
323 000414 323 IF controlinline THEN
324 000416 324 errmess(FALSE, "0324: Command character not first in line.");
325 000422 325 IF errlines > 0 THEN
326 000425 B12 326 BEGIN
327 000425 327 errlines:= errlines-1;
328 000430 328 Selectoutput(0);
329 000433 329 IF linenumbered THEN
330 000435 B13 330 BEGIN
331 000435 331 temp:= Copy(linenumber);
332 000446 332 Write(temp);
333 000451 333 delet(temp)
334 000451 E13 334 END
335 000454 335 ELSE
336 000455 B14 336 BEGIN
337 000455 337 Write("LINE ");
338 000465 338 Print(linecount - 1, 5);
339 000471 339 Write(": ")
340 000474 E14 340 END;
341 000474 341 temp:= Copy(answer,1,answerlength);
342 000507 342 Write(temp);
343 000512 343 Newline;
344 000517 344 IF answerlength > 0 THEN delet(temp);
345 000522 345 IF errlines = 0 THEN
346 000525 346 Write("----------------------------------------------------------------------[N]");
347 000530 347 Selectoutput(2)
348 000533 E12 348 END;
349 000533 349 COMMENT -------------------------------------------------
350 000533 350 Now we check to see whether the current line is an %IF,
351 000533 351 %IFNOT or %IFEND command line and, if so, "skip" will be
352 000533 352 reset accordingly. "Skip" is the BOOLEAN which GNOSIS
353 000533 353 checks to determine whether or not to skip certain lines.
354 000533 354 -----------------------------------------------------------;
355 000541 355 IF answer.[1] # controlchar THEN GOTO noif;
356 000542 356 getcontrolstart(3);
357 000545 357 IF controlstart = "IF" THEN
358 000545 358 COMMENT --------------------------------------------------
359 000545 359 Since the parameter passed to 'getcontrolstart' was 3 rather
360 000545 360 than the usual 4, %IF, %IFNOT and %IFEND will look the same
361 000545 361 at this point. (They do not differ in their first three
362 000545 362 characters.)
363 000545 363 -----------------------------------------------------------;
364 000552 B15 364 BEGIN
365 000552 365 pastoperation;
366 000554 366 switchword:= getword;
367 000564 367 upcase(switchword);
368 000574 368 IF Length(switchword) <= 0 THEN errmess(TRUE, "0368: No switchname in %IF-class command.[N]****** Line will be ignored.");
369 000602 369 FOR switchnumber:= 1 STEP 1 UNTIL switchcount DO
370 000616 370 IF switchname[switchnumber] = switchword THEN GOTO found;
371 000620 371 errmess(TRUE, "0371: Unknown switchname in %IF-class command.[N]****** Line will be ignored.");
372 000624 372 GOTO getnextline;
373 000624 373
374 000624 374 found:
375 000636 375 IF answer.[4] = lce OR answer.[4] = uce THEN
376 000636 376 COMMENT --------------------------------------------------
377 000636 377 Since this command line began with "%IF" and had an "E" in
378 000636 378 the fourth position, it must be an %IFEND command.
379 000636 379
380 000636 380 This command turns off the %IF/%IFNOT facility. In other
381 000636 381 words, the SCOPE of each %IF or %IFNOT extends to the next
382 000636 382 occurrence of a %IFEND command. Thus, all text following
383 000636 383 %IFEND will be included in the translated lesson as usual,
384 000636 384 regardless of previous %IF's or %IFNOT's. Subsequent %IF's
385 000636 385 or %IFNOT's will, of course, create another need for an
386 000636 386 %IFEND to define THEIR scope -- unless that scope extends
387 000636 387 all the way to the end of the lesson. %IFEND must therefore
388 000636 388 follow some %IF or %IFNOT command.
389 000636 389 -----------------------------------------------------------;
390 000657 B16 390 BEGIN
391 000657 391 IF NOT ifset[switchnumber] THEN
392 000663 392 errmess(FALSE, "0392: %IFEND on non-active switch -- will have no effect.");
393 000667 393 ifset[switchnumber]:= FALSE
394 000672 E16 394 END ELSE
395 000673 B17 395 BEGIN
396 000673 396 ifset[switchnumber]:= TRUE;
397 000676 397 ifval[switchnumber]:= answer.[4] = blank
398 000676 398 COMMENT --------------------------------------------------
399 000676 399 The line above handles both %IFNOT and %IF command lines.
400 000676 400 If no blank follows the "IF", then the appropriate item in
401 000676 401 the BOOLEAN ARRAY 'ifval' is switched FALSE since the
402 000676 402 trailing character (in position 4) can only be an "N" (i.e.,
403 000676 403 a %IFNOT command line). On the othr hand, if a blank does
404 000676 404 follow the "IF", then the item is switched TRUE (i.e., since
405 000676 405 the command was a %IF).
406 000676 406
407 000676 407 Assuming <switchname> has been declared and initialized by a
408 000676 408 %SWITCH command, the occurrence of %IF will cause the text
409 000676 409 between the %IF and the next %IFEND to be deposited in the
410 000676 410 translated lesson ONLY if <switchname> was initialized TRUE.
411 000676 411 Otherwise these lines of text will be skipped.
412 000676 412 Correspondingly, the text between %IFNOT and the next %IFEND
413 000676 413 command will be included in the ALGOL translation of the
414 000676 414 lesson ONLY if <switchname> is FALSE.
415 000676 415 -----------------------------------------------------------;
416 000710 E17 416 END;
417 000710 417 skip:= FALSE;
418 000713 418 FOR switchnumber:= 1 STEP 1 UNTIL switchcount DO
419 000717 419 skip:= skip OR ( ifset[switchnumber] AND NOT
420 000717 420 ( ifval[switchnumber] EQV switchval[switchnumber] ));
421 000735 421 GOTO getnextline
422 000736 E15 422 END ELSE
423 000736 423
424 000736 424 noif:
425 000751 425 IF skip THEN GOTO getnextline;
426 000752 426 pos:= 1
427 000754 E6 427 END of PR*CEDURE getline;
428 000754 428
429 000754 429
430 000754 430
431 000764 431 PROCEDURE upcase(s);
432 000770 432 STRING s;
433 000770 433 COMMENT --------------------------------------------------
434 000770 434 'Upcase' will transform all letters in the parameter STRING
435 000770 435 from lower case to upper case. If the language of the
436 000770 436 lesson is swedish, then the swedish letters }, { and ` will
437 000770 437 also be transformed to upper case
438 000770 438 -----------------------------------------------------------;
439 000771 B18 439 BEGIN
440 000772 440 INTEGER t, i;
441 000774 441 FOR i:= 1 STEP 1 UNTIL Length(s) DO
442 001007 B19 442 BEGIN
443 001007 443 IF s.[i] >= 97 AND s.[i] <= 122 THEN
444 001031 444 s.[i]:= s.[i]-32
445 001046 445 ELSE IF language = 2 THEN
446 001051 B20 446 BEGIN
447 001057 447 IF s.[i] = lcaa THEN s.[i]:= ucaa ELSE
448 001075 448 IF s.[i] = lcae THEN s.[i]:= ucae ELSE
449 001113 449 IF s.[i] = lcoe THEN s.[i]:= ucoe
450 001113 E20 450 END
451 001122 E19 451 END
452 001123 E18 452 END of PR*CEDURE upcase;
453 001123 453
454 001123 454
455 001123 455
456 001134 456 PROCEDURE getcontrolstart(i);
457 001140 457 VALUE i;
458 001140 458 INTEGER i;
459 001140 459 COMMENT --------------------------------------------------
460 001140 460 'Getcontrolstart' extracts that part of a command line which
461 001140 461 contains the beginning of the command text. This beginning
462 001140 462 determines what GNOSIS will do until it encounters another
463 001140 463 command line. The PROCEDURE also passes over unrecognized
464 001140 464 commands and any non-command line(s) which may follow them.
465 001140 465 This ensures that the error scan will be able to generate
466 001140 466 meaningful messages for the user and, with a little luck,
467 001140 467 may enable GNOSIS to produce a program the ALGOL compiler
468 001140 468 will accept despite user error.
469 001140 469 -----------------------------------------------------------;
470 001141 B21 470 BEGIN
471 001141 471
472 001141 472 repeat:
473 001152 473 delet(controlstart);
474 001155 474 controlstart:= Copy(answer,2,i);
475 001170 475 upcase(controlstart);
476 001173 476 IF i = 4 THEN
477 001176 B22 477 BEGIN
478 001176 478 COMMENT --------------------------------------------------
479 001176 479 We scan down this list, eliminating the most frequently used
480 001176 480 GNOSIS commands first. The semicolon after 'THEN' is a
481 001176 481 dummy statement used to outwit the compiler (it still
482 001176 482 complains some). This is as close as we can come to a case
483 001176 483 statement in ALGOL.
484 001176 484 -----------------------------------------------------------;
485 001203 485 IF controlstart = "RIG" THEN ;
******* ^
485 SEMICOLON PROBABLY SUPERFLUOUS
486 001211 486 ELSE IF controlstart = "WRO" THEN ;
******* ^
486 SEMICOLON PROBABLY SUPERFLUOUS
487 001217 487 ELSE IF controlstart = "SAM" THEN ;
******* ^
487 SEMICOLON PROBABLY SUPERFLUOUS
488 001225 488 ELSE IF controlstart = "ORD" THEN ;
******* ^
488 SEMICOLON PROBABLY SUPERFLUOUS
489 001233 489 ELSE IF controlstart = "NOO" THEN ;
******* ^
489 SEMICOLON PROBABLY SUPERFLUOUS
490 001241 490 ELSE IF controlstart = "EXT" THEN ;
******* ^
490 SEMICOLON PROBABLY SUPERFLUOUS
491 001247 491 ELSE IF controlstart = "NOE" THEN ;
******* ^
491 SEMICOLON PROBABLY SUPERFLUOUS
492 001255 492 ELSE IF controlstart = "QUE" THEN ;
******* ^
492 SEMICOLON PROBABLY SUPERFLUOUS
493 001263 493 ELSE IF controlstart = "NEU" THEN ;
******* ^
493 SEMICOLON PROBABLY SUPERFLUOUS
494 001271 494 ELSE IF controlstart = "LAC" THEN ;
******* ^
494 SEMICOLON PROBABLY SUPERFLUOUS
495 001277 495 ELSE IF controlstart = "GO " THEN ;
******* ^
495 SEMICOLON PROBABLY SUPERFLUOUS
496 001305 496 ELSE IF controlstart = "GOT" THEN ;
******* ^
496 SEMICOLON PROBABLY SUPERFLUOUS
497 001313 497 ELSE IF controlstart = "TEX" THEN ;
******* ^
497 SEMICOLON PROBABLY SUPERFLUOUS
498 001321 498 ELSE IF controlstart = "JUS" THEN ;
******* ^
498 SEMICOLON PROBABLY SUPERFLUOUS
499 001327 499 ELSE IF controlstart = "NOJ" THEN ;
******* ^
499 SEMICOLON PROBABLY SUPERFLUOUS
500 001335 500 ELSE IF controlstart = "HEL" THEN ;
******* ^
500 SEMICOLON PROBABLY SUPERFLUOUS
501 001343 501 ELSE IF controlstart = "VAR" THEN ;
******* ^
501 SEMICOLON PROBABLY SUPERFLUOUS
502 001351 502 ELSE IF controlstart = "PRO" THEN ;
******* ^
502 SEMICOLON PROBABLY SUPERFLUOUS
503 001357 503 ELSE IF controlstart = "INI" THEN ;
******* ^
503 SEMICOLON PROBABLY SUPERFLUOUS
504 001365 504 ELSE IF controlstart = "ALG" THEN ;
******* ^
504 SEMICOLON PROBABLY SUPERFLUOUS
505 001373 505 ELSE IF controlstart = "QEN" THEN ;
******* ^
505 SEMICOLON PROBABLY SUPERFLUOUS
506 001401 506 ELSE IF controlstart = "END" THEN ;
******* ^
506 SEMICOLON PROBABLY SUPERFLUOUS
507 001407 507 ELSE IF controlstart = "TEA" THEN ;
******* ^
507 SEMICOLON PROBABLY SUPERFLUOUS
508 001415 508 ELSE IF controlstart = "NAM" THEN ;
******* ^
508 SEMICOLON PROBABLY SUPERFLUOUS
509 001423 509 ELSE IF controlstart = "KEE" THEN ;
******* ^
509 SEMICOLON PROBABLY SUPERFLUOUS
510 001431 510 ELSE IF controlstart = "BEL" THEN ;
******* ^
510 SEMICOLON PROBABLY SUPERFLUOUS
511 001437 511 ELSE IF controlstart = "DSK" THEN ;
******* ^
511 SEMICOLON PROBABLY SUPERFLUOUS
512 001445 512 ELSE IF controlstart = "DIS" THEN ;
******* ^
512 SEMICOLON PROBABLY SUPERFLUOUS
513 001453 513 ELSE IF controlstart = "LOC" THEN ;
******* ^
513 SEMICOLON PROBABLY SUPERFLUOUS
514 001461 514 ELSE IF controlstart = "COP" THEN ;
******* ^
514 SEMICOLON PROBABLY SUPERFLUOUS
515 001467 515 ELSE IF controlstart = "LAN" THEN ;
******* ^
515 SEMICOLON PROBABLY SUPERFLUOUS
516 001475 516 ELSE IF controlstart = "SGN" THEN ;
******* ^
516 SEMICOLON PROBABLY SUPERFLUOUS
517 001503 517 ELSE IF controlstart = "SWI" THEN ;
******* ^
517 SEMICOLON PROBABLY SUPERFLUOUS
518 001511 518 ELSE IF controlstart = "NOC" THEN ;
******* ^
518 SEMICOLON PROBABLY SUPERFLUOUS
519 001517 519 ELSE IF controlstart = "NEX" THEN ;
******* ^
519 SEMICOLON PROBABLY SUPERFLUOUS
520 001525 520 ELSE IF controlstart = "FIN" THEN ;
******* ^
520 SEMICOLON PROBABLY SUPERFLUOUS
521 001533 521 ELSE IF controlstart = "IF " THEN ;
******* ^
521 SEMICOLON PROBABLY SUPERFLUOUS
522 001541 522 ELSE IF controlstart = "IFE" THEN ;
******* ^
522 SEMICOLON PROBABLY SUPERFLUOUS
523 001547 523 ELSE IF controlstart = "IFN" THEN ;
******* ^
523 SEMICOLON PROBABLY SUPERFLUOUS
524 001547 524 ELSE
525 001550 B23 525 BEGIN
526 001550 526 errmess(TRUE,
527 001550 527 "0527: Unrecognized command line found. As a result,[N]****** this line up to next command line will be ignored.");
528 001554 528 getline;
529 001564 529 WHILE answer.[1] # controlchar DO getline;
530 001567 530 i:= 4;
531 001571 531 GOTO repeat
532 001571 E23 532 END
533 001572 E22 533 END
534 001572 E21 534 END of PR*CEDURE getcontrolstart;
535 001572 535
536 001572 536
537 001572 537
538 001573 538 STRING PROCEDURE getword;
539 001573 539 COMMENT --------------------------------------------------
540 001573 540 'Getword' scans the input line, beginning at 'pos', and
541 001573 541 finds a word. For purposes of this PROCEDURE, any STRING of
542 001573 542 non-blank characters terminated by a blank or a <CR><LF>
543 001573 543 will constitute a word. Leading and trailing blanks are not
544 001573 544 assumed to be part of the word. 'Getword' will move 'pos'
545 001573 545 to the end of the found word.
546 001573 546 -----------------------------------------------------------;
547 001603 B24 547 BEGIN
548 001604 548 INTEGER pos1, t;
549 001604 549 pos1:= pos;
550 001611 550 IF pos1 # 1 THEN GOTO blankloop;
551 001611 551
552 001611 552 textloop:
553 001623 553 t:= answer.[pos1];
554 001633 554 IF t = carriagereturn THEN GOTO null;
555 001634 555 IF t # blank THEN
556 001637 B25 556 BEGIN
557 001637 557 pos1:= pos1+1;
558 001642 558 GOTO textloop
559 001643 E25 559 END;
560 001643 560
561 001643 561 blankloop:
562 001654 562 t:= answer.[pos1];
563 001664 563 IF t = carriagereturn THEN GOTO null;
564 001665 564 IF t = blank THEN
565 001670 B26 565 BEGIN
566 001670 566 pos1:= pos1+1;
567 001673 567 GOTO blankloop
568 001674 E26 568 END;
569 001702 569 IF answer.[pos1] = carriagereturn THEN GOTO null;
570 001703 570 pos:= pos1+1;
571 001703 571
572 001703 572 wordloop:
573 001717 573 t:= answer.[pos];
574 001724 574 IF t # blank AND t # carriagereturn THEN
575 001736 B27 575 BEGIN
576 001736 576 pos:= pos+1;
577 001741 577 GOTO wordloop
578 001742 E27 578 END;
579 001747 579 getword:= Copy(answer,pos1,pos-1);
580 001762 580 GOTO out;
581 001762 581
582 001762 582 null:
583 001773 583 getword:= "";
584 001773 584
585 001773 585 out:
586 002012 E24 586 END of PR*CEDURE getword;
587 002012 587
588 002012 588
589 002012 589
590 002022 590 PROCEDURE alglin(s);
591 002026 591 VALUE s;
592 002026 592 STRING s;
593 002026 593 COMMENT --------------------------------------------------
594 002026 594 'Alglin' will dump the STRING passed to it as a parameter
595 002026 595 into the translated lesson. Since this parameter could
596 002026 596 contain characters which are not supposed to have their
597 002026 597 usual ALGOL function (i.e., the semicolon, the left and
598 002026 598 right square bracket, and the doubequote), we could not take
599 002026 599 advantage of the built-in PROCEDURE 'Write'. A <CR><LF> is
600 002026 600 output after the STRING.
601 002026 601 -----------------------------------------------------------;
602 002027 B28 602 BEGIN
603 002031 603 FOR wpos:= 1 STEP 1 UNTIL Length(s) DO
604 002051 604 Outsymbol(s.[wpos]);
605 002051 605 Newline
606 002057 E28 606 END of PR*CEDURE alglin;
607 002057 607
608 002057 608
609 002057 609
610 002064 610 PROCEDURE textline(s);
611 002070 611 VALUE s;
612 002070 612 STRING s;
613 002070 613 COMMENT --------------------------------------------------
614 002070 614 'Textline' will output a line in an Algol 10 program. This
615 002070 615 line contains a call to the Algol 10 PROCEDURE "Write" such
616 002070 616 that the input STRING is written. Example: If the input
617 002070 617 STRING is "ABCD[I]" then this PROCEDURE will output the line
618 002070 618 "Write("ABCD[[I]]").
619 002070 619
620 002070 620 We developed this PROCEDURE so that we would not go bonkers
621 002070 621 trying to nest square brackets and doublequotes -- not to
622 002070 622 mention a 'Write' inside another 'Write'. However, the
623 002070 623 program was mostly finished before we began to take
624 002070 624 advantage of it.
625 002070 625 -----------------------------------------------------------;
626 002071 B29 626 BEGIN
627 002072 627 INTEGER pos, t;
628 002072 628 Write("Write(""");
629 002077 629 FOR pos:= 1 STEP 1 UNTIL Length(s) DO
630 002112 B30 630 BEGIN
631 002112 631 t:= s.[pos];
632 002117 632 IF t = doublequote OR t = semicolon OR
633 002117 633 t = leftsquare OR t = rightsquare
634 002143 634 THEN Outsymbol(t);
635 002146 635 Outsymbol(t)
636 002151 E30 636 END;
637 002152 637 Write("[[N]]"");;[N]")
638 002155 E29 638 END of PR*CEDURE textline;
639 002155 639
640 002155 640
641 002155 641
642 002161 642 PROCEDURE textlines;
643 002161 643 COMMENT --------------------------------------------------
644 002161 644 'Textlines' will take text from the GNOSIS lesson and
645 002161 645 translate that text to an Algol 10 program sequence which,
646 002161 646 in turn, will write that text to the user. Succesive lines
647 002161 647 from the GNOSIS lesson are translated until a line is found
648 002161 648 which contains a GNOSIS command.
649 002161 649
650 002161 650 In %NOJUSTIFY mode, GNOSIS watches vertical spacing only,
651 002161 651 ensuring that scrolling will cease as soon as the screen is
652 002161 652 full. (A call to 'pause' is inserted for this purpose.) In
653 002161 653 %JUSTIFY mode, GNOSIS not only watches vertical spacing but
654 002161 654 also edits the text in such a way that a semi-justified
655 002161 655 right margin is produced (at or before column 72). In this
656 002161 656 mode, GNOSIS will be sensitive to the occurrence of the
657 002161 657 semicolon, right and left square bracket, and the
658 002161 658 doublequote. This sensitivity will probably be removed in
659 002161 659 later versions.
660 002161 660 -----------------------------------------------------------;
661 002171 B31 661 BEGIN
662 002172 662 INTEGER outpos, screenlines;
663 002172 663 STRING nextword;
664 002174 664 BOOLEAN writingaline, morewords;
665 002174 665
666 002174 666
667 002174 667
668 002175 668 STRING PROCEDURE getnextword;
669 002175 669 COMMENT --------------------------------------------------
670 002175 670 Same as 'getword' except does not scan past first word in
671 002175 671 'answer'.
672 002175 672 -----------------------------------------------------------;
673 002205 B32 673 BEGIN
674 002206 674 INTEGER pos1, t;
675 002206 675 pos1:= pos;
676 002210 676 t:= answer.[pos1];
677 002220 677 IF t = carriagereturn THEN GOTO null;
678 002220 678
679 002220 679 blankloop:
680 002232 680 t:= answer.[pos1];
681 002242 681 IF t = carriagereturn THEN GOTO null;
682 002243 682 IF t = blank OR t = tabchar THEN
683 002255 B33 683 BEGIN
684 002255 684 pos1:= pos1+1;
685 002260 685 GOTO blankloop
686 002261 E33 686 END;
687 002267 687 IF answer.[pos1] = carriagereturn THEN GOTO null;
688 002270 688 pos:= pos1+1;
689 002270 689
690 002270 690 wordloop:
691 002304 691 t:= answer.[pos];
692 002311 692 IF t # blank AND t # carriagereturn THEN
693 002323 B34 693 BEGIN
694 002323 694 pos:= pos+1;
695 002326 695 GOTO wordloop
696 002327 E34 696 END;
697 002334 697 getnextword:= Copy(answer,pos1,pos-1);
698 002347 698 GOTO out;
699 002347 699
700 002347 700 null:
701 002360 701 getnextword:= "";
702 002360 702
703 002360 703 out:
704 002377 E32 704 END of PR*CEDURE getnextword;
705 002377 705
706 002403 706 getline;
707 002405 707 IF NOT justify THEN
708 002407 B35 708 BEGIN
709 002407 709 screenlines:= 0;
710 002410 710 WHILE answer.[1] # controlchar DO
711 002416 B36 711 BEGIN
712 002416 712 IF answerlength = 0 THEN
713 002421 B37 713 BEGIN
714 002421 714 screenlines:= screenlines + 1;
715 002427 715 IF screenlines < 22 THEN Write("Newline;;[N]") ELSE
716 002433 B38 716 BEGIN
717 002433 717 screenlines:= 0;
718 002434 718 Write("pause;;[N]")
719 002434 E38 719 END
720 002437 E37 720 END
721 002437 721 ELSE
722 002440 B39 722 BEGIN
723 002440 723 screenlines:=screenlines + 1;
724 002443 724 IF screenlines > 21 THEN
725 002446 B40 725 BEGIN
726 002446 726 Write("pause;;[N]");
727 002451 727 screenlines:= 0
728 002452 E40 728 END;
729 002471 729 textline((temp:=Copy(answer,1,answerlength)));
730 002474 730 delet(temp)
731 002477 E39 731 END;
732 002477 732 getline
733 002477 E36 733 END
734 002501 E35 734 END
735 002502 735 ELSE
736 002503 B41 736 BEGIN
737 002503 737 writingaline:= FALSE;
738 002504 738 screenlines:= 0;
739 002505 739 outpos:= 1;
740 002507 740 WHILE answer.[1] # controlchar DO
741 002515 B42 741 BEGIN
742 002515 742 IF answerlength = 0 THEN
743 002520 B43 743 BEGIN
744 002520 744 IF writingaline THEN
745 002522 B44 745 BEGIN
746 002522 746 Write("[[N]]"");;[N]");
747 002525 747 screenlines:= screenlines + 1;
748 002530 748 IF screenlines < 22 THEN
749 002533 B45 749 BEGIN
750 002533 750 Write("Newline;;[N]");
751 002536 751 screenlines:= screenlines + 1
752 002536 E45 752 END
753 002541 753 ELSE
754 002542 B46 754 BEGIN
755 002542 755 Write("pause;;[N]");
756 002545 756 screenlines:= 0
757 002546 E46 757 END;
758 002546 758 writingaline:= FALSE;
759 002547 759 outpos:= 1
760 002547 E44 760 END
761 002551 761 ELSE
762 002552 B47 762 BEGIN
763 002552 763 screenlines:= screenlines + 1;
764 002555 764 IF screenlines < 22 THEN
765 002560 B48 765 BEGIN
766 002560 766 Write("Newline;;[N]");
767 002563 767 screenlines:= screenlines + 1
768 002563 E48 768 END
769 002566 769 ELSE
770 002567 B49 770 BEGIN
771 002567 771 Write("pause;;[N]");
772 002572 772 screenlines:= 0
773 002572 E49 773 END
774 002573 E47 774 END
775 002573 E43 775 END
776 002573 776 ELSE
777 002574 B50 777 BEGIN
778 002574 778 morewords:= TRUE;
779 002577 779 IF NOT writingaline THEN Write("Write(""");
780 002602 780 writingaline:= TRUE;
781 002603 781 WHILE morewords DO
782 002605 B51 782 BEGIN
783 002605 783 delet(nextword);
784 002610 784 nextword:= getnextword;
785 002625 785 IF nextword = "" THEN morewords:= FALSE
786 002625 786 ELSE
787 002627 B52 787 BEGIN
788 002627 788 outpos:= outpos + Length(nextword) + 1;
789 002635 789 IF outpos < rightmargin THEN
790 002640 B53 790 BEGIN
791 002640 791 Write(nextword);
792 002643 792 Write(" ")
793 002643 E53 793 END
794 002646 794 ELSE
795 002647 B54 795 BEGIN
796 002647 796 Write("[[N]]"");;[N]");
797 002652 797 screenlines:= screenlines + 1;
798 002655 798 IF screenlines > 21 THEN
799 002660 B55 799 BEGIN
800 002660 800 Write("pause;;[N]");
801 002663 801 screenlines:= 0
802 002664 E55 802 END;
803 002664 803 outpos:= Length(nextword) + 1;
804 002671 804 Write("Write(""");
805 002674 805 Write(nextword);
806 002677 806 Write(" ")
807 002677 E54 807 END
808 002702 E52 808 END
809 002702 E51 809 END morewords loop;
810 002703 E50 810 END writing cycle for string currently in "answer";
811 002703 811 getline
812 002705 E42 812 END WHIL* answer.[1] # controlchar;
813 002710 813 IF writingaline THEN Write("[[N]]"");;[N]")
814 002713 E41 814 END;
815 002716 815 IF screenlines > 18 THEN Write("pause;;[N]");
816 002721 816 getcontrolstart(4)
817 002724 E31 817 END of PR*CEDURE textlines;
818 002724 818
819 002724 819
820 002724 820
821 002726 821 PROCEDURE pastoperation;
822 002726 822 COMMENT --------------------------------------------------
823 002726 823 'Pastoperation' will scan an input line (usually a GNOSIS
824 002726 824 command line) and find the first non-blank character after
825 002726 825 the first blank. Thus, the PROCEDURE scans past the command
826 002726 826 word. The array address of the found character is stored in
827 002726 827 'pos'.
828 002726 828 -----------------------------------------------------------;
829 002737 B56 829 BEGIN
830 002741 830 FOR pos:= 1 STEP 1 UNTIL answerlength+1 DO
831 002755 831 IF answer.[pos] = blank THEN GOTO bskip;
832 002755 832
833 002755 833 bskip:
834 002772 834 FOR pos:= pos STEP 1 UNTIL answerlength+1 DO
835 003006 835 IF answer.[pos] # blank THEN GOTO out;
836 003006 836 out:
837 003020 E56 837 END of PR*CEDURE pastoperation;
838 003020 838
839 003020 839
840 003020 840
841 003021 841 PROCEDURE shortalgol;
842 003021 842 COMMENT --------------------------------------------------
843 003021 843 Many GNOSIS commands can contain a short ALGOL program
844 003021 844 sequence after the end of the command (e.g., '%QUE IF
845 003021 845 lasterrors > 0 THEN'). 'Shortalgol' will transfer that
846 003021 846 short ALGOL program sequence unchanged from the GNOSIS
847 003021 847 lesson into the ALGOL translation of the lesson.
848 003021 848 -----------------------------------------------------------;
849 003031 B57 849 BEGIN
850 003031 850 pastoperation;
851 003033 851 IF pos <= answerlength THEN
852 003055 852 alglin((temp:=Copy(answer,pos,answerlength)));
853 003060 853 delet(temp)
854 003063 E57 854 END of PR*CEDURE shortalgol;
855 003063 855
856 003063 856
857 003063 857
858 003064 858 PROCEDURE goanywherecommands;
859 003064 859 COMMENT --------------------------------------------------
860 003064 860 'Goanywherecommands' will determine whether the GNOSIS
861 003064 861 command at the current command line is one of te go-anywhere
862 003064 862 commands (i.e., %JUSTIFY, %NOJUSTIFY, %EXTRA, %NOEXTRA,
863 003064 863 %ORDER, %NOORDER, %GOTO, or %ALGOL) and take appropriate
864 003064 864 action. The first six will set internal BOOLEAN variables
865 003064 865 in the GNOSIS program. %ALGOL will cause an ALGOL program
866 003064 866 sequence to be transferred unchanged from the GNOSIS lesson
867 003064 867 into the ALGOL translation of that lesson. If there are
868 003064 868 more than one of these commands in succession, they will all
869 003064 869 be handled by this PROCEDURE. The PROCEDURE returns when a
870 003064 870 GNOSIS command is encountered which is none of the eight
871 003064 871 handled by this PROCEDURE.
872 003064 872
873 003064 873 Note: In terms of their behavior, %IF, %IFEND, and %IFNOT
874 003064 874 function like the 'goanywhere' commands. They, too, may
875 003064 875 appear anywhere in the lesson as long as a %SWITCH command
876 003064 876 precedes them.
877 003064 877 -----------------------------------------------------------;
878 003076 B58 878 BEGIN
879 003076 879
880 003076 880 loop:
881 003113 881 IF controlstart = "JUS" THEN justify:= TRUE ELSE
882 003122 882 IF controlstart = "NOJ" THEN justify:= FALSE ELSE
883 003122 883 COMMENT --------------------------------------------------
884 003122 884 The %JUSTIFY command causes all text, includin the text in
885 003122 885 %QUESTION blocks and %HELP blocks, to be semi-justified to
886 003122 886 produce a ragged right at column =< 72. It also causes such
887 003122 887 text material to be paged out in such a way that nothing
888 003122 888 will be lost scrolling off the top of a CRT.
889 003122 889
890 003122 890 Although GNOSIS begins processing text material in the
891 003122 891 %NOJUSTIFY mode, an occurrence of the %JUSTIFY command will
892 003122 892 change th mode of processing until a subsequent %NOJUSTIFY
893 003122 893 command is encountered.
894 003122 894
895 003122 895 In %NOJUSTIFY mode GNOSIS continues to recognize when the
896 003122 896 CRT screen heigth is about to be exceeded and arranges for
897 003122 897 the lesson to issue a call to the 'pause' PROCEDURE at the
898 003122 898 appropriate time. However, there is in this mode no attempt
899 003122 899 at right-justification. Consequently, in %NOJUSTIFY mode,
900 003122 900 text will be displayed to the student exactly as it appears
901 003122 901 in the GNOSIS source script.
902 003122 902 -----------------------------------------------------------;
903 003131 903 IF controlstart = "EXT" THEN extra:= TRUE ELSE
904 003140 904 IF controlstart = "NOE" THEN extra:= FALSE ELSE
905 003140 905 COMMENT --------------------------------------------------
906 003140 906 The above commands influence the way in which student
907 003140 907 answers are compared to canned answer patterns. After a
908 003140 908 %EXTRA command, and until the next %NOEXTRA command, student
909 003140 909 answers will be considered correct even if they contain
910 003140 910 extra characters not part of the %RIGHT answer pattern
911 003140 911 PROVIDED they do at least contain all the essential
912 003140 912 characters. If they answer DOES contain extra characters,
913 003140 913 then GNOSIS will flag the essential characters with
914 003140 914 uparrows.
915 003140 915 -----------------------------------------------------------;
916 003147 916 IF controlstart = "ORD" THEN order:= TRUE ELSE
917 003156 917 IF controlstart = "NOO" THEN order:= FALSE ELSE
918 003156 918 COMMENT --------------------------------------------------
919 003156 919 These commands also influence the way in which student
920 003156 920 answers are compared to canned answer patterns. After a
921 003156 921 %ORDER command -- and until the next %NOORDER command -- a
922 003156 922 student's answer will be considered correct only if the
923 003156 923 elements of the student's answer appear in PRECISELY the
924 003156 924 same order as the elements of the canned answer pattern.
925 003156 925 -----------------------------------------------------------;
926 003160 926 IF controlstart = "GOT" OR controlstart = "GO " THEN
927 003160 927 COMMENT --------------------------------------------------
928 003160 928 The %GOTO command works just the way 'GOTO' works in ALGOL
929 003160 929 itself. Since the old version of GNOSIS allowed %GOTO
930 003160 930 command lines to end without a semicolon and the new version
931 003160 931 doesn't, the code below was added to make the old and new
932 003160 932 versions compatible. Also, in this version, the %GOTO
933 003160 933 command can appear anywhere in the lesson script, not (as
934 003160 934 was formerly the case) just in %QUESTION environments.
935 003160 935 -----------------------------------------------------------;
936 003177 B59 936 BEGIN
937 003200 937 INTEGER i;
938 003217 938 alglin((temp:= Copy(answer,2,answerlength)));
939 003222 939 i:= answerlength;
940 003241 940 WHILE answer.[i] = blank AND i > 4 DO i:= i-1;
941 003245 941 IF answer.[i] # semicolon THEN
942 003253 B60 942 BEGIN
943 003253 943 errmess(FALSE, "0943: Semicolon omitted at end of '%GOTO' command.[N]****** GNOSIS will supply one for you.");
944 003257 944 Outsymbol(semicolon);
945 003257 945 Newline
946 003264 E60 946 END;
947 003264 947 delet(temp)
948 003267 E59 948 END ELSE
949 003273 949 IF controlstart = "ALG" THEN
950 003273 950 COMMENT --------------------------------------------------
951 003273 951 This command causes one or more lines of ALGOL code to be
952 003273 952 transferred unchanged to the ALGOL translation of the
953 003273 953 lesson. The segment must be legal in ALGOL and, in
954 003273 954 addition, must mesh with the GNOSIS lesson at the point of
955 003273 955 isertion.
956 003273 956 -----------------------------------------------------------;
957 003300 B61 957 BEGIN
958 003300 958 shortalgol;
959 003300 959
960 003300 960 algloop:
961 003313 961 getline;
962 003323 962 IF answer.[1] = controlchar THEN GOTO out;
963 003327 963 IF answerlength = 0 THEN Newline ELSE
964 003332 B62 964 BEGIN
965 003351 965 alglin((temp:=Copy(answer,1,answerlength)));
966 003354 966 delet(temp)
967 003357 E62 967 END;
968 003357 968 GOTO algloop
969 003361 E61 969 END ELSE GOTO return;
970 003362 970 getline;
971 003364 971 IF answer.[1] # controlchar THEN
972 003372 B63 972 BEGIN
973 003372 973 errmess(TRUE,
974 003372 974 "0974: A command line is required at this point. As a result,[N]****** this line up to next command line will be ignored.");
975 003376 975 WHILE answer.[1] # controlchar DO getline
976 003407 E63 976 END;
977 003407 977
978 003407 978 out:
979 003417 979 getcontrolstart(4);
980 003422 980 GOTO loop;
981 003422 981
982 003422 982 return:
983 003434 E58 983 END of PR*CEDURE goanywherecommands;
984 003434 984
985 003434 985
986 003434 986
987 003435 987 PROCEDURE putaway;
988 003435 988 COMMENT --------------------------------------------------
989 003435 989 'Putaway' writes into the lesson identifying phrases. If
990 003435 990 teacher reports are generated and the student's answer to a
991 003435 991 question is unexpected, then this identifier will be paired
992 003435 992 with his answer and both will be routed to the teacher
993 003435 993 reports. If the teacher gave the question a label, then
994 003435 994 this label will also be included as part of the identifying
995 003435 995 phrase.
996 003435 996
997 003435 997 -----------------------------------------------------------;
998 003445 B64 998 BEGIN
999 003446 999 INTEGER t;
1000 003446 B65 1000 BEGIN
1001 003446 1001 Write("putaway(""%QUE");
1002 003451 1002 Print(qcount,2);
1003 003455 1003 IF Length(question) > 0 THEN
1004 003462 B66 1004 BEGIN
1005 003462 1005 Write(";;;;");
1006 003467 1006 FOR pos2:= 1 STEP 1 UNTIL Length(question) DO
1007 003502 B67 1007 BEGIN
1008 003502 1008 t:= question.[pos2];
1009 003507 1009 IF t = leftsquare OR t = rightsquare
1010 003507 1010 OR t = semicolon OR t = doublequote
1011 003533 1011 THEN Outsymbol(t);
1012 003536 1012 Outsymbol(t)
1013 003536 E67 1013 END
1014 003542 E66 1014 END;
1015 003542 1015 Write(""");;[N]")
1016 003542 E65 1016 END
1017 003545 E64 1017 END of PR*CEDURE putaway;
1018 003545 1018
1019 003545 1019
1020 003545 1020
1021 003551 1021 PROCEDURE unknownmessage;
1022 003551 1022 COMMENT --------------------------------------------------
1023 003551 1023 'Unknownmessage' will output that ALGOL program sequence
1024 003551 1024 which handles an answer from the student which was not
1025 003551 1025 expected by the teacher (i.e., a "%NEUTRAL or %WRONG"
1026 003551 1026 command with no teacher answer pattern following it). The
1027 003551 1027 ALGOL program produced will give an appropriate message to
1028 003551 1028 the student and write the unexpected answer into the teacher
1029 003551 1029 reports (if any) so that the teacher can study the answer in
1030 003551 1030 order to improve the lesson. Unless ALL the answer commands
1031 003551 1031 following a particular %QUESTION command have been %NEUTRAL
1032 003551 1032 commands, 'unknownmessage' causes a call on 'wrongmessage'
1033 003551 1033 to be issued.
1034 003551 1034 -----------------------------------------------------------;
1035 003562 B68 1035 BEGIN
1036 003562 1036 Write("BEGIN[N]");
1037 003565 1037 IF allneutral THEN
1038 003567 B69 1038 BEGIN
1039 003567 1039 IF language = 1 THEN
1040 003572 1040 Write("Write(""I don't understand your answer.[[N]]"");;[N]")
1041 003576 1041 ELSE IF language = 2 THEN
1042 003601 1042 Write("Write(""Jag f`rst}r inte ditt svar.[[N]]"");;[N]")
1043 003601 E69 1043 END
1044 003605 1044 ELSE Write("wrongmessage;;[N]");
1045 003610 1045 IF put THEN putaway
1046 003614 E68 1046 END of PR*CEDURE unknownmessage;
1047 003614 1047
1048 003614 1048
1049 003614 1049
1050 003615 1050 PROCEDURE zeroprint;
1051 003615 1051 COMMENT --------------------------------------------------
1052 003615 1052 'Zeroprint' will output an ALGOL program sequence which will
1053 003615 1053 determine whether the student answer was empty and, in that
1054 003615 1054 case, tell the student what happened and give the question
1055 003615 1055 once more to the student.
1056 003615 1056 -----------------------------------------------------------;
1057 003625 B70 1057 BEGIN
1058 003625 1058 Write("IF answerlength = 0 THEN[N]");
1059 003630 1059 Write("BEGIN[N]");
1060 003633 1060 Write("noanswer;;[N]GOTO repeat;;[N]END;;[N]");
1061 003636 1061 zeroprinted:= TRUE
1062 003637 E70 1062 END of PR*CEDURE zeroprint;
1063 003637 1063
1064 003637 1064
1065 003637 1065
1066 003645 1066 PROCEDURE checkprecedence(n);
1067 003651 1067 INTEGER n;
1068 003651 1068 COMMENT -------------------------------------------------
1069 003651 1069 'Checkprecedence' does some rudimentary checking to
1070 003651 1070 determine whether the lesson author used GNOSIS commands in
1071 003651 1071 the proper order, warns him if he did not, and tries to
1072 003651 1072 recover from the error. Not all errors of precedence are
1073 003651 1073 caught by this check since some are context-dependent. A
1074 003651 1074 complete precedence table for GNOSIS commands appears below:
1075 003651 1075
1076 003651 1076 =======================================================
1077 003651 1077 PRECEDENCE COMMAND COMMENT
1078 003651 1078 =======================================================
1079 003651 1079 0 %ALGOL Use of these commands is
1080 003651 1080 0 %EXTRA unrestricted. They may go
1081 003651 1081 0 %GOTO anywhere in the lesson.
1082 003651 1082 0 %IF
1083 003651 1083 0 %IFEND However, the %SWITCH
1084 003651 1084 0 %IFNOT command must precede
1085 003651 1085 0 %JUSTIFsY %IF, %IFENDs and %IFNOTs.
1086 003651 1086 0 %NOEXTRA
1087 003651 1087 0 %NOJUSTIFY
1088 003651 1088 0 %NOORDER
1089 003651 1089 0 %ORDER
1090 003651 1090 -------------------------------------------------------
1091 003651 1091 1 %BELL These commands (if used)
1092 003651 1092 1 %COPYRIGHT must precede all those > 1.
1093 003651 1093 1 %DISK (also %DSK or %DSIC)
1094 003651 1094 1 %KEEP
1095 003651 1095 1 %LANGUAGE
1096 003651 1096 1 %LOCK
1097 003651 1097 1 %NAME
1098 003651 1098 1 %NEXTLESSON
1099 003651 1099 1 %NOCONTROLC
1100 003651 1100 1 %SGNOSIS
1101 003651 1101 1 %SWITCH
1102 003651 1102 1 %TEACHER
1103 003651 1103 -------------------------------------------------------
1104 003651 1104 2 %VARIABLES This command (if used)
1105 003651 1105 must precede all those > 2.
1106 003651 1106 -------------------------------------------------------
1107 003651 1107 3 %HELP These commands (if used)
1108 003651 1108 3 %PROCEDURE must precede all those > 3.
1109 003651 1109 -------------------------------------------------------
1110 003651 1110 4 %INITIALIZE This command (if used)
1111 003651 1111 must precede all those > 4.
1112 003651 1112 -------------------------------------------------------
1113 003651 1113 5 %LACK These commands (if used)
1114 003651 1114 5 %NEUTRAL must precede all those > 5.
1115 003651 1115 5 %QEND
1116 003651 1116 5 %QUESTION After %QUESTION, %RIGHTs
1117 003651 1117 5 %RIGHT precede %WRONGs (or %LACKs).
1118 003651 1118 5 %SAME %NEUTRALs can go anywhere..
1119 003651 1119 5 %TEXT Empty patterns of each type
1120 003651 1120 5 %WRONG should appear last.
1121 003651 1121 -------------------------------------------------------
1122 003651 1122 6 %FINISH This command (if used) must
1123 003651 1123 precede only the %END.
1124 003651 1124 -------------------------------------------------------
1125 003651 1125 7 %END This command must be last.
1126 003651 1126 =======================================================
1127 003651 1127
1128 003651 1128 Note: GNOSIS will accept some contextually awkward
1129 003651 1129 orderings of the answer pattern commands. For example,
1130 003651 1130 GNOSIS will accept %NEUTRAL at any point after %QUESTION
1131 003651 1131 even though, in the context of the lesson, that occurrence
1132 003651 1132 of %NEUTRAL may have unintended effects.
1133 003651 1133 -----------------------------------------------------------;
1134 003652 B71 1134 BEGIN
1135 003653 1135 BOOLEAN legalcommand;
1136 003655 1136 STRING ARRAY command [1:16];
1137 003662 1137 INTEGER i;
1138 003662 1138 command[1]:= "LAN";
1139 003673 1139 command[2]:= "TEA";
1140 003704 1140 command[3]:= "COP";
1141 003715 1141 command[4]:= "NOC";
1142 003726 1142 command[5]:= "NEX";
1143 003737 1143 command[6]:= "SGN";
1144 003750 1144 command[7]:= "SWI";
1145 003761 1145 command[8]:= "KEE";
1146 003772 1146 command[9]:= "LOC";
1147 004003 1147 command[10]:= "BEL";
1148 004014 1148 command[11]:= "NAM";
1149 004025 1149 command[12]:= "DIS";
1150 004036 1150 command[13]:= "DSK";
1151 004047 1151 command[14]:= "VAR";
1152 004060 1152 command[15]:= "HEL";
1153 004071 1153 command[16]:= "PRO";
1154 004102 1154 WHILE NOT legalcommand DO
1155 004104 B72 1155 BEGIN
1156 004106 1156 FOR i:= 1 STEP 1 UNTIL n DO
1157 004117 B73 1157 BEGIN
1158 004117 1158 IF controlstart = command[i] THEN
1159 004127 B74 1159 BEGIN
1160 004127 1160 errmess(FALSE,
1161 004127 1161 "1161: Command is out of place here. As a result,[N]****** this line up to next command line will be ignored.");
1162 004133 1162 getline;
1163 004143 1163 WHILE answer.[1] # controlchar DO getline;
1164 004146 1164 getcontrolstart(4);
1165 004151 1165 GOTO earlyexit
1166 004151 E74 1166 END
1167 004156 1167 ELSE IF i = n THEN legalcommand:= TRUE;
1168 004157 E73 1168 END;
1169 004157 1169 earlyexit:
1170 004171 E72 1170 END
1171 004172 E71 1171 END PR*CEDURE checkprecedence;
1172 004172 1172
1173 004172 1173
1174 004172 1174
1175 004174 1175 PROCEDURE putvariables;
1176 004174 1176 COMMENT -------------------------------------------------
1177 004174 1177 The translated GNOSIS lesson is prefaced by (1) a preamble
1178 004174 1178 of global variable declarations (output by "putvariables"),
1179 004174 1179 (2) a set of global PROCEDURE declarations (output by
1180 004174 1180 "putprocedures"), (3) a set of statements to initialize the
1181 004174 1181 value of global variables (output by "putvalues"), and (4) a
1182 004174 1182 lesson header (output by putheader) which does some
1183 004174 1183 additional initialization of I/O.
1184 004174 1184 -----------------------------------------------------------;
1185 004205 B75 1185 BEGIN
1186 004205 1186 Write("BEGIN");
1187 004210 1187 Write(" COMMENT: This is the lesson """);
1188 004213 1188 Write(lessonname);
1189 004216 1189 Write(""";;[N]");
1190 004221 1190 IF put AND teacher # "" THEN
1191 004231 B76 1191 BEGIN
1192 004231 1192 Write("COMMENT: This lesson was written by[N]");
1193 004234 1193 alglin(teacher);
1194 004237 1194 Write(";;");
1195 004237 1195 Newline
1196 004244 E76 1196 END;
1197 004244 1197 COMMENT -------------------------------------------------
1198 004244 1198 Output of data declarations follows.
1199 004244 1199 -----------------------------------------------------------;
1200 004244 1200 Write("BOOLEAN firsttry, ihaveblanked, nopause, skip, back, stop, message;;[N]");
1201 004247 1201 Write("INTEGER lasterrors, score, latescore, qcount, lastqcount, lastqkount, carriagereturn, linefeed, pos, blank;;[N]");
1202 004252 1202 Write("INTEGER lastscorecount, lastlatescorecount, lastscorekount, lastlatescorekount;;[N]");
1203 004255 1203 IF language = 2 THEN
1204 004260 B77 1204 BEGIN
1205 004260 1205 Write("INTEGER lcaa, lcae, lcoe, ucaa, ucae, ucoe;;[N]")
1206 004263 E77 1206 END;
1207 004263 1207 Write("INTEGER randno, answerlength, controlstart, controlg, uparrow;;[N]");
1208 004266 1208 Write("INTEGER lastrights;;[N]");
1209 004271 1209 Write("STRING answer, answercopy, char, endofline, lessonname, firstname, tempfile1, tempfile2, prompt;;[N]");
1210 004274 1210 Write("STRING ARRAY right, rightatlast, wrong[[0:9]];;[2N]");
1211 004277 E75 1211 END of PR*CEDURE putvariables;
1212 004277 1212
1213 004277 1213
1214 004300 1214 PROCEDURE putprocedures;
1215 004300 1215 COMMENT -------------------------------------------------
1216 004300 1216 'Putprocedures' is the second in a series of four procedures
1217 004300 1217 to output the lesson preface
1218 004300 1218 -----------------------------------------------------------;
1219 004311 B78 1219 BEGIN
1220 004313 1220 IF nocontrolc THEN Write("EXTERNAL PROCEDURE stopkc;;[2N]");
1221 004320 1221 IF transferlesson THEN Write("EXTERNAL PROCEDURE pub, nolpt, run, r;;[2N]");
1222 004320 1222
1223 004325 1223 IF put THEN Write("FORWARD PROCEDURE putaway;;[N]");
1224 004325 1224
1225 004330 1225 Write("FORWARD BOOLEAN PROCEDURE anywhere;;[2N]");
1226 004330 1226
1227 004333 1227 Write("PROCEDURE getline;;[N]");
1228 004336 1228 Write("COMMENT: 'Getline' reads in a line of text input by the student,[N]");
1229 004341 1229 Write("dumping it in the STRING 'answer'. Column one of the line is checked[N]");
1230 004344 1230 Write("to see if the student typed '%', indicating that he wanted[N]");
1231 004347 1231 Write("to interrupt the flow of the lesson;;[N]");
1232 004352 1232 Write("BEGIN[N]INTEGER s, t, i;;[N]BOOLEAN quit;;[N]");
1233 004355 1233 Write("Breakoutput;;[N]quit:= FALSE;;[N]");
1234 004360 1234 Write("[N]again:[N]FOR i:= 1 STEP 1 UNTIL 132 DO[N]");
1235 004363 1235 Write("BEGIN[N]Insymbol(t);;[N]");
1236 004366 1236 Write("COMMENT: Lower case transform;;[N]");
1237 004371 1237 Write("IF t >= 97 AND t <= 122 THEN t:= t-32");
1238 004377 1238 IF language = 1 THEN Write(";;[N]")
1239 004403 1239 ELSE IF language = 2 THEN
1240 004406 B79 1240 BEGIN
1241 004406 1241 Write(" ELSE[N]");
1242 004411 1242 Write("IF t = lcaa THEN t:= ucaa ELSE[N]");
1243 004414 1243 Write("IF t = lcae THEN t:= ucae ELSE[N]");
1244 004417 1244 Write("IF t = lcoe THEN t:= ucoe;;[N]")
1245 004422 E79 1245 END;
1246 004422 1246 Write("answer.[[i]]:= t;;[N]");
1247 004425 1247 Write("IF t = carriagereturn THEN GOTO out;;[N]");
1248 004430 1248 Write("END;;[N]");
1249 004433 1249 Write("GOTO again;;[N]");
1250 004436 1250 Write("[N]out:[N]Insymbol(t);;[N]i:= i+1;;[N]answer.[[i]]:= t;;[N]pos:= 1;;[N]answerlength:= i-2;;[N]");
1251 004441 1251 Write("IF answerlength < 0 THEN answerlength:= 0;;[N]");
1252 004444 1252 Write("Delete(answercopy);;[N]answercopy:= Copy(answer,1,i);;[N]");
1253 004447 1253 Write("ihaveblanked:= FALSE;;[N]");
1254 004452 1254 Write("IF answerlength = 1 THEN[N]");
1255 004455 1255 Write("BEGIN[N]IF answer.[[1]] = controlstart THEN[N]");
1256 004460 1256 IF language = 1 THEN
1257 004463 B80 1257 BEGIN
1258 004463 1258 Write("BEGIN[N]Write(""Answer 'STOP'"");;[N]");
1259 004470 1259 IF NOT lock THEN Write("Write("", 'SKIP', 'BACK', "");;[N]");
1260 004473 1260 Write("Write(""or 'CONTINUE'.[[N]]"");;[N]")
1261 004473 E80 1261 END
1262 004477 1262 ELSE IF language = 2 THEN
1263 004502 B81 1263 BEGIN
1264 004502 1264 Write("BEGIN[N]Write(""Svara """"STOPP"""" om Du vill l{mna lektionen,[[N]]"");;[N]");
1265 004507 1265 IF NOT lock THEN Write("Write(""""""SKIPPA"""" om Du vill skippa denna fr}ga,[[N]]"");;[N]");
1266 004514 1266 IF NOT lock THEN Write("Write(""""""BACKA"""" om Du vill g} tillbaka till en tidigare del av lektionen,[[N]]"");;[N]");
1267 004517 1267 Write("Write(""""""FORTS#TT"""" om Du vill forts{tta.[[N]]"");;[N]")
1268 004522 E81 1268 END;
1269 004524 1269 IF bell THEN Write("Outsymbol(controlg);;[N]");
1270 004527 1270 Write("Write(prompt);;[N]Breakoutput;;[N]");
1271 004532 1271 Write("quit:= TRUE;;[N]GOTO again;;[N]");
1272 004535 1272 Write("END;;[N]END;;[N]");
1273 004540 1273 Write("IF quit THEN[N]");
1274 004543 1274 Write("BEGIN[N]quit:= FALSE;;[N]IF anywhere(""");
1275 004551 1275 IF language = 1 THEN Write("STOP")
1276 004560 1276 ELSE IF language = 2 THEN Write("STOPP");
1277 004563 1277 Write(""") THEN[N]BEGIN[N]");
1278 004566 1278 Write("stop:= TRUE;;[N]");
1279 004574 1279 IF language = 1 THEN Write("Write(""Lesson aborted."");;[N]") ELSE
1280 004603 1280 IF language = 2 THEN Write("Write(""Lektionen avbr`t.[[N]]"");;[N]");
1281 004606 1281 Write("GOTO exit;;[N]END;;[N]");
1282 004611 1282 Write("pos:= 1;;[N]IF anywhere(""");
1283 004617 1283 IF language = 1 THEN Write("SKIP")
1284 004626 1284 ELSE IF language = 2 THEN Write("SKIPPA");
1285 004631 1285 Write(""") THEN[N]");
1286 004634 1286 Write("BEGIN[N]Write(""");
1287 004637 1287 IF NOT lock THEN
1288 004641 B82 1288 BEGIN
1289 004644 1289 IF language = 1 THEN Write("Question skipped.")
1290 004653 1290 ELSE IF language = 2 THEN Write("Fr}gan skippad.");
1291 004656 1291 Write("[[N]]"");;[N]skip:= TRUE;;[N]")
1292 004656 E82 1292 END
1293 004661 1293 ELSE
1294 004662 B83 1294 BEGIN
1295 004665 1295 IF language = 1 THEN Write("??? Skipping not allowed in this lesson.")
1296 004674 1296 ELSE IF language = 2 THEN Write("???");
1297 004677 1297 Write("[[N]]"");;[N]")
1298 004702 E83 1298 END;
1299 004702 1299 Write("END[N]ELSE[N]BEGIN[N]");
1300 004705 1300 Write("pos:= 1;;[N]IF anywhere(""");
1301 004713 1301 IF language = 1 THEN Write("BACK")
1302 004722 1302 ELSE IF language = 2 THEN Write("BACKA");
1303 004725 1303 Write(""") THEN[N]");
1304 004730 1304 Write("BEGIN[N]Write(""");
1305 004733 1305 IF NOT lock THEN
1306 004735 B84 1306 BEGIN
1307 004740 1307 IF language = 1 THEN Write("Lesson is backing.")
1308 004747 1308 ELSE IF language = 2 THEN Write("Lektionen g}r tillbaka.");
1309 004752 1309 Write("[[N]]"");;[N]back:= TRUE;;[N]")
1310 004752 E84 1310 END
1311 004755 1311 ELSE
1312 004756 B85 1312 BEGIN
1313 004761 1313 IF language = 1 THEN Write("??? Backing not allowed in this lesson.")
1314 004770 1314 ELSE IF language = 2 THEN Write("???");
1315 004773 1315 Write("[[N]]"");;[N]")
1316 004776 E85 1316 END;
1317 004776 1317 Write("END[N]ELSE[N]BEGIN[N]");
1318 005001 1318 IF language = 1 THEN
1319 005004 B86 1319 BEGIN
1320 005004 1320 Write("Write(""Please continue, then, giving your response[[N]]"");;[N]");
1321 005007 1321 Write("Write(""to the PREVIOUS '-->' or 'RETURN' prompt...[[N]]"");;[N]")
1322 005007 E86 1322 END
1323 005013 1323 ELSE IF language = 2 THEN
1324 005016 1324 Write("Write(""Du vill inte avbryta nu. Forts{tt d} med ditt ordinarie svar.[[N]]"");;[N]");
1325 005021 1325 Write("GOTO again;;[N]");
1326 005024 1326 Write("END;;[N]END;;[N]");
1327 005027 1327 Write("END;;[2N]exit:[N]END;;[2N]");
1328 005027 1328
1329 005032 1329 Write("BOOLEAN PROCEDURE here(comp);;[N]VALUE comp;;[N]STRING comp;;[N]");
1330 005035 1330 Write("COMMENT: 'Here' determines whether the argument string can be found[N]");
1331 005040 1331 Write("beginning at 'pos' in the student answer. Blanks, but nothing[N]");
1332 005043 1332 Write("else, may precede the matching word. 'Here' is mostly used[N]");
1333 005046 1333 Write("for answers matched in the %NOEXTRA mode;;[N]");
1334 005051 1334 Write("BEGIN[N]INTEGER cpos;;[N]");
1335 005054 1335 Write("[N]blankline:[N]IF answercopy.[[pos]] = blank THEN[N]");
1336 005057 1336 Write("BEGIN[N]pos:= pos+1;;[N]GOTO blankline;;[N]");
1337 005062 1337 Write("END;;[N]");
1338 005065 1338 Write("FOR cpos:= 1 STEP 1 UNTIL Length(comp) DO[N]");
1339 005070 1339 Write("BEGIN[N]");
1340 005073 1340 Write("IF answercopy.[[pos]] # comp.[[cpos]] THEN GOTO nofit;;[N]");
1341 005076 1341 Write("pos:= pos+1;;[N]");
1342 005101 1342 Write("END;;[N]");
1343 005104 1343 Write("here:= TRUE;;[N]GOTO out;;[N]");
1344 005107 1344 Write("[N]nofit:[N]here:= FALSE;;[N]");
1345 005112 1345 Write("[N]out:[N]END;;[2N]");
1346 005112 1346
1347 005115 1347 Write("BOOLEAN PROCEDURE anywhere(comp);;[N]VALUE comp;;[N]STRING comp;;[N]");
1348 005120 1348 Write("COMMENT: 'Anywhere' determines whether the argument string can be [N]");
1349 005123 1349 Write("found anywhere in the student answer after 'pos'. Blanks and[N]");
1350 005126 1350 Write("unmatched strings will be bypassed. 'Anywhere' is used in[N]");
1351 005131 1351 Write("the %EXTRA mode and in the %NOEXTRA %NOORDER mode.[N]");
1352 005134 1352 Write("'Anywhere' will substitute blanks for all characters in[N]");
1353 005137 1353 Write("the matched strings. This allows the program (e.g., in the[N]");
1354 005142 1354 Write("%NOEXTRA mode) to determine whether there are[N]");
1355 005145 1355 Write("any non-blank characters in the student answer. In the[N]");
1356 005150 1356 Write("%NOEXTRA mode, his answer will be wrong if any non-blank characters remain;;[N]");
1357 005153 1357 Write("BEGIN[N]INTEGER cpos, nextpos;;[N]");
1358 005156 1358 Write("[N]blankline:[N]IF answercopy.[[pos]] = blank THEN[N]");
1359 005161 1359 Write("BEGIN[N]pos:= pos+1;;[N]GOTO blankline;;[N]");
1360 005164 1360 Write("END;;[N]");
1361 005167 1361 Write("nextpos:= pos+1;;[N]");
1362 005172 1362 Write("FOR cpos:= 1 STEP 1 UNTIL Length(comp) DO[N]");
1363 005175 1363 Write("BEGIN[N]");
1364 005200 1364 Write("IF answercopy.[[pos]] # comp.[[cpos]] THEN GOTO nofit;;[N]");
1365 005203 1365 Write("pos:= pos+1;;[N]");
1366 005206 1366 Write("END;;[N]");
1367 005211 1367 Write("FOR cpos:= pos-Length(comp) STEP 1 UNTIL pos-1 DO[N]");
1368 005214 1368 Write("BEGIN[N]answercopy.[[cpos]]:= blank;;[N]");
1369 005217 1369 Write("END;;[N]");
1370 005222 1370 Write("anywhere:= ihaveblanked:= TRUE;;[N]GOTO out;;[N]");
1371 005225 1371 Write("[N]nofit:[N]IF answercopy.[[pos]] # carriagereturn THEN[N]");
1372 005230 1372 Write("BEGIN[N]pos:= nextpos;;[N]GOTO blankline;;[N]");
1373 005233 1373 Write("END;;[N]");
1374 005236 1374 Write("anywhere:= FALSE;;[N]");
1375 005241 1375 Write("[N]out:[N]END;;[2N]");
1376 005241 1376
1377 005244 1377 Write("PROCEDURE restore;;[N]");
1378 005247 1378 Write("COMMENT: Since 'anywhere' substitutes blanks for matched parts of the student[N]");
1379 005252 1379 Write("answer, the original response must be restored before comparing[N]");
1380 005255 1380 Write("it to other target patterns. This restoration is done here;;[N]");
1381 005260 1381 Write("BEGIN[N]ihaveblanked:= FALSE;;[N]");
1382 005263 1382 Write("Delete(answercopy);;[N]answercopy:= Copy(answer,1,answerlength+2);;[N]");
1383 005266 1383 Write("END;;[2N]");
1384 005271 1384 Write("INTEGER PROCEDURE random;;[N]");
1385 005274 1385 Write("COMMENT: 'Random' is a number generator which gives a random[N]");
1386 005277 1386 Write("number between 0 and 9. The generator will not repeat[N]");
1387 005302 1387 Write("itself until after 862 generations;;[N]");
1388 005305 1388 Write("BEGIN[N]");
1389 005310 1389 Write("randno:= randno*10 rem 863;;[N]");
1390 005313 1390 Write("random:= randno div 87;;[N]");
1391 005316 1391 Write("END;;[2N]");
1392 005316 1392
1393 005321 1393 Write("PROCEDURE personalize(message);;[N]VALUE message;;[N]STRING message;;[N]");
1394 005324 1394 Write("COMMENT: 'Personalize' uses the student's firstname in conversational[N]");
1395 005327 1395 Write("I/O to give a personal touch to the lessons. To avoid monotony[N]");
1396 005332 1396 Write("and to further efficiency, the probability that the message will be[N]");
1397 005335 1397 Write("personalized is only .2;;[N]");
1398 005340 1398 Write("BEGIN[N]IF firstname = """" OR random < 8 THEN Write(message)[N]");
1399 005343 1399 Write("ELSE BEGIN[N]INTEGER i, j;;[N]i:= 1;;[N]j:= Length(message);;[N]");
1400 005346 1400 Write("WHILE i < j DO[N]BEGIN[N]Outsymbol(message.[[i]]);;i:= i + 1;;[N]END;;[N]");
1401 005351 1401 Write("Write("", "");;[N]Write(firstname);;[N]Outsymbol(message.[[j]]);;[N]");
1402 005354 1402 Write("END;;[N]END;;[2N]");
1403 005354 1403
1404 005354 1404
1405 005357 1405 Write("PROCEDURE rightmessage;;[N]");
1406 005362 1406 Write("COMMENT: 'Rightmessage' is called when a student has[N]");
1407 005365 1407 Write("made a correct answer. He is told about this, and the[N]");
1408 005370 1408 Write("score is updated. The message to the student is different[N]");
1409 005373 1409 Write("depending on whether he succeeds on the fist try or[N]");
1410 005376 1410 Write("only after previous fruitless attempts. Random numbers are[N]");
1411 005401 1411 Write("used to choose between ten different messages to give[N]");
1412 005404 1412 Write("some variation to the conversation;;[N]");
1413 005407 1413 Write("BEGIN[N]");
1414 005412 1414 Write("lastrights:= lastrights+1;;[N]");
1415 005415 1415 Write("IF firsttry THEN[N]");
1416 005420 1416 Write("BEGIN[N]score:= score+1;;[N]qcount:= qcount+1;;[N]firsttry:= FALSE;;[N]");
1417 005423 1417 Write("personalize(right[[random]]);;[N]");
1418 005426 1418 Write(
1419 005426 1419 "END[N]ELSE[N]BEGIN[N]personalize(right[[random]]);;[N]IF lasterrors > 1 THEN Write(rightatlast[[random]]);;[N]END;;[N]");
1420 005431 1420 IF language = 1 THEN
1421 005434 B87 1421 BEGIN
1422 005434 1422 Write("IF lasterrors > 3 THEN[N]BEGIN[N]");
1423 005437 1423 Write("personalize(""[[N]]I must admit that last one was a bit tricky!"");;[N]");
1424 005442 1424 Write("Newline;;[N]END;;[N]");
1425 005445 E87 1425 END;
1426 005445 1426 Write("latescore:= latescore+1;;[N]Newline;;[N]");
1427 005450 1427 Write("END;;[2N]");
1428 005450 1428
1429 005453 1429 Write("PROCEDURE wrongmessage;;[N]");
1430 005456 1430 Write("COMMENT: 'Wrongmessage' is called when a student[N]");
1431 005461 1431 Write("has made an erroneous answer. He is told about this,[N]");
1432 005464 1432 Write("and the lesson statistics are updated. Random numbers[N]");
1433 005467 1433 Write("are used to choose between ten different messages in order[N]");
1434 005472 1434 Write("provide some variation in the conversation;;[N]");
1435 005475 1435 Write("BEGIN[N]");
1436 005500 1436 Write("lasterrors:= lasterrors+1;;[N]");
1437 005503 1437 Write("IF firsttry THEN[N]");
1438 005506 1438 Write("BEGIN[N]qcount:= qcount+1;;[N]firsttry:= FALSE;;[N]");
1439 005511 1439 Write("END;;[N]");
1440 005514 1440 Write("personalize(wrong[[random]]);;[N]Newline;;[N]");
1441 005517 1441 Write("END;;[2N]");
1442 005517 1442
1443 005517 1443
1444 005522 1444 Write("PROCEDURE pause;;[N]");
1445 005525 1445 Write("COMMENT: Lesson text is given to the student in small portions.[N]");
1446 005530 1446 Write("One reason for this is that it is easier to read a little[N]");
1447 005533 1447 Write("at a time. Another reason is that display terminals have[N]");
1448 005536 1448 Write("a limited screen size. The 'pause' PROCEDURE produces a pause[N]");
1449 005541 1449 Write("in the display of text to the student, and she can continue[N]");
1450 005544 1450 Write("whenever she has finished examining the displayed material.[N]");
1451 005547 1451 Write("To go on, she simply pushes the 'RETURN' key. Normally, this[N]");
1452 005552 1452 Write("PROCEDURE is called between each %TEXT or %QUESTION,[N]");
1453 005555 1453 Write("but GNOSIS will introduce ADDITIONAL automatic pause points[N]");
1454 005560 1454 Write("within large blocks of text or question material.[N]");
1455 005563 1455 Write("The teacher can inhibit pauses BETWEEN '%' commands by 'nopause:= TRUE', but[N]");
1456 005566 1456 Write("the pauses which GNOSIS inserts in long text blocks cannot be inhibited;;[N]");
1457 005571 1457 Write("IF nopause THEN nopause:= FALSE ELSE[N]");
1458 005574 1458 Write("BEGIN[2N][N]");
1459 005602 1459 IF language = 1 THEN Write("Write(""[[N]]Push RETURN "");;[N]") ELSE
1460 005611 1460 IF language = 2 THEN Write("Write(""[[N]]Tryck RETURN "");;[N]");
1461 005614 1461 Write("write(prompt);;[N]");
1462 005621 1462 IF bell THEN Write("Outsymbol(controlg);;[N]");
1463 005624 1463 Write("getline;;[N]Newline;;[N]");
1464 005627 1464 Write("IF stop THEN[N]BEGIN[N]stop:= FALSE;;[N]GOTO endoflesson[N]END;;[N]");
1465 005632 1465 Write("IF answerlength > 0 THEN[N]");
1466 005635 1466 Write("BEGIN[N]pos:= 1;;[N]");
1467 005640 1467 Write("IF NOT here(endofline) THEN[N]BEGIN[N]");
1468 005646 1468 IF language = 1 THEN textline("Eh? The computer expected you would just push the RETURN button.") ELSE
1469 005655 1469 IF language = 2 THEN textline("??? Datorn v{ntade sig bara RETURN fr}n Dig.");
1470 005660 1470 Write("END;;[N]END;;[N]");
1471 005663 1471 Write("END;;[2N]");
1472 005663 1472
1473 005666 1473 Write("PROCEDURE page;;[N]");
1474 005671 1474 Write("COMMENT: 'Page' can be called by the teacher when he[N]");
1475 005674 1475 Write("wants to blank the screen on a display terminal).[N]");
1476 005677 1476 Write("The effect produced is, of course, terminal dependent;;[N]");
1477 005702 1477 Write("BEGIN[N]pause;;[N]Outsymbol(12);;[N]Outsymbol(12);;[N]Newline;;[N]");
1478 005705 1478 Write("END;;[2N]");
1479 005705 1479
1480 005710 1480 Write("PROCEDURE extratest;;[N]");
1481 005713 1481 Write("COMMENT: 'Extratest' will flag and display those parts of the student answer [N]");
1482 005716 1482 Write("which WERE matched by the teacher answer pattern IF the[N]");
1483 005721 1483 Write("student response contained extra (i.e., superfluous) characters[N]");
1484 005724 1484 Write("'Extratest' is called automatically for %RIGHT answers in the[N]");
1485 005727 1485 Write("%EXTRA mode. Recall that 'here' scans past leading blanks;;[N]");
1486 005732 1486 Write("BEGIN[N]");
1487 005735 1487 Write("pos:= 1;;[N]IF NOT here(endofline) THEN[N]");
1488 005740 1488 Write("BEGIN[N]Newline;;[N]");
1489 005743 1489 Write("FOR pos:= 1 STEP 1 UNTIL answerlength + 2 DO Outsymbol(answer.[[pos]]);;[N]");
1490 005746 1490 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO[N]");
1491 005751 1491 Write("IF answercopy.[[pos]] = blank AND answer.[[pos]] # blank THEN Outsymbol(uparrow) ELSE Outsymbol(blank);;[N]");
1492 005754 1492 Write("Newline;;[N]Newline;;[N]");
1493 005757 1493 Write("END;;[N]");
1494 005762 1494 Write("END;;[2N]");
1495 005762 1495
1496 005765 1496 Write("REAL PROCEDURE percent;;[N]");
1497 005770 1497 Write("COMMENT: 'Percent' returns the percentage of questions answered correctly[N]");
1498 005773 1498 Write("by the student on his very first try since the start of the lesson;;[N]");
1499 005776 1499 Write("percent:= IF qcount = 0 or score = 0 THEN 0.0 ELSE 100.0 * score/qcount;;[2N]");
1500 005776 1500
1501 006001 1501 Write("REAL PROCEDURE latepercent;;[N]");
1502 006004 1502 Write("COMMENT: 'Latepercent' returns the percentage of questions answered correctly[N]");
1503 006007 1503 Write("by the student since the start of the lesson whether[N]");
1504 006012 1504 Write("student was correct on the first try or afterward;;[N]");
1505 006015 1505 Write("latepercent:= IF qcount = 0 or latescore = 0 THEN 0.0 ELSE 100.0 * latescore/qcount;;[2N]");
1506 006015 1506
1507 006020 1507 Write("INTEGER PROCEDURE lastscore;;[N]");
1508 006023 1508 Write("COMMENT: 'Lastscore' returns number of questions answered correctly on the[N]");
1509 006026 1509 Write("very first try since this PROCEDURE was last called;;[N]");
1510 006031 1510 Write("BEGIN[N]lastscore:= score - lastscorecount;;[N]lastscorecount:= score[N]END;;[2N]");
1511 006031 1511
1512 006034 1512 Write("INTEGER PROCEDURE lastlatescore;;[N]");
1513 006037 1513 Write("COMMENT: 'Lastlatescore' returns number of questions answered correctly[N]");
1514 006042 1514 Write("since this PROCEDURE was last called whether student was correct on the[N]");
1515 006045 1515 Write("very first try or afterward;;[N]");
1516 006050 1516 Write("BEGIN[N]lastlatescore:= latescore - lastlatescorecount;;[N]lastlatescorecount:= latescore[N]END;;[2N]");
1517 006050 1517
1518 006053 1518 Write("REAL PROCEDURE lastpercent;;[N]");
1519 006056 1519 Write("COMMENT: 'Lastpercent' returns the percentage of questions answered correctly[N]");
1520 006061 1520 Write("on the very first try since this PROCEDURE was last called;;[N]");
1521 006064 1521 Write("BEGIN[N]INTEGER x;;[N]");
1522 006067 1522 Write("x:= score - lastscorekount;;[N]lastscorekount:= score;;[N]lastqcount:= qcount - lastqcount;;[N]");
1523 006072 1523 Write("lastpercent:= IF lastqcount = 0 or x = 0 THEN 0.0 ELSE 100.0 * x/lastqcount;;[N]");
1524 006075 1524 Write("END;;[2N]");
1525 006075 1525
1526 006100 1526 Write("REAL PROCEDURE lastlatepercent;;[N]");
1527 006103 1527 Write("COMMENT: 'Lastlatepercent' returns the percentage of questions answered correctly[N]");
1528 006106 1528 Write("since this PROCEDURE was last called whether student was correct on the first try[N]");
1529 006111 1529 Write("or afterward;;[N]");
1530 006114 1530 Write("BEGIN[N]INTEGER x;;[N]");
1531 006117 1531 Write("x:= latescore - lastlatescorekount;;[N]lastlatescorekount:= latescore;;[N]lastqkount:= qcount - lastqkount;;[N]");
1532 006122 1532 Write("lastlatepercent:= IF lastqkount = 0 or x = 0 THEN 0.0 ELSE 100.0 * x/lastqkount;;[N]");
1533 006125 1533 Write("END;;[2n]");
1534 006130 1534 IF put THEN
1535 006132 B88 1535 BEGIN
1536 006132 1536
1537 006132 1537 Write("PROCEDURE putaway(question);;[N]");
1538 006135 1538 Write("COMMENT: If the lesson contained a report-generating command,[N]");
1539 006140 1539 Write("then unexpected student answers are written into a pair of reports,[N]");
1540 006143 1540 Write("<lessonname>.DTA and <lessonname>.SRT, which the teacher can use to improve the[N]");
1541 006146 1541 Write("lesson. 'Putaway' writes the unexpected answers in these files;;[N]");
1542 006151 1542 Write("VALUE question;;[N]STRING question;;[N]");
1543 006154 1543 Write("BEGIN[N]INTEGER i;;[N]");
1544 006157 1544 Write("Breakoutput;;[N]");
1545 006162 1545 Write("Selectoutput(2);;[N]");
1546 006165 1546 Write("Write(question);;[N]Write("": "");;[N]");
1547 006170 1547 Write("FOR i:= 1 STEP 1 UNTIL answerlength DO Outsymbol(answer.[[i]]);;[N]");
1548 006173 1548 Write("Newline;;[N]");
1549 006176 1549 Write("Breakoutput;;[N]");
1550 006201 1550 Write("Selectoutput(3);;[N]");
1551 006204 1551 Write("Write(question);;[N]Write("": "");;[N]");
1552 006207 1552 Write("FOR i:= 1 STEP 1 UNTIL answerlength DO Outsymbol(answer.[[i]]);;[N]");
1553 006212 1553 Write("Newline;;[N]");
1554 006215 1554 Write("Breakoutput;;[N]");
1555 006220 1555 Write("Selectoutput(0);;[N]");
1556 006223 1556 Write("END;;[2N]");
1557 006226 1557 IF teacher # "" THEN
1558 006233 B89 1558 BEGIN
1559 006233 1559
1560 006233 1560 Write("PROCEDURE putmessage;;[N]");
1561 006236 1561 Write("COMMENT: If no disk files are being generated for teacher reports,[N]");
1562 006241 1562 Write("'Putmessage' will tell the student to send hardcopy reports [N]");
1563 006244 1563 Write("to the teacher -- unless no teacher's name and address[N]");
1564 006247 1564 Write("was supplied with %TEACHER command);;[N]");
1565 006252 1565 Write("BEGIN[N]");
1566 006255 1566 IF language = 1 THEN
1567 006260 B90 1567 BEGIN
1568 006260 1568 textline("He needs the listing to improve the lesson.");
1569 006265 1569 IF NOT name THEN textline("You can send it anonymously - the teacher will");
1570 006272 1570 IF NOT name THEN textline("not know which student sent it to him.");
1571 006275 1571 Write("Newline;;[N]");
1572 006300 1572 textline("The name and address of the teacher is:")
1573 006300 E90 1573 END
1574 006304 1574 ELSE IF language = 2 THEN
1575 006307 B91 1575 BEGIN
1576 006307 1576 textline("Han beh`ver den f`r att kunna g`ra lektionen b{ttre.");
1577 006314 1577 IF NOT name THEN textline("Du kan s{nda den anonymt - l{raren beh`ver inte veta");
1578 006321 1578 IF NOT name THEN textline("vilken elev som s{nde den till honom.");
1579 006324 1579 Write("Newline;;[N]");
1580 006327 1580 textline("L{rarens namn och adress {r:")
1581 006332 E91 1581 END;
1582 006332 1582 textline(teacher);
1583 006335 1583 Write("Newline;;[N]END;;[2N]")
1584 006335 E89 1584 END
1585 006340 E88 1585 END;
1586 006340 1586
1587 006340 1587 Write("PROCEDURE noanswer;;[N]");
1588 006343 1588 Write("BEGIN[N]");
1589 006346 1589 IF language = 1 THEN
1590 006351 B92 1590 BEGIN
1591 006351 1591 Write("personalize(""??? You gave no answer at all."");;[N]Newline;;[N]");
1592 006354 1592 Write("Write(""If you want to interrupt the lesson, then type the single character """"")
1593 006354 E92 1593 END
1594 006360 1594 ELSE IF language = 2 THEN
1595 006363 B93 1595 BEGIN
1596 006363 1596 Write("personalize(""??? Du gav inget svar alls."");;[N]Newline;;[N]");
1597 006366 1597 Write("Write(""Om Du vill g} ut ur fr}gan, s} skriv det enda tecknet """"")
1598 006371 E93 1598 END;
1599 006371 1599 Outsymbol(controlchar);
1600 006374 1600 Write(""""".[[N]]"");;[N]");
1601 006377 1601 Write("end noanswer;;[2N]");
1602 006377 1602
1603 006402 1603 Write("PROCEDURE tryagain;;[N]");
1604 006405 1604 Write("COMMENT: Questions output to students who give no answer, a wrong[N]");
1605 006410 1605 Write("answer, or an incomplete answer are usually repeated by GNOSIS.[N]");
1606 006413 1606 Write("'Tryagain' will output to such students a 'try again' message[N]");
1607 006416 1607 Write("which varies according to circumstances. In %NEUTRAL mode,[N]");
1608 006421 1608 Write("the message will always be 'Please try again'. Otherwise,[N]");
1609 006424 1609 Write("the content of the message depends on the number of times[N]");
1610 006427 1610 Write("the student has failed to give a correct response;;[N]");
1611 006432 1611 IF language = 1 THEN
1612 006435 B94 1612 BEGIN
1613 006435 1613 Write("BEGIN[N]Newline;;[N]");
1614 006440 1614 Write("personalize(""Please try again."");;[N]");
1615 006443 1615 Write("IF lasterrors = 3 THEN Write(""[[N]]You have at least eliminated some of the possibilities."") ELSE[N]");
1616 006446 1616 Write("IF lasterrors = 4 THEN Write(""[[N]](You might want to rethink some of your previous answers.)"") ELSE[N]");
1617 006451 1617 Write("IF lasterrors > 4 THEN Write(""[[N]]Or...interrupt the lesson by typing the symbol """"");
1618 006454 1618 Outsymbol(controlchar);
1619 006457 1619 Write("""""."");;[N]");
1620 006462 1620 Write("Newline;;[N]Newline;;[N]");
1621 006465 1621 Write("END;;[2N]")
1622 006465 E94 1622 END
1623 006471 1623 ELSE IF language = 2 THEN
1624 006474 B95 1624 BEGIN
1625 006474 1625 Write("BEGIN[N]Newline;;[N]");
1626 006477 1626 Write("personalize(""F`rs`k igen."");;[N]");
1627 006502 1627 Write("IF lasterrors = 3 THEN Write(""[[N]]Ddu har eliminerat flera m`jligheter redan."") ELSE[N]");
1628 006505 1628 Write("IF lasterrors > 3 THEN Write(""[[N]]Eller...avbryt lektionen genom att skriva symbolen """"");
1629 006510 1629 Outsymbol(controlchar);
1630 006513 1630 Write("""""."");;[N]");
1631 006516 1631 Write("[N]Newline;;[N]Newline;;[N]END;;[2N]")
1632 006521 E95 1632 END;
1633 006521 1633
1634 006521 1634 Write("PROCEDURE giveanswer;;[N]");
1635 006524 1635 Write("COMMENT: 'Giveanswer' displays a right answer to a student who is skipping[N]");
1636 006527 1636 Write("the question or who repeatedly fails to give a right answer.[N]");
1637 006532 1637 Write("The answer given will always be the one following the FIRST[N]");
1638 006535 1638 Write("%RIGHT command for the preceding %QUESTION;;[N]");
1639 006540 1639 Write("BEGIN[N]");
1640 006543 1640 IF language = 1 THEN
1641 006546 B96 1641 BEGIN
1642 006546 1642 Write("Newline;;[N]personalize(""Just for the record,"");;[N]");
1643 006551 1643 Write("Write("" GNOSIS will simulate an acceptable answer:[[2N]]-->"");;[N]");
1644 006554 E96 1644 END
1645 006555 1645 ELSE IF language = 2 THEN
1646 006560 B97 1646 BEGIN
1647 006560 1647 Write("Newline;;[N]personalize(""F`r den h{ndelse du {r intresserad,"");;[N]");
1648 006563 1648 Write("Write("" h{r {r ett svar[[N]]"");;[N]");
1649 006566 1649 Write("Write(""vilket skulle ha varit acceptabelt:[2N]-->"");;[N]")
1650 006571 E97 1650 END;
1651 006571 1651 Write("END;;[N]");
1652 006574 E78 1652 END of PR*CEDURE putprocedures;
1653 006574 1653
1654 006574 1654
1655 006575 1655 PROCEDURE putvalues;
1656 006575 1656 COMMENT -------------------------------------------------
1657 006575 1657 'Putvalues' writes code which handles the initialization of
1658 006575 1658 variables before the start of the lesson. This is phase
1659 006575 1659 three of the preface output routines.
1660 006575 1660 -----------------------------------------------------------;
1661 006605 B98 1661 BEGIN
1662 006605 1662 Write(
1663 006605 1663 "[4N]lasterrors:= latescore:= score:= lastqcount:= lastqkount:= qcount:= 0;;[N]carriagereturn:= 13;;[N]linefeed:= 10;;[N]");
1664 006610 1664 Write("lastrights:= lastscorecount:= lastscorekount:= lastlatescorecount:= lastlatescorekount:= 0;;[N]");
1665 006613 1665 Write("blank:= "" "".[[1]];;uparrow:= ""^"".[[1]];;[N]controlg:="""".[[1]];;[N]");
1666 006616 1666 IF language = 2 THEN
1667 006621 B99 1667 BEGIN
1668 006621 1668 Write("ucaa:= ""$"".[[1]];;[N]ucae:= ""#"".[[1]];;[N]ucoe:= ""@"".[[1]];;[N]");
1669 006624 1669 Write("lcaa:= ""}"".[[1]];;[N]lcae:= ""{"".[[1]];;[N]lcoe:= ""`"".[[1]];;[N]")
1670 006627 E99 1670 END;
1671 006627 1671 Write("answer:= Newstring(135,7);;[N]answercopy:= Copy("" "");;[N]firstname:= """";;[N]prompt:= Copy(""-->"");;[N]");
1672 006632 1672 Write("answer.[[134]]:= carriagereturn;;[N]answer.[[135]]:= linefeed;;[N]");
1673 006635 1673 Write("char:= Newstring(1,7);;[N]");
1674 006640 1674 Write("endofline:= Newstring(1,7);;[N]endofline.[[1]]:= carriagereturn;;[N]");
1675 006643 1675 Write("randno:= 1;;[N]nopause:= skip:= message:= FALSE;;[N]");
1676 006646 1676 Write("controlstart:= """);
1677 006651 1677 Outsymbol(controlchar);
1678 006654 1678 Write(""".[[1]];;[N]");
1679 006657 1679 Write("lessonname:= """);
1680 006662 1680 Write(lessonname);
1681 006665 1681 Write(""";;[N]");
1682 006670 B100 1682 BEGIN
1683 006670 1683 COMMENT -------------------------------------------------
1684 006670 1684 Here the 30 STRINGs with different responses to right and
1685 006670 1685 wrong student answers are initialized. A simple PROCEDURE
1686 006670 1686 "m" is used to simplify the repetitive part of this
1687 006670 1687 initialization.
1688 006670 1688 -----------------------------------------------------------;
1689 006671 1689 INTEGER type, index;
1690 006671 1690 STRING arrayname;
1691 006671 1691
1692 006671 1692
1693 006671 1693
1694 006677 1694 PROCEDURE m(message);
1695 006703 1695 STRING message;
1696 006704 B101 1696 BEGIN
1697 006704 1697 IF index = 9 THEN
1698 006710 B102 1698 BEGIN
1699 006710 1699 index:= 0;
1700 006711 1700 type:= type+1;
1701 006717 1701 IF type = 1 THEN arrayname:= "right" ELSE
1702 006733 1702 IF type = 2 THEN arrayname:= "rightatlast" ELSE
1703 006747 1703 IF type = 3 THEN arrayname:= "wrong"
1704 006760 E102 1704 END ELSE index:= index+1;
1705 006763 1705 Write(arrayname);
1706 006766 1706 Write("[[");
1707 006771 1707 Print(index,1);
1708 006775 1708 Write("]]:= """);
1709 007000 1709 Write(message);
1710 007003 1710 Write(""";;[N]")
1711 007006 E101 1711 END of PR*CEDURE m;
1712 007006 1712
1713 007007 1713 type:= 0;
1714 007010 1714 index:= 9;
1715 007012 1715 IF language = 1 THEN
1716 007015 B103 1716 BEGIN
1717 007015 1717 m("Good for you!");
1718 007020 1718 m("Very good.");
1719 007023 1719 m("Sure!");
1720 007026 1720 m("Bravo!");
1721 007031 1721 m("Exactly right!");
1722 007034 1722 m("Right!");
1723 007037 1723 m("Well done!");
1724 007042 1724 m("That's it!");
1725 007045 1725 m("Excellent!");
1726 007050 1726 m("OK!");
1727 007053 1727 m(" You're doing better!");
1728 007056 1728 m(" Now you're catching on!");
1729 007061 1729 m(" You're improving!");
1730 007064 1730 m(" Yo've got the idea now!");
1731 007067 1731 m(" I knew you could do it.");
1732 007072 1732 m(" There is hope for you after all!");
1733 007075 1733 m(" You're making progress.");
1734 007100 1734 m(" Aren't you glad you kept trying?");
1735 007103 1735 m(" Keep up the good work!");
1736 007106 1736 m(" You've got the hang of it now.");
1737 007111 1737 m("Wrong!");
1738 007114 1738 m("No!");
1739 007117 1739 m("You gave the wrong answer.");
1740 007122 1740 m("Your answer was wrong.");
1741 007125 1741 m("Incorrect!");
1742 007130 1742 m("No, you're wrong this time.");
1743 007133 1743 m("Sorry.");
1744 007136 1744 m("That wasn't correct.");
1745 007141 1745 m("You're mistaken.");
1746 007144 1746 m("No, you missed this one.")
1747 007144 E103 1747 END
1748 007150 1748 ELSE IF language = 2 THEN
1749 007153 B104 1749 BEGIN
1750 007153 1750 m("Bra gjort!");
1751 007156 1751 m("Mycket bra.");
1752 007161 1752 m("Javisst!");
1753 007164 1753 m("Utm{rkt!");
1754 007167 1754 m("Precis r{tt.");
1755 007172 1755 m("R{tt!");
1756 007175 1756 m("Korrekt.");
1757 007200 1757 m("Du svarade r{tt igen.");
1758 007203 1758 m("Bra!");
1759 007206 1759 m("OK!");
1760 007211 1760 m(" Just det - Du klarar dig b{ttre nu.");
1761 007214 1761 m(" Nu b`rjar Du fatta!");
1762 007217 1762 m(" B{ttre och b{ttre!");
1763 007222 1763 m(" Nu har Du fattat det hela!");
1764 007225 1764 m(" Javisst! Nu klarar Du det h{r.");
1765 007230 1765 m(" S}ja, till slut g}r det bra!");
1766 007233 1766 m(" Du g`r framsteg.");
1767 007236 1767 m(" #ntligen r{tt!");
1768 007241 1768 m(" Bra! Forts{tt p} det s{ttet.");
1769 007244 1769 m(" Just det. Bara man anstr{nger sig lite s} g}r det bra.");
1770 007247 1770 m("Fel!");
1771 007252 1771 m("Nej!");
1772 007255 1772 m("Du valde fel svar.");
1773 007260 1773 m("Ditt svar var felaktigt.");
1774 007263 1774 m("Det {r inte r{tt!");
1775 007266 1775 m("Nej, den h{r g}ngen svarade Du fel.");
1776 007271 1776 m("Tyv{rr inte r{tt.");
1777 007274 1777 m("Det d{r {r inte riktigt.");
1778 007277 1778 m("Nej, inte riktigt s}.");
1779 007302 1779 m("Nej, den fr}gan missade Du.")
1780 007305 E104 1780 END;
1781 007305 1781 Newline
1782 007307 E100 1782 END;
1783 007310 E98 1783 END of PR*CEDURE putvalues;
1784 007310 1784
1785 007310 1785
1786 007311 1786 PROCEDURE putheader;
1787 007311 1787 COMMENT -------------------------------------------------
1788 007311 1788 'Putheader' is the last of four procedures used to output
1789 007311 1789 the lesson preface. This procedure writes code which
1790 007311 1790 handles I/O initialization.
1791 007311 1791 -----------------------------------------------------------;
1792 007321 B105 1792 BEGIN
1793 007321 1793 Write("[N]Input(0,""TTY"");;[N]");
1794 007324 1794 IF put THEN
1795 007326 B106 1795 BEGIN
1796 007330 1796 IF NOT disk THEN Write("Output(2,""LPT"");;[N]Selectoutput(2);;[N]");
1797 007335 1797 IF disk THEN Write("Input(1,""DSK"");;[N]Output(2,""DSK"");;[N]Output(3,""DSK"");;[N]");
1798 007342 1798 IF nocontrolc THEN Write("stopkc;;[N]");
1799 007345 1799 IF NOT disk AND NOT keep THEN
1800 007351 B107 1800 BEGIN
1801 007354 1801 IF language = 1 THEN textline("Please send this listing to the teacher.") ELSE
1802 007363 1802 IF language = 2 THEN textline("L{raren {r tacksam om Du s{nder denna lista till honom.");
1803 007366 1803 Write("putmessage;;[N]")
1804 007371 E107 1804 END;
1805 007371 1805 Write("Breakoutput;;[N]");
1806 007374 1806 Write("Selectoutput(0);;[2N]")
1807 007377 E106 1807 END;
1808 007377 1808 COMMENT -------------------------------------------------
1809 007377 1809 Now we write code which displays certain standard text
1810 007377 1810 material to the student at the beginning of a new lesson.
1811 007377 1811 Most of this code will NOT be written into the lesson,
1812 007377 1812 however, if the %SGNOSIS command was used.
1813 007377 1813 -----------------------------------------------------------;
1814 007377 1814 IF name THEN
1815 007401 B108 1815 BEGIN
1816 007401 1816 IF language = 1 THEN
1817 007404 B109 1817 BEGIN
1818 007404 1818 Write("Write(""[[N]]Hello! This is GNOSIS talking.[[N]]"");;[N]");
1819 007407 1819 Write("[N]repeat:[N]Write(""I'd like to know your full name--[[N]]just type it in after the arrow.[[N]]"");;[N]");
1820 007412 1820 IF put THEN
1821 007414 B110 1821 BEGIN
1822 007414 1822 COMMENT The following code brings GNOSIS into compliance with privacy laws;
1823 007414 1823 Write("Write(""[[NT]](Unless you enter a made-up name, GNOSIS will"");;[N]");
1824 007417 1824 Write("Write(""[[NT]]generate personal data based on this session.)[[2N]]"");;[N]")
1825 007422 E110 1825 END;
1826 007424 1826 IF bell THEN Write("Outsymbol(controlg);;[N]");
1827 007427 1827 Write("Write(prompt);;[N]getline;;[N]");
1828 007432 1828 Write("IF answerlength < 6 THEN[N]");
1829 007435 1829 Write("BEGIN[N]Write(""That's too short to be your FULL name.[[N]]"");;[N]Newline;;[N]GOTO repeat;;[N]END;;[N]");
1830 007440 1830 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO IF answer.[[pos]] = blank THEN GOTO continue;;[N]");
1831 007443 1831 Write("Write(""That's only ONE of your names.[[N]]"");;[N]GOTO repeat;;[N]");
1832 007446 1832 Write("[N]continue:[N]Write(""Glad to meet you, "");;[N]")
1833 007446 E109 1833 END
1834 007452 1834 ELSE IF language = 2 THEN
1835 007455 B111 1835 BEGIN
1836 007455 1836 Write("Write(""[[N]]Hej! Det h{r {r GNOSIS-programmet som talar.[[N]]"");;[N]");
1837 007460 1837 Write("[N]repeat:[N]Write(""Jag skulle vilja veta ditt fullst{ndiga namn--skriv det p} terminalen.[[N]]"");;[N]");
1838 007465 1838 IF bell THEN Write("Outsymbol(controlg);;[N]");
1839 007470 1839 Write("Write(prompt);;[N]getline;;[N]");
1840 007473 1840 Write("IF answerlength < 6 THEN[N]");
1841 007476 1841 Write("BEGIN[N]Write(""???[[N]]"");;[N]Newline;;[N]GOTO repeat;;[N]END;;[N]");
1842 007501 1842 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO IF answer.[[pos]] = blank THEN GOTO continue;;[N]");
1843 007504 1843 Write("Write(""???[[N]]"");;[N]GOTO repeat;;[N]");
1844 007507 1844 Write("[N]continue:[N]Write(""Trevligt att tr{ffas, "");;[N]")
1845 007512 E111 1845 END;
1846 007512 1846 Write("BEGIN[N]INTEGER pos, t;;[N]");
1847 007515 1847 Write("pos:=1;;[N]");
1848 007520 1848 Write("[N]nameloop:[N]t:=answer.[[pos]];;[N]");
1849 007523 1849 Write("IF pos<answerlength THEN[N]");
1850 007526 1850 Write("BEGIN[N]IF t#blank THEN[N]");
1851 007531 1851 Write("BEGIN[N]pos:=pos+1;;[N]GOTO nameloop;;[N]");
1852 007534 1852 Write("END;;[N]");
1853 007537 1853 Write("END;;[N]");
1854 007542 1854 Write("firstname:=Copy(answer,1,pos-1);;[N]");
1855 007545 1855 Write("Write(firstname);;[N]Write(""!"");;[N]");
1856 007550 1856 Write("END;;[N]");
1857 007553 1857 IF disk THEN
1858 007555 B112 1858 BEGIN
1859 007555 1859 Write("tempfile1:= tempfile2:= Newstring(Length(firstname)+5,7);;[N]");
1860 007560 1860 Write("FOR pos:= 1 STEP 1 UNTIL Length(firstname) DO tempfile1.[[pos]]:= tempfile2.[[pos]]:= firstname.[[pos]];;[N]");
1861 007563 1861 Write("IF firstname.[[Length(firstname)]] # ""."".[[1]] THEN ");
1862 007566 1862 Write("tempfile1.[[pos+1]]:= tempfile2.[[pos+1]]:= ""."".[[1]][N]");
1863 007571 1863 Write("ELSE pos:= pos - 2;;[N]");
1864 007574 1864 Write("tempfile1.[[pos+2]]:= ""D"".[[1]];;[N]");
1865 007577 1865 Write("tempfile1.[[pos+3]]:= ""T"".[[1]];;[N]");
1866 007602 1866 Write("tempfile1.[[pos+4]]:= ""A"".[[1]];;[N]");
1867 007605 1867 Write("tempfile2.[[pos+2]]:= ""S"".[[1]];;[N]");
1868 007610 1868 Write("tempfile2.[[pos+3]]:= ""R"".[[1]];;[N]");
1869 007613 1869 Write("tempfile2.[[pos+4]]:= ""T"".[[1]];;[N]");
1870 007616 1870 Write("Openfile(2,tempfile1,%057);;[N]");
1871 007621 1871 Write("Openfile(3,tempfile2,%057);;[N]");
1872 007626 1872 IF nocontrolc THEN Write("stopkc;;[N]")
1873 007631 E112 1873 END;
1874 007631 1874 IF put THEN
1875 007633 B113 1875 BEGIN
1876 007633 1876 Write("Selectoutput(2);;[N]");
1877 007636 1877 IF language = 1 THEN
1878 007641 B114 1878 BEGIN
1879 007641 1879 Write("Write(""[[P]]TEACHER REPORT FOR THE LESSON: ");
1880 007644 1880 Write(lessonname);
1881 007647 1881 Write("[[2N]]"");;[N]");
1882 007652 1882 Write("Write(""STUDENT'S NAME: "");;[N]");
1883 007655 1883 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO Outsymbol(answer.[[pos]]);;[N]");
1884 007660 1884 Write("Newline;;[N]");
1885 007663 1885 Write("Write(""[[N]]TRACE OF UNEXPECTED ANSWERS:[[N]]"");;[N]Breakoutput;;[N]Selectoutput(0);;[N]")
1886 007663 E114 1886 END
1887 007667 1887 ELSE IF language = 2 THEN
1888 007672 B115 1888 BEGIN
1889 007672 1889 Write("Write(""[[P]]L#RARRAPPORT F@R LEKTIONEN: ");
1890 007675 1890 Write(lessonname);
1891 007700 1891 Write("[[2N]]"");;[N]");
1892 007703 1892 Write("Selectoutput(2);;[N]");
1893 007706 1893 Write("Write(""ELEVENS NAMN: "");;[N]");
1894 007711 1894 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO Outsymbol(answer.[[pos]]);;[N]");
1895 007714 1895 Write("Newline;;[N]");
1896 007717 1896 Write("Write(""[[N]]SP$RNING AV OV#NTADE SVAR:[[N]]"");;[N]Breakoutput;;[N]Selectoutput(0);;[N]")
1897 007717 E115 1897 END
1898 007722 E113 1898 END
1899 007722 E108 1899 END;
1900 007722 1900 IF NOT sgnosis THEN
1901 007724 B116 1901 BEGIN
1902 007724 1902 IF language = 1 THEN
1903 007727 B117 1903 BEGIN
1904 007727 1904 Write("Write(""[[2N]]Welcome to the lesson '"");;[N]");
1905 007732 1905 Write("Write(lessonname);;[N]");
1906 007735 1906 Write("Write(""'"");;[N]");
1907 007740 1907 IF copyright # "" THEN
1908 007745 B118 1908 BEGIN
1909 007745 1909 Write("Write("",[[N]]");
1910 007750 1910 Write(copyright);
1911 007753 1911 Write(""");;[N]");
1912 007756 E118 1912 END;
1913 007756 1913 Write("Write("".[[2N]]"");;[N]");
1914 007761 1914 Write("Write(""This lesson was produced by the GNOSIS system for computer aided[[N]]"");;[N]");
1915 007764 1915 Write("Write(""instruction (CAI) from the Research Institute of National Defense[[N]]"");;[N]");
1916 007767 1916 Write("Write(""Stockholm, Sweden, and the Old Dominion University Research Foundation.[[N]]"");;[N]")
1917 007767 E117 1917 END
1918 007773 1918 ELSE IF language = 2 THEN
1919 007776 B119 1919 BEGIN
1920 007776 1920 Write("Write(""[[2N]]Detta {r lektionen '");
1921 010001 1921 Write(lessonname);
1922 010004 1922 Write("'"");;[N]");
1923 010007 1923 IF copyright # "" THEN
1924 010014 B120 1924 BEGIN
1925 010014 1925 Write("Write("",[[N]]");
1926 010017 1926 Write(copyright);
1927 010022 1927 Write(","");;[N]");
1928 010025 E120 1928 END;
1929 010025 1929 Write("Write(""[[N]]producerad av GNOSIS-systemet "");;[N]");
1930 010030 1930 textline("f`r datorst`dd undervisning(DU) fr}n");
1931 010033 1931 textline("F`rsvarets forskningsanstalt, Stockholm.")
1932 010036 E119 1932 END;
1933 010036 1933 Write("Newline;;[N]");
1934 010041 1934 IF put THEN
1935 010043 B121 1935 BEGIN
1936 010043 1936 IF teacher # "" THEN
1937 010050 B122 1937 BEGIN
1938 010053 1938 IF language = 1 THEN textline("The author of this lesson is...") ELSE
1939 010062 1939 IF language = 2 THEN textline("Den l{rare som skrev den h{r lektionen {r...");
1940 010065 1940 textline(teacher)
1941 010065 E122 1941 END
1942 010070 E121 1942 END;
1943 010070 1943 IF language = 1 THEN
1944 010073 1944 Write("Write(""[[N]]IMPORTANT: You can interrupt the lesson at any time by typing the[[N]]single character """"")
1945 010073 1945 ELSE
1946 010102 1946 IF language = 2 THEN Write("Write(""Du kan avbryta lektionen n{r som helst genom att skriva[[N]]det enda tecknet """"");
1947 010105 1947 Outsymbol(controlchar);
1948 010113 1948 IF language = 1 THEN Write(""""""");;[N]") ELSE
1949 010122 1949 IF language = 2 THEN Write(""""""");;[N]");
1950 010130 1950 IF language = 1 THEN Write("Write("" on your terminal and then pushing the RETURN button.[[2N]]"");;[N]")
1951 010137 1951 ELSE IF language = 2 THEN Write("Write("" p} Din terminal och sedan trycka p} RETURN-knappen.[[N]]"");;[N]");
1952 010142 1952 IF NOT lock THEN
1953 010144 B123 1953 BEGIN
1954 010144 1954 IF language = 1 THEN
1955 010147 B124 1955 BEGIN
1956 010147 1956 Write("Write(""GNOSIS will then explain how you can type"");;[N]");
1957 010152 1957 Write("Write(""[[NT]](1) 'STOP' to end the lesson immediately;;;;"");;[N]");
1958 010155 1958 Write("Write(""[[NT]](2) 'SKIP' to move on to the next question (or text);;;; or"");;[N]");
1959 010160 1959 Write("Write(""[[NT]](3) 'BACK' to return to the previous question (or text).[[2N]]"");;[N]")
1960 010160 E124 1960 END
1961 010164 1961 ELSE IF language = 2 THEN
1962 010167 B125 1962 BEGIN
1963 010167 1963 Write("Write(""D{refter kan du[[NT]]- avsluta hela lektionen eller[[NT]]- bara hoppa");
1964 010174 1964 IF NOT lock THEN Write(" `ver en fr}ga eller[[NT]]- g} tillbaka i lektionen.[[2N]]"");;[N]")
1965 010174 E125 1965 END
1966 010177 E123 1966 END;
1967 010177 1967 Write("page;;[2N]")
1968 010202 E116 1968 END;
1969 010202 1969 Newline;
1970 010204 1970 Write(mainlab);
1971 010207 1971 Write(": ");
1972 010212 1972 Write("[N]start:[N]");
1973 010215 1973 Write("BEGIN[N]INTEGER blockmaker;;[N]")
1974 010220 E105 1974 END of PR*CEDURE putheader;
1975 010220 1975
1976 010220 1976
1977 010220 1977
1978 010221 1978 PROCEDURE putfinish;
1979 010221 1979 COMMENT -------------------------------------------------
1980 010221 1980 'Putfinish' prints that part of the ALGOL program which
1981 010221 1981 comes after the proper translation of the lesson itself.
1982 010221 1982 This part tells the student his score, accepts messages from
1983 010221 1983 him for the teacher, and closes the files which contain the
1984 010221 1984 teacher reports. In %SGNOSIS mode, however, code will be
1985 010221 1985 written which causes the lesson to end more directly,
1986 010221 1986 without issuing score reports, etc.
1987 010221 1987 -----------------------------------------------------------;
1988 010231 B126 1988 BEGIN
1989 010231 1989 Write("END of block started with makeblock INTEGER;;[4N]");
1990 010234 1990 IF NOT lock AND labelcount > 0 THEN
1991 010243 B127 1991 BEGIN
1992 010244 1992 INTEGER i, j;
1993 010244 1993 mainlab:= Copy("ZQXAAA");
1994 010255 1994 Write("IF FALSE THEN[N]BEGIN[N]");
1995 010260 1995 j:= labelcount;
1996 010264 1996 FOR i:= 1 STEP 1 UNTIL j DO
1997 010270 B128 1997 BEGIN
1998 010270 1998 makemainlab;
1999 010272 1999 Newline;
2000 010274 2000 Write(mainlab);
2001 010277 2001 Write(":[N]")
2002 010302 E128 2002 END;
2003 010303 2003 IF language = 1 THEN
2004 010306 B129 2004 BEGIN
2005 010306 2005 Write("Write(""NOTE: The backing procedure is unable to go back just ONE step [[N]]"");;[N]");
2006 010311 2006 Write("Write(""from this point. It is going all the way back to the start.[[N]]"");;[N]")
2007 010311 E129 2007 END
2008 010315 2008 ELSE IF language = 2 THEN
2009 010320 B130 2009 BEGIN
2010 010320 2010 Write("Write(""Jag kan inte g} en liten bit bak}t p.g.a. lektionens komplexitet[[N]]"");;[N]");
2011 010323 2011 Write("Write(""utan m}ste backa till lektionens b`rjan. F`rl}t![[N]]"");;[N]")
2012 010326 E130 2012 END;
2013 010326 2013 Write("GOTO start;;[N]END;;[N]")
2014 010331 E127 2014 END;
2015 010334 2015 Write("[N]endoflesson:[N]Newline;;[N]");
2016 010337 2016 IF NOT sgnosis THEN
2017 010341 B131 2017 BEGIN
2018 010341 2018 IF language = 1 THEN
2019 010344 B132 2019 BEGIN
2020 010344 2020 Write("Write(""During the lesson """"");
2021 010347 2021 Write(lessonname);
2022 010352 2022 Write(""""" you answered"");;[N]Print(qcount,3);;[N]");
2023 010355 2023 Write("Write("" questions,[[N]]and you gave the right answer"");;[N]Print(latescore,3);;[N]");
2024 010360 2024 Write("Write("" times.[[N]]On"");;[N]Print(score,3);;[N]");
2025 010363 2025 Write("Write("" questions your answer was right on your very first try.[[N]]"");;[N]")
2026 010363 E132 2026 END
2027 010367 2027 ELSE IF language = 2 THEN
2028 010372 B133 2028 BEGIN
2029 010372 2029 Write("Write(""Lektion """"");
2030 010375 2030 Write(lessonname);
2031 010400 2031 Write(""""" {r slut.[[N]]Du har svarat p}"");;[N]Print(qcount,3);;[N]");
2032 010403 2032 Write("Write("" fr}gor, [[N]]och Du gav r{tt svar"");;[N]Print(latescore,3);;[N]");
2033 010406 2033 Write("Write("" g}nger.[[N]]P}"");;[N]Print(score,3);;[N]");
2034 010411 2034 Write("Write("" fr}gor gav Du r{tt svar f`rsta g}ngen Du fick fr}gan.[[N]]"");;[N]")
2035 010411 E133 2035 END
2036 010414 E131 2036 END;
2037 010414 2037 IF put THEN
2038 010416 B134 2038 BEGIN
2039 010416 2039 IF NOT keep AND NOT disk THEN
2040 010422 B135 2040 BEGIN
2041 010422 2041 IF language = 1 THEN
2042 010425 B136 2042 BEGIN
2043 010425 2043 Write("Write(""[[2N]]This lesson has produced a report sheet for the teacher.[[N]]"");;[N]");
2044 010430 2044 Write("Write(""This sheet will be printed on the line printer.[[N]]"");;[N]")
2045 010433 E136 2045 END ELSE
2046 010434 2046 IF language = 2 THEN
2047 010437 B137 2047 BEGIN
2048 010437 2048 textline("[[2N]]Denna lektion har producerat ett rapportblad till l{raren.");
2049 010442 2049 textline("Detta blad kommer att skrivas ut p} radskrivaren.")
2050 010445 E137 2050 END;
2051 010445 2051 IF language = 1 THEN
2052 010450 B138 2052 BEGIN
2053 010450 2053 textline("Please send the line printer listing (not the listing");
2054 010453 2054 textline("at the conversational terminal!) to the teacher.")
2055 010456 E138 2055 END ELSE
2056 010457 2056 IF language = 2 THEN
2057 010462 B139 2057 BEGIN
2058 010462 2058 textline("L{raren {r tacksam om Du s{nder radskrivarlistan");
2059 010465 2059 textline("(inte dialogterminallistan!) till honom.")
2060 010470 E139 2060 END;
2061 010470 2061 Write("putmessage;;[N]")
2062 010473 E135 2062 END;
2063 010473 2063 Write("Breakoutput;;[N]");
2064 010476 2064 Write("Selectoutput(2);;[N]Newline;;[N]");
2065 010504 2065 IF language = 1 THEN Write("Write(""SCORES: "");;[N]") ELSE
2066 010513 2066 IF language = 2 THEN Write(" Write(""Antal r{tt: "");;[N]");
2067 010516 2067 Write(
2068 010516 2068 "Print(latepercent,2,1);;[N]Write(""% ("");;[N]Print(percent,2,1);;[N]Write(""%)[[NT]]-"");;[N]Print(score,3);;[N]"
2069 010516 2069 );
2070 010524 2070 IF language = 1 THEN Write("Write("" right answers on first tries and[[NT]]-"");;[N]")
2071 010533 2071 ELSE IF language = 2 THEN Write("Write("" f`rstasvar och[[NT]]-"");;[N]");
2072 010536 2072 Write("Print(latescore,3);;[N]");
2073 010541 2073 IF language = 1 THEN
2074 010544 2074 Write(
2075 010544 2075 "Write("" total right out of a total of[[NT]]-"");;[N]Print(qcount,3);;[N]Write("" questions attempted.[[2N]]"");;[N]")
2076 010544 2076 ELSE
2077 010550 2077 IF language = 2 THEN
2078 010553 2078 Write("Write("" totalt av[[NT]]-"");;[N]Print(qcount,3);;[N]Write("" givna fr}gor.[[2N]]"");;[N]");
2079 010556 2079 Write("Breakoutput;;[N]");
2080 010561 2080 Write("Selectoutput(0);;[N]")
2081 010564 E134 2081 END;
2082 010564 2082 Write("Newline;;[N]");
2083 010567 2083 IF put THEN
2084 010571 B140 2084 BEGIN
2085 010571 2085 IF language = 1 THEN
2086 010574 B141 2086 BEGIN
2087 010574 2087 Write("Write(""If you have any message for the teacher, then type it now, one[[N]]"");;[N]");
2088 010577 2088 Write("Write(""line at a time. Finish with an EXTRA push on the RETURN key.[[2N]]"");;[N]")
2089 010577 E141 2089 END
2090 010603 2090 ELSE IF language = 2 THEN
2091 010606 B142 2091 BEGIN
2092 010606 2092 Write("Write(""Om Du har n}got meddelande till l{raren, s} skriv det nu.[[N]]"");;[N]");
2093 010611 2093 Write("Write(""Sluta med att trycka en extra g}ng p} RETURN-knappen.[[2N]]"");;[N]")
2094 010614 E142 2094 END;
2095 010614 2095 Write("[N]mess:[N]");
2096 010621 2096 IF bell THEN Write("Outsymbol(controlg);;[N]");
2097 010624 2097 Write("Selectoutput(0);;[N]");
2098 010627 2098 Write("Write(prompt);;[N]Breakoutput;;[N]getline;;[N]");
2099 010632 2099 IF NOT lock THEN
2100 010634 B143 2100 BEGIN
2101 010634 2101 Write("IF back THEN[N]BEGIN[N]back:= FALSE;;[N]GOTO ");
2102 010637 2102 Write(mainlab);
2103 010642 2103 Write(";;[N]END;;[N]")
2104 010645 E143 2104 END;
2105 010645 2105 Write("IF answerlength > 0 THEN[N]");
2106 010650 2106 Write("BEGIN[N]message:= TRUE;;[N]");
2107 010653 2107 Write("Selectoutput(2);;[N]");
2108 010656 2108 IF language = 1 THEN
2109 010661 2109 Write("Write(""MESSAGE: "");;[N]")
2110 010665 2110 ELSE IF language = 2 THEN
2111 010670 2111 Write("Write(""MEDDELANDE: "");;[N]");
2112 010673 2112 Write("FOR pos:= 1 STEP 1 UNTIL answerlength DO Outsymbol(answer.[[pos]]);;[N]");
2113 010676 2113 Write("GOTO mess;;[N]END;;[N]")
2114 010701 E140 2114 END;
2115 010701 2115 Write("Breakoutput;;[N]");
2116 010704 2116 Write("Selectoutput(0);;[N]");
2117 010707 2117 IF NOT sgnosis THEN
2118 010711 B144 2118 BEGIN
2119 010714 2119 IF language = 1 THEN Write("Write(""Leaving the lesson """"") ELSE
2120 010723 2120 IF language = 2 THEN Write("Write(""G}r ut ur lektion """"");
2121 010726 2121 Write(lessonname);
2122 010731 2122 Write("""""...[[N]]"");;[N]")
2123 010734 E144 2123 END;
2124 010734 2124 IF disk THEN
2125 010736 B145 2125 BEGIN
2126 010736 2126 Write("Openfile(1,""");
2127 010741 2127 Write(lessonname);
2128 010744 2128 Write(".DTA"", %155);;[N]");
2129 010747 2129 Write("Selectinput(1);;[N]Breakoutput;;[N]Selectoutput(2);;[N]Transfile;;[N]");
2130 010752 2130 Write("Openfile (1,"""");;[N]Openfile (2,""");
2131 010755 2131 Write(lessonname);
2132 010760 2132 Write(".DTA"", %155);;[N]");
2133 010763 2133 Write("Closefile(1);;[N]");
2134 010766 2134 Write("Openfile(1,""");
2135 010771 2135 Write(lessonname);
2136 010774 2136 Write(".SRT"", %155);;[N]");
2137 010777 2137 Write("Selectinput(1);;[N]Selectoutput(3);;[N]Transfile;;[N]");
2138 011002 2138 Write("Openfile (1,"""");;[N]Openfile (3,""");
2139 011005 2139 Write(lessonname);
2140 011010 2140 Write(".SRT"", %155);;[N]")
2141 011013 E145 2141 END;
2142 011013 2142 Write("Selectoutput(0);;[N]");
2143 011016 2143 IF language=1 THEN
2144 011021 B146 2144 BEGIN
2145 011021 2145 Write("Write(""[[2N]]Have a nice day"");;[N]");
2146 011024 2146 Write("IF firstname # """" THEN[N]BEGIN[N]Write("", "");;[N]Write(firstname);;[N]END;;[N]");
2147 011027 2147 Write("Write(""!"");;[N]")
2148 011027 E146 2148 END
2149 011032 E126 2149 END of PR*CEDURE putfinish;
2150 011032 2150
2151 011032 2151
2152 011032 2152
2153 011033 2153 PROCEDURE gotoput;
2154 011033 2154 COMMENT -------------------------------------------------
2155 011033 2155 'Gotoput' determines whether the current GNOSIS command is a
2156 011033 2156 "%SAME" command and, if so, outputs the appropriate "GOTO"
2157 011033 2157 into the translated Algol program. If the command is not
2158 011033 2158 %SAME, then a default GOTO statement is output. Of course,
2159 011033 2159 if the teacher provided an explicit %GOTO in the previous
2160 011033 2160 line, then the default GOTO statement (which is always
2161 011033 2161 output) is superfluous.
2162 011033 2162 -----------------------------------------------------------;
2163 011043 B147 2163 BEGIN
2164 011043 2164 goanywherecommands;
2165 011045 2165 IF controlstart = "SAM" THEN
2166 011045 2166 COMMENT -------------------------------------------------
2167 011045 2167 This command is used to avoid storing duplicate comments
2168 011045 2168 whenever the comment provided for the prvious %RIGHT,
2169 011045 2169 %WRONG, %LACK, or %NEUTRAL answer pattern can be reused.
2170 011045 2170
2171 011045 2171 Obviously, the first answer command after a %QUESTION
2172 011045 2172 command cannot be followed by a %SAME command since there
2173 011045 2173 would, in this case, be no previous comment to reuse.
2174 011045 2174 -----------------------------------------------------------;
2175 011052 B148 2175 BEGIN
2176 011052 2176 IF same = "" THEN
2177 011057 2177 errmess(TRUE, "2177: No previous comment available.[N]****** Command will be ignored.") ELSE
2178 011064 B149 2178 BEGIN
2179 011064 2179 Write("GOTO SAME");
2180 011067 2180 Write(same);
2181 011072 2181 Write(";;[N]")
2182 011075 E149 2182 END;
2183 011075 2183 getline;
2184 011077 2184 IF answer.[1] # controlchar THEN
2185 011105 B150 2185 BEGIN
2186 011105 2186 errmess(TRUE,
2187 011105 2187 "2187: A command line is required at this point. As a result,[N]****** this line up to next command line will be ignored.");
2188 011111 2188 WHILE answer.[1] # controlchar DO getline
2189 011122 E150 2189 END;
2190 011122 2190 getcontrolstart(4)
2191 011125 E148 2191 END ELSE
2192 011126 B151 2192 BEGIN
2193 011126 2193 delet(same);
2194 011131 2194 same:= Copy(lab);
2195 011146 2195 IF NOT right AND NOT neutral THEN Write("GOTO repeat;;[N]")
2196 011152 2196 ELSE Write("GOTO next;;[N]");
2197 011155 2197 empty:= FALSE
2198 011156 E151 2198 END;
2199 011156 2199 Newline;
2200 011160 2200 Write(lab);
2201 011163 2201 Write(":[N]")
2202 011166 E147 2202 END of PR*CEDURE gotoput;
2203 011166 2203
2204 011166 2204
2205 011166 2205
2206 011167 2206 PROCEDURE makelabel;
2207 011167 2207 COMMENT -------------------------------------------------
2208 011167 2208 Extra labels have to be created for insertion into the
2209 011167 2209 translated ALGOL program. 'Makelabel' will generate a new
2210 011167 2210 label at each call (i.e, QZXAAA, QZXAAB, QZXAAC etc.). The
2211 011167 2211 label is stored in the global STRING 'lab' which is
2212 011167 2212 initialized to "QZXAAA" for each new %QUESTION command in
2213 011167 2213 the lesson.
2214 011167 2214 -----------------------------------------------------------;
2215 011177 B152 2215 BEGIN
2216 011200 2216 INTEGER i, k;
2217 011200 2217 i:= Length(lab);
2218 011200 2218
2219 011200 2219 letterchange:
2220 011216 2220 k:= lab.[i];
2221 011223 2221 IF k >= z THEN
2222 011226 B153 2222 BEGIN
2223 011226 2223 lab.[i]:= a;
2224 011233 2224 i:= i-1;
2225 011236 2225 GOTO letterchange
2226 011240 E153 2226 END ELSE lab.[i]:= k+1
2227 011246 E152 2227 END of PR*CEDURE makelabel;
2228 011246 2228
2229 011246 2229
2230 011246 2230
2231 011252 2231 PROCEDURE makemainlab;
2232 011252 2232 COMMENT -------------------------------------------------
2233 011252 2233 A different set of labels have to be created for insertion
2234 011252 2234 in the translated ALGOL program. 'Makemainlab' will
2235 011252 2235 generate a new label for this purpose at each call (i.e.,
2236 011252 2236 ZQXAAA, ZQXAAB, ZQXAAC etc.). The label is stored in the
2237 011252 2237 global STRING "mainlab" which is initialized to "ZQXAAA"
2238 011252 2238 once for each lesson. This set of labels is used to enable
2239 011252 2239 the student to skip backward in a lesson. His backward path
2240 011252 2240 will be strictly linear -- not necessarily the reverse of
2241 011252 2241 the path he followed when moving forward.
2242 011252 2242 -----------------------------------------------------------;
2243 011262 B154 2243 BEGIN
2244 011263 2244 INTEGER i, k;
2245 011263 2245 labelcount:= labelcount+1;
2246 011266 2246 i:= Length(mainlab);
2247 011266 2247
2248 011266 2248 letterchange:
2249 011304 2249 k:= mainlab.[i];
2250 011311 2250 IF k >= z THEN
2251 011314 B155 2251 BEGIN
2252 011314 2252 mainlab.[i]:= a;
2253 011321 2253 i:= i-1;
2254 011324 2254 GOTO letterchange
2255 011326 E155 2255 END ELSE mainlab.[i]:= k+1
2256 011334 E154 2256 END of PR*CEDURE makemainlabel;
2257 011334 2257
2258 011334 2258
2259 011334 2259
2260 011340 2260 PROCEDURE openoutput;
2261 011340 2261 COMMENT -------------------------------------------------
2262 011340 2262 The output file is given the same filename as the input
2263 011340 2263 GNOSIS lesson but another extension: '.ALG'. That file is
2264 011340 2264 opened by the PROCEDURE 'openoutput'.
2265 011340 2265 -----------------------------------------------------------;
2266 011350 B156 2266 BEGIN
2267 011351 2267 STRING filename;
2268 011353 2268 INTEGER i;
2269 011361 2269 filename:= Newstring(Length(lessonname)+5,7);
2270 011375 2270 FOR i:= 1 STEP 1 UNTIL Length(lessonname) DO
2271 011410 2271 filename.[i]:= lessonname.[i];
2272 011422 2272 filename.[i+1]:= ".".[1];
2273 011435 2273 filename.[i+2]:= "A".[1];
2274 011450 2274 filename.[i+3]:= "L".[1];
2275 011463 2275 filename.[i+4]:= "G".[1];
2276 011476 2276 Openfile(2,filename,%057);
2277 011503 2277 opened:= TRUE;
2278 011504 2278 Selectoutput(2)
2279 011507 E156 2279 END of PR*CEDURE openoutput;
2280 011507 2280
2281 011507 2281
2282 011507 2282
2283 011507 2283
2284 011507 2284
2285 011507 2285
2286 011507 2286
2287 011507 2287
2288 011507 2288 COMMENT -------------------------------------------------
2289 011507 2289 Initialization of program CONSTANTS follows.
2290 011507 2290 -----------------------------------------------------------;
2291 011511 2291 carriagereturn:= 13;
2292 011513 2292 linefeed:= 10;
2293 011515 2293 formfeed:= 12;
2294 011517 2294 tabchar:= 9;
2295 011521 2295 linenumber:= Newstring(6,7);
2296 011533 2296 linenumber.[6]:= 9;
2297 011540 2297 answer:= Newstring(135,7);
2298 011552 2298 answer.[134]:= carriagereturn;
2299 011557 2299 answer.[135]:= linefeed;
2300 011564 2300 colon:= ":".[1];
2301 011571 2301 equalsign:= "=".[1];
2302 011576 2302 semicolon:= ";;".[1];
2303 011603 2303 dot:= ".".[1];
2304 011610 2304 blank:= " ".[1];
2305 011615 2305 exclamation:= "!".[1];
2306 011622 2306 doublequote:= """".[1];
2307 011627 2307 leftsquare:= "[[".[1];
2308 011634 2308 rightsquare:= "]]".[1];
2309 011641 2309 rightmargin:= 72;
2310 011643 2310 temp:= controlstart:= lessonname:= word:= teacher:= question:= word:= "";
2311 011716 2311 a:= "A".[1];
2312 011723 2312 z:= "Z".[1];
2313 011730 2313 lab:= "";
2314 011737 2314 lcaa:= "}".[1];
2315 011744 2315 lcae:= "{".[1];
2316 011751 2316 lcoe:= "`".[1];
2317 011756 2317 lce:= "e".[1];
2318 011763 2318 ucaa:= "$".[1];
2319 011770 2319 ucae:= "#".[1];
2320 011775 2320 ucoe:= "@".[1];
2321 012002 2321 uce:= "E".[1];
2322 012002 2322 COMMENT -------------------------------------------------
2323 012002 2323 Channel 3 is binary to check if the file is linenumbered.
2324 012002 2324 -----------------------------------------------------------;
2325 012007 2325 Input(0,"TTY");
2326 012013 2326 Input(1,"DSK");
2327 012017 2327 Input(3,"DSK",11);
2328 012024 2328 Output(2,"DSK");
2329 012024 2329
2330 012024 2330
2331 012024 2331
2332 012024 2332
2333 012024 2333
2334 012024 2334
2335 012024 2335
2336 012024 2336
2337 012030 2337 Write("GNOSIS Version 2 (June, 1978)[N]");
2338 012033 2338 Write("Copyright (c) 1978 by Jacob Palme and Walter Maner");
2339 012036 2339 Write("[2N]Do NOT type ahead while running the GNOSIS translator.[N]");
2340 012036 2340
2341 012036 2341 start:
2342 012041 2342 COMMENT -------------------------------------------------
2343 012041 2343 Initialization of program VARIABLES follows. Program
2344 012041 2344 defaults are handled first.
2345 012041 2345
2346 012041 2346 GNOSIS returns to this point after a lesson has been
2347 012041 2347 translated and initializes for the translation of another
2348 012041 2348 lesson.
2349 012041 2349 -----------------------------------------------------------;
2350 012052 2350 switchcount:= 0;
2351 012053 2351 linenumbered:= skip:= FALSE;
2352 012055 2352 linecount:= 0;
2353 012056 2353 labelcount:= 0;
2354 012057 2354 mainlab:= Copy("ZQXAAA");
2355 012057 2355 COMMENT -------------------------------------------------
2356 012057 2356 Many of the following BOOLEAN values will be reset when
2357 012057 2357 GNOSIS begins to read the lesson script.
2358 012057 2358 -----------------------------------------------------------;
2359 012070 2359 extra:= TRUE;
2360 012071 2360 sgnosis:= put:= keep:= order:= opened:= nocontrolc:= disk:= transferlesson:= lock:= bell:= name:= FALSE;
2361 012104 2361 language:= 1;
2362 012104 2362 COMMENT -------------------------------------------------
2363 012104 2363 GNOSIS defaults to language 1 (English).
2364 012104 2364 -----------------------------------------------------------;
2365 012106 2365 errlines:= controlchar:= qcount:= texcount:= 0;
2366 012112 2366 delet(teacher);
2367 012115 2367 teacher:= "";
2368 012124 2368 Write("[2N]Enter lesson name with extension, or push RETURN to exit from GNOSIS.[N]");
2369 012127 2369 Write("-->[B]");
2370 012132 2370 getline;
2371 012134 2371 infile:= Copy(answer,1,answerlength);
2372 012154 2372 IF infile = "" THEN GOTO stop;
2373 012155 2373 upcase(infile);
2374 012160 2374 pos:= 1;
2375 012210 2375 WHILE pos < Length(infile) AND infile.[pos] # ".".[1] DO pos:= pos + 1;
2376 012214 2376 IF pos = Length(infile) THEN
2377 012221 B157 2377 BEGIN
2378 012222 2378 STRING temp;
2379 012230 2379 temp:= Newstring(Length(infile)+5,7);
2380 012257 2380 FOR pos:= 1 STEP 1 UNTIL Length(infile) DO temp.[pos]:=infile.[pos];
2381 012271 2381 temp.[pos+1]:= ".".[1];
2382 012304 2382 temp.[pos+2]:= "G".[1];
2383 012317 2383 temp.[pos+3]:= "N".[1];
2384 012332 2384 temp.[pos+4]:= "O".[1];
2385 012352 2385 infile:= Newstring(Length(temp),7);
2386 012364 2386 infile:= temp
2387 012373 E157 2387 END;
2388 012376 2388 Write("[2N]Translation of the lesson """);
2389 012401 2389 Write(infile);
2390 012404 2390 Write(""" has begun...[2N]");
2391 012404 2391 COMMENT -------------------------------------------------
2392 012404 2392 Now we check if the file is linenumbered or not.
2393 012404 2393 -----------------------------------------------------------;
2394 012407 2394 Openfile(3,infile);
2395 012413 2395 Selectinput(3);
2396 012416 2396 Insymbol(pos);
2397 012421 2397 linenumbered:= pos REM 2 # 0;
2398 012427 2398 Closefile(3);
2399 012432 2399 Openfile(1,infile);
2400 012436 2400 Selectinput(1);
2401 012436 2401 COMMENT -------------------------------------------------
2402 012436 2402 The part before the extension of the lessonname is found.
2403 012436 2403 -----------------------------------------------------------;
2404 012443 2404 FOR pos:= 1 STEP 1 UNTIL Length(infile) DO
2405 012456 2405 IF infile.[pos] = dot THEN
2406 012464 B158 2406 BEGIN
2407 012464 2407 pos:= pos-1;
2408 012467 2408 GOTO leavefor
2409 012470 E158 2409 END;
2410 012470 2410
2411 012470 2411 leavefor:
2412 012502 2412 delet(teacher);
2413 012505 2413 delet(copyright);
2414 012510 2414 delet(lessonname);
2415 012513 2415 lessonname:= Copy(infile,1,pos);
2416 012526 2416 openoutput;
2417 012526 2417 COMMENT -------------------------------------------------
2418 012526 2418 The first lesson line is read, and the first character of
2419 012526 2419 that line is assumed to be the command indicator (usually
2420 012526 2420 '%').
2421 012526 2421 -----------------------------------------------------------;
2422 012526 2422
2423 012526 2423 startloop:
2424 012541 2424 getline;
2425 012543 2425 IF controlchar = 0 THEN
2426 012546 B159 2426 BEGIN
2427 012551 2427 WHILE answerlength = 0 DO getline;
2428 012554 2428 controlchar:= answer.[1];
2429 012561 2429 IF controlchar # "%".[1] THEN
2430 012567 2430 errmess(FALSE, "2430: You are not using '%' as a command indicator.")
2431 012573 E159 2431 END;
2432 012573 2432 IF answer.[1] # controlchar THEN
2433 012601 B160 2433 BEGIN
2434 012601 2434 errmess(TRUE,
2435 012601 2435 "2435: A command line is required at this point. As a result,[N]****** this line up to next command line will be ignored.");
2436 012605 2436 WHILE answer.[1] # controlchar DO getline
2437 012616 E160 2437 END;
2438 012616 2438 COMMENT -------------------------------------------------
2439 012616 2439 Here the program starts looking for those GNOSIS commands
2440 012616 2440 which are expected before the start of the lesson, that is
2441 012616 2441 %BELL, %KEEP, %LOCK, %DISK, %SGNOSIS, %NAME, %TEACHER and
2442 012616 2442 %LANGUAGE command lines.
2443 012616 2443 -----------------------------------------------------------;
2444 012616 2444 getcontrolstart(4);
2445 012621 2445 goanywherecommands;
2446 012623 2446 IF controlstart = "NOC" THEN
2447 012630 B161 2447 BEGIN
2448 012630 2448 COMMENT -------------------------------------------------
2449 012630 2449 In this mode, if a student types a CTRL-C, he will not be
2450 012630 2450 returned to the monitor level. Instead, he will be logged
2451 012630 2451 off the system without further ado. (Thus CTRL-C's become
2452 012630 2452 functionally equivalent to the 'BYE' command in BASIC.)
2453 012630 2453 -----------------------------------------------------------;
2454 012630 2454 nocontrolc:= TRUE;
2455 012631 2455 errmess(FALSE,
2456 012631 2456 "2456: The GNOLIB.REL file must reside in 'SYS:'. [N]****** Load as follows: '.LOAD <lessonname>.ALG, SYS:GNOLIB.REL'.");
2457 012635 2457 GOTO startloop
2458 012636 E161 2458 END;
2459 012636 2459 IF controlstart = "NEX" THEN
2460 012636 2460 COMMENT -------------------------------------------------
2461 012636 2461 This command tells GNOSIS which lesson to run after the
2462 012636 2462 student finishes the current lesson. Transfer to this
2463 012636 2463 lesson is wholly automatic at the point of exit, just as if
2464 012636 2464 the new lesson had been called up by GNOSIS directly,
2465 012636 2465 without intervention of the monitor.
2466 012636 2466
2467 012636 2467 The next lesson can be any RUN-able or R-able program, i.e.,
2468 012636 2468 any program with the extension .SAV, .EXE or .SHR).
2469 012636 2469 'run("<lesson name>")' is should appear on the same line,
2470 012636 2470 after this command, when the lesson resides in the student's
2471 012636 2471 area Or, 'r("<lesson name>")' should appear when it resides
2472 012636 2472 in the SYS: area.
2473 012636 2473
2474 012636 2474 Technical Note: The literal which replaces '<lesson name>'
2475 012636 2475 must be a single filename, without extension.
2476 012636 2476 -----------------------------------------------------------;
2477 012643 B162 2477 BEGIN
2478 012643 2478 nextlesson:= getword;
2479 012653 2479 upcase(nextlesson);
2480 012656 2480 transferlesson:= TRUE;
2481 012657 2481 errmess(FALSE,
2482 012657 2482 "2482: The GNOLIB.REL file must reside in 'SYS:'. [N]****** Load as follows: '.LOAD <lessonname>.ALG, SYS:GNOLIB.REL'.");
2483 012663 2483 GOTO startloop
2484 012664 E162 2484 END;
2485 012664 2485 IF controlstart = "LAN" THEN
2486 012664 2486 COMMENT -------------------------------------------------
2487 012664 2487 This command tells the system which language to use in
2488 012664 2488 communication with the student. The command is not
2489 012664 2489 necessary if the language is to be English. (The language
2490 012664 2490 used in communicating with the teacher at the time his
2491 012664 2491 script is being processed by GNOSIS is not affected by the
2492 012664 2492 %LANGUAGE command. It is always English.)
2493 012664 2493 -----------------------------------------------------------;
2494 012671 B163 2494 BEGIN
2495 012671 2495 delet(word);
2496 012674 2496 word:= getword;
2497 012704 2497 upcase(word);
2498 012714 2498 IF word = "ENGLISH" THEN language:= 1 ELSE
2499 012724 2499 IF word = "SWEDISH" THEN language:= 2 ELSE
2500 012727 B164 2500 BEGIN
2501 012727 2501 errmess(FALSE, "2501: Unknown language.[N]****** GNOSIS will default to English..")
2502 012733 E164 2502 END;
2503 012733 2503 GOTO startloop
2504 012734 E163 2504 END;
2505 012734 2505 IF controlstart = "SGN" THEN
2506 012734 2506 COMMENT --------------------------------------------------
2507 012734 2507 GNOSIS lessons normally output a header which tells the
2508 012734 2508 student that he is running a GNOSIS lesson, that it was
2509 012734 2509 authored by so-and-so, and that he can do certain things to
2510 012734 2510 control his path through the lesson. Also, at the end of
2511 012734 2511 the question-and-answer section of the lesson, GNOSIS will
2512 012734 2512 normally output a corresponding trailer which tells the
2513 012734 2513 student how he scored. %SGNOSIS (for (S)top GNOSIS) will
2514 012734 2514 inhibit the display of this header and trailer. The command
2515 012734 2515 is useful when you want to use GNOSIS to administer a
2516 012734 2516 questionnaire.
2517 012734 2517 -----------------------------------------------------------;
2518 012741 B165 2518 BEGIN
2519 012741 2519 sgnosis:= TRUE;
2520 012742 2520 GOTO startloop
2521 012743 E165 2521 END;
2522 012743 2522 IF controlstart = "SWI" THEN
2523 012750 B166 2523 BEGIN
2524 012750 2524 COMMENT -------------------------------------------------
2525 012750 2525 The %SWITCH command declares and initializes a BOOLEAN
2526 012750 2526 variable used to control skipping in conjunction with %IF,
2527 012750 2527 %IFNOT and %IFEND commands. The variable appears after
2528 012750 2528 '%SWITCH', on the same command line.
2529 012750 2529 -----------------------------------------------------------;
2530 012750 2530 pastoperation;
2531 012752 2531 switchword:= getword;
2532 012762 2532 upcase(switchword);
2533 012772 2533 IF Length(switchword) <= 0 THEN errmess(TRUE, "2530: No switchname in %SWITCH command.[N]****** Line will be ignored.");
2534 013000 2534 FOR switchnumber:= 1 STEP 1 UNTIL switchcount DO
2535 013004 2535 IF switchword = switchname[switchnumber] THEN
2536 013014 2536 errmess(FALSE, "2536: This switch is doubly defined.");
2537 013021 2537 IF switchcount = 9 THEN
2538 013024 2538 errmess(TRUE, "2538: More than 9 switches not allowed.[N]THIS switch will replace the old number nine.")
2539 013031 2539 ELSE switchcount:= switchcount+1;
2540 013034 2540 switchname[switchcount]:= Copy(switchword);
2541 013050 2541 switchword:= getword;
2542 013060 2542 upcase(switchword);
2543 013070 2543 IF switchword = "TRUE" THEN switchval[switchcount]:= TRUE ELSE
2544 013101 2544 IF switchword = "FALSE" THEN switchval[switchcount]:= FALSE ELSE
2545 013105 2545 errmess(TRUE, "2545: Switch value neither 'TRUE' nor 'FALSE'.[N]****** The effect of this error is undefined.");
2546 013111 2546 ifset[switchcount]:= FALSE;
2547 013114 2547 GOTO startloop
2548 013115 E166 2548 END;
2549 013115 2549 IF controlstart = "KEE" THEN
2550 013122 B167 2550 BEGIN
2551 013122 2551 COMMENT -------------------------------------------------
2552 013122 2552 This command is useful only in association with a %TEACHER
2553 013122 2553 command, i.e., in report-generating lessons. Unless %KEEP
2554 013122 2554 is used in such a lesson (or unless %DISK is used, which
2555 013122 2555 executes an implicit %KEEP command), the student will be
2556 013122 2556 directed to pick up the teacher report generated by the
2557 013122 2557 lesson (after it has been printed by the lineprinter), and
2558 013122 2558 to bring this report to the teacher. This command is
2559 013122 2559 probably not needed any longer since reports can
2560 013122 2560 conveniently be kept on disk.
2561 013122 2561 -----------------------------------------------------------;
2562 013122 2562 keep:= TRUE;
2563 013123 2563 GOTO startloop
2564 013124 E167 2564 END;
2565 013124 2565 IF controlstart = "LOC" THEN
2566 013124 2566 COMMENT -------------------------------------------------
2567 013124 2567 This command PERMANENTLY disables the backstepping and
2568 013124 2568 skipping provisions of GNOSIS. The student is in effect
2569 013124 2569 "locked" into the lesson path defined by the teacher unless
2570 013124 2570 the teacher explicitly supplies branching opportunities in
2571 013124 2571 the lesson itself. (Note, however, that the student can
2572 013124 2572 still END the lesson by typing 'stop'.) There does not
2573 013124 2573 exist, as yet, a corresponding %UNLOCK command.
2574 013124 2574 -----------------------------------------------------------;
2575 013131 B168 2575 BEGIN
2576 013131 2576 lock:= TRUE;
2577 013132 2577 GOTO startloop
2578 013133 E168 2578 END;
2579 013133 2579 IF controlstart = "BEL" THEN
2580 013140 B169 2580 BEGIN
2581 013140 2581 COMMENT -------------------------------------------------
2582 013140 2582 This command causes the bell to be rung at the student's
2583 013140 2583 terminal whenever the computer is awaiting input from him.
2584 013140 2584 Useful in noisy environments and with first-time computer
2585 013140 2585 users.
2586 013140 2586 -----------------------------------------------------------;
2587 013140 2587 bell:= TRUE;
2588 013141 2588 GOTO startloop
2589 013142 E169 2589 END;
2590 013142 2590 IF controlstart = "NAM" THEN
2591 013142 2591 COMMENT -------------------------------------------------
2592 013142 2592 This command causes the GNOSIS lesson to exchange greetings
2593 013142 2593 with the student at the start of the lesson. The student's
2594 013142 2594 full name is requested (and routed to the <lessonname>.DTA
2595 013142 2595 file, if any) and his first name is saved for use in I/O
2596 013142 2596 routines.
2597 013142 2597 -----------------------------------------------------------;
2598 013147 B170 2598 BEGIN
2599 013147 2599 name:= TRUE;
2600 013150 2600 GOTO startloop
2601 013151 E170 2601 END;
2602 013151 2602 IF controlstart = "DIS" OR controlstart = "DSK" THEN
2603 013170 B171 2603 BEGIN
2604 013170 2604 COMMENT -------------------------------------------------
2605 013170 2605 This command causes teacher reports to be created at lesson
2606 013170 2606 runtime, then routed to preexisting disk files named
2607 013170 2607 <lessonname>.DTA and <lessonname>.SRT. The <lessonname>.DTA
2608 013170 2608 file contains a page of data for each run of the lesson.
2609 013170 2609 These data include the student's name, a trace of his
2610 013170 2610 unexpected answers, lesson statistics, and any message he
2611 013170 2611 may have left for the teacher. The <lessonname>.SRT file
2612 013170 2612 contains only the "unexpected answer" traces, converted to a
2613 013170 2613 format suitable for sorting.
2614 013170 2614
2615 013170 2615 Unless the %DISK (or %DISC or %DSK) command is used, then
2616 013170 2616 teacher reports (if any) will be routed to the lineprinter
2617 013170 2617 and no machine readable records will remain. The reports
2618 013170 2618 queued to the lineprinter are equivalent to those which
2619 013170 2619 would have been contained in the <lessonname>.DTA file
2620 013170 2620 except that each page is printed as a separate item.
2621 013170 2621 Without the %DISK command, no <lessonname>.SRT file is
2622 013170 2622 generated.
2623 013170 2623
2624 013170 2624 When using the %DISK command, care must be taken to ensure
2625 013170 2625 that the blank files <lessonname>.DTA and <lessonname>.SRT
2626 013170 2626 have been created IN THE ACCOUNT WHERE THE LESSON WILL BE
2627 013170 2627 RUN. They must exist there before the lesson is used for
2628 013170 2628 the first time. Otherwise a mysterious error message will
2629 013170 2629 be sent to the student by ALGDDT as he tries to exit from
2630 013170 2630 the lesson. A protection of <155> should be given to these
2631 013170 2631 report files. This isn't adequate for all purposes, of
2632 013170 2632 course, but it is a workable compromise for the teacher who
2633 013170 2633 wishes to inspect, print or copy-and-sort these records from
2634 013170 2634 another account.
2635 013170 2635
2636 013170 2636 The %DISK command executes implicit %TEACHER and %KEEP
2637 013170 2637 commands. Thus, an explicit %TEACHER command will be
2638 013170 2638 required only if it is necessary to add the teacher's name
2639 013170 2639 and address.
2640 013170 2640
2641 013170 2641 Technical Note: Unless %NAME is used in conjunction with
2642 013170 2642 %DISK, only one student at a time may use a
2643 013170 2643 report-generating lesson. When the %NAME command is used,
2644 013170 2644 however, temporary .DTA and .SRT files (based on his first
2645 013170 2645 name) are opened at runtime. Writing to these files (until
2646 013170 2646 the very end of the lesson) usually avoids any
2647 013170 2647 conflict-of-access problems connected with writing the main
2648 013170 2648 <lessonname>.DTA and <lessonname>.SRT files.
2649 013170 2649 -----------------------------------------------------------;
2650 013170 2650 disk:= keep:= put:= TRUE;
2651 013173 2651 errmess(FALSE, "2651: Ignore this message if you have created");
2652 013177 2652 Selectoutput(0);
2653 013202 2653 Write("****** ");
2654 013205 2654 Write(lessonname);
2655 013210 2655 Write(".DTA<155> and ");
2656 013213 2656 Write(lessonname);
2657 013216 2657 Write(".SRT<155> files to receive teacher reports.");
2658 013221 2658 Newline;
2659 013223 2659 Selectoutput(2);
2660 013226 2660 GOTO startloop
2661 013227 E171 2661 END;
2662 013227 2662 IF controlstart = "COP" THEN
2663 013234 B172 2663 BEGIN
2664 013234 2664 COMMENT -------------------------------------------------
2665 013234 2665 If this command is used then, each time the lesson is run, a
2666 013234 2666 copyright notice will be output as part of the lesson
2667 013234 2667 header. This copyright applies only to the lesson itself,
2668 013234 2668 of course -- not to the GNOSIS software.
2669 013234 2669 -----------------------------------------------------------;
2670 013234 2670 pastoperation;
2671 013236 2671 copyright:= Copy(answer,pos,answerlength);
2672 013251 2672 GOTO startloop
2673 013252 E172 2673 END;
2674 013252 2674 IF controlstart = "TEA" THEN
2675 013257 B173 2675 BEGIN
2676 013257 2676 COMMENT -------------------------------------------------
2677 013257 2677 If this command is included in a lesson, then teacher
2678 013257 2678 reports (of some kind) will be produced for the lesson, and
2679 013257 2679 students will be told who authored the lesson each time the
2680 013257 2680 lesson is run. If the %TEACHER command is used with an
2681 013257 2681 empty argument, then an anonymous teacher report will be
2682 013257 2682 generated and no information about lesson authorship will be
2683 013257 2683 displayed to the student at runtime.
2684 013257 2684
2685 013257 2685 The <lessonname>.DTA teacher report contains the following
2686 013257 2686 information:
2687 013257 2687
2688 013257 2688 ---- The student's full name, if operating in %NAME mode.
2689 013257 2689
2690 013257 2690 ---- Unexpected answers to questions in the lesson.
2691 013257 2691
2692 013257 2692 This trace will include any unforeseen student response or,
2693 013257 2693 roughly speaking, all those responses students entered
2694 013257 2694 without getting any specific diagnostic feedback. Recurrent
2695 013257 2695 unanticipated responses usually signal a need to rewrite the
2696 013257 2696 lesson with that response as an argument for an answer
2697 013257 2697 command -- followed of course by appropriate comments or
2698 013257 2698 hints.
2699 013257 2699
2700 013257 2700
2701 013257 2701 ---- Basic statistical data about the student's
2702 013257 2702 performance.
2703 013257 2703
2704 013257 2704 This data should not be taken too seriously, especially when
2705 013257 2705 the lesson permits the student to exercise control over
2706 013257 2706 skipping and backstepping.
2707 013257 2707
2708 013257 2708 ---- Student comments about the lesson.
2709 013257 2709
2710 013257 2710 GNOSIS can store as lengthy a comment as the student wants
2711 013257 2711 to type, even if his comment should run on for pages. The
2712 013257 2712 <lessonname>.SRT report, which is generated if %DISK is used
2713 013257 2713 in conjunction with %TEACHER, contains the trace of
2714 013257 2714 unexpected answers in a form ready to be input to the
2715 013257 2715 utility program SORT. The following command string usually
2716 013257 2716 does the job:
2717 013257 2717
2718 013257 2718 .R SORT
2719 013257 2719 *x.SRT=x.SRT/KEY:1:60:A/ALPHA/RECORD:132
2720 013257 2720
2721 013257 2721 where 'x' = <lessonname>.
2722 013257 2722 -----------------------------------------------------------;
2723 013257 2723 pastoperation;
2724 013261 2724 teacher:= Copy(answer,pos,answerlength);
2725 013274 2725 IF teacher = "" THEN
2726 013301 B174 2726 BEGIN
2727 013301 2727 errmess(FALSE, "2727: Ignore this message if you meant to omit[N]****** teacher's name and address.");
2728 013305 2728 keep:=TRUE
2729 013306 E174 2729 END;
2730 013306 2730 put:=TRUE;
2731 013307 2731 GOTO startloop
2732 013310 E173 2732 END;
2733 013310 2733 COMMENT -------------------------------------------------
2734 013310 2734 Since all of the 'IF controlstart = <command abbreviation>'
2735 013310 2735 tests above have failed, the current command line must be
2736 013310 2736 something other than %BELL, %COPYRIGHT, %DISK (or %DSK or
2737 013310 2737 %DISC), %KEEP, %LANGUAGE, %LOCK, %NAME, %NEXTLESSON,
2738 013310 2738 %NOCONTROLC, %SGNOSIS, %SWITCH or %TEACHER. This being so,
2739 013310 2739 it is time to output that part of the lesson preface which
2740 013310 2740 contains the data declarations.
2741 013310 2741 -----------------------------------------------------------;
2742 013310 2742 putvariables;
2743 013312 2743 WHILE controlstart = "VAR" DO
2744 013312 2744 COMMENT -------------------------------------------------
2745 013312 2745 The %VARIABLES command causes user-defined variables (if
2746 013312 2746 any) to be written into the lesson.
2747 013312 2747 -----------------------------------------------------------;
2748 013317 B175 2748 BEGIN
2749 013317 2749 controlstart:= Copy("ALG");
2750 013317 2750 goanywherecommands
2751 013332 E175 2751 END;
2752 013333 2752 checkprecedence(13);
2753 013333 2753 COMMENT -------------------------------------------------
2754 013333 2754 Now it is time to output the user's own PROCEDURE
2755 013333 2755 declarations.
2756 013333 2756 -----------------------------------------------------------;
2757 013336 2757 putprocedures;
2758 013340 2758 WHILE (controlstart = "PRO" OR controlstart = "HEL") DO
2759 013357 B176 2759 BEGIN
2760 013357 2760 WHILE controlstart = "PRO" DO
2761 013357 2761 COMMENT -------------------------------------------------
2762 013357 2762 This command is used to make a standard ALGOL PROCEDURE
2763 013357 2763 declaration. Code followingthe %PROCEDURE command is
2764 013357 2764 processed like code following the %ALGOL command except that
2765 013357 2765 it is written into the lesson at the point where PROCEDURE
2766 013357 2766 declarations belong.
2767 013357 2767
2768 013357 2768 The %PROCEDURE command itself is not copied, since it might
2769 013357 2769 as well have been abbreviated to '%PRO'. Thus the terms
2770 013357 2770 'PROCEDURE', 'EXTERNAL PROCEDURE', and so on should occur
2771 013357 2771 immediately after '%PROCEDURE' even though this might appear
2772 013357 2772 redundant.
2773 013357 2773 -----------------------------------------------------------;
2774 013364 B177 2774 BEGIN
2775 013364 2775 controlstart:= Copy("ALG");
2776 013375 2776 Newline;
2777 013377 2777 Newline;
2778 013377 2778 goanywherecommands
2779 013403 E177 2779 END controlstart = "PRO";
2780 013404 2780 WHILE controlstart = "HEL" DO
2781 013404 2781 COMMENT -------------------------------------------------
2782 013404 2782 The %HELP command causes GNOSIS to establish a golbal help
2783 013404 2783 text, i.e., one which is potentially accessible by the
2784 013404 2784 student from any part of the lesson. '%ALGOL <help text
2785 013404 2785 name>', wherever it may appear in the script, will
2786 013404 2786 subsequently cause the help text to be displayed.
2787 013404 2787
2788 013404 2788 The name of the help procedure (limited to a single word)
2789 013404 2789 must immediately follow '%HELP', on the same command line.
2790 013404 2790 Unlike the %PROCEDURE command (see above), GNOSIS does in
2791 013404 2791 his case write the word 'PROCEDURE' into the translated
2792 013404 2792 lesson.
2793 013404 2793 -----------------------------------------------------------;
2794 013411 B178 2794 BEGIN
2795 013411 2795 Write("[2N]PROCEDURE ");
2796 013414 2796 Write(getword);
2797 013417 2797 Write(";;[N]");
2798 013422 2798 Write("BEGIN[N]");
2799 013425 2799 textlines;
2800 013427 2800 Write("END;;[N]");
2801 013427 2801 goanywherecommands
2802 013434 E178 2802 END controlstart = "HEL";
2803 013435 E176 2803 END "PRO" or "HEL";
2804 013436 2804 checkprecedence(14);
2805 013441 2805 putvalues;
2806 013443 2806 WHILE controlstart = "INI" DO
2807 013443 2807 COMMENT -------------------------------------------------
2808 013443 2808 This command is normally used to initialize global variables
2809 013443 2809 which have been declared with the %VARIABLES command,
2810 013443 2810 although it could just as well be used to reinitialize
2811 013443 2811 GNOSIS system parameters if that should ever be necessary.
2812 013443 2812 %INITIALIZE operates like %ALGOL (see above), except that
2813 013443 2813 the code following %INITIALIZE is written into the lesson at
2814 013443 2814 the point where data are initialized, just before the start
2815 013443 2815 of the main program.
2816 013443 2816 -----------------------------------------------------------;
2817 013450 B179 2817 BEGIN
2818 013450 2818 controlstart:= Copy("ALG");
2819 013461 2819 Newline;
2820 013463 2820 Newline;
2821 013463 2821 goanywherecommands
2822 013467 E179 2822 END;
2823 013470 2823 checkprecedence(16);
2824 013470 2824 COMMENT -------------------------------------------------
2825 013470 2825 Now we finish the lesson preface by outputting the final
2826 013470 2826 portion of the header. This code sets up some I/O routines
2827 013470 2827 and does some further initialization.
2828 013470 2828 -----------------------------------------------------------;
2829 013473 2829 putheader;
2830 013473 2830
2831 013473 2831 whichcontrol:
2832 013475 2832 COMMENT -------------------------------------------------
2833 013475 2833 Check which of the remaining GNOSIS command lines we have
2834 013475 2834 here.
2835 013475 2835 -----------------------------------------------------------;
2836 013507 2836 goanywherecommands;
2837 013511 2837 IF controlstart = "QEN" THEN
2838 013511 2838 COMMENT -------------------------------------------------
2839 013511 2839 This command is used because, as a side-effect, it causes
2840 013511 2840 GNOSIS to finishing writing code for a particular
2841 013511 2841 question-and-answer processing loop. This command is rarely
2842 013511 2842 used since %TEXT, %QUESTION and %END contain this command
2843 013511 2843 implicitly. However, %QEND is sometimes useful before
2844 013511 2844 certain %ALGOL commands since those commands do NOT
2845 013511 2845 implicitly close the question-and-answer loop. So, for
2846 013511 2846 example, if you had an independent block of ALGOL code to
2847 013511 2847 insert between two %QUESTION commands, it would be necessary
2848 013511 2848 to use %QEND after the first question and answer patterns.
2849 013511 2849 -----------------------------------------------------------;
2850 013516 B180 2850 BEGIN
2851 013516 2851 shortalgol;
2852 013520 2852 GOTO checkline
2853 013521 E180 2853 END;
2854 013521 2854 IF controlstart = "TEX" THEN
2855 013521 2855 COMMENT -------------------------------------------------
2856 013521 2856 The text on the lines following this command, and until the
2857 013521 2857 next GNOSIS command, will be displayed to the student. Like
2858 013521 2858 many other commands, the %TEXT command can take any single
2859 013521 2859 line of ALGOL code as an argument. Usually this code will
2860 013521 2860 contain conditions (as arguments for IF-statemens) and/or
2861 013521 2861 labels.
2862 013521 2862 -----------------------------------------------------------;
2863 013526 B181 2863 BEGIN
2864 013526 2864 texcount:= texcount + 1;
2865 013531 2865 Write("[4N]COMMENT: Text");
2866 013534 2866 Print(texcount,2);
2867 013540 2867 Write(";;[N]");
2868 013543 2868 shortalgol;
2869 013545 2869 previouslab:= mainlab;
2870 013554 2870 makemainlab;
2871 013556 2871 Newline;
2872 013560 2872 Write(mainlab);
2873 013563 2873 Write(":[N]");
2874 013566 2874 textlines;
2875 013570 2875 Write("BEGIN[N]pause;;[N]");
2876 013573 2876 IF NOT lock THEN
2877 013575 B182 2877 BEGIN
2878 013575 2878 COMMENT -------------------------------------------------
2879 013575 2879 When the student executes a BACK command, he is backed to
2880 013575 2880 the previous %TEXT or %QUESTION. What usually follows is a
2881 013575 2881 repetition of the material he just encountered, but not
2882 013575 2882 always. If he arrived at the point where he issues the BACK
2883 013575 2883 command via a GOTO, then the backstepping (which is alaways
2884 013575 2884 linear) will not return him to the material just
2885 013575 2885 encountered. We have a fix for this, but do not feel that
2886 013575 2886 the additional overhead required by the fix can be
2887 013575 2887 justified.
2888 013575 2888 -----------------------------------------------------------;
2889 013575 2889 Write("IF back THEN[N]BEGIN[N]back:= FALSE;;[N]GOTO ");
2890 013600 2890 Write(previouslab);
2891 013603 2891 Write(";;[N]END;;[N]")
2892 013606 E182 2892 END;
2893 013606 2893 Write("END;;[N]");
2894 013611 2894 GOTO whichcontrol
2895 013612 E181 2895 END;
2896 013612 2896 IF controlstart = "QUE" THEN
2897 013617 B183 2897 BEGIN
2898 013617 2898 COMMENT -------------------------------------------------
2899 013617 2899 Code which initializes question handling is written into the
2900 013617 2900 lesson at this point. With the exception of the incremental
2901 013617 2901 comment GNOSIS supplies to identify the question, this code
2902 013617 2902 is rewritten in essentially the same form for each
2903 013617 2903 occurrence of '%QUESTION' in the lesson script.
2904 013617 2904
2905 013617 2905 The %QUESTION command can take any single line of ALGOL code
2906 013617 2906 as an argument. Uusally this code will contain conditions
2907 013617 2907 (as arguments for IF-statements) and/or labels. If a label
2908 013617 2908 is supplied following this command, then it is extracted for
2909 013617 2909 further use in preparing identifying phrases for the teacher
2910 013617 2910 reports.
2911 013617 2911
2912 013617 2912 GNOSIS assumes teachers will usually not bother to label
2913 013617 2913 their questions, so a count is kept of the number of
2914 013617 2914 %QUESTION commands encountered in the lesson. The value of
2915 013617 2915 this count will be paried with students' unexpected answers
2916 013617 2916 to the question so that the the question which generated
2917 013617 2917 these unexpected answers may be identified in the teacher
2918 013617 2918 reports.
2919 013617 2919 -----------------------------------------------------------;
2920 013620 2920 INTEGER errcount;
2921 013620 2921 delet(lab);
2922 013623 2922 lab:= Copy("QZXAAA");
2923 013634 2923 delet(same);
2924 013637 2924 same:= "";
2925 013646 2925 errcount:= 0;
2926 013647 2926 allneutral:= TRUE;
2927 013650 2927 rightfound:= zeroprinted:= FALSE;
2928 013652 2928 qcount:= qcount+1;
2929 013655 2929 Write("[4N]COMMENT: Question");
2930 013660 2930 Print(qcount,2);
2931 013664 2931 Write(";;[N]");
2932 013667 2932 IF put THEN
2933 013671 B184 2933 BEGIN
2934 013672 2934 INTEGER pos1, pos2;
2935 013672 2935 delet(question);
2936 013677 2936 FOR pos1:= 1 STEP 1 UNTIL answerlength DO
2937 013703 B185 2937 BEGIN
2938 013703 2938 IF answer.[pos1] = colon THEN
2939 013711 B186 2939 BEGIN
2940 013720 B187 2940 IF pos1 < answerlength THEN pos1:= pos1 + 1 ELSE BEGIN
2941 013720 2941 pos2:= pos1 - 1;
2942 013723 2942 GOTO ditto
2943 013724 E187 2943 END;
2944 013724 2944 IF answer.[pos1] # equalsign THEN
2945 013732 B188 2945 BEGIN
2946 013732 2946 pos2:= pos1 - 2;
2947 013735 2947 pos1:= pos1 - 1;
2948 013735 2948
2949 013735 2949 ditto:
2950 013751 2950 IF answer.[pos1] # blank AND answer.[pos1] # semicolon THEN
2951 013772 B189 2951 BEGIN
2952 013772 2952 pos1:= pos1 - 1;
2953 013775 2953 GOTO ditto
2954 013776 E189 2954 END;
2955 013776 2955 delet(question);
2956 014006 2956 question:= Copy(answer,pos1+1,pos2);
2957 014021 2957 pos1:= pos2 + 1
2958 014021 E188 2958 END
2959 014024 E186 2959 END
2960 014024 E185 2960 END
2961 014025 E184 2961 END;
2962 014030 2962 shortalgol;
2963 014032 2963 previouslab:= mainlab;
2964 014041 2964 makemainlab;
2965 014043 2965 Newline;
2966 014045 2966 Write(mainlab);
2967 014050 2967 Write(":[N]");
2968 014053 2968 Write("BEGIN[N]INTEGER subblock;;[N]");
2969 014056 2969 Write("firsttry:= TRUE;;[N]lastrights:= lasterrors:= 0;;[N]");
2970 014061 2970 Write("ihaveblanked:= FALSE;;[N]");
2971 014061 2971 COMMENT -------------------------------------------------
2972 014061 2972 Repetition of the same question loop begins here.
2973 014061 2973 -----------------------------------------------------------;
2974 014064 2974 Write("IF FALSE THEN[N]");
2975 014067 2975 Write("BEGIN[2N]repeat:[N]");
2976 014072 2976 Write("tryagain;;[N]");
2977 014075 2977 Write("END;;[N]");
2978 014100 2978 Write("Newline;;[N]");
2979 014100 2979 COMMENT -------------------------------------------------
2980 014100 2980 Output of the question text - Input of the answer.
2981 014100 2981 -----------------------------------------------------------;
2982 014103 2982 textlines;
2983 014107 2983 IF bell THEN Write("Outsymbol(controlg);;[N]");
2984 014112 2984 Write("Write(prompt);;[N]getline;;[N]");
2985 014115 2985 Write("IF stop THEN[N]");
2986 014120 2986 Write("BEGIN[N]");
2987 014123 2987 IF put THEN
2988 014125 B190 2988 BEGIN
2989 014125 2989 saveanlen:= answerlength;
2990 014127 2990 answerlength:= 0;
2991 014130 2991 putaway;
2992 014132 2992 answerlength:= saveanlen
2993 014134 E190 2993 END;
2994 014134 2994 Write("stop:= FALSE;;[N]GOTO endoflesson;;[N]END;;[N]");
2995 014137 2995 IF NOT lock THEN
2996 014141 B191 2996 BEGIN
2997 014141 2997 Write("IF back THEN[N]");
2998 014144 2998 Write("BEGIN[N]");
2999 014147 2999 IF put THEN
3000 014151 B192 3000 BEGIN
3001 014151 3001 saveanlen:= answerlength;
3002 014153 3002 answerlength:= 0;
3003 014154 3003 putaway;
3004 014156 3004 answerlength:= saveanlen
3005 014160 E192 3005 END;
3006 014160 3006 Write("back:= FALSE;;[N]GOTO ");
3007 014163 3007 Write(previouslab);
3008 014166 3008 Write(";;[N]END;;[N]");
3009 014171 3009 Write("IF skip THEN[N]");
3010 014174 3010 Write("BEGIN[N]");
3011 014177 3011 IF put THEN
3012 014201 B193 3012 BEGIN
3013 014201 3013 saveanlen:= answerlength;
3014 014203 3014 answerlength:= 0;
3015 014204 3015 putaway;
3016 014206 3016 answerlength:= saveanlen
3017 014210 E193 3017 END;
3018 014210 3018 Write("skip:= FALSE;;[N]GOTO simulate;;[N]END;;[N]")
3019 014213 E191 3019 END;
3020 014213 3020 COMMENT -------------------------------------------------
3021 014213 3021 Loop for answer commands: %RIGHT, %WRONG, %LACK or
3022 014213 3022 %NEUTRAL.
3023 014213 3023 -----------------------------------------------------------;
3024 014213 3024
3025 014213 3025 answerfind:
3026 014224 3026 neutral:= FALSE;
3027 014225 3027 goanywherecommands;
3028 014227 3028 lack:= FALSE;
3029 014230 3029 IF controlstart = "RIG" THEN
3030 014235 B194 3030 BEGIN
3031 014235 3031 COMMENT -------------------------------------------------
3032 014235 3032 This command causes GNOSIS to search for an answer pattern
3033 014235 3033 and, if it is found, to consider it correct. If a match for
3034 014235 3034 the canned answer is found in the student's response, then
3035 014235 3035 the following happens:
3036 014235 3036
3037 014235 3037 ---- The GNOSIS system gives the student one of several
3038 014235 3038 stock messages, all of which have the effect of providing
3039 014235 3039 positive feedback.
3040 014235 3040
3041 014235 3041 ---- If he had previously missed this question then,
3042 014235 3042 depending on the circumstances, GNOSIS provides additional
3043 014235 3043 stock messages designed to encourage him.
3044 014235 3044
3045 014235 3045 ---- The text on the optional line(s) following the %RIGHT
3046 014235 3046 command (until the next GNOSIS command) is displayed to the
3047 014235 3047 student.
3048 014235 3048
3049 014235 3049 ---- Various statistical variables (see %TEXT command) are
3050 014235 3050 updated.
3051 014235 3051
3052 014235 3052 ---- GNOSIS moves on to the next item of business. We save
3053 014235 3053 first %RIGHT answer to give to the student (1) if he
3054 014235 3054 executes a SKIP command or (2) if he repeatedly fails to
3055 014235 3055 give a right answer.
3056 014235 3056 -----------------------------------------------------------;
3057 014235 3057 right:= TRUE;
3058 014236 3058 IF NOT rightfound THEN
3059 014240 B195 3059 BEGIN
3060 014240 3060 IF pos <= answerlength THEN
3061 014243 B196 3061 BEGIN
3062 014243 3062 delet(firstright);
3063 014246 3063 pastoperation;
3064 014250 3064 firstright:= Copy(answer, pos, answerlength);
3065 014263 3065 rightfound:= TRUE;
3066 014264 3066 pos:= 1
3067 014264 E196 3067 END
3068 014266 E195 3068 END
3069 014266 E194 3069 END ELSE
3070 014274 3070 IF controlstart = "WRO" THEN right:= FALSE ELSE
3071 014274 3071 COMMENT -------------------------------------------------
3072 014274 3072 This command causes GNOSIS to search for an answer pattern
3073 014274 3073 and, if it is found, to consider it wrong. If a match for
3074 014274 3074 the canned answer is found in the student's response, then
3075 014274 3075 the following happens:
3076 014274 3076
3077 014274 3077 ---- The GNOSIS system gives the student one of several
3078 014274 3078 stock messages, all of which have the effect of providing
3079 014274 3079 negative feedback.
3080 014274 3080
3081 014274 3081 ---- The text on the optional line(s) following the %WRONG
3082 014274 3082 command (until the next GNOSIS command) is displayed to the
3083 014274 3083 student.
3084 014274 3084
3085 014274 3085 ---- If the student is still getting meaningful help from
3086 014274 3086 the program, he is recycled through the question once more.
3087 014274 3087 Otherwise, GNOSIS simulates a correct answer (plus
3088 014274 3088 commentary for such an answer) and moves on to the next item
3089 014274 3089 of business.
3090 014274 3090 -----------------------------------------------------------;
3091 014303 3091 IF controlstart = "NEU" THEN neutral:= TRUE ELSE
3092 014303 3092 COMMENT -------------------------------------------------
3093 014303 3093 This command tells GNOSIS to search for an answer and, if it
3094 014303 3094 is found, to interpret it as being neither correct nor
3095 014303 3095 incorrect. If the neutral target text is found in the
3096 014303 3096 student's response, then any line(s) of comments or hints
3097 014303 3097 provided by the teacher will be displayed to the student at
3098 014303 3098 that point. The default for %NEUTRAL commands is '%GOTO
3099 014303 3099 next' so the teacher who wants a question repeated after
3100 014303 3100 GNOSIS has found a neutral match will have to insert '%GOTO
3101 014303 3101 repeat' after that %NEUTRAL command (and comments, if any).
3102 014303 3102
3103 014303 3103 Technical Note: The procedure "extratest" is NOT called for
3104 014303 3104 %NEUTRAL commands with empty answer patterns. Thus clever
3105 014303 3105 use of '%NEUTRAL <empty>' should enable the teacher to trap
3106 014303 3106 most misspelled answers with no prejudice to the student's
3107 014303 3107 score -- or ego.
3108 014303 3108 -----------------------------------------------------------;
3109 014305 3109 IF controlstart = "LAC" THEN
3110 014305 3110 COMMENT -------------------------------------------------
3111 014305 3111 This command causes GNOSIS to search for something which (a)
3112 014305 3112 is essential to a correct response but which (b) is likely
3113 014305 3113 to be missing. If the the item is not found in the
3114 014305 3114 student's answer, then he receives appropriate negative
3115 014305 3115 feedback from GNOSIS and the text (if any) on the optional
3116 014305 3116 line(s) after the %LACK command is displayed to him at that
3117 014305 3117 point. If more than one element is expected to be lacking
3118 014305 3118 from the student's response, then he receives feedback and
3119 014305 3119 commentary (if any) as soon as ANY of the elements cannot be
3120 014305 3120 detected in his response. The chief advantage of the %LACK
3121 014305 3121 command does not lie in its increased efficiency but rather
3122 014305 3122 in the opportunity it provides for writing highly specific
3123 014305 3123 diagnostic comments.
3124 014305 3124
3125 014305 3125 Technical Note: Regardless of context, %LACK works as if
3126 014305 3126 %NOORDER and %EXTRA were declared immediately above it.
3127 014305 3127 -----------------------------------------------------------;
3128 014312 B197 3128 BEGIN
3129 014312 3129 lack:= TRUE;
3130 014313 3130 right:= FALSE;
3131 014314 3131 IF NOT zeroprinted THEN zeroprint
3132 014320 E197 3132 END ELSE
3133 014321 B198 3133 BEGIN
3134 014321 3134 COMMENT -------------------------------------------------
3135 014321 3135 There are no more answer commands (i.e., %RIGHT, %WRONG,
3136 014321 3136 %LACK or %NEUTRAL) for the current question, so now we write
3137 014321 3137 the trailing code for this question segment and recycle via
3138 014321 3138 'GOTO whichcontrol' to the next non-answer command.
3139 014321 3139 -----------------------------------------------------------;
3140 014323 3140 IF NOT zeroprinted THEN zeroprint;
3141 014325 3141 unknownmessage;
3142 014327 3142 Write("END;;[N]");
3143 014332 3143 Write("[N]simulate:[N]");
3144 014335 3144 IF rightfound THEN
3145 014337 B199 3145 BEGIN
3146 014337 3146 Write("giveanswer;;[N]");
3147 014342 3147 textline(firstright);
3148 014345 3148 Write("Write(right[[random]]);;[N]Newline;;[N]GOTO SAMEQZXAAB;;[N]")
3149 014350 E199 3149 END;
3150 014350 3150 Write("[N]next:[N]");
3151 014353 3151 Write("pause;;[N]");
3152 014356 3152 IF NOT lock THEN
3153 014360 B200 3153 BEGIN
3154 014360 3154 Write("IF back THEN[N]BEGIN[N]back:= FALSE;;[N]GOTO ");
3155 014363 3155 Write(previouslab);
3156 014366 3156 Write(";;[N]END;;[N]")
3157 014371 E200 3157 END;
3158 014371 3158 Write("END;;[N]");
3159 014374 3159 GOTO whichcontrol
3160 014375 E198 3160 END;
3161 014375 3161 Write("IF ihaveblanked THEN restore;;[N]");
3162 014400 3162 delet(word);
3163 014403 3163 word:= getword;
3164 014413 3164 upcase(word);
3165 014423 3165 IF word = "" THEN empty:= TRUE;
3166 014424 3166 IF empty AND NOT right AND NOT neutral AND NOT lack THEN
3167 014433 B201 3167 BEGIN
3168 014433 3168 COMMENT -------------------------------------------------
3169 014433 3169 %WRONG with no answer pattern causes GNOSIS to generate code
3170 014433 3170 which handles unexpected answers.
3171 014433 3171 -----------------------------------------------------------;
3172 014433 3172 errcount:= errcount+1;
3173 014436 3173 IF errcount = 1 THEN
3174 014441 B202 3174 BEGIN
3175 014441 3175 IF NOT zeroprinted THEN zeroprint
3176 014445 E202 3176 END;
3177 014445 3177 Write("IF lasterrors =");
3178 014455 3178 Print(errcount - 1,2,0);
3179 014462 3179 Write(" THEN[N]");
3180 014465 3180 makelabel;
3181 014467 3181 unknownmessage;
3182 014471 3182 Newline;
3183 014473 3183 Write("SAME");
3184 014476 3184 Write(lab);
3185 014501 3185 Write(":[N]");
3186 014504 3186 textlines;
3187 014506 3187 gotoput;
3188 014510 3188 Write("END;;[N]");
3189 014513 3189 GOTO answerfind
3190 014514 E201 3190 END ELSE
3191 014515 B203 3191 BEGIN
3192 014515 3192 COMMENT -------------------------------------------------
3193 014515 3193 Now we interpret the teacher answer pattern and translate it
3194 014515 3194 into an ALGOL program sequence for comparing the student's
3195 014515 3195 answer with the pattern.
3196 014515 3196 -----------------------------------------------------------;
3197 014517 3197 IF NOT neutral THEN allneutral:= FALSE;
3198 014520 3198 IF errcount # 0 THEN
3199 014523 B204 3199 BEGIN
3200 014523 3200 errmess(TRUE, "3200: Expected answers must precede first [N]****** empty answer pattern. Command will be ignored.");
3201 014523 3201
3202 014523 3202 orderloop:
3203 014540 3203 getline;
3204 014550 3204 IF answer.[1] # controlchar THEN GOTO orderloop;
3205 014551 3205 getcontrolstart(4);
3206 014554 3206 GOTO answerfind
3207 014555 E204 3207 END;
3208 014555 3208 makelabel;
3209 014557 3209 IF order THEN
3210 014561 B205 3210 BEGIN
3211 014561 3211 Write("pos:= 1;;");
3212 014561 3212 Newline
3213 014566 E205 3213 END;
3214 014566 3214 WHILE word # "" DO
3215 014573 B206 3215 BEGIN
3216 014573 3216 IF NOT lack THEN
3217 014575 B207 3217 BEGIN
3218 014577 3218 IF NOT order THEN Write("pos:= 1;;[N]");
3219 014602 3219 Write("IF NOT ");
3220 014610 3220 IF NOT order OR extra THEN Write("anyw");
3221 014613 3221 Write("here(""")
3222 014616 E207 3222 END;
3223 014620 3223 IF lack THEN Write("pos:= 1;;[N]IF NOT anywhere(""");
3224 014625 3224 FOR wpos:= 1 STEP 1 UNTIL Length(word) DO
3225 014640 B208 3225 BEGIN
3226 014640 3226 charvalue:= word.[wpos];
3227 014650 3227 IF charvalue = doublequote THEN Outsymbol(charvalue);
3228 014656 3228 IF charvalue = semicolon THEN Outsymbol(semicolon);
3229 014661 3229 Outsymbol(charvalue)
3230 014664 E208 3230 END;
3231 014665 3231 Write(""") THEN GOTO ");
3232 014672 3232 IF lack THEN Write("LACK");
3233 014675 3233 Write(lab);
3234 014700 3234 Write(";;[N]");
3235 014703 3235 delet(word);
3236 014706 3236 word:= getword;
3237 014716 3237 upcase(word)
3238 014721 E206 3238 END;
3239 014722 3239 IF NOT(extra OR lack) AND NOT(neutral AND empty) THEN
3240 014732 B209 3240 BEGIN
3241 014734 3241 IF NOT order THEN Write("pos:= 1;;[N]");
3242 014737 3242 Write("IF NOT here(endofline) THEN GOTO ");
3243 014742 3243 Write(lab);
3244 014745 3244 Write(";;[N]")
3245 014750 E209 3245 END;
3246 014750 3246 IF lack THEN
3247 014752 B210 3247 BEGIN
3248 014752 3248 Write("GOTO ");
3249 014755 3249 Write(lab);
3250 014760 3250 Write(";;[N]");
3251 014763 3251 Newline;
3252 014765 3252 Write("LACK");
3253 014770 3253 Write(lab);
3254 014773 3254 Write(":[N]")
3255 014776 E210 3255 END;
3256 014776 3256 COMMENT -------------------------------------------------
3257 014776 3257 This code will tell the student whether he was right or
3258 014776 3258 wrong and will update the score statistics.
3259 014776 3259 -----------------------------------------------------------;
3260 014776 3260 IF NOT neutral THEN
3261 015000 B211 3261 BEGIN
3262 015006 3262 IF right THEN Write("rightmessage") ELSE Write("wrongmessage");
3263 015011 3263 Write(";;[N]")
3264 015014 E211 3264 END;
3265 015014 3265 IF lack THEN
3266 015016 B212 3266 BEGIN
3267 015016 3267 IF put THEN putaway
3268 015022 E212 3268 END;
3269 015022 3269 IF extra THEN
3270 015024 B213 3270 BEGIN
3271 015030 3271 IF (neutral AND NOT empty) OR right THEN Write("extratest;;[N]")
3272 015033 E213 3272 END;
3273 015033 3273 Newline;
3274 015035 3274 Write("SAME");
3275 015040 3275 Write(lab);
3276 015043 3276 Write(":[N]");
3277 015043 3277 COMMENT -------------------------------------------------
3278 015043 3278 This code will output the comment the teacher wrote to go
3279 015043 3279 with a student's answer.
3280 015043 3280 -----------------------------------------------------------;
3281 015046 3281 textlines;
3282 015050 3282 gotoput;
3283 015052 3283 GOTO answerfind
3284 015052 E203 3284 END
3285 015053 E183 3285 END;
3286 015056 3286 IF controlstart = "FIN" THEN
3287 015056 3287 COMMENT -------------------------------------------------
3288 015056 3288
3289 015056 3289 This command will enable the user to place one or more lines
3290 015056 3290 of ALGOL code in the GNOSIS translated lesson immediately
3291 015056 3291 before its final 'END'. (Ordinarily this would be possible
3292 015056 3292 only through editing the .ALG file produced by GNOSIS.)
3293 015056 3293 '%ALGOL <one or more lines of ALGOL code>' MUST follow the
3294 015056 3294 %FINISH command. Note too that %FINISH does NOT terminate
3295 015056 3295 the lesson script. A '%END' is still necessary to close the
3296 015056 3296 lesson.
3297 015056 3297 -----------------------------------------------------------;
3298 015063 B214 3298 BEGIN
3299 015063 3299 putfinish;
3300 015065 3300 getline;
3301 015075 3301 IF answer.[1] # controlchar THEN GOTO finclose;
3302 015076 3302 getcontrolstart(4);
3303 015101 3303 goanywherecommands;
3304 015103 3304 GOTO finclose
3305 015104 E214 3305 END;
3306 015104 3306 IF controlstart = "END" THEN
3307 015104 3307 COMMENT -------------------------------------------------
3308 015104 3308 This is -- MUST be -- the last command of a lesson. Any
3309 015104 3309 text after this command will be ignored by GNOSIS.
3310 015104 3310 -----------------------------------------------------------;
3311 015111 B215 3311 BEGIN
3312 015111 3312 putfinish;
3313 015111 3313
3314 015111 3314 finclose:
3315 015126 3315 IF transferlesson THEN Write(nextlesson);
3316 015131 3316 Write("[N]END;;[N]");
3317 015134 3317 delet(infile);
3318 015137 3318 Selectinput(0);
3319 015142 3319 Selectoutput(0);
3320 015145 3320 Closefile(1);
3321 015150 3321 Closefile(2);
3322 015153 3322 Write("...and is ready.[N]");
3323 015156 3323 GOTO start
3324 015157 E215 3324 END;
3325 015157 3325
3326 015157 3326 COMMENT -------------------------------------------------
3327 015157 3327 Since 'getcontrolstart' has validated the command, the only
3328 015157 3328 possible reason for reaching this point would be an error in
3329 015157 3329 precedence. Thus it is not necessary to call
3330 015157 3330 'checkprecedence' to discover this.
3331 015157 3331 -----------------------------------------------------------;
3332 015157 3332 errmess(TRUE,
3333 015157 3333 "3330: Command is out of place here. As a result,[N]****** this line up to next command line will be ignored.");
3334 015157 3334
3335 015157 3335 checkline:
3336 015174 3336 getline;
3337 015176 3337 IF answer.[1] # controlchar THEN
3338 015204 B216 3338 BEGIN
3339 015204 3339 errmess(TRUE,
3340 015204 3340 "3340: A command line is required at this point. As a result,[N]****** this line up to next command line will be ignored.");
3341 015210 3341 WHILE answer.[1] # controlchar DO getline
3342 015221 E216 3342 END;
3343 015221 3343
3344 015221 3344 controlline:
3345 015233 3345 getcontrolstart(4);
3346 015236 3346 GOTO whichcontrol;
3347 015236 3347
3348 015236 3348 stop:
3349 015247 E1 3349 END
No errors
E----1 PROGRAM
B----1 179
B----2 280
E----2 428
B----3 440
E----3 453
B----4 548
E----4 587
B----5 627
E----5 639
B----6 662
B----7 674
E----7 705
E----6 818
B----8 937
E----8 949
B----9 999
E----9 1018
B---10 1135
E---10 1172
B---11 1689
E---11 1783
B---12 1992
E---12 2015
B---13 2216
E---13 2228
B---14 2244
E---14 2257
B---15 2267
E---15 2280
B---16 2378
E---16 2388
B---17 2920
B---18 2934
E---18 2962
E---17 3286
E----1 3350
A 182# 2223 2252 2311
ALGLIN 590# 852 938 965 1193
ALGLOOP
961# 969
ALLNEUTRAL
194# 1037 2926 3197
ANSWER 187# 255 302 320 341 355 375 397 474 529 553 562 569 573
579 676 680 687 691 697 710 729 740 831 835 852 938 940
941 962 965 971 975 1163 2184 2188 2297 2298 2299 2371 2428 2432
2436 2671 2724 2938 2944 2950 2956 3064 3204 3301 3337 3341
ANSWERLENGTH
181# 255 258 319 341 344 712 729 742 830 834 851 852 938
939 963 965 2371 2427 2671 2724 2936 2940 2989 2990 2992 3001 3002
3004 3013 3014 3016 3060 3064
ANSWERFIND
3026# 3190 3207 3284
ARRAYNAME
1690# 1701 1702 1703 1705
BELL 195# 1269 1462 1826 1838 2096 2360 2587 2983
BLANK 180# 416 555 564 574 682 692 831 835 940 2304 2950
BLANKLOOP
550 562# 568 680# 686
BSKIP 831 834#
CARRIAGERETURN
180# 554 563 569 574 677 681 687 692 2291 2298
CHARVALUE
181# 3226 3227 3228 3229
CHECKLINE
2853 3336#
CHECKPRECEDENCE
1066# 2752 2804 2823
CLOSEFILE
2398 3320 3321
COLON 182# 2300 2938
COMMAND
1136# 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150
1151 1152 1153 1158
CONTROLINLINE
195# 296 305 323
CONTROLCHAR
180# 303 355 529 710 740 962 971 975 1163 1599 1618 1629 1677
1947 2184 2188 2365 2425 2428 2429 2432 2436 3204 3301 3337 3341
CONTROLSTART
187# 357 473 474 475 485 486 487 488 489 490 491 492 493
494 495 496 497 498 499 500 501 502 503 504 505 506 507
508 509 510 511 512 513 514 515 516 517 518 519 520 521
522 523 881 882 903 904 916 917 926 949 1158 2165 2310 2446
2459 2485 2505 2522 2549 2565 2579 2590 2602 2662 2674 2743 2749 2758
2760 2775 2780 2806 2818 2837 2854 2896 3029 3070 3091 3109 3286 3306
CONTROLLINE
3345#
COPY 245 255 331 341 474 579 697 729 852 938 965 1993 2194 2354
2371 2415 2540 2671 2724 2749 2775 2818 2922 2956 3064
COPYRIGHT
187# 1907 1910 1923 1926 2413 2671
DELET 210# 247 258 333 344 473 730 783 853 947 966 2193 2366 2412
2413 2414 2495 2921 2923 2935 2955 3062 3162 3235 3317
DELETE 217
DISK 195# 1796 1797 1799 1857 2039 2124 2360 2650
DITTO 2943 2950# 2954
DOT 182# 2303 2405
DOUBLEQUOTE
181# 632 1011 2306 3227
EARLYEXIT
1166 1170#
EMPTY 194# 2197 3165 3166 3239 3271
EQUALSIGN
182# 2301 2944
ERRCOUNT
2920# 2925 3172 3173 3178 3198
ERRLINES
182# 241 260 325 327 345 2365
ERRMESS
221# 316 322 324 368 371 392 526 943 973 1160 2177 2186 2430
2434 2455 2481 2501 2533 2536 2538 2545 2651 2727 3200 3332 3339
EXCLAMATION
180# 320 2305
EXTRA 194# 903 904 2359 3220 3239 3269
FILENAME
2267# 2269 2271 2272 2273 2274 2275 2276
FINCLOSE
3301 3305 3315#
FIRSTRIGHT
187# 3062 3064 3147
FORMFEED
182# 308 2293
FOUND 370 375#
GETCONTROLSTART
202# 356 456# 816 979 1164 2190 2444 3205 3302 3345
GETLINE
269# 528 529 706 733 812 961 970 976 1162 1163 2183 2189 2370
2424 2427 2437 3203 3300 3336 3342
GETNEXTLINE
284# 320 372 422 425
GETNEXTWORD
668# 697 701 784
GETWORD
206# 366 538# 579 583 2478 2496 2531 2541 2796 3163 3236
GOANYWHERECOMMANDS
858# 2164 2445 2751 2779 2802 2822 2836 3027 3303
GOTOPUT
2153# 3187 3282
I 280# 288 291 297 302 305 311 312 319 440# 441 443 444 447
448 449 456# 457# 458# 474 476 530 937# 939 940 941 1137# 1156
1158 1167 1992# 1996 2216# 2217 2220 2223 2224 2226 2244# 2246 2249 2252
2253 2255 2268# 2270 2271 2272 2273 2274 2275
IFSET 199# 391 393 396 419 2546
IFVAL 199# 397 420
INDEX 1689# 1697 1699 1704 1707 1714
INFILE 188# 2371 2372 2373 2375 2376 2379 2380 2385 2386 2389 2394 2399 2404
2405 2415 3317
INPUT 2325 2326 2327
INSYMBOL
290 293 301 2396
J 1992# 1995 1996
JUSTIFY
195# 707 881 882
K 2216# 2220 2221 2226 2244# 2249 2250 2255
KEEP 196# 1799 2039 2360 2562 2650 2728
LAB 188# 2194 2200 2217 2220 2223 2226 2313 2921 2922 3184 3233 3243 3249
3253 3275
LABELCOUNT
182# 1990 1995 2245 2353
LACK 196# 3028 3129 3166 3216 3223 3232 3239 3246 3265
LANGUAGE
180# 445 1039 1041 1203 1238 1239 1256 1262 1275 1276 1279 1280 1283
1284 1289 1290 1295 1296 1301 1302 1307 1308 1313 1314 1318 1323 1420
1459 1460 1468 1469 1566 1574 1589 1594 1611 1623 1640 1645 1666 1715
1748 1801 1802 1816 1834 1877 1887 1902 1918 1938 1939 1943 1946 1948
1949 1950 1951 1954 1961 2003 2008 2018 2027 2041 2046 2051 2056 2065
2066 2070 2071 2073 2077 2085 2090 2108 2110 2119 2120 2143 2361 2498
2499
LCAA 184# 447 2314
LCAE 184# 448 2315
LCE 184# 375 2317
LCOE 184# 449 2316
LEAVEFOR
2409 2412#
LEFTSQUARE
183# 633 1009 2307
LEGALCOMMAND
1135# 1154 1167
LENGTH 217 368 441 603 629 788 803 1003 1006 2217 2246 2269 2270 2375
2376 2379 2380 2385 2404 2533 3224
LESSONNAME
187# 1188 1680 1880 1890 1921 2021 2030 2121 2127 2131 2135 2139 2269
2270 2271 2310 2414 2415 2654 2656
LETTERCHANGE
2220# 2226 2249# 2255
LINECOUNT
183# 252 284 338 2352
LINEFEED
180# 307 2292 2299
LINENUMBER
188# 245 291 331 2295 2296
LINENUMBERED
196# 243 286 329 2351 2397
LOCK 195# 1259 1265 1266 1287 1305 1952 1964 1990 2099 2360 2576 2876 2995
3152
LOOP 301# 311 881# 980
M 1694# 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729
1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743
1744 1745 1746 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774
1775 1776 1777 1778 1779
MAINLAB
188# 1970 1993 2000 2102 2246 2249 2252 2255 2354 2869 2872 2963 2966
MAKELABEL
2206# 3180 3208
MAKEMAINLAB
202# 1998 2231# 2870 2964
MESSAGE
221# 223# 224# 262 1694# 1695# 1709
MOREWORDS
664# 778 781 785
N 1066# 1067# 1156 1167
NAME 195# 1569 1570 1577 1578 1814 2360 2599
NEUTRAL
194# 2195 3026 3091 3166 3197 3239 3260 3271
NEWLINE
257 263 343 606 946 963 1196 1782 1969 1999 2199 2658 2776 2777
2819 2820 2871 2965 3182 3213 3251 3273
NEWSTRING
2269 2295 2297 2379 2385
NEXTLESSON
188# 2478 2479 3315
NEXTWORD
663# 783 784 785 788 791 803 805
NOCONTROLC
195# 1220 1798 1872 2360 2454
NOIF 355 425#
NULL 554 563 569 583# 677 681 687 701#
OPENED 194# 2277 2360
OPENFILE
2276 2394 2399
OPENOUTPUT
2260# 2416
ORDER 194# 916 917 2360 3209 3218 3220 3241
ORDERLOOP
3203# 3204
OUT 307 314 319# 580 586# 698 704# 835 837# 962 979#
OUTPOS 662# 739 759 788 789 803
OUTPUT 2328
OUTSYMBOL
310 604 634 635 944 1011 1012 1599 1618 1629 1677 1947 3227 3228
3229
PASTOPERATION
202# 365 821# 850 2530 2670 2723 3063
POS 181# 426 549 570 573 576 579 627# 629 631 675 688 691 694
697 830 831 834 835 851 852 2374 2375 2376 2380 2381 2382 2383
2384 2396 2397 2404 2405 2407 2415 2671 2724 3060 3064 3066
POS1 548# 549 550 553 557 562 566 569 570 579 674# 675 676 680
684 687 688 697 2934# 2936 2938 2940 2941 2944 2946 2947 2950 2952
2956 2957
POS2 181# 1006 1008 2934# 2941 2946 2956 2957
PREVIOUSLAB
187# 2869 2890 2963 3007 3155
PRINT 252 338 1002 1707 2866 2930 3178
PUT 194# 1045 1190 1223 1534 1794 1820 1874 1934 2037 2083 2360 2650 2730
2932 2987 2999 3011 3267
PUTAWAY
987# 1046 2991 3003 3015 3268
PUTFINISH
1978# 3299 3312
PUTHEADER
1786# 2829
PUTPROCEDURES
1214# 2757
PUTVALUES
1655# 2805
PUTVARIABLES
1175# 2742
QCOUNT 182# 1002 2365 2928 2930
QUESTION
188# 1003 1006 1008 2310 2935 2955 2956
REPEAT 473# 532
RETURN 969 983#
RIGHT 194# 2195 3057 3070 3130 3166 3262 3271
RIGHTFOUND
196# 2927 3058 3065 3144
RIGHTMARGIN
183# 789 2309
RIGHTSQUARE
183# 634 1010 2308
S 210# 211# 217 280# 431# 432# 441 443 444 447 448 449 590# 591#
592# 603 604 610# 611# 612# 629 631
SAME 188# 2176 2180 2193 2194 2923 2924
SAVEANLEN
181# 2989 2993 3001 3005 3013 3017
SCREENLINES
662# 709 714 715 717 723 724 727 738 747 748 751 756 763
764 767 772 797 798 801 815
SELECTINPUT
2395 2400 3318
SELECTOUTPUT
240 264 328 347 2278 2652 2659 3319
SEMICOLON
182# 632 941 944 1010 2302 2950 3228
SGNOSIS
194# 1900 2016 2117 2360 2519
SHORTALGOL
841# 958 2851 2868 2962
SKIP 196# 417 419 425 2351
START 2342# 3324
STARTLOOP
2424# 2458 2484 2504 2521 2548 2564 2578 2589 2601 2661 2673 2732
STOP 2372 3349#
SWITCHNAME
191# 370 2535 2540
SWITCHVAL
199# 420 2543 2544
SWITCHWORD
188# 366 367 368 370 2531 2532 2533 2535 2540 2541 2542 2543 2544
SWITCHNUMBER
183# 369 370 391 393 396 397 418 419 420 2534 2535
SWITCHCOUNT
183# 369 418 2350 2534 2537 2539 2540 2543 2544 2546
T 280# 290 292 293 294 301 302 303 307 308 310 440# 548# 553
554 555 562 563 564 573 574 627# 631 632 633 634 635 674#
676 677 680 681 682 691 692 999# 1008 1009 1010 1011 1012
TABCHAR
180# 682 2294
TABERROR
281# 285 294 321
TEACHER
187# 1190 1193 1557 1582 1936 1940 2310 2366 2367 2412 2724 2725
TEMP 188# 245 246 247 255 256 258 331 332 333 341 342 344 729
730 852 853 938 947 965 966 2310 2378# 2379 2380 2381 2382 2383
2384 2385 2387
TEXCOUNT
182# 2365 2864 2866
TEXTLINES
642# 2799 2874 2982 3186 3281
TEXTLINE
610# 729 1468 1469 1568 1569 1570 1572 1576 1577 1578 1580 1582 1801
1802 1930 1931 1938 1939 1940 2048 2049 2053 2054 2058 2059 3147
TEXTLOOP
553# 559
TOGGLE 221# 222# 261
TRANSFERLESSON
195# 1221 2360 2480 3315
TYPE 1689# 1700 1701 1702 1703 1713
UCAA 184# 447 2318
UCAE 184# 448 2319
UCE 184# 375 2321
UCOE 184# 450 2320
UNKNOWNMESSAGE
1021# 3141 3181
UPCASE 202# 367 431# 475 2373 2479 2497 2532 2542 3164 3237
WHICHCONTROL
2832# 2895 3160 3346
WORD 187# 2310 2495 2496 2497 2498 2499 3162 3163 3164 3165 3214 3224 3226
3235 3236 3237
WORDLOOP
573# 578 691# 696
WPOS 181# 603 604 3224 3226
WRITE 246 251 253 256 261 262 332 337 339 342 346 628 637 715
718 726 746 750 755 766 771 779 791 792 796 800 804 805
806 813 815 1001 1005 1015 1036 1040 1042 1044 1058 1059 1060 1186
1187 1188 1189 1192 1194 1200 1201 1202 1205 1207 1208 1209 1210 1220
1221 1223 1225 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
1238 1241 1242 1243 1244 1246 1247 1248 1249 1250 1251 1252 1253 1254
1255 1258 1259 1260 1264 1265 1266 1267 1269 1270 1271 1272 1273 1274
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1289 1290
1291 1295 1296 1297 1299 1300 1301 1302 1303 1304 1307 1308 1309 1313
1314 1315 1317 1320 1321 1324 1325 1326 1327 1329 1330 1331 1332 1333
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1347 1348
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1377
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1405 1406 1407 1408
1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1422 1423 1424 1426
1427 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1470 1471 1473 1474
1475 1476 1477 1478 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489
1490 1491 1492 1493 1494 1496 1497 1498 1499 1501 1502 1503 1504 1505
1507 1508 1509 1510 1512 1513 1514 1515 1516 1518 1519 1520 1521 1522
1523 1524 1526 1527 1528 1529 1530 1531 1532 1533 1537 1538 1539 1540
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554
1555 1556 1560 1561 1562 1563 1564 1565 1571 1579 1583 1587 1588 1591
1592 1596 1597 1600 1601 1603 1604 1605 1606 1607 1608 1609 1610 1613
1614 1615 1616 1617 1619 1620 1621 1625 1626 1627 1628 1630 1631 1634
1635 1636 1637 1638 1639 1642 1643 1647 1648 1649 1651 1662 1664 1665
1668 1669 1671 1672 1673 1674 1675 1676 1678 1679 1680 1681 1705 1706
1708 1709 1710 1793 1796 1797 1798 1803 1805 1806 1818 1819 1823 1824
1826 1827 1828 1829 1830 1831 1832 1836 1837 1838 1839 1840 1841 1842
1843 1844 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1859
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1876
1879 1880 1881 1882 1883 1884 1885 1889 1890 1891 1892 1893 1894 1895
1896 1904 1905 1906 1909 1910 1911 1913 1914 1915 1916 1920 1921 1922
1925 1926 1927 1929 1933 1944 1946 1948 1949 1950 1951 1956 1957 1958
1959 1963 1964 1967 1970 1971 1972 1973 1989 1994 2000 2001 2005 2006
2010 2011 2013 2015 2020 2021 2022 2023 2024 2025 2029 2030 2031 2032
2033 2034 2043 2044 2061 2063 2064 2065 2066 2067 2070 2071 2072 2074
2078 2079 2080 2082 2087 2088 2092 2093 2095 2096 2097 2098 2101 2102
2103 2105 2106 2107 2109 2111 2112 2113 2115 2116 2119 2120 2121 2122
2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139
2140 2142 2145 2146 2147 2179 2180 2181 2195 2196 2200 2201 2337 2338
2339 2368 2369 2388 2389 2390 2653 2654 2655 2656 2657 2795 2796 2797
2798 2800 2865 2867 2872 2873 2875 2889 2890 2891 2893 2929 2931 2966
2967 2968 2969 2970 2974 2975 2976 2977 2978 2983 2984 2985 2986 2994
2997 2998 3006 3007 3008 3009 3010 3018 3142 3143 3146 3148 3150 3151
3154 3155 3156 3158 3161 3177 3179 3183 3184 3185 3188 3211 3218 3219
3220 3221 3223 3231 3232 3233 3234 3241 3242 3243 3244 3248 3249 3250
3252 3253 3254 3262 3263 3271 3274 3275 3276 3315 3316 3322
WRITINGALINE
664# 737 744 758 779 780 813
Z 182# 2221 2250 2312
ZEROPRINTED
196# 1061 2927 3131 3140 3175
ZEROPRINT
1050# 3132 3140 3176