Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/tbl.r36
There are 14 other files named tbl.r36 in the archive. Click here to see a list.
!TBL library file for NETSPL & friends
!VERSION [3]	EDIT [7]	DATE [19,Mar,80]

COMPILETIME FTNET=1;
COMPILETIME FTQUASAR=1;
COMPILETIME FTLOG=(%VARIANT AND 2) NEQ 0;	!On for logging support
COMPILETIME FTDET=FTLOG;	!Support detached mode (output via TRMOP)
COMPILETIME FTSIG=%VARIANT AND 1;	!On for signalling stuff
%IF (%VARIANT AND 2) NEQ 0 %THEN %ASSIGN(FTSIG,1) %FI;
		!Always on for NETSPL

MACRO DEFAULT_VALUE(N,V)=%IF NOT %DECLARED(N) %THEN LITERAL N=V %FI %;

MACRO IF700=IFMON_NEWER(700) %;		!See if monitor is 7.00 or later

MACRO IFMON_NEWER(VRS)=
	IF	(%IF NOT %DECLARED(MONVER) %THEN EXTERNAL MONVER; %FI
		 .MONVER GEQ %O %STRING(VRS,'00')) %;

DEFAULT_VALUE(SFDMAX,5);

%(
FILE BLOCK format
	There will be file blocks for all non-TTY I/O.  These will be set up
for use by the FILOP. UUO.
	A NETSPL file block will consist of:
	[1] a FILOP. block
	[2] an extended LOOKUP block
	[3] a PATH. block
	There will be routines callable from BLISS-36 to use these.
 	In detail, the file block format is:
)%

PHASE(0);

!OFFSET	FIELD			COMMENTS
SWITCHES LIST(NOSOURCE);
FIELD FILE_FIELDS=SET

DFF[$,FIRSTWORD,WRD],			!Start of block
DFF[FILE$START,FIRSTWORD,WRD],		!Beginning of all this
DFF[FILE$GODLY,FIRSTWORD,35,1,0],	!Ignore protection codes if true
DFF[FILE$CHANNEL,THISWORD,18,17,0],	!Channel number
DFF[FILE$FUNCTION,THISWORD,RH],		!Function Code for FILOP. UUO. 
DFF[FILE$MODE,NEXTWORD,WRD],		!Mode and open bits
DFF[FILE$CHARCOUNT,THISWORD,28,7,0],	!Character count for foreign filespec
DFF[FILE$DEVICE,NEXTWORD,WRD],		!Device (SIXBIT)
DFF[FILE$O_BRH,NEXTWORD,LH],		!Output B.R.H. addr
DFF[FILE$I_BRH,THISWORD,RH],		!Input B.R.H. addr
DFF[FILE$O_NBUFF,NEXTWORD,18,18,1],	!# of output buffers
DFF[FILE$I_NBUFF,THISWORD,0,18,1],	!# of input buffers
DFF[FILE$RENAME,NEXTWORD,LH],		!RENAME lookup block
DFF[FILE$LOOKUP,THISWORD,RH],		!Address of LOOKUP block
DFF[FILE$PATH_LEN,NEXTWORD,LH],		!Length of PATH. block
DFF[FILE$PATH_BLOCK,THISWORD,RH],	!Address of PATH. block
DFF[FILE$ALIAS,NEXTWORD,WRD],		!Enforce protection as if we were he

!An extended LOOKUP block follows:
DFF[FILE$ELK,NEXTWORD,WRD],		!Extended lookup block

DFF[FILE$COUNT,THISWORD,0,17,0],	!# of args (should contain 9)
DFF[FILE$LPPN,NEXTWORD,WRD],		!PPN
 DFF[FILE$LPATH,THISWORD,RH],		! Address of PATH block
DFF[FILE$NAME,NEXTWORD,WRD],		!FILE NAME (SIXBIT)
DFF[FILE$EXTENSION,NEXTWORD,LH],	!Extension (SIXBIT)
DFF[FILE$CDATE75,THISWORD,15,3,0],	!High-order 3bits of Creation Date
DFF[FILE$ADATE,THISWORD,0,15,0],	!Access Date
DFF[FILE$PROTECTION,NEXTWORD,27,9,0],	!Protection code
 DFF[FILE$PROTOWN,THISWORD,33,3,0],	!Owner protection
 DFF[FILE$PROTGRP,THISWORD,30,3,0],	!Group
 DFF[FILE$PROTWLD,THISWORD,27,3,0],	!World
