perm filename SYM.MS[10X,AIL] blob sn#091951 filedate 1974-03-26 generic text, type T, neo UTF8

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 1,1

******** SYM **** PAGE 1
1)	COMMENT ⊗   VALID 00037 PAGES VERSION 17-1(26)
1)	RECORD PAGE   DESCRIPTION
1)	 00001 00001
1)	 00009 00002	HISTORY
1)	 00016 00003	SUBTTL	SCAN
1)	 00019 00004	BITDATA (SCNWRD -- LISTING CONTROL, ETC.)
1)	 00025 00005	DATA (SCANNER PARSE TOKENS)
1)	 00032 00006	DSCR main SCANNER Dispatch loop
1)	 00037 00007	 ID -- RESET FOR SCAN
1)	 00045 00008	Comment   COMMENT -- throw out everything to next semicolon
1)	 00046 00009	DSCR -- USID
1)	 00053 00010	DSCR -- SCNACT
1)	 00062 00011		PUSH	PNT,PNEXTC-1	STRING NUMBER
1)	 00066 00012	DSCR STRNG, etc.
1)	 00070 00013	COMMENT  
1)	 00073 00014	DEFCHK:
1)	 00084 00015	DSCR SCNUMB -- number scanner
1)	 00091 00016	Comment 
1)	 00093 00017	Comment  Print the last character, then stack the result
1)	 00097 00018	DSCR CSPEC, SEOL, SEOM, SEOB -- Special handling routines
1)	 00101 00019	SUBTTL	Cspec, Seol
1)	 00102 00020	 CALL SPECIAL ROUTINE, BUT FIRST MAKE SURE CHARACTER COUNT IS
1)	 00108 00021	
1)	 00115 00022	 END OF BUFFER CODE.
1)	 00117 00023	Comment  Parameter delimiter or end of message 
1)	 00124 00024	DSCR ADVBUF -- new input buffer routine
1)	 00132 00025	UPDCNT:	HRRM	C,PNAME			UPDATE PNAME
1)	 00134 00026	DSCR --HERE IS THE CREFFINF STUFF (STRANGE PLACE N'EST CE PAS?)
1)	 00141 00027	DSCR HDR, HDROV 
1)	 00149 00028	DSCR ENTERS -- make new symbol entry
1)	 00153 00029	↑ENTERS:	
1)	 00159 00030	 
1)	 00164 00031
1)	 00165 00032	DSCR ADCINS, CREINT, CONINS
1)	 00169 00033	DSCR SHASH, NHASH -- look up symbol entries in hashed buckets.
1)	 00175 00034	SUBTTL	SEMBLK Allocation Routines
1)	 00182 00035	SUBTTL	RNGVRB, RNGSTR, etc. -- `Ring' Linkage Routines
1)	 00185 00036
1)	 00188 00037	SUBTTL  Mark insertion routine for counter routines
1)	 00191 ENDMK
1)	⊗;
*** SYM[S,AIL] *** PAGE 1
2)	COMMENT ⊗   VALID 00037 PAGES VERSION 17-1(24)
2)	RECORD PAGE   DESCRIPTION
2)	 00001 00001
2)	 00005 00002	HISTORY
2)	 00012 00003	SCAN

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 1,1

2)	 00015 00004	BITDATA (SCNWRD -- LISTING CONTROL, ETC.)
2)	 00021 00005	DATA (SCANNER PARSE TOKENS)
2)	 00029 00006	DSCR main SCANNER Dispatch loop
2)	 00034 00007	 ID -- RESET FOR SCAN
2)	 00042 00008	Comment   COMMENT -- throw out everything to next semicolon
2)	 00043 00009	DSCR -- USID
2)	 00050 00010	DSCR -- SCNACT
2)	 00059 00011		PUSH	PNT,PNEXTC-1	STRING NUMBER
2)	 00063 00012	DSCR STRNG, etc.
2)	 00067 00013	 
2)	 00072 00014	DEFCHK:
2)	 00083 00015	DSCR SCNUMB -- number scanner
2)	 00090 00016	Comment 
2)	 00092 00017	Comment  Print the last character, then stack the result
2)	 00096 00018	DSCR CSPEC, SEOL, SEOM, SEOB -- Special handling routines
2)	 00100 00019	Cspec, Seol
2)	 00101 00020	 CALL SPECIAL ROUTINE, BUT FIRST MAKE SURE CHARACTER COUNT IS
2)	 00106 00021	
2)	 00112 00022	 END OF BUFFER CODE.
2)	 00114 00023	Comment  Parameter delimiter or end of message 
2)	 00121 00024	DSCR ADVBUF -- new input buffer routine
2)	 00125 00025	UPDCNT:	HRRM	C,PNAME			UPDATE PNAME
2)	 00127 00026	DSCR --HERE IS THE CREFFINF STUFF (STRANGE PLACE N'EST CE PAS?)
2)	 00133 00027	DSCR HDR, HDROV 
2)	 00138 00028	DSCR ENTERS -- make new symbol entry
2)	 00142 00029	↑ENTERS:	
2)	 00148 00030	 
2)	 00153 00031	
2)	 00154 00032	DSCR ADCINS, CREINT, CONINS
2)	 00158 00033	DSCR SHASH, NHASH -- look up symbol entries in hashed buckets.
2)	 00164 00034	SEMBLK Allocation Routines
2)	 00171 00035	RNGVRB, RNGSTR, etc. -- `Ring' Linkage Routines
2)	 00174 00036	
2)	 00177 00037	 Mark insertion routine for counter routines
2)	 00180 ENDMK
2)	⊗;


