Artifact d62b49912c5071ab008a293ab41a2959c75405a64803d67c1394b0afd1fa08f4:
- File
perq-pascal-lisp-project/paslsp-ini-read.red
— part of check-in
[eb17ceb7f6]
at
2020-04-21 19:40:01
on branch master
— Add Reduce 3.0 to the historical section of the archive, and some more
files relating to version sof PSL from the early 1980s. Thanks are due to
Paul McJones and Nelson Beebe for these, as well as to all the original
authors.git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/historical@5328 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1937) [annotate] [blame] [check-ins using] [more...]
% File to read PASLSP.INI to produce sorted tables FLUID '(NID!* IDLIST!* NCONST!* CONSTLIST!* NFN!* FNLIST!*); lisp procedure IniErr x; Error LIST("Bad Ini File ",x); load gsort; lisp procedure prinl l; for each x in l do print x; lisp procedure Sorts; Begin ReadPaslspInit(); Prin2t "--------------- Functions ----------------"; prinl idsort FNLIST!*; Prin2t "--------------- Other IDS ----------------"; prinl idsort IDLIST!*; Prin2t "--------------- CONST ----------------"; prinl CONSTLIST!*; End; lisp procedure ReadPaslspInit; BEGIN scalar infil,oldfil; % load "symbol table" with identifiers, constants, and functions. infil:=open("paslsp.ini",'input); oldfil:=rds(infil); NID!*:=RATOM(); % get count of identifiers. IF not fixp NID!* THEN IniErr("*****BAD SYMBOL TABLE, INTEGER EXPECTED AT START"); IDLIST!*:=NIL; FOR i := 1:NID!* DO IDLIST!* := RATOM() . IDLIST!*; % reading token magically loads it into id space. IF not ZeroP RATOM() % look for zero terminator. then IniErr("*****BAD SYMBOL TABLE, ZERO EXPECTED AFTER IDENTIFIERS"); NCONST!*:=RATOM(); % count of constants IF not FIXP NCONST!* THEN IniErr("*****BAD SYMBOL TABLE, INTEGER EXPECTED BEFORE CONSTANTS"); CONSTLIST!*:=NIL; FOR i := 1:NCONST!* DO CONSTLIST!*:=READ() . CONSTLIST!*; IF not ZeroP RATOM() then IniErr("*****BAD SYMBOL TABLE, ZERO EXPECTED AFTER CONSTANTS"); NFN!*:=RATOM(); % count of functions. IF not FIXP NFN!* then IniErr("*****BAD SYMBOL TABLE, INTEGER EXPECTED BEFORE FUNCTIONS"); FNLIST!*:=NIL; FOR i := 1:NFN!* DO % for each function % store associated code FNLIST!*:=RATOM(). FNLIST!*; If not Zerop RATOM() then IniErr("*****BAD SYMBOL TABLE, ZERO EXPECTED AFTER FUNCTIONS"); RDS(oldfil); CLOSE infil; END;