Google
 

Trailing-Edge - PDP-10 Archives - bb-jr93i-bb - 7,6/ap020/msunv.x20
There are 4 other files named msunv.x20 in the archive. Click here to see a list.
;This software is furnished under a license and may only be used
;  or copied in accordance with the terms of such license.
;
;Copyright (C) 1979,1980,1981,1982 by Digital Equipment Corporation
;	       1983,1984,1985,1986    Maynard, Massachusetts, USA


	UNIVERSAL MSUNV - Universal file for MS

	.DIRECTIVE FLBLST
	SALL


;MACRO TO DO COPYRIGHT STATEMENT IN .REL FILES

DEFINE CPYRYT,<
	LOC	0
	ASCIZ /
COPYRIGHT (C) BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. 1986
ALL RIGHTS RESERVED.
/
	RELOC>



DEFINE MSINIT,<

   TOPS10<
	IFNDEF .GTLPN,<.GTLPN==-10>	; Original logged-in PPN
	TWOSEG
	RELOC 400000
   >;End TOPS10

   TOPS20<
	.PSECT .HIGH.

BY2PAG==5000			; [JCR]Bytes to a page
WD2PAG==1000

CTCCHN==0			; ^C ON CHAN 0
TMRCHN==5			; TIMER ON CHAN 5

   >

   TOPS10<
BY2PAG==1200			; Bytes to a "page" (TOPS10 disk block)
WD2PAG==200			; Words to a "page" (TOPS10 disk block)
NQBFSZ==200			; Words in disk buffer
   >;End TOPS10

WRDPAG==1000			; [JCR]Words to a page
BY2WRD==5			; [JCR]Bytes to a word

TAKPTN==3*20			; Length of take IFN stack (FOB size, addr, IFN)


; AC's

O=0				; CAUTION -- Clobbered by all GLXLIB stuff!!
A=1				; Temp and JSYS
B=2				; Ditto
C=3				; Ditto
D=4				; Ditto
E=5				; Temp & local to routine
T=6				; Ditto
U=7				; Ditto
V=10				; Ditto - frequently is a character pointer
W=11				; Ditto
L=12				; Byte pointer to list of message numbers
M=13				; Current message if any (message number)
MX=M				; M, when pointing to current msg block
F=14				; Flags
X=15				; Often horizontal cursor position
CX=16				; Used by macros
P=17

IFN <TF>,<PRINTX ?WARNING -- GLXLIB AC conventions have changed - TF>
IFN <A-S1>,<PRINTX ?WARNING -- GLXLIB AC conventions have changed - S1>
IFN <B-S2>,<PRINTX ?WARNING -- GLXLIB AC conventions have changed - S2>

>;End DEFINE MSINIT
 SUBTTL Global symbol definitions

DEFINE QEXT (VAR),<
	IF2<
	IRP VAR,<
	IFDEF VAR,<INTERNAL VAR>
	IFNDEF VAR,<EXTERNAL VAR>
	>
	>
>

DEFINE QEXTN (VAR),<
	IF2<
	IRP VAR,<
	IFNDEF VAR,<EXTERNAL VAR>
	>
	>
>

;Keep these alphabetical

DEFINE GLOBS,<			;; Define global storage and equates
TOPS10<	QEXT <APPBLK> >
	QEXT <CLZTXT,CNCLHD>
;**;[3074][3075] Add EMXGJB in global list	MDR	14-AUG-86
TOPS20<	QEXT <EDFORK,EDTGJB,EMXGJB,EV,EXECFK> >
	QEXT <RESMSQ,SAVMSQ,MSGQLN>
	QEXT <FILCOL>
	QEXT <HDRPAG,HSTHLP>
	QEXT <KWDTBL>
	QEXT <LASTM,LCNT,LHOSTN,LINEW>
	QEXT <LSTCHR,LSTMSG>
	QEXT <MSGIDX,MSGJFN,MSGSEQ,MYDIR,MYDIRS>
	QEXT <MYHDEC,MYHNAM>
	QEXT <NXTMSG,OBPTR,OHSN,OHSPTR,OUTIFN>
	QEXT <REPLIN>
TOPS20<	QEXT <SAVMOD> >
TOPS10<	QEXT <SAVPSZ> >
	QEXT <SVMIFN>
	QEXT <TAKPTR,TCPAG,TOPTRS,TRAILR>