******** SYM **** PAGE 2
1)	021  102100000032  ⊗;
1)	COMMENT ⊗
1)	VERSION 17-1(26) 3-17-74 BY RLS INSTALL TENEX
1)	VERSION 17-1(25) 3-17-74 
1)	VERSION 17-1(24) 2-5-74 BY HJS BUG #RA# ALLOW TEXT PAST FINAL END OF PROGRAM 
*** SYM[S,AIL] *** PAGE 2
2)	021  102100000030  ⊗;
2)	COMMENT ⊗
2)	VERSION 17-1(24) 2-5-74 BY HJS BUG #RA# ALLOW TEXT PAST FINAL END OF PROGRAM 

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 2,2



******** SYM **** PAGE 13
1)	   2. Save the length of the string up to the start of the ident.
1)	   3. Scan this (possible) param into the constant, no case conversion.
1)	   4. Save the length of the string up to the end of the ident.
1)	   5. Save state of scanner (char, bits), then return PNEXTC to the
1)	      ident within the string const.  Call DSCAN (ident scanner) to con-
1)	      vert and lookup this identifier (some special bits set to avoid
1)	      stacking results, etc.)
1)	   6. If not a DEFINE parameter, reset TOPBYTE and PNAME pointers to
1)	      their state at the end of step 3, clear space used during DSCAN,
1)	      and return to main string constant loop.
1)	   7. Back TOPBYTE pointer up to the length of step 2, insert '177
1)	      (param marker), followed by param number into string, clear space
*** SYM[S,AIL] *** PAGE 13
2)	   2. Save a pointer to the start of this ident in the string const.
2)	   3. Scan this (possible) param into the constant, no case conversion.
2)	   4. Reset the TOPBYTE pointer, save status, then return PNEXTC to
2)	      point to this ident again.  Call DSCAN (ident scanner) to con-
2)	      vert and lookup this identifier (some special bits set to avoid
2)	      stacking results, etc.)
2)	   5. If not a DEFINE parameter, reset TOPBYTE and PNAME pointers to
2)	      their state at the end of step 3, clear space used during DSCAN,
2)	      and return to main string constant loop.
2)	   6. Back TOPBYTE pointer up to beginning of ident again, insert '177
2)	      (param marker), followed by param number into string, clear space


******** SYM **** PAGE 13
1)	 Substring operations are used to retrieve the relevant byte
1)	 pointers from the saved lengths, and only when they are really
1)	 needed, to avoid the garbage collect problems with multiple
1)	 saved pointers which plagued past implementations, and made
1)	 the multiple string space implementation impossible.
1)	Be warned (again) that the current setup is the result of several
1)	 (+1) killed bugs  --  each  thought to  be the  last.  No
1)	 guarantees are proferred that no more exist, but chances are
1)	 (even) better than ever.
1)	⊗
1)	DEFCHK:
1)		TLNE	A,NUMB		;MUST BE A LETTER
1)		 JRST	 DEPOSIT	; DIGIT OR OTHER NUMBER PART, GO ON
1)		PUSH	P,C	;save length just before scanning ident
1)	RANSCN:	ADDI	C,1		;COUNT FIRST CHAR
*** SYM[S,AIL] *** PAGE 13
2)	During the course of this operation, several things get stored
2)	 (as strings) on the SP stack, to prevent damage over possible

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 13,13