DFF[FILE$WMODE,THISWORD,23,4,0],	!Mode file was written in
DFF[FILE$CTIME,THISWORD,12,11,0],	!Creation time (minutes since midnight)
DFF[FILE$CDATE,THISWORD,0,12,0],	!Creation date (except for top 3 bits)
DFF[FILE$SIZE,NEXTWORD,WRD],		!File size in WORDS
 DFF[FILE$WORDS,THISWORD,WRD],		!synonym
DFF[FILE$VERSION,NEXTWORD,WRD],		!Version number
 DFF[FILE$VWHO,THISWORD,33,3,0],	! the number that follows the dash
 DFF[FILE$VMAJOR,THISWORD,24,9,0],	! number that gets printed first
 DFF[FILE$VMINOR,THISWORD,18,6,0],	! letter that follows version number
 DFF[FILE$VEDIT,THISWORD,RH],		! number in parentheses
DFF[FILE$SPOOL,NEXTWORD,WRD],		!Spooled name (also printed by DIRECT)
DFF[FILE$EST,NEXTWORD,WRD],		!Estimated length (blocks)
DFF[FILE$ALLOC,NEXTWORD,WRD],		!Allocated length (contiguous or cause error)

!A PATH. block follows:

DFF[FILE$PATH_FUN,NEXTWORD,WRD],	!Function or channel
DFF[FILE$PATH_FLAGS,NEXTWORD,WRD],	!Bits and flags
DFF[FILE$DIR,NEXTWORD,WRD],		!PPN
 DFF[FILE$PPN,THISWORD,WRD],		!UFD
   DFF[FILE$PROJECT,THISWORD,LH],
   DFF[FILE$PROGRAMMER,THISWORD,RH],
DFF[FILE$SFD,MWORDS(SFDMAX),WRD],	!Start of SFDs
DFF[FILE$PATH_END,NEXTWORD,WRD],	!should be 0 to mark end of PATH. block

!Input buffer ring header

DFF[FILE$I_CBUFF,NEXTWORD,WRD],		!First word of input buffer ring header
 DFF[FILE$I_USE,THISWORD,35,1,0],	! use bit
DFF[FILE$I_PTR,NEXTWORD,WRD],		!2nd word = Input Pointer
 DFF[FILE$I_BYTESIZE,THISWORD,24,6,0],	!Byte size
DFF[FILE$I_COUNT,NEXTWORD,RHS],		!3rd word = byte count
 DFF[FILE$I_BOOKKEEPING,THISWORD,LH],	!The "Book-keeping 'word'"
 DFF[FILE$I_IOLIST,THISWORD,WRD], 	!If dump mode, address of I/O list
DFF[FILE$I_UDX,NEXTWORD,WRD],		!4th word = UDX

!Output buffer ring header

DFF[FILE$O_CBUFF,NEXTWORD,WRD],		!First word of output buffer ring header
 DFF[FILE$O_USE,THISWORD,35,1,0],	! use bit
 DFF[FILE$O_NOCLEAR,THISWORD,34,1,0],	! don't clear output buffers
DFF[FILE$O_PTR,NEXTWORD,WRD],		!2nd word = Output pointer
 DFF[FILE$O_BYTESIZE,THISWORD,24,6,0],	!Byte size
DFF[FILE$O_COUNT,NEXTWORD,RHS],		!3rd word = byte count
 DFF[FILE$O_BOOKKEEPING,THISWORD,LH],	!The "Book-keeping 'word'"
 DFF[FILE$O_IOLIST,THISWORD,WRD],	!If dump mode, address of I/O list
DFF[FILE$O_UDX,NEXTWORD,WRD],		!4th word = UDX