TOPS10<	QEXT <TTYUDX> >
	QEXT <TXTCNT,TXTFPG,TXTMS2,TXTPTR,TXTTOT>
	QEXT <UPDPTR,UPDX>
	QEXT <VERSN.>
>

DEFINE GLOBRS,<			;; Define global routines
	QEXT <DFSQNW,DFSQTH>
	QEXT <FNDHDR,FNDSB1,FNDTO0,FNDTO1>
TOPS20<	QEXT <GETTYM> >
	QEXT <GETUNM>
	QEXTN <KBFTOR>
	QEXT <MOVMID,MOVOPT,MOVSB2,MOVTO,MOVCC>
	QEXT <MOVSUB>
	QEXT <NXTNEW,NXTSEQ>
	QEXT <PRSMS0,PRSMSG,PRTSEQ,PRTSQS>
	QEXTN <R,RSKP>
	QEXT <RDTEXT,RELSEQ>
	QEXT <SPCCHK>
TOPS20<	QEXT <SETTYM> >
	QEXT <STQDL2,STRBUF>
	QEXT <TRANSH>
	QEXT <YESNO>
>
 SUBTTL Storage allocation macros

;Since MACRO and LINK under TOPS10 don't get PSECTs right, klugery is required.

DEFINE IMPUR0,<
   TOPS20<
	.ENDPS
	.PSECT .LOW.
   >;End TOPS20
   TOPS10<
	IFGE .-400000,<RELOC>
   >;End TOPS10
>

DEFINE PURE,<
   TOPS20<
	.ENDPS
	.PSECT .HIGH.
   >;End TOPS20
   TOPS10<
	IFL .-400000,<RELOC>
   >;End TOPS10
>

DEFINE DEFPAG (ADDR,LENGTH) <
   TOPS20<
	.PSECT DATAP
   >
   TOPS10<
	IMPUR0
   >
ADDR:	IFIDN <LENGTH>,<>,<BLOCK 1000>
	IFDIF <LENGTH>,<>,<BLOCK 1000*LENGTH>
   TOPS20<
	TOPPAG==.
	.ENDPS DATAP
   >
   TOPS10<
	PURE
   >
>

OPDEF UTYPE [2B8]
OPDEF UETYPE [3B8]
OPDEF UERR [4B8]
OPDEF CALL [PUSHJ 17,]
OPDEF CALLRET [JRST]
OPDEF RET [POPJ 17,]

DEFINE RETSKP <JRST RSKP>

NPDL==2000			; Size of PDL

F%F1==1B0			; Temporary local flags
F%F2==1B1			;  ..
F%F3==1B2			;  ..
F%AT==1B3			; @ seen in address
F%CC==1B4			; In cc command
F%CMA==1B5			; Type comma except before 1st field
F%LCL==1B6			; Local mail seen
F%ESND==1B7			; EMACS said "send"
F%RSCN==1B8			; Exec level command seen
F%LOGO==1B9			; LOGOUT-ON-EXIT command seen
F%CTLC==1B10			; Control-C seen during expunge
F%RPIN==1B11			; Include me in replies
F%CONC==1B12			; Concise mode
F%RPAL==1B13			; Reply to all (0 = sender only)
F%VBTY==1B14			; Verbose-type (all hdrs) flag
F%NSUM==1B15			; Don't type initial summary line
F%CEOF==1B16			; Lit by caller of RFLDE to force error return
				;  instead of invisible unwinding
F%MX==1B17			; MX queued up some mail for us
;F%NIPC==1B17			; New IPCF mailer exists - OBSOLETE

