Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/listings/tkb-vnp/cmds.bpt
There are no other files named cmds.bpt in the archive.
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

   1	!<SAUTER.TKB20>CMDS.BLI.11, 15-Feb-79 07:50:35, Edit by SROBINSON
   2	!<SAUTER.TKB20>CMDS.BLI.9, 20-Nov-78 06:53:59, Edit by SROBINSON
   3	MODULE CMDS (					! COMMAND SCANNER
   4			IDENT = 'X0.1-2A'
   5			) =
   6	BEGIN
   7	!
   8	!
   9	!
  10	! COPYRIGHT (C) 1978, 1979 BY
  11	! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
  12	!
  13	!
  14	! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
  15	! ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
  16	! INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
  17	! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
  18	! OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
  19	! TRANSFERRED.
  20	!
  21	!
  22	! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
  23	! AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
  24	! CORPORATION.
  25	!
  26	! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
  27	! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
  28	!
  29	
  30	!++
  31	! FACILITY: TKB-20
  32	!
  33	! ABSTRACT:
  34	!
  35	!
  36	! THIS IS THE COMMAND SCANNER FOR THE TASK BUILDER.
  37	!
  38	!
  39	! ENVIRONMENT: TOPS-20
  40	!
  41	! AUTHOR: J. SAUTER, CREATION DATE: 14-DEC-77
  42	!
  43	! MODIFIED BY:
  44	!
  45	!	Scott G. Robinson, 15-FEB-79 : VERSION X0.1-2A
  46	!	- Make calls to CMDLIN include the prompt
  47	!
  48	!	, : VERSION
  49	! 01	-
  50	!--
  51	
  52	!<BLF/PAGE>
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

  53	!
  54	! TABLE OF CONTENTS:
  55	!
  56	
  57	FORWARD ROUTINE
  58	    UPPER_CASE,					!CONVERT LOWER CASE TO UPPER
  59	    SCN_FILE_NAME,				!SCAN A FILE NAME
  60	    SCN_SWITCH,					!SCAN A SWITCH
  61	    CMDLIN,					!PROCESS A COMMAND LINE (GLOBAL)
  62	    GET_SW,					!GET SWITCH AND VALUE (GLOBAL)
  63	    SEL_SWITCH;					! SUBROUTINE USED BY GET_SW
  64	
  65	!
  66	! INCLUDE FILES:
  67	!
  68	
  69	LIBRARY 'VNP-LIB.L36';
  70	
  71	!REQUIRE 'BLOCKH.REQ';				!PREPARE TO DEFINE STORAGE BLOCKS
  72	!REQUIRE 'FILE.REQ';				!DEFINE FILE BLOCK
  73	!REQUIRE 'FILSW.REQ';				!DEFINE FILE SWITCH BLOCK
  74	!REQUIRE 'BLOCKT.REQ';				!END OF DEFINING BLOCKS
  75	!
  76	! MACROS:
  77	!
  78	!	NONE
  79	!
  80	! EQUATED SYMBOLS:
  81	!
  82	!	NONE
  83	!
  84	! OWN STORAGE:
  85	!
  86	!	NONE
  87	!
  88	! EXTERNAL REFERENCES:
  89	!
  90	
  91	EXTERNAL ROUTINE
  92	    BLD_CHAIN,					!BUILD A MULTIPLE-POINTER LIST
  93	    CLOSE : NOVALUE,				!CLOSE A FILE
  94	    OPEN,					!OPEN A FILE
  95	    ERRMSG : NOVALUE,				!PRINT ERROR MESSAGE
  96	    ERROR,					!ANNOUNCE A PROGRAMMING ERROR
  97	    FND_CHAIN,					!FIND A BLOCK IN A CHAIN
  98	    FREBLK : NOVALUE,				!RETURN A BLOCK TO THE FREE LIST
  99	    GETBLK,					!GET A BLOCK FROM THE FREE LIST
 100	    INPUT,					!READ FROM I/O DEVICE
 101	    PCRLF : NOVALUE,				!PRINT CRLF
 102	    OUTSTR : NOVALUE;				!PRINT A STRING
 103	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 104	ROUTINE UPPER_CASE (CHAR) = 			!CONVERT LC TO UC
 105	
 106	!++
 107	! FUNCTIONAL DESCRIPTION:
 108	!
 109	!
 110	!
 111	!	ROUTINE TO CONVERT LOWER CASE CHARACTERS TO UPPER CASE
 112	!	ALL CHARACTERS FROM LOWER CASE "A" TO LOWER CASE "Z"
 113	!	GET OCTAL 40 SUBTRACTED FROM THEM.  ALL OTHER CHARACTERS
 114	!	ARE RETURNED UNCHANGED.
 115	!
 116	!
 117	! FORMAL PARAMETERS:
 118	!
 119	!	CHAR - THE CHARACTER TO BE CONVERTED
 120	!
 121	! IMPLICIT INPUTS:
 122	!
 123	!	NONE
 124	!
 125	! IMPLICIT OUTPUTS:
 126	!
 127	!	NONE
 128	!
 129	! ROUTINE VALUE:
 130	!
 131	!	THE CHARACTER, CONVERTED TO UPPER CASE IF NECESSARY
 132	!
 133	! SIDE EFFECTS
 134	!
 135	!	NONE
 136	!
 137	!--
 138	
 139	    BEGIN
 140	
 141	    SELECTONE .CHAR OF
 142		SET
 143	
 144		[%C'a' TO %C'z'] :
 145		    .CHAR - %O'40';
 146	
 147		[OTHERWISE] :
 148		    .CHAR;
 149		TES
 150	
 151	    END;
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 152	ROUTINE SCN_FILE_NAME (PTR) = 			! SCAN FILE NAME
 153	
 154	!++
 155	! FUNCTIONAL DESCRIPTION:
 156	!
 157	!	SCAN A FILE NAME.  STOP ON PROPER DELIMETER.
 158	!
 159	! FORMAL PARAMETERS:
 160	!
 161	!	PTR - POINTER TO TEXT; GETS UPDATED.
 162	!
 163	! IMPLICIT INPUTS:
 164	!
 165	!	THE TEXT POINTED TO IS READ
 166	!
 167	! IMPLICIT OUTPUTS:
 168	!
 169	!	NONE
 170	!
 171	! ROUTINE VALUE:
 172	!
 173	!	POINTER TO FILE BLOCK, OR 0 IF OUT OF STORAGE.
 174	!
 175	! SIDE EFFECTS
 176	!
 177	!	OBTAINS STORAGE FROM THE FREE LIST
 178	!
 179	!--
 180	
 181	    BEGIN
 182	
 183	    LOCAL
 184		CHAR,
 185		FILE_PTR : REF FILE_BLOCK,
 186		FIL_N_CTR,
 187		FIL_N_PTR,
 188		SCAN_DONE;
 189	
 190	!
 191	
 192	    IF ((FILE_PTR = GETBLK (FILE_TYP, FILE_LEN)) EQL 0)
 193	    THEN
 194		BEGIN
 195		ERRMSG (0, 1, UPLIT (%ASCIZ'SCAN_FILE_NAME'), 0, 0, 0, 0);
 196		0
 197		END
 198	    ELSE
 199		BEGIN
 200		FIL_N_PTR = CH$PTR (FILE_PTR [FILE_NAME], -1);
 201		SCAN_DONE = 0;
 202		FIL_N_CTR = 0;
 203	
 204		DO
 205		    BEGIN
 206		    CHAR = UPPER_CASE (CH$A_RCHAR (.PTR));
 207	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 208		    CASE .CHAR FROM 0 TO 127 OF
 209			SET
 210	
 211			[%C'A' TO %C'Z', %C'0' TO %C'9', %C'.', %C'<', %C'>', %C'[', %C']', %C':', %C'-'] :
 212			    BEGIN			!VALID CHAR IN FILE NAME
 213	
 214			    IF (.FIL_N_CTR LSS (LEN_FILE_STRING - 1))
 215			    THEN
 216				BEGIN
 217				CH$A_WCHAR (.CHAR, FIL_N_PTR);
 218				FIL_N_CTR = .FIL_N_CTR + 1;
 219				END
 220			    ELSE
 221				SCAN_DONE = -1;
 222	
 223			    END;
 224	
 225			[%C',', %C'/', %C'=', 0] :
 226			    BEGIN			!VALID DELIMETER
 227			    SCAN_DONE = 1;
 228			    .PTR = CH$PLUS (..PTR, -1);
 229			    END;
 230	
 231			[INRANGE] :
 232			    BEGIN
 233			    SCAN_DONE = -1;
 234			    CH$A_WCHAR (.CHAR, FIL_N_PTR);
 235			    END;
 236			TES;
 237	
 238		    END
 239		UNTIL (.SCAN_DONE NEQ 0);
 240	
 241		CH$A_WCHAR (0, FIL_N_PTR);		!TERMINATE FILE NAME
 242	
 243		IF (.SCAN_DONE LSS 0)
 244		THEN
 245		    ERRMSG (0, 2, UPLIT (%ASCIZ'SCAN_FILE_NAME'), FILE_PTR [FILE_NAME], 0, 0,
 246			0);
 247	
 248		.FILE_PTR				!RETURN POINTER TO FILE BLOCK
 249		END					!GOT STORAGE
 250	    END;					!ROUTINE SCN_FIL_NAME (SCAN_FILE_NAME)
 251	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 252	ROUTINE SCN_SWITCH (PTR) = 			! SCAN A SWITCH
 253	
 254	!++
 255	! FUNCTIONAL DESCRIPTION:
 256	!
 257	!	SCAN A SWITCH WITH OPTIONAL VALUE
 258	!
 259	! FORMAL PARAMETERS:
 260	!
 261	!	PTR - POINTER TO TEXT; GETS UPDATED.
 262	!	 INITIALLY POINTS RIGHT AFTER THE "/".
 263	!
 264	! IMPLICIT INPUTS:
 265	!
 266	!	THE TEXT POINTED TO IS READ
 267	!
 268	! IMPLICIT OUTPUTS:
 269	!
 270	!	NONE
 271	!
 272	! ROUTINE VALUE:
 273	!
 274	!	POINTER TO LIST OF SWITCH BLOCKS, OR 0 IF OUT OF STORAGE.
 275	!
 276	! SIDE EFFECTS
 277	!
 278	!	OBTAINS STORAGE FROM THE FREE LIST.
 279	!	THE POINTER IS LEFT POINTING TO THE FIRST CHAR AFTER THE SWITCH
 280	!
 281	!--
 282	
 283	    BEGIN
 284	
 285	    LOCAL
 286		CHAR,
 287		DEC_VAL,
 288		OCT_BAD,
 289		OCT_VAL,
 290		SCAN_DONE,
 291		SW_PTR : REF FILSW_BLOCK,
 292		VALUE_TEXT : VECTOR [CH$ALLOCATION (LEN_FSW_TEXT)],
 293		VAL_TYPE,
 294		WORD_CTR,
 295		WORD_DONE,
 296		WORD_PTR;
 297	
 298	    SCAN_DONE = 0;
 299	
 300	    IF ((SW_PTR = GETBLK (FILSW_TYP, FILSW_LEN)) EQL 0)
 301	    THEN
 302		BEGIN
 303		ERRMSG (0, 1, UPLIT (%ASCIZ'SCAN_SWITCHES'), 0, 0, 0, 0);
 304		SCAN_DONE = -1;
 305		END;
 306	
 307	    IF (.SCAN_DONE EQL 0)
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 308	    THEN
 309		BEGIN					!SETUPS ARE OK
 310		WORD_DONE = 0;
 311		WORD_CTR = 0;
 312		WORD_PTR = CH$PTR (SW_PTR [FSW_NAME], -1);
 313	
 314		WHILE (.WORD_DONE EQL 0) DO
 315		    BEGIN
 316		    CHAR = UPPER_CASE (CH$A_RCHAR (.PTR));
 317	
 318		    SELECT .CHAR OF
 319			SET
 320	
 321			[%C'A' TO %C'Z', %C'0' TO %C'9', %C'.', %C'-'] :
 322			    BEGIN
 323	
 324			    IF (.WORD_CTR LSS (LEN_FSW_NAME - 1))
 325			    THEN
 326				BEGIN
 327				CH$A_WCHAR (.CHAR, WORD_PTR);
 328				WORD_CTR = .WORD_CTR + 1;
 329				END
 330			    ELSE
 331				BEGIN
 332				SCAN_DONE = -1;
 333				WORD_DONE = -1;
 334				END;
 335	
 336			    END;
 337	
 338			[%C'/', %C',', %C'=', 0] :
 339			    BEGIN
 340			    SCAN_DONE = 1;
 341			    .PTR = CH$PLUS (..PTR, -1);
 342			    END;
 343	
 344			[%C':', %C'/', %C',', %C'=', 0] :
 345			    BEGIN
 346			    WORD_DONE = 1;
 347			    END;
 348	
 349			[OTHERWISE] :
 350			    BEGIN
 351			    SCAN_DONE = -1;		!INVALID CHARACTER
 352			    WORD_DONE = -1;
 353			    END;
 354			TES;
 355	
 356		    END;				!SCAN OF WORD
 357	
 358		IF (.SCAN_DONE EQL 0)
 359		THEN
 360		    BEGIN				!WE HAVE A VALUE FOR THIS SWITCH
 361		    WORD_DONE = 0;
 362		    CHAR = CH$A_RCHAR (.PTR);
 363	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 364		    SELECTONE UPPER_CASE (.CHAR) OF
 365			SET
 366	
 367			[%C'0' TO %C'9'] :
 368			    BEGIN			!NUMERIC
 369			    DEC_VAL = 0;
 370			    OCT_VAL = 0;
 371			    OCT_BAD = 0;
 372			    VAL_TYPE = 1;		!ASSUME OCTAL NUMBER
 373	
 374			    WHILE (.WORD_DONE EQL 0) DO
 375				BEGIN
 376	
 377				SELECT .CHAR OF
 378				    SET
 379	
 380				    [%C'0' TO %C'7'] :
 381					OCT_VAL = (.OCT_VAL*8) + (.CHAR - %C'0');
 382	
 383				    [%C'0' TO %C'9'] :
 384					DEC_VAL = (.DEC_VAL*10) + (.CHAR - %C'0');
 385	
 386				    [%C'8' TO %C'9'] :
 387					OCT_BAD = 1;
 388	
 389				    [%C'.'] :
 390					BEGIN
 391					VAL_TYPE = 2;	!MUST BE DECIMAL NUMBER
 392					WORD_DONE = 1;
 393					SCAN_DONE = 1;
 394					END;
 395	
 396				    [%C'/', %C',', %C'=', 0] :
 397					BEGIN
 398					SCAN_DONE = 1;
 399					WORD_DONE = 1;
 400					.PTR = CH$PLUS (..PTR, -1);
 401					END;
 402	
 403				    [OTHERWISE] :
 404					BEGIN
 405					SCAN_DONE = -1;
 406					WORD_DONE = -1;
 407					END;
 408				    TES;
 409	
 410				IF (.WORD_DONE EQL 0) THEN CHAR = CH$A_RCHAR (.PTR);
 411	
 412				END;
 413	
 414			    END;			!NUMERIC
 415	
 416			[%C'A' TO %C'Z', %C'$', %C'.'] :
 417			    BEGIN			!TEXT
 418			    WORD_CTR = 0;
 419			    WORD_PTR = CH$PTR (VALUE_TEXT, -1);
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 420			    VAL_TYPE = 3;
 421	
 422			    WHILE (.WORD_DONE EQL 0) DO
 423				BEGIN
 424	
 425				SELECTONE UPPER_CASE (.CHAR) OF
 426				    SET
 427	
 428				    [%C'A' TO %C'Z', %C'0' TO %C'9', %C'$', %C'.'] :
 429					BEGIN
 430	
 431					IF (.WORD_CTR LSS (LEN_FSW_TEXT - 1))
 432					THEN
 433					    BEGIN
 434					    CH$A_WCHAR (.CHAR, WORD_PTR);
 435					    WORD_CTR = .WORD_CTR + 1;
 436					    END
 437					ELSE
 438					    BEGIN
 439					    SCAN_DONE = -1;
 440					    WORD_DONE = -1;
 441					    END;
 442	
 443					END;
 444	
 445				    [%C'/', %C',', %C'=', 0] :
 446					BEGIN
 447					SCAN_DONE = 1;
 448					WORD_DONE = 1;
 449					.PTR = CH$PLUS (..PTR, -1);
 450					END;
 451	
 452				    [OTHERWISE] :
 453					BEGIN
 454					SCAN_DONE = -1;
 455					WORD_DONE = -1;
 456					END;
 457				    TES;
 458	
 459				IF (.WORD_DONE EQL 0) THEN CHAR = CH$A_RCHAR (.PTR);
 460	
 461				END;
 462	
 463			    END;			!TEXT
 464	
 465			[OTHERWISE] :
 466			    BEGIN
 467			    SCAN_DONE = -1;
 468			    WORD_DONE = -1;
 469			    END;
 470			TES;
 471	
 472	!
 473	
 474		    IF (.WORD_DONE GTR 0)
 475		    THEN
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 476			BEGIN
 477	
 478			CASE .VAL_TYPE FROM 1 TO 3 OF
 479			    SET
 480	
 481			    [1] :
 482				BEGIN			!OCTAL NUMBER
 483	
 484				IF (.OCT_BAD NEQ 0)
 485				THEN
 486				    SCAN_DONE = -1
 487				ELSE
 488				    BEGIN
 489				    SW_PTR [FSW_VAL] = .OCT_VAL;
 490				    SW_PTR [FSW_VAL_PRES] = 1;
 491				    END;
 492	
 493				END;
 494	
 495			    [2] :
 496				BEGIN			!DECIMAL NUMBER
 497				SW_PTR [FSW_VAL] = .DEC_VAL;
 498				SW_PTR [FSW_VAL_PRES] = 1;
 499				END;
 500	
 501			    [3] :
 502				BEGIN			!TEXT
 503				CH$MOVE (.WORD_CTR, CH$PTR (VALUE_TEXT), CH$PTR (SW_PTR [FSW_TEXT]));
 504				SW_PTR [FSW_TEXT_PRES] = 1;
 505				END;
 506			    TES;
 507	
 508			END;				!WORD_CTR GTR 0
 509	
 510		    END					!VALUE FOR THIS SWITCH
 511		END;					!SETUPS ARE OK
 512	
 513	    IF (.SCAN_DONE LEQ 0)
 514	    THEN
 515		BEGIN
 516	
 517		IF (.SW_PTR NEQ 0) THEN FREBLK (.SW_PTR);
 518	
 519		0
 520		END
 521	    ELSE
 522		BEGIN
 523		.SW_PTR
 524		END
 525	
 526	    END;					!ROUTINE SCN_SWITCH (SCAN_SWITCHES)
 527	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 528	GLOBAL ROUTINE CMDLIN (CHANNEL, UP_FILE, PROMPT) = 	! SCAN A COMMAND LINE
 529	
 530	!++
 531	! FUNCTIONAL DESCRIPTION:
 532	!
 533	!	ROUTINE TO PROCESS A COMMAND LINE
 534	!	HANDLES INDIRECTION AND SWITCHES
 535	!
 536	! FORMAL PARAMETERS:
 537	!
 538	!	CHANNEL - FIRST CHANNEL OVER WHICH TO GET INPUT
 539	!	UP_FILE - POINTER TO PREVIOUS FILE BLOCK (ROOT IF CHANNEL = 0)
 540	!	PROMPT - POINTER TO PROMPT STRING (ISSUED TO TERMINAL)
 541	!
 542	! IMPLICIT INPUTS:
 543	!
 544	!	DATA FROM THE INDICATED CHANNEL, AND FROM SPECIFIED FILES
 545	!
 546	! IMPLICIT OUTPUTS:
 547	!
 548	!	ADDS FILES TO THE DATA STRUCTURE POINTED TO BY UP_FILE
 549	!
 550	! ROUTINE VALUE:
 551	!
 552	!	0 = SYNTAX ERROR, 1 = SUCCESS.
 553	!
 554	! SIDE EFFECTS
 555	!
 556	!	GETS STORAGE FROM FREE LIST
 557	!	READS FROM SPECIFIED I/O CHANNEL, AND FROM
 558	!	 FILES AS SPECIFIED IN THE COMMAND STRING
 559	!
 560	!--
 561	
 562	    BEGIN
 563	
 564	    BIND
 565		ROUTINE_NAME = UPLIT (%ASCIZ'CMDLIN');
 566	
 567	    LOCAL
 568		CHAN,
 569		CHAR,
 570		FILE_PTR : REF FILE_BLOCK,
 571		FIRST_FILE : REF FILE_BLOCK,
 572		HIGHER_FILE : REF FILE_BLOCK,
 573		IND_FILE_PTR : VECTOR [5],		!POINTS TO FILE BLOCKS
 574		NXT_FILE_PTR : REF FILE_BLOCK,
 575		SCAN_DONE,
 576		SEEN_DELIM,
 577		SEEN_CONT,
 578		SEEN_EQUAL,
 579		SWITCH_PTR : REF FILSW_BLOCK,
 580		TEXT_CTR,
 581		TEXT_LINE : VECTOR [CH$ALLOCATION (200)],
 582		TEXT_PTR,
 583		TMP_FILE_PTR : REF FILE_BLOCK;
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 584	
 585	    FIRST_FILE = 0;
 586	    SEEN_EQUAL = 0;				!NO '=' YET
 587	    SEEN_CONT = -1;				!PRETEND WE HAVE SEEN CONT MARK
 588	    FILE_PTR = 0;				!NO FILES SEEN YET
 589	    CHAN = .CHANNEL;				!START ON SPECIFIED CHANNEL
 590	    HIGHER_FILE = .UP_FILE;			!START WITH SPECIFIED HIGHER FILE
 591	    IND_FILE_PTR [.CHAN] = .UP_FILE;		!REMEMBER FOR INDIRECT FILES
 592	!
 593	! LOOP HERE TO SCAN CONTINUED LINES
 594	!
 595	
 596	    WHILE ((.SEEN_CONT NEQ 0) OR (.CHAN NEQ .CHANNEL)) DO
 597		BEGIN
 598		SEEN_CONT = 0;
 599		SEEN_DELIM = -1;
 600	
 601		IF (.CHAN EQL 0)
 602		THEN
 603		    BEGIN
 604		    OUTSTR (.CHAN, .PROMPT);
 605		    END;
 606	
 607	!
 608	! ABSORB TEXT LINE FROM INPUT DEVICE
 609	!
 610		TEXT_CTR = 0;
 611		TEXT_PTR = CH$PTR (TEXT_LINE, -1);
 612	
 613		DO
 614		    BEGIN
 615		    CHAR = INPUT (.CHAN);
 616	
 617		    IF (.CHAR LSS 0)
 618		    THEN
 619			BEGIN
 620	
 621			IF (.CHAN GTR .CHANNEL)
 622			THEN
 623			    BEGIN
 624			    CLOSE (.CHAN);
 625			    CHAN = .CHAN - 1;
 626			    HIGHER_FILE = .IND_FILE_PTR [.CHAN];
 627			    END
 628			ELSE
 629			    ERRMSG (0, 9, ROUTINE_NAME, 0, 0, 0, 0);
 630	
 631			END
 632		    ELSE
 633	
 634			IF ((.CHAR GEQ %C' ') AND (.TEXT_CTR LSS 200)) THEN CH$A_WCHAR (.CHAR, TEXT_PTR);
 635	
 636		    END
 637		UNTIL ((.CHAR EQL %O'12') OR ((.CHAR LSS 0) AND (.CHAN EQL .CHANNEL)));
 638	
 639		CH$A_WCHAR (0, TEXT_PTR);		!APPEND NULL TO LINE IMAGE
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 640		TEXT_PTR = CH$PTR (TEXT_LINE, -1);
 641	
 642		IF (.CHAR EQL %O'12')
 643		THEN
 644		    SCAN_DONE = 0
 645		ELSE
 646	
 647		    IF ((.CHAR LSS 0) AND (.CHAN EQL .CHANNEL) AND (SEEN_CONT EQL 0))
 648		    THEN
 649			SCAN_DONE = 1
 650		    ELSE
 651			SCAN_DONE = -1;
 652	
 653	!
 654	! NOW SCAN THE LINE
 655	!
 656	
 657		WHILE (.SCAN_DONE EQL 0) DO
 658		    BEGIN
 659		    CHAR = UPPER_CASE (CH$A_RCHAR (TEXT_PTR));
 660	
 661		    SELECTONE .CHAR OF
 662			SET
 663	
 664			[%C'@'] :
 665			    BEGIN			!INDIRECT FILE
 666	
 667			    IF (.CHAN GEQ 4)
 668			    THEN
 669				ERRMSG (0, 8, ROUTINE_NAME, TEXT_LINE, 0, 0, 0)
 670			    ELSE
 671	
 672				IF ((IND_FILE_PTR [.CHAN + 1] = SCN_FILE_NAME (TEXT_PTR)) EQL 0)
 673				THEN
 674				    ERRMSG (0, 2,
 675					ROUTINE_NAME, TEXT_LINE, 0, 0, 0)
 676				ELSE
 677				    BEGIN
 678				    TMP_FILE_PTR = .IND_FILE_PTR [.CHAN + 1];
 679				    TMP_FILE_PTR [FILE_FLAG_IND] = 1;
 680	
 681				    IF (OPEN (.CHAN + 1, TMP_FILE_PTR [FILE_NAME], 1, 0, UPLIT (%ASCIZ'CMD')) NEQ 0)
 682				    THEN
 683					BEGIN
 684					HIGHER_FILE [FILE_DOWN] = BLD_CHAIN (.HIGHER_FILE, .HIGHER_FILE [FILE_DOWN],
 685					    .TMP_FILE_PTR);
 686					TMP_FILE_PTR [FILE_HIGH] = .HIGHER_FILE;
 687					HIGHER_FILE = .TMP_FILE_PTR;
 688					CHAN = .CHAN + 1;
 689					END;
 690	
 691				    END;
 692	
 693			    END;
 694	
 695			[%C'A' TO %C'Z', %C'0' TO %C'9'] :
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 696			    BEGIN			!ALPHANUMERIC, MUST START A FILE SPEC
 697	
 698			    IF (.SEEN_DELIM EQL 0)
 699			    THEN
 700				BEGIN
 701				ERRMSG (0, 6, ROUTINE_NAME, TEXT_LINE, 0, 0, 0);
 702				SCAN_DONE = -1;
 703				END
 704			    ELSE
 705				BEGIN
 706				TEXT_PTR = CH$PLUS (.TEXT_PTR, -1);
 707				NXT_FILE_PTR = SCN_FILE_NAME (TEXT_PTR);
 708	
 709				IF (.NXT_FILE_PTR EQL 0)
 710				THEN
 711				    SCAN_DONE = -1
 712				ELSE
 713				    BEGIN
 714				    NXT_FILE_PTR [FILE_PREV] = .FILE_PTR;
 715				    NXT_FILE_PTR [FILE_HIGH] = .HIGHER_FILE;
 716				    HIGHER_FILE [FILE_DOWN] = BLD_CHAIN (.HIGHER_FILE, .HIGHER_FILE [FILE_DOWN],
 717					.NXT_FILE_PTR);
 718	
 719				    IF (.FILE_PTR NEQ 0) THEN FILE_PTR [FILE_NEXT] = .NXT_FILE_PTR;
 720	
 721				    FILE_PTR = .NXT_FILE_PTR;
 722	
 723				    IF (.FIRST_FILE EQL 0) THEN FIRST_FILE = .FILE_PTR;
 724	
 725				    IF (.SEEN_EQUAL NEQ 0) THEN FILE_PTR [FILE_FLAG_IN] = 1;
 726	
 727				    SEEN_DELIM = 0;
 728				    END;
 729	
 730				END;
 731	
 732			    END;
 733	
 734			[%C'/'] :
 735			    BEGIN			!SWITCHES
 736	
 737			    IF (.SEEN_DELIM NEQ 0)
 738			    THEN
 739				ERRMSG (0, 7, ROUTINE_NAME, TEXT_LINE, 0, 0, 0)
 740			    ELSE
 741				BEGIN
 742				SWITCH_PTR = SCN_SWITCH (TEXT_PTR);
 743	
 744				IF (.SWITCH_PTR EQL 0)
 745				THEN
 746				    ERRMSG (0, 6, ROUTINE_NAME, TEXT_LINE, 0, 0, 0)
 747				ELSE
 748				    BEGIN
 749	
 750				    IF ((FILE_PTR [FILE_SWITCHES] = BLD_CHAIN (.FILE_PTR, .FILE_PTR [FILE_SWITCHES],
 751					    .SWITCH_PTR)) EQL 0)
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 752				    THEN
 753					ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0);
 754	
 755				    END;
 756	
 757				END;
 758	
 759			    END;
 760	
 761			[%C','] :
 762			    BEGIN			!COMMA, SEPARATES FILE SPECS
 763			    SEEN_DELIM = -1;
 764			    END;
 765	
 766			[%C'-'] :
 767			    BEGIN			!DASH, INDICATES CONTINUATION IN RIGHT CONTEXT
 768	
 769			    IF (SEEN_DELIM NEQ 0) THEN SEEN_CONT = -1;
 770	
 771			    SEEN_DELIM = 0;
 772			    END;
 773	
 774			[%C'='] :
 775			    BEGIN			!EQUAL SIGN, SEPATATES OUTPUT FROM INPUT FILES
 776	
 777			    IF ((.SEEN_DELIM NEQ 0) OR (.SEEN_EQUAL NEQ 0))
 778			    THEN
 779				BEGIN
 780				ERRMSG (0, 6, ROUTINE_NAME, TEXT_LINE, 0, 0, 0);
 781				SCAN_DONE = -1;
 782				END
 783			    ELSE
 784				BEGIN
 785				SEEN_DELIM = -1;
 786				SEEN_EQUAL = -1;
 787	!
 788	! MARK ALL FILE SPECS ALREADY SEEN AS BEING TO THE LEFT OF
 789	!  THE EQUAL SIGN.
 790	!
 791				TMP_FILE_PTR = .FIRST_FILE;
 792	
 793				WHILE (.TMP_FILE_PTR NEQ 0) DO
 794				    BEGIN
 795				    TMP_FILE_PTR [FILE_FLAG_OUT] = 1;
 796				    TMP_FILE_PTR = .TMP_FILE_PTR [FILE_NEXT];
 797				    END;
 798	
 799				END;
 800	
 801			    END;
 802	
 803			[0] :
 804			    BEGIN			! END OF LINE
 805			    SCAN_DONE = 1;
 806			    END;
 807	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 808			[OTHERWISE] :
 809			    BEGIN
 810			    ERRMSG (0, 2, ROUTINE_NAME, TEXT_LINE, 0, 0, 0);
 811			    SCAN_DONE = -1;
 812			    END;
 813			TES;
 814	
 815		    END;				! END OF SCAN LOOP
 816	
 817		END;					! END OF CONTINUATION LINES
 818	
 819	    WHILE (.CHAN NEQ .CHANNEL) DO
 820		BEGIN
 821		CLOSE (.CHAN);
 822		CHAN = .CHAN - 1;
 823		END;
 824	
 825	    .SCAN_DONE
 826	    END;
 827	
 828	!
 829	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 830	GLOBAL ROUTINE GET_SW (FILE_PTR, SWITCH_NAME) = 	!GET SWITCH AND VALUE
 831	
 832	!++
 833	! FUNCTIONAL DESCRIPTION:
 834	!
 835	!	GET A SWITCH (ON A FILE) AND ITS VALUE
 836	!
 837	! FORMAL PARAMETERS:
 838	!
 839	!	FILE_PTR - THE FILE BLOCK THAT MAY HAVE THE SPECIFIED SWITCH
 840	!	SWITCH_NAME - NAME OF THE SWITCH, SEVEN CHARACTERS, LAST NULL.
 841	!
 842	! IMPLICIT INPUTS:
 843	!
 844	!	NONE
 845	!
 846	! IMPLICIT OUTPUTS:
 847	!
 848	!	NONE
 849	!
 850	! ROUTINE VALUE:
 851	!
 852	!	POINTER TO THE SWITCH BLOCK, OR 0
 853	!
 854	! SIDE EFFECTS
 855	!
 856	!	NONE
 857	!
 858	!--
 859	
 860	    BEGIN
 861	
 862	    MAP
 863		FILE_PTR : REF FILE_BLOCK;
 864	
 865	    IF (.FILE_PTR EQL 0) THEN 0 ELSE FND_CHAIN (.FILE_PTR [FILE_SWITCHES], SEL_SWITCH, .SWITCH_NAME)
 866	
 867	    END;					!OF GET_SW
 868	
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

 869	ROUTINE SEL_SWITCH (FILSW_PTR, SWITCH_NAME) = 	!SEE IF A SWITCH IS ON A FILE
 870	
 871	!++
 872	! FUNCTIONAL DESCRIPTION:
 873	!
 874	!	SEE IF A SWITCH IS ON A FILE.  USED IN CALL TO FND_CHAIN.
 875	!
 876	! FORMAL PARAMETERS:
 877	!
 878	!	FILSW_PTR - POINTER TO A FILE SWITCH TO TEST
 879	!	SWITCH_NAME - POINTER TO NAME OF SWITCH TO LOOK FOR
 880	!
 881	! IMPLICIT INPUTS:
 882	!
 883	!	NONE
 884	!
 885	! IMPLICIT OUTPUTS:
 886	!
 887	!	NONE
 888	!
 889	! ROUTINE VALUE:
 890	!
 891	!	0 IF THIS IS NOT THE PROPER SWITCH (WHICH WILL CAUSE FND_CHAIN
 892	!	 TO KEEP SEARCHING), OR THE POINTER TO THE SWITCH BLOCK IF
 893	!	 THE NAME MATCHES.
 894	!
 895	! SIDE EFFECTS
 896	!
 897	!	NONE
 898	!
 899	!--
 900	
 901	    BEGIN
 902	
 903	    MAP
 904		FILSW_PTR : REF FILSW_BLOCK;
 905	
 906	    IF (CH$EQL (LEN_FSW_NAME, CH$PTR (FILSW_PTR [FSW_NAME]), LEN_FSW_NAME, CH$PTR (.SWITCH_NAME), 0))
 907	    THEN
 908		.FILSW_PTR
 909	    ELSE
 910		0
 911	
 912	    END;					!OF SEL_SWITCH
 913	END
 914	
 915	ELUDOM
 916	! Local Modes:
 917	! Comment Start:!
 918	! Comment Column:36
 919	! Auto Save Mode:2
 920	! Mode:Fundamental
 921	! End:
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

