;PUPDEF.MAC.10, 31-Mar-82 15:48:46, Edit by SCHOEN
; Add global storage dummy parameters to USEVAR definition
;PUPDEF.MAC;8	3/1/81			Edit by RINDFLEISCH
; Added SAVE/RSTR macros for PUSH/POP and CALL/RET for PUSHJ/POPJ
;PUPDEF.MAC;7	20-Aug-80 13:12:12  Edit by SCHOEN
; Added RUNM UUO for lower-fork runnable PUPFTP
;PUPDEF.MAC;6	11-Jul-80 13:06:53  Edit by SCHOEN
; Added SHXINT, SHXFLG defns for user "!" typeout when not debugging
;PUPDEF.MAC;5	4/23/80		Edit by SCHOEN
; SEARCH SYSDEF so calls to VACCT and GDACC simulations don't fail
; on Tops20
;PUPDEF.MAC;4    4/3/80			EDIT BY RINDFLEISCH
; Added macros to simulate VACCT and GDACC JSYSs
;PUPDEF.MAC;3    25-Mar-80 12:45:08    EDIT BY SCHOEN
; Changed (no)tenex/tops20 opdefs to macro so they work
;PUPDEF.MAC;2    21-Mar-80 12:45:08    EDIT BY SCHOEN
; Define (no)tenex/tops20 macros for conditional assembly
;PUPDEF.MAC;30     2-SEP-79 15:58:49    EDIT BY TAFT
;PUPDEF.MAC;29    11-APR-79 17:31:43    EDIT BY TAFT
; Put Sender property in its right alphabetical sequence, dummy
;PUPDEF.MAC;28    18-MAR-79 19:18:28    EDIT BY TAFT
; Put back Sender property
;PUPDEF.MAC;27    24-MAY-78 18:12:41    EDIT BY TAFT
; Add New-Store mark
;PUPDEF.MAC;26    15-SEP-77 11:19:01    EDIT BY TAFT
; Fix [Mailbox-exception] command to take sub-codes
;PUPDEF.MAC;25     1-SEP-77 15:52:10    EDIT BY TAFT
; Revise property and mark tables for updated Mail Transfer Protocol
;PUPDEF.MAC;24     3-JUN-77 11:04:13    EDIT BY TAFT
; Remove "Sender" and "Distribution" properties
;PUPDEF.MAC;23     2-JUN-77 21:33:43    EDIT BY TAFT
; Add "Size" and "Author" properties
; Add "Rename" command mark
;PUPDEF.MAC;22    15-APR-77 10:03:57    EDIT BY TAFT
; Add SERVF
;PUPDEF.MAC;21    31-MAR-77 20:16:42    EDIT BY TAFT
; Add marks and properties for Mail Transfer Protocol
;PUPDEF.MAC;20    19-MAR-77 20:24:21    EDIT BY TAFT
; Add "delete" mark type
; Add date properties
;PUPDEF.MAC;18    18-MAR-77 17:05:38    EDIT BY TAFT
; Move mark and property definitions here from PFUDEF.MAC.
; Add some common flag bits.
;PUPDEF.MAC;16    10-MAR-77 14:24:40    EDIT BY TAFT
; Divide into two definitions files:
; PUPDEF.MAC contains definitions common to PUPSRV and PUPFTP
; PSVDEF.MAC contains stuff specific to PUPSRV
;PUPDEF.MAC;14    20-OCT-76 13:27:17    EDIT BY TAFT
; Add defs for net directory server
;PUPDEF.MAC;13     2-OCT-76 23:16:30    EDIT BY TAFT
; Add defs for gateway info server
;PUPDEF.MAC;11    30-JUN-76 18:04:45    EDIT BY TAFT
; Revise storage assignment macros
; Add defs for event report server

; Copyright 1979 by Xerox Corporation

	UNIVERSAL PUPDEF -- DEFINITIONS COMMON TO PUPSRV AND PUPFTP
	SUBTTL E. A. Taft / September, 1975