DFF[FILE$PF,NEXTWORD,LH],		!Filespec parser flags (as follows)
 DFF[FILE$PF_NORESET,THISWORD,35,1,0],	!Don't reset default flags
 DFF[FILE$PF_NODE_D,THISWORD,34,1,0],	!Nodeid defaulted (not specified by user)
 DFF[FILE$PF_DEV_D,THISWORD,33,1,0],	!Device defaulted
 DFF[FILE$PF_NAME_D,THISWORD,32,1,0],	!File name defaulted
 DFF[FILE$PF_EXT_D,THISWORD,31,1,0],	!Extension defaulted
 DFF[FILE$PF_DIR_D,THISWORD,30,1,0],	!Directory defaulted
  DFF[FILE$PF_ALL_D,THISWORD,30,5,0],	!Everything defaulted
 DFF[FILE$FB$DLC,THISWORD,29,1,0],	!Delete file on CLOSE
 !There are some unused bits here
 DFF[FILE$NOWAIT,THISWORD,22,1,0],	!Do not call WAIT
 DFF[FILE$PF_WILDN_A,THISWORD,21,1,0],	!The NODEID may be wildcarded also
 DFF[FILE$PF_WILD_A,THISWORD,20,1,0],	!Wildcards allowed in this fileblock
 DFF[FILE$PF_NODE_A,THISWORD,19,1,0],	!Nodeid permitted (otherwise illegal)
 DFF[FILE$NOSIGNAL,THISWORD,18,1,0],	!Return code instead of signal
  DFF[FILE$PF_NOSIG,%FIELDEXPAND(FILE$NOSIGNAL)],
DFF[FILE$IB,THISWORD,RH],		!Interrupt block for this device[20]
DFF[FILE$WRITES,NEXTWORD,LH],		!Writes to this device for billing
DFF[FILE$READS,THISWORD,RH]		!Reads for billing

TES;

DLIT <FILE_LEN,NEXTWORD>;
	LITERAL FB_LEN=FILE_LEN;	!Already in use this way

!NODE BLOCK (NDB) Format
%(
	The first nn words of the NCB will be the file block for the TSK
device.  Following that is that information about a node that is either
specific to this transmission or so frequently needed that we do not want
to get the NODTBL segment every time we need it.
	These items are as follows:
)%

!OFFSET	FIELD			COMMENTS

FIELD NDB_FIELDS=SET

DFF[NDB$NODEID,THISWORD,WRD],	!NODEID	Copied from NODTBL
DFF[NDB$START_TIME,NEXTWORD,WRD], !Time (UDT) transfer is started
DFF[NDB$CONTO,NEXTWORD,LH],	!CONNECT INITIATE TIMEOUT
DFF[NDB$REPTO,THISWORD,RH],	!CONNECT REPLY TIMEOUT
DFF[NDB$INACTO,NEXTWORD,LH],	!INACTIVITY TIMEOUT
DFF[NDB$REQUE,THISWORD,RH],	!REQUE /AFTER:+nnn IF UNSUCCESSFUL (NBS DTM)
DFF[NDB$FLG,NEXTWORD,WRD],	!FLAGS			Copied from NODTBL
DFF[NDB$RENAME_FB,NEXTWORD,LH],	!File block for rename (remote request only)
DFF[NDB$LOG_FB,%FIELDEXPAND(NDB$RENAME_FB)],	!Log file (local request only)
DFF[NDB$FB,THISWORD,RH],		!File block for local file
DFF[NDB$OPTIONS,NEXTWORD,RH],	!Options from RMCOPY
  DFF[NDB$RMC$O_CODE,THISWORD,0,1,0],	!/LOG switch
   DFF[NDB$RMC$O_LOG,%FIELDEXPAND(NDB$RMC$O_CODE)],
 DFF[NDB$RMC$O_WAIT,THISWORD,1,1,0],	!/WAIT switch
 DFF[NDB$RMC$O_B36,THISWORD,2,1,0],	!/36BIN switch (10-10 image mode)
 DFF[NDB$RMC$O_B11I,THISWORD,3,1,0],	!/16BINIMAGE
  DFF[NDB$RMC$O_B16I,%FIELDEXPAND(NDB$RMC$O_B11I)],
 DFF[NDB$RMC$O_B11P,THISWORD,4,1,0],	!/16BINPACKED
  DFF[NDB$RMC$O_B16P,%FIELDEXPAND(NDB$RMC$O_B11P)],
 DFF[NDB$RMC$O_ASC,THISWORD,5,1,0],	!Ascii stream mode
 DFF[NDB$RMC$O_GO,THISWORD,6,1,0],	!/SUBMIT
  DFF[NDB$RMC$O_SUB,%FIELDEXPAND(NDB$RMC$O_GO)],
 DFF[NDB$RMC$O_RTS,THISWORD,7,1,0],	!/RTS
 DFF[NDB$RMC$O_DE,THISWORD,8,1,0],	!/DELETE (after transfer)
 DFF[NDB$RMC$O_CRP,THISWORD,9,1,0],	!/ENCRYPT
 DFF[NDB$RMC$O_OPR,THISWORD,10,1,0],	!/OPERATOR
 DFF[NDB$RMC$O_SU,THISWORD,11,1,0],	!/SUPERCEDE
 DFF[NDB$RMC$O_APPD,THISWORD,12,1,0],	!/APPEND
 DFF[NDB$RMC$O_SBIT,THISWORD,13,1,0],	!/SIXBIT
 DFF[NDB$RMC$O_CKSM,THISWORD,14,1,0],	!/CHECKSUM
 DFF[NDB$RMC$O_ASCB,THISWORD,15,1,0],	!/AB (ASCII BLOCK)