BLD_CHAIN	  92*	 684	 716	 750
CHAN		 568	 589#	 591	 596	 601	 604	 615
		 621	 624	 625#	 626	 637	 647	 667
		 672	 678	 681	 688#	 819	 821	 822#
CHANNEL		 528	 589	 596	 621	 637	 647	 819
CHAR		 104	 141	 145	 148	 184	 206#	 208
		 217	 234	 286	 316#	 318	 327	 362#
		 364	 377	 381	 384	 410#	 425	 434
		 459#	 569	 615#	 617	 634	 637	 642
		 647	 659#	 661
CLOSE		  93	 624	 821
CMDLIN		  61	 528*
CMDS		   3#
DEC_VAL		 287	 369#	 384#	 497
ERRMSG		  95	 195	 245	 303	 629	 669	 674
		 701	 739	 746	 753	 780	 810
ERROR		  96
FILE_BLOCK	 185	 570	 571	 572	 574	 583	 863
FILE_DOWN	 684	 716
FILE_FLAG_IN	 725
FILE_FLAG_IND	 679
FILE_FLAG_OUT	 795
FILE_HIGH	 686	 715
FILE_LEN	 192
FILE_NAME	 200	 245	 681
FILE_NEXT	 719	 796
FILE_PREV	 714
FILE_PTR	 185	 192#	 200	 245	 248	 570	 588#
		 714	 719#	 721#	 723	 725#	 750#	 830
		 863	 865
