Trailing-Edge
-
PDP-10 Archives
-
decuslib10-04
-
43,50341/poet.mac
There are no other files named poet.mac in the archive.
TITLE POET - VERSIFICATION ROUTINE
SUBTTL RNF (UWO) 5-SEP-73
IFNDEF %%SCNM,<SEARCH C,SCNMAC>
CUST==0
MAJOR==3
MINOR==0
EDIT==12
TWOSEG
LOC <.JBVER==137>
BYTE (3)CUST(9)MAJOR(6)MINOR(18)EDIT
RELOC 400000
T1==1
T2==2
T3==3
N==7
P==17
DEFINE HELP <
HELPMS: ASCIZ /
POET is a program to set the version number in the extended
rib of DSK files. The command format is
XXX=YYY
where YYY may be a file from which the version number
is to be obtained, or YYY may itself be a version number.
(E. G., XXX=#401002000003 sets the version number to 1B(3)-4,
while XXX.MAC=XXX.SHR finds the version number of
XXX.SHR and uses it to set the version of XXX.MAC.)
/>
ENTRY POET
POET: TDZA T1,T1 ;REMEMBER WHERE STARTED
MOVEI T1,1
MOVEM T1,OFFSET
RESET
SETZM CLRBLK
MOVE T1,[CLRBLK,,CLRBLK+1]
BLT T1,CLREND
MOVE P,PDP
MOVE T1,[2,,[IOWD 1,['VERSIF']
OFFSET,,'POE']]
PUSHJ P,.ISCAN## ;INITIALIZE COMMAND SCANNER
POET1: MOVE T1,[6,,[0
0
0
1,,HELPMS
CLANS,,0
AIN,,AOUT]]
PUSHJ P,.TSCAN##
SETZM TESTOR ;(0 MEANS INPUT SPEC MAY BE #NNN)
;(-1 MEANS IT IS DEFINITELY A FILE SPEC)
SKIPE IDEV ;IDEV ZERO MEANS NO INPUT SPEC GIVEN
JRST IDP0 ;IN WHICH CASE USE OUTPUT SPEC
MOVE T1,[OFIL,,IFIL] ;"X.Y=" MEANS "X.Y=X"
BLT T1,IFIL+LIFIL-1
SETZM IEXT
SETOM TESTOR
JRST IDP
IDP0: SKIPN T1,INAM ;DOES INPUT SPEC INCLUDE FILE NAME?
JRST IDP1 ;"X.Y=Z:.W" MEANS "X.Y=Z:X.W"
VERIFY: MOVEI T2,0
ROTC T1,6 ;GIVEN "X=Y"; IS Y A FILE NAME?
JUMPE T2,BLANK
CAIL T2,'0'
CAILE T2,'Z'
JRST NOTNAM ;NO, THIS CHARACTER IS NOT ALPHANUMERIC
CAIL T2,'9'
CAIL T2,'A'
JRST VERIFY ;THIS CHAR IS ALPHANUMERIC
JRST NOTNAM
IDP1: MOVE T1,ONAM
MOVEM T1,INAM
SETOM TESTOR
JRST IDP
BLANK: JUMPE T1,IDP
NOTNAM: SKIPN TESTOR
JRST READY
IDP: SKIPN IEXT
JRST NOEXT ;NO EXT GIVEN, TRY .SHR, .HGH., ...
SETOM TESTOR ;EXT GIVEN, MUST BE A FILE SPEC
SETZM PFSPEC
MOVE T1,[4,,[[IFIL],,0
OPENBL,,LBLOCK
LIFIL,,7
1,,PFSPEC]]
PUSHJ P,.LKWLD##
JRST POET1
PUSHJ P,OPE
LOOKUP 1,LBLOCK
JRST LKFAIL
JRST FOUND
NOEXT: MOVSI T1,(FX.NUL)
ANDCAM T1,IMOD
MOVSI T1,-NMLEN
NOEXT1: MOVEM T1,TRYC
HLLO T1,NMTAB(T1)
MOVEM T1,IEXT
SETZM PFSPEC
MOVE T1,[4,,[[IFIL],,0
OPENBL,,LBLOCK
LIFIL,,7
1,,PFSPEC]]
PUSHJ P,.LKWLD##
JRST TRYAGN
PUSHJ P,OPE
LOOKUP 1,LBLOCK
JRST TRYAGN
JRST FOUND
TRYAGN: MOVE T1,TRYC
AOBJN T1,NOEXT1
SKIPE TESTOR ;MAYBE IT WASN'T A FILE SPEC
JRST POET1 ;WRONG. IT WAS
JRST READY
NMTAB: SIXBIT /SHR/
SIXBIT /HGH/
SIXBIT /SAV/
SIXBIT /LOW/
SIXBIT /SVE/
SIXBIT / /
NMLEN==.-NMTAB
FOUND: SKIPE T1,LBLOCK+.RBVER ;DOES FILE HAVE A VERSION?
JRST FOUND1
HLRZ T1,LBLOCK+.RBEXT ;NO, IS VERSION SEARCH MEANINGFUL?
CAIE T1,'HGH'
CAIN T1,'SHR'
JRST VERHGH
CAIE T1,'LOW'
CAIN T1,'SAV'
JRST VERLOW
CAIE T1,'SVE'
JRST VERNON
VERLOW: PUSHJ P,.NXDTW## ;GET NEXT IOWD POINTER
JRST VERNON ;GIVE UP IF EOF
JUMPE T1,VERNON ;OR IF JUNK
SKIPA T2,T1
VERLO1: AOBJP T2,VERLOW ;IF ALL USED UP, GET ANOTHER
PUSHJ P,.NXDTW##
JRST VERNON
HRRZ T3,T2
CAIGE T3,.JBVER-1
JRST VERLO1
CAIN T3,.JBVER-1
JRST FOUND1
JRST VERNON
VERHGH: MOVEI T2,.JBHVR##
PUSHJ P,.NXDTW##
JRST VERNON
SOJGE T2,.-2
FOUND1: JUMPE T1,VERNON
MOVEM T1,INAM
JRST READY
VERNON: MOVEI N,IFIL
M.FAIF <No version number in >
READY: SETZM LSWTCH
POET2: PUSHJ P,LOOK
JRST POET1
LOOKUP 1,LBLOCK
JRST LKFAIL
MOVE T1,INAM
MOVEM T1,LBLOCK+.RBVER
RENAME 1,LBLOCK
PUSHJ P,RENERR
MOVE T1,LBLOCK+.RBNAM
PUSHJ P,.TSIXN##
HLLZ T1,LBLOCK+.RBEXT
JUMPE T1,.+3
OUTCHR ["."]
PUSHJ P,.TSIXN
PUSHJ P,CRLF
JRST POET2
.TNEWL::
CRLF: OUTSTR [ASCIZ /
/]
POPJ P,
CLANS: SETZM CLRBLK
MOVE T1,[CLRBLK,,CLRBLK+1]
BLT T1,CLREND
POPJ P,
AOUT: MOVEI T1,OFIL
MOVEI T2,LOFIL
POPJ P,
AIN: MOVEI T1,IFIL
MOVEI T2,LIFIL
POPJ P,
LKFAIL: PUSHJ P,E.DFL##
JRST POET1
RENERR: OUTSTR [ASCIZ /%RENAME failure (/]
HRRZ T1,LBLOCK+.RBEXT
PUSHJ P,.TDECW##
OUTSTR [ASCIZ /) /]
POPJ P,
LOOK: SKIPE LSWTCH
JRST LOOK1
OUTSTR [ASCIZ /FILES VERSIFIED:
/]
SETZM PFSPEC
LOOK1: MOVE T1,[4,,[[OFIL],,0
OPENBL,,LBLOCK
LOFIL,,7
0,,PFSPEC]]
PUSHJ P,.LKWLD##
JRST DONE1
SKIPN LSWTCH
REOPE: PUSHJ P,OPE
AOS LSWTCH
CPOPJ1: AOS (P)
CPOPJ: POPJ P,
DONE1: AOJE T1,CPOPJ
JRST REOPE
OPE: MOVEI T1,14 ;SET CHANNEL FOR OPENING IN BINARY
MOVEM T1,OPENBL
OPEN 1,OPENBL
JRST [PUSHJ P,E.DFO##
JRST POET1]
POPJ P,
HELP
PDP: IOWD 30,PDL
RELOC 0
PDL: BLOCK 30
OFFSET: BLOCK 1
OPENBL: BLOCK 3
CLRBLK:
PFSPEC: BLOCK 1
LBLOCK: BLOCK 7
LSWTCH: BLOCK 1
OFIL:! BLOCK 0
ODEV: BLOCK 1
ONAM: BLOCK 1
ONAMN: BLOCK 1
OEXT: BLOCK 1
OMOD: BLOCK 1
OMODM: BLOCK 1
ODIR: BLOCK 1
ODIRM: BLOCK 13
LOFIL==.-OFIL
IFIL: BLOCK 0
IDEV: BLOCK 1
INAM: BLOCK 1
INAMN: BLOCK 1
IEXT: BLOCK 1
IMOD: BLOCK 1
IMODM: BLOCK 1
IDIR: BLOCK 1
IDIRM: BLOCK 13
LIFIL==.-IFIL
TESTOR: BLOCK 1
TRYC: BLOCK 1
CLREND==.-1
RELOC
END POET