F%FDIR==1B35			; Force directory lookup (no RCUSR outside <>)
F%REDI==1B34			; REDISTRIBUTE command in progress
F%ARPA==1B33			; ARPA net present
F%MOD== 1B32			; Reading system MAIL.TXT
F%AMOD==1B31			; Auto MOD
F%DECN==1B30			; DECnet present
F%QDEC==1B29			; DECNET mail has been queued
F%QARP==1B28			; ARPANET mail has been queued
F%QXML==1B27			; XMAILR mail has been queued
F%XMLR==1B26			; System has XMAILR/HOSTS2 support
F%XMTO==1B25			; Flag for MOVTO/MOVCC to do XMAILR-style lists
F%HLPT==1B24			; Preface LPT listings with headers of msgs
F%PRSN==1B23			; Show personal name only in headers
F%DNNM==1B22			; Use DECNET node name instead of ARPANET
F%BREF==1B21			; Brief address-lists (don't display elements)
F%SUFX==1B20			; Suffix will be needed at end of this expansion
F%XPIP==1B19			; Expunge in progress
F%JSYS==1B18			; Next call to TXTOUT should do SOUT, not TSOUT
F%ANFX==F%JSYS			; ANF10 net present (precludes JSYSes)
F%UUO==F%XMLR			; Use OUTPUT UUO instead of TSOUT

;Flags2 word bits

F2%NDC==1B0			; set no directory-lookup-confirmation
F2%NSV==1B1			; temporarily suppress save-outgoing-messages
F2%NSQ==1B2			; no sequence message flag

 SUBTTL Message block (MSGxxx) definitions

	PHASE 0			; Define msg block offsets
MSGALL:!BLOCK 1			; Starting byte of message
MSGALN:!BLOCK 1			; Size of whole message
MSGBOD:!BLOCK 1			; Starting byte of message body
MSGBON:!BLOCK 1			; Size of message body
MSGHDN:!BLOCK 1			; Size of header area
MSGDAT:!BLOCK 1			; Date of message
MSGSND:!BLOCK 1			; Starting byte of sender field
MSGSNN:!BLOCK 1			; Size of sender field
MSGFRM:!BLOCK 1			; Starting byte of from field
MSGFRN:!BLOCK 1			; Size of from field
MSGTO:!	BLOCK 1			; Starting byte of to field
MSGTON:!BLOCK 1			; Size of first line of to field
MSGTOK:!BLOCK 1			; Size of entire to field
MSGCC:!	BLOCK 1
MSGCCN:!BLOCK 1
MSGSUB:!BLOCK 1			; Starting byte of subject
MSGSUN:!BLOCK 1			; Size of subject
MSGMID:!BLOCK 1			; Starting byte of message-ID
MSGMIN:!BLOCK 1			; Size of message-ID
MSGREF:!BLOCK 1			; Starting byte of Reference
MSGRFN:!BLOCK 1			; Size of reference
MSGRRR:!BLOCK 1			; Starting byte of return receipt field
MSGRRN:!BLOCK 1			; Size of same
MSGBTS:!BLOCK 1			; Msg bits 0-5 local only
				;	   6-17 file copy
				;	   18-35 dynamic
MSGNUM:!BLOCK 1			; Message number
MSGIDN:!			; Size of a message block
	DEPHASE

M%SEEN==1			; Message has been seen
M%DELE==2			; Message is deleted
M%ATTN==4			; Message wants attention
M%RPLY==10			; Message has been replied to
M%RSNT==4000			; Return receipt has been sent

M%VALI==1B0			; Local bit -- msg info is valid
M%TEMP==1B1			; Temporary marker bit
;Random parameters

MS%ISA==^D5			; Number of times to try again when
				; invalid simul. access occurs (in sec)
ADRWTH==^D57			; Maximum line width for address lists
NTCPAG==10			; Number of pages for To/CC lists
NTCENT==<NTCPAG*1000>/2		; Number of entries per To or CC list
NTRAIL==^D13			; Length of trailer (MUST MATCH definition
				;  of TRAILR in MS.MAC!)
NQID==12345			; ENQ ID magic number for expunge interlock
APPQID==23456			; ENQ ID magic number for append interlock
CJFNLN==20			; Length of COMND JSYS's GTJFN block
MAXTRY==^D25			; Number of tries minus 5 to get MX's PID

;Random bit definitions

RWJFNO==1B0			; The READ/WRITE file is open

;Random macros

DEFINE BP2CHR,<			;; Byte pointer to character pointer
	LDB C,[POINT 6,A,5]
	MOVEI V,1(A)
	IMULI V,5
	IDIVI C,7
	SUBI V,(C)
>

DEFINE CHR2BP,<			;; Character pointer to byte pointer
	MOVE A,V
	ADJBP A,[POINT 7,0]
>

;MACRO TO CALL GTMIND ( GET MESSAGE BLOCK POINTER)

DEFINE GTMBL (REGS,REGD) <
	IF2 <IFNDEF GTMIND, <EXTERNAL GTMIND>>
	PUSH P,F		;SAVE FLAGS
	JSP F,GTMIND		;CALL ROUTINE
	REGS,,REGD
	POP P,F			;RESTORE FLAGS
>
;Flags in command dispatch word

C%GETF==1B0			; Need to have MAIL file for this

;Node block (N-block).  This is the fundamental data structure formed
; from the various node tables.  The RH of each HOSTAB entry points
; to one of these.

	PHASE 0

N.SIZE:!BLOCK 1			; Size, in words, of this block
N.FLGS:!BLOCK 1			; Flag bits
   NT%DCN==1B35			; DECnet host
   NT%ARP==1B34			; ARPAnet host
   NT%ANF==1B33			; ANF10 hot
   NT%LCL==1B32			; this host
   NT%DON==1B31			; mail queued for this host
   NT%SYN==1B30			; This name is a synonym for some other name
   NT%NXL==1B29			; Don't translate this name in message text
   NT%KWL==1B28			; Kawell mail host (VMS, RSX, RSTS)
   NT%NM0==1B27			; Name string is dynamically allocated (ALCSB)
N.NAME:!BLOCK 1			; Address of name string (allocated with ALCSB
				;  iff NT%NM0 is lit, else lives in HOSTS2.BIN)
N.PATH:!BLOCK 1			; Address of path string, or zero
N.REAL:!BLOCK 1			; Address of real name, if NT%SYN is lit
N.SITE:!BLOCK 1			; Address of site table entry, for HOSTS2 hosts
N.UTIL:!BLOCK 1			; Utility word
N.NEXT:!BLOCK 1			; Link to next N-block
   N.LEN==.+1			; Length of an N-block

	DEPHASE

;Flags in LH of to/cc list entries (TCPAG)

AD%PFX==1B0			; This entry is a prefix name for a list
AD%SFX==1B1			; This is a suffix (semicolon) placeholder
AD%PRN==1B2			; This is a personal name
AD%DON==1B3			; This one has been queued (XMAILR only)
AD%DEL==1B4			; [JCR]Network mail delivered by MX

SB.LEN==^D25			; Size of a string block (these are used
				;  for usernames, keywords, header-item names,
				;  alias names, and so forth)
;Header-item definitions

;User-defined header items are maintained in a TBLUK-style table.
; The string (pointed to by LH of table entry) is the name of the
; header-item.  The right half points to an H-block.

;H-block - contains type, flags, and possible data for header-item

HD.SIZ==0		; Size of this H-block
HD.FLG==1		; Flags and type code
	HD%OPT==1B18		; Optional (must use send lvl cmd to include)
	HD%PDF==1B19		; Predefined (wired in)
	HD%RQD==1B20		; Required but not defined (must prompt for it)
	HD%PRS==1B21		; This header-item is present in current msg
	HD%TYP==77B35		; Type code (types defined at GETHDA by HDTYPS macro)
HD.DAT==2		; Data associated with header-item
   HD.LEN==HD.DAT+3

;Alias definitions.  These are maintained in a TBLUK-style table,
; with the data portion pointing at one or more A-blocks linked together.

;A-block format

AB.COD==0		; User no. or code, -1 = net addr, -2 = SYSTEM
AB.FLG==1		; Flag bits
   AB%INV==1B0			; Invisible -- don't show alias in mail
AB.LNK==2		; Link to next A-block
AB.ADR==3		; Text of address in this A-block
   AB.LEN==AB.ADR+1	; Length of A-block


;U-block (TOPS10 only) -- contains structure and PPN for MAIL.TXT

UB.PPN==0		; PPN
UB.STR==1		; Structure
   UB.LEN==2


;T-block - page of message text.  These are linked together and the
; list grows as message text is added.

TB.FOR==0			; Forward link
TB.BAK==1			; Backward link
TB.CNT==2			; Count of bytes in this block
TB.TXT==3			; First word of text

TXTSIZ==<1000-TB.TXT>*5		; Number of bytes in a T-block

;Funny values returned by GETUSR for non-addresses or special addresses

NETCOD==<0,,-1>			; Network address code
SYSCOD==<0,,-2>			; Special system code
PFXCOD==<0,,-3>			; Prefix code (name of address list)
SFXCOD==<0,,-4>			; Suffix code (terminator of address list)
PRNCOD==<0,,-5>			; Personal name code

 SUBTTL Simple macros

DEFINE TYPE (X) <
	UTYPE [ASCIZ \X\]
   >
DEFINE CTYPE (X) <
	UTYPE 10, [ASCIZ \X\]
   >
DEFINE CITYPE (X) <
	UTYPE 1, [ASCIZ \X\]
   >

DEFINE ETYPE (X) <
	UETYPE [ASCIZ \X\]
   >
DEFINE CETYPE (X) <
	UETYPE 10, [ASCIZ \X\]
   >
DEFINE CIETYP (X) <
	UETYPE 1, [ASCIZ \X\]
   >


;AC field decoded as follows:
;10 (1 = ? , 0 = %)
; 4 ERSTR for last error
; 3 Return to user
; 2 Return to EXEC
; 1 User settable return (*** de-implemented ***)
; 0 Cause command error reparse

DEFINE DEFERR (XX,Y) <
	DEFINE XX (Z) <
		IFIDN <Z>,<>,<UERR Y, 0>
		IFDIF <Z>,<>,<UERR Y, [ASCIZ /Z/]>
	   >
   >
DEFERR CWARN,0
DEFERR WARN,3
DEFERR JWARN,7
DEFERR CERR,10
DEFERR JCERR,14
DEFERR CMERR,13
DEFERR JRETER,17
DEFERR FATAL,12
DEFERR JFATAL,16
 SUBTTL COMND helper macros -- stolen from MACSYM because GLXMAC doesn't have 'em

;Macro to add break character to four word break mask (W0., W1., W2., W3.)

DEFINE BRKCH. (%%V,V2)
<
%%FOO==%%V
	BRK0 (%%FOO,V2,0)
>

;Macro to remove character

DEFINE UNBRK. (%%V,V2)
<
%%FOO==%%V
	BRK0 (%%FOO,V2,1)
>

DEFINE BRK0 (%%11,V2,FLAVOR)
<	..V22==%%11
	..V1==%%11
	IFNB <V2>,<..V22==V2>
REPEAT ..V22-<%%11>+1,<	;;BRACKETS AROUND %%11 IN CASE ITS AN EXPRESSION
	%%W==..V1/^D32	;;DECIDE WHICH WORD CHARACTER GOES IN
	%%X==..V1-%%W*^D32	;;CALCULATE BIT POSITION WITHIN WORD
	IFE FLAVOR,BRKC1 \"<%%W+"0">	;;MODIFY CORRECT MASK WORD
	IFN FLAVOR,BRKC2 \"<%%W+"0">
	..V1==..V1+1
		   >
>

DEFINE BRKC1 (ARG1)
<	W'ARG1'.==W'ARG1'.!<1B<%%X>>
>

DEFINE BRKC2 (ARG1)
<	W'ARG1'.==W'ARG1'.&<-1-1B<%%X>>
>

;Macro to initialize 4-word 12-bit character break mask

DEFINE BRINI.(A0<0>,A1<0>,A2<0>,A3<0>)
<
W0.==A0
W1.==A1				;Initialize break mask
W2.==A2
W3.==A3
>

;macro to define a break set

DEFINE BRMSK. (INI0,INI1,INI2,INI3,ALLOW,DISALW)
<	BRINI. INI0,INI1,INI2,INI3	;;SET UP INITIAL MASK
	IRPC ALLOW,<	UNBRK. "ALLOW">	;;DON'T BREAK ON CHARS TO BE ALLOWED IN FIELD
	IRPC DISALW,<	BRKCH. "DISALW">	;;BREAK ON CHARACTERS NOT ALLOWED
	EXP W0.,W1.,W2.,W3.		;;STORE RESULTANT MASK IN MEMORY
>

;Define break masks

	BRINI.			;Initialize break mask for standard field
	BRKCH. (0,37)		;All control characters
	BRKCH. (40,54)		;Space through comma
	BRKCH. (56,57)		;Dot and slash
	BRKCH. (72,77)		;Colon through question mark
	BRKCH. (100)		;Atsign
	BRKCH. (133,140)	;Open bracket through accent grave
	BRKCH. (173,177)	;Close bracket through tilde

FLDB0.==W0.			;Standard field break mask
FLDB1.==W1.
FLDB2.==W2.
FLDB3.==W3.


;Macro to generate function data block -- caller supplies POINTER to help text

    DEFINE FLDDB1 (TYP,FLGS,DATA,HLPM,DEFM,LST) <
	XLIST
	..XX==<FLD(TYP,CM%FNC)>+FLGS+<Z LST>
	IFNB <HLPM>,<..XX==CM%HPP!..XX>
	IFNB <DEFM>,<..XX==CM%DPP!..XX>
	    ..XX
	IFNB <DATA>,<DATA>
	IFB <DATA>,<0>
	IFNB <HLPM>,<HLPM>
	IFB <HLPM>,<IFNB <DEFM>,<0>>
	IFNB <DEFM>,<POINT 7,[ASCIZ \DEFM\]>
	LIST
    >

; Macro to generate function data block -- caller supplies help text

    DEFINE FLDDB. (TYP,FLGS,DATA,HLPM,DEFM,LST) <
	XLIST
	..XX==<FLD(TYP,CM%FNC)>+FLGS+<Z LST>
	IFNB <HLPM>,<..XX==CM%HPP!..XX>
	IFNB <DEFM>,<..XX==CM%DPP!..XX>
	    ..XX
	IFNB <DATA>,<DATA>
	IFB <DATA>,<0>
	IFNB <HLPM>,<POINT 7,[ASCIZ \HLPM\]>
	IFB <HLPM>,<IFNB <DEFM>,<0>>
	IFNB <DEFM>,<POINT 7,[ASCIZ \DEFM\]>
	LIST
    >


;Macro to generate function descriptor block with break mask supplied

DEFINE FLDBK. (TYP,FLGS,DATA,HLPM,DEFM,BRKADR,LST)<
	..XX==<FLD(TYP,CM%FNC)>+FLGS+<Z LST>
   IFNB <HLPM>,<..XX=CM%HPP!..XX>
   IFNB <DEFM>,<..XX=CM%DPP!..XX>
   IFNB <BRKADR>,<..XX=CM%BRK!..XX>
	..XX
   IFNB <DATA>,<DATA>
   IFB <DATA>,<0>
   IFNB <HLPM>,<POINT 7,[ASCIZ HLPM]>
   IFB <HLPM>,<IFNB <DEFM'BRKADR>,<0>>
   IFB <DEFM>,<IFNB <BRKADR>,<0>>
   IFNB <DEFM>,<POINT 7,[ASCIZ \DEFM\]>
   IFNB <BRKADR>,<BRKADR>
   >


DEFINE FLDBK1 (TYP,FLGS,DATA,HLPM,DEFM,BRKADR,LST)<
	..XX==<FLD(TYP,CM%FNC)>+FLGS+<Z LST>
   IFNB <HLPM>,<..XX=CM%HPP!..XX>
   IFNB <DEFM>,<..XX=CM%DPP!..XX>
   IFNB <BRKADR>,<..XX=CM%BRK!..XX>
	..XX
   IFNB <DATA>,<DATA>
   IFB <DATA>,<0>
   IFNB <HLPM>,<HLPM>
   IFB <HLPM>,<IFNB <DEFM'BRKADR>,<0>>
   IFB <DEFM>,<IFNB <BRKADR>,<0>>
   IFNB <DEFM>,<POINT 7,[ASCIZ \DEFM\]>
   IFNB <BRKADR>,<BRKADR>
   >


;Macro to prompt for command

DEFINE PROMPT (MESSAGE) <
	XLIST
	HRROI A,[ASCIZ MESSAGE]
	CALL DPROMPT
	LIST
>

;Macro to print guidewords

DEFINE NOISE (SHT) <
	XLIST
	MOVEI A,[FLDDB. (.CMNOI,,<POINT 7,[ASCIZ /SHT/]>)]
	CALL RFIELD
	LIST
>

;Macro to require confirmation

DEFINE CONFRM <
	XLIST
	MOVEI A,[FLDDB. (.CMCFM)]
	CALL RFIELD
	LIST
>
   REPEAT 0,<
;Macros to make table entry for TBLUK or COMND .CMKEY style table

DEFINE TB (WORD,ADDRES) <
IFB <ADDRES>,<	[ASCIZ /WORD/],,.'WORD>
IFNB <ADDRES>,<	[ASCIZ /WORD/],,ADDRES>
>
   >;End REPEAT 0

DEFINE CMD (X,Y,Z) <
    IFIDN <Z>,<>,<
	IFIDN <Y>,<>,<[ASCIZ \X\],,.'X>
	IFDIF <Y>,<>,<[ASCIZ \X\],,Y>
    >
    IFDIF <Z>,<>,<
	IFIDN <Y>,<>,<[Z
			 ASCIZ \X\],,.'X>
	IFDIF <Y>,<>,<[Z
			 ASCIZ \X\],,Y>
    >
>

DEFINE CMD1 (X,Y,Z) < CMD (X,Y,<CM%FW!Z>) >

DEFINE CMDT (X,Y,Z<0>,FL<0>) <
	IFDIF <Y>,<>,< CMD (X,<[FL!Y]>,<CM%FW!Z>) >
	IFIDN <Y>,<>,< CMD (X,<[FL!.'X]>,<CM%FW!Z>) >
>

;Macro to move entries in message tables down over deleted entries.
; Whenever a message table is added, its name must be added to the
; argument list in the invocation of this macro in the expunge code.

DEFINE MXMOV (AC1,AC2,ZOT) <
	XLIST
    IRP ZOT,<
	GTMBL (M,AC1)
	GTMBL (X,AC2)
	MOVE AC1,MSG'ZOT(AC1)
	MOVEM AC1,MSG'ZOT(AC2)
>
	LIST
>

;Macros to conditionally save/restore message sequence context, based
; on whether or not we're in read mode.

DEFINE SAVMSX  <
	SKIPN REDLVL		;; Read mode?
	JRST .+4
	MOVEM F,SAVF
	JSP F,SAVMSQ		;; Yes, save context
	MOVE F,SAVF
>

DEFINE RESMSX  <
	SKIPN REDLVL		;; Read mode?
	JRST .+4
	MOVEM F,SAVF
	JSP F,RESMSQ		;; Yes, restore stuff
	MOVE F,SAVF
>

 SUBTTL HOSTS2 Definitions

;HOSTS2 is the Stanford/MIT Host table.  It is compiled from text files into
; the format described here.  It allows for multiple networks, multiple
; names for a host, and multiple paths to a host.  XMAILR is a mailer
; which uses HOSTS2.  MS assumes that a system either has XMAILR and
; HOSTS2, or neither.

;The format of the compiled HOSTS2 file is:

HSTSID==0	; wd 0	SIXBIT /HOSTS2/
NAMPTR==10	; wd 10 Address in file of NAME table.
SITPTR==11	; wd 11	Address in file of SITE table.
NETPTR==12	; wd 12 Address in file of NETWORK table.


;NETWORK table
; wd 0	Number of entries in table.
; wd 1	Number of words per entry. (2)

NETNUM==0	; wd 0	network number
NTLNAM==1	; wd 1 LH - address in file of name of network
NTRTAB==1	; wd 1 RH - address in file of network's address table


;ADDRESS table(s)
; wd 0	Number of entries in table.
; wd 1	Number of words per entry. (2)

ADDADR==0	; wd 0	Network address of this entry including network number
ADLSIT==1	; wd 1 LH - address in file of SITE table entry
ADRCDR==1	; wd 1 RH - address in file of next ADDRESS entry for this site
		;	    0 = end of list


;SITE table
; wd 0	Number of entries in table.
; wd 1	Number of words per entry. (3)

STLNAM==0	; wd 0 LH - address in file of official host name
STRADR==0	; wd 0 RH - address in file of first ADDRESS table entry for
		;	    this site.  Successive entries are threaded
		;	    together through ADRCDR.


;NAMES table:
; wd 0	Number of entries
; wd 1	Number of words per entry. (1)

NMLSIT==0	; lh	address in file of SITE table entry for this host.
NMRNAM==0	; rh	address in file of host name


; All names are ASCIZ strings, all letters upper case.
; The strings are stored before, after and between the tables.
; All strings are word-aligned, and fully zero-filled in the last word.


;Network addresses are defined as follows, for purposes of this table:
;    4.9     0
;    4.8-4.1 network number
;    Chaos net (number 7):
;	3.9-2.8	0
;	2.7-1.1 address (2.7-1.9 subnet, 1.8-1.1 host)
;    Arpanet (number 12):	(note, old-format Arpanet addresses
;	3.9-3.8	0	 	never appear in the host table.)
;	3.7-2.1	IMP
;	1.9	0
;	1.8-1.1	Host
;    Dialnet (number 26):
;	3.9-3.1	0
;	2.9-1.1	address in file of ASCIZ string of phone number
 SUBTTL      MS/MX IPCF Message Format

;Format of the message header

	PHASE 0
.PKTYP:!	BLOCK 1		;[JCR]Packet type
	.POST==1		;[JCR]New message packet
	.CONT==2		;[JCR]Old message packet
.PKID:! 	BLOCK 1		;[JCR]Packet i.d.
.PKSEQ:!	BLOCK 1		;[JCR]Packet sequence number
.PKSTS:!	BLOCK 1		;[JCR]Packet status
	.DONE==1		;[JCR]Packet completes the message
	.MORE==2		;[JCR]More packets follow this one
	.STAOK==1		;[JCR]Packet made it O.K. (Sent by MX)
	.STAME==2		;[JCR]MX expects more packets (Sent by MX)
	.STASM==3		;[JCR]Error, some received mail (Sent by MX)
	.STABD==4		;[JCR]Error, no one received mail (Sent by MX)
.PKRCT:!	BLOCK 1		;[JCR]Number of records in this packet
.HDRSZ:!			;[JCR]Length of header

	DEPHASE

;Format of a message record

	PHASE 0

.RECNM:!	BLOCK 1		;[JCR]Record sequence number
.RECTY:!	BLOCK 1		;[JCR]Record type
	.FLSPC==1		;[JCR]Record contains file-spec of message file
	.SENDR==2		;[JCR]Record contains sender of message
	.DESTN==3		;[JCR]Record contains destination string
	.SJSTR==4		;[JCR]Record contains subject line
.RECLN:!	BLOCK 1		;[JCR]Record length
.RECHS:!			;[JCR]Record header size
.RECTX:!	BLOCK 1		;[JCR]First word of the ASCII string
.RECMN:!			;[JCR]Minimum record length

	DEPHASE

MXRCSZ==.RECHS+51		;[JCR]Maximum record length
BUFEND==1000-MXRCSZ		;[JCR]End of message page check
;Clean up the symbol tables

	PURGE ..V22
	PURGE ..V1
	PURGE ..XX
	PURGE %%W
	PURGE %%X
	PURGE %%FOO

	END

; Edit 2450 to MSUNV.MAC by JROSSELL on 30-Sep-85
; Remove symbols PIDGET and PIDNAM. They are no longer needed by MSLCL
; Edit 2462 to MSUNV.MAC by PRATT on 4-Nov-85
; Merge many changes in -10, -20, and common code.
; *** Edit 2465 to MSUNV.MAC by JROSSELL on 5-Nov-85
; Define a subject record value
; *** Edit 2471 to MSUNV.MAC by PRATT on 14-Nov-85
; Changes to break up MS into a smaller module.
; *** Edit 2482 to MSUNV.MAC by PRATT on 20-Nov-85
; Invent F%MX (mail queued up by MX), use it for warm and fuzzy confirmation


; *** Edit 2486 to MSUNV.MAC by PRATT on 22-Nov-85
; Copyright statements
; *** Edit 2634 to MSUNV.MAC by JROSSELL on 10-Jan-86
; Open up a second JFN as READ/WRITE in places where we don't want another
; process writing to the mail file.
; *** Edit 2651 to MSUNV.MAC by SANTEE on 2-Feb-86
; Eliminate the need for MSUTAB at all. Move the few useful lines elsewhere. 
; *** Edit 2683 to MSUNV.MAC by JROSSELL on 18-Mar-86
; Change the way MX's PID is picked up to avoid infinite loops 
; *** Edit 2715 to MSUNV.MAC by RASPUZZI on 6-Jun-86
; Make MS more flexible when encountering "Invalid simultaneous access" on
; MAIL.TXT by trying to open the file 1 time per second for 5 seconds just in
; case MX has the file opened for incoming mail. 
; *** Edit 3074 to MSUNV.MAC by RASPUZZI on 14-Aug-86, for SPR #21351
; Make sure MS gets the right EMACS from EDITOR:
; *** Edit 3075 to MSUNV.MAC by RASPUZZI on 14-Aug-86
; Silly me. I forgot to put in the edit number for 3074. So now there are 2.