FILE_SWITCHES	 750	 865
FILE_TYP	 192
FILSW_BLOCK	 291	 579	 904
FILSW_LEN	 300
FILSW_PTR	 869	 904	 906	 908
FILSW_TYP	 300
FIL_N_CTR	 186	 202#	 214	 218#
FIL_N_PTR	 187	 200#	 217	 234	 241
FIRST_FILE	 571	 585#	 723#	 791
FND_CHAIN	  97	 865
FREBLK		  98	 517
FSW_NAME	 312	 906
FSW_TEXT	 503
FSW_TEXT_PRES	 504
FSW_VAL		 489	 497
FSW_VAL_PRES	 490	 498
GETBLK		  99	 192	 300
GET_SW		  62	 830*
HIGHER_FILE	 572	 590#	 626#	 684#	 686	 687#	 715
		 716#
IND_FILE_PTR	 573	 591#	 626	 672#	 678
INPUT		 100	 615
LEN_FILE_STRING	 214
LEN_FSW_NAME	 324	 906
LEN_FSW_TEXT	 292	 431
		DSK:CMDS.XRF[4,31]               31-Aug-79 14:41

NXT_FILE_PTR	 574	 707#	 709	 714#	 715#	 717	 719
		 721
OCT_BAD		 288	 371#	 387#	 484
OCT_VAL		 289	 370#	 381#	 489
OPEN		  94	 681
OUTSTR		 102	 604
PCRLF		 101
PROMPT		 528	 604
PTR		 152	 206	 228#	 252	 316	 341#	 362
		 400#	 410	 449#	 459
