Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/libsim/skip.mac
There is 1 other file named skip.mac in the archive. Click here to see a list.
COMMENT * SIMULA specification;
OPTIONS(/E:QUICK,skip);
TEXT PROCEDURE skip(tt,c);
NAME tt; TEXT tt; CHARACTER c;
COMMENT If, starting at tt.Pos, a sequence of characters = c is found,
then tt.Pos is moved past these characters, otherwise tt.Pos is unaltered.
The function value of skip is rest(tt) (after changing tt.Pos).
;
!*;! MACRO-10 code !*;!
TITLE skip
ENTRY skip
SUBTTL SIMULA utility, Lars Enderin Nov 1975
;!*** Copyright 1975 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed. ***
sall
search simmac,simmcr,simrpa
macinit
;! Local definitions ;!
tt==XWAC1
t==tt
c==XWAC3
bp==X0
lng=XIAC
c1==t+1
skip: PROC
IF ;! Xtop is not XWAC1
CAIN XTAC,XWAC1
GOTO FALSE
THEN ;! Rearrange ac's
EXCH XWAC1,(XTAC)
EXCH XWAC2,1(XTAC)
EXCH XWAC3,2(XTAC)
FI
ADDI t,(t+1) ;! Address of text variable
LF X1,ZTVCP(t) ;! X1:=t.Pos-1
LF lng,ZTVLNG(t) ;! lng:=t.Length-X1
SUBI lng,(X1)
JUMPLE lng,L9 ;! NOT t.More
LF ,ZTVSP(t)
ADDI (X1)
IDIVI 5
ADD (t)
HRRZ
ADD bytep(X1)
LOOP
ILDB c1,
CAIE c1,(c)
GOTO FALSE
AS
SOJG lng,TRUE
SA
LF X1,ZTVLNG(t)
SUBI X1,(lng) ;! X1:=t.Length-l
SF X1,ZTVCP(t) ;! [244]
IF ;! Any character remains
JUMPLE lng,FALSE
THEN
L c,t ;! Save text var address
MOVSI t,(x1)
ADD t,(c)
MOVSI t+1,(lng)
ELSE ;! NOTEXT
L9():! SETZB t,t+1
FI
IF ;! Xtop is not XWAC1
CAIN XTAC,XWAC1
GOTO FALSE
THEN
EXCH XWAC3,2(XTAC)
EXCH XWAC2,1(XTAC)
EXCH XWAC1,(XTAC)
FI
RETURN
EPROC
bytep: POINT 7,2,-1
POINT 7,2,6
POINT 7,2,13
POINT 7,2,20
POINT 7,2,27
LIT
END;