Google
 

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

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

  50	!
  51	! TABLE OF CONTENTS:
  52	!
  53	
  54	FORWARD ROUTINE
  55	    RD16,					!READ A 16-BIT WORD
  56	    RDLBBL,					!READ AN OBJECT BLOCK (NON-DOS FMT)
  57	    RSTB,					!READ SYMBOL TABLE
  58	    GET_BYTE,					!GET AN 8-BIT BYTE FROM FILE
  59	    GET_WORD,					!GET A 16-BIT WORD FROM FILE
  60	    OBJ_GSD : NOVALUE,				!PROCESS GSD OBJECT ENTRY
  61	    OBJ_END_GSD : NOVALUE,			!END OF GSD ENTRIES
  62	    OBJ_EOM : NOVALUE,				!END OF MODULE
  63	    GSD_MNAME : NOVALUE,			!MODULE NAME
  64	    GSD_CNAME : NOVALUE,			!CSECT NAME (INVALID)
  65	    GSD_ISN : NOVALUE,				!INTERNAL SYMBOL NAME (INVALID)
  66	    GSD_TRA : NOVALUE,				!TRANSFER ADDRESS
  67	    SEL_GLOBAL,					!FIND A GLOBAL SYMBOL
  68	    GSD_GSN : NOVALUE,				!GLOBAL SYMBOL
  69	    SEL_PSECT,					!FIND A PSECT
  70	    GSD_PSN : NOVALUE,				!PSECT
  71	    GSD_IDENT : NOVALUE,			!MODULE IDENTIFICATION
  72	    GSD_MAP : NOVALUE,				!MAPPED ARRAY (INVALID)
  73	    OBJ_ISD : NOVALUE,				!INTERNAL SYMBOL (INVALID)
  74	    SYM_VAL,					!RETURN VALUE OF A SYMBOL
  75	    SEL_SYMBOL,					!FIND A SYMBOL BY NAME
  76	    GBL_VAL;					!RETURN VALUE OF A GLOBAL
  77	
  78	!
  79	! INCLUDE FILES:
  80	!
  81	
  82	LIBRARY 'VNP-LIB.L36';
  83	
  84	!REQUIRE 'BLOCKH.REQ';				!PREPARE TO DEFINE STORAGE BLOCKS
  85	!REQUIRE 'FILE.REQ';				!DEFINE FILE BLOCK
  86	!REQUIRE 'FILSW.REQ';				!DEFINE FILE SWITCHES
  87	!REQUIRE 'GLOBL.REQ';				!DEFINE GLOBAL BLOCK
  88	!REQUIRE 'MODU.REQ';				!DEFINE MODULE BLOCK
  89	!REQUIRE 'PSECT.REQ';				!DEFINE PSECT BLOCK
  90	!REQUIRE 'BLOCKT.REQ';				!END OF DEFINING STORAGE BLOCKS
  91	
  92	!
  93	! MACROS:
  94	!
  95	!	NONE
  96	!
  97	! EQUATED SYMBOLS:
  98	!
  99	
 100	LITERAL
 101	    DEBUG = 0;
 102	
 103	!
 104	! OWN STORAGE:
 105	!
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 106	!	NONE
 107	!
 108	! EXTERNAL REFERENCES:
 109	!
 110	
 111	EXTERNAL ROUTINE
 112	    OPEN,					!OPEN A FILE
 113	    CLOSE : NOVALUE,				!CLOSE A FILE
 114	    INPUT,					!READ FROM A FILE
 115	    OUTPUT : NOVALUE,				!OUTPUT TO A FILE
 116	    ERROR : NOVALUE,				!SIGNAL PROGRAMMING ERROR
 117	    ERRMSG : NOVALUE,				!ERROR MESSAGE
 118	    GETSTG,					!GET STORAGE
 119	    FRESTG : NOVALUE,				!FREE STORAGE
 120	    PCRLF : NOVALUE,				!PRINT CRLF
 121	    OUTNUM : NOVALUE,				!PRINT A NUMBER
 122	    OUTSTR : NOVALUE,				!PRINT A STRING
 123	    R50TOA : NOVALUE,				!CONVERT RADIX50 TO ASCII
 124	    GETBLK,					!GET A STORAGE BLOCK
 125	    BLD_CHAIN,					!BUILD ONTO A CHAIN
 126	    FND_CHAIN;					!FIND AN ITEM IN A CHAIN
 127	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 128	ROUTINE RD16 (CHAN, CHKSUM) = 			!READ A 16-BIT WORD
 129	
 130	!++
 131	! FUNCTIONAL DESCRIPTION:
 132	!
 133	!	READ A 16-BIT WORD, ASSEMBLING IT FROM THE 8-BIT
 134	!	 INPUT STREAM.  MAINTAIN THE CHECKSUM.
 135	!
 136	! FORMAL PARAMETERS:
 137	!
 138	!	CHAN - THE CHANNEL OVER WHICH TO READ THE 8-BIT BYTES
 139	!	CHKSUM - ADDRESS OF THE CHECKSUM CELL
 140	!
 141	! IMPLICIT INPUTS:
 142	!
 143	!	NONE
 144	!
 145	! IMPLICIT OUTPUTS:
 146	!
 147	!	NONE
 148	!
 149	! ROUTINE VALUE:
 150	!
 151	!	THE VALUE OF THE 16-BIT WORD READ, OR -1 IF WE REACHED
 152	!	 END OF FILE ON INPUT.
 153	!
 154	! SIDE EFFECTS
 155	!
 156	!	READS FROM THE INPUT FILE.  MAY REACH EOF.
 157	!
 158	!--
 159	
 160	    BEGIN
 161	
 162	    LOCAL
 163		BYTE1,
 164		BYTE2,
 165		RESULT;
 166	
 167	    IF ((BYTE1 = INPUT (.CHAN)) LSS 0)
 168	    THEN
 169		.BYTE1
 170	    ELSE
 171		BEGIN
 172		.CHKSUM = ..CHKSUM + .BYTE1;
 173	
 174		IF ((BYTE2 = INPUT (.CHAN)) LSS 0)
 175		THEN
 176		    .BYTE2
 177		ELSE
 178		    BEGIN
 179		    .CHKSUM = ..CHKSUM + .BYTE2;
 180		    RESULT = 0;
 181		    RESULT<8, 8> = .BYTE2;		!HIGH-ORDER BYTE
 182		    RESULT<0, 8> = .BYTE1;		!LOW-ORDER BYTE
 183		    .RESULT
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 184		    END
 185	
 186		END
 187	
 188	    END;
 189	!
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 190	ROUTINE RDLBBL (CHAN, FILE_PTR, BYTES_READ) = 	!READ A LIBRARY BLOCK
 191	
 192	!++
 193	! FUNCTIONAL DESCRIPTION:
 194	!
 195	!	READ A BLOCK OF DATA FROM THE LIBRARY FILE.  THIS BLOCK
 196	!	 STARTS WITH A COUNT WORD FOLLOWED BY "COUNT" DATA WORDS.
 197	!	 THE DATA WORDS COMPRISE OBJECT TEXT WHICH MAY CONTAIN
 198	!	 SEVERAL RECORDS.
 199	!	THIS FORMAT IS ALSO USED FOR OBJECT FILES WITHOUT THE "DOS"
 200	!	 SWITCH.
 201	!
 202	! FORMAL PARAMETERS:
 203	!
 204	!	CHAN - THE CHANNEL OVER WHICH TO READ DATA.  IT MUST HAVE
 205	!	 BEEN OPENED IN WORD MODE.
 206	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR
 207	!	 ERROR MESSAGES.
 208	!	BYTES_READ - SET TO THE NUMBER OF BYTES READ FROM THE INPUT
 209	!	 CHANNEL.
 210	!
 211	! IMPLICIT INPUTS:
 212	!
 213	!	NONE
 214	!
 215	! IMPLICIT OUTPUTS:
 216	!
 217	!	NONE
 218	!
 219	! ROUTINE VALUE:
 220	!
 221	!	A POINTER TO A VECTOR.  THE FIRST WORD OF THE VECTOR HAS
 222	!	 ITS LENGTH IN WORDS.  THE SECOND HAS THE LENGTH OF DATA IN
 223	!	 BYTES.  SUBSEQUENT WORDS ARE THE DATA READ, SUITABLE
 224	!	 FOR SCANNING 8 BITS AT A TIME USING CH$A_RCHAR.  IT IS
 225	!	 THE CALLER'S RESPONSIBILITY TO FREE THIS VECTOR BY CALLING
 226	!	 FRESTG.
 227	!	IF WE REACH EOF, -1 IS RETURNED.  IF STORAGE IS NOT AVAILABLE,
 228	!	 0 IS RETURNED.  AN INVALID FORMAT ALSO RETURNS -1.
 229	!
 230	! SIDE EFFECTS
 231	!
 232	!	READS DATA FROM THE INPUT CHANNEL.  MAY GET EOF.
 233	!	OBTAINS STORAGE FROM THE FREE LIST.
 234	!	 WILL RETURN IT ON ERROR.
 235	!
 236	!--
 237	
 238	    BEGIN
 239	
 240	    BIND
 241		ROUTINE_NAME = UPLIT (%ASCIZ'READ_LIBRARY_BLOCK');
 242	
 243	    MAP
 244		FILE_PTR : REF FILE_BLOCK;
 245	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 246	    LOCAL
 247		BLKPTR,
 248		BYTE1,
 249		CHKSUM,
 250		COUNT,
 251		OUTLEN,
 252		RESULT : REF VECTOR;
 253	
 254	    RESULT = 0;
 255	    .BYTES_READ = 0;
 256	    OUTLEN = 0;
 257	
 258	    WHILE (.OUTLEN EQL 0) DO
 259		BEGIN
 260		OUTLEN = RD16 (.CHAN, CHKSUM);
 261		.BYTES_READ = ..BYTES_READ + 2;
 262		END;
 263	
 264	    IF ((.OUTLEN LSS 2) OR (.OUTLEN GTR 128))
 265	    THEN
 266		BEGIN
 267	
 268		IF (.OUTLEN NEQ -1) THEN ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 269	
 270		RESULT = -1;
 271		END
 272	    ELSE
 273		BEGIN
 274	
 275		IF ((RESULT = GETSTG ((((.OUTLEN)/4) + 3))) LEQ 0)
 276		THEN
 277		    BEGIN
 278		    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0);
 279		    END
 280		ELSE
 281		    BEGIN
 282		    RESULT [0] = (((.OUTLEN)/4) + 3);	!AMOUNT TO FREE
 283		    RESULT [1] = .OUTLEN;		!NUMBER OF BYTES
 284		    BLKPTR = CH$PTR (RESULT [2], -1, 8);
 285		    COUNT = 0;
 286	
 287		    WHILE (((COUNT = .COUNT + 1) LEQ .OUTLEN) AND (.BYTE1 GEQ 0)) DO
 288			BEGIN
 289			BYTE1 = INPUT (.CHAN);
 290			.BYTES_READ = ..BYTES_READ + 1;
 291	
 292			IF (.BYTE1 GEQ 0) THEN CH$A_WCHAR (.BYTE1, BLKPTR);
 293	
 294			END;
 295	
 296		    IF (.BYTE1 LSS 0)
 297		    THEN
 298			BEGIN
 299			ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 300			FRESTG (.RESULT, .RESULT [0]);
 301			RESULT = -1;
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 302			END;
 303	
 304		    END;
 305	
 306		END;
 307	
 308	    .RESULT
 309	    END;					!OF RDLBBL
 310	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 311	GLOBAL ROUTINE RSTB (FILE_CHAN, FILE_PTR) = 	!READ SYMBOL TABLE
 312	
 313	!++
 314	! FUNCTIONAL DESCRIPTION:
 315	!
 316	!	READ A SYMBOL TABLE FOR A TASK OR SYSTEM IMAGE
 317	!
 318	! FORMAL PARAMETERS:
 319	!
 320	!	FILE_CHAN - THE CHANNEL NUMBER TO USE WHEN READING THE FILE.
 321	!	FILE_PTR - POINTER TO THE FILE BLOCK WHICH DESCRIBES
 322	!		THE SYMBOL TABLE FILE TO BE READ
 323	!
 324	! IMPLICIT INPUTS:
 325	!
 326	!	NONE
 327	!
 328	! IMPLICIT OUTPUTS:
 329	!
 330	!	GETS SPACE FROM FREE STORAGE TO HOLD THE SYMBOLS
 331	!
 332	! ROUTINE VALUE:
 333	!
 334	!	POINTER TO THE CHAIN BLOCK WHICH POINTS TO THE SYMBOLS
 335	!
 336	! SIDE EFFECTS
 337	!
 338	!	READS THE SYMBOL TABLE FILE
 339	!
 340	!--
 341	
 342	    BEGIN
 343	
 344	    BIND
 345		ROUTINE_NAME = UPLIT (%ASCIZ'READ_SYMBOL_TABLE');
 346	
 347	    MAP
 348		FILE_PTR : REF FILE_BLOCK;
 349	
 350	    LOCAL
 351		ASCVAL : VECTOR [CH$ALLOCATION (LEN_PSECT_NAME)],
 352		BLKPTR : REF VECTOR,
 353		BYTECTR,
 354		BYTEPTR,
 355		BYTES_READ,
 356		CHAR,
 357		COUNTER,
 358		POINTER,
 359		PREV_CHAR : VECTOR [3],
 360		R50VAL,
 361		READ_DONE,
 362		RECORD_TYPE;
 363	
 364	    IF (OPEN (.FILE_CHAN, FILE_PTR [FILE_NAME], 2, 0, UPLIT (%ASCIZ'STB')) NEQ 0)
 365	    THEN
 366		BEGIN					!SUCCESSFUL INPUT OPEN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 367		READ_DONE = 0;
 368	
 369		DO
 370		    BEGIN
 371		    BLKPTR = RDLBBL (.FILE_CHAN, .FILE_PTR, BYTES_READ);
 372	
 373		    IF (.BLKPTR LEQ 0)
 374		    THEN
 375			BEGIN
 376			ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 377			READ_DONE = -1;
 378			END
 379		    ELSE
 380			BEGIN
 381			BYTEPTR = CH$PTR (BLKPTR [2], -1, 8);
 382			BYTECTR = .BLKPTR [1];
 383	
 384			IF (DEBUG GEQ 2)
 385			THEN
 386			    BEGIN
 387			    PCRLF (1);
 388			    OUTNUM (1, .BYTECTR, 10, 0);
 389			    COUNTER = .BYTECTR;
 390			    POINTER = .BYTEPTR;
 391			    PREV_CHAR [0] = 0;
 392			    PREV_CHAR [1] = 0;
 393			    PREV_CHAR [2] = 0;
 394			    R50VAL = 0;
 395	
 396			    WHILE ((COUNTER = .COUNTER - 1) GEQ 0) DO
 397				BEGIN
 398				CHAR = CH$A_RCHAR (POINTER);
 399				PCRLF (1);
 400				OUTSTR (1, UPLIT (%ASCIZ'    '));
 401				OUTNUM (1, .CHAR, 8, 0);
 402				OUTPUT (1, %O'11');
 403				R50VAL<24, 8> = .PREV_CHAR [1];
 404				R50VAL<16, 8> = .PREV_CHAR [0];
 405				R50VAL<8, 8> = .CHAR;
 406				R50VAL<0, 8> = .PREV_CHAR [2];
 407				R50TOA (.R50VAL, ASCVAL [0]);
 408				OUTSTR (1, ASCVAL [0]);
 409				PREV_CHAR [0] = .PREV_CHAR [1];
 410				PREV_CHAR [1] = .PREV_CHAR [2];
 411				PREV_CHAR [2] = .CHAR;
 412				END;
 413	
 414			    END;			!DEBUG
 415	
 416			RECORD_TYPE = GET_BYTE (BYTEPTR, BYTECTR, .FILE_PTR);
 417	
 418			CASE .RECORD_TYPE FROM 1 TO 6 OF
 419			    SET
 420	
 421			    [1] :
 422				OBJ_GSD (BYTEPTR, BYTECTR, .FILE_PTR);	!GSD
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 423	
 424			    [2] :
 425				OBJ_END_GSD (BYTEPTR, BYTECTR, .FILE_PTR);	!END OF GSD
 426	
 427			    [5] :
 428				OBJ_ISD (BYTEPTR, BYTECTR, .FILE_PTR);	!INTERNAL SYMBOL DIRECTORY
 429	
 430			    [6] :
 431				BEGIN
 432				OBJ_EOM (BYTEPTR, BYTECTR, .FILE_PTR);	!END OF MODULE
 433				READ_DONE = -1;
 434				END;
 435	
 436			    [3, 4, OUTRANGE] :
 437				BEGIN
 438				ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 439				READ_DONE = -1;
 440				END;
 441			    TES;
 442	
 443			FRESTG (.BLKPTR, .BLKPTR [0]);
 444			END
 445	
 446		    END
 447		UNTIL (.READ_DONE NEQ 0);
 448	
 449		CLOSE (.FILE_CHAN);
 450		END;					!OF SUCCESSFUL INPUT OPEN
 451	
 452	    END;					!OF READ_FILE
 453	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 454	ROUTINE GET_BYTE (BYTEPTR, BYTECTR, FILE_PTR) = 	!GET BYTE
 455	
 456	!++
 457	! FUNCTIONAL DESCRIPTION:
 458	!
 459	!	FETCH A BYTE FROM THE OBJECT RECORD.  MAINTAIN
 460	!	 THE COUNTER AND GIVE AN ERROR MESSAGE IF IT RUNS OUT.
 461	!
 462	! FORMAL PARAMETERS:
 463	!
 464	!	BYTEPTR - POINTER TO THE BYTE POINTER
 465	!	BYTECTR - POINTER TO THE COUNTER CELL
 466	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE FILE
 467	!	 BEING READ, FOR ERROR MESSAGES.
 468	!
 469	! IMPLICIT INPUTS:
 470	!
 471	!	THE OBJECT RECORD POINTED TO
 472	!
 473	! IMPLICIT OUTPUTS:
 474	!
 475	!	NONE
 476	!
 477	! ROUTINE VALUE:
 478	!
 479	!	THE VALUE OF THE BYTE, OR -1 IF WE RAN OFF THE END.
 480	!
 481	! SIDE EFFECTS
 482	!
 483	!	NONE
 484	!
 485	!--
 486	
 487	    BEGIN
 488	
 489	    BIND
 490		ROUTINE_NAME = UPLIT (%ASCIZ'GET_BYTE');
 491	
 492	    MAP
 493		FILE_PTR : REF FILE_BLOCK;
 494	
 495	    IF (..BYTECTR GTR 0)
 496	    THEN
 497		BEGIN
 498		.BYTECTR = ..BYTECTR - 1;
 499		CH$A_RCHAR (.BYTEPTR)
 500		END
 501	    ELSE
 502		BEGIN
 503		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 504		-1
 505		END
 506	
 507	    END;					!OF GET_BYTE
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 508	ROUTINE GET_WORD (BYTEPTR, BYTECTR, FILE_PTR) = 	!GET WORD
 509	
 510	!++
 511	! FUNCTIONAL DESCRIPTION:
 512	!
 513	!	FETCH A WORD FROM THE OBJECT RECORD.  MAINTAIN
 514	!	 THE COUNTER AND GIVE AN ERROR MESSAGE IF IT RUNS OUT.
 515	!
 516	! FORMAL PARAMETERS:
 517	!
 518	!	BYTEPTR - POINTER TO THE BYTE POINTER
 519	!	BYTECTR - POINTER TO THE COUNTER CELL
 520	!	FILE_PTR - POINTER TO FILE BLOCK FOR ERROR MESSAGES
 521	!
 522	! IMPLICIT INPUTS:
 523	!
 524	!	THE OBJECT RECORD POINTED TO
 525	!
 526	! IMPLICIT OUTPUTS:
 527	!
 528	!	NONE
 529	!
 530	! ROUTINE VALUE:
 531	!
 532	!	THE VALUE OF THE WORD, OR -1 IF WE RAN OFF THE END.
 533	!
 534	! SIDE EFFECTS
 535	!
 536	!	NONE
 537	!
 538	!--
 539	
 540	    BEGIN
 541	
 542	    BIND
 543		ROUTINE_NAME = UPLIT (%ASCIZ'GET_WORD');
 544	
 545	    MAP
 546		FILE_PTR : REF FILE_BLOCK;
 547	
 548	    LOCAL
 549		RESULT;
 550	
 551	    IF (..BYTECTR GTR 1)
 552	    THEN
 553		BEGIN
 554		.BYTECTR = ..BYTECTR - 2;
 555		RESULT = CH$A_RCHAR (.BYTEPTR);
 556		RESULT<8, 8> = CH$A_RCHAR (.BYTEPTR);
 557		.RESULT
 558		END
 559	    ELSE
 560		BEGIN
 561		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 562		-1
 563		END
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 564	
 565	    END;					!OF GET_WORD
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 566	ROUTINE OBJ_GSD (BYTEPTR, BYTECTR, FILE_PTR) : NOVALUE = 	!PROCESS GSD RECORD
 567	
 568	!++
 569	! FUNCTIONAL DESCRIPTION:
 570	!
 571	!	PROCESS A GLOBAL SYMBOL DIRECTORY ENTRY IN THE OBJECT
 572	!	 FILE.  THIS IS DONE BY FETCHING THE PARAMETERS AND THEN
 573	!	 TO A SUBROUTINE TO HANDLE THE ENTRY TYPE.
 574	!
 575	! FORMAL PARAMETERS:
 576	!
 577	!	BYTEPTR - POINTER TO THE BYTE POINTER
 578	!	BYTECTR - POINTER TO THE COUNTER CELL
 579	!	FILE_PTR - POINTER TO THE FILE BLOCK OF THE OBJECT
 580	!	 FILE BEING READ.  THIS IS FOR ERROR MESSAGES AND TO
 581	!	 POINT TO THE DATA READ.
 582	!
 583	! IMPLICIT INPUTS:
 584	!
 585	!	THE OBJECT RECORD POINTED TO
 586	!
 587	! IMPLICIT OUTPUTS:
 588	!
 589	!	NONE
 590	!
 591	! ROUTINE VALUE:
 592	!
 593	!	NONE
 594	!
 595	! SIDE EFFECTS
 596	!
 597	!	IN MANY CASES, THE HANDLERS FOR THE ENTRY TYPES WILL
 598	!	 OBTAIN SPACE FROM THE FREE STORAGE LIST
 599	!
 600	!--
 601	
 602	    BEGIN
 603	
 604	    BIND
 605		ROUTINE_NAME = UPLIT (%ASCIZ'OBJ_GSD');
 606	
 607	    MAP
 608		FILE_PTR : REF FILE_BLOCK;
 609	
 610	    LOCAL
 611		MODU_PTR : REF MODU_BLOCK,
 612		CHAR,
 613		R50VAL,
 614		ASCVAL : VECTOR [CH$ALLOCATION (LEN_PSECT_NAME)],
 615		FLAGS,
 616		ETYPE,
 617		VALUE;
 618	
 619	    IF (DEBUG GEQ 1)
 620	    THEN
 621		BEGIN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 622		PCRLF (1);
 623		OUTPUT (1, %O'11');
 624		OUTSTR (1, UPLIT (%ASCIZ'GSD RECORD, LENGTH = '));
 625		OUTNUM (1, ..BYTECTR, 10, 0);
 626		END;					!DEBUG
 627	
 628	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) NEQ 0)
 629	    THEN
 630		BEGIN
 631	
 632		IF ((.MODU_PTR [MODU_FLAG_EGSD] NEQ 0) AND (.MODU_PTR [MODU_FLAG_ENDED] NEQ 0))
 633		THEN
 634		    ERRMSG (0, 10,
 635			ROUTINE_NAME, 0, 0, 0, 0);
 636	
 637		END;
 638	
 639	    CHAR = GET_BYTE (.BYTEPTR, .BYTECTR, .FILE_PTR);	!UNUSED BYTE
 640	
 641	    DO
 642		BEGIN
 643		R50VAL = 0;
 644		R50VAL<16, 16> = GET_WORD (.BYTEPTR, .BYTECTR, .FILE_PTR);
 645		R50VAL<0, 16> = GET_WORD (.BYTEPTR, .BYTECTR, .FILE_PTR);
 646		R50TOA (.R50VAL, ASCVAL [0]);
 647		FLAGS = GET_BYTE (.BYTEPTR, .BYTECTR, .FILE_PTR);
 648		ETYPE = GET_BYTE (.BYTEPTR, .BYTECTR, .FILE_PTR);
 649		VALUE = GET_WORD (.BYTEPTR, .BYTECTR, .FILE_PTR);
 650	
 651		CASE .ETYPE FROM 0 TO 7 OF
 652		    SET
 653	
 654		    [0] :
 655			GSD_MNAME (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 656	
 657		    [1] :
 658			GSD_CNAME (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 659	
 660		    [2] :
 661			GSD_ISN (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 662	
 663		    [3] :
 664			GSD_TRA (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 665	
 666		    [4] :
 667			GSD_GSN (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 668	
 669		    [5] :
 670			GSD_PSN (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 671	
 672		    [6] :
 673			GSD_IDENT (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 674	
 675		    [7] :
 676			GSD_MAP (ASCVAL [0], .FLAGS, .VALUE, .FILE_PTR);
 677	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 678		    [OUTRANGE] :
 679			ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 680		    TES;
 681	
 682		END
 683	    UNTIL (..BYTECTR EQL 0);
 684	
 685	    END;					!OF OBJ_GSD
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 686	ROUTINE OBJ_END_GSD (BYTEPTR, BYTECTR, FILE_PTR) : NOVALUE = 	!PROCESS END GSD RECORD
 687	
 688	!++
 689	! FUNCTIONAL DESCRIPTION:
 690	!
 691	!	PROCESS THE END GSD RECORD.
 692	!
 693	! FORMAL PARAMETERS:
 694	!
 695	!	BYTEPTR - POINTER TO THE BYTE POINTER
 696	!	BYTECTR - POINTER TO THE COUNTER CELL
 697	!	FILE_PTR - POINTER TO FILE BLOCK
 698	!
 699	! IMPLICIT INPUTS:
 700	!
 701	!	NONE
 702	!
 703	! IMPLICIT OUTPUTS:
 704	!
 705	!	SETS A FLAG WHICH FORBIDS ANY MORE GSD RECORDS IN
 706	!	 THIS MODULE.
 707	!
 708	! ROUTINE VALUE:
 709	!
 710	!	NONE
 711	!
 712	! SIDE EFFECTS
 713	!
 714	!	NONE
 715	!
 716	!--
 717	
 718	    BEGIN
 719	
 720	    BIND
 721		ROUTINE_NAME = UPLIT (%ASCIZ'OBJ_END_GSD');
 722	
 723	    MAP
 724		FILE_PTR : REF FILE_BLOCK;
 725	
 726	    LOCAL
 727		MODU_PTR : REF MODU_BLOCK;
 728	
 729	    IF (DEBUG GEQ 1)
 730	    THEN
 731		BEGIN
 732		PCRLF (1);
 733		OUTPUT (1, %O'11');
 734		OUTSTR (1, UPLIT (%ASCIZ'END GSD RECORD, LENGTH = '));
 735		OUTNUM (1, ..BYTECTR, 10, 0);
 736		END;					!DEBUG
 737	
 738	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
 739	    THEN
 740		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME],
 741		    0, 0, 0)
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 742	    ELSE
 743		BEGIN
 744	
 745		IF (.MODU_PTR [MODU_FLAG_EGSD] NEQ 0)
 746		THEN
 747		    ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0,
 748			0)
 749		ELSE
 750		    BEGIN
 751		    MODU_PTR [MODU_FLAG_EGSD] = 1;
 752		    END;
 753	
 754		END;
 755	
 756	    END;					!OF OBJ_END_GSD
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 757	ROUTINE OBJ_ISD (BYTEPTR, BYTECTR, FILE_PTR) : NOVALUE = 	!PROCESS ISD RECORD
 758	
 759	!++
 760	! FUNCTIONAL DESCRIPTION:
 761	!
 762	!	PROCESS INTERNAL SYMBOL DIRECTORY RECORD.
 763	!
 764	! FORMAL PARAMETERS:
 765	!
 766	!	BYTEPTR - POINTER TO THE BYTE POINTER
 767	!	BYTECTR - POINTER TO THE COUNTER CELL
 768	!	FILE_PTR - POINTER TO OBJECT FILE BLOCK
 769	!
 770	! IMPLICIT INPUTS:
 771	!
 772	!	THE OBJECT RECORD POINTED TO
 773	!
 774	! IMPLICIT OUTPUTS:
 775	!
 776	!	ADDS THE INTERNAL SYMBOLS TO THE DATA STRUCTURE
 777	!
 778	! ROUTINE VALUE:
 779	!
 780	!	NONE
 781	!
 782	! SIDE EFFECTS
 783	!
 784	!	NONE
 785	!
 786	!--
 787	
 788	    BEGIN
 789	
 790	    BIND
 791		ROUTINE_NAME = UPLIT (%ASCIZ'OBJ_ISD');
 792	
 793	    IF (DEBUG GEQ 1)
 794	    THEN
 795		BEGIN
 796		PCRLF (1);
 797		OUTPUT (1, %O'11');
 798		OUTSTR (1, UPLIT (%ASCIZ'INTERNAL SYMBOL DIRECTORY RECORD, LENGTH = '));
 799		OUTNUM (1, ..BYTECTR, 10, 0);
 800		END;					!DEBUG
 801	
 802	    ERRMSG (0, 12, ROUTINE_NAME, 0, 0, 0, 0);
 803	    END;					!OF OBJ_ISD
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 804	ROUTINE OBJ_EOM (BYTEPTR, BYTECTR, FILE_PTR) : NOVALUE = 	!PROCESS END OF MODULE RECORD
 805	
 806	!++
 807	! FUNCTIONAL DESCRIPTION:
 808	!
 809	!	PROCESS THE END MODULE RECORD.
 810	!
 811	! FORMAL PARAMETERS:
 812	!
 813	!	BYTEPTR - POINTER TO THE BYTE POINTER
 814	!	BYTECTR - POINTER TO THE COUNTER CELL
 815	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
 816	!
 817	! IMPLICIT INPUTS:
 818	!
 819	!	THE OBJECT RECORD POINTED TO
 820	!
 821	! IMPLICIT OUTPUTS:
 822	!
 823	!	SETS A FLAG TO INDICATE THAT WE ARE BETWEEN MODULES.
 824	!	 AN EOF IS OK IN THIS CONTEXT.
 825	!
 826	! ROUTINE VALUE:
 827	!
 828	!	NONE
 829	!
 830	! SIDE EFFECTS
 831	!
 832	!	NONE
 833	!
 834	!--
 835	
 836	    BEGIN
 837	
 838	    BIND
 839		ROUTINE_NAME = UPLIT (%ASCIZ'OBJ_EOM');
 840	
 841	    MAP
 842		FILE_PTR : REF FILE_BLOCK;
 843	
 844	    LOCAL
 845		MODU_PTR : REF MODU_BLOCK;
 846	
 847	    IF (DEBUG GEQ 1)
 848	    THEN
 849		BEGIN
 850		PCRLF (1);
 851		OUTPUT (1, %O'11');
 852		OUTSTR (1, UPLIT (%ASCIZ'END OF MODULE RECORD, LENGTH = '));
 853		OUTNUM (1, ..BYTECTR, 10, 0);
 854		END;					!DEBUG
 855	
 856	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
 857	    THEN
 858		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME],
 859		    0, 0, 0)
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 860	    ELSE
 861		BEGIN
 862	
 863		IF ((.MODU_PTR [MODU_FLAG_EGSD] EQL 0) OR (.MODU_PTR [MODU_FLAG_ENDED] NEQ 0))
 864		THEN
 865		    ERRMSG (0, 10,
 866			ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0)
 867		ELSE
 868		    MODU_PTR [MODU_FLAG_ENDED] = 1;
 869	
 870		END;
 871	
 872	    END;					!OF OBJ_EOM
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 873	ROUTINE GSD_MNAME (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS MODULE NAME ENTRY
 874	
 875	!++
 876	! FUNCTIONAL DESCRIPTION:
 877	!
 878	!	PROCESS THE MODULE NAME ENTRY OF THE GSD RECORD
 879	!
 880	! FORMAL PARAMETERS:
 881	!
 882	!	ASCPTR - POINTER TO NAME, IN ASCII
 883	!	FLAGS - THE FLAGS BYTE
 884	!	VALUE - THE VALUE WORD
 885	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
 886	!
 887	! IMPLICIT INPUTS:
 888	!
 889	!	NONE
 890	!
 891	! IMPLICIT OUTPUTS:
 892	!
 893	!	ADDS THE MODULE NAME TO THE DATA STRUCTURE
 894	!
 895	! ROUTINE VALUE:
 896	!
 897	!	NONE
 898	!
 899	! SIDE EFFECTS
 900	!
 901	!	OBTAINS SPACE FROM THE FREE LIST
 902	!
 903	!--
 904	
 905	    BEGIN
 906	
 907	    BIND
 908		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_MNAME');
 909	
 910	    MAP
 911		FILE_PTR : REF FILE_BLOCK;
 912	
 913	    LOCAL
 914		MODU_PTR : REF MODU_BLOCK,
 915		FILE_ERROR;
 916	
 917	    IF (DEBUG GEQ 1)
 918	    THEN
 919		BEGIN
 920		PCRLF (1);
 921		OUTPUT (1, %O'11');
 922		OUTPUT (1, %O'11');
 923		OUTSTR (1, UPLIT (%ASCIZ'MODULE NAME, NAME = '));
 924		OUTSTR (1, .ASCPTR);
 925		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
 926		OUTNUM (1, .FLAGS, 8, 0);
 927		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
 928		OUTNUM (1, .VALUE, 8, 0);
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 929		END;					!DEBUG
 930	
 931	!
 932	    FILE_ERROR = 0;
 933	
 934	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) NEQ 0)
 935	    THEN
 936		BEGIN
 937	
 938		IF (.MODU_PTR [MODU_FLAG_ENDED] EQL 0)
 939		THEN
 940		    BEGIN
 941		    ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 942		    FILE_ERROR = -1;
 943		    END
 944		ELSE
 945		    BEGIN
 946		    ERRMSG (0, 23, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 947		    FILE_ERROR = -1;
 948		    END;
 949	
 950		END;
 951	
 952	    IF (.FILE_ERROR EQL 0)
 953	    THEN
 954		BEGIN					!THERE IS NOT ALREADY A MODULE BEING PROCESSED
 955	
 956		IF ((MODU_PTR = GETBLK (MODU_TYP, MODU_LEN)) EQL 0)
 957		THEN
 958		    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 959		ELSE
 960		    BEGIN				!WE HAVE STORAGE FOR THE MODULE NAME
 961	
 962		    IF ((FILE_PTR [FILE_DOWN] = BLD_CHAIN (.FILE_PTR, .FILE_PTR [FILE_DOWN], .MODU_PTR)) EQL 0)
 963		    THEN
 964			ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 965		    ELSE
 966			BEGIN				!WE HAVE STORAGE FOR THE CHAIN BLOCK
 967			CH$MOVE (LEN_MODU_NAME, CH$PTR (.ASCPTR), CH$PTR (MODU_PTR [MODU_NAME]));
 968			FILE_PTR [FILE_MODU] = .MODU_PTR;
 969			MODU_PTR [MODU_OBJ_FILE] = .FILE_PTR;
 970			MODU_PTR [MODU_SECTOR] = 0;
 971			END;
 972	
 973		    END;
 974	
 975		END;
 976	
 977	    END;					!OF GSD_MNAME
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

 978	ROUTINE GSD_CNAME (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS CSECT NAME ENTRY
 979	
 980	!++
 981	! FUNCTIONAL DESCRIPTION:
 982	!
 983	!	PROCESS THE CSECT NAME ENTRY OF THE GSD RECORD
 984	!	 THIS IS IMPLEMENTED BY CONVERTING THE CSECT INTO
 985	!	 AN APPROPRIATE PSECT.
 986	!
 987	! FORMAL PARAMETERS:
 988	!
 989	!	ASCPTR - POINTER TO NAME, IN ASCII
 990	!	FLAGS - THE FLAGS BYTE
 991	!	VALUE - THE VALUE WORD
 992	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
 993	!
 994	! IMPLICIT INPUTS:
 995	!
 996	!	NONE
 997	!
 998	! IMPLICIT OUTPUTS:
 999	!
1000	!	NONE
1001	!
1002	! ROUTINE VALUE:
1003	!
1004	!	NONE
1005	!
1006	! SIDE EFFECTS
1007	!
1008	!	CALLS GSD_PNAME
1009	!
1010	!--
1011	
1012	    BEGIN
1013	
1014	    BIND
1015		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_CNAME');
1016	
1017	    MAP
1018		FILE_PTR : REF FILE_BLOCK;
1019	
1020	    LOCAL
1021		MODU_PTR : REF MODU_BLOCK;
1022	
1023	    IF (DEBUG GEQ 1)
1024	    THEN
1025		BEGIN
1026		PCRLF (1);
1027		OUTPUT (1, %O'11');
1028		OUTPUT (1, %O'11');
1029		OUTSTR (1, UPLIT (%ASCIZ'CSECT NAME, NAME = '));
1030		OUTSTR (1, .ASCPTR);
1031		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1032		OUTNUM (1, .FLAGS, 8, 0);
1033		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1034		OUTNUM (1, .VALUE, 8, 0);
1035		END;					!DEBUG
1036	
1037	!
1038	! TURN THE CSECT NAME ENTRY INTO A PSECT BY CALLING GSD_PNAME WITH
1039	!  THE APPROPRIATE ARGUMENTS.
1040	!
1041	
1042	    IF (CH$EQL (LEN_PSECT_NAME, CH$PTR (.ASCPTR), LEN_PSECT_NAME,
1043		    CH$PTR (UPLIT (%ASCIZ'      '
1044			))))
1045	    THEN
1046		BEGIN					!BLANK CSECT, MAKE LOCAL PSECT
1047		GSD_PSN (.ASCPTR, (1^PSECT_FLG_REL), .VALUE, .FILE_PTR);
1048		END
1049	    ELSE
1050	
1051		IF (CH$EQL (LEN_PSECT_NAME, CH$PTR (.ASCPTR), LEN_PSECT_NAME,
1052			CH$PTR (UPLIT (%ASCIZ'. ABS.'
1053			    ))))
1054		THEN
1055		    BEGIN				!ASECT, MAKE AN ABSOLUTE PSECT
1056		    GSD_PSN (UPLIT (%ASCIZ'. ABS.'), ((1^PSECT_FLG_GBL) + (1^PSECT_FLG_OVR)), .VALUE, .FILE_PTR);
1057		    END
1058		ELSE
1059		    BEGIN				!NAMED CSECT, MAKE A GLOBAL PSECT
1060		    GSD_PSN (.ASCPTR, ((1^PSECT_FLG_GBL) + (1^PSECT_FLG_REL) + (1^PSECT_FLG_OVR)), .VALUE, .FILE_PTR)
1061		    ;
1062		    END;
1063	
1064	    END;					!OF GSD_CNAME
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1065	ROUTINE GSD_ISN (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS INTERNAL SYMBOL NAME ENTRY
1066	
1067	!++
1068	! FUNCTIONAL DESCRIPTION:
1069	!
1070	!	PROCESS THE INTERNAL SYMBOL NAME ENTRY OF THE GSD RECORD.
1071	!	 THIS IS NOT IMPLEMENTED SINCE MACY11 DOES NOT PRODUCE
1072	!	 THESE RECORDS.
1073	!
1074	! FORMAL PARAMETERS:
1075	!
1076	!	ASCPTR - POINTER TO NAME, IN ASCII
1077	!	FLAGS - THE FLAGS BYTE
1078	!	VALUE - THE VALUE WORD
1079	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1080	!
1081	! IMPLICIT INPUTS:
1082	!
1083	!	NONE
1084	!
1085	! IMPLICIT OUTPUTS:
1086	!
1087	!	NONE
1088	!
1089	! ROUTINE VALUE:
1090	!
1091	!	NONE
1092	!
1093	! SIDE EFFECTS
1094	!
1095	!	PRINTS AN ERROR MESSAGE
1096	!
1097	!--
1098	
1099	    BEGIN
1100	
1101	    BIND
1102		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_ISN');
1103	
1104	    IF (DEBUG GEQ 1)
1105	    THEN
1106		BEGIN
1107		PCRLF (1);
1108		OUTPUT (1, %O'11');
1109		OUTPUT (1, %O'11');
1110		OUTSTR (1, UPLIT (%ASCIZ'INTERNAL SYMBOL NAME, NAME = '));
1111		OUTSTR (1, .ASCPTR);
1112		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1113		OUTNUM (1, .FLAGS, 8, 0);
1114		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
1115		OUTNUM (1, .VALUE, 8, 0);
1116		END;					!DEBUG
1117	
1118	    ERRMSG (0, 12, ROUTINE_NAME, 0, 0, 0, 0);
1119	    END;					!OF GSD_ISN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1120	ROUTINE GSD_TRA (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS TRANSFER ADDRESS ENTRY
1121	
1122	!++
1123	! FUNCTIONAL DESCRIPTION:
1124	!
1125	!	PROCESS THE TRANSFER ADDRESS ENTRY OF THE GSD RECORD
1126	!
1127	! FORMAL PARAMETERS:
1128	!
1129	!	ASCPTR - POINTER TO NAME, IN ASCII
1130	!	FLAGS - THE FLAGS BYTE
1131	!	VALUE - THE VALUE WORD
1132	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1133	!
1134	! IMPLICIT INPUTS:
1135	!
1136	!	NONE
1137	!
1138	! IMPLICIT OUTPUTS:
1139	!
1140	!	STORES THE TRANSFER ADDRESS IN THE DATA STRUCTURE
1141	!
1142	! ROUTINE VALUE:
1143	!
1144	!	NONE
1145	!
1146	! SIDE EFFECTS
1147	!
1148	!	NONE
1149	!
1150	!--
1151	
1152	    BEGIN
1153	
1154	    BIND
1155		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_TRA');
1156	
1157	    MAP
1158		FILE_PTR : REF FILE_BLOCK;
1159	
1160	    LOCAL
1161		MODU_PTR : REF MODU_BLOCK,
1162		PSECT_PTR : REF PSECT_BLOCK,
1163		PSECT_INFO : VECTOR [3];
1164	
1165	    IF (DEBUG GEQ 1)
1166	    THEN
1167		BEGIN
1168		PCRLF (1);
1169		OUTPUT (1, %O'11');
1170		OUTPUT (1, %O'11');
1171		OUTSTR (1, UPLIT (%ASCIZ'TRANSFER ADDRESS, NAME = '));
1172		OUTSTR (1, .ASCPTR);
1173		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1174		OUTNUM (1, .FLAGS, 8, 0);
1175		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1176		OUTNUM (1, .VALUE, 8, 0);
1177		END;					!DEBUG
1178	
1179	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
1180	    THEN
1181		ERRMSG (0, 10, ROUTINE_NAME, 0, 0, 0, 0)
1182	    ELSE
1183		BEGIN
1184		PSECT_INFO [0] = .ASCPTR;
1185		PSECT_INFO [1] = 0;
1186		PSECT_INFO [2] = 0;
1187		PSECT_PTR = FND_CHAIN (.MODU_PTR [MODU_PSECTS], SEL_PSECT, PSECT_INFO);
1188	
1189		IF (.PSECT_PTR EQL 0)
1190		THEN
1191		    MODU_PTR [MODU_XFR_OFFSET] = .VALUE
1192		ELSE
1193		    BEGIN
1194		    MODU_PTR [MODU_XFR_PSECT] = .PSECT_PTR;
1195		    MODU_PTR [MODU_XFR_OFFSET] = .VALUE + .PSECT_PTR [PSECT_OFFSET];
1196		    END;
1197	
1198		END;
1199	
1200	    END;					!OF GSD_TRA
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1201	ROUTINE SEL_GLOBAL (GLOBAL_PTR, GLOBAL_INFO) = 	!SELECT PROPER GLOBAL
1202	
1203	!++
1204	! FUNCTIONAL DESCRIPTION:
1205	!
1206	!	SELECT THE GLOBAL DESCRIBED FROM THE LIST OF ALL GLOBALS.
1207	!	 USED IN A CALL TO FND_CHAIN.
1208	!
1209	! FORMAL PARAMETERS:
1210	!
1211	!	GLOBAL_PTR - POINTER TO GLOBAL TO TEST FOR SUITABILITY
1212	!	GLOBAL_INFO - INFORMATION ABOUT THE GLOBAL WE ARE LOOKING FOR
1213	!
1214	! IMPLICIT INPUTS:
1215	!
1216	!	NONE
1217	!
1218	! IMPLICIT OUTPUTS:
1219	!
1220	!	NONE
1221	!
1222	! ROUTINE VALUE:
1223	!
1224	!	POINTER TO THE GLOBAL, OR 0.
1225	!
1226	! SIDE EFFECTS
1227	!
1228	!	NONE
1229	!
1230	!--
1231	
1232	    BEGIN
1233	
1234	    MAP
1235		GLOBAL_PTR : REF GLOBL_BLOCK,
1236		GLOBAL_INFO : REF VECTOR [3];
1237	
1238	!
1239	! THE GLOBAL_INFO VECTOR CONTAINS:
1240	!
1241	! 0: POINTER TO THE GLOBAL NAME, IN ASCII
1242	! 1: THE GLOBAL FLAGS
1243	! 2: THE "VALUE" WORD FROM THE GLOBAL
1244	!
1245	
1246	    IF (CH$NEQ (LEN_GBL_NAME, CH$PTR (.GLOBAL_INFO [0]), LEN_GBL_NAME, CH$PTR (GLOBAL_PTR [GBL_NAME])))
1247	    THEN
1248		0
1249	    ELSE
1250		.GLOBAL_PTR
1251	
1252	    END;					!OF SEL_GLOBAL
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1253	ROUTINE GSD_GSN (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS GLOBAL SYMBOL NAME
1254	
1255	!++
1256	! FUNCTIONAL DESCRIPTION:
1257	!
1258	!	PROCESS THE GLOBAL SYMBOL NAME ENTRY OF THE GSD RECORD
1259	!
1260	! FORMAL PARAMETERS:
1261	!
1262	!	ASCPTR - POINTER TO NAME, IN ASCII
1263	!	FLAGS - THE FLAGS BYTE
1264	!	VALUE - THE VALUE WORD
1265	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1266	!
1267	! IMPLICIT INPUTS:
1268	!
1269	!	NONE
1270	!
1271	! IMPLICIT OUTPUTS:
1272	!
1273	!	ADDS THE GLOBAL SYMBOL TO THE DATA STRUCTURE
1274	!
1275	! ROUTINE VALUE:
1276	!
1277	!	NONE
1278	!
1279	! SIDE EFFECTS
1280	!
1281	!	OBTAINS SPACE FROM THE FREE LIST
1282	!
1283	!--
1284	
1285	    BEGIN
1286	
1287	    BIND
1288		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_GSN');
1289	
1290	    MAP
1291		FILE_PTR : REF FILE_BLOCK;
1292	
1293	    LOCAL
1294		GLOBL_PTR : REF GLOBL_BLOCK,
1295		GLOBAL_INFO : VECTOR [3],
1296		MODU_PTR : REF MODU_BLOCK,
1297		MODU_PTR1 : REF MODU_BLOCK,
1298		PSECT_PTR : REF PSECT_BLOCK,
1299		TEMP_FLAGS;
1300	
1301	    IF (DEBUG GEQ 1)
1302	    THEN
1303		BEGIN
1304		PCRLF (1);
1305		OUTPUT (1, %O'11');
1306		OUTPUT (1, %O'11');
1307		OUTSTR (1, UPLIT (%ASCIZ'GLOBAL SYMBOL NAME, NAME = '));
1308		OUTSTR (1, .ASCPTR);
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1309		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1310		OUTNUM (1, .FLAGS, 8, 0);
1311		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
1312		OUTNUM (1, .VALUE, 8, 0);
1313		END;					!DEBUG
1314	
1315	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
1316	    THEN
1317		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME],
1318		    0, 0, 0)
1319	    ELSE
1320		BEGIN					!WE ARE PROCESSING A MODULE
1321		PSECT_PTR = .MODU_PTR [MODU_PSECT];
1322		GLOBAL_INFO [0] = .ASCPTR;
1323		GLOBAL_INFO [1] = .FLAGS;
1324		GLOBAL_INFO [2] = .VALUE;
1325	!
1326	! BE SURE THE GLOBAL IS NOT ALREADY CHAINED TO THE CURRENT MODULE.
1327	!
1328		GLOBL_PTR = FND_CHAIN (.MODU_PTR [MODU_GLOBALS], SEL_GLOBAL, GLOBAL_INFO);
1329	
1330		IF (.GLOBL_PTR NEQ 0)
1331		THEN
1332		    BEGIN				!ALREADY CHAINED
1333		    MODU_PTR1 = .GLOBL_PTR [GBL_DEF_MODU];
1334		    TEMP_FLAGS = .GLOBL_PTR [GBL_FLAGS];
1335		    ERRMSG (0, 13, GLOBL_PTR [GBL_NAME], MODU_PTR1 [MODU_NAME], 	!
1336			.GLOBL_PTR [GBL_VALUE] + 	!
1337			(IF (.TEMP_FLAGS<GBL_FLG_REL, 1> EQL 0) THEN 0 ELSE %O'200000'), 	!
1338			MODU_PTR [MODU_NAME], 		!
1339			.VALUE + (IF (.FLAGS<GBL_FLG_REL, 1> EQL 0) THEN 0 ELSE %O'200000'));
1340		    END
1341		ELSE
1342		    BEGIN				!NO PREVIOUS REFERENCE TO THIS SYMBOL
1343	
1344		    IF ((GLOBL_PTR = GETBLK (GLOBL_TYP, GLOBL_LEN)) EQL 0)
1345		    THEN
1346			ERRMSG (0, 1, ROUTINE_NAME, 0, 0,
1347			    0, 0)
1348		    ELSE
1349			BEGIN				!WE HAVE STORAGE FOR THE GLOBAL BLOCK
1350			CH$MOVE (LEN_GBL_NAME, CH$PTR (.ASCPTR), CH$PTR (GLOBL_PTR [GBL_NAME]));
1351			GLOBL_PTR [GBL_FLAGS] = .FLAGS;
1352			GLOBL_PTR [GBL_VALUE] = .VALUE;
1353			GLOBL_PTR [GBL_DEF_MODU] = .MODU_PTR;
1354	
1355			IF ((MODU_PTR [MODU_GLOBALS] = BLD_CHAIN (.MODU_PTR, .MODU_PTR [MODU_GLOBALS], .GLOBL_PTR))
1356			    EQL 0)
1357			THEN
1358			    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0);
1359	
1360			IF (.FLAGS<GBL_FLG_REL, 1> NEQ 0)
1361			THEN
1362			    BEGIN
1363			    GLOBL_PTR [GBL_DEF_PSECT] = .PSECT_PTR;
1364			    GLOBL_PTR [GBL_DEF_OFFSET] = .PSECT_PTR [PSECT_OFFSET];
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1365			    END;
1366	
1367			END;
1368	
1369		    END;
1370	
1371		END;
1372	
1373	    END;					!OF GSD_GSN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1374	ROUTINE SEL_PSECT (PSECT_PTR, PSECT_INFO) = 	!SELECT PROPER PSECT
1375	
1376	!++
1377	! FUNCTIONAL DESCRIPTION:
1378	!
1379	!	SELECT THE PSECT DESCRIBED FROM THE LIST OF ALL PSECTS.
1380	!	 USED IN A CALL TO FND_CHAIN.
1381	!
1382	! FORMAL PARAMETERS:
1383	!
1384	!	PSECT_PTR - POINTER TO PSECT TO TEST FOR SUITABILITY
1385	!	PSECT_INFO - INFORMATION ABOUT THE PSECT WE ARE LOOKING FOR
1386	!
1387	! IMPLICIT INPUTS:
1388	!
1389	!	NONE
1390	!
1391	! IMPLICIT OUTPUTS:
1392	!
1393	!	NONE
1394	!
1395	! ROUTINE VALUE:
1396	!
1397	!	POINTER TO THE PSECT, OR 0.
1398	!
1399	! SIDE EFFECTS
1400	!
1401	!	NONE
1402	!
1403	!--
1404	
1405	    BEGIN
1406	
1407	    MAP
1408		PSECT_PTR : REF PSECT_BLOCK,
1409		PSECT_INFO : REF VECTOR [3];
1410	
1411	!
1412	! THE PSECT_INFO VECTOR CONTAINS:
1413	!
1414	! 0: POINTER TO THE PSECT NAME, IN ASCII
1415	! 1: THE PSECT FLAGS
1416	! 2: THE MAXIMUM LENGTH OF THE PSECT
1417	!
1418	
1419	    IF (CH$NEQ (LEN_PSECT_NAME, CH$PTR (.PSECT_INFO [0]), LEN_PSECT_NAME, CH$PTR (PSECT_PTR [PSECT_NAME])))
1420	    THEN
1421		0
1422	    ELSE
1423		.PSECT_PTR
1424	
1425	    END;					!OF SEL_PSECT
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1426	ROUTINE GSD_PSN (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS PSECT NAME
1427	
1428	!++
1429	! FUNCTIONAL DESCRIPTION:
1430	!
1431	!	PROCESS THE PROGRAM SECTION NAME ENTRY OF THE GSD RECORD
1432	!
1433	! FORMAL PARAMETERS:
1434	!
1435	!	ASCPTR - POINTER TO NAME, IN ASCII
1436	!	FLAGS - THE FLAGS BYTE
1437	!	VALUE - THE VALUE WORD
1438	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1439	!
1440	! IMPLICIT INPUTS:
1441	!
1442	!	NONE
1443	!
1444	! IMPLICIT OUTPUTS:
1445	!
1446	!	ADDS THE PSECT NAME TO THE DATA STRUCTURE
1447	!
1448	! ROUTINE VALUE:
1449	!
1450	!	NONE
1451	!
1452	! SIDE EFFECTS
1453	!
1454	!	OBTAINS SPACE FROM THE FREE LIST
1455	!
1456	!--
1457	
1458	    BEGIN
1459	
1460	    BIND
1461		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_PSN');
1462	
1463	    MAP
1464		FILE_PTR : REF FILE_BLOCK;
1465	
1466	    LOCAL
1467		MODU_PTR : REF MODU_BLOCK,
1468		PSECT_PTR : REF PSECT_BLOCK,
1469		PSECT_INFO : VECTOR [3],
1470		SEARCH_DONE;
1471	
1472	    IF (DEBUG GEQ 1)
1473	    THEN
1474		BEGIN
1475		PCRLF (1);
1476		OUTPUT (1, %O'11');
1477		OUTPUT (1, %O'11');
1478		OUTSTR (1, UPLIT (%ASCIZ'PSECT NAME, NAME = '));
1479		OUTSTR (1, .ASCPTR);
1480		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1481		OUTNUM (1, .FLAGS, 8, 0);
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1482		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
1483		OUTNUM (1, .VALUE, 8, 0);
1484		END;					!DEBUG
1485	
1486	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
1487	    THEN
1488		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME],
1489		    0, 0, 0)
1490	    ELSE
1491		BEGIN					!WE ARE PROCESSING A MODULE
1492		PSECT_INFO [0] = .ASCPTR;
1493		PSECT_INFO [1] = .FLAGS;
1494		PSECT_INFO [2] = .VALUE;
1495	!
1496		PSECT_PTR = FND_CHAIN (.MODU_PTR [MODU_PSECTS], SEL_PSECT, PSECT_INFO);
1497	
1498		IF (.PSECT_PTR EQL 0)
1499		THEN
1500		    BEGIN				!FIRST REFERENCE TO THIS PSECT BY THIS MODULE
1501	
1502		    IF ((PSECT_PTR = GETBLK (PSECT_TYP, PSECT_LEN)) EQL 0)
1503		    THEN
1504			ERRMSG (0, 1, ROUTINE_NAME, 0, 0,
1505			    0, 0)
1506		    ELSE
1507			BEGIN				!WE HAVE STORAGE FOR THE PSECT BLOCK
1508			CH$MOVE (LEN_PSECT_NAME, CH$PTR (.ASCPTR), CH$PTR (PSECT_PTR [PSECT_NAME]));
1509			PSECT_PTR [PSECT_FLAGS] = .FLAGS;
1510			PSECT_PTR [PSECT_SIZE] = 0;
1511			PSECT_PTR [PSECT_OFFSET] = 0;
1512	
1513			IF ((MODU_PTR [MODU_PSECTS] = BLD_CHAIN (.MODU_PTR, .MODU_PTR [MODU_PSECTS], .PSECT_PTR)) EQL
1514			    0)
1515			THEN
1516			    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
1517			ELSE
1518			    PSECT_PTR = FND_CHAIN (.MODU_PTR [MODU_PSECTS], SEL_PSECT, PSECT_INFO);
1519	
1520			IF (.PSECT_PTR EQL 0)
1521			THEN
1522			    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
1523			ELSE
1524			    BEGIN
1525			    MODU_PTR [MODU_PSECT] = .PSECT_PTR;
1526			    PSECT_PTR [PSECT_OFFSET] = (IF (.FLAGS<PSECT_FLG_OVR, 1> NEQ 0) THEN 0 ELSE .PSECT_PTR [
1527				    PSECT_SIZE] + (IF ((.PSECT_PTR [PSECT_SIZE] MOD 2) EQL 0) THEN 0 ELSE 1));
1528			    PSECT_PTR [PSECT_SIZE] = (IF (.FLAGS<PSECT_FLG_OVR, 1> NEQ 0) THEN MAX (.PSECT_PTR [
1529					PSECT_SIZE], .VALUE) ELSE .PSECT_PTR [PSECT_SIZE] + .VALUE);
1530			    PSECT_PTR [PSECT_SECTOR] = .MODU_PTR [MODU_SECTOR];
1531	
1532			    IF ((MODU_PTR [MODU_SECTOR] = .MODU_PTR [MODU_SECTOR] + 1) GTR 255)
1533			    THEN
1534				ERRMSG (0, 10,
1535				    ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
1536	
1537			    END;
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1538	
1539			END;
1540	
1541		    END;				!OF FIRST REFERENCE TO THIS PSECT BY THIS MODULE
1542	
1543		IF (((.PSECT_PTR [PSECT_FLAGS] XOR .FLAGS) AND ((1^PSECT_FLG_HI) OR (1^PSECT_FLG_LIB) OR (1^
1544		    PSECT_FLG_OVR) OR (1^PSECT_FLG_RO) OR (1^PSECT_FLG_REL) OR (1^PSECT_FLG_GBL) OR (1^PSECT_FLG_DATA
1545		    ))) NEQ 0)
1546		THEN
1547		    ERRMSG (0, 15, ROUTINE_NAME, MODU_PTR [MODU_NAME], PSECT_PTR [PSECT_NAME],
1548			.PSECT_PTR [PSECT_FLAGS], .FLAGS);
1549	
1550		END;					!OF PROCESSING A MODULE
1551	
1552	    END;					!OF GSD_PSN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1553	ROUTINE GSD_IDENT (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS VERSION IDENT
1554	
1555	!++
1556	! FUNCTIONAL DESCRIPTION:
1557	!
1558	!	PROCESS THE PROGRAM VERSION IDENTIFICATION ENTRY OF THE
1559	!	 GSD RECORD.  THIS ENTRY IS PRODUCED BY THE ".IDENT"
1560	!	 ASSEMBLER DIRECTIVE.
1561	!
1562	! FORMAL PARAMETERS:
1563	!
1564	!	ASCPTR - POINTER TO NAME, IN ASCII
1565	!	FLAGS - THE FLAGS BYTE
1566	!	VALUE - THE VALUE WORD
1567	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1568	!
1569	! IMPLICIT INPUTS:
1570	!
1571	!	NONE
1572	!
1573	! IMPLICIT OUTPUTS:
1574	!
1575	!	ADDS THE IDENTIFICATION TO THE DATA STRUCTURE
1576	!
1577	! ROUTINE VALUE:
1578	!
1579	!	NONE
1580	!
1581	! SIDE EFFECTS
1582	!
1583	!	NONE
1584	!
1585	!--
1586	
1587	    BEGIN
1588	
1589	    BIND
1590		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_IDENT');
1591	
1592	    MAP
1593		FILE_PTR : REF FILE_BLOCK;
1594	
1595	    LOCAL
1596		MODU_PTR : REF MODU_BLOCK;
1597	
1598	    IF (DEBUG GEQ 1)
1599	    THEN
1600		BEGIN
1601		PCRLF (1);
1602		OUTPUT (1, %O'11');
1603		OUTPUT (1, %O'11');
1604		OUTSTR (1, UPLIT (%ASCIZ'PROGRAM VERSION IDENTIFICATION, NAME = '));
1605		OUTSTR (1, .ASCPTR);
1606		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1607		OUTNUM (1, .FLAGS, 8, 0);
1608		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1609		OUTNUM (1, .VALUE, 8, 0);
1610		END;					!DEBUG
1611	
1612	    IF ((MODU_PTR = .FILE_PTR [FILE_MODU]) EQL 0)
1613	    THEN
1614		ERRMSG (0, 10, ROUTINE_NAME, FILE_PTR [FILE_NAME],
1615		    0, 0, 0)
1616	    ELSE
1617		BEGIN					!THERE IS A MODULE BEING PROCESSED
1618		CH$MOVE (LEN_MODU_VER, CH$PTR (.ASCPTR), CH$PTR (MODU_PTR [MODU_IDENT]));
1619		MODU_PTR [MODU_FLAG_IDENT] = 1;
1620		END;
1621	
1622	    END;					!OF GSD_IDENT
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1623	ROUTINE GSD_MAP (ASCPTR, FLAGS, VALUE, FILE_PTR) : NOVALUE = 	!PROCESS MAPPED ARRAY
1624	
1625	!++
1626	! FUNCTIONAL DESCRIPTION:
1627	!
1628	!	PROCESS THE MAPPED ARRAY ENTRY OF THE GSD RECORD.
1629	!	 THIS IS NOT IMPLEMENTED SINCE IT IS NOT PRODUCED BY MACY11.
1630	!
1631	! FORMAL PARAMETERS:
1632	!
1633	!	ASCPTR - POINTER TO NAME, IN ASCII
1634	!	FLAGS - THE FLAGS BYTE
1635	!	VALUE - THE VALUE WORD
1636	!	FILE_PTR - POINTER TO THE FILE BLOCK FOR THE OBJECT FILE
1637	!
1638	! IMPLICIT INPUTS:
1639	!
1640	!	NONE
1641	!
1642	! IMPLICIT OUTPUTS:
1643	!
1644	!	NONE
1645	!
1646	! ROUTINE VALUE:
1647	!
1648	!	NONE
1649	!
1650	! SIDE EFFECTS
1651	!
1652	!	PRINTS AN ERROR MESSAGE
1653	!
1654	!--
1655	
1656	    BEGIN
1657	
1658	    BIND
1659		ROUTINE_NAME = UPLIT (%ASCIZ'GSD_MAP');
1660	
1661	    IF (DEBUG GEQ 1)
1662	    THEN
1663		BEGIN
1664		PCRLF (1);
1665		OUTPUT (1, %O'11');
1666		OUTPUT (1, %O'11');
1667		OUTSTR (1, UPLIT (%ASCIZ'MAPPED ARRAY DECLARATION, NAME = '));
1668		OUTSTR (1, .ASCPTR);
1669		OUTSTR (1, UPLIT (%ASCIZ', FLAGS = '));
1670		OUTNUM (1, .FLAGS, 8, 0);
1671		OUTSTR (1, UPLIT (%ASCIZ', VALUE = '));
1672		OUTNUM (1, .VALUE, 8, 0);
1673		END;					!DEBUG
1674	
1675	    ERRMSG (0, 12, ROUTINE_NAME, 0, 0, 0, 0);
1676	    END;					!OF GSD_MAP
1677	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1678	GLOBAL ROUTINE SYM_VAL (FILE_PTR, SYMBOL_NAME, ERR) = 	!GET VALUE OF NAMED SYMBOL
1679	
1680	!++
1681	! FUNCTIONAL DESCRIPTION:
1682	!
1683	!	GET THE VALUE OF A NAMED SYMBOL FROM A (SYMBOL TABLE) FILE
1684	!
1685	! FORMAL PARAMETERS:
1686	!
1687	!	FILE_PTR - THE FILE BLOCK THAT MAY HAVE THE SPECIFIED SYMBOL
1688	!	SYMBOL_NAME - NAME OF THE SYMBOL, SEVEN CHARACTERS, LAST NULL.
1689	!	ERR - 0 = PRINT ERROR MESSAGE IF NOT FOUND, 1 = JUST RETURN -1.
1690	!
1691	! IMPLICIT INPUTS:
1692	!
1693	!	NONE
1694	!
1695	! IMPLICIT OUTPUTS:
1696	!
1697	!	NONE
1698	!
1699	! ROUTINE VALUE:
1700	!
1701	!	VALUE OF THE SYMBOL, OR -1 IF UNDEFINED.
1702	!
1703	! SIDE EFFECTS
1704	!
1705	!	NONE
1706	!
1707	!--
1708	
1709	    BEGIN
1710	
1711	    BIND
1712		ROUTINE_NAME = UPLIT (%ASCIZ'SYMBOL_VALUE');
1713	
1714	    MAP
1715		FILE_PTR : REF FILE_BLOCK;
1716	
1717	    LOCAL
1718		GLOBL_PTR : REF GLOBL_BLOCK,
1719		MODU_PTR : REF MODU_BLOCK;
1720	
1721	    IF (.FILE_PTR EQL 0)
1722	    THEN
1723		BEGIN
1724		ERRMSG (0, 32, ROUTINE_NAME, .SYMBOL_NAME, FILE_PTR [FILE_NAME], 0, 0);
1725		-1
1726		END
1727	    ELSE
1728		BEGIN
1729		MODU_PTR = .FILE_PTR [FILE_MODU];
1730	
1731		IF (.MODU_PTR EQL 0)
1732		THEN
1733		    BEGIN
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1734		    ERRMSG (0, 32, ROUTINE_NAME, .SYMBOL_NAME, FILE_PTR [FILE_NAME], 0, 0);
1735		    -1
1736		    END
1737		ELSE
1738		    BEGIN
1739		    GLOBL_PTR = FND_CHAIN (.MODU_PTR [MODU_GLOBALS], SEL_SYMBOL, .SYMBOL_NAME);
1740	
1741		    IF (.GLOBL_PTR EQL 0)
1742		    THEN
1743			BEGIN
1744	
1745			IF (.ERR EQL 0) THEN ERRMSG (0, 32, ROUTINE_NAME, .SYMBOL_NAME, FILE_PTR [FILE_NAME], 0, 0);
1746	
1747			-1
1748			END
1749		    ELSE
1750			(GBL_VAL (.GLOBL_PTR)) AND %O'177777'
1751	
1752		    END
1753	
1754		END
1755	
1756	    END;					!OF SYM_VAL
1757	
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1758	ROUTINE SEL_SYMBOL (GLOBL_PTR, SYMBOL_NAME) = 	!SEE IF THIS IS THE TARGET SYMBOL
1759	
1760	!++
1761	! FUNCTIONAL DESCRIPTION:
1762	!
1763	!	SEE IF THIS IS THE SYMBOL WE ARE SEARCHING FOR.  USED IN
1764	!	 CALL TO FND_CHAIN.
1765	!
1766	! FORMAL PARAMETERS:
1767	!
1768	!	GLOBL_PTR - POINTER TO THE SYMBOL TO TEST
1769	!	SYMBOL_NAME - POINTER TO NAME OF SYMBOL WE ARE LOOKING FOR
1770	!
1771	! IMPLICIT INPUTS:
1772	!
1773	!	NONE
1774	!
1775	! IMPLICIT OUTPUTS:
1776	!
1777	!	NONE
1778	!
1779	! ROUTINE VALUE:
1780	!
1781	!	0 IF THIS IS NOT THE PROPER SYMBOL (WHICH WILL CAUSE FND_CHAIN
1782	!	 TO KEEP SEARCHING), OR THE POINTER TO THE GLOBAL BLOCK IF
1783	!	 THE NAME MATCHES.
1784	!
1785	! SIDE EFFECTS
1786	!
1787	!	NONE
1788	!
1789	!--
1790	
1791	    BEGIN
1792	
1793	    MAP
1794		GLOBL_PTR : REF GLOBL_BLOCK;
1795	
1796	    IF (CH$EQL (LEN_GBL_NAME, CH$PTR (GLOBL_PTR [GBL_NAME]), LEN_GBL_NAME, CH$PTR (.SYMBOL_NAME), 0))
1797	    THEN
1798		.GLOBL_PTR
1799	    ELSE
1800		0
1801	
1802	    END;					!OF SEL_SYMBOL
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1803	GLOBAL ROUTINE GBL_VAL (GLOBL_PTR) = 			!RETURN VALUE OF GLOBAL SYMBOL
1804	
1805	!++
1806	! FUNCTIONAL DESCRIPTION:
1807	!
1808	!	IF THE GLOBAL SYMBOL IS ABSOLUTE, JUST RETURN ITS VALUE CELL.
1809	!	 IF IT IS RELOCATABLE, WE MUST ADD TO THIS THE BASE OF THE
1810	!	 PSECT IT WAS DEFINED IN AND THE OFFSET INTO THAT PSECT AT
1811	!	 THE TIME OF THE DEFINITION.
1812	!	 AN UNDEFINED SYMBOL RETURNS ZERO AND GIVES AN ERROR MESSAGE.
1813	!
1814	! FORMAL PARAMETERS:
1815	!
1816	!	GLOBL_PTR - POINTER TO THE GLOBAL WHOSE VALUE IS TO BE RETURNED
1817	!
1818	! IMPLICIT INPUTS:
1819	!
1820	!	NONE
1821	!
1822	! IMPLICIT OUTPUTS:
1823	!
1824	!	NONE
1825	!
1826	! ROUTINE VALUE:
1827	!
1828	!	THE VALUE OF THE GLOBAL SYMBOL, WITH THE HIGH-ORDER BIT
1829	!	 SPREAD.
1830	!
1831	! SIDE EFFECTS
1832	!
1833	!	NONE
1834	!
1835	!--
1836	
1837	    BEGIN
1838	
1839	    MAP
1840		GLOBL_PTR : REF GLOBL_BLOCK;
1841	
1842	    LOCAL
1843		FLAGS,
1844		PSECT_PTR : REF PSECT_BLOCK,
1845		RESULT;
1846	
1847	    FLAGS = .GLOBL_PTR [GBL_FLAGS];
1848	
1849	    IF (.FLAGS<GBL_FLG_DEF, 1> EQL 0)
1850	    THEN
1851		BEGIN
1852		ERRMSG (0, 16, GLOBL_PTR [GBL_NAME], 0, 0, 0, 0);
1853		0
1854		END
1855	    ELSE
1856		BEGIN
1857	
1858		IF (.FLAGS<GBL_FLG_REL, 1> EQL 0)
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

1859		THEN
1860		    RESULT = .GLOBL_PTR [GBL_VALUE]
1861		ELSE
1862		    BEGIN
1863		    PSECT_PTR = .GLOBL_PTR [GBL_DEF_PSECT];
1864		    RESULT = .GLOBL_PTR [GBL_VALUE] + .PSECT_PTR [PSECT_BASE] + .GLOBL_PTR [GBL_DEF_OFFSET]
1865		    END;
1866	
1867		IF (.RESULT<15, 1> NEQ 0) THEN RESULT<16, 20> = -1;
1868	
1869		.RESULT
1870		END
1871	
1872	    END;					!OF GBL_VAL
1873	END
1874	
1875	ELUDOM
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

ASCPTR		 873	 924	 967	 978	1030	1042	1047
		1051	1060	1065	1111	1120	1172	1184
		1253	1308	1322	1350	1426	1479	1492
		1508	1553	1605	1618	1623	1668
ASCVAL		 351	 407	 408	 614	 646	 655	 658
		 661	 664	 667	 670	 673	 676
BLD_CHAIN	 125	 962	1355	1513
BLKPTR		 247	 284#	 292	 352	 371#	 373	 381
		 382	 443
BYTE1		 163	 167#	 169	 172	 182	 248	 287
		 289#	 292	 296
BYTE2		 164	 174#	 176	 179	 181
BYTECTR		 353	 382#	 388	 389	 416	 422	 425
		 428	 432	 454	 495	 498#	 508	 551
		 554#	 566	 625	 639	 644	 645	 647
		 648	 649	 683	 686	 735	 757	 799
		 804	 853
BYTEPTR		 354	 381#	 390	 416	 422	 425	 428
		 432	 454	 499	 508	 555	 556	 566
		 639	 644	 645	 647	 648	 649	 686
		 757	 804
BYTES_READ	 190	 255#	 261#	 290#	 355	 371
CHAN		 128	 167	 174	 190	 260	 289
CHAR		 356	 398#	 401	 405	 411	 612	 639#
CHKSUM		 128	 172#	 179#	 249	 260
CLOSE		 113	 449
COUNTER		 357	 389#	 396#
COUNT		 250	 285#	 287#
ERR		1678	1745
ERRMSG		 117	 268	 278	 299	 376	 438	 503
		 561	 634	 679	 740	 747	 802	 858
		 865	 941	 946	 958	 964	1118	1181
		1317	1335	1346	1358	1488	1504	1516
		1522	1534	1547	1614	1675	1724	1734
		1745	1852
ERROR		 116
ETYPE		 616	 648#	 651
FILE_BLOCK	 244	 348	 493	 546	 608	 724	 842
		 911	1018	1158	1291	1464	1593	1715
FILE_CHAN	 311	 364	 371	 449
FILE_DOWN	 962
FILE_ERROR	 915	 932#	 942#	 947#	 952
FILE_MODU	 628	 738	 856	 934	 968	1179	1315
		1486	1612	1729
FILE_NAME	 268	 299	 364	 376	 438	 503	 561
		 679	 740	 747	 858	 866	 941	 946
		1317	1488	1535	1614	1724	1734	1745
FILE_PTR	 190	 244	 268	 299	 311	 348	 364
		 371	 376	 416	 422	 425	 428	 432
		 438	 454	 493	 503	 508	 546	 561
		 566	 608	 628	 639	 644	 645	 647
		 648	 649	 655	 658	 661	 664	 667
		 670	 673	 676	 679	 686	 724	 738
		 740	 747	 757	 804	 842	 856	 858
		 866	 873	 911	 934	 941	 946	 962#
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

		 968#	 969	 978	1018	1047	1056	1060
		1065	1120	1158	1179	1253	1291	1315
		1317	1426	1464	1486	1488	1535	1553
		1593	1612	1614	1623	1678	1715	1721
		1724	1729	1734	1745
FLAGS		 615	 647#	 655	 658	 661	 664	 667
		 670	 673	 676	 873	 926	 978	1032
		1065	1113	1120	1174	1253	1310	1323
		1339	1351	1360	1426	1481	1493	1509
		1526	1528	1543	1548	1553	1607	1623
		1670	1843	1847#	1849	1858
FND_CHAIN	 126	1187	1328	1496	1518	1739
FRESTG		 119	 300	 443
GBL_DEF_MODU	1333	1353
GBL_DEF_OFFSET	1364	1864
GBL_DEF_PSECT	1363	1863
GBL_FLAGS	1334	1351	1847
GBL_FLG_DEF	1849
GBL_FLG_REL	1337	1339	1360	1858
GBL_NAME	1246	1335	1350	1796	1852
GBL_VAL		  76#	1750	1803*
GBL_VALUE	1336	1352	1860	1864
GETBLK		 124	 956	1344	1502
GETSTG		 118	 275
GET_BYTE	  58	 416	 454*	 639	 647	 648
GET_WORD	  59	 508*	 644	 645	 649
GLOBAL_INFO	1201	1236	1246	1295	1322#	1323#	1324#
		1328
GLOBAL_PTR	1201	1235	1246	1250
GLOBL_BLOCK	1235	1294	1718	1794	1840
GLOBL_LEN	1344
GLOBL_PTR	1294	1328#	1330	1333	1334	1335	1336
		1344#	1350	1351#	1352#	1353#	1355	1363#
		1364#	1718	1739#	1741	1750	1758	1794
		1796	1798	1803	1840	1847	1852	1860
		1863	1864
GLOBL_TYP	1344
GSD_CNAME	  64	 658	 978*
GSD_GSN		  68	 667	1253*
GSD_IDENT	  71	 673	1553*
GSD_ISN		  65	 661	1065*
GSD_MAP		  72	 676	1623*
GSD_MNAME	  63	 655	 873*
GSD_PSN		  70	 670	1047	1056	1060	1426*
GSD_TRA		  66	 664	1120*
INPUT		 114	 167	 174	 289
LEN_GBL_NAME	1246	1350	1796
LEN_MODU_NAME	 967
LEN_MODU_VER	1618
LEN_PSECT_NAME	 351	 614	1042	1051	1419	1508
MODU_BLOCK	 611	 727	 845	 914	1021	1161	1296
		1297	1467	1596	1719
MODU_FLAG_EGSD	 632	 745	 751	 863
MODU_FLAG_ENDED	 632	 863	 868	 938
MODU_FLAG_IDENT	1619
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

MODU_GLOBALS	1328	1355	1739
MODU_IDENT	1618
MODU_LEN	 956
MODU_NAME	 967	1335	1338	1547
MODU_OBJ_FILE	 969
MODU_PSECTS	1187	1496	1513	1518
MODU_PSECT	1321	1525
MODU_PTR	 611	 628#	 632	 727	 738#	 745	 751#
		 845	 856#	 863	 868#	 914	 934#	 938
		 956#	 962	 967	 968	 969#	 970#	1021
		1161	1179#	1187	1191#	1194#	1195#	1296
		1315#	1321	1328	1338	1353	1355#	1467
		1486#	1496	1513#	1518	1525#	1530	1532#
		1547	1596	1612#	1618	1619#	1719	1729#
		1731	1739
MODU_PTR1	1297	1333#	1335
MODU_SECTOR	 970	1530	1532
MODU_TYP	 956
MODU_XFR_OFFSET	1191	1195
MODU_XFR_PSECT	1194
OBJ_END_GSD	  61	 425	 686*
OBJ_EOM		  62	 432	 804*
OBJ_GSD		  60	 422	 566*
OBJ_ISD		  73	 428	 757*
OPEN		 112*	 364
OUTLEN		 251	 256#	 258	 260#	 264	 268	 275
		 282	 283	 287
OUTNUM		 121	 388	 401	 625	 735	 799	 853
		 926	 928	1032	1034	1113	1115	1174
		1176	1310	1312	1481	1483	1607	1609
		1670	1672
OUTPUT		 115	 402	 623	 733	 797	 851	 921
		 922	1027	1028	1108	1109	1169	1170
		1305	1306	1476	1477	1602	1603	1665
		1666
OUTSTR		 122	 400	 408	 624	 734	 798	 852
		 923	 924	 925	 927	1029	1030	1031
		1033	1110	1111	1112	1114	1171	1172
		1173	1175	1307	1308	1309	1311	1478
		1479	1480	1482	1604	1605	1606	1608
		1667	1668	1669	1671
PCRLF		 120	 387	 399	 622	 732	 796	 850
		 920	1026	1107	1168	1304	1475	1601
		1664
POINTER		 358	 390#	 398
PREV_CHAR	 359	 391#	 392#	 393#	 403	 404	 406
		 409#	 410#	 411#
PSECT_BASE	1864
PSECT_BLOCK	1162	1298	1408	1468	1844
PSECT_FLAGS	1509	1543	1548
PSECT_FLG_DATA	1544
PSECT_FLG_GBL	1056	1060	1544
PSECT_FLG_HI	1543
PSECT_FLG_LIB	1543
PSECT_FLG_OVR	1056	1060	1526	1528	1544
		DSK:RSTB.XRF[4,31]               31-Aug-79 14:58

PSECT_FLG_REL	1047	1060	1544
PSECT_FLG_RO	1544
PSECT_INFO	1163	1184#	1185#	1186#	1187	1374	1409
		1419	1469	1492#	1493#	1494#	1496	1518
PSECT_LEN	1502
PSECT_NAME	1419	1508	1547
PSECT_OFFSET	1195	1364	1511	1526
PSECT_PTR	1162	1187#	1189	1194	1195	1298	1321#
		1363	1364	1374	1408	1419	1423	1468
		1496#	1498	1502#	1508	1509#	1510#	1511#
		1513	1518#	1520	1525	1526#	1527	1528#
		1529	1530#	1543	1547	1548	1844	1863#
		1864
PSECT_SECTOR	1530
PSECT_SIZE	1510	1527	1528	1529
PSECT_TYP	1502
R50TOA		 123	 407	 646
R50VAL		 360	 394#	 403#	 404#	 405#	 406#	 407
		 613	 643#	 644#	 645#	 646
RD16		  55	 128*	 260
RDLBBL		  56	 190*	 371
READ_DONE	 361	 367#	 377#	 433#	 439#	 447
RECORD_TYPE	 362	 416#	 418
RESULT		 165	 180#	 181#	 182#	 183	 252	 254#
		 270#	 275#	 282#	 283#	 284	 300	 301#
		 308	 549	 555#	 556#	 557	1845	1860#
		1864#	1867#	1869
ROUTINE_NAME	 241#	 268	 278	 299	 345#	 376	 438
		 490#	 503	 543#	 561	 605#	 635	 679
		 721#	 740	 747	 791#	 802	 839#	 858
		 866	 908#	 941	 946	 958	 964	1015#
		1102#	1118	1155#	1181	1288#	1317	1346
		1358	1461#	1488	1504	1516	1522	1535
		1547	1590#	1614	1659#	1675	1712#	1724
		1734	1745
RSTB		   2#	  57	 311*
SEARCH_DONE	1470
SEL_GLOBAL	  67	1201*	1328
SEL_PSECT	  69	1187	1374*	1496	1518
SEL_SYMBOL	  75	1739	1758*
SYMBOL_NAME	1678	1724	1734	1739	1745	1758	1796
SYM_VAL		  74	1678*
TEMP_FLAGS	1299	1334#	1337
VALUE		 617	 649#	 655	 658	 661	 664	 667
		 670	 673	 676	 873	 928	 978	1034
		1047	1056	1060	1065	1115	1120	1176
		1191	1195	1253	1312	1324	1339	1352
		1426	1483	1494	1529	1553	1609	1623
		1672