DFF[NDB$OSTYPE,NEXTWORD,27,8,0],	!Type of remote operating system
DFF[NDB$FILESYS,THISWORD,18,8,0],	!Type of file system (remote)
DFF[NDB$VERNUM,THISWORD,9,8,0],		!DAP version #
DFF[NDB$ECONUM,THISWORD,0,8,0],		!DAP ECO #
DFF[NDB$USRNUM,NEXTWORD,27,8,0],	!User Version of DAP
DFF[NDB$SOFTVER,THISWORD,18,8,0],	!Software version #
DFF[NDB$USRSOFT,THISWORD,9,8,0],	!User software version #
DFF[NDB$GOT,THISWORD,0,9,0],		!Bits for what messages we got so far
 DFF[NDB$GOT_CONNECT,THISWORD,0,1,0],	![7.] Connect succeeded
  DFF[NDB$CONNECTED,%FIELDEXPAND(NDB$GOT_CONNECT)],
 DFF[NDB$GOT_CFG,THISWORD,8,1,0],	!Config
 DFF[NDB$GOT_ATT,THISWORD,7,1,0],	!Attributes
 DFF[NDB$GOT_ACC,THISWORD,6,1,0],	!Access
 DFF[NDB$GOT_CTL,THISWORD,5,1,0],	!Some sort of Control message
 DFF[NDB$GOT_STREAM,THISWORD,4,1,0],	!Stream has been set up
DFF[NDB$SYSCAP,MWORDS(3),WRD],		!SYSCAP field of CONFIG (EX-12)
DFF[NDB$BUFSIZ,NEXTWORD,LH],		!Remote's maximum bufferable message
DFF[NDB$DATATYPE,NEXTWORD,WRD],		!![14](word) from ATTRIBUTES (EX-2)
DFF[NDB$MAXNSP,NEXTWORD,LH],		![14] maximum NSP message size
DFF[NDB$ORG,THISWORD,9,8,0],		!!ORG field of ATTRIBUTES
DFF[NDB$RFM,THISWORD,0,8,0],		!!RFM
DFF[NDB$RAT,NEXTWORD,WRD],		!![14](word) RAT (EX-3)
DFF[NDB$BSZ,THISWORD,0,8,0],		!!BSZ (byte size)
DFF[NDB$BLS,NEXTWORD,LH],		!!Block size
DFF[NDB$MRS,THISWORD,RH],		!!Record size
DFF[NDB$DEV,MWORDS(2),WRD],		!!Device characteristics
DFF[NDB$ACCFUNC,THISWORD,9,8,0],	!!Access function
DFF[NDB$FOP,MWORDS(2),WRD],		!!FOP field of Attributes
DFF[NDB$ACCOPT,MWORDS(2),WRD],		!!Access options EX-5
DFF[NDB$CTLFUNC,THISWORD,9,8,0],	!!!Control function code
DFF[NDB$MLENGTH,THISWORD,0,9,0],	![17] DAP message length
DFF[NDB$FAC,NEXTWORD,WRD],		!![14](word) Access operations EX-3
DFF[NDB$SHR,NEXTWORD,WRD],		!![14](word) Shared operations EX-3
DFF[NDB$MASTER,NEXTWORD,35,1,0],	![15] Did we request this transfer?
DFF[NDB$TIMEDOUT,THISWORD,34,1,0],	!We already timed out!!
DFF[NDB$MFLAGS,THISWORD,18,9,0],	!MFLAGS for most recent msg received
 DFF[NDB$MFLAG_STM,THISWORD,18,1,0],	!STREAMID field was present
 DFF[NDB$MFLAG_LEN,THISWORD,19,1,0],	!Length field was present