2)	 garbage collects: the string constant so far, pointers to the
2)	 beginning and one past the end of the possible parameter, and
2)	 the input (PNEXTC) pointers (in case they represent a macro
2)	 body, which of course must be collected properly.  There exists
2)	 a problem.  If STRINGC happens, all these  pointers  must  be
2)	 moved together, so that they still point inside the same string.
2)	 STRINGC,  remember, when  working  for SAIL, adjusts each new 
2)	 string to the start of a new word--catastrophic in this case.
2)	 To solve this, we convince each pointer  saved  that it  is a
2)	 (non-null)  string  which is a substring of a string which is
2)	 guaranteed to contain all the others.  Since in some cases we
2)	 save a pointer one past the last real char scanned, there are
2)	 places in the code below where the string count of PNAME (and
2)	 saved  representations)  is incremented to include this char.
2)	 This is also the reason for the one character  long  invented
2)	 strings ([XWD 40,1] constructs). In one mystical case, below,
2)	 a  PNAME, PNAME+1 pair is saved solely for the reason that it
2)	 is the only string containing all others -- it is thrown away
2)	 after the last possible STRINGC,  and the  count  re-computed
2)	 from other data.
2)	Be warned that the current setup is the result of several killed
2)	 bugs  --  each  thought to  be the  last.  No guarantees  are
2)	 proferred that no more exist, but chances are better than ever.
2)	⊗
2)	DEFCHK:
2)		HRRM	C,PNAME		;MAKE COUNT HONEST BEFORE SAVING
2)		TLNE	A,NUMB		;MUST BE A LETTER
2)		 JRST	 DEPOSIT	; DIGIT OR OTHER NUMBER PART, GO ON
2)		EXCH	SP,STPSAV	;SAVE PNAME
2)		MOVSS	POVTAB+6	;SET PDLOV FOR STRING STACK
2)		AOS	PNAME		;INCREMENT TO INCLUDE 1ST IDENT CHAR(SEE ABOVE)
2)	;;#PZ#(1 OF 3) DCS SAID DELETE THE NEXT INSTR.
2)	;;	ADDI	C,1		;TO CARRY XTRA CHAR THROUGH FURTHER STEPS
2)		PUSH	SP,PNAME	; BECAUSE DSCAN IS GOING TO CHANGE
2)		PUSH	SP,PNAME+1	; IT
2)		PUSH	SP,[XWD 40,1]   ;PROTECT 1ST CHAR PTR OVER GC (SEE ABOVE)
2)		PUSH	SP,TOPBYTE(USER);SAVE LOC OF BEGINNING OF IDENT
2)		EXCH	SP,STPSAV	;PUT BACK FOR NONCE
2)		MOVSS	POVTAB+6	;RE-ENABLE TRAP FOR PARSE STACKS
2)	RANSCN:	ADDI	C,1		;COUNT FIRST CHAR


******** SYM **** PAGE 14
1)		SKIPN	REQDLM		; SPECIAL DELIMITER MODE
1)		JRST 	CHKCON		; NO
1)		CAMN	B,CURMED	; MACRO BODY END DELIMITER
1)		JRST	MBEDCK		; YES
1)		CAMN	B,CURMBG	; MACRO BODY BEGIN DELIMITER

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 14,14

1)		AOS	BNSTCN		; YES, INCREMENT NEST COUNT
1)		JRST	CHKCON		; CONTINUE ID SCAN
1)	MBEDCK:	SOSL 	BNSTCN		; DONE WITH MACRO BODY
1)	CHKCON:	 AOJA	 C,RANSC1-1(TBITS2) ; COUNT AND LOOP
*** SYM[S,AIL] *** PAGE 14
2)		SKIPN	REQDLM		; SPECIAL DELIMITER MODE?
2)		JRST 	CHKCON		; NO
2)		CAMN	B,CURMED	; MACRO BODY END DELIMITER?
2)		JRST	MBEDCK		; YES
2)		CAMN	B,CURMBG	; MACRO BODY BEGIN DELIMITER?
2)		AOS	BNSTCN		; YES, INCREMENT NEST COUNT
2)		JRST	CHKCON		; CONTINUE ID SCAN
2)	MBEDCK:	SOSL 	BNSTCN		; DONE WITH MACRO BODY?
2)	CHKCON:	 AOJA	 C,RANSC1-1(TBITS2) ; COUNT AND LOOP


******** SYM **** PAGE 14
1)		PUSH	P,A		;SAVE BITS,
*** SYM[S,AIL] *** PAGE 14
2)	;;#PZ# RHT -- (2 OF 3) DCS SAID TO REPLACE THE COMMENTED OUT CODE
2)	;;	HRRM	C,PNAME		;UPDATE CHAR COUNT IN STRING DSCRPTR
2)	;;	SUBI	C,1		; MAINTAIN XTRA CHAR IN PNAME
2)	;;	PUSH	P,A		;SAVE BITS AND
2)	;;	PUSH	P,B		; CHAR AND
2)	;;	PUSH	P,C		; COUNT
2)		PUSH	P,A		;SAVE BITS,


******** SYM **** PAGE 14
1)		HRRM	C,PNAME		; END POINTER OVER GC
1)	; P stack is:
1)	;  -3 -- length before ident scanned into string const
1)	;  -2 -- bits for char after ident.
1)	;  -1 -- char after ident.
1)	;   0 -- length after ident scanned into string const
1)		HRRZ	TBITS,-3(P);use length(id)+5 for string space need
1)		SUBM	C,TBITS	
1)		PUSH	P,TBITS	;save id length for remchr update
1)		ADDI	TBITS,5		;WILL MOVE OUT TO AVOID A PROBLEM
1)	COLNEC:	PUSHJ	P,SGCOL2	;COLLECT IF NECESSARY
1)	; Developing string constant is now at the end of the current
1)	;  string space, with room beyond for the identifier scan.
1)	; P Stack as before, with ident length added to top
1)		AOS	TOPBYTE(USER)	;IDPB-ILDB GETS INTO LOOP IN DSCAN IF NOT
1)		EXCH	SP,STPSAV	;save string constant state in preparation for
1)		MOVSS	POVTAB+6	; identifier rescan (as identifier)
1)		PUSH	SP,PNEXTC-1	;Save Scanner input state, and PNAME
1)		PUSH	SP,PNEXTC	; (string constant) state.

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 14,14

