Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/libsim/filspc.mac
There is 1 other file named filspc.mac in the archive. Click here to see a list.
COMMENT * SIMULA specification;
OPTIONS(/E:CODE,NOCHECK,filspc);
TEXT PROCEDURE filspc;!(fileref,format);! REF(FILE)fileref;! INTEGER format;
COMMENT Returns a string specifying a file:
in TOPS-10: dev:file.ext[path]<prot>
in TOPS-20: str:<directory>file.ext.,Pnnnnnn
(".," stands for semicolon)
FORMAT is an integer which specifies the fields to be included in the resulting
string. FORMAT is basically treated as a packed integer array,
where most elements are 3 bits wide.
Each 3-bit integer controls one field of the output string.
The value of a controlling integer can be:
0: (.JSNOF) Suppress the field.
1: (.JSAOF) Always output the field.
2: (.JSSSD) Suppress the field if it is the system default.
The following octal values would be used to always output the corresponding
fields:
8R 100000 000000 (2^33) Output DEVICE (File structure)
8R 010000 000000 (2^30) Directory name in TOPS-20, ppn (+SFD) path in TOPS-10
8R 001000 000000 (2^27) File name (value=2 illegal)
8R 000100 000000 (2^24) File type (extension) (value=2 illegal)
8R 000010 000000 (2^21) File generation number (not implemented)
8R 000001 000000 (2^18) Protection
8R 000000 040000 (2^14, one bit) Temporary file (only in TOPS-20)
The remaining field control bits used are:
8R 000000 000001 (2^0) Punctuate All Fields, e g DEV:NAME.EXT[p,pn,sfd1,sfd2]
The format is adapted from the control word for the JFNS JSYS in TOPS-20
(see the Monitor Calls manual for TOPS-20) to make it easy to modify when
and if full TOPS-20 support will be included in the SIMULA system.
FORMAT=0 or omitted is equivalent to 8R 221110 000001 -
dev:name.ext[proj,prog,sfd1,...] (TOPS-10)
dev:<directory>name.typ.gen.,T (TOPS-20)
(., stands for semicolon)
with dev: omitted if it is DSK, <directory> omitted if it is the connected
directory, [proj,...] omitted if it is the default path.
;
!*;! MACRO-10 code !*;!
TITLE filspc
ENTRY filspc
SUBTTL SIMULA utility, Lars Enderin June 1977
;!*** Copyright 1977 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed. ***
sall
search simmac,simmcr,simrpa
macinit
ERRMAC(PH)
EXTERN .FILST
FILST==.FILST
;! Local definitions ;!
result==2
fileref==result+2
format==fileref+2
filspc: PROC
LF ,ZFLATP(XCB,fileref)
CAIE QREF
PHERR 7,Wrong actual parameter type
LF X1,ZFLZQU(XCB,fileref)
LF ,ZCPGCI(X1)
CAIE QIOFI
PHERR 11,Wrong qualification on actual parameter
IF ;! No thunk
SKIPL X1,fileref(XCB)
GOTO FALSE
THEN ;! Load file ref easily
HRRZ X2,fileref+1(XCB)
ADDI X2,(X1)
L XWAC1,(X2)
ELSE ;! Use RTS routine
LI XWAC1,(XCB)
HRLI XWAC1,fileref
XEC PHFV
Z
FI
LF ,ZDNTYP(XWAC1)
CAIE QZCL
PHERR 13,Wrong kind of actual parameter
ST XWAC1,fileref(XCB)
CAIN XWAC1,NONE
BRANCH CSEP ;! NONE => NOTEXT
SETZM fileref+1(XCB)
IF ;! Format given
SKIPN X1,format(XCB)
GOTO FALSE
THEN ;! Get value
LF ,ZFLATP(XCB,format)
CAIE QINTEGER
PHERR 7,Wrong type ...
IF ;! No thunk
JUMPG X1,FALSE
THEN ;! Simple load
HRRZ X2,format+1(XCB)
ADDI X2,(X1)
L XWAC1,(X2)
ELSE ;! Use RTS
LI XWAC1,(XCB)
HRLI XWAC1,format
EXEC PHFV
Z
FI
ST XWAC1,fileref+1(XCB)
FI
TOPS10,<Q1==2+2*<1+2+6+1> ;! Record for PATH. UUOs
Q==<6+1+6+1+3+1+7*<6+1>+4>/5+2>
TOPS20,<Q1==0
Q==6+1+^d39+6+1+1+3+1+2+6+5>
LOWADR
SETOM YSANIN(XLOW)
IFN Q1,<L XTAC,[QZYS,,Q+Q1] ;! One ZYS record one text record>
IFE Q1,<L XTAC,[QZTE,,Q]>
XEC SAAR
IFN Q1,<LI X4,2(XTAC)
HRLI X4,Q1-3
LI Q1
SF ,ZYSLG(XTAC)
LI XTAC,Q1(XTAC)
LI X1,QZTE
MOVSM X1,(XTAC)
LI X1,Q
SF X1,ZTELEN(XTAC)
>
IFE Q1,<LF X1,ZTELEN(XTAC)>
HRRZM XTAC,result(XCB)
SUBI X1,2
IMULI X1,5
SF X1,ZTECLN(XTAC)
IFN QSADEA,<
L X1,YSATOP(XLOW)
ST X1,YSADEA(XLOW)
>
LI X1,2(XTAC)
HRLI X1,(POINT 7,0)
ST X1,format+1(XCB)
LI X1,[IDPB X1,format+1(XCB)
AOS format+3(XCB)
RET]
LD X2,fileref(XCB)
XEC FILST
L X1,format+3(XCB);! Character count
SF X1,ZTVLNG(XCB,result)
LF XWAC1,ZTVZTE(XCB,result)
SF X1,ZTECLN(XWAC1)
ADDI X1,4+2*5
IFN QSADEA,<
L X1,YSATOP(XLOW)
ST X1,YSADEA(XLOW)
>
IDIVI X1,5
LF X2,ZTELEN(XWAC1)
IF ;! More than 2 empty words at the end
CAIG X2,2(X1)
GOTO FALSE
THEN ;! Make rest a dummy ZYS record, to be collected
SF X1,ZTELEN(XWAC1)
ADDI XWAC1,(X1)
IFN QSADEA,<ST XWAC1,YSADEA(XLOW)>
SUBI X2,(X1)
WSF X2,ZYSLG(XWAC1)
LI QZYS
SF ,ZDNTYP(XWAC1)
FI
BRANCH CSEP
EPROC
LIT
END;