|
|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 4608 (0x1200)
Types: TextFile
Names: »readaddpctx«
└─⟦621cfb9a2⟧ Bits:30002817 RC8000 Dump tape fra HCØ. Detaljer om "HC8000" projekt.
└─⟦0364f57e3⟧
└─⟦bf33d74f6⟧ »iogeofile«
└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ.
└─⟦b2ec5d50f⟧
└─⟦bf33d74f6⟧ »iogeofile«
└─⟦this⟧
; read_add_pc_tx * page 1 13 09 77, 10.29;
; read_add_pch
; ************
if listing.yes
char 10 12 10
read_add_pch = set 1 disc
read_add_pch = algol
external integer procedure read_add_pch(z, v, c);
_________________________________________________
zone z;
long v;
integer c;
comment read_add_pch is used for input of tapes from punching adding
machines. in order to permit rereading of data stored after error nl,
blank, and ff are accepted as blind symbols outside any number incl.
the sign and the terminator. the only legal terminators are letters
a to f or nl instead of c. the only legal sign is minus. a minus
following immediately after minus will give a termination with minus
as illegal terminator.
An illegal termination will always give the termination
class 7, except for the EM-character.
read_add_pch return integer
the class of the input according to the termination
a = 1, b = 2, c =3, d = 4, e = 5, f = 6, others = 7, though em = 8
z call and return zone
the zone used for buffering of the character input. the zone is
assumed open and in state for character input.
v return long
the number input. if no digits have been input v = 0.
input of more than 13 significant digits will produce
an exit with the last digit as the illegal terminator.
c return integer
the isovalue of the terminator character
decision table
state init after sign after digit
_ 0 1 2
_ action/next state
class
1=digit 1/2 1/2 1/2
2=sign 2/1 4/4 4/4
3=leg term 4/4 4/4 4/3
4=illeg tm 4/4 4/4 4/4
5=bl or ff 3/0 4/4 4/4
6=nl 3/0 4/4 4/3
state=3 legal exit
state=4 illegal exit
actions
1 include digit
2 record sign
3 no action
4 end_action;
\f
comment read_add_pc_tx * page 2 13 09 77, 10.29
0 1 2 3 4 5 6 7 8 9 ;
begin
boolean array ac_st(1:12);
integer class, state, action, char, digits;
long number;
boolean neg;
for class:=1 step 1 until 12 do
ac_st(class):=false add (case class of (
1 + (1 shift 3) + (1 shift 6), 2 + (4 shift 3) + (4 shift 6),
4 + (4 shift 3) + (4 shift 6), 4 + (4 shift 3) + (4 shift 6),
3 + (4 shift 3) + (4 shift 6), 3 + (4 shift 3) + (4 shift 6),
2 + (2 shift 3) + (2 shift 6), 1 + (4 shift 3) + (4 shift 6),
4 + (4 shift 3) + (3 shift 6), 4 + (4 shift 3) + (4 shift 6),
0 + (4 shift 3) + (4 shift 6), 0 + (4 shift 3) + (3 shift 6)));
number:=0; state:=0; neg:=false;
for digits:=0, digits while state>=-6 do
begin
class:=case (read_char(z, char)-1) of (
if digits<14 then 1 else 4, if char=45 then 2 else 4,
4, 4, if 97<=char and char<=102 then 3 else 4,
if char<>32 then 4 else 5,
if char=10 then 6 else if char=12 then 5 else 4);
action:=(ac_st(class) shift state) extract 3;
state:=-3*((ac_st(class+6) shift state) extract 3);
case action of
begin
begin comment action 1, include digit;
if char<>48 or digits<>0 then digits:=digits+1;
number:=number*10+char-48;
end action 1;
comment action 2 record sign; neg:=true;
comment action 3, no action; ;
begin comment action 4, terminate reading;
if neg then number:=-number; v:=number; c:=char;
read_add_pch:=case (-state)//3 - 2 of (
if char<>10 then (char-96) else 3,
if char<>25 then 7 else 8);
end action 4;
end actions;
end digit loop;
end read_add_pch;
end
\f
; read_add_pc_tx * page 3 13 09 77, 10.29;
if warning.yes
(mode 0.yes
message read_add_pch not ok
lookup read_add_pch)
▶EOF◀