IFNDEF FT10X,

; Standard Accumulator assignments

	F=0		; Flags

	A=1		; General scratch
	B=2
	C=3
	D=4

	P1=10		; Permanent -- saved by callees
	P2=11
	P3=12
	P4=13

	P=17		; Stack


; Flag assignments common to PUPSRV and PUPFTP

DEBUGF==1B0		; In debug mode
ENABLF==1B1		; We are enabled as wheel/operator
SERVF==1B2		; On if we are server, off if user
RUNF==1B3		; PUPFTP running as lower fork option

RAISEF==1B18		; Raise lower-case input
SHXFLG==1B19		; Typed a "!" on a line


; Macros to define conditional assembly for Tops-20/Tenex
; assumes calling program has "SEARCHed SYSDEF"
; ejs, 3/20/80
define tops20,
define notops20,
define tenex,
define notenex,

; Macro to declare storage PC's to be used in a module

DEFINE USEVAR(LSVAR,LSPVAR,GSVAR,GSPVAR) <
	DEFINE LS(LOC,SIZE<1>) <.ASSIGN LOC,LSVAR,SIZE>
	DEFINE LSP(LOC,SIZE<1>) <.ASSIGN LOC,LSPVAR,↑O1000*>
	DEFINE GS(LOC,SIZE<1>) <.ASSIGN LOC,GSVAR,SIZE>
	DEFINE GSP(LOC,SIZE<1>) <.ASSIGN LOC,GSPVAR,↑O1000*>
>

; Definitions needed to append items to a list and then extract
;  them all for assembly in a single place

DEFINE APPEND(DEF,ITEM) <
	DEFINE DEF(XX,MORE) >
>
DEFINE EXPAND(DEF,OP) <
	DEFINE OPMAC(A,ITEM) ,>>
	DEF(OPMAC)
	PURGE OPMAC
>

DEFINE UUO(OP,DISP) <
	UUON==UUON+1
	OPDEF OP [B8]
IFB ,
IFNB ,
>

APPEND(UUOS)	;INIT DISPATCH LIST
UUON==0		;INIT UUO NUMBERS


; UUOs used in PUPSRV and PUPFTP

	UUO PRINT	; Print character specified in eff adr
	UUO UTYPE	; Type message on TTY
	UUO UDTYPE	; Type message on TTY iff debugging
	UUO UWRITE	; Write message on arbitrary designator
	UUO UFTPM	; Send FTP reply message

; UUOs used only in PUPSRV

	UUO ULOG	; Log a message
	UUO UELOG	; Log to both file and TTY

; UUOs used only in PUPFTP

	UUO UERROR	; Type error message, clear input buffer
	UUO UNOISE	; Print noise words if Escape hit
	UUO UPROMP	; Type text and also append to cmd buffer
	UUO URUNM	; Error message to shared page

; Macros to call the above UUOs

DEFINE LOG(STRING) 
DEFINE ELOG(STRING) 
DEFINE TYPE(STRING) 
DEFINE DTYPE(STRING) 
DEFINE NOISE(STRING) 
DEFINE PROMPT(STRING) 
DEFINE ERROR(STRING,NPOP<0>) 
DEFINE WRITE(AC,STRING) <
	IFNB ,
	IFB ,
>
DEFINE FTPM(TYPE,CODE,STRING,NPOP<0>,EOCF) <
	ZZ==,<1>>
	UFTPM [B7+B15+B16++1
		ASCIZ \STRING\]
>
DEFINE RUNM(TYPE,STRING) <
	URUNM [TYPE
	       ASCIZ \STRING\]
>

; MACRO definitions to save and restore lists of locations
DEFINE SAVE(LST)<
   IRP LST,		; Save stuff on stack
>

DEFINE RSTR(LST)<
   IRP LST,		; Recover stuff from stack
>

; OPDEF's for subroutine call/return
OPDEF	CALL [PUSHJ P,]
OPDEF	RET  [POPJ P,]