1)		PUSH	SP,PNAME
1)		PUSH	SP,PNAME+1
1)		PUSH	SP,PNAME	;Now retrieve (possibly moved) bp to beginning
1)		PUSH	SP,PNAME+1	; of potential formal name in constant
1)		PUSH	P,[1]	;PNAME[<before id length> for 1]
1)		PUSH	P,-5(P)
1)		JSP	B,SBSTR
1)		POP	SP,TEMP	;resultant bp
1)		SUB	SP,X11
1)		MOVSS	POVTAB+6
1)		EXCH	SP,STPSAV
1)		ILDB	B,TEMP		;SET UP FOR SCANNER
*** SYM[S,AIL] *** PAGE 14
2)		ADDI	C,1		;MAKE PNAME LOOK ONE LONGET TO PROTECT
2)		HRRM	C,PNAME		; END POINTER OVER GC
2)	;;#PZ#
2)		EXCH	SP,STPSAV	;GET STRING STACK BACK
2)		MOVSS	POVTAB+6	;ENABLE FOR STRING STACK OV
2)		PUSH	SP,[XWD 40,1]	;PROTECT PTR OVER STRINGC(SEE ABOVE)
2)		PUSH	SP,TOPBYTE(USER) ;END OF ID
2)		PUSH	SP,PNEXTC-1	;CURRENT INPUT POSITION
2)		PUSH	SP,PNEXTC
2)		HRRZ	TBITS,-7(SP)	;ORIGINAL COUNT
2)		PUSH	SP,PNAME	;THIS IS ONLY STRING GUARANTEED
2)		PUSH	SP,PNAME+1	; TO CONTAIN ALL OTHERS
2)		EXCH	SP,STPSAV
2)		MOVSS	POVTAB+6	;ENABLE FOR PARSE STACK OV
2)		SUBM	C,TBITS		;LENGTH OF ID (`C' NOW CORRECT, SEE ABOVE)
2)	;;#PZ# (3 OF 3) ! USED TO BE A 5
2)		ADDI	TBITS,4		;WILL MOVE OUT TO AVOID A PROBLEM
2)	COLNEC:	PUSHJ	P,SGCOL2	;COLLECT IF NECESSARY
2)		AOS	TOPBYTE(USER)	;IDPB-ILDB GETS INTO LOOP IN DSCAN IF NOT
2)		MOVE	TEMP,STPSAV	;NOW GET PTR TO BEGIN OF ID (PERHAPS LOWER CASE)
2)		MOVE	TEMP,-6(TEMP)	;ILDB GETS ID'S FIRST CHAR
2)		ILDB	B,TEMP		;SET UP FOR SCANNER


******** SYM **** PAGE 14
1)		POP	P,TEMP	;fix up REMCHR using saved ident length
1)		MOVNS	TEMP
1)		ADDM	TEMP,REMCHR(USER)
1)		EXCH	SP,STPSAV	;PUT THE SCANNER LOCATION BACK
1)		POP	SP,PNAME+1	;Restore string constant descriptor
1)		POP	SP,PNAME
1)		ADD	SP,X22	;Then use to get one or other pointer back (below)
1)		PUSH	P,[1]	;Whichever SUBSR is called, it will be [x for 1]
1)	TSTPRM:	SKIPG	LPSA,NEWSYM	;THESE TESTS DETERMINE IF 
*** SYM[S,AIL] *** PAGE 14

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 14,14

2)					;THIS MAY CALL STRINGC -- BUT ALL-ENCOMPASSING
2)					;PNAME ENTRY IS IN THE SP STACK, SO OK
2)		POP	P,C		;GET COUNT BACK (IT'S CORRECT)
2)		POP	P,B		;GET ID BREAK CHAR BACK
2)		POP	P,A		;GET ID BREAK CHAR BITS BACK
2)		EXCH	SP,STPSAV	;PUT THE SCANNER LOCATION BACK
2)		SUB	SP,X22		;REMOVE ENCOMPASSING PNAME ENTRY (SEE DESCR)
2)		POP	SP,PNEXTC
2)		POP	SP,PNEXTC-1
2)	TSTPRM:	SKIPG	LPSA,NEWSYM	;THESE TESTS DETERMINE IF 


******** SYM **** PAGE 14
1)		PUSH	P,-4(P)	;We found a param -- retrieve bp to beginning of
1)		JSP	B,SBSTR	; original param name, clear string space to end
1)		MOVE	TEMP,(SP)	; of space which DSCAN used
1)		PUSHJ	P,CLREST
1)		POP	SP,C		;Now replace param name with 177, param #
1)		MOVEI	TEMP,177	;(other word of SUBSR result removed at DN below)
1)		IDPB	TEMP,C
*** SYM[S,AIL] *** PAGE 14
2)		MOVE	TEMP,-2(SP)	;IN OTHER WORDS, WE FOUND A PARAM
2)		MOVEI	C,0		; BP OF START OF ID IN TEMP
2)	LINLUP:	TLNN	TEMP,760000	;ZERO REST OF FIRST WORD TO BE AFFECTED
2)		 JRST	 OKL
2)		IDPB	C,TEMP
2)		JRST	LINLUP
2)	OKL:	HRLI	TEMP,1(TEMP)	;ZERO REST OF ORIGINAL SCAN, ALL OF DSCAN
2)		HRRI	TEMP,2(TEMP)	; SCAN
2)		SETZM	-1(TEMP)	
2)		BLT	TEMP,@TOPBYTE(USER)
2)		SUB	SP,X44		;REMOVE PTR TO FIRST, PTR TO LAST OF ORIG ID SCAN
2)		MOVE	C,2(SP)		;PTR TO FIRST, WILL BECOME TOPBYTE
2)		MOVEI	TEMP,177	;MARK PARAM OCCURRENCE
2)		IDPB	TEMP,C


******** SYM **** PAGE 14
1)		MOVEM	C,TOPBYTE(USER)	;update end of space
1)		AOS	C,-3(P)	;length before id scan, +2 for param spec,
1)		AOJA	C,DN		; yields proper current string const. length
1)	NOPAR:
1)		PUSH	P,-1(P)	;Was not param, retain (apparent) ident in string,
1)		JSP	B,SBSTR	; by retrieving bp to end of original scan,
1)		MOVE	TEMP,(SP)	; clearing space to end of DSCAN scan,
1)		PUSHJ	P,CLREST	; then restoring TOPBYTE to continue macro body
1)		POP	SP,TOPBYTE(USER)	; scan
1)		HRRZ	C,(P)	;Restore length after ident scan

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 14,14

1)	DN:	TLZE	TBITS2,BACKON	;TURN LISTING BACK ON
1)		TRZ	TBITS2,NOLIST	;YES
1)		SUB	P,X11	;Toss end of ident length
1)		POP	P,B	;ident terminator
1)		POP	P,A	;bits for that terminator
1)		SUB	P,X11	;Beginning of ident length
1)		SUB	SP,X11	;count word from whichever subsr was done
1)		POP	SP,PNEXTC	;Finally, restore Scanner input
1)		POP	SP,PNEXTC-1
1)		EXCH	SP,STPSAV	;ONE MORE TIME
*** SYM[S,AIL] *** PAGE 14
2)		MOVEM	C,TOPBYTE(USER) ;WHAT DID I TELL YOU?
2)		HRRZ	C,-1(SP)	;ORIGINAL LENGTH (+1)
2)		AOJA	C,DN		; +2 FOR MARKER, -1 TO REMOVE XTRA CHR
2)	NOPAR:	AOS	TEMP,PNAME+1	;CLEAR FROM END OF ORIGINAL SCAN
2)		HRLI	TEMP,-1(TEMP)	;TO END OF DSCAN SCAN
2)		SETZM	-1(TEMP)
2)		BLT	TEMP,@TOPBYTE(USER)
2)		POP	SP,TOPBYTE(USER);SAVE ORIGINAL SCAN
2)		SUB	SP,X33		;FORGET OTHER POINTER
2)	; C IS THE VALUE PRIOR TO THE DSCAN IF NOPAR
2)	DN:	TLZE	TBITS2,BACKON	;TURN LISTING BACK ON?
2)		TRZ	TBITS2,NOLIST	;YES
2)		POP	SP,PNAME+1	;NOW RESTORE THESE
2)		POP	SP,PNAME
2)		EXCH	SP,STPSAV	;ONE MORE TIME


******** SYM **** PAGE 14
1)	CLREST:	MOVEI	C,0		; BP OF START OF ID IN TEMP
1)	LINLUP:	CAMN	TEMP,TOPBYTE(USER) ;clear space from temp's bp to
1)		POPJ	P,		;current top
1)		IDPB	C,TEMP
1)		JRST	LINLUP
1)	SBSTR:	AOS	(P)		;ADAPT TO SAIL CONVENTIONS
1)		MOVE	C,LPSA		;SAVE
1)	EXTERN	SUBSR
1)		PUSHJ	P,SUBSR
1)		MOVE	LPSA,C		;RESTORE
1)		MOVE	USER,GOGTAB
1)		JRST	(B)
1)	Comment ⊗
*** SYM[S,AIL] *** PAGE 14
2)	Comment ⊗


******** SYM **** PAGE 20
1)	NOTENX <

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 20,20

1)	NLNO:	MOVE	TBITS,LSTPNT	;LST OUTPUT  BYTE POINTER
*** SYM[S,AIL] *** PAGE 20
2)	NLNO:	MOVE	TBITS,LSTPNT	;LST OUTPUT  BYTE POINTER


******** SYM **** PAGE 20
1)	>;NOTENX
1)	TENX<
1)		PUSH	P,C
1)		PUSH	P,B
1)		HRRZ	2,LPNT
1)		HRRZ	3,LSTBUF
1)		SUBI	3,1(2)		;-#WRDS, INCLUDING CURRENT WORD
1)		IMULI	3,5		;-#CHRS, INCL. EXTRAS IN CURRENT WRD
1)		SKIPA	2,LPNT
1)		IBP	2
1)		TLNE	2,760000	;LAST CHAR IN WORD COUNTED?
1)		 AOJA	3,.-2		;UN-COUNT AN EXTRA CHAR
1)		EXCH	1,LISJFN
1)		HRRO	2,LSTBUF
1)		JSYS	SOUT
1)		EXCH	1,LISJFN
1)		HRRZ	3,LSTBUF	;NOW ZERO LSTBUF, JUST IN CASE.
1)		SETZM	(3)
1)		HRLI	3,(3)
1)		ADDI	3,1
1)		BLT	3,(2)
1)		POP	P,B
1)		POP	P,C
1)	>;TENX
1)		HRRO	TEMP,LSTBUF	;ADDR OF FIRST WORD OF BUFFER
*** SYM[S,AIL] *** PAGE 20
2)		HRRO	TEMP,LSTBUF	;ADDR OF FIRST WORD OF BUFFER


******** SYM **** PAGE 21
1)	NXTSRC:
1)	NOTENX <
1)		MOVE	A,AVLSRC		;BITS TELLING FREE CHANNELS
1)		JFFO	A,GOTNEW		;FOUND A FREE ONE
*** SYM[S,AIL] *** PAGE 21
2)	NXTSRC:	MOVE	A,AVLSRC		;BITS TELLING FREE CHANNELS
2)		JFFO	A,GOTNEW		;FOUND A FREE ONE


******** SYM **** PAGE 21
1)	>;NOTENX
1)	TENX <

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 21,21

1)		MOVEI 	C,ENDSRC-BGNSWA+1	;SIZE OF SAVE AREA
1)	>;TENX
1)		PUSHJ	P,CORGET		;GET ONE
*** SYM[S,AIL] *** PAGE 21
2)		PUSHJ	P,CORGET		;GET ONE


******** SYM **** PAGE 21
1)	NOTENX <
1)		HRLI	TEMP,SRCCDB
1)		BLT	TEMP,ENDSRC-SRCCDB(B)
1)	>;NOTENX
1)	TENX <
1)		HRLI	TEMP,BGNSWA
1)		BLT	TEMP,ENDSRC-BGNSWA(B)
1)	>;TENX
1)		HRRZM	B,SWTLNK		;SAVE PTR TO SAVE AREA
*** SYM[S,AIL] *** PAGE 21
2)		HRLI	TEMP,SRCCDB
2)		BLT	TEMP,ENDSRC-SRCCDB(B)
2)		HRRZM	B,SWTLNK		;SAVE PTR TO SAVE AREA


******** SYM **** PAGE 21
1)		SETZM	LSTCHR			;ALWAYS DO IT
1)		SETZM	SAVCHR
1)	NOTENX <
1)		SETZM	SAVTYI
1)		SETZM	EOF
1)		SETZM	EOL
1)		POP	P,A			;CHANNEL NUMBER
*** SYM[S,AIL] *** PAGE 21
2)	FOR II IN (LSTCHR,SAVCHR,SAVTYI,EOF,EOL) <
2)		SETZM	II
2)	>
2)		POP	P,A			;CHANNEL NUMBER


******** SYM **** PAGE 21
1)		SETOM	TYICORE			;WILL SCAN FROM STRING
1)	>;NOTENX
1)		AOS	TEMP,LININD		;HOW FAR IN TO SPACE ON TTY
*** SYM[S,AIL] *** PAGE 21
2)		AOS	TEMP,LININD		;HOW FAR IN TO SPACE ON TTY


******** SYM **** PAGE 21
1)		MOVE	TEMP,GENLEF+2

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 21,21

*** SYM[S,AIL] *** PAGE 21
2)		SETOM	TYICORE			;WILL SCAN FROM STRING
2)		MOVE	TEMP,GENLEF+2


******** SYM **** PAGE 24
1)	NOTENX <
1)	ADVBUF:	
*** SYM[S,AIL] *** PAGE 24
2)	ADVBUF:	


******** SYM **** PAGE 24
1)	>;NOTENX
1)	TENX <
1)	ADVBUF:	PUSH	P,1
1)		PUSH	P,2
1)		PUSH	P,3
1)		SKIPE	TTYSRC		;CONTROLLING TERMINAL SOURCE DEVICE?
1)		  JRST	ADVTTY		;YES
1)		HRRZ	1,SRCJFN
1)		JSYS	GTSTS
1)		TLNE	2,1000		;EOF?
1)		 JRST	ENDFL		;YES
1)		HRR	2,SRCPNT
1)		ADDI	2,1		;SRCPNT IS A 7-BIT POINTER THAT IS A WORD EARLY
1)		HRLI	2,444400	;36-BIT POINTER.
1)		MOVNI	3,SRCBSZ	;SIZE OF SRC BUF IN WRDS, MINUS EOB NULL
1)		JSYS	SIN		;SRCJFN OPEN FOR 36BIT INPUT
1)		SETZM	1(2)		;EOB NULL.
1)	ADVDUN:	PUSHJ	P,SGCHK
1)		POP	P,3
1)		POP	P,2
1)		POP	P,1
1)		MOVE	PNT,SRCPNT	;RESET PNT TO CURRENT BP,
1)		MOVEM	PNT,PNEXTC	;FIX THIS GUY TOO.
1)		MOVE	TEMP,1(PNT)	;GET THE FIRST WORD IN TEMP
1)		POPJ	P,
1)	; CHECK FOR STRING SPACE FULL, GC IF SO
1)	SGCHK:
1)		MOVEI	TBITS,SRCBSZ*5	;TENEX BUFFER SIZE
1)		MOVE	TEMP,REMCHR(USER)	;REMAINING CHARS
1)		ADD 	TEMP,TBITS
1)		SKIPL	TEMP			;ENOUGH?
1)		   JRST	SGCOL		;NOT ENUF STRNG SPACE FOR A FULL BUFFER
1)		POPJ	P,		;NOW THERE IS
1)	DSCR ADVTTY
1)		Since the boys at BBN have seen fit to not provide a standard

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 24,24

1)	line editor into their system, we must resort to using some runtimes
1)	to handle input in the case that the source is a TTY.  We confine the
1)	problem to the case that the source is the controlling teletype, as
1)	indicated by the SRCTTY (set in CC), and use INTTY.  INTTY at IMSSS
1)	uses the IMSSS PSTIN jsys, otherwise a simulation of same.
1)	⊗;
1)	ADVTTY:
1)	EXTERNAL .SKIP.
1)	EXTERNAL INTTY
1)		EXCH	SP,STPSAV
1)		PUSHJ	P,INTTY		;GET A STRING USING THE PSTIN JSYS
1)		POP	SP,A		;BYTE POINTER
1)		POP	SP,C		;XWD -1, LENGTH -- STACKS ARE NOW OK
1)		EXCH	SP,STPSAV
1)		MOVE	B,.SKIP.
1)		CAIN	B,32		;CONTROL-Z TO INDIATE EOF
1)		  JRST	ENDFL		;YES END OF FILE
1)		MOVE	B,SRCPNT
1)		HRRZ	C,C	
1)		MOVNS	C		;NUMBER OF CHARS TO TRANSFER
1)		JSYS	SIN		;USE SIN TO TRANSFER STRING
1)		MOVEI	C,15
1)		IDPB	C,B
1)		MOVEI	C,12
1)		IDPB	C,B
1)		SETZ	C,
1)		REPEAT 5, <IDPB	C,B>	;PUT NULLS THERE
1)		SETZM	(B)		;BE SURE TO INDICATE EOF
1)		SETZM	1(B)		
1)		JRST	ADVDUN		;AND FINISH UP, ABOVE
1)	ENDFL:
1)		HRRZ	A,SRCJFN
1)		JSYS	CLOSF
1)		  JFCL
1)		HRRZ	A,SRCJFN
1)		JSYS	RLJFN
1)		  JFCL
1)		POP	P,3
1)		POP	P,2
1)		POP	P,1
1)	>;TENX
1)	ENDSWT:	MOVEM	TBITS2,SCNWRD	;UPDATE IN CORE VERSION
*** SYM[S,AIL] *** PAGE 24
2)	ENDSWT:	MOVEM	TBITS2,SCNWRD	;UPDATE IN CORE VERSION


******** SYM **** PAGE 25
1)		MOVSS	POVTAB+6	;calling seq. to .SONTP may oflow

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 25,26

1)		PUSH	P,TBITS		;PASS TO STRGC THIS WAY
*** SYM[S,AIL] *** PAGE 26
2)		PUSH	P,TBITS		;PASS TO STRGC THIS WAY


******** SYM **** PAGE 25
1)		MOVSS	POVTAB+6
1)		POPJ	P,		; NO, GO AHEAD
1)	NOTENX <
1)	?CHROUT: SOSG	LSTCNT		;ONE CHAR OUTPUT ROUTINE
*** SYM[S,AIL] *** PAGE 26
2)		POPJ	P,		; NO, GO AHEAD
2)	?CHROUT: SOSG	LSTCNT		;ONE CHAR OUTPUT ROUTINE


******** SYM **** PAGE 25
1)	>;NOTENX
1)	TENX <
1)	?CHROUT: EXCH	TBITS,2
1)		EXCH	1,LISJFN
1)		JSYS	BOUT
1)		EXCH	1,LISJFN
1)		EXCH	TBITS,2
1)		POPJ	P,
1)	>;TENX
1)	DSCR --HERE IS THE CREFFINF STUFF (STRANGE PLACE N'EST CE PAS?)
*** SYM[S,AIL] *** PAGE 26
2)	DSCR --HERE IS THE CREFFINF STUFF (STRANGE PLACE N'EST CE PAS?)


******** SYM **** PAGE 26
1)	NOTENX <
1)	GONEF:	SOSG	LSTCNT
*** SYM[S,AIL] *** PAGE 26
2)	GONEF:	SOSG	LSTCNT


******** SYM **** PAGE 26
1)	>;NOTENX
1)	TENX <
1)	GONEF:	EXCH	1,2
1)		EXCH	1,LISJFN
1)		JSYS	BOUT
1)		EXCH	1,LISJFN
1)		EXCH	1,2
1)		POPJ	P,
1)	>;TENX
1)	↑↑CREFASC:			;CREF THE ASCII FOR A SYMBOL.

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 26,26

*** SYM[S,AIL] *** PAGE 26
2)	↑↑CREFASC:			;CREF THE ASCII FOR A SYMBOL.


******** SYM **** PAGE 27
1)	NOTENX<
1)	↑HDR:	
*** SYM[S,AIL] *** PAGE 27
2)	↑HDR:	


******** SYM **** PAGE 27
1)	>;NOTENX
1)	TENX<
1)	↑HDR:	
1)		AOS	PAGENO		;NEXT PAGE, PLEASE
1)		AOS	FPAGNO		;NEXT IN THIS FILE
1)		SETZM	PAGINC		;FIRST PHYSICAL PAGE NO
1)		SETZM	BINLIN		;SEQUENTIAL LINE #
1)		AOS	BINLIN		;ALWAYS STARTS AT 1
1)	;;#HU# 6-20-72 DCS BETTER TTY LISTING
1)		SKIPN	CRIND		;NEED CRLF/INDENT?
1)		 JRST	 NCRIND		;NO
1)		SETZM	CRIND
1)		TERPRI
1)		MOVE	TEMP,LININD
1)		PUUO	3,INDTAB(TEMP)	;CRLF -- INDENT
1)	NCRIND:	PRINT	< >
1)		DECPNT	FPAGNO		;JUST KEEP TRACK
1)	↑HDROV:	
1)		SETZM	LINNUM
1)		AOS	PAGINC		;HERE WHEN LINES OVERFLOW PAGE
1)		TLNN	FF,LISTNG	;ARE WE LISTING?
1)		 POPJ	 P,		; NO
1)		PUSH	P,D		;SAVE
1)		SETZM	BKR		;LET NULL BREAK ON TENEX
1)		SKIPG	LISJFN		;SHOULD SKIP IF LISTING
1)		  JRST	NOHDR
1)		PUSH	P,A
1)		PUSH	P,B
1)		MOVE	A,LISJFN
1)		HRRZI	B,14
1)		JSYS	BOUT
1)		MOVE	TEMP,A		;10X ASCFIL TAKES JFN'S IN TEMP
1)		POP	P,B
1)		POP	P,A
1)		MOVE	A,[POINT 7,TITLIN]
1)		PUSHJ	P,ASCFIL	;INTERSPERSE CONSTANTS

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 27,27

1)		MOVE	D,FPAGNO
1)		PUSHJ	P,DECFIL
1)		MOVN	D,PAGINC	; TO FORM HEADER LINE
1)		PUSHJ	P,DECFIL
1)		PUSHJ	P,ASCFIL
1)		MOVE	LPSA,TTOP
1)		PUSHJ	P,PSTRNG
1)		PUSHJ	P,ASCFIL
1)		MOVE	A,[POINT 7,[ASCIZ/
1)	/],-1]
1)		PUSHJ	P,ASCFIL
1)	NOHDR:	POP	P,D
1)		POPJ	P,
1)	PSTRNG:	HRRZ	B,$PNAME(LPSA)
1)		MOVE	C,$PNAME+1(LPSA)
1)	MKT1:	ILDB	D,C
1)		IDPB	D,TEMP
1)		SOJG	B,MKT1		;PUT OUT PROG NAME
1)		POPJ	P,
1)	>;TENX
1)	ZERODATA(TITLE LINE)
1)	TITLIN:	BLOCK	=28		;SHOULD BE BIG ENOUGH FOR TITLE LINE
1)	ENDDATA
1)	;  MAKT -- PREPARE A TITLE LINE
1)	NOTENX <
1)	↑MAKT:	
*** SYM[S,AIL] *** PAGE 27
2)	TITLIN:	BLOCK	=28		;SHOULD BE BIG ENOUGH FOR TITLE LINE
2)	;  MAKT -- PREPARE A TITLE LINE
2)	↑MAKT:	


******** SYM **** PAGE 27
1)	>;NOTENX
1)	TENX <
1)	↑MAKT:	TLNN	FF,LISTNG	;WANT A LISTING?
1)		  POPJ	P,		;NO
1)		HRROI	2,TITLIN	;DEST. DESIGN. FOR ALL THAT FOLLOWS
1)		HRROI	1,[ASCIZ /SAIL  /]
1)		SETZ	3,
1)		JSYS	SIN
1)		HRRZI	3,IPROC
1)		MOVE	1,$PNAME+1(3)	;BP FOR PROGRAM NAME
1)		HRRZ	3,$PNAME(3)	;CHAR COUNT
1)		MOVNS	3
1)		JSYS	SIN
1)		MOVEI	1," "
1)		IDPB	1,2

	1) SYM vs. 2) SYM[S,AIL]	SRCCOM	03-19-74	01:42	PAGES 27,28

1)		IDPB	1,2
1)		MOVE	1,2		;DEST. DESIG (UPDATED) INTO 1.
1)		HRRZ	2,SRCJFN
1)		SETZ	3,		
1)		JSYS	JFNS		
1)		MOVEI	2," "
1)		IDPB	2,1		
1)		IDPB	2,1
1)		SETO	2,
1)		HRLZI	3,336321	
1)		JSYS	ODTIM		
1)		MOVEI	2," "
1)		IDPB	2,1
1)		IDPB	2,1
1)		SETZ	2,		
1)		IDPB	2,1
1)		POPJ	P,
1)	>;TENX
1)	SUBTTL	ENTERS -- ENTER A SYMBOL
*** SYM[S,AIL] *** PAGE 28
2)	SUBTTL	ENTERS -- ENTER A SYMBOL