DFF[NDB$EQ,THISWORD,RH],		!"NEXTJOB" message that initiated this
DFF[NDB$REQUESTOR,MWORDS(8),WRD],	!Initiator of this request (ASCIZ)
DFF[NDB$REMOTEFILE,MWORDS(26),WRD],	!Remote filespec (ASCIZ)
DFF[NDB$REMRENAME,MWORDS(26),WRD],	!Remote RENAME filespec (ASCIZ)

DFF[NDB$NSPMLENGTH,%FIELDEXPAND(FILE$I_COUNT)]	![17]Byte count of message

TES;
DLIT <NDB_LEN,NEXTWORD>;

MACRO	INOEOR(FB)=(.FB[FILE$I_CBUFF])<34,1>%,
	ONOEOR(FB)=(.FB[FILE$O_CBUFF])<34,1>%;

MACRO CALLI(A,Y)=(BUILTIN MACHSKIP;MACHSKIP(%O'047',A,Y)) %;
MACRO HALTF=CALLI(1,%O'12') %;


MACRO CRLF=%CHAR(%O'15',%O'12') %;
MACRO OUTC(C)=	BEGIN	!Type character at addr C
		BUILTIN MACHOP;
		%IF FTLOG %THEN
			EXTERNAL ROUTINE LOGC;
			LOGC(.(C));		!Write to LOG file
		%FI
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPCHR;
				TYPCHR(.(C))	!C is address of char
				END
			%ELSE	MACHOP(%O'051',1,C)	!OUTCHR UUO
			%FI
		END%;
MACRO OUTC_NOLOG(C)=
		BEGIN	!Type character at addr C
		BUILTIN MACHOP;
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPCHR;
				TYPCHR(.(C))	!C is address of char
				END
			%ELSE	MACHOP(%O'051',1,C)	!OUTCHR UUO
			%FI
		END%;
MACRO TCHR(C)=	!Type character passed as argument (OUTC immediate)
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPCHR;
				%IF FTLOG
				%THEN	BEGIN
					EXTERNAL LOGC;
					LOGC((C))
					END;
				%FI;
				TYPCHR((C))	!C is char
				END
			%ELSE	BEGIN
				LOCAL CH;
				CH=C;
				OUTC(CH)
				END
			%FI %;
MACRO TCHR_NOLOG(C)=	!Type character passed as argument (OUTC immediate)
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPCHR;
				TYPCHR((C))	!C is char
				END
			%ELSE	BEGIN
				LOCAL CH;
				CH=C;
				OUTC_NOLOG(CH)
				END
			%FI %;
MACRO TSTR(S)=	BEGIN	!Type string at address S
		BUILTIN MACHOP;
		%IF FTLOG %THEN
			EXTERNAL ROUTINE LOGS;
			LOGS(S);		!Write to LOG file
		%FI
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPSTR;
				TYPSTR(S);	!S is address of string
				END
			%ELSE	MACHOP(%O'051',3,S)	!OUTSTR UUO
			%FI
		END%;
MACRO TYPE[]=	BEGIN
		BIND TYPE_STRING=(UPLIT(%ASCIZ %STRING(%REMAINING)));
		TSTR(TYPE_STRING)
		END%;
MACRO TSTR_NOLOG(S)=	BEGIN	!Type string at address S
		BUILTIN MACHOP;
		%IF FTDET
			%THEN	BEGIN
				EXTERNAL ROUTINE TYPSTR;
				TYPSTR(S);	!S is address of string
				END
			%ELSE	MACHOP(%O'051',3,S)	!OUTSTR UUO
			%FI
		END%;