; FTP-related definitions common to server and user

USRSTL==↑D39		; Maximum name/password/acct string lengths
NAMSTL==↑D<2*39+1+2*39>	; Name.Extension length (with possible ↑Vs)
SFNSTL==USRSTL+2+NAMSTL+7  ; Server-Filename string length

PQUOTE=="'"		; Quote character in property lists
CR==15			; Char defs
LF==12
FF==14
DEL==177
EOL==37			; Tenex EOL character (internal use only)

; Global network numbers (assigned by Jon Postel/ARPA)
NW%CHS==7		; CHAOSNET
NW%ARP==12		; ARPANET
NW%DLN==26		; DIALNET
NW%SUN==44		; SUNET
NW%LCL==:NW%SUN		; Local connected network for PUPSRV

SHXINT==↑d10		; Type a "!" every 10 pages if not debugging

; Property list names and assignments
; Calls are of the form
;	X internal mnemonic , property name , storage
; The internal mnemonic must be 4 characters or less.
; Entries must be sorted alphabetically by property name.
; "Storage" is the maximum number of words needed to store
;  the property (default 1).
; Offsets in a property list are assigned to P.' mnemonic.
; Dispatches to process received properties are PP' mnemonic.

DEFINE PNAMES <
	X AUTH,,USRSTL/5+1
	X BYTE,
	X CNAM,
	X CPSW,,USRSTL/5+1
	X CDAT,
	X DEVI,,USRSTL/5+1
	X DIRE,,USRSTL/5+1
	X EOLC,
	X MLBX,,0
	X NAMB,,NAMSTL/5+1
	X RDAT,
	X SNDR,,USRSTL/5+1
	X SFIL,,SFNSTL/5+1
	X SIZE,
	X TYPE,
	X UACT,,USRSTL/5+2
	X UNAM,
	X UPSW,,USRSTL/5+1
	X VERS,
	X WDAT,
>


; Assign offsets for individual properties in a property list

DEFINE X(SYM,NAME,SIZE<1>) <
	P.'SYM==PLSIZE
	PLSIZE==PLSIZE+SIZE
>
	PLSIZE==0

	PNAMES

; Mark type assignments
; Calls are of the form
;	XN internal mnemonic , mark type , name string , flags
; or	XS internal mnemonic , mark type , name string , flags
; The internal mnemonic must be 4 characters or less.
; Mark type must be octal.  Entries must be in order of Mark type.
; Mark types are assigned to MK' mnemonic.
; Dispatches to process received Marks are C.' mnemonic.
; The XS macro declares the Mark to have sub-codes.

; Flag assignments
;	B0			; Command has subcommands
	NFETCH==1B1		; Do not pre-fetch command text
	OKRETR==1B2		; Command ok during Retrieve
	OKSTOR==1B3		; Command ok during Store

DEFINE MARKS <
	XN RETR, 1,
	XN STOR, 2,
	XS YES,  3,,OKRETR+OKSTOR
	XS NO,   4,,OKRETR+OKSTOR
	XN FILE, 5,,NFETCH+OKSTOR
	XN EOC,  6,,NFETCH+OKRETR+OKSTOR
	XN COMM, 7,,OKRETR+OKSTOR
	XS VERS,10,
	XN NSTO,11,
	XN DIR, 12,
	XN PLST,13,
	XN YUSR,14,
	XN ABOR,15,,OKRETR+OKSTOR
	XN DELE,16,
	XN RENA,17,
	XN SMAI,20,
	XN RMAI,21,
	XN FMAI,22,
	XS MBEX,23,
>


; Assign the Mark type symbols

DEFINE XN(SYM,TYPE,NAME,FLAGS) <
	MK'SYM==TYPE
	NMARKS==NMARKS+1
>
DEFINE XS(SYM,TYPE,NAME,FLAGS) <
	MK'SYM==TYPE
	NMARKS==NMARKS+1
>

	NMARKS==0
	MARKS




	END