Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0003/paslnk.mac
There are 4 other files named paslnk.mac in the archive. Click here to see a list.
TITLE PASLNK - MODULE TO RETURN STUFF FROM SCAN TO PASREL
TWOSEG
;edit history
;2 - modify pushf so caller can detect problems in openning file
;3 - add clribf to clear input buffer on compile error
;4 - for tenex simulate PPNST
;5 - add curname to do JFNS
search monsym,pasunv,uuosym
if1, <printx Tops-20(%3 or later) version>
reg==b
reg1==c
reg2==d
reg3==e
reg4==f
reg5==g
reg6==h
opdef ppnst[jsys 557]
lookl==6 ;length of lookup block made by passcn
openl==3 ;length of open block
pathl==9 ;length of path block made by passcn
infil==2 ;ac containing file block for input
outfil==3 ; " output
relfil==4 ; " rel file
file==5 ; " current file block
data==6 ; " current data block from passcn (lookl+openl+pathl)
bptr==7 ; " byte pointer for making up file spec
bptr6==10 ; " byte pointer for sixbit conversion
gjfl==11 ;flags for gtjfn in pascnv
p==17
t==1
t0==0
reloc 0
oldf: block filcmp+1
oldfen=.-1
spec: block 12 ;longest possible tops-20 file spec
specl==.-1
RELOC 400000
ENTRY PASPRM
ENTRY PASXIT
entry clribf,curnam
entry pushf
entry popf
extern resetf,clofil
pasprm: movem relfil,relfcb## ;store for restart
move file,infil ;convert input file spec
movei data,inblk##
movsi gjfl,(gj%old)
pushj p,pascnv
move file,outfil
movei data,outblk##
movsi gjfl,(gj%fou)
pushj p,pascnv
move file,relfil
movei data,relblk##
movsi gjfl,(gj%fou)
pushj p,pascnv
movei t,relnam## ;beginning of parameter block to return
movem t,1(p) ;place PASCAL expects returned thing
popj p,
popj p,
pascnv: push p,a ;these ac's will be used in jsys's
push p,b
push p,c
setzm spec ;clear spec area
move t,[xwd spec,spec+1]
blt t,specl
move bptr,[point 7,spec]
;copy device name
move bptr6,[point 6,lookl+1(data)]
movei t,6
pushj p,from6
movei a,":"
idpb a,bptr
;copy directory name (if PPN given)
skipn b,.rbppn(data)
jrst pascn3 ;no PPN
move a,[point 7,spec] ;overwrite old device with dev:direct
ife tenex,<
move c,a ;c _ device to which PPN applies
ppnst
erjmp badcnv
move bptr,a ;updated output ptr to bptr
> ;ife tenex
ifn tenex,<
;[4] output a directory name from PPN using DIRST. Some sites (SUMEX) have
;a SCN7B which knows about tenex directory names, so one may say:
;obj_<directory>source, rather than obj_source[1,dir#]
movei c,"<"
idpb c,a ;open the directory name
movei b,0(b) ;DIRST needs dir # in RH
dirst
erjmp badcnv ;in case it fails
movei c,">"
idpb c,a ;close the directory name
move bptr,a ;updated output ptr to bptr
> ;ifn tenex
;copy file name
pascn3: move bptr6,[point 6,.rbnam(data)]
movei t,6
pushj p,from6
movei a,"."
idpb a,bptr
;copy extension
move bptr6,[point 6,.rbext(data)]
movei t,3
pushj p,from6
;now get the jfn
movsi a,(gj%flg!gj%sht) ;short jfn, returning flags
move b,[point 7,spec]
tryjfn: ior a,gjfl ;input or output flags
gtjfn
erjmp badcnv
move b,file
pushj p,initb.##
movem a,filjfn(file)
pop p,c
pop p,b
pop p,a
popj p,
;here if error in converting file spec - get from tty:
badcnv: movei a,[asciz /PASCNV - /]
esout
movei a,.priou ;to tty
hrloi b,.fhslf ;this process
setz c, ;as many bytes as you like
erstr
jfcl
jfcl
hrroi a,[asciz / - /]
psout
hrroi a,spec
psout
hrroi a,[asciz /
New file spec: /]
psout
movsi a,(gj%msg!gj%cfm!gj%fns!gj%flg!gj%sht)
move b,[xwd .priin,.priou]
jrst tryjfn ;now try again
;routine to put sixbit thing in the spec
from6: ildb c,bptr6
jumpe c,cpopj
addi c,40
idpb c,bptr
sojg t,from6
cpopj: popj p,
clribf: movei a,.priin
cfibf ;clear input buffer
popj p,
;curname(file,string)
; put current file spec into string
;b - FCB
;c - string addr
;d - string length
curnam: addi d,4 ;d _ string length in words
idivi d,5
move t0,[ascii / /] ;now init string to blanks
movem t0,(c)
hrli a,(c)
hrri a,1(c)
add d,c
blt a,-1(d)
hrro a,c ;now do jfns
hrrz b,filjfn(b)
move c,[exp 111110000001] ;full file spec
setz d,
jfns
movei t0,40 ;put blank in over null at end
idpb t0,a
popj p,
pasxit: movei reg,input##
setz reg1,
pushj p,clofil
movei reg,output##
setz reg1,
pushj p,clofil
move reg,relfcb
setz reg1,
pushj p,clofil
jrst calscn##
pushf: hrl t,reg ;copy old fcb
hrri t,oldf
blt t,oldfen
pushj p,init.b## ;reinit fcb
setz a, ;indicate text file
seto reg3, ;[2] so we can see errors
setzb reg4,reg5 ;[2]
movei reg6,30 ;[2] let us see open errors and EOL char
pushj p,resetf
popj p,
popf: push p,reg
setz reg1,
pushj p,clofil
pop p,reg
hrli t,oldf
hrr t,reg
blt t,filcmp(reg)
popj p,
end