MACRO TYPE_NOLOG[]=TSTR_NOLOG(UPLIT(%ASCIZ %STRING(%REMAINING))) %;

MACRO CRASH(STR)=
	BEGIN
	%IF NOT %DECLARED(%NAME('.CRASH'))
	%THEN EXTERNAL ROUTINE %NAME('.CRASH') %FI;
	TYPE(STR,%REMAINING);
	%NAME('.CRASH')();
	END
%;

FIELD INSTR_FIELDS=SET

INSTR$OPCODE=[0,27,9,0],	!Opcode for instruction on PDP-10/20
INSTR$AC=[0,23,4,0],		!AC Field
INSTR$IND=[0,22,1,0],		!Indirect bit
INSTR$INDEX=[0,18,4,0],		!Index register field
INSTR$ADDRESS=[0,0,18,0]	!Direct address field

TES;




MACRO	FILE_BLOCK=BLOCK[FB_LEN] FIELD(FILE_FIELDS) %,
	NDB=BLOCK[NDB_LEN] FIELD(FILE_FIELDS,NDB_FIELDS) %,
	INSTRUCTION=BLOCK[1] FIELD(INSTR_FIELDS) %,
	XWD(A,B)=(((A)^18) OR (B)) %;

LITERAL TTYDESIG=%O'200000';	!Start of TTY UDX's

!MODE and OPEN bit definitions
LITERAL
_IOASC=0,		!ASCII
_IOASL=1,		!ASCII line
_IOBYT=3,		!BYTE mode
_IOIMG=%O'10',		!IMAGE
_IODMP=%O'17';		!DUMP mode

LITERAL
UU_DMR=%O'100000000000',!Disable message re-assembly
UU_AIO=%O'40000000000',	!Non-blocking I/O
UU_NBE=%O'1000000';	!Non-blocking enter

!PSISER NON-IO INTERRUPT CODES
LITERAL
_PCDAT=-%O'21',		!ATTACH/DETACH
	_PCDAT_DETACH=-1;	!It was a detach

!PATH UUO FUNCTION CODES
LITERAL
_PTFRD=-1,		!Read default path
_PTFSD=-2,		!Set default path
_PTFSL=-3,		!Set LIB:
_PTFRL=-4;		!Read LIB:

!
! FILOP FUNCTION CODES
!
LITERAL
_FORED=1,		!Read
_FOCRE=2,		!Non-superceding create
_FOWRT=3,		!Create new file
_FOSAU=4,		!Single-access update
_FOMAU=5,		!Multiple-access update
_FOAPP=6,		!Append
_FOCLS=7,		!Close
_FOURB=%O'10',		!Update RIB (checkpoint the file)
_FOUSI=%O'11',		!USETI
_FOUSO=%O'12',		!USETO
_FORNM=%O'13',		!Rename
_FODLT=%O'14',		!Delete
_FOPRE=%O'15';		!Preallocate

MACRO	OPEN(FB,FUN)=	BEGIN
			EXTR(OPENFILE);
			BIND FILB=FB: FILE_BLOCK;
			FILB[FILE$FUNCTION]=FUN;
			OPENFILE(FILB)
			END%,
	FILOPFUN(FB,FUN)=
			BEGIN
			EXTR(FILOP);
			BIND FILB=FB: FILE_BLOCK;
			FILB[FILE$FUNCTION]=FUN;
			FILOP(FILB)
			END%,
	FILOPFUN_NOBUFF(FB,FUN)=
			BEGIN
			EXTR(FILOP);
			BIND FILB=FB: FILE_BLOCK;
			FILB[FILE$FUNCTION]=FUN;	!Set up function
			FILB[FILE$I_NBUFF]=(FILB[FILE$O_NBUFF]=0); !No buffers needed
			FILOP(FILB)
			END%,

	OPEN_R(FB)=OPEN(FB,_FORED)%,
	OPEN_W(FB)=OPEN(FB,_FOWRT)%,
	OPEN_C(FB)=OPEN(FB,_FOCRE)%,
	OPEN_CRE(FB)=OPEN(FB,_FOCRE)%,
	OPEN_U(FB)=OPEN(FB,_FOSAU)%,
	OPEN_RW(FB)=OPEN(FB,_FOSAU)%,
	OPEN_A(FB)=OPEN(FB,_FOAPP)%,
	OPEN_WNS(FB)=OPEN(FB,_FOCRE)%,
	CLOSE(FB)=FILOPFUN(FB,_FOCLS)%,
	CHECKPOINT(FB)=FILOPFUN(FB,_FOURB)%,
	RENAME(FB)=FILOPFUN_NOBUFF(FB,_FORNM)%,
	DELETE(FB)=FILOPFUN_NOBUFF(FB,_FODLT)%,
	PREALLOCATE(FB)=OPEN(FB,_FOPRE)%;