ROUTINE_NAME	 565#	 629	 669	 675	 701	 739	 746
		 753	 780	 810
SCAN_DONE	 188	 201#	 221#	 227#	 233#	 239	 243
		 290	 298#	 304#	 307	 332#	 340#	 351#
		 358	 393#	 398#	 405#	 439#	 447#	 454#
		 467#	 486#	 513	 575	 644#	 649#	 651#
		 657	 702#	 711#	 781#	 805#	 811#	 825
SCN_FILE_NAME	  59	 152*	 672	 707
SCN_SWITCH	  60	 252*	 742
SEEN_CONT	 577	 587#	 596	 598#	 647	 769#
SEEN_DELIM	 576	 599#	 698	 727#	 737	 763#	 769
		 771#	 777	 785#
SEEN_EQUAL	 578	 586#	 725	 777	 786#
SEL_SWITCH	  63	 865	 869*
SWITCH_NAME	 830	 865	 869	 906
SWITCH_PTR	 579	 742#	 744	 751
SW_PTR		 291	 300#	 312	 489#	 490#	 497#	 498#
		 503	 504#	 517	 523
TEXT_CTR	 580	 610#	 634
TEXT_LINE	 581	 611	 640	 669	 675	 701	 739
		 746	 780	 810
TEXT_PTR	 582	 611#	 634	 639	 640#	 659	 672
		 706#	 707	 742
TMP_FILE_PTR	 583	 678#	 679#	 681	 685	 686#	 687
		 791#	 793	 795#	 796#
UPPER_CASE	  58	 104*	 206	 316	 364	 425	 659
UP_FILE		 528	 590	 591
VALUE_TEXT	 292	 419	 503
VAL_TYPE	 293	 372#	 391#	 420#	 478
WORD_CTR	 294	 311#	 324	 328#	 418#	 431	 435#
		 503
WORD_DONE	 295	 310#	 314	 333#	 346#	 352#	 361#
		 374	 392#	 399#	 406#	 410	 422	 440#
		 448#	 455#	 459	 468#	 474
WORD_PTR	 296	 312#	 327	 419#	 434