perm filename PUI2S.PUI[DOC,AIL]2 blob
sn#198146 filedate 1976-01-28 generic text, type T, neo UTF8
1⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 1␈F1␈←
2⎇⎇␈F1SAIL Addendum 1␈→1069⎇243⎇1⎇0⎇⎇INTRODUCTION␈←
3⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16409⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
4⎇⎇␈F1␈→978⎇0⎇2⎇0⎇⎇␈F2INTRODUCTION␈F1␈←
5⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
6⎇⎇␈F1The⎇following⎇short⎇manual⎇describes⎇the⎇changes⎇that⎇have⎇happened⎇to⎇SAIL⎇since⎇the⎇publishing
7⎇⎇␈F1of⎇the⎇Manual⎇in⎇July⎇1973.⎇It⎇accurately⎇reflects⎇the⎇state⎇of⎇SAIL,⎇version⎇18,⎇which⎇was⎇last
8⎇⎇␈F1modified⎇on⎇November⎇23,⎇1975.⎇ The⎇reader⎇should⎇be⎇warned⎇that⎇many⎇of⎇these⎇new⎇features
9⎇⎇␈F1were⎇designed⎇for⎇veteran⎇SAIL⎇hackers.
10⎇⎇␈F1The⎇reader⎇may⎇also⎇want⎇to⎇refer⎇to⎇the⎇following⎇documents,⎇which⎇are⎇usually⎇kept⎇updated.
11⎇⎇␈F1MACLIE.WRU[DOC,AIL]␈=320⎇A⎇summary⎇of⎇commonly⎇made⎇errors⎇when⎇using⎇macros⎇and⎇what⎇to⎇do
12⎇⎇␈F1␈=320⎇about⎇them.
13⎇⎇␈F1TUTOR.DOC[DOC,AIL]␈=320⎇In⎇introduction⎇to⎇LEAP.
14⎇⎇␈F1LEAP.WRU[DOC,AIL]␈=320⎇A⎇detailed⎇description⎇of⎇the⎇runtime⎇environment⎇of⎇LEAP⎇for⎇the⎇hardy
15⎇⎇␈F1␈=320⎇few⎇who⎇want⎇to⎇interface⎇to⎇LEAP⎇in⎇assembly⎇language.
16⎇⎇␈F1SAIL.DOC[AIM,DOC]␈=320⎇The⎇July⎇'73⎇manual⎇(AIM-204)⎇in⎇LPT⎇form.⎇Warning:⎇this⎇version⎇is⎇the
17⎇⎇␈F1␈=320⎇Stanford⎇character⎇set.⎇ It⎇is⎇also⎇almost⎇300⎇pages⎇long.⎇ You⎇can⎇get⎇a
18⎇⎇␈F1␈=320⎇120⎇page⎇version,⎇set⎇in⎇two⎇columns⎇of⎇nice⎇type⎇from⎇the⎇National
19⎇⎇␈F1␈=320⎇Technical⎇Information⎇Service,⎇Springfield,⎇Virginia⎇22151.
20⎇⎇␈F1LIES[DOC,AIL]␈=320⎇This⎇file⎇contains⎇the⎇know⎇mistakes⎇in⎇the⎇Manual.⎇Soon⎇it⎇will⎇also
21⎇⎇␈F1␈=320⎇contain⎇the⎇known⎇mistakes⎇in⎇this⎇document.
22⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 2␈F1␈←
23⎇⎇␈F1SAIL Addendum 1␈→970⎇243⎇1⎇0⎇⎇NUMERICAL ROUTINES␈←
24⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16411⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
25⎇⎇␈F1␈→834⎇0⎇2⎇0⎇⎇␈F2NUMERICAL ROUTINES␈F1␈←
26⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
27⎇⎇␈F1A⎇collection⎇of⎇numerical⎇routines⎇has⎇been⎇added⎇to⎇SAIL.⎇ These⎇are⎇pre-declared⎇in⎇the
28⎇⎇␈F1compiler,⎇and⎇are⎇loaded⎇from⎇the⎇standard⎇SAIL⎇library.⎇ The⎇functions⎇are⎇quite⎇standard;
29⎇⎇␈F1following⎇are⎇the⎇equivalent⎇definitions:
30⎇⎇␈F11.␈=64⎇The⎇standard⎇trigonometric⎇functions.⎇ ASIN,⎇ACOS,⎇ATAN⎇and⎇ATAN2⎇return⎇results⎇in
31⎇⎇␈F1␈=64⎇radians.⎇ The⎇ATAN2⎇call⎇takes⎇arc-tangent⎇of⎇the⎇quotient⎇of⎇its⎇arguments;⎇in⎇this⎇way,⎇it
32⎇⎇␈F1␈=64⎇correctly⎇preserves⎇sign⎇information.
33⎇⎇␈F1 REAL PROCEDURE SIN (REAL RADIANS);
34⎇⎇␈F1 REAL PROCEDURE COS (REAL RADIANS);
35⎇⎇␈F1 REAL PROCEDURE SIND (REAL DEGREES);
36⎇⎇␈F1 REAL PROCEDURE COSD (REAL DEGREES);
37⎇⎇␈F1 REAL PROCEDURE ASIN (REAL ARGUMENT);
38⎇⎇␈F1 REAL PROCEDURE ACOS (REAL ARGUMENT);
39⎇⎇␈F1 REAL PROCEDURE ATAN (REAL ARGUMENT);
40⎇⎇␈F1 REAL PROCEDURE ATAN2 (REAL NUMERATOR,DENOMINATOR);
41⎇⎇␈F12.␈=64⎇The⎇hyperbolic⎇trigonometric⎇functions.
42⎇⎇␈F1 REAL PROCEDURE SINH (REAL ARGUMENT);
43⎇⎇␈F1 REAL PROCEDURE COSH (REAL ARGUMENT);
44⎇⎇␈F1 REAL PROCEDURE TANH (REAL ARGUMENT);
45⎇⎇␈F13.⎇␈=64⎇The⎇square-root⎇function:
46⎇⎇␈F1 REAL PROCEDURE SQRT (REAL ARGUMENT);
47⎇⎇␈F14.␈=64⎇A⎇pseudo-random⎇number⎇generator.⎇ The⎇argument⎇specifies⎇a⎇new⎇value⎇for⎇the⎇seed⎇(If⎇the
48⎇⎇␈F1␈=64⎇argument⎇is⎇0,⎇the⎇old⎇seed⎇value⎇is⎇used.⎇ Thus⎇to⎇get⎇differing⎇random⎇numbers,⎇this
49⎇⎇␈F1␈=64⎇argument⎇should⎇be⎇zero.)⎇ Results⎇are⎇normalized⎇to⎇lie⎇in⎇the⎇range⎇[0,1].
50⎇⎇␈F1 REAL PROCEDURE RAN (INTEGER SEED);
51⎇⎇␈F15.␈=64⎇Logarithm⎇and⎇exponentiation⎇functions.⎇ These⎇functions⎇are⎇the⎇same⎇ones⎇used⎇by⎇the
52⎇⎇␈F1SAIL Addendum 1␈→970⎇243⎇1⎇0⎇⎇NUMERICAL ROUTINES␈←
53⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16413⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
54⎇⎇␈F1␈=64⎇SAIL⎇exponentiation⎇operator.⎇ The⎇base⎇is⎇e⎇(2.71828182845904).⎇ The⎇logarithm⎇to⎇the⎇base
55⎇⎇␈F1␈=64⎇10⎇of⎇e⎇is⎇.4342944819.
56⎇⎇␈F1 REAL PROCEDURE LOG (REAL ARGUMENT);
57⎇⎇␈F1 REAL PROCEDURE EXP (REAL ARGUMENT);
58⎇⎇␈F1These⎇functions⎇may⎇occasionally⎇be⎇asked⎇to⎇compute⎇numbers⎇that⎇lie⎇outside⎇the⎇range⎇of⎇legal
59⎇⎇␈F1floating-point⎇numbers⎇on⎇the⎇PDP-10.⎇ In⎇these⎇cases,⎇the⎇routines⎇issue⎇sprightly⎇error⎇messages
60⎇⎇␈F1that⎇are⎇continuable.
61⎇⎇␈F12.1⎇-⎇␈F2OVERFLOW␈F1
62⎇⎇␈F1In⎇order⎇to⎇better⎇perform⎇their⎇tasks,⎇these⎇routines⎇enable⎇the⎇system⎇interrupt⎇facility⎇for
63⎇⎇␈F1floating-point⎇overflow⎇and⎇underflow⎇errors.⎇ If⎇an⎇underflow⎇is⎇detected,⎇the⎇results⎇are⎇set⎇to
64⎇⎇␈F10⎇(a⎇feat⎇not⎇done⎇by⎇the⎇PDP-10⎇hardware,⎇alas).⎇ Be⎇aware⎇that⎇such⎇underflow⎇fixups⎇will⎇be
65⎇⎇␈F1done⎇to⎇every⎇underflow⎇that⎇occurs⎇in⎇your⎇program.⎇ For⎇further⎇implementation⎇details,⎇see
66⎇⎇␈F1the⎇section⎇below.
67⎇⎇␈F1If⎇you⎇would⎇like⎇to⎇be⎇informed⎇of⎇any⎇numerical⎇exceptions,⎇you⎇can⎇call⎇the⎇runtime:
68⎇⎇␈F1 TRIGINI ( LOCATION(simple-procedure-name) );
69⎇⎇␈F1Every⎇floating-point⎇exception⎇that⎇is⎇not⎇expected⎇by⎇the⎇interrupt⎇handler⎇(the⎇numerical
70⎇⎇␈F1routines⎇use⎇a⎇special⎇convention⎇to⎇indicate⎇that⎇arithmetic⎇exception⎇was⎇expected)⎇will⎇cause
71⎇⎇␈F1the⎇specified⎇simple⎇procedure⎇to⎇be⎇called.⎇ This⎇procedure⎇may⎇look⎇around⎇the⎇world⎇as
72⎇⎇␈F1described⎇in⎇the⎇Manual⎇for⎇'export'⎇interrupt⎇handlers,⎇page⎇79.⎇ If⎇no⎇TRIGINI⎇call⎇is⎇done,⎇the
73⎇⎇␈F1interrupt⎇routine⎇will⎇simply⎇dismiss⎇unexpected⎇floating-point⎇interrupts.
74⎇⎇␈F12.2⎇-⎇␈F2ENTRY⎇POINTS␈F1
75⎇⎇␈F1In⎇order⎇to⎇avoid⎇confusion⎇(by⎇the⎇loader)⎇with⎇older⎇trig⎇packages,⎇the⎇entry⎇points⎇of⎇the⎇SAIL
76⎇⎇␈F1arithmetic⎇routines⎇all⎇have⎇a⎇"$"⎇appended⎇to⎇the⎇end.⎇ Thus,⎇SIN⎇has⎇the⎇entry⎇point⎇SIN$,⎇etc.
77⎇⎇␈F1WARNING:⎇If⎇a⎇program⎇plans⎇to⎇use⎇the⎇SAIL⎇intrinsic⎇numerical⎇routines,⎇it⎇should⎇NOT⎇include
78⎇⎇␈F1external⎇declarations⎇to⎇them,⎇since⎇this⎇will⎇probably⎇cause⎇the⎇FORTRAN⎇library⎇routines⎇to⎇be
79⎇⎇␈F1loaded.
80⎇⎇␈F1SAIL Addendum 1␈→970⎇243⎇1⎇0⎇⎇NUMERICAL ROUTINES␈←
81⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16416⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
82⎇⎇␈F12.3⎇-⎇␈F2OVERFLOW⎇IMPLEMENTATION␈F1
83⎇⎇␈F1This⎇section⎇may⎇be⎇skipped⎇by⎇all⎇but⎇those⎇interested⎇in⎇interfacing⎇number⎇crunching⎇assembly
84⎇⎇␈F1code⎇with⎇SAIL⎇routines⎇where⎇overflow⎇and⎇underflow⎇are⎇expected⎇to⎇be⎇a⎇problem.
85⎇⎇␈F1The⎇SAIL⎇arithmetic⎇interrupt⎇routines⎇first⎇check⎇to⎇see⎇if⎇the⎇interrupt⎇was⎇caused⎇by⎇floating
86⎇⎇␈F1exponent⎇underflow.⎇If⎇it⎇was,⎇then⎇the⎇result⎇is⎇set⎇to⎇zero,⎇be⎇it⎇in⎇an⎇accumulator,⎇memory,⎇or
87⎇⎇␈F1both.⎇ Then⎇if⎇the⎇arithmetic⎇instruction⎇that⎇causes⎇the⎇interrupt⎇if⎇followed⎇by⎇a⎇JFCL,⎇the⎇AC
88⎇⎇␈F1field⎇of⎇the⎇JFCL⎇is⎇compared⎇with⎇the⎇PC⎇flag⎇bits⎇to⎇see⎇if⎇the⎇JFCL⎇tests⎇for⎇any⎇of⎇the⎇flags
89⎇⎇␈F1that⎇are⎇on.⎇If⎇it⎇does,⎇those⎇flags⎇are⎇cleared⎇and⎇the⎇program⎇proceeds⎇at⎇the⎇effective⎇address
90⎇⎇␈F1of⎇the⎇JFCL⎇(i.e.,⎇the⎇hardware⎇is⎇simulated⎇in⎇that⎇case).⎇Note⎇that⎇no⎇instructions⎇may⎇intervene
91⎇⎇␈F1between⎇the⎇interrupt-causing⎇instruction⎇and⎇the⎇JFCL⎇or⎇the⎇interrupt⎇routines⎇will⎇not⎇see⎇the
92⎇⎇␈F1JFCL.⎇They⎇only⎇look⎇one⎇instruction⎇ahead.⎇ Note⎇that⎇in⎇any⎇case,⎇floating⎇exponent⎇underflow
93⎇⎇␈F1always⎇causes⎇the⎇result⎇to⎇be⎇set⎇to⎇zero.⎇There⎇is⎇no⎇way⎇to⎇disable⎇that⎇effect.
94⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 3␈F1␈←
95⎇⎇␈F1SAIL Addendum 1␈→934⎇243⎇1⎇0⎇⎇NEW PROCESS FEATURES␈←
96⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16418⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
97⎇⎇␈F1␈→785⎇0⎇2⎇0⎇⎇␈F2NEW PROCESS FEATURES␈F1␈←
98⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
99⎇⎇␈F13.1⎇-⎇␈F2SPROUT⎇APPLY␈F1
100⎇⎇␈F1The⎇<procedure⎇call>⎇in⎇a⎇SPROUT⎇statement⎇may⎇be⎇an⎇APPLY⎇construct.⎇ In⎇ this⎇case⎇SPROUT
101⎇⎇␈F1will⎇ do⎇the⎇"right"⎇thing⎇ about⎇setting⎇up⎇the⎇static⎇link⎇for⎇ the⎇APPLY.⎇That⎇is,⎇"up-level"
102⎇⎇␈F1references⎇by⎇the⎇process⎇will⎇be⎇made⎇to⎇the⎇same⎇variable⎇instances⎇that⎇would⎇be⎇used⎇if⎇the
103⎇⎇␈F1APPLY⎇did⎇not⎇occur⎇in⎇a⎇SPROUT⎇statement.⎇(See⎇page⎇77⎇of⎇the⎇manual.)
104⎇⎇␈F1However,⎇there⎇is⎇a⎇glitch.⎇The⎇sprout⎇mechanism⎇is⎇not⎇yet⎇smart⎇enough⎇to⎇find⎇out⎇the⎇block
105⎇⎇␈F1of⎇the⎇declaration⎇of⎇the⎇procedure⎇used⎇to⎇define⎇the⎇procedure⎇item.⎇It⎇would⎇be⎇nice⎇if⎇it⎇did,
106⎇⎇␈F1since⎇then⎇it⎇could⎇warn⎇the⎇user⎇when⎇that⎇block⎇was⎇exited⎇and⎇yet⎇the⎇process⎇was⎇still⎇alive,
107⎇⎇␈F1and⎇thus⎇potentially⎇able⎇to⎇refer⎇to⎇deallocated⎇arrays⎇and⎇etc.⎇What⎇the⎇sprout⎇does⎇instead⎇is
108⎇⎇␈F1assume⎇the⎇procedure⎇was⎇declared⎇in⎇the⎇outer⎇block.⎇This⎇may⎇be⎇fixed⎇ eventually,⎇but⎇in⎇the
109⎇⎇␈F1meantime⎇ some⎇extra⎇care⎇should⎇be⎇taken⎇ when⎇using⎇ apply⎇in⎇sprouts⎇to⎇ avoid⎇ exiting⎇a
110⎇⎇␈F1block⎇ with⎇dependents.⎇ Similarly,⎇be⎇warned⎇ that⎇the⎇"DEPENDENTS⎇(<blockid>)"⎇construct
111⎇⎇␈F1may⎇ not⎇give⎇ the⎇ "right"⎇result⎇ for⎇ sprout⎇applies.⎇Page⎇68⎇of⎇the⎇Manual⎇contains⎇the
112⎇⎇␈F1description⎇of⎇this⎇protection⎇mechanism⎇for⎇non-APPLY⎇Sprouts.
113⎇⎇␈F13.2⎇-⎇␈F2SPROUT_DEFAULTS␈F1
114⎇⎇␈F1SAIL⎇ now⎇provides⎇ a⎇mechanism⎇ by⎇which⎇ the⎇user⎇ may⎇specify⎇ the⎇"default"⎇options⎇to⎇be
115⎇⎇␈F1used⎇when⎇individual⎇procedures⎇are⎇sprouted.
116⎇⎇␈F3Syntax:
117⎇⎇␈F3 PROCEDURE <procid> ...
118⎇⎇␈F3 BEGIN
119⎇⎇␈F3 <some declarations>;
120⎇⎇␈F3 SPROUT_DEFAULTS <integer constant>;
121⎇⎇␈F3 <perhaps some more declarations>;
122⎇⎇␈F3 :
123⎇⎇␈F3 :
124⎇⎇␈F3 <statements>
125⎇⎇␈F1SAIL Addendum 1␈→934⎇243⎇1⎇0⎇⎇NEW PROCESS FEATURES␈←
126⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16422⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
127⎇⎇␈F3 :
128⎇⎇␈F3 END;
129⎇⎇␈F1In⎇other⎇words,⎇SPROUT_DEFAULTS⎇is⎇a⎇declaration.
130⎇⎇␈F1Semantics:
131⎇⎇␈F1If⎇ one⎇of⎇the⎇"allocation"⎇fields⎇of⎇ the⎇options⎇word⎇passed⎇to⎇the⎇SPROUT⎇routine⎇--⎇i.e.
132⎇⎇␈F1QUANTUM,STRINGSTACK,PSTACK,⎇or⎇ PRIORITY⎇--⎇is⎇zero,⎇ then⎇ SPROUT⎇ will⎇look⎇ at
133⎇⎇␈F1the⎇corresponding⎇ field⎇of⎇ the⎇specified⎇<integer⎇constant>⎇for⎇the⎇procedure⎇being⎇sprouted.⎇If
134⎇⎇␈F1the⎇field⎇is⎇ non-zero,⎇ then⎇ that⎇value⎇ will⎇be⎇ used;⎇otherwise⎇ the⎇current⎇"system"⎇default
135⎇⎇␈F1will⎇be⎇used.
136⎇⎇␈F1NOTE:⎇ SPROUT_DEFAULTS⎇ only⎇applies⎇ to⎇ "allocations",⎇i.e.⎇ the⎇process⎇status⎇control⎇bits
137⎇⎇␈F1(e.g.⎇SUSPME)⎇are⎇not⎇affected.
138⎇⎇␈F3Example:
139⎇⎇␈F3 RECURSIVE PROCEDURE FOO;
140⎇⎇␈F3 BEGIN
141⎇⎇␈F3 SPROUT_DEFAULTS STRINGSTACK(10);
142⎇⎇␈F3 INTEGER XXX;
143⎇⎇␈F3 :
144⎇⎇␈F3 :
145⎇⎇␈F3 END;
146⎇⎇␈F3 :
147⎇⎇␈F3 SPROUT(P1,FOO,STRINGSTACK(3));
148⎇⎇␈F3 SPROUT(P2,FOO);
149⎇⎇␈F3 COMMENT P1 will have a string stack of 3*32 words.
150⎇⎇␈F3 P2 will have a string stack of 10*32 words;
151⎇⎇␈F1SAIL Addendum 1␈→934⎇243⎇1⎇0⎇⎇NEW PROCESS FEATURES␈←
152⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16423⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
153⎇⎇␈F13.3⎇-⎇␈F2SUSPEND␈F1
154⎇⎇␈F1SUSPEND⎇now⎇behaves⎇like⎇RESUME⎇in⎇that⎇it⎇returns⎇an⎇item.
155⎇⎇␈F1 itm ← SUSPEND(<process item>)
156⎇⎇␈F1Frequently,⎇one⎇is⎇suspending⎇some⎇other⎇process⎇than⎇the⎇one⎇that⎇is⎇executing⎇the⎇SUSPEND
157⎇⎇␈F1statement.⎇In⎇this⎇case,⎇the⎇item⎇returned⎇is⎇ANY.⎇ However,⎇in⎇cases⎇like:
158⎇⎇␈F1 X ← SUSPEND(MYPROC);
159⎇⎇␈F1where⎇the⎇process⎇suspends⎇itself,⎇it⎇might⎇happen⎇that⎇this⎇process⎇is⎇made⎇running⎇by⎇a
160⎇⎇␈F1RESUME⎇from⎇another⎇process.⎇If⎇so,⎇then⎇X⎇receives⎇the⎇<return_item>⎇ that⎇was⎇an⎇argument
161⎇⎇␈F1to⎇the⎇RESUME.
162⎇⎇␈F13.4⎇-⎇␈F2FAIL⎇AND⎇SUCCEED␈F1
163⎇⎇␈F1FAIL⎇and⎇SUCCEED⎇now⎇behave⎇like⎇RESUME⎇and⎇SUSPEND⎇in⎇that⎇they⎇also⎇return⎇an⎇item.
164⎇⎇␈F1The⎇item⎇returned⎇is⎇ANY⎇unless⎇the⎇Matching⎇Procedure⎇containing⎇the⎇FAIL⎇or⎇SUCCEED⎇was
165⎇⎇␈F1(1)⎇sprouted⎇as⎇a⎇process,⎇and⎇(2)⎇made⎇running⎇by⎇a⎇RESUME⎇construct.⎇ In⎇the⎇latter⎇case,⎇the
166⎇⎇␈F1item⎇returned⎇is⎇the⎇<return_item>⎇that⎇was⎇an⎇argument⎇to⎇the⎇RESUME.⎇ [Note⎇that⎇the⎇only
167⎇⎇␈F1case⎇in⎇which⎇a⎇Matching⎇Procedure⎇can⎇be⎇reactivated⎇at⎇a⎇FAIL⎇is⎇by⎇being⎇RESUMEd.]
168⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 4␈F1␈←
169⎇⎇␈F1SAIL Addendum 1␈→1040⎇243⎇1⎇0⎇⎇ERROR HANDLING␈←
170⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16426⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
171⎇⎇␈F1␈→929⎇0⎇2⎇0⎇⎇␈F2ERROR HANDLING␈F1␈←
172⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
173⎇⎇␈F14.1⎇-⎇␈F2ERROR⎇MODES␈F1
174⎇⎇␈F1SAIL's⎇error⎇ handler⎇has⎇at⎇ long⎇last⎇been⎇ modified⎇to⎇do⎇ what⎇is⎇claimed⎇it⎇will⎇do⎇ in⎇Section
175⎇⎇␈F120⎇of⎇the⎇manual⎇(pgs⎇95⎇-⎇97),⎇and⎇in⎇the⎇description⎇of⎇USERERR⎇(pg⎇42).⎇ In⎇brief,⎇it⎇allows⎇one
176⎇⎇␈F1to⎇ have⎇error⎇ messages⎇automatically⎇ sent⎇ to⎇ a⎇"log"⎇ file⎇ while⎇one⎇ is⎇compiling,⎇and⎇to⎇use
177⎇⎇␈F1USERERR⎇as⎇a⎇trace⎇statement.
178⎇⎇␈F1The⎇description⎇given⎇in⎇the⎇manual⎇differs⎇from⎇reality⎇in⎇two⎇ways:⎇"Keep"⎇mode⎇has⎇not⎇ been
179⎇⎇␈F1implemented⎇(the⎇error⎇handler⎇ will⎇flush⎇all⎇type-ahead⎇except⎇a⎇<lf>);⎇ all⎇of⎇the⎇ other⎇modes
180⎇⎇␈F1("Quiet",⎇ "Logging",⎇and⎇"Numbers")⎇are⎇implemented⎇ONLY⎇ IN⎇THE⎇COMPILER.⎇ However,⎇one
181⎇⎇␈F1can⎇get⎇the⎇effect⎇of⎇error⎇modes⎇at⎇runtime⎇by⎇using⎇a⎇brand⎇new⎇feature⎇called⎇user⎇error
182⎇⎇␈F1procedures.
183⎇⎇␈F14.2⎇-⎇␈F2ALTMODE⎇RESPONSE␈F1
184⎇⎇␈F1After⎇an⎇"E"⎇or⎇"T"⎇response⎇to⎇the⎇error⎇handler,⎇an⎇altmode⎇will⎇return⎇to⎇the⎇question⎇loop;
185⎇⎇␈F1i.e.,⎇you⎇may⎇change⎇your⎇mind⎇if⎇you⎇do⎇not⎇wish⎇to⎇edit.⎇ Normal⎇monitor⎇line⎇editing⎇of⎇the⎇file
186⎇⎇␈F1name⎇is⎇allowed.
187⎇⎇␈F14.3⎇-⎇␈F2USER⎇ERROR⎇PROCEDURES␈F1
188⎇⎇␈F1A⎇ user⎇error⎇ procedure⎇is⎇a⎇ user⎇procedure⎇ that⎇is⎇run⎇ before⎇or⎇instead⎇of⎇ the⎇ SAIL⎇error
189⎇⎇␈F1handler⎇ everytime⎇ an⎇error⎇ occurs⎇ at⎇runtime.⎇ This⎇ includes⎇all⎇array⎇errors,⎇IO⎇ errors,
190⎇⎇␈F1Leapish⎇errors⎇and⎇all⎇USERERRs.⎇ It⎇does⎇not⎇include⎇system⎇errors,⎇such⎇as⎇Ill⎇Mem⎇Ref⎇or⎇Ill
191⎇⎇␈F1UUO.
192⎇⎇␈F1The⎇ procedure⎇one⎇uses⎇ for⎇a⎇ user⎇error⎇procedure⎇ must⎇be⎇ of⎇the⎇following⎇type:
193⎇⎇␈F1SAIL Addendum 1␈→1040⎇243⎇1⎇0⎇⎇ERROR HANDLING␈←
194⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16431⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
195⎇⎇␈F1␈→359⎇0⎇2⎇0⎇⎇SIMPLE INTEGER PROCEDURE proc (INTEGER loc; STRING msg, rsp);␈←
196⎇⎇␈F1Only⎇the⎇names⎇ proc,⎇loc,⎇ msg,⎇and⎇rsp⎇ may⎇vary⎇ from⎇the⎇ example⎇above,⎇except⎇ that⎇one
197⎇⎇␈F1may⎇declare⎇ the⎇procedure⎇ INTERNAL⎇if⎇ one⎇wishes⎇to⎇use⎇it⎇across⎇files.
198⎇⎇␈F1Whenever⎇ the⎇external⎇integer⎇_ERRP_⎇ is⎇loaded⎇with⎇LOCATION(proc),⎇the⎇error⎇handler⎇will
199⎇⎇␈F1call⎇proc⎇before⎇it⎇ does⎇anything⎇else.⎇ It⎇will⎇set⎇loc⎇to⎇ the⎇core⎇location⎇of⎇the⎇call⎇ to⎇the
200⎇⎇␈F1error⎇handler.⎇ Msg⎇ will⎇be⎇ the⎇message⎇ that⎇it⎇ would⎇have⎇ printed.⎇ Rsp⎇will⎇be⎇non-NULL
201⎇⎇␈F1only⎇if⎇the⎇error⎇was⎇from⎇a⎇USERERR⎇which⎇had⎇response⎇string⎇argument.⎇ Proc⎇can⎇do⎇anything
202⎇⎇␈F1that⎇ a⎇simple⎇procedure⎇can⎇do.⎇ When⎇it⎇exits,⎇it⎇should⎇ return⎇an⎇ integer⎇which⎇ tells⎇the
203⎇⎇␈F1error⎇handler⎇ if⎇ it⎇should⎇do⎇anything⎇more.⎇ If⎇the⎇integer⎇is⎇0,⎇the⎇error⎇handler⎇will⎇(1)⎇ print
204⎇⎇␈F1the⎇ message,⎇(2)⎇ print⎇the⎇location,⎇and⎇(3)⎇query⎇the⎇tty⎇and⎇dispatch⎇on⎇the⎇response⎇character
205⎇⎇␈F1(i.e⎇ask⎇for⎇a⎇<cr>,⎇<lf>,⎇etc.).⎇ If⎇the⎇right⎇half⎇of⎇the⎇integer⎇is⎇non-zero,⎇it⎇is⎇taken⎇as⎇the⎇ascii
206⎇⎇␈F1for⎇a⎇character⎇to⎇dispatch⎇upon.⎇ The⎇left⎇half⎇may⎇have⎇two⎇bits⎇to⎇control⎇printing.⎇ If⎇bit⎇17
207⎇⎇␈F1in⎇the⎇integer⎇is⎇on,⎇message⎇printing⎇is⎇inhibited.⎇ If⎇bit⎇16⎇is⎇on,⎇then⎇the⎇location⎇printing⎇is
208⎇⎇␈F1inhibited.⎇For⎇example,⎇"X"+(1⎇LSH⎇18)⎇will⎇cause⎇the⎇location⎇to⎇be⎇printed⎇and⎇the⎇program
209⎇⎇␈F1exited.⎇"C"+(3⎇LSH⎇18)⎇will⎇cause⎇the⎇error⎇handler⎇to⎇continue⎇without⎇printing⎇anything.
210⎇⎇␈F1Note⎇that⎇simple⎇ procedures⎇can⎇not⎇do⎇ a⎇non-local⎇GOTO.⎇ However,⎇the⎇ effect⎇of⎇ a⎇non-
211⎇⎇␈F1local⎇ GOTO⎇ can⎇be⎇ achieved⎇in⎇ a⎇ user⎇error⎇procedure⎇by⎇loading⎇the⎇external⎇integer
212⎇⎇␈F1_ERRJ_⎇with⎇the⎇LOCATION⎇of⎇a⎇label.⎇The⎇label⎇should⎇be⎇a⎇on⎇a⎇call⎇to⎇a⎇non-simple⎇procedure
213⎇⎇␈F1which⎇does⎇the⎇desired⎇GOTO.⎇ The⎇error⎇handler⎇clears⎇_ERRJ_⎇before⎇calling⎇the⎇procedure⎇in
214⎇⎇␈F1_ERRP_.⎇ If⎇_ERRJ_⎇ is⎇non-zero⎇when⎇the⎇ user⎇procedure⎇returns,⎇and⎇continuing⎇was⎇specified,
215⎇⎇␈F1then⎇the⎇error⎇handler's⎇exit⎇ consists⎇of⎇a⎇simple⎇transfer⎇to⎇ that⎇location.⎇ Note⎇that⎇for⎇this
216⎇⎇␈F1simple⎇transfer⎇to⎇work⎇properly,⎇the⎇place⎇where⎇the⎇error⎇occurred⎇(or⎇the⎇call⎇to⎇USERERR)
217⎇⎇␈F1must⎇be⎇in⎇the⎇same⎇static⎇(lexical)⎇scope⎇as⎇the⎇label⎇whose⎇LOCATION⎇is⎇in⎇_ERRJ_.⎇ If⎇this⎇is
218⎇⎇␈F1really⎇important⎇to⎇you,⎇see⎇a⎇SAIL⎇hacker.
219⎇⎇␈F1WARNING!⎇Handling⎇errors⎇from⎇strange⎇places⎇like⎇the⎇string⎇garbage⎇collector⎇and⎇the⎇core
220⎇⎇␈F1management⎇routines⎇will⎇get⎇you⎇into⎇deep⎇trouble.
221⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 5␈F1␈←
222⎇⎇␈F1SAIL Addendum 1␈→856⎇243⎇1⎇0⎇⎇INEXHAUSTIBLE STRING SPACE␈←
223⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16432⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
224⎇⎇␈F1␈→657⎇0⎇2⎇0⎇⎇␈F2INEXHAUSTIBLE STRING SPACE␈F1␈←
225⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
226⎇⎇␈F1The⎇string⎇garbage⎇collector⎇has⎇been⎇modified⎇to⎇expand⎇string⎇space⎇(using⎇discontiguous⎇blocks)
227⎇⎇␈F1whenever⎇necessary⎇to⎇satisfy⎇the⎇demand⎇for⎇places⎇to⎇put⎇strings.⎇To⎇take⎇advantage⎇ of⎇ this
228⎇⎇␈F1feature,⎇ one⎇need⎇not⎇change⎇his⎇programs.
229⎇⎇␈F1Here⎇are⎇some⎇points⎇which⎇might⎇be⎇of⎇interest,⎇however:
230⎇⎇␈F11)␈=64⎇Although⎇ we⎇ are⎇ going⎇ to⎇ provide⎇ user⎇control⎇over⎇all⎇size⎇parameters⎇eventually,
231⎇⎇␈F1␈=64⎇currently⎇only⎇ the⎇ initial⎇ string⎇ space⎇size⎇ is⎇ settable⎇ by⎇ the⎇ user,⎇either⎇via
232⎇⎇␈F1␈=64⎇REQUIRE⎇or⎇the⎇ALLOC⎇sequence,⎇as⎇before.⎇ The⎇size⎇of⎇each⎇string⎇space⎇increment⎇will
233⎇⎇␈F1␈=64⎇be⎇ the⎇same⎇as⎇the⎇original⎇size,⎇which⎇need⎇not⎇be⎇monstrous⎇any⎇more⎇unless⎇you⎇ know
234⎇⎇␈F1␈=64⎇that⎇all⎇runs⎇of⎇your⎇program⎇will⎇ need⎇ a⎇monstrous⎇ string⎇ space⎇ anyhow.⎇ The
235⎇⎇␈F1␈=64⎇threshold⎇(see⎇below)⎇for⎇expanding⎇will⎇be⎇set⎇at⎇1/8⎇ the⎇ string⎇ space⎇ size⎇ (increment
236⎇⎇␈F1␈=64⎇size).
237⎇⎇␈F12)␈=64⎇One⎇can,⎇in⎇his⎇program,⎇modify⎇these⎇values⎇independently,⎇if⎇he⎇is⎇willing⎇to⎇use⎇the
238⎇⎇␈F1␈=64⎇USERCON⎇function,⎇and⎇to⎇follow⎇this⎇format:
239⎇⎇␈F4 USER TABLE ENTRY NAME VALUE
240⎇⎇␈F4 STINCR lh: number of chars. in increment
241⎇⎇␈F4 rh: number of words in increment + 4
242⎇⎇␈F4 STREQD lh: number of chars. in threshold
243⎇⎇␈F4 rh: number of words in threshold.
244⎇⎇␈F13)␈=64⎇The⎇threshold.⎇ After⎇garbage⎇collection,⎇let⎇us⎇say⎇that⎇M-1⎇discontiguous⎇string⎇spaces⎇ are
245⎇⎇␈F1␈=64⎇full,⎇ and⎇ the⎇ M'th⎇ has⎇ n⎇ free⎇ characters⎇in⎇it⎇(available⎇for⎇new⎇strings).⎇ The⎇ garbage
246⎇⎇␈F1␈=64⎇collector⎇ was⎇ called⎇because⎇ some⎇routine⎇wanted⎇to⎇create⎇a⎇string⎇R⎇characters⎇long,⎇and
247⎇⎇␈F1␈=64⎇there⎇were⎇not⎇that⎇many⎇ available⎇(free).⎇ After⎇ garbage⎇collection,⎇ the⎇new⎇algorithm
248⎇⎇␈F1␈=64⎇requires⎇that⎇N⎇be⎇greater⎇than⎇R+LH(STREQD).⎇ If⎇it⎇is⎇not,⎇expansion⎇takes⎇place⎇(to⎇M+1
249⎇⎇␈F1␈=64⎇spaces),⎇to⎇ satisfy⎇ this⎇requirement.⎇ In⎇other⎇words,⎇if⎇STREQD⎇is⎇1/8⎇the⎇size⎇of⎇the
250⎇⎇␈F1␈=64⎇current⎇space,⎇that⎇space⎇will⎇not⎇be⎇ allowed⎇ to⎇become⎇ more⎇ than⎇ about⎇ 7/8⎇ full.
251⎇⎇␈F1␈=64⎇This⎇helps⎇avoid⎇frequent,⎇nearly⎇useless⎇calls⎇on⎇the⎇garbage⎇collector⎇when⎇ space⎇is⎇about
252⎇⎇␈F1␈=64⎇gone.⎇ All⎇but⎇the⎇current⎇space⎇are⎇allowed⎇to⎇become⎇as⎇full⎇as⎇possible,⎇however.
253⎇⎇␈F14)␈=64⎇New⎇statistics⎇are⎇maintained⎇by⎇the⎇ garbage⎇ collector.⎇ Soon⎇there⎇ will⎇ be⎇a⎇built-in
254⎇⎇␈F1SAIL Addendum 1␈→856⎇243⎇1⎇0⎇⎇INEXHAUSTIBLE STRING SPACE␈←
255⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16434⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
256⎇⎇␈F1␈=64⎇routine⎇you⎇can⎇use⎇to⎇print⎇them.⎇ For⎇now,⎇you⎇may⎇look⎇at⎇them⎇using⎇USERCON,
257⎇⎇␈F1␈=64⎇although⎇this⎇ document⎇ does⎇not⎇ say⎇ what⎇ they⎇ are.⎇ In⎇ order⎇to⎇activate⎇timing⎇of
258⎇⎇␈F1␈=64⎇the⎇garbage⎇collector⎇(slows⎇it⎇down),⎇set⎇SGCTIME⎇in⎇the⎇ user⎇ table⎇to⎇-1.
259⎇⎇␈F15)␈=64⎇Future⎇plans.⎇ The⎇ new⎇ structure⎇ not⎇only⎇allows⎇expansion⎇of⎇string⎇space,⎇it⎇also⎇will
260⎇⎇␈F1␈=64⎇allow⎇ for⎇ partial⎇ garbage⎇ collections⎇ (no⎇ visible⎇benefits⎇ except⎇ increased⎇speed,⎇since
261⎇⎇␈F1␈=64⎇a⎇partial⎇collection⎇will⎇be⎇almost⎇as⎇effective⎇as⎇a⎇complete⎇one,⎇and⎇ much⎇ faster),⎇ and⎇the
262⎇⎇␈F1␈=64⎇ability⎇ to⎇ move⎇ string⎇ space⎇ blocks,⎇in⎇order⎇to⎇compact⎇memory.⎇ Push⎇on⎇your⎇local
263⎇⎇␈F1␈=64⎇representative⎇ to⎇ get⎇ these⎇ things⎇done.
264⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 6␈F1␈←
265⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
266⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16435⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
267⎇⎇␈F1␈→851⎇0⎇2⎇0⎇⎇␈F2RECORD STRUCTURES␈F1␈←
268⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
269⎇⎇␈F16.1⎇-⎇␈F2INTRODUCTORY⎇REMARKS␈F1
270⎇⎇␈F1Record⎇structures⎇are⎇a⎇fairly⎇recent⎇addition⎇to⎇SAIL.⎇ Essentially,⎇they⎇provide⎇ a⎇means⎇by
271⎇⎇␈F1which⎇a⎇ number⎇of⎇closely⎇related⎇variables⎇may⎇be⎇allocated⎇and⎇manipulated⎇ as⎇a⎇unit,⎇without
272⎇⎇␈F1the⎇overhead⎇ or⎇limitations⎇associated⎇ with⎇using⎇parallel⎇ arrays⎇and⎇without⎇the⎇restriction
273⎇⎇␈F1that⎇the⎇variables⎇all⎇be⎇of⎇the⎇same⎇data⎇type.⎇ In⎇ the⎇current⎇implementation,⎇each⎇ record⎇is⎇an
274⎇⎇␈F1instance⎇of⎇a⎇user-defined⎇"record⎇class",⎇which⎇serves⎇as⎇ a⎇template⎇describing⎇the⎇ various
275⎇⎇␈F1subfields⎇of⎇the⎇record.⎇ Internally,⎇records⎇are⎇small⎇blocks⎇of⎇storage⎇which⎇contain⎇space⎇for
276⎇⎇␈F1the⎇various⎇ subfields⎇and⎇ a⎇pointer⎇ to⎇a⎇ class⎇descriptor⎇record.⎇ Subfields⎇ are⎇allocated⎇ one
277⎇⎇␈F1per⎇ word⎇and⎇ are⎇accessed⎇by⎇ constant⎇indexing⎇off⎇the⎇ record⎇pointer.⎇ Deallocation⎇is
278⎇⎇␈F1performed⎇automatically⎇by⎇a⎇garbage⎇collector⎇or⎇manually⎇through⎇explicit⎇calls⎇to⎇a⎇deallocation
279⎇⎇␈F1procedure.
280⎇⎇␈F1Records⎇were⎇originally⎇added⎇ to⎇SAIL⎇to⎇ fullfill⎇a⎇number⎇of⎇ very⎇specific⎇needs⎇at⎇Stanford,
281⎇⎇␈F1and⎇ were⎇subsequently⎇generalized⎇to⎇the⎇form⎇ seen⎇ here.⎇ The⎇structures⎇ described⎇ in⎇ this
282⎇⎇␈F1section⎇are⎇implemented⎇and,⎇so⎇far⎇as⎇is⎇known,⎇work⎇correctly.⎇ (They⎇have⎇been⎇used
283⎇⎇␈F1successfully⎇by⎇several⎇different⎇people⎇to⎇produce⎇a⎇number⎇of⎇sizable⎇programs).⎇ Readers⎇are
284⎇⎇␈F1strongly⎇urged⎇to⎇look⎇at⎇the⎇ file⎇RECAUX.SAI[CSP,SYS],⎇which⎇contains⎇a⎇ number⎇of⎇useful
285⎇⎇␈F1examples⎇and⎇auxilliary⎇functions.
286⎇⎇␈F16.2⎇-⎇␈F2RECORD⎇CLASS⎇DECLARATIONS␈F1
287⎇⎇␈F1 RECORD_CLASS <classid> (<subfield declarations>)
288⎇⎇␈F1For instance,
289⎇⎇␈F1 RECORD_CLASS VECTOR (REAL X,Y,Z);
290⎇⎇␈F1 RECORD_CLASS CELL (RECORD_POINTER(ANY_CLASS) CAR,CDR);
291⎇⎇␈F1 RECORD_CLASS TABLEAU (REAL ARRAY A,B,C;INTEGER N,M);
292⎇⎇␈F1 RECORD_CLASS FOO(LIST L;ITEMVAR A);
293⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
294⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16439⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
295⎇⎇␈F1Generally,⎇ the⎇<subfield⎇ declarations>⎇ have⎇ the⎇ same⎇form⎇ as⎇ a⎇procedure's⎇ formal⎇paramter
296⎇⎇␈F1list,⎇except⎇that⎇ the⎇words⎇ VALUE⎇and⎇REFERENCE⎇should⎇ not⎇ be⎇used.⎇ Each⎇record⎇ class
297⎇⎇␈F1declaration⎇is⎇compiled⎇into⎇ a⎇"record⎇ descriptor"⎇which⎇is⎇ a⎇record⎇ of⎇constant⎇record⎇class
298⎇⎇␈F1$CLASS⎇and⎇is⎇used⎇by⎇the⎇runtime⎇system⎇for⎇allocation,⎇deallocation,⎇garbage⎇collection,⎇etc.
299⎇⎇␈F16.3⎇-⎇␈F2RECORD⎇POINTER⎇DECLARATIONS␈F1
300⎇⎇␈F1 RECORD_POINTER(<classid list>) <id list>
301⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) <id list>
302⎇⎇␈F1For instance,
303⎇⎇␈F1 RECORD_POINTER(VECTOR) V1,V2;
304⎇⎇␈F1 RECORD_POINTER(VECTOR,TABLEAU) T1,T2;
305⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) R;
306⎇⎇␈F1At⎇runtime,⎇these⎇variables⎇contain⎇either⎇the⎇value⎇NULL_RECORD⎇(internally,⎇zero)⎇or⎇else⎇a
307⎇⎇␈F1pointer⎇to⎇a⎇record.⎇ The⎇<classid⎇list>⎇is⎇used⎇to⎇make⎇a⎇compile-time⎇check⎇on⎇assignments⎇and
308⎇⎇␈F1subfield⎇references.⎇ The⎇pseudo-class⎇ANY_CLASS⎇matches⎇all⎇classes,⎇and⎇effectively⎇disables
309⎇⎇␈F1this⎇compile-time⎇check.⎇ For⎇instance:
310⎇⎇␈F1 RECORD_POINTER(FOO,BAR) FB1,FB2;
311⎇⎇␈F1 RECORD_POINTER(FOO) FB3;
312⎇⎇␈F1 RECORD_POINTER(CELL) C;
313⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) RP;
314⎇⎇␈F1 :
315⎇⎇␈F1 COMMENT the following are all ok syntactically;
316⎇⎇␈F1 C←NEW_RECORD(CELL);
317⎇⎇␈F1 RP←C;
318⎇⎇␈F1 FB2←NEW_RECORD(FOO);
319⎇⎇␈F1 FB1←FB3;
320⎇⎇␈F1 FB3←RP; COMMENT Note that this is most likely a runtime bug
321⎇⎇␈F1 Since RP will contain a cell record. SAIL
322⎇⎇␈F1 won't catch it, however;
323⎇⎇␈F1 CELL:CAR[RP]←FB1;
324⎇⎇␈F1 CELL:CAR[RP]←FB1;
325⎇⎇␈F1 COMMENT The compiler will complain about these: ;
326⎇⎇␈F1 FB1←C;
327⎇⎇␈F1 FB3←NEW_RECORD(CELL);
328⎇⎇␈F1 RP←CELL:CAR[FB3];
329⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
330⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16441⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
331⎇⎇␈F1NO⎇runtime⎇class⎇information⎇is⎇kept⎇with⎇the⎇variable,⎇and⎇no⎇runtime⎇class⎇checks⎇are⎇made⎇on
332⎇⎇␈F1record⎇assignment⎇or⎇subfield⎇access.⎇ Record⎇pointer⎇variables⎇are⎇allocated⎇quantities,⎇and⎇should
333⎇⎇␈F1not⎇appear⎇inside⎇SIMPLE⎇procedures.⎇ They⎇resemble⎇lists⎇in⎇that⎇they⎇are⎇not⎇given⎇any⎇special
334⎇⎇␈F1value⎇upon⎇block⎇entry⎇and⎇they⎇are⎇set⎇to⎇a⎇null⎇value⎇(NULL_RECORD)⎇when⎇the⎇block⎇in
335⎇⎇␈F1which⎇they⎇are⎇declared⎇is⎇exited.⎇ (This⎇is⎇so⎇that⎇any⎇records⎇referred⎇to⎇only⎇in⎇that⎇block⎇can
336⎇⎇␈F1be⎇reclaimed⎇by⎇the⎇garbage⎇collector.)
337⎇⎇␈F16.4⎇-⎇␈F2ALLOCATION␈F1
338⎇⎇␈F1Records⎇are⎇allocated⎇by⎇means⎇of⎇the⎇construct
339⎇⎇␈F1 NEW_RECORD(<classid>)
340⎇⎇␈F1which⎇returns⎇a⎇new⎇record⎇of⎇the⎇specified⎇class.⎇ All⎇subfields⎇of⎇the⎇new⎇record⎇are⎇set⎇to⎇the
341⎇⎇␈F1"null"⎇or⎇"zero"⎇value⎇for⎇that⎇subfield⎇--⎇i.e.,⎇real⎇&⎇integer⎇subfields⎇will⎇be⎇set⎇to⎇0,⎇itemvar
342⎇⎇␈F1subfields⎇will⎇be⎇set⎇to⎇ANY,⎇lists⎇will⎇be⎇set⎇to⎇PHI,⎇etc.⎇ Again,⎇note⎇that⎇entry⎇into⎇a⎇block
343⎇⎇␈F1with⎇local⎇record⎇pointer⎇variables⎇does⎇NOT⎇cause⎇records⎇to⎇be⎇allocated⎇and⎇assigned⎇to⎇those
344⎇⎇␈F1variables.
345⎇⎇␈F16.5⎇-⎇␈F2SUBFIELDS␈F1
346⎇⎇␈F1Record⎇subfields⎇are⎇referenced⎇by⎇means⎇of⎇the⎇construct
347⎇⎇␈F1 <classid>:<fieldid>[<record pointer expression>]
348⎇⎇␈F1and⎇may⎇be⎇used⎇wherever⎇an⎇array⎇element⎇may⎇be⎇used.⎇ For⎇example
349⎇⎇␈F1 RECORD_POINTER(VECTOR) V;
350⎇⎇␈F1 RECORD_POINTER(CELL) C;
351⎇⎇␈F1 RECORD_POINTER(FOO) F;
352⎇⎇␈F1 :
353⎇⎇␈F1 VECTOR:X[V]←VECTOR:Y[V];
354⎇⎇␈F1 CELL:CAR[C←NEW_RECORD(CELL)]←V;
355⎇⎇␈F1 VECTOR:Z[V]←VECTOR:X[CELL:CAR[C]];
356⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
357⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16444⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
358⎇⎇␈F1 SUBLIS ← FOO:L[F][1 TO 3];
359⎇⎇␈F1 :
360⎇⎇␈F1If⎇the⎇<record⎇pointer⎇expression>⎇gives⎇a⎇null⎇record,⎇then⎇a⎇runtime⎇error⎇message⎇will⎇be
361⎇⎇␈F1generated.⎇ This⎇is⎇the⎇only⎇runtime⎇check⎇that⎇is⎇made⎇at⎇present.⎇ I.e.,⎇no⎇runtime⎇checks⎇are
362⎇⎇␈F1made⎇to⎇verify⎇that⎇the⎇<classid>⎇in⎇the⎇subfield⎇statement⎇matches⎇the⎇class⎇of⎇the⎇record
363⎇⎇␈F1whose⎇subfield⎇is⎇being⎇extracted.
364⎇⎇␈F1An⎇array⎇subfield⎇may⎇be⎇used⎇as⎇an⎇array⎇name,⎇as⎇in
365⎇⎇␈F1 RECORD_POINTER(TABLEAU) T;
366⎇⎇␈F1 :
367⎇⎇␈F1 TABLEAU:A[T][I,J] ← 2.5;
368⎇⎇␈F1provided⎇that⎇you⎇have⎇stored⎇a⎇valid⎇array⎇descriptor⎇into⎇the⎇subfield.⎇ Unfortunately,⎇SAIL
369⎇⎇␈F1does⎇not⎇provide⎇any⎇clean⎇way⎇to⎇do⎇this.⎇ One⎇unclean⎇way⎇is
370⎇⎇␈F1 INTEGER PROCEDURE NEWARY(INTEGER LB,UB);
371⎇⎇␈F1 BEGIN
372⎇⎇␈F1 INTEGER ARRAY A[LB:UB];
373⎇⎇␈F1 INTEGER AA;
374⎇⎇␈F1 AA←MEMORY[LOCATION(A)];
375⎇⎇␈F1 MEMORY[LOCATION(A)]←0;
376⎇⎇␈F1 COMMENT defeats deallocation;
377⎇⎇␈F1 RETURN(AA);
378⎇⎇␈F1 END;
379⎇⎇␈F1 :
380⎇⎇␈F1 RECORD_CLASS FUBAR(INTEGER ARRAY A);
381⎇⎇␈F1 RECORD_POINTER(FUBAR) FB;
382⎇⎇␈F1 :
383⎇⎇␈F1 MEMORY[LOCATION(FUBAR:A[FB])]←NEWARY(1,100);
384⎇⎇␈F1(Warning:⎇the⎇above⎇"advice"⎇is⎇primarily⎇intended⎇for⎇hackers;⎇we⎇make⎇no⎇promisses⎇that⎇it⎇will
385⎇⎇␈F1never⎇get⎇you⎇into⎇trouble,⎇although⎇this⎇particular⎇trick⎇is⎇unlikely⎇to⎇be⎇made⎇obsolete⎇in⎇the
386⎇⎇␈F1forseeable⎇future).
387⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
388⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16445⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
389⎇⎇␈F16.6⎇-⎇␈F2GARBAGE⎇COLLECTION␈F1
390⎇⎇␈F1The⎇SAIL⎇record⎇service⎇routines⎇allocate⎇records⎇as⎇"small⎇blocks"⎇from⎇larger⎇"buffers"⎇of⎇free
391⎇⎇␈F1storage⎇obtained⎇from⎇the⎇normal⎇SAIL⎇free⎇storage⎇system.⎇(The⎇format⎇of⎇these⎇records⎇will⎇be
392⎇⎇␈F1discussed⎇in⎇a⎇later⎇section).⎇ From⎇time⎇to⎇time,⎇a⎇garbage⎇collector⎇is⎇called⎇to⎇reclaim⎇the
393⎇⎇␈F1storage⎇for⎇records⎇which⎇are⎇no⎇longer⎇accessible⎇by⎇the⎇user's⎇program⎇(i.e.,⎇are⎇not⎇pointed⎇to
394⎇⎇␈F1by⎇any⎇variables,⎇aren't⎇pointed⎇to⎇by⎇any⎇accessible⎇records,⎇etc.).⎇ The⎇garbage⎇collector⎇may⎇be
395⎇⎇␈F1called⎇explicitly⎇from⎇SAIL⎇programs⎇as⎇external⎇procedure⎇$RECGC,⎇and⎇automatic⎇invocation⎇of
396⎇⎇␈F1the⎇garbage⎇collection⎇may⎇be⎇inhibited⎇by⎇setting⎇user⎇table⎇entry⎇RGCOFF⎇to⎇TRUE.⎇(In⎇this
397⎇⎇␈F1case,⎇SAIL⎇will⎇just⎇keep⎇allocating⎇more⎇space,⎇with⎇nothing⎇being⎇reclaimed⎇until⎇RGCOFF⎇is⎇set
398⎇⎇␈F1back⎇to⎇FALSE⎇or⎇$RECGC⎇is⎇called⎇explicitly).⎇ In⎇addition,⎇SAIL⎇provides⎇a⎇number⎇of⎇"hooks"
399⎇⎇␈F1that⎇allow⎇a⎇user⎇to⎇control⎇the⎇automatic⎇invocation⎇of⎇the⎇garbage⎇collector.⎇ These⎇are
400⎇⎇␈F1discussed⎇in⎇a⎇subsequent⎇section.
401⎇⎇␈F16.7⎇-⎇␈F2INTERNAL⎇REPRESENTATIONS⎇␈F1
402⎇⎇␈F1Each⎇record⎇has⎇the⎇following⎇form:
403⎇⎇␈F1 -1: <pointers to ring of all records of class>
404⎇⎇␈F1 0: <garbage collector pointer>,,<pntr to class descriptor>
405⎇⎇␈F1 +1: <first subfield>
406⎇⎇␈F1 :
407⎇⎇␈F1 +n: <last subfield>
408⎇⎇␈F1Record⎇ pointer⎇ variables⎇ point⎇ at⎇ word⎇ 0⎇ of⎇ such⎇ records.
409⎇⎇␈F1The⎇predefined⎇record⎇class⎇$CLASS⎇is⎇used⎇to⎇define⎇all⎇record⎇classes,⎇and⎇is⎇itself⎇a⎇record⎇of
410⎇⎇␈F1class⎇$CLASS.
411⎇⎇␈F1 RECORD_CLASS $CLASS (INTEGER RECRNG,HNDLER,RECSIZ;
412⎇⎇␈F1 INTEGER ARRAY TYPARR;
413⎇⎇␈F1 STRING ARRAY TXTARR);
414⎇⎇␈F1RECRNG⎇is⎇a⎇ring⎇(bidirectional⎇linked⎇list)⎇of⎇all⎇records⎇of⎇the⎇particular⎇class.
415⎇⎇␈F1HNDLER⎇is⎇a⎇pointer⎇to⎇the⎇handler⎇procedure⎇for⎇the⎇class⎇(default⎇$REC$).
416⎇⎇␈F1RECSIZ⎇is⎇the⎇number⎇of⎇subfields⎇in⎇the⎇class.
417⎇⎇␈F1TYPARR⎇is⎇an⎇array⎇of⎇subfield⎇descriptors⎇for⎇each⎇subfield⎇of⎇the⎇class.
418⎇⎇␈F1TXTARR⎇is⎇an⎇array⎇of⎇subfield⎇names⎇for⎇the⎇class.
419⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
420⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16448⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
421⎇⎇␈F1The⎇normal⎇ value⎇for⎇the⎇ handler⎇procedure⎇is⎇ $REC$,⎇which⎇ is⎇the⎇standard⎇procedure⎇ for
422⎇⎇␈F1such⎇ functions⎇as⎇ allocation,⎇deallocation,⎇etc.
423⎇⎇␈F1TYPARR⎇and⎇TXTARR⎇are⎇indexed⎇[0:RECSIZ].⎇ TXTARR[0]⎇is⎇the⎇name⎇of⎇the⎇record⎇class.
424⎇⎇␈F1TYPARR[0]⎇contains⎇type⎇bits⎇for⎇the⎇record⎇class.
425⎇⎇␈F1Example:
426⎇⎇␈F1 RECORD_CLASS FOO(LIST L;ITEMVAR A);
427⎇⎇␈F1The record class descriptor for FOO would contain:
428⎇⎇␈F1 FOO-1: <pointers for ring of all records of $CLASS>
429⎇⎇␈F1 FOO: <pointer to $CLASS>
430⎇⎇␈F1 FOO+1: <pointers for ring of all records of class FOO
431⎇⎇␈F1 initialized to <FOO+2,,FOO+2> >.
432⎇⎇␈F1 FOO+2: <pointer to handler procedure: $REC$>
433⎇⎇␈F1 FOO+3: 2
434⎇⎇␈F1 FOO+4 <pointer to TYPARR>
435⎇⎇␈F1 FOO+5: <pointer to TXTARR>
436⎇⎇␈F1The subfields of FOO will be:
437⎇⎇␈F1 $CLASS:FOO[RECRNG] = <initialized to null ring,
438⎇⎇␈F1 i.e., xwd(loc(FOO)+2,loc(FOO)+22)>
439⎇⎇␈F1 $CLASS:FOO[HNDLER] = $REC$
440⎇⎇␈F1 $CLASS:FOO[RECSIZ] = 2
441⎇⎇␈F1 $CLASS:FOO[TXTARR] [0] = "FOO"
442⎇⎇␈F1 $CLASS:FOO[TXYARR] [1] = "L"
443⎇⎇␈F1 $CLASS:FOO[TXTARR] [2] = "A"
444⎇⎇␈F1 $CLASS:FOO[TYPARR] [0] = <magic bits for garbage collector>
445⎇⎇␈F1 $CLASS:FOO[TYPARR] [1] = <descriptor for LIST>
446⎇⎇␈F1 $CLASS:FOO[TYPARR] [2] = <descriptor for ITEMVAR>
447⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
448⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16449⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
449⎇⎇␈F16.8⎇-⎇␈F2HANDLER⎇PROCEDURES␈F1
450⎇⎇␈F1SAIL⎇uses⎇a⎇single⎇runtime⎇routine⎇$RECFN(OP,REC)⎇to⎇handle⎇such⎇system⎇functions⎇as⎇record
451⎇⎇␈F1allocation,⎇deallocation,⎇etc.⎇ For⎇instance,⎇the⎇construct
452⎇⎇␈F1 r ← NEW_RECORD(foo)
453⎇⎇␈F1is compiled as
454⎇⎇␈F1 PUSH P,[1]
455⎇⎇␈F1 PUSH P,[foo]
456⎇⎇␈F1 PUSHJ P,$RECFN
457⎇⎇␈F1 MOVEM 1,r
458⎇⎇␈F1$RECFN⎇performs⎇a⎇certain⎇amount⎇of⎇type⎇checking⎇and⎇then⎇jumps⎇to⎇the⎇appropriate⎇handler
459⎇⎇␈F1procedure⎇for⎇the⎇class⎇being⎇operated⎇on.⎇ The⎇normal⎇value⎇for⎇this⎇handler⎇procedure⎇is⎇$REC$.
460⎇⎇␈F1It⎇is⎇possible⎇for⎇a⎇user⎇to⎇substitute⎇his⎇own⎇handler⎇procedure⎇for⎇a⎇given⎇class⎇of⎇records⎇by
461⎇⎇␈F1including⎇the⎇procedure⎇name⎇ in⎇brackets⎇after⎇the⎇record⎇class⎇declaration:
462⎇⎇␈F1 RECORD_CLASS <id> (<subfields>) [<handler>]
463⎇⎇␈F1This handler must have the form
464⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) PROCEDURE <procid>
465⎇⎇␈F1 (INTEGER OP;RECORD_POINTER(ANY_CLASS) R);
466⎇⎇␈F1Where⎇OP⎇ will⎇be⎇a⎇ small⎇integer⎇ saying⎇what⎇is⎇ to⎇be⎇ done.⎇ The⎇current⎇assignments⎇for⎇OP
467⎇⎇␈F1are:
468⎇⎇␈F1 OP value meaning
469⎇⎇␈F1 0 invalid
470⎇⎇␈F1 1 allocate a new record of record class R
471⎇⎇␈F1 2 not used
472⎇⎇␈F1 3 not used
473⎇⎇␈F1 4 Mark all subfields of record R
474⎇⎇␈F1 5 Delete all space for record R
475⎇⎇␈F1Macro⎇definitions⎇for⎇these⎇functions⎇may⎇be⎇found⎇in⎇the⎇file⎇SYS:RECORD.DEF,⎇which⎇also
476⎇⎇␈F1includes⎇EXTERNAL⎇declarations⎇for⎇$CLASS,⎇$REC$,⎇and⎇$RECFN.
477⎇⎇␈F1$REC$(1,R)⎇allocates⎇a⎇record⎇of⎇the⎇record⎇class⎇specified⎇by⎇R,⎇which⎇must⎇be⎇a⎇record⎇of⎇class
478⎇⎇␈F1$CLASS.⎇ All⎇subfields⎇(except⎇string)⎇are⎇initialized⎇to⎇zero.⎇ String⎇subfields⎇are⎇initialized⎇to⎇a
479⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
480⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16451⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
481⎇⎇␈F1pointer⎇to⎇a⎇string⎇descriptor⎇with⎇length⎇zero⎇(null⎇string).
482⎇⎇␈F1$REC$(4,R)⎇is⎇used⎇by⎇the⎇garbage⎇collector⎇to⎇mark⎇all⎇record⎇subfields⎇of⎇R.
483⎇⎇␈F1$REC$(5,R)⎇deallocates⎇record⎇R,⎇and⎇deallocates⎇all⎇string⎇and⎇array⎇subfields⎇of⎇record⎇R.⎇ Care
484⎇⎇␈F1must⎇be⎇exercised⎇to⎇prevent⎇multiple⎇pointers⎇to⎇string⎇and⎇array⎇subfields,⎇ie.⎇DO⎇NOT⎇store
485⎇⎇␈F1the⎇location⎇of⎇an⎇array⎇in⎇subfields⎇of⎇two⎇different⎇records⎇unless⎇extreme⎇caution⎇is⎇taken⎇to
486⎇⎇␈F1handle⎇deletion.⎇ This⎇can⎇be⎇accomplished⎇through⎇user⎇handler⎇procedures⎇which⎇zero⎇array
487⎇⎇␈F1subfields⎇(without⎇actually⎇deleting⎇the⎇arrays)⎇prior⎇to⎇the⎇call⎇on⎇$REC$(5,R).
488⎇⎇␈F1NOTE:⎇ When⎇a⎇user⎇wishes⎇to⎇supply⎇his⎇own⎇handler⎇procedure,⎇he⎇must⎇be⎇careful⎇to⎇furnish
489⎇⎇␈F1all⎇the⎇necessary⎇functions.⎇ One⎇good⎇way⎇to⎇do⎇this⎇is⎇to⎇test⎇for⎇those⎇OPs⎇that⎇he⎇wishes⎇to
490⎇⎇␈F1handle⎇and⎇then⎇call⎇$REC$⎇for⎇all⎇the⎇rest.⎇ Also,⎇if⎇$REC$⎇was⎇used⎇to⎇allocate⎇space⎇for⎇the
491⎇⎇␈F1record⎇then⎇it⎇should⎇also⎇be⎇used⎇to⎇release⎇the⎇space.⎇ These⎇points⎇are⎇illustrated⎇by⎇the
492⎇⎇␈F1following⎇example:
493⎇⎇␈F1 RECORD_CLASS FOO(ITEMVAR IV)[FOOH];
494⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) PROCEDURE FOOH(INTEGER OP;
495⎇⎇␈F1 RECORD_POINTER(ANY_CLASS) R);
496⎇⎇␈F1 BEGIN
497⎇⎇␈F1 OUTSTR("CALLING FOOH. OP = "&CVS(OP));
498⎇⎇␈F1 IF OP = 1 THEN
499⎇⎇␈F1 BEGIN
500⎇⎇␈F1 RECORD_POINTER(FOO) F;
501⎇⎇␈F1 F←$REC$(1,R);
502⎇⎇␈F1 FOO:IV[F]←NEW;
503⎇⎇␈F1 RETURN(F);
504⎇⎇␈F1 END
505⎇⎇␈F1 ELSE IF OP = 5 THEN
506⎇⎇␈F1 BEGIN
507⎇⎇␈F1 DELETE(FOO:IV[R]);
508⎇⎇␈F1 END;
509⎇⎇␈F1 RETURN($REC$(OP,R));
510⎇⎇␈F1 END;
511⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
512⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16452⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
513⎇⎇␈F16.9⎇-⎇␈F2STRING⎇SUBFIELDS␈F1
514⎇⎇␈F1String⎇subfields⎇presented⎇an⎇implementation⎇difficulty⎇due⎇to⎇the⎇fact⎇that⎇string⎇discriptors
515⎇⎇␈F1require⎇2⎇words,⎇but⎇record⎇subfields⎇are⎇exactly⎇one⎇word.⎇ This⎇problem⎇was⎇solved⎇by⎇making
516⎇⎇␈F1string⎇subfields⎇contain⎇a⎇pointer⎇to⎇the⎇descriptor⎇for⎇the⎇string⎇(like⎇REFERENCE⎇STRING
517⎇⎇␈F1formal⎇parameters).
518⎇⎇␈F1When⎇a⎇record⎇with⎇string⎇subfields⎇is⎇allocated⎇by⎇a⎇call⎇to⎇NEW_RECORD,⎇the⎇string⎇descriptor
519⎇⎇␈F1blocks⎇(2⎇words⎇each)⎇are⎇allocated⎇from⎇a⎇linked⎇list⎇of⎇free⎇string⎇descriptors.⎇ Likewise,⎇when
520⎇⎇␈F1a⎇record⎇is⎇deallocated⎇either⎇explicitly⎇or⎇by⎇the⎇garbage⎇collector,⎇the⎇string⎇subfield
521⎇⎇␈F1descriptors⎇are⎇released⎇to⎇the⎇free⎇list.⎇ The⎇free⎇list⎇is⎇automatically⎇expanded⎇when⎇exhausted.
522⎇⎇␈F16.10⎇-⎇␈F2MORE⎇ABOUT⎇GARBAGE⎇COLLECTION␈F1
523⎇⎇␈F1The⎇information⎇used⎇by⎇the⎇system⎇to⎇decide⎇when⎇to⎇call⎇$RECGC⎇on⎇its⎇own⎇is⎇accessible
524⎇⎇␈F1through⎇global⎇array,⎇$SPCAR.⎇ In⎇general,⎇$SPCAR[n]⎇points⎇at⎇a⎇"descriptor⎇block"⎇used⎇to
525⎇⎇␈F1control⎇the⎇allocation⎇of⎇small⎇blocks⎇of⎇n⎇words.⎇ This⎇descriptor⎇includes⎇the⎇following⎇fields:
526⎇⎇␈F1 BLKSIZ -- number of words per block in this "space"
527⎇⎇␈F1 TRIGGER -- a counter used to control when to garbage collect
528⎇⎇␈F1 TGRMIN -- described below.
529⎇⎇␈F1 TUNUSED -- number of unused blocks on the "free list"
530⎇⎇␈F1 TINUSE -- total number of blocks "in use" for this space.
531⎇⎇␈F1 CULPRIT -- the number of times this space has caused
532⎇⎇␈F1 collection.
533⎇⎇␈F1The⎇appropriate⎇macro⎇definitions⎇for⎇access⎇of⎇these⎇fields⎇may⎇be⎇found⎇in⎇the⎇source⎇file
534⎇⎇␈F1"SYS:RECORD.DEF".⎇ As⎇one⎇might⎇expect,⎇the⎇decision⎇to⎇invoke⎇the⎇garbage⎇collector⎇is⎇ made
535⎇⎇␈F1as⎇part⎇of⎇the⎇block⎇allocation⎇procedure,⎇which⎇works⎇(roughly)⎇as⎇follows:
536⎇⎇␈F1 INTEGER spc,size;
537⎇⎇␈F1 size ← $CLASS:RECSIZ[classid]+2;
538⎇⎇␈F1 IF size>16 THEN
539⎇⎇␈F1 return a CORGET block;
540⎇⎇␈F1 spc ← $SPCAR[size];
541⎇⎇␈F1 L1: IF (MEMORY[spc+TRIGGER]←MEMORY[spc+TRIGGER]-1) < 0 THEN
542⎇⎇␈F1 BEGIN
543⎇⎇␈F1 IF ¬MEMORY[GOGTAB+RGCOFF] THEN
544⎇⎇␈F1 BEGIN
545⎇⎇␈F1 MEMORY[spc+CULPRIT]←MEMORY[spc+CULPRIT]+1;
546⎇⎇␈F1SAIL Addendum 1␈→979⎇243⎇1⎇0⎇⎇RECORD STRUCTURES␈←
547⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16455⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
548⎇⎇␈F1 $RECGC;
549⎇⎇␈F1 GO TO L1;
550⎇⎇␈F1 END;
551⎇⎇␈F1 END;
552⎇⎇␈F1 <allocate the block from space spc, update counters, etc.>
553⎇⎇␈F1Once⎇$RECGC⎇has⎇returned⎇all⎇unused⎇records⎇to⎇the⎇free⎇lists⎇associated⎇with⎇their⎇respective
554⎇⎇␈F1block⎇sizes,⎇it⎇must⎇adjust⎇the⎇trigger⎇levels⎇in⎇the⎇various⎇spaces.⎇ To⎇do⎇this,⎇it⎇first⎇looks⎇to
555⎇⎇␈F1see⎇if⎇the⎇user⎇has⎇specified⎇the⎇location⎇of⎇an⎇adjustment⎇procedure⎇in⎇TGRADJ(USER).⎇ If⎇this
556⎇⎇␈F1cell⎇is⎇non-zero,⎇then⎇$RECGC⎇calls⎇that⎇procedure⎇(which⎇must⎇have⎇no⎇parameters).⎇ Otherwise,
557⎇⎇␈F1it⎇calls⎇a⎇default⎇system⎇procedure⎇that⎇works⎇roughly⎇like⎇this:
558⎇⎇␈F1 <set all TRIGGER levels to -1>
559⎇⎇␈F1 FOR size ← 3 STEP 1 UNTIL 16 DO
560⎇⎇␈F1 BEGIN
561⎇⎇␈F1 spc ← $SPCAR[size];
562⎇⎇␈F1 IF MEMORY[spc+TRIGGER]<0 THEN
563⎇⎇␈F1 BEGIN
564⎇⎇␈F1 t←MEMORY[spc+TINUSE]*RGCRHO(USER);
565⎇⎇␈F1 t←MAX(t,MEMORY[spc+TUNUSED],
566⎇⎇␈F1 MEMORY[spc+TGRMIN]);
567⎇⎇␈F1 END;
568⎇⎇␈F1 END;
569⎇⎇␈F1RGCRHO(USER)⎇is⎇a⎇real⎇number⎇currently⎇initialized⎇by⎇the⎇system⎇to⎇0.33.⎇ Thus,⎇users⎇can
570⎇⎇␈F1modify⎇the⎇behavior⎇or⎇SAIL's⎇automatic⎇garbage⎇collection⎇by⎇some⎇combination⎇of:
571⎇⎇␈F1 (1) Setting RGCOFF(USER).
572⎇⎇␈F1 (2) Supplying their own procedure in TGRADJ(USER).
573⎇⎇␈F1 (3) Modifying RGCRHO(USER).
574⎇⎇␈F1 (4) Modifying the TGRMIN entries in the space descriptors.
575⎇⎇␈F1One⎇word⎇of⎇caution:⎇User⎇procedures⎇that⎇set⎇trigger⎇levels⎇must⎇be⎇sure⎇not⎇to⎇leave⎇the
576⎇⎇␈F1trigger⎇level⎇of⎇the⎇space⎇that⎇caused⎇collection⎇to⎇be⎇set⎇to⎇zero.⎇ This⎇will⎇cause⎇a⎇runtime
577⎇⎇␈F1error⎇message⎇to⎇be⎇generated.
578⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 7␈F1␈←
579⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
580⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16456⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
581⎇⎇␈F1␈→1169⎇0⎇2⎇0⎇⎇␈F2PRINT␈F1␈←
582⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
583⎇⎇␈F1SAIL⎇has⎇traditionally⎇had⎇very⎇flexible⎇input⎇and⎇output⎇that⎇allowed⎇the⎇user⎇essentially
584⎇⎇␈F1complete⎇access⎇to⎇the⎇time-sharing⎇system.⎇ Unfortunately,⎇some⎇of⎇the⎇simple⎇and⎇common
585⎇⎇␈F1things⎇that⎇the⎇user⎇wants⎇to⎇do⎇have⎇been⎇too⎇difficult⎇--⎇an⎇example⎇being⎇printing⎇output.
586⎇⎇␈F1Typically,⎇the⎇user⎇has⎇done⎇his⎇own⎇explicit⎇conversions⎇in⎇order⎇to⎇print⎇the⎇various⎇SAIL⎇data
587⎇⎇␈F1types.⎇ Thus,⎇the⎇following⎇is⎇an⎇example⎇of⎇the⎇coding⎇that⎇has⎇been⎇common.
588⎇⎇␈F1OUTSTR("The values are " & CVS(I) & " and " & CVG(X) &
589⎇⎇␈F1" for item " & CVIS(IT,JUNK));
590⎇⎇␈F1The⎇PRINT⎇statement⎇solves⎇this⎇by⎇printing⎇out⎇each⎇value⎇according⎇to⎇the⎇printing⎇format⎇for
591⎇⎇␈F1each⎇argument⎇and⎇allowing⎇an⎇indefinite⎇number⎇of⎇arguments,⎇each⎇of⎇which⎇is⎇separately⎇printed
592⎇⎇␈F1without⎇concatenation.⎇ Thus,⎇the⎇above⎇becomes:
593⎇⎇␈F1PRINT("The values are ",I,X," for item ",IT);
594⎇⎇␈F1The⎇PRINT⎇construction⎇is⎇both⎇clearer⎇and⎇more⎇efficient.⎇ The⎇first⎇example⎇has⎇the
595⎇⎇␈F1disadvantage⎇of⎇doing⎇unneeded⎇concatenation,⎇in⎇the⎇sense⎇that⎇the⎇string⎇really⎇doesn't⎇have⎇to
596⎇⎇␈F1be⎇created;⎇PRINT⎇avoids⎇unnecessary⎇concatenation⎇and⎇generally⎇compiles⎇less⎇in-line⎇code⎇as
597⎇⎇␈F1well.
598⎇⎇␈F17.1⎇-⎇␈F2Default⎇Formats⎇for⎇PRINT␈F1
599⎇⎇␈F1Each⎇syntactic⎇type⎇is⎇formatted⎇by⎇PRINT⎇in⎇a⎇standard⎇way⎇that⎇will⎇hopefully⎇satisfy⎇most
600⎇⎇␈F1users.⎇ Strings⎇are⎇simply⎇printed⎇out.⎇ Integers⎇use⎇the⎇function⎇CVS,⎇with⎇the⎇current
601⎇⎇␈F1SETFORMAT⎇positions.⎇ Reals⎇use⎇CVG,⎇also⎇with⎇the⎇current⎇SETFORMAT.
602⎇⎇␈F1Item⎇expressions⎇use⎇the⎇print⎇name⎇for⎇the⎇item⎇if⎇one⎇exists,⎇otherwise⎇ITEM!xxx,⎇where⎇xxx⎇is
603⎇⎇␈F1the⎇item⎇number.⎇ Sets⎇and⎇lists⎇are⎇printed⎇out⎇showing⎇their⎇item⎇components,⎇separated⎇by
604⎇⎇␈F1commas.⎇ Sets⎇are⎇surrounded⎇by⎇single⎇braces,⎇and⎇lists⎇by⎇double⎇braces.⎇ PHI⎇and⎇NIl⎇are⎇printed
605⎇⎇␈F1for⎇the⎇empty⎇set⎇and⎇empty⎇list⎇respectively.
606⎇⎇␈F1Record⎇pointers⎇are⎇printed⎇with⎇the⎇name⎇of⎇the⎇record⎇class,⎇followed⎇by⎇a⎇".",⎇followed⎇by⎇the
607⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
608⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16459⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
609⎇⎇␈F1address⎇in⎇decimal⎇of⎇the⎇record.⎇ NULL!RECORD⎇is⎇printed⎇for⎇the⎇empty⎇record.
610⎇⎇␈F1If⎇the⎇user⎇wants⎇some⎇other⎇format⎇for⎇a⎇given⎇syntactic⎇type,⎇it⎇is⎇easy⎇to⎇make⎇a⎇function⎇call
611⎇⎇␈F1as⎇the⎇argument⎇to⎇the⎇PRINT⎇statement.⎇ For⎇example,
612⎇⎇␈F1PRINT(CVOS(I));
613⎇⎇␈F1will⎇print⎇out⎇I⎇in⎇octal,⎇since⎇CVOS⎇is⎇first⎇called.⎇ (The⎇syntactic⎇type⎇of⎇the⎇expression
614⎇⎇␈F1CVOS(I)⎇is⎇of⎇course⎇STRING.)
615⎇⎇␈F1There⎇is⎇also⎇a⎇way⎇to⎇entirely⎇change⎇the⎇default⎇formatting⎇function⎇for⎇a⎇given⎇syntactic⎇type.
616⎇⎇␈F1It⎇is⎇described⎇below,⎇but⎇is⎇considered⎇to⎇be⎇for⎇wizards⎇only.
617⎇⎇␈F17.2⎇-⎇␈F2SETPRINT⎇and⎇GETPRINT␈F1
618⎇⎇␈F1The⎇SETPRINT⎇function⎇sets⎇the⎇destination⎇of⎇the⎇output⎇from⎇the⎇PRINT⎇statement.⎇ Initially,
619⎇⎇␈F1the⎇PRINT⎇statement⎇is⎇set⎇to⎇output⎇to⎇the⎇user's⎇terminal.⎇ This⎇may⎇be⎇changed⎇to⎇be⎇to⎇a⎇file
620⎇⎇␈F1or⎇to⎇both⎇the⎇terminal⎇and⎇a⎇file.
621⎇⎇␈F1The⎇call⎇to⎇SETPRINT⎇is⎇as⎇follows:
622⎇⎇␈F1␈→827⎇0⎇2⎇0⎇⎇SETPRINT("FILE!NAME", "MODE")␈←
623⎇⎇␈F1The⎇file⎇name⎇is⎇a⎇(possibly⎇empty)⎇name⎇for⎇a⎇file⎇to⎇which⎇the⎇PRINTed⎇text⎇is⎇to⎇be⎇printed.
624⎇⎇␈F1"MODE"⎇is⎇a⎇single⎇character⎇indicating⎇how⎇the⎇PRINT⎇statement⎇is⎇to⎇function.⎇ SETPRINT⎇may
625⎇⎇␈F1be⎇called⎇many⎇times⎇--⎇it⎇is⎇a⎇procedure⎇with⎇dynamic⎇effects,⎇not⎇a⎇declaration.
626⎇⎇␈F1 Character Meaning
627⎇⎇␈F1 ---------------------------
628⎇⎇␈F1 T the Terminal gets all PRINT output. if an
629⎇⎇␈F1 output file is open, it is to be closed. T is
630⎇⎇␈F1 the default mode in which PRINT is initialized.
631⎇⎇␈F1 F File gets PRINT output. If no file is open, it
632⎇⎇␈F1 will be opened, as described below.
633⎇⎇␈F1 B Both terminal and file get PRINT output. if
634⎇⎇␈F1 no file is open, it should be opened.
635⎇⎇␈F1 N Neither the file nor the terminal is getting any
636⎇⎇␈F1 output. if a file is open, it will be closed.
637⎇⎇␈F1 S suppress all output, but open a file if none is
638⎇⎇␈F1 open.
639⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
640⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16461⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
641⎇⎇␈F1 O a file is Open, but the terminal is getting all
642⎇⎇␈F1 output. opens a file if none is open.
643⎇⎇␈F1 C terminal gets output, but ignore whether or not
644⎇⎇␈F1 file is open and whether or not file is getting
645⎇⎇␈F1 output.
646⎇⎇␈F1 I terminal does not get output. ignore whether or
647⎇⎇␈F1 not a file is open and whether or not file is
648⎇⎇␈F1 getting any output.
649⎇⎇␈F1The⎇first⎇6⎇possibilities⎇represent⎇the⎇logically⎇possible⎇states⎇in⎇which⎇the⎇PRINT⎇system⎇can⎇be.
650⎇⎇␈F1These⎇are⎇therefore⎇the⎇letters⎇returned⎇by⎇GETPRINT⎇below.⎇ The⎇"C"⎇and⎇"I"⎇modes⎇are⎇added
651⎇⎇␈F1for⎇convenience,⎇so⎇that⎇it⎇is⎇possible⎇to⎇terminal⎇output⎇on⎇and⎇off⎇without⎇bothering⎇to⎇check,
652⎇⎇␈F1with⎇GETPRINT,⎇the⎇current⎇state⎇of⎇the⎇output.
653⎇⎇␈F1The⎇PRINT⎇statement⎇is⎇initialized⎇to⎇mode⎇"T"⎇--⎇print⎇to⎇Terminal.⎇ The⎇user⎇will⎇probably⎇find
654⎇⎇␈F1modes⎇"T",⎇"F"⎇and⎇"B"⎇to⎇be⎇the⎇most⎇useful.⎇ The⎇other⎇modes⎇are⎇included⎇for⎇completeness⎇of
655⎇⎇␈F1the⎇system,⎇and⎇to⎇allow⎇the⎇user⎇to⎇switch⎇between⎇various⎇combinations⎇dynamically.
656⎇⎇␈F1Should⎇SETPRINT⎇be⎇called⎇in⎇such⎇a⎇way⎇that⎇a⎇file⎇has⎇to⎇be⎇opened⎇--⎇e.g.,⎇mode⎇"F"⎇and⎇no
657⎇⎇␈F1file⎇is⎇open⎇--⎇then⎇the⎇first⎇argument⎇to⎇SETPRINT⎇will⎇be⎇used⎇ss⎇the⎇name⎇for⎇the⎇output⎇file.
658⎇⎇␈F1If⎇the⎇filename⎇argument⎇is⎇NULL,⎇then⎇the⎇filename⎇will⎇be⎇obtained⎇from⎇the⎇terminal.⎇ Thus,⎇the
659⎇⎇␈F1statement:
660⎇⎇␈F1SETPRINT(NULL,"F");
661⎇⎇␈F1first⎇types⎇out⎇the⎇message
662⎇⎇␈F1File for PRINT output *
663⎇⎇␈F1and⎇then⎇waits⎇for⎇the⎇user⎇to⎇type⎇a⎇filename,⎇and⎇then⎇opens⎇such⎇a⎇file.⎇ On⎇TENEX,⎇GTJFN
664⎇⎇␈F1with⎇filename⎇recognition⎇is⎇used⎇here.⎇ On⎇the⎇DEC⎇system⎇and⎇its⎇variants,⎇the⎇filename⎇is⎇read
665⎇⎇␈F1in⎇with⎇the⎇INCHWL⎇routine.
666⎇⎇␈F1The⎇file⎇opened⎇by⎇SETPRINT⎇will⎇be⎇closed⎇when⎇the⎇program⎇terminates⎇by⎇falling⎇through⎇the
667⎇⎇␈F1bottom.⎇ It⎇will⎇also⎇be⎇closed⎇if⎇the⎇user⎇calls⎇SETPRINT⎇with⎇some⎇mode⎇that⎇closes⎇the⎇file⎇--
668⎇⎇␈F1e.g.,⎇"T"⎇will⎇close⎇an⎇output⎇file⎇if⎇one⎇is⎇open.
669⎇⎇␈F1To⎇determine⎇the⎇current⎇mode⎇of⎇the⎇PRINT⎇system,⎇the⎇user⎇can⎇call⎇GETPRINT,⎇which⎇returns
670⎇⎇␈F1a⎇letter⎇indicating⎇which⎇of⎇the⎇modes⎇is⎇currently⎇set,⎇using⎇the⎇same⎇coding⎇as⎇SETPRINT⎇above.
671⎇⎇␈F1Thus,⎇the⎇call⎇is
672⎇⎇␈F1 "MODE" ← GETPRINT;
673⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
674⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16462⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
675⎇⎇␈F1SETPRINT⎇and⎇GETPRINT⎇are⎇related⎇only⎇to⎇the⎇PRINT⎇statement⎇and⎇do⎇not⎇effect⎇CPRINT
676⎇⎇␈F1below.
677⎇⎇␈F17.3⎇-⎇␈F2Simple⎇Uses⎇of⎇PRINT⎇and⎇SETPRINT␈F1
678⎇⎇␈F1We⎇provide⎇a⎇few⎇examples⎇of⎇common⎇output⎇situations.
679⎇⎇␈F11)⎇ PRINT⎇to⎇TERMINAL.⎇ Just⎇call⎇PRINT⎇with⎇your⎇output,⎇don't⎇bother⎇with⎇SETPRINT.
680⎇⎇␈F12)⎇ PRINT⎇to⎇FILE.⎇ Call
681⎇⎇␈F1SETPRINT(NULL,"F");
682⎇⎇␈F1and⎇type⎇the⎇name⎇of⎇the⎇output⎇file,⎇at⎇runtime,⎇when⎇it⎇asks.
683⎇⎇␈F13)⎇ PRINT⎇to⎇FILE⎇and⎇TERMINAL.⎇ Call,⎇at⎇the⎇beginning⎇of⎇your⎇program,
684⎇⎇␈F1SETPRINT(NULL,"B");
685⎇⎇␈F1and⎇type⎇the⎇name⎇when⎇asked.
686⎇⎇␈F14)⎇ PRINT⎇to⎇FILE⎇always⎇and⎇sometimes⎇also⎇to⎇TERMINAL.⎇ Call,⎇at⎇the⎇beginning
687⎇⎇␈F1SETPRINT(NULL,"B");
688⎇⎇␈F1and⎇give⎇the⎇name⎇of⎇the⎇file⎇when⎇it⎇asks.⎇ This⎇sets⎇output⎇to⎇both⎇the⎇terminal⎇and⎇the⎇file.
689⎇⎇␈F1Now,⎇to⎇ignore⎇the⎇terminal⎇(leaving⎇the⎇file⎇alone),⎇call
690⎇⎇␈F1SETPRINT(NULL,"I");
691⎇⎇␈F1Likewise,⎇to⎇turn⎇the⎇teletype⎇back⎇on,⎇call
692⎇⎇␈F1SETPRINT(NULL,"C");
693⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
694⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16464⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
695⎇⎇␈F1This⎇is⎇useful⎇for⎇obtaining⎇a⎇cleaned-up⎇printout⎇on⎇the⎇file,⎇with⎇error⎇messages⎇going⎇to⎇the
696⎇⎇␈F1terminal.
697⎇⎇␈F1The⎇use⎇of⎇GETPRINT⎇to⎇determine⎇the⎇current⎇state⎇allows⎇more⎇complex⎇possibilities.
698⎇⎇␈F17.4⎇-⎇␈F2CPRINT⎇--⎇Printing⎇to⎇a⎇Channel␈F1
699⎇⎇␈F1CPRINT⎇is⎇similar⎇to⎇PRINT⎇except⎇that⎇the⎇first⎇argument⎇is⎇assumed⎇to⎇be⎇a⎇SAIL⎇channel
700⎇⎇␈F1number.⎇ CPRINT⎇then⎇dispatches⎇to⎇the⎇file⎇the⎇appropriate⎇printed⎇formats⎇of⎇the⎇rest⎇of⎇the
701⎇⎇␈F1arguments.⎇ Thus,⎇the⎇following⎇are⎇functionally⎇equivalent:
702⎇⎇␈F1CPRINT(CHAN,"The value are ",I," and ",X);
703⎇⎇␈F1OUT(CHAN,"The values are " & CVS(I) & " and " & CVG(X));
704⎇⎇␈F1The⎇user⎇is⎇responsible⎇for⎇obtaining⎇and⎇releasing⎇the⎇channel⎇for⎇the⎇CPRINT⎇statement.⎇ As⎇a
705⎇⎇␈F1very⎇simple⎇example⎇on⎇the⎇DEC⎇system:
706⎇⎇␈F1OUTSTR("Type output file name *");
707⎇⎇␈F1OPEN(CHAN ← GETCHAN,"DSK",0,0,2,0,0,0);
708⎇⎇␈F1ENTER(CHAN,INCHWL,FLAG);
709⎇⎇␈F1IF FLAG THEN USERERR(0,0,"CANNOT GET FILE ON DISK");
710⎇⎇␈F1or⎇for⎇TENEX:
711⎇⎇␈F1OUTSTR("Type output file name *");
712⎇⎇␈F1CHAN ← OPENFILE(NULL,"W");
713⎇⎇␈F1The⎇statement⎇RELEASE(CHAN)⎇on⎇DEC⎇or⎇CFILE(CHAN)⎇on⎇TENEX⎇will⎇close⎇and⎇release⎇the
714⎇⎇␈F1device/file⎇open⎇on⎇CHAN.
715⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
716⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16466⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
717⎇⎇␈F17.5⎇-⎇␈F2Design⎇of⎇PRINT␈F1
718⎇⎇␈F1The⎇PRINT⎇statement⎇was⎇designed⎇for⎇those⎇who⎇miss⎇the⎇ALGOL⎇W⎇WRITE⎇and⎇WRITEON
719⎇⎇␈F1statements,⎇especially⎇for⎇new⎇SAIL⎇users⎇who⎇currently⎇have⎇to⎇learn⎇too⎇much⎇about⎇type
720⎇⎇␈F1conversion⎇and⎇file⎇manipulation⎇to⎇write⎇simple⎇SAIL⎇programs.⎇ Notice⎇that⎇SAIL⎇doesn't⎇need
721⎇⎇␈F1both⎇WRITE⎇and⎇WRITEON,⎇since⎇manipulating⎇lines⎇can⎇be⎇done⎇from⎇SAIL⎇by⎇printing⎇out
722⎇⎇␈F1formatting⎇characters.⎇ We⎇recommend⎇the⎇following⎇macro
723⎇⎇␈F1DEFINE CRLF="('15 & '12)";
724⎇⎇␈F1which⎇the⎇user⎇may⎇define⎇to⎇mean⎇"carriage⎇return⎇-⎇line⎇feed".⎇ Thus,
725⎇⎇␈F1PRINT(CRLF,"Hi There");
726⎇⎇␈F1is equivalent to the ALGOL W
727⎇⎇␈F1WRITE("Hi There");
728⎇⎇␈F1A⎇READ⎇statement⎇was⎇also⎇considered⎇for⎇implementation.⎇ The⎇difficulty⎇lies⎇in⎇defining⎇how
729⎇⎇␈F1strings⎇are⎇input.⎇ SAIL⎇has⎇very⎇extensive⎇input⎇facilities,⎇including⎇break⎇tables,⎇which⎇do⎇many
730⎇⎇␈F1of⎇the⎇common⎇scanning⎇operation.
731⎇⎇␈F1Further⎇consideration⎇was⎇given⎇to⎇a⎇template-driven⎇printing⎇function.⎇ This⎇proved⎇to⎇be⎇both
732⎇⎇␈F1inefficient⎇in⎇implementation,⎇and⎇an⎇added⎇overhead⎇to⎇an⎇already⎇large⎇runtime⎇system.
733⎇⎇␈F17.6⎇-⎇␈F2CAVEATS⎇of⎇PRINT⎇and⎇CPRINT␈F1
734⎇⎇␈F1A⎇problem⎇with⎇the⎇PRINT⎇construction,⎇especially⎇for⎇experienced⎇SAIL⎇users,⎇is⎇likely⎇to⎇occur
735⎇⎇␈F1when⎇the⎇user⎇trys⎇to⎇exploit⎇the⎇normal⎇SAIL⎇type⎇conversions⎇in⎇the⎇printing⎇of⎇strings.⎇ This
736⎇⎇␈F1is⎇especially⎇common⎇when⎇the⎇user⎇wants⎇to⎇print⎇out⎇ASCII⎇characters.⎇ One⎇often⎇uses⎇a
737⎇⎇␈F1number⎇(i.e.,⎇an⎇INTEGER⎇expression)⎇that,⎇upon⎇default⎇type⎇conversion,⎇becomes⎇a⎇one-character
738⎇⎇␈F1string.⎇ Thus,
739⎇⎇␈F1OUTSTR(12)
740⎇⎇␈F1prints⎇a⎇form-feed⎇onto⎇the⎇terminal,⎇whereas
741⎇⎇␈F1PRINT(12)
742⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
743⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16469⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
744⎇⎇␈F1prints⎇"12"⎇onto⎇the⎇terminal.⎇ The⎇reason,⎇of⎇course,⎇is⎇the⎇default⎇formatting⎇for⎇integers⎇under
745⎇⎇␈F1PRINT⎇or⎇CPRINT.
746⎇⎇␈F1This⎇problem⎇is⎇especially⎇confusing⎇with⎇macros⎇that⎇have⎇been⎇defined⎇with⎇an⎇integer⎇to
747⎇⎇␈F1represent⎇an⎇ASCII⎇character.⎇ For⎇example,
748⎇⎇␈F1DEFINE TAB="'11";
749⎇⎇␈F1will⎇present⎇the⎇same⎇problem.⎇ The⎇solution⎇is⎇to⎇define⎇the⎇macro⎇so⎇that⎇it⎇expands⎇to⎇a
750⎇⎇␈F1STRING⎇constant⎇rather⎇than⎇an⎇integer.
751⎇⎇␈F1Also,⎇beware⎇that⎇the⎇first⎇argument⎇to⎇CPRINT⎇is⎇the⎇channel⎇number.
752⎇⎇␈F17.7⎇-⎇␈F2Hooks⎇into⎇the⎇PRINT⎇System␈F1
753⎇⎇␈F1[This⎇section⎇is⎇for⎇wizards⎇only.]
754⎇⎇␈F1As⎇is⎇traditional⎇with⎇SAIL,⎇there⎇are⎇user⎇hooks⎇to⎇get⎇hold⎇of⎇the⎇operation⎇of⎇the⎇PRINT
755⎇⎇␈F1system.⎇ These⎇hooks⎇are⎇obtained⎇by⎇setting⎇certain⎇cells⎇of⎇the⎇user⎇table⎇to⎇the⎇addresses⎇of
756⎇⎇␈F1SIMPLE⎇PROCEDURES⎇that⎇the⎇user⎇has⎇written.
757⎇⎇␈F1All⎇output⎇going⎇to⎇either⎇the⎇PRINT⎇or⎇CPRINT⎇statements⎇can⎇be⎇trapped⎇by⎇setting⎇user⎇table
758⎇⎇␈F1entry⎇$$PROU⎇to⎇the⎇address⎇of⎇a⎇SIMPLE⎇procedure⎇that⎇has⎇one⎇string⎇and⎇one⎇integer
759⎇⎇␈F1argument,⎇e.g.,
760⎇⎇␈F1SIMPLE PROCEDURE MYPRINT(INTEGER CHAN; STRING S)
761⎇⎇␈F1The⎇user⎇could⎇set⎇this⎇up⎇by⎇the⎇assignment
762⎇⎇␈F1GOGTAB[$$PROU] ← LOCATION(MYPRINT);
763⎇⎇␈F1(See⎇below⎇in⎇this⎇manual⎇for⎇a⎇description⎇of⎇the⎇GOGTAB⎇array⎇as⎇a⎇way⎇of⎇accessing⎇the⎇user
764⎇⎇␈F1table.)
765⎇⎇␈F1The⎇CHAN⎇argument⎇is⎇then⎇either⎇the⎇CHAN⎇argument⎇for⎇CPRINT,⎇or⎇-1⎇for⎇PRINT.⎇ If⎇this
766⎇⎇␈F1SAIL Addendum 1␈→1213⎇243⎇1⎇0⎇⎇PRINT␈←
767⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16471⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
768⎇⎇␈F1trap⎇is⎇set⎇up,⎇all⎇output⎇from⎇PRINT⎇and⎇CPRINT⎇goes⎇through⎇the⎇user⎇routine,⎇and⎇is⎇not
769⎇⎇␈F1printed⎇(unless⎇the⎇user⎇invokes⎇OUT⎇or⎇OUTSTR⎇from⎇within⎇the⎇trap⎇routine⎇itself.)
770⎇⎇␈F1To⎇trap⎇the⎇formatting⎇function⎇for⎇any⎇syntactic⎇type,⎇the⎇user⎇should⎇set⎇the⎇appropriate⎇user
771⎇⎇␈F1table⎇address⎇to⎇the⎇location⎇of⎇a⎇function⎇that⎇returns⎇a⎇string⎇and⎇takes⎇as⎇an⎇argument⎇the
772⎇⎇␈F1syntactic⎇type⎇in⎇question.⎇ For⎇example,⎇if⎇the⎇user⎇wanted⎇to⎇trap⎇integer⎇printing⎇and⎇print⎇all
773⎇⎇␈F1integers⎇out⎇in⎇octal,⎇preceded⎇by⎇a⎇"'",⎇he⎇could⎇do⎇the⎇following:
774⎇⎇␈F1SIMPLE STRING PROCEDURE MYCVOS(INTEGER I);
775⎇⎇␈F1RETURN("'" & CVOS(I));
776⎇⎇␈F1GOGTAB[$$FINT] ← LOCATION(MYCVOS);
777⎇⎇␈F1The⎇names⎇for⎇the⎇addresses⎇in⎇the⎇user⎇table⎇associated⎇with⎇each⎇formatting⎇function⎇are:
778⎇⎇␈F1User table index for syntactic type
779⎇⎇␈F1-----------------------------------------
780⎇⎇␈F1$$FINT INTEGER
781⎇⎇␈F1$$FREL REAL
782⎇⎇␈F1$$FITM ITEM
783⎇⎇␈F1$$FSET SET
784⎇⎇␈F1$$FLST LIST
785⎇⎇␈F1$$FSTR STRING
786⎇⎇␈F1$$FREC RECORD!POINTER
787⎇⎇␈F1To⎇restore⎇any⎇formatting⎇function⎇to⎇the⎇default⎇provided⎇by⎇the⎇PRINT⎇system,⎇the⎇user⎇should
788⎇⎇␈F1zero⎇the⎇appropriate⎇address⎇of⎇the⎇user⎇table.
789⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 8␈F1␈←
790⎇⎇␈F1SAIL Addendum 1␈→1048⎇243⎇1⎇0⎇⎇SAVE/CONTINUE␈←
791⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16472⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
792⎇⎇␈F1␈→963⎇0⎇2⎇0⎇⎇␈F2SAVE/CONTINUE␈F1␈←
793⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
794⎇⎇␈F1A⎇save/continue⎇facility⎇has⎇been⎇implemented⎇in⎇the⎇SAIL⎇compiler.⎇ This⎇allows⎇compiling
795⎇⎇␈F1header⎇files,⎇saving⎇the⎇state⎇of⎇the⎇compiler,⎇and⎇resuming⎇compilation⎇at⎇a⎇later⎇time.⎇ The
796⎇⎇␈F1save/continue⎇facility⎇works⎇with⎇files⎇as⎇the⎇basic⎇unit;⎇compilation⎇can⎇be⎇interrupted⎇only⎇at
797⎇⎇␈F1the⎇end⎇of⎇a⎇file.⎇ The⎇/X⎇(eXtend)⎇switch⎇controls⎇the⎇new⎇feature.⎇ The⎇examples⎇shown⎇here
798⎇⎇␈F1are⎇for⎇the⎇DEC⎇timesharing⎇system.⎇ Analogous⎇commands⎇work⎇under⎇TENEX,⎇using⎇the⎇TENEX
799⎇⎇␈F1RUN⎇and⎇SAVE⎇commands.⎇ The⎇dialog⎇is⎇similar,⎇except⎇that⎇the⎇TENEX⎇command⎇language⎇format
800⎇⎇␈F1is⎇followed⎇on⎇TENEX.⎇ Example:
801⎇⎇␈F1.R SAIL
802⎇⎇␈F1*INTRMD.REL[PRJ,PRG]←A,B,C/X
803⎇⎇␈F1 A.SAI 1 etc.
804⎇⎇␈F1SAVE ME FOR USE AS XSAIL.
805⎇⎇␈F1EXIT
806⎇⎇␈F1.SAVE XSAIL
807⎇⎇␈F1JOB SAVED IN 25K
808⎇⎇␈F1UPPER NOT SAVED!
809⎇⎇␈F1.RU XSAIL
810⎇⎇␈F1*FINAL←D,E,F
811⎇⎇␈F1 D.SAI
812⎇⎇␈F1Copying DSK:INTRMD.REL[PRJ,PRG]
813⎇⎇␈F1 2 3 etc.
814⎇⎇␈F1*↑C
815⎇⎇␈F1The above is equivalent to
816⎇⎇␈F1.R SAIL
817⎇⎇␈F1*FINAL←A,B,C,D,E,F
818⎇⎇␈F1On⎇TENEX,⎇the⎇user⎇will⎇want⎇to⎇save⎇core⎇from⎇20⎇to⎇577777⎇in⎇creating⎇the⎇XSAIL.SAV⎇file.
819⎇⎇␈F1Information⎇is⎇saved⎇in⎇XSAIL.SAV⎇and⎇in⎇the⎇binary⎇file⎇from⎇the⎇first⎇"compilation"⎇(in⎇this⎇case
820⎇⎇␈F1INTRMD.REL).⎇ When⎇compilation⎇is⎇resumed,⎇the⎇final⎇binary⎇file⎇is⎇initialized⎇by⎇copying⎇the
821⎇⎇␈F1intermediate⎇file.
822⎇⎇␈F1Save/continue⎇is⎇not⎇allowed⎇if⎇the⎇file⎇break⎇occurs⎇while⎇scanning⎇false⎇conditional⎇compilation
823⎇⎇␈F1SAIL Addendum 1␈→1048⎇243⎇1⎇0⎇⎇SAVE/CONTINUE␈←
824⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16474⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
825⎇⎇␈F1or⎇actual⎇parameters⎇to⎇a⎇macro⎇call.
826⎇⎇␈F1A⎇hint⎇on⎇using⎇this⎇feature:⎇ If⎇the⎇source⎇term⎇of⎇your⎇command⎇string⎇consists⎇of⎇just⎇one⎇file,
827⎇⎇␈F1and⎇this⎇one⎇file⎇does⎇REQUIREs⎇of⎇other⎇source⎇files,⎇the⎇following⎇setup⎇works⎇well.
828⎇⎇␈F1Original file FOO.SAI:
829⎇⎇␈F1 BEGIN "FOO"
830⎇⎇␈F1 REQUIRE "[][]" DELIMITERS;
831⎇⎇␈F1 DEFINE !=[COMMENT];
832⎇⎇␈F1 REQUIRE "BAZ.SAI" SOURCE_FILE;
833⎇⎇␈F1 REQUIRE "MUMBLE.SAI" SOURCE_FILE;
834⎇⎇␈F1 :
835⎇⎇␈F1 <rest of file>
836⎇⎇␈F1 :
837⎇⎇␈F1 END "FOO"
838⎇⎇␈F1New file FOO.SAI:
839⎇⎇␈F1 IFCR NOT DECLARATION(GARPLY) THENC
840⎇⎇␈F1 BEGIN "FOO"
841⎇⎇␈F1 REQUIRE "[][]" DELIMITERS;
842⎇⎇␈F1 DEFINE GARPLY=TRUE;
843⎇⎇␈F1 DEFINE !=[COMMENT];
844⎇⎇␈F1 REQUIRE "BAZ.SAI" SOURCE_FILE;
845⎇⎇␈F1 REQUIRE "MUMBLE.SAI" SOURCE_FILE;
846⎇⎇␈F1 ENDC;
847⎇⎇␈F1 :
848⎇⎇␈F1 <rest of file>
849⎇⎇␈F1 :
850⎇⎇␈F1 END "FOO"
851⎇⎇␈F1New file FOO.HDR:
852⎇⎇␈F1 IFCR NOT DECLARATION(GARPLY) THENC
853⎇⎇␈F1 BEGIN "FOO"
854⎇⎇␈F1 REQUIRE "[][]" DELIMITERS;
855⎇⎇␈F1 DEFINE GARPLY=TRUE;
856⎇⎇␈F1 DEFINE !=[COMMENT];
857⎇⎇␈F1 REQUIRE "BAZ.SAI" SOURCE_FILE;
858⎇⎇␈F1 REQUIRE "MUMBLE.SAI" SOURCE_FILE;
859⎇⎇␈F1 ENDC;
860⎇⎇␈F1Initial compilation:
861⎇⎇␈F1SAIL Addendum 1␈→1048⎇243⎇1⎇0⎇⎇SAVE/CONTINUE␈←
862⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16475⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
863⎇⎇␈F1 .R SAIL
864⎇⎇␈F1 *FOO.INT[PRJ,PRG]←FOO.HDR/X
865⎇⎇␈F1 SAVE ME!
866⎇⎇␈F1 .SAV XSAIL
867⎇⎇␈F1Now the command string
868⎇⎇␈F1 FOO←FOO
869⎇⎇␈F1will work both in the case of .R SAIL and in the case .RU XSAIL.
870⎇⎇␈F1␈→1069⎇0⎇2⎇0⎇⎇␈F2SECTION 9␈F1␈←
871⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
872⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16476⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
873⎇⎇␈F1␈→625⎇0⎇2⎇0⎇⎇␈F2MISCELLANEOUS NEW FEATURES␈F1␈←
874⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
875⎇⎇␈F19.1⎇-⎇␈F2NEW⎇MTAPE⎇OPTIONS␈F1
876⎇⎇␈F1 MTAPE(chan,NULL)
877⎇⎇␈F1will⎇cause⎇an⎇MTAPE⎇0⎇to⎇be⎇issued⎇for⎇channel⎇chan.⎇ For⎇mag.⎇tapes,⎇this⎇will⎇cause⎇you⎇to⎇wait
878⎇⎇␈F1until⎇all⎇activity⎇ceases.⎇ For⎇other⎇devices,⎇various⎇random⎇things⎇can⎇happen,⎇depending⎇on⎇the
879⎇⎇␈F1device⎇and⎇system.
880⎇⎇␈F1In⎇export⎇SAIL,⎇MTAPE(chnl,"I")⎇sets⎇the⎇'IBM⎇compatible'⎇mode⎇for⎇a⎇tape⎇drive.⎇ (It⎇does⎇an
881⎇⎇␈F1MTAPE⎇chnl,101.)
882⎇⎇␈F1These⎇features⎇do⎇not⎇work⎇in⎇TENEX⎇SAIL.⎇ Full⎇access⎇to⎇TENEX⎇magtapes⎇is⎇obtained⎇through
883⎇⎇␈F1the⎇MTOPR,⎇GDSTS⎇and⎇SDSTS⎇routines,⎇which⎇are⎇TENEX-only⎇runtimes.
884⎇⎇␈F19.2⎇-⎇␈F2INITIALIZATION⎇PHASES␈F1
885⎇⎇␈F1User⎇initializations⎇ are⎇ now⎇done⎇ in⎇successive⎇ phases,⎇with⎇ all⎇initializations⎇ required⎇ for
886⎇⎇␈F1one⎇ phase⎇ being⎇ done⎇ before⎇initializations⎇required⎇for⎇the⎇next⎇phase.
887⎇⎇␈F1Syntax:
888⎇⎇␈F1 REQUIRE <procid> INITIALIZATION;
889⎇⎇␈F1 REQUIRE <procid> INITIALIZATION [<phase no>];
890⎇⎇␈F1where <phase no> is an integer constant.
891⎇⎇␈F1Semantics:
892⎇⎇␈F1<phase⎇no>⎇specifies⎇ the⎇number⎇ of⎇the⎇user⎇ initialization⎇phase.⎇ If⎇ it⎇is⎇left⎇out,⎇ then⎇one⎇is
893⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
894⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16480⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
895⎇⎇␈F1used.⎇ Currently,⎇there⎇are⎇three⎇ phases,⎇numbered⎇0,⎇1,⎇and⎇ 2.⎇ If⎇the⎇ demand⎇is⎇great⎇enough,
896⎇⎇␈F1additional⎇phases⎇may⎇ be⎇added⎇later.⎇ (Note⎇for⎇assembly⎇ language⎇hackers:⎇internally,⎇user
897⎇⎇␈F1phases⎇are⎇numbered⎇'400000,⎇'400001,⎇etc.)
898⎇⎇␈F19.3⎇-⎇␈F2CHNCDB␈F1
899⎇⎇␈F1 val←CHNCDB(channel)
900⎇⎇␈F1This⎇integer⎇procedure⎇returns⎇a⎇pointer⎇to⎇the⎇three⎇word⎇block⎇used⎇to⎇open⎇the⎇ specified
901⎇⎇␈F1channel.⎇ It⎇is⎇provided⎇ for⎇the⎇benefit⎇ of⎇assembly⎇language⎇procedures⎇that⎇may⎇want⎇to⎇do
902⎇⎇␈F1I/O⎇inside⎇some⎇fast⎇inner⎇loop,⎇but⎇which⎇may⎇want⎇to⎇live⎇in⎇a⎇SAIL⎇core⎇image⎇&⎇use⎇the⎇SAIL
903⎇⎇␈F1OPEN,⎇etc.
904⎇⎇␈F1This⎇feature⎇does⎇not⎇work⎇in⎇TENEX⎇SAIL.⎇ See⎇a⎇hacker⎇if⎇you⎇want⎇these⎇features.
905⎇⎇␈F19.4⎇-⎇␈F2OVERFLOW␈F1
906⎇⎇␈F1The⎇overflow-underflow⎇handling⎇routines⎇have⎇been⎇upgraded⎇to⎇deal⎇with⎇JFCL⎇properly.⎇See
907⎇⎇␈F1the⎇section⎇on⎇trigonometric⎇routines.
908⎇⎇␈F19.5⎇-⎇␈F2ARRCLR␈F1
909⎇⎇␈F1 ARRCLR(arry)
910⎇⎇␈F1This⎇new⎇runtime⎇routine⎇clears⎇any⎇kind⎇of⎇array.⎇That⎇is,⎇arthmetic⎇arrays⎇get⎇filled⎇with⎇zeros,
911⎇⎇␈F1string⎇arrays⎇with⎇NULLs,⎇and⎇itemvar⎇arrays⎇with⎇ANYs.⎇ One⎇may⎇use⎇ARRCLR⎇with⎇set⎇and
912⎇⎇␈F1list⎇arrays,⎇but⎇the⎇set⎇and⎇list⎇space⎇will⎇be⎇lost⎇(i.e.⎇un-garbage-collectable).⎇The⎇alternative
913⎇⎇␈F1form:
914⎇⎇␈F1 ARRCLR(arry,val)
915⎇⎇␈F1where⎇val⎇is⎇either⎇an⎇integer⎇or⎇a⎇real⎇number,⎇will⎇fill⎇arry⎇with⎇that⎇value.⎇ Do⎇not⎇do⎇this⎇to
916⎇⎇␈F1string⎇or⎇list⎇arrays⎇unless⎇you⎇do⎇not⎇care⎇whether⎇or⎇not⎇your⎇program⎇works.⎇ Also⎇using⎇a
917⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
918⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16484⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
919⎇⎇␈F1real⎇val⎇for⎇an⎇itemvar⎇array⎇is⎇apt⎇to⎇cause⎇strange⎇results.⎇(If⎇you⎇use⎇an⎇integer,⎇arry⎇will⎇be
920⎇⎇␈F1filled⎇with⎇CVI(val).)
921⎇⎇␈F19.6⎇-⎇␈F2SETPL␈F1
922⎇⎇␈F1 SETPL(channel, @linnum, @pagnum, @sosnum)
923⎇⎇␈F1This⎇new⎇runtime⎇routine⎇allows⎇one⎇to⎇keep⎇track⎇of⎇the⎇string⎇input⎇from⎇CHANNEL.
924⎇⎇␈F1Whenever⎇a⎇'12⎇is⎇encountered,⎇LINNUM⎇is⎇incremented.⎇ Whenever⎇a⎇'14⎇is⎇encountered,
925⎇⎇␈F1PAGNUM⎇is⎇incremented,⎇and⎇LINNUM⎇is⎇zeroed.⎇ Whenever⎇an⎇SOS⎇line⎇number⎇is⎇encountered,
926⎇⎇␈F1it⎇is⎇placed⎇into⎇SOSNUM.⎇ When⎇fully⎇implemented⎇(soon),⎇this⎇will⎇work⎇on⎇the⎇INPUT,⎇INTIN,
927⎇⎇␈F1and⎇REALIN⎇functions⎇as⎇well.
928⎇⎇␈F19.7⎇-⎇␈F2EVALREDEFINE␈F1
929⎇⎇␈F1EVALREDEFINE⎇bears⎇the⎇same⎇relationship⎇to⎇REDEFINE⎇as⎇EVALDEFINE⎇does⎇to⎇DEFINE.
930⎇⎇␈F1See⎇pages⎇47⎇and⎇50⎇of⎇the⎇Manual.
931⎇⎇␈F19.8⎇-⎇␈F2CVPS␈F1
932⎇⎇␈F1CVPS(<macro_parameter>)⎇converts⎇<macro_parameter>⎇to⎇a⎇string⎇and⎇returns⎇the⎇string.⎇See
933⎇⎇␈F1about⎇macro⎇parameters⎇on⎇page⎇48⎇of⎇the⎇manual.
934⎇⎇␈F19.9⎇-⎇␈F2EXPRESSIONS⎇IN⎇REQUIRES␈F1
935⎇⎇␈F1Previously,⎇all⎇REQUIRE⎇constructs⎇had⎇to⎇have⎇only⎇constants⎇in⎇them.⎇Now⎇SAIL⎇allows⎇compile
936⎇⎇␈F1time⎇expressions⎇as⎇well.⎇See⎇about⎇compile⎇time⎇expressions⎇on⎇page⎇47⎇of⎇the⎇Manual.
937⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
938⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16489⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
939⎇⎇␈F19.10⎇-⎇␈F2RELEASE␈F1
940⎇⎇␈F1RELEASE⎇now⎇takes⎇an⎇optional⎇second⎇argument,⎇the⎇CLOSE⎇inhibit⎇bits.⎇ These⎇are⎇described⎇in
941⎇⎇␈F1the⎇UUO⎇manual⎇(Stanford⎇System).⎇These⎇are⎇defaulted⎇to⎇zero⎇when⎇not⎇specified⎇so⎇that⎇old
942⎇⎇␈F1programs⎇which⎇did⎇not⎇specify⎇them⎇will⎇work⎇as⎇before.
943⎇⎇␈F1The⎇CLOSE⎇inhibit⎇feature⎇only⎇works⎇at⎇SU-AI.
944⎇⎇␈F19.11⎇-⎇␈F2TTYUP␈F1
945⎇⎇␈F1 oldval←TTYUP(newval)
946⎇⎇␈F1This⎇routine⎇casuse⎇conversion⎇of⎇lower⎇case⎇characters⎇(a-z)⎇to⎇their⎇upper⎇case⎇equivalents⎇for
947⎇⎇␈F1strings⎇read⎇by⎇any⎇of⎇the⎇SAIL⎇teletype⎇routines⎇that⎇do⎇not⎇use⎇break⎇tables.⎇ If⎇newval⎇is
948⎇⎇␈F1TRUE,⎇then⎇conversion⎇will⎇take⎇place⎇on⎇all⎇subsequent⎇inputs⎇until⎇TTYUP⎇is⎇called⎇with⎇newval
949⎇⎇␈F1FALSE.⎇ Oldval⎇will⎇always⎇get⎇set⎇to⎇the⎇value⎇of⎇newval⎇used⎇in⎇the⎇previous⎇call.⎇(If⎇TTYUP
950⎇⎇␈F1has⎇never⎇been⎇called,⎇then⎇no⎇conversions⎇will⎇take⎇place,⎇and⎇the⎇first⎇call⎇to⎇TTYUP⎇will
951⎇⎇␈F1return⎇FALSE).
952⎇⎇␈F1In⎇TENEX,⎇TTYUP⎇sets⎇the⎇system⎇parameter⎇using⎇the⎇STPAR⎇jsys⎇to⎇convert⎇to⎇upper⎇case.
953⎇⎇␈F19.12⎇-⎇␈F2BREAKSET⎇MODES⎇"K"⎇AND⎇"F"␈F1
954⎇⎇␈F1A⎇"K"⎇specification⎇as⎇a⎇BREAKSET⎇mode⎇will⎇cause⎇lower⎇to⎇upper⎇case⎇conversion⎇when⎇that
955⎇⎇␈F1break⎇table⎇is⎇used.⎇ Conversion⎇takes⎇place⎇before⎇each⎇character⎇is⎇checked⎇for⎇breaking⎇or
956⎇⎇␈F1omission.⎇ An⎇"F"⎇specification⎇turns⎇off⎇the⎇conversion⎇--⎇i.e.⎇it⎇undoes⎇the⎇effects⎇of⎇"K".
957⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
958⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16493⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
959⎇⎇␈F19.13⎇-⎇␈F2INOUT␈F1
960⎇⎇␈F1 INOUT(inchan,outchan,howmany)
961⎇⎇␈F1INOUT⎇reads⎇howmany⎇words⎇from⎇channel⎇inchan⎇and⎇writes⎇them⎇out⎇on⎇channel⎇outchan.⎇ Each
962⎇⎇␈F1channel⎇must⎇be⎇open⎇in⎇a⎇mode⎇between⎇8⎇and⎇12.⎇ on⎇return,⎇the⎇EOF⎇variables⎇for⎇the⎇two
963⎇⎇␈F1channels⎇will⎇be⎇the⎇same⎇as⎇if⎇ARRYIN⎇&⎇ARRYOUT⎇had⎇been⎇used.⎇ If⎇howmany⎇is⎇less⎇than
964⎇⎇␈F1zero,⎇then⎇transfer⎇of⎇data⎇will⎇cease⎇only⎇upon⎇end⎇of⎇file⎇or⎇a⎇device⎇error.
965⎇⎇␈F1(note:⎇INOUT⎇uses⎇BLTs⎇to⎇transfer⎇data⎇directly⎇from⎇one⎇set⎇of⎇buffers⎇to⎇the⎇other)
966⎇⎇␈F1INOUT⎇is⎇not⎇available⎇in⎇TENEX⎇SAIL.
967⎇⎇␈F19.14⎇-⎇␈F2GETSTS⎇&⎇SETSTS␈F1
968⎇⎇␈F1 SETSTS(chan,new_status)
969⎇⎇␈F1issues a SETSTS uuo on channel chan with the status value new_status.
970⎇⎇␈F1 status←GETSTS(chan)
971⎇⎇␈F1returns⎇the⎇results⎇of⎇a⎇GETSTS⎇uuo⎇on⎇channel⎇chan.
972⎇⎇␈F1These⎇functions⎇do⎇not⎇exist⎇in⎇TENEX⎇SAIL.⎇ Instead,⎇see⎇GTSTS,⎇GDSTS,⎇STSTS,⎇and⎇SDSTS
973⎇⎇␈F1for⎇analogous⎇features.
974⎇⎇␈F19.15⎇-⎇␈F2CHANGES⎇TO⎇"OPEN"⎇ERROR⎇HANDLING␈F1
975⎇⎇␈F1If⎇the⎇EOF⎇variable⎇supplied⎇to⎇OPEN⎇is⎇non-zero⎇and⎇the⎇device⎇name⎇is⎇invalid,⎇then⎇OPEN⎇will
976⎇⎇␈F1fail⎇without⎇giving⎇the⎇error⎇message⎇"INVALID⎇DEVICE⎇NAME⎇FOR⎇OPEN",⎇and⎇the⎇EOF⎇value
977⎇⎇␈F1will⎇be⎇unchanged.⎇ If⎇a⎇device⎇is⎇unavailable,⎇and⎇EOF=0,⎇then⎇the⎇user⎇is⎇now⎇given⎇the⎇options
978⎇⎇␈F1of⎇trying⎇again⎇or⎇going⎇on⎇without⎇opening⎇the⎇device,⎇in⎇which⎇case⎇EOF⎇will⎇be⎇set⎇to⎇non-
979⎇⎇␈F1zero⎇as⎇usual.
980⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
981⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16497⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
982⎇⎇␈F19.16⎇-⎇␈F2ASH␈F1
983⎇⎇␈F1ASH⎇has⎇been⎇added⎇as⎇an⎇arithmetic⎇operator.⎇ Its⎇syntax⎇is⎇just⎇like⎇that⎇of⎇LSH,⎇and⎇it
984⎇⎇␈F1generates⎇similar⎇code⎇(except⎇for⎇putting⎇out⎇a⎇PDP-10⎇ASH⎇instruction⎇instead⎇of⎇a⎇LSH).
985⎇⎇␈F19.17⎇-⎇␈F2ARG_LIST␈F1
986⎇⎇␈F1 ARG_LIST(<arg1>,...,<argn>)
987⎇⎇␈F1where⎇each⎇<arg>⎇may⎇be⎇any⎇valid⎇argument⎇to⎇the⎇REF_ITEM⎇construct,⎇assembles⎇a⎇list⎇of
988⎇⎇␈F1"temporary"⎇reference⎇items⎇that⎇will⎇be⎇deleted⎇by⎇APPLY⎇after⎇the⎇applied⎇procedure⎇returns.
989⎇⎇␈F1Thus
990⎇⎇␈F1 APPLY(proc,ARG_LIST(foo,bar,VALUE baz))
991⎇⎇␈F1is roughly equivalent to
992⎇⎇␈F1 tmplst←{{REF_ITEM(foo),REF_ITEM(bar),REF_ITEM(VALUE baz)}};
993⎇⎇␈F1 APPLY(proc,tmplst);
994⎇⎇␈F1 WHILE LENGTH(tmplst) DO DELETE(LOP(tmplst));
995⎇⎇␈F1but⎇is⎇somewhat⎇easier⎇to⎇type.⎇ Note⎇that⎇the⎇reference⎇items⎇created⎇by⎇ARG_LIST⎇are⎇just
996⎇⎇␈F1like⎇those⎇created⎇by⎇REF_ITEM,⎇except⎇that⎇they⎇are⎇marked⎇so⎇that⎇APPLY⎇will⎇know⎇to⎇kill
997⎇⎇␈F1them.
998⎇⎇␈F19.18⎇-⎇␈F2CLOSE␈F1
999⎇⎇␈F1The⎇CLOSE⎇function⎇now⎇has⎇an⎇additional⎇optional⎇argument⎇that⎇allows⎇the⎇CLOSE⎇inhibit⎇bits
1000⎇⎇␈F1to⎇be⎇turned⎇on.⎇ The⎇second⎇argument⎇is⎇the⎇bit⎇pattern⎇for⎇the⎇inhibition,⎇and⎇it⎇is⎇defaulted⎇0.
1001⎇⎇␈F1See⎇the⎇UUO⎇manual⎇for⎇details.
1002⎇⎇␈F1This⎇feature⎇is⎇available⎇only⎇at⎇SU-AI,⎇and⎇is⎇not⎇available⎇in⎇the⎇TENEX⎇version⎇of⎇SAIL.
1003⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1004⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16501⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1005⎇⎇␈F19.19⎇-⎇␈F2TYPEIT␈F1
1006⎇⎇␈F1The⎇number⎇returned⎇by⎇the⎇TYPEIT⎇procedure⎇(which⎇identifies⎇the⎇type⎇of⎇the⎇datum⎇of⎇its
1007⎇⎇␈F1item⎇expression⎇argument)⎇is⎇now⎇changed⎇for⎇arrays.⎇ Now⎇it⎇is⎇'24⎇plus⎇the⎇scalar⎇value⎇of⎇the
1008⎇⎇␈F1type⎇(e.g.,⎇INTEGER),⎇whereas⎇before⎇it⎇was⎇'15⎇plus⎇the⎇scalar⎇value.
1009⎇⎇␈F1Additional⎇types⎇added⎇to⎇TYPEIT⎇are:⎇ '16⎇for⎇labels,⎇'17⎇for⎇record⎇classes.
1010⎇⎇␈F19.20⎇-⎇␈F2COMPARISON⎇OF⎇.REL⎇FILES␈F1
1011⎇⎇␈F1Starting⎇with⎇version⎇18,⎇the⎇compiler⎇emits⎇information⎇into⎇each⎇.REL⎇file⎇containing⎇the⎇version
1012⎇⎇␈F1of⎇the⎇compiler⎇used.⎇ Then,⎇during⎇the⎇SAIL⎇initialization⎇sequence,⎇these⎇versions⎇are⎇compared,
1013⎇⎇␈F1and⎇a⎇warning⎇message⎇is⎇issued⎇if⎇necessary.⎇ Thus,⎇the⎇problem⎇of⎇converting⎇from⎇one⎇version
1014⎇⎇␈F1of⎇the⎇compiler⎇to⎇a⎇new⎇version⎇is⎇lessened.⎇ This⎇feature⎇may⎇not⎇work⎇as⎇well⎇in⎇the⎇ current
1015⎇⎇␈F1changeover⎇as⎇it⎇will⎇in⎇the⎇future.
1016⎇⎇␈F19.21⎇-⎇␈F2SCAN⎇Optimizations␈F1
1017⎇⎇␈F1The⎇SCAN⎇function⎇has⎇been⎇modified⎇to⎇return⎇true⎇substrings⎇instead⎇of⎇copies⎇in⎇those⎇cases
1018⎇⎇␈F1that⎇the⎇break⎇table⎇in⎇question⎇was⎇not⎇omitting⎇any⎇characters.⎇ This⎇should⎇be⎇an⎇improvement
1019⎇⎇␈F1in⎇the⎇efficiency⎇of⎇those⎇routines.
1020⎇⎇␈F19.22⎇-⎇␈F2BREAK⎇TABLES␈F1
1021⎇⎇␈F1There⎇are⎇now⎇54⎇user-setable⎇break⎇tables⎇available⎇to⎇the⎇SCAN,⎇INPUT,⎇TTYINL⎇functions,⎇as
1022⎇⎇␈F1well⎇as⎇SETBREAK⎇and⎇BREAKSET.⎇ These⎇tables⎇are⎇allocated⎇and⎇deallocated⎇dynamically.
1023⎇⎇␈F1In⎇addition,⎇GETBREAK⎇now⎇returns⎇the⎇value⎇of⎇the⎇smallest⎇unallocated⎇breaktable,⎇and
1024⎇⎇␈F1RELBREAK⎇releases⎇its⎇table⎇argument.⎇ The⎇implicit⎇declarations⎇of⎇these⎇new⎇runtime⎇routines
1025⎇⎇␈F1are:
1026⎇⎇␈F1␈→824⎇0⎇2⎇0⎇⎇INTEGER PROCEDURE GETBREAK␈←
1027⎇⎇␈F1␈→715⎇0⎇2⎇0⎇⎇PROCEDURE RELBREAK(INTEGER TABLE)␈←
1028⎇⎇␈F1NOTE:⎇ a⎇breaktable⎇is⎇allocated⎇by⎇either⎇GETBREAK,⎇SETBREAK,⎇BREAKSET⎇or⎇STDBRK.⎇ A
1029⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1030⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16506⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1031⎇⎇␈F1breaktable⎇is⎇de-allocated⎇(and⎇thereby⎇made⎇available⎇to⎇GETBREAK)⎇by⎇RELBREAK.
1032⎇⎇␈F1Breaktables⎇are⎇stored⎇in⎇groups⎇of⎇18,⎇so⎇it⎇is⎇more⎇efficient⎇to⎇use⎇all⎇the⎇tables⎇in⎇a⎇given
1033⎇⎇␈F1group⎇before⎇going⎇to⎇another⎇group.⎇ The⎇use⎇of⎇GETBREAK⎇is⎇particularly⎇recommended⎇for
1034⎇⎇␈F1load-modules⎇and⎇the⎇like,⎇so⎇that⎇conflicts⎇will⎇be⎇minimzed.⎇ Breaktable⎇zero⎇is⎇special.⎇ It⎇is
1035⎇⎇␈F1predeclared⎇to⎇produce⎇the⎇same⎇results⎇as⎇SETBREAK(0,NULL,NULL,"I").⎇ This⎇results⎇in⎇break-
1036⎇⎇␈F1on-count⎇for⎇calls⎇to⎇INPUT,⎇and⎇always⎇returns⎇the⎇whole⎇string⎇for⎇SCAN.⎇ Breaktable⎇zero⎇is
1037⎇⎇␈F1stored⎇along⎇with⎇breaktables⎇1⎇to⎇18,⎇and⎇thus⎇takes⎇up⎇no⎇additional⎇space.
1038⎇⎇␈F1HACKERS:⎇ Actually⎇there⎇are⎇17⎇additional⎇system⎇breaktables⎇which⎇are⎇reserved⎇for⎇use⎇by
1039⎇⎇␈F1the⎇SAIL⎇runtime⎇system.⎇ These⎇tables⎇are⎇numbers⎇-17⎇through⎇-1,⎇and⎇are⎇ordinarily⎇not
1040⎇⎇␈F1available⎇to⎇the⎇user.⎇ They⎇will⎇be⎇used⎇by⎇the⎇debugger⎇and⎇by⎇additional⎇SAIL⎇system⎇software.
1041⎇⎇␈F1The⎇user⎇can⎇obtain⎇access⎇to⎇breaktables⎇-17⎇through⎇-1⎇by⎇setting⎇BRKPRV(USER)⎇to⎇-1,⎇for
1042⎇⎇␈F1example⎇by⎇the⎇USERCON⎇function⎇which⎇accesses⎇the⎇SAIL⎇user⎇table.⎇ WARNING:⎇ absolutely
1043⎇⎇␈F1no⎇guarantees⎇are⎇made⎇to⎇the⎇user⎇who⎇accesses⎇these⎇breaktables.⎇ This⎇information⎇is⎇intended
1044⎇⎇␈F1for⎇completeness⎇only;⎇the⎇use⎇of⎇these⎇special⎇breaktables⎇by⎇the⎇user⎇is⎇not⎇recommended.
1045⎇⎇␈F19.23⎇-⎇␈F2CV6STR␈F1
1046⎇⎇␈F1CV6STR⎇does⎇what⎇you⎇always⎇wished⎇CVXSTR⎇did.⎇ I.e.,⎇it⎇stops⎇converting⎇as⎇soon⎇as⎇it⎇sees⎇a
1047⎇⎇␈F1blank⎇rather⎇than⎇always⎇returning⎇a⎇six-character⎇string.⎇ Example:
1048⎇⎇␈F1 CV6STR(CVSIX("XYZ"))="XYZ", not "XYZ ".
1049⎇⎇␈F1Beware, however, since
1050⎇⎇␈F1 CV6STR(CVSIX("X Y Z")) ="X", not "X Y Z" or "XYZ".
1051⎇⎇␈F19.24⎇-⎇␈F2TENEX⎇RUNTIMES␈F1
1052⎇⎇␈F1The⎇TENEX⎇version⎇of⎇SAIL⎇now⎇has⎇these⎇additional⎇teletype-oriented⎇routines:⎇ STTYP,
1053⎇⎇␈F1GTTYP,⎇STPAR,⎇STI,⎇and⎇DELNF,⎇all⎇named⎇after⎇jsyses.⎇ See⎇TENEX-specific⎇documentation.
1054⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1055⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16509⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1056⎇⎇␈F19.25⎇-⎇␈F2CVASTR␈F1
1057⎇⎇␈F1CVASTR⎇is⎇the⎇"correct"⎇inverse⎇function⎇to⎇CVASC.⎇ I.e.,⎇it⎇stops⎇on⎇a⎇null⎇character.⎇ For
1058⎇⎇␈F1instance,
1059⎇⎇␈F1 CVASTR(CVASC("ABC")) is "ABC"
1060⎇⎇␈F1whereas
1061⎇⎇␈F1 CVSTR(CVASC("ABC")) is "ABC"&0&0
1062⎇⎇␈F19.26⎇-⎇␈F2NEW⎇SWITCHES␈F1
1063⎇⎇␈F1/V⎇ forces⎇loader⎇link⎇blocks⎇and⎇constant⎇string⎇texts⎇into⎇the⎇low⎇segment;⎇intended⎇for
1064⎇⎇␈F1overlay⎇systems⎇in⎇which⎇code⎇is⎇overlaid⎇but⎇data⎇is⎇not.
1065⎇⎇␈F1/X⎇ controls⎇compiler⎇save/continue;⎇see⎇the⎇section⎇on⎇save/continue.
1066⎇⎇␈F1/W⎇ generates⎇additional⎇(suppressed)⎇DDT⎇symbols.⎇ These⎇symbols⎇are⎇designed⎇to⎇serve⎇as
1067⎇⎇␈F1comments⎇to⎇a⎇programmer⎇or⎇processor⎇rummaging⎇though⎇the⎇generated⎇code.⎇ Symbols
1068⎇⎇␈F1generated⎇by⎇this⎇switch⎇all⎇begin⎇with⎇a⎇percent⎇sign⎇(%),⎇and⎇many⎇come⎇in⎇pairs.⎇ A⎇%$⎇symbol
1069⎇⎇␈F1points⎇to⎇the⎇first⎇word⎇of⎇an⎇area⎇and⎇a⎇%.⎇symbol⎇points⎇to⎇the⎇first⎇word⎇beyond⎇the⎇area.
1070⎇⎇␈F1Thus⎇the⎇length⎇of⎇an⎇area⎇is⎇the⎇difference⎇of⎇its⎇%.⎇and⎇%$⎇symbols.⎇ The⎇symbols⎇are:
1071⎇⎇␈F1 %$ADCN %.ADCN address constant area
1072⎇⎇␈F1 %$LIT %.LIT literal area
1073⎇⎇␈F1 %$RLIT %.RLIT reference literal area
1074⎇⎇␈F1 %$SCOD %.SCOD START!CODE or QUICK!CODE area
1075⎇⎇␈F1 %$STRC %$STRC string variable area
1076⎇⎇␈F1 %$VARS %.VARS simple variable area
1077⎇⎇␈F1 %ALSTO registers are about to be cleared
1078⎇⎇␈F1 %$ARRY first data word of a fixed array
1079⎇⎇␈F1 %$FORE FOREACH satisfier block
1080⎇⎇␈F1 %$SUCC SUCCEED/FAIL return block
1081⎇⎇␈F1/W⎇tends⎇to⎇increase⎇the⎇number⎇of⎇DDT⎇symbols⎇by⎇a⎇factor⎇of⎇2⎇or⎇3.
1082⎇⎇␈F1/F⎇Two⎇new⎇values,⎇/40F⎇and⎇/100F,⎇have⎇been⎇added.⎇Characters⎇are⎇temporarily⎇inhibited⎇from
1083⎇⎇␈F1going⎇to⎇the⎇listing⎇file⎇if⎇the⎇40⎇bit⎇is⎇on⎇(see⎇COMPILER_SWITCHES⎇below⎇for⎇what⎇good⎇this
1084⎇⎇␈F1will⎇do⎇you).⎇ If⎇the⎇100⎇bit⎇is⎇on⎇then⎇the⎇two-line⎇banner⎇normally⎇put⎇at⎇the⎇top⎇of⎇each⎇page
1085⎇⎇␈F1of⎇the⎇listing⎇is⎇suppressed.⎇ Using⎇the⎇100⎇bit⎇is⎇a⎇way⎇to⎇have⎇SAIL⎇"permanently"⎇expand
1086⎇⎇␈F1macros;⎇a⎇/110F⎇listing⎇can⎇be⎇used⎇as⎇a⎇SAIL⎇source⎇file.
1087⎇⎇␈F1/D,⎇/P,⎇/Q,⎇/R⎇now⎇accept⎇values.⎇ If⎇a⎇non-zero⎇value⎇appears,⎇it⎇is⎇interpreted⎇as⎇decimal⎇and
1088⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1089⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16512⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1090⎇⎇␈F1the⎇stack⎇is⎇set⎇to⎇that⎇size.⎇If⎇the⎇value⎇is⎇zero⎇or⎇absent,⎇then⎇the⎇stack⎇size⎇is⎇doubled⎇as
1091⎇⎇␈F1before.⎇ Thus⎇/35P/P⎇first⎇sets⎇the⎇P⎇stack⎇to⎇35⎇and⎇then⎇doubles⎇it⎇to⎇70.
1092⎇⎇␈F19.27⎇-⎇␈F2COMPILER_SWITCHES␈F1
1093⎇⎇␈F1The⎇statement⎇REQUIRE⎇"chars"⎇COMPILER_SWITCHES;⎇can⎇be⎇used⎇to⎇change⎇the⎇settings⎇of
1094⎇⎇␈F1the⎇compiler⎇switches.⎇ "chars"⎇must⎇be⎇a⎇string⎇constant⎇which⎇is⎇a⎇legitimate⎇switch⎇string,
1095⎇⎇␈F1containing⎇none⎇of⎇the⎇characters⎇"(/)";⎇e.g.,
1096⎇⎇␈F1 REQUIRE "20F" COMPILER_SWITCHES;
1097⎇⎇␈F1The⎇string⎇of⎇characters⎇is⎇merely⎇passed⎇to⎇the⎇switch⎇processor,⎇and⎇it⎇may⎇be⎇possible⎇to
1098⎇⎇␈F1cause⎇all⎇sorts⎇of⎇problems⎇depending⎇on⎇the⎇switches⎇you⎇try⎇to⎇modify.⎇ The⎇switches⎇which⎇set
1099⎇⎇␈F1stack⎇sizes⎇(D,⎇P,⎇Q,⎇R)⎇or⎇string⎇space⎇(S)⎇should⎇be⎇avoided.⎇Switches⎇which⎇control⎇the⎇format
1100⎇⎇␈F1of⎇files⎇(B,⎇F)⎇should⎇only⎇be⎇used⎇if⎇you⎇have⎇such⎇a⎇file⎇open.
1101⎇⎇␈F19.28⎇-⎇␈F2COMPILER_BANNER␈F1
1102⎇⎇␈F1This⎇is⎇a⎇predefined⎇macro⎇which⎇expands⎇to⎇a⎇string⎇constant⎇containing⎇the⎇text⎇of⎇the⎇two-line
1103⎇⎇␈F1banner⎇which⎇would⎇appear⎇at⎇the⎇top⎇of⎇the⎇current⎇page⎇if⎇a⎇listing⎇file⎇were⎇being⎇made.⎇ This
1104⎇⎇␈F1string⎇contains⎇the⎇date,⎇time,⎇name⎇and⎇page⎇of⎇the⎇source⎇file,⎇the⎇value⎇of⎇all⎇compiler⎇switches,
1105⎇⎇␈F1the⎇name⎇of⎇the⎇outer⎇block,⎇and⎇the⎇name⎇of⎇the⎇current⎇block.⎇ Thus⎇you⎇can⎇automatically
1106⎇⎇␈F1include⎇the⎇date⎇of⎇compilation⎇in⎇a⎇program⎇by⎇using⎇COMPILER_BANNER[n⎇TO⎇m]⎇for
1107⎇⎇␈F1appropriate⎇n⎇and⎇m.⎇Try⎇REQUIRE⎇COMPILER_BANNER⎇MESSAGE;⎇or⎇look⎇at⎇a⎇listing⎇for⎇the
1108⎇⎇␈F1exact⎇format.
1109⎇⎇␈F19.29⎇-⎇␈F2EDFILE␈F1
1110⎇⎇␈F1 EDFILE("filename",line,page,bits[0])
1111⎇⎇␈F1Exits⎇to⎇an⎇editor.⎇ Which⎇editor⎇is⎇determined⎇by⎇the⎇bits⎇which⎇are⎇on⎇in⎇the⎇second⎇parameter,
1112⎇⎇␈F1line⎇.⎇If⎇bit⎇0⎇or⎇bit⎇1⎇(600000,,0⎇bits)⎇is⎇on,⎇then⎇line⎇is⎇assumed⎇to⎇be⎇ASCID⎇and⎇SOS⎇is⎇called.⎇ If
1113⎇⎇␈F1neither⎇of⎇these⎇bits⎇is⎇on,⎇then⎇ line⎇ is⎇assumed⎇to⎇be⎇of⎇the⎇form⎇ attach⎇count,,sequential⎇line
1114⎇⎇␈F1number⎇and⎇E⎇is⎇called.⎇ Page⎇ is⎇the⎇binary⎇page⎇number.⎇ Bits⎇defaults⎇to⎇zero⎇and⎇controls⎇the
1115⎇⎇␈F1editing⎇mode:
1116⎇⎇␈F1 0 edit
1117⎇⎇␈F1 1 no directory (as in /N)
1118⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1119⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16516⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1120⎇⎇␈F1 2 readonly (as in /R)
1121⎇⎇␈F1 4 create (as in /C)
1122⎇⎇␈F1In⎇addition,⎇the⎇accumulators⎇are⎇set⎇up⎇from⎇INIACS⎇(see⎇below)⎇so⎇that⎇the⎇E⎇command⎇αX⎇RUN
1123⎇⎇␈F1will⎇run⎇the⎇dump⎇file⎇from⎇which⎇the⎇current⎇program⎇was⎇gotten.⎇[Accumulators⎇0⎇(file⎇name),⎇1
1124⎇⎇␈F1(extention),⎇and⎇6⎇(device)⎇are⎇loaded⎇from⎇the⎇corresponding⎇values⎇in⎇INIACS.]
1125⎇⎇␈F19.30⎇-⎇␈F2INIACS␈F1
1126⎇⎇␈F1The⎇contents⎇of⎇locations⎇0-'17⎇are⎇saved⎇in⎇block⎇INIACS⎇when⎇the⎇core⎇image⎇is⎇started⎇for⎇the
1127⎇⎇␈F1first⎇time.⎇ Declare⎇INIACS⎇as⎇an⎇external⎇integer⎇and⎇use⎇START_CODE⎇or
1128⎇⎇␈F1MEMORY[LOCATION(⎇INIACS)+n]⎇to⎇reference⎇this⎇block.
1129⎇⎇␈F19.31⎇-⎇␈F2GOGTAB␈F1
1130⎇⎇␈F1Direct⎇access⎇to⎇the⎇user⎇table⎇can⎇be⎇gained⎇by⎇declaring⎇EXTERNAL⎇INTEGER⎇ARRAY
1131⎇⎇␈F1GOGTAB[0:n];⎇ The⎇clumsy⎇USERCON⎇linkage⎇is⎇obsolete.
1132⎇⎇␈F1The⎇symbolic⎇names⎇of⎇all⎇GOGTAB⎇entries⎇can⎇be⎇obtained⎇by⎇requiring⎇SYS:GOGTAB.DEF
1133⎇⎇␈F1(<SAIL>GOGTAB.DEF⎇on⎇TENEX)⎇as⎇a⎇source⎇file.⎇ This⎇file⎇contains⎇DEFINEs⎇for⎇all⎇of⎇the
1134⎇⎇␈F1user⎇table⎇entries.
1135⎇⎇␈F19.32⎇-⎇␈F2ARERR␈F1
1136⎇⎇␈F1The⎇effective⎇address⎇of⎇an⎇ARERR⎇UUO⎇(op⎇code⎇007)⎇may⎇be⎇either⎇word⎇1⎇or⎇word⎇2⎇of⎇a
1137⎇⎇␈F1string⎇descriptor.⎇ This⎇allows⎇ARERR⎇1,["array⎇name"]⎇from⎇START_CODE.
1138⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1139⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16520⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1140⎇⎇␈F19.33⎇-⎇␈F2COORD␈F1
1141⎇⎇␈F1INTEGER PROCEDURE COORD(STRING LOCATION);
1142⎇⎇␈F1(A⎇ new⎇BAIL⎇feature).⎇ Returns⎇the⎇coordinate⎇number⎇of⎇the⎇location⎇given⎇as⎇its⎇argument.
1143⎇⎇␈F1LOCATION⎇has⎇the⎇same⎇syntax⎇as⎇in⎇BREAK.
1144⎇⎇␈F19.34⎇-⎇␈F2DEFAULT⎇PARAMETER⎇VALUES␈F1
1145⎇⎇␈F1Actually,⎇this⎇is⎇an⎇old⎇feature⎇which,⎇for⎇some⎇reason,⎇was⎇never⎇documented.⎇ The⎇SAIL
1146⎇⎇␈F1compiler⎇allows⎇you⎇to⎇specify⎇default⎇values⎇to⎇any⎇trailing⎇parameters.⎇ This⎇is⎇done⎇by
1147⎇⎇␈F1enclosing⎇the⎇desired⎇value⎇in⎇parentheses⎇following⎇the⎇parameter⎇declaration.⎇ For⎇instance,
1148⎇⎇␈F1 PROCEDURE FOO(REAL X;INTEGER I(2);STRING S("FOO");REAL Y(3.14159));
1149⎇⎇␈F1Then,⎇if⎇a⎇defaulted⎇parameter⎇is⎇left⎇out⎇of⎇a⎇procedure⎇call,⎇the⎇compiler⎇fills⎇in⎇the⎇default
1150⎇⎇␈F1automatically.⎇ Thus,⎇the⎇following⎇would⎇all⎇compile⎇the⎇same:⎇ FOO(A+B);
1151⎇⎇␈F1FOO(A+B,2,"FOO");⎇ FOO(A+B,2,"FOO",3.14159);
1152⎇⎇␈F1Only⎇VALUE⎇parameters⎇may⎇be⎇defaulted,⎇and⎇the⎇default⎇values⎇must⎇all⎇be⎇recognized⎇by⎇the
1153⎇⎇␈F1SAIL⎇compiler⎇as⎇constants.⎇ Also,⎇you⎇cannot⎇leave⎇out⎇a⎇parameter⎇from⎇the⎇middle⎇of⎇the
1154⎇⎇␈F1parameter⎇list.⎇(I.e.,⎇FOO(A+B,,"BAR")⎇won't⎇work).⎇ Finally,⎇it⎇should⎇be⎇noted⎇that⎇the⎇compiled
1155⎇⎇␈F1code⎇assumes⎇that⎇all⎇parameters⎇are⎇actually⎇present⎇in⎇the⎇call,⎇so⎇be⎇careful⎇about⎇funny
1156⎇⎇␈F1START_CODE⎇or⎇INTERNAL-EXTERNAL⎇linkages.⎇ However,⎇APPLY⎇will⎇fill⎇in⎇default⎇values⎇if
1157⎇⎇␈F1not⎇enough⎇actual⎇parameters⎇are⎇supplied⎇in⎇an⎇interpreted⎇call.
1158⎇⎇␈F19.35⎇-⎇␈F2PRESET_WITH␈F1
1159⎇⎇␈F1(This⎇feature⎇has⎇also⎇been⎇around⎇for⎇a⎇while.)⎇PRESET_WITH⎇is⎇just⎇like⎇PRELOAD_WITH
1160⎇⎇␈F1except⎇that⎇an⎇array⎇which⎇is⎇PRESET⎇is⎇placed⎇in⎇the⎇upper⎇segment⎇if⎇the⎇/H⎇switch⎇was
1161⎇⎇␈F1specified⎇to⎇the⎇compiler.⎇ This⎇allows⎇constant⎇arrays⎇to⎇be⎇in⎇the⎇shared⎇portion⎇of⎇the⎇code.
1162⎇⎇␈F1SAIL Addendum 1␈→819⎇243⎇1⎇0⎇⎇MISCELLANEOUS NEW FEATURES␈←
1163⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16524⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1164⎇⎇␈F19.36⎇-⎇␈F2RELATIONAL⎇OPERATORS␈F1
1165⎇⎇␈F1(This⎇feature⎇is⎇not⎇exactly⎇new,⎇either.)⎇ The⎇syntax⎇E1⎇RELOP1⎇E2⎇RELOP2⎇E3⎇where⎇E1,⎇E2,
1166⎇⎇␈F1and⎇E3⎇are⎇expressions⎇and⎇RELOP1,⎇RELOP2⎇are⎇relational⎇operators,⎇is⎇specially⎇interpreted⎇as
1167⎇⎇␈F1(E1⎇RELOP1⎇(T←E2))⎇AND⎇(T⎇RELOP2⎇E3).⎇ In⎇addition,⎇the⎇compiler⎇can⎇often⎇produce⎇better
1168⎇⎇␈F1code⎇when⎇the⎇special⎇syntax⎇is⎇used.⎇ Thus⎇a⎇bounds⎇check⎇may⎇be⎇written⎇IF⎇L<I<U⎇THEN⎇...⎇.
1169⎇⎇␈F1RELOP1⎇and⎇RELOP2⎇may⎇be⎇any⎇relational⎇operators,⎇and⎇need⎇not⎇be⎇in⎇transitive⎇order.⎇ The
1170⎇⎇␈F1code⎇IF⎇A<X>B⎇THEN⎇is⎇equivalent⎇to⎇IF⎇X>(A⎇MAX⎇B)⎇THEN⎇.
1171⎇⎇␈F1␈→1050⎇0⎇2⎇0⎇⎇␈F2SECTION 10␈F1␈←
1172⎇⎇␈F1SAIL Addendum 1␈→805⎇243⎇1⎇0⎇⎇MINOR CORRECTIONS TO AIM-204␈←
1173⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16526⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1174⎇⎇␈F1␈→621⎇0⎇2⎇0⎇⎇␈F2MINOR CORRECTIONS TO AIM-204␈F1␈←
1175⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇␈←
1176⎇⎇␈F1␈F4This⎇is⎇a⎇file⎇of⎇known⎇SAIL⎇manual⎇defects⎇(mainly⎇typos)⎇that⎇are⎇not
1177⎇⎇␈F4already⎇noted⎇in⎇the⎇preface⎇or⎇covered⎇by⎇the⎇"incremental"⎇SAIL
1178⎇⎇␈F4manual.⎇ It⎇is⎇primarily⎇an⎇internal⎇document⎇for⎇the⎇SAIL⎇hackers,⎇put
1179⎇⎇␈F4is⎇being⎇provided⎇here⎇as⎇a⎇stopgap⎇measure⎇pending⎇a⎇full⎇new⎇edition
1180⎇⎇␈F4for⎇the⎇manual.⎇ This⎇list⎇is,⎇however,⎇not⎇complete⎇in⎇that⎇it⎇does⎇not
1181⎇⎇␈F4include⎇a⎇number⎇of⎇typos⎇that⎇do⎇not⎇change⎇the⎇meaning.⎇ If,⎇however,
1182⎇⎇␈F4you⎇discover⎇any⎇defects⎇in⎇the⎇manual⎇or⎇in⎇the⎇update,⎇please⎇notify
1183⎇⎇␈F4your⎇friendly⎇local⎇SAIL⎇representative.
1184⎇⎇␈F499R KVL The synonym for "SUCH THAT" is "|" and not "␈↓"␈↑
1185⎇⎇␈F432R KVL APPENDIX 5 has nothing to do with the
1186⎇⎇␈F4 bits for IO errors or mode enablings
1187⎇⎇␈F443L RHT FILEINFO documentation is a lie. You usually get:
1188⎇⎇␈F4 FILENAME
1189⎇⎇␈F4 EXT,,DATE
1190⎇⎇␈F4 prot(9)Mode(4)time(11)date(12)
1191⎇⎇␈F4 negative swapped word count (if did a lookup).
1192⎇⎇␈F4 0 (unless you opened device in magic mode)
1193⎇⎇␈F4 0
1194⎇⎇␈F4 The whole point is that what you get is the six words
1195⎇⎇␈F4 from the last lookup or enter. For details see the
1196⎇⎇␈F4 monitor manual.
1197⎇⎇␈F458R JRL if a designated bracketed triple is not found
1198⎇⎇␈F4 then bindit is returned and no error message is given
1199⎇⎇␈F433L JRL release now takes a second defaultable value integer
1200⎇⎇␈F4 argument, the close inhibit bits (see RELEAS in UUO
1201⎇⎇␈F4 manual). These are defaulted to zero when
1202⎇⎇␈F4 unspecified.
1203⎇⎇␈F472R KVL TELLALL does not do an implicit RESCHEDULE as the
1204⎇⎇␈F4 description implies -- it just sets the status of
1205⎇⎇␈F4 the concerned processes to "ready".
1206⎇⎇␈F4102R RFS "33 through 36" S/B "33 through 35"
1207⎇⎇␈F4105R RFS ". her are several" s/b " . There are several"
1208⎇⎇␈F1SAIL Addendum 1␈→805⎇243⎇1⎇0⎇⎇MINOR CORRECTIONS TO AIM-204␈←
1209⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16528⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1210⎇⎇␈F479R,L KVL JOBTPC should be loaded with the location of a CALL
1211⎇⎇␈F4 to a non-simple procedure.
1212⎇⎇␈F492R JRL 20F will in future surround macro expansions with
1213⎇⎇␈F4 "<>" not "⊂⊃".
1214⎇⎇␈F438R RHT The description of INCHWL is wrong. Actually, the
1215⎇⎇␈F4 activation character is never included in the string
1216⎇⎇␈F4 and is always put into _SKIP_. (<crlf> puts a <cr>
1217⎇⎇␈F4 into _SKIP_ & throws away the <lf>).
1218⎇⎇␈F424L RHT The compiler will not in fact turn division by a
1219⎇⎇␈F4 power of two into an ASH.
1220⎇⎇␈F490L REG "... See section 19 about these [compilation errors]"
1221⎇⎇␈F4 should be section 20.
1222⎇⎇␈F490L REG 19.1.3 "boundary" is misspelled.
1223⎇⎇␈F441R RHT CVSIX left-justifies the sixbit value it builds.
1224⎇⎇␈F443L RHT In POINT, it is "a PDP-10 byte pointer".
1225⎇⎇␈F445R RHT FORC syntax should be "FORC <identifier> ← ... "
1226⎇⎇␈F457R RHT " ... methods of searching the associative store ..."
1227⎇⎇␈F4 had "store" missing before.
1228⎇⎇␈F4105L RHT "omaname" should be "the symbolic name"
1229⎇⎇␈F4110L RHT added reference:
1230⎇⎇␈F4 Harvey, Brian "Monitor Command Manual" SAILON 54.3
1231⎇⎇␈F4 (Dec 1973)
1232⎇⎇␈F4 Also, there is a more current SOS manual: SAILON 50.3
1233⎇⎇␈F476L RHT Should be "REF_ITEM(VALUE <expression>)"
1234⎇⎇␈F443L RFS For FILEINFO, also should have a note to export users
1235⎇⎇␈F4 like "FILEINFO fills the array with the results of
1236⎇⎇␈F4 the last LOOKUP or ENTER (DEC 10-50 systems).
1237⎇⎇␈F4 Consult your local monitor manual for the format of
1238⎇⎇␈F4 these entries."
1239⎇⎇␈F428L JRL CALLING PROCEDURES FROM INSIDE CODE BLOCKS
1240⎇⎇␈F4 "... procedure is typed, it will return is value in
1241⎇⎇␈F4 AC 1 (a pointer to the second word if the procedure
1242⎇⎇␈F4 is a string procedure)." should be " procedure is
1243⎇⎇␈F4 typed and not a string procedure it will return
1244⎇⎇␈F4 its value in AC 1. String procedures push the two
1245⎇⎇␈F4 word string descriptor corresponding to the result
1246⎇⎇␈F4 on the SP stack."
1247⎇⎇␈F1SAIL Addendum 1␈→805⎇243⎇1⎇0⎇⎇MINOR CORRECTIONS TO AIM-204␈←
1248⎇⎇␈F1␈→1296⎇0⎇2⎇0⎇⎇16529⎇␈←␈→1296⎇647⎇1⎇0⎇⎇␈←
1249⎇⎇␈F423L RHT The table of precedence for ∧ & ∨ is misleading.
1250⎇⎇␈F4 ∧ has higher precedence than ∨.
1251⎇⎇␈F426R JRL ARRYIN. No indication of how many words were actually
1252⎇⎇␈F4 read is given if EOF is encountered while reading a
1253⎇⎇␈F4 file in DUMP mode.
1254⎇⎇␈F425L RHT The description of the MEMORY[x,<type>] construct is
1255⎇⎇␈F4 very misleading. There is no restriction on the use
1256⎇⎇␈F4 of this construct as the left hand side of an
1257⎇⎇␈F4 assignment statement. In fact, MEMORY[x,<type>] may
1258⎇⎇␈F4 be used anywhere a simple variable of type <type> may
1259⎇⎇␈F4 be used.
1260⎇⎇␈F492R JFR The compiler is initialized with /7F.
1261⎇⎇␈F499L JFR In Appendix 3, the entry "STRBRK" should be "STDBRK".