LITERAL MAX_NXFERS=6;	!Maximum # of simultaneous file transfers

!
! Condition handler stuff
!

LITERAL	SEVERITY_MASK=7;

MACRO	!Macros to define fields in completion codes & condition codes
	SEVERITY=0,3,0%,	!Severity of condition
	STSCODE=0,32,0%,	!Status code
	FACCODE=18,14,0%;	!Facility code

	!These are macros so they can be used without mapping a structure
	!onto whatever is being used
	!i.e. B<SEVERITY>

MACRO ERROR(X)=BEGIN
		%IF FTSIG
		%THEN
		%INFORM('Using old ERROR macro')
		SIGNAL(X
		 %IF NOT %NULL(%REMAINING) %THEN ,%REMAINING %FI)
		%FI;
		RETURN(((X) AND NOT SEVERITY_MASK) OR STS$K_ERROR)
		END%;
MACRO SIGNALE[]=(%INFORM('Using Old macro SIGNALE') SIGNAL(%REMAINING)) %;
MACRO SIGNALW[]=(%INFORM('Using Old macro SIGNALW') SIGNAL(%REMAINING)) %;

MACRO WARNING(X)=BEGIN
		%IF FTSIG
		%THEN
		%INFORM('Using old WARNING macro')
		SIGNAL(X
		 %IF NOT %NULL(%REMAINING) %THEN ,%REMAINING %FI)
		%FI;
		RETURN(((X) AND NOT SEVERITY_MASK) OR STS$K_WARN)
		END%;
MACRO INFORM(X)=BEGIN
		%IF FTSIG
		%THEN
		%INFORM('Using old INFORM macro')
		SIGNAL(X
		 %IF NOT %NULL(%REMAINING) %THEN ,%REMAINING %FI)
		%FI;
		RETURN(((X) AND NOT SEVERITY_MASK) OR STS$K_NORMAL)
		END%;
!ERROR CODES

LITERAL

WIN=1,		!Non-error code
STS$K_NORMAL=1,	!Same as WIN
STS$K_WARN=0,		!Warning
STS$K_ERROR=2,		!Error
STS$K_SEVEREERROR=4;		!Bad error

!Compatability with old literal names
MACRO OLDNAME[A,B]=
	MACRO A=%INFORM('Obsolete symbol ',
		%STRING(%QUOTE %QUOTE %QUOTE %QUOTE A),
		 ' has been replaced by ',
		%STRING(%QUOTE %QUOTE %QUOTE %QUOTE B))
		B %QUOTE % %;


OLDNAME(
SS$_NORMAL,	STS$K_NORMAL,
SS$_WARN,	STS$K_WARN,
SS$_ERROR,	STS$K_ERROR,
SS$_SEVEREERROR,STS$K_SEVEREERROR,

SS$_CONTINUE,	STS$K_CONTINUE,
SS$_RESIGNAL,	STS$K_RESIGNAL
);


MACRO TNUM(NUM,RAD)=
	BEGIN
	EXTR(WRNUM);
	LOCAL STR: VECTOR[CH$ALLOCATION(80)];
	WRNUM(NUM,%IF %NULL(RAD) %THEN 8 %ELSE RAD %FI,CH$PTR(STR));
	TSTR(STR);
	END%;

LITERAL
REQUEST_ABORTED		=	%O'777777',
REQUEST_REQUEUED	=	%O'777776';