Google
 

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

   1	!<SAUTER.TKB20>WSTB.BLI.9, 20-Nov-78 06:59:26, Edit by SROBINSON
   2	MODULE WSTB (					!WRITE STB FILE
   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: TKB-20
  31	!
  32	! ABSTRACT:
  33	!
  34	!
  35	! THIS MODULE WRITES THE 'STB' FILE, WHICH CONTAINS THE SYMBOL
  36	!  DEFINITIONS.
  37	!
  38	!
  39	! ENVIRONMENT: TOPS-20 USER MODE
  40	!
  41	! AUTHOR: J. SAUTER, CREATION DATE: 16-MAR-78
  42	!
  43	! MODIFIED BY:
  44	!
  45	!	, : VERSION
  46	! 01	-
  47	!--
  48	
  49	!<BLF/PAGE>
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

  50	!
  51	! TABLE OF CONTENTS:
  52	!
  53	
  54	FORWARD ROUTINE
  55	    WR_REC : NOVALUE,				!WRITE RECORD
  56	    WR_GSD : NOVALUE,				!PUT GSD IN BUFFER
  57	    WSTB : NOVALUE;				!WRITE STB FILE
  58	
  59	!
  60	! INCLUDE FILES
  61	!
  62	
  63	LIBRARY 'VNP-LIB.L36';
  64	
  65	!REQUIRE 'BLOCKH.REQ';				!PREPARE TO DEFINE STORAGE BLOCKS
  66	!REQUIRE 'FILE.REQ';				!FILE DATA BLOCK
  67	!REQUIRE 'FILSW.REQ';				!SWITCH STORAGE BLOCK
  68	!REQUIRE 'GLOBL.REQ';				!GLOBAL STORAGE BLOCK
  69	!REQUIRE 'MODU.REQ';				!MODULE STORAGE BLOCK
  70	!REQUIRE 'PSECT.REQ';				!PSECT STORAGE BLOCK
  71	!REQUIRE 'BLOCKT.REQ';				!END OF STORAGE BLOCK DEFINITIONS
  72	
  73	!
  74	! MACROS:
  75	!
  76	!	NONE
  77	!
  78	! EQUATED SYMBOLS:
  79	!
  80	
  81	LITERAL
  82	    DEBUG = 0,
  83	    LEN_STB_BUF = %O'172';
  84	
  85	!
  86	! OWN STORAGE:
  87	!
  88	!	NONE
  89	!
  90	! EXTERNAL REFERENCES:
  91	!
  92	
  93	EXTERNAL ROUTINE
  94	    ATOR50 : NOVALUE,				!ASCII TO RADIX50_11
  95	    ERRMSG : NOVALUE,				!TYPE AN ERROR MESSAGE
  96	    ERROR : NOVALUE,				!SIGNAL AN INTERNAL ERROR
  97	    FND_CHAIN,					!FIND A BLOCK IN A CHAIN
  98	    FRESTG,					!FREE STORAGE
  99	    GBL_VAL,					!GET VALUE OF GLOBAL
 100	    GETSTG,					!GET STORAGE
 101	    OUTNUM : NOVALUE,				!WRITE A NUMBER ON A FILE
 102	    OUTPUT : NOVALUE;				!WRITE ON A FILE
 103	
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 104	ROUTINE WR_REC (CHAN, RECBUF) : NOVALUE = 	!WRITE RECORD
 105	
 106	!++
 107	! FUNCTIONAL DESCRIPTION:
 108	!
 109	!
 110	!	ROUTINE TO WRITE A RECORD FROM THE RECORD BUFFER.  THE FIRST
 111	!	 WORD IS THE NUMBER OF BYTES TO WRITE, IN ADDITION TO THE
 112	!	 COUNT BYTE.
 113	!
 114	!
 115	! FORMAL PARAMETERS:
 116	!
 117	!	CHAN - CHANNEL ON WHICH TO WRITE THE RECORD FILE
 118	!	RECBUF - RECORD BUFFER, ONE BYTE PER WORD
 119	!
 120	! IMPLICIT INPUTS:
 121	!
 122	!	NONE
 123	!
 124	! IMPLICIT OUTPUTS:
 125	!
 126	!	NONE
 127	!
 128	! ROUTINE VALUE:
 129	!
 130	!	NONE
 131	!
 132	! SIDE EFFECTS
 133	!
 134	!	WRITES ON THE SPECIFIED FILE
 135	!
 136	!--
 137	
 138	    BEGIN
 139	
 140	    BIND
 141		ROUTINE_NAME = UPLIT (%ASCIZ'WR_REC');
 142	
 143	    MAP
 144		RECBUF : REF VECTOR;
 145	
 146	    LOCAL
 147		LEN;
 148	
 149	    LEN = .RECBUF [0];
 150	    OUTPUT (.CHAN, .LEN);
 151	    OUTPUT (.CHAN, 0);
 152	
 153	    INCR COUNTER FROM 1 TO .LEN DO
 154		OUTPUT (.CHAN, .RECBUF [.COUNTER]);
 155	
 156	    RECBUF [0] = 0;
 157	    END;					!OF WR_REC
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 158	ROUTINE WR_GSD (CHAN, RECBUF, GSD_BUF) : NOVALUE = 	!WRITE A GSD ENTRY
 159	
 160	!++
 161	! FUNCTIONAL DESCRIPTION:
 162	!
 163	!
 164	!	ROUTINE TO PLACE A GSD ENTRY IN THE RECORD BUFFER.  IF THE
 165	!	 BUFFER WOULD OVERFLOW IT IS WRITTEN FIRST.
 166	!
 167	!
 168	!
 169	! FORMAL PARAMETERS:
 170	!
 171	!	CHAN - CHANNEL ON WHICH TO WRITE THE STB FILE
 172	!	RECBUF - BUFFER WHICH HOLDS THE RECORD BEING BUILT
 173	!	GSD_BUF - POINTER TO GSD BUFFER, ONE BYTE PER WORD
 174	!
 175	! IMPLICIT INPUTS:
 176	!
 177	!	NONE
 178	!
 179	! IMPLICIT OUTPUTS:
 180	!
 181	!	NONE
 182	!
 183	! ROUTINE VALUE:
 184	!
 185	!	NONE
 186	!
 187	! SIDE EFFECTS
 188	!
 189	!	MAY CALL WR_REC, WHICH WRITES ON THE SPECIFIED FILE
 190	!
 191	!--
 192	
 193	    BEGIN
 194	
 195	    BIND
 196		ROUTINE_NAME = UPLIT (%ASCIZ'WR_GSD');
 197	
 198	    MAP
 199		RECBUF : REF VECTOR,
 200		GSD_BUF : REF VECTOR;
 201	
 202	    LOCAL
 203		LEN;
 204	
 205	    IF ((.RECBUF [0] + 8) GTR LEN_STB_BUF) THEN WR_REC (.CHAN, .RECBUF);
 206	
 207	    IF ((LEN = .RECBUF [0]) EQL 0)
 208	    THEN
 209		BEGIN
 210	!
 211	! WE JUST WROTE THE RECORD, OR THIS IS THE FIRST CALL TO WR_GSD
 212	!
 213		RECBUF [1] = 1;				!FLAG GSD RECORD
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 214		RECBUF [2] = 0;
 215		RECBUF [0] = 2;
 216		LEN = 2;
 217		END;
 218	
 219	    INCR COUNTER FROM 1 TO 8 DO
 220		RECBUF [.LEN + .COUNTER] = .GSD_BUF [.COUNTER - 1];
 221	
 222	    RECBUF [0] = .LEN + 8;
 223	    END;					!OF WR_GSD
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 224	ROUTINE SEL_MODU (MODU_PTR, UNUSED) = 		!FIND A MODULE WITH AN IDENT
 225	
 226	!++
 227	! FUNCTIONAL DESCRIPTION:
 228	!
 229	!
 230	!	ROUTINE TO SELECT A MODULE WITH AN IDENT
 231	!
 232	!
 233	! FORMAL PARAMETERS:
 234	!
 235	!	MODU_PTR - POINTER TO MODULE BLOCK
 236	!	UNUSED - PASSED FROM CALL TO FND_CHAIN, NOT USED.
 237	!
 238	! IMPLICIT INPUTS:
 239	!
 240	!	NONE
 241	!
 242	! IMPLICIT OUTPUTS:
 243	!
 244	!	NONE
 245	!
 246	! ROUTINE VALUE:
 247	!
 248	!	POINTER TO THE MODULE BLOCK IF IT HAS AN IDENT, OTHERWISE
 249	!	 0.
 250	!
 251	! SIDE EFFECTS
 252	!
 253	!	NONE
 254	!
 255	!--
 256	
 257	    BEGIN
 258	
 259	    MAP
 260		MODU_PTR : REF MODU_BLOCK;
 261	
 262	    IF (.MODU_PTR [MODU_FLAG_IDENT] NEQ 0) THEN .MODU_PTR ELSE 0
 263	
 264	    END;					!OF SEL_MODU
 265	
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 266	GLOBAL ROUTINE WSTB (CHAN, MODU_CHAIN, PSECT_PTR, GLOBL_PTR, FILE_PTR) : NOVALUE = 	!WRITE STB FILE
 267	
 268	!++
 269	! FUNCTIONAL DESCRIPTION:
 270	!
 271	!
 272	!	ROUTINE TO WRITE THE STB FILE.  THE FILE IS WRITTEN IN OBJECT
 273	!	 FILE FORMAT.  IT CONTAINS ONLY THE MODULE NAME, THE IDENT
 274	!	 AND THE DEFINITIONS OF THE GLOBAL SYMBOLS.  AT THE END IS
 275	!	 AN END GSD RECORD FOLLOWED BY AN END MODULE RECORD.
 276	!
 277	!
 278	! FORMAL PARAMETERS:
 279	!
 280	!	CHAN - CHANNEL ON WHICH TO WRITE THE STB FILE
 281	!	MODU_CHAIN - CHAIN TO ALL MODULES
 282	!	PSECT_PTR - POINTER TO FIRST PSECT
 283	!	GLOBL_PTR - POINTER TO FIRST GLOBAL
 284	!	FILE_PTR - POINTER TO STB FILE BLOCK
 285	!
 286	! IMPLICIT INPUTS:
 287	!
 288	!	NONE
 289	!
 290	! IMPLICIT OUTPUTS:
 291	!
 292	!	NONE
 293	!
 294	! ROUTINE VALUE:
 295	!
 296	!	NONE
 297	!
 298	! SIDE EFFECTS
 299	!
 300	!	WRITES ON THE SPECIFIED FILE
 301	!
 302	!--
 303	
 304	    BEGIN
 305	
 306	    BIND
 307		ROUTINE_NAME = UPLIT (%ASCIZ'WSTB');
 308	
 309	    MAP
 310		FILE_PTR : REF FILE_BLOCK,
 311		GLOBL_PTR : REF GLOBL_BLOCK,
 312		PSECT_PTR : REF PSECT_BLOCK;
 313	
 314	    LOCAL
 315		GLOBAL_VALUE,
 316		GLOBL_PTR1 : REF GLOBL_BLOCK,
 317		GSD_BUF : REF VECTOR,
 318		MODU_PTR : REF MODU_BLOCK,
 319		REC_BUF : REF VECTOR,
 320		SEARCH_DONE;
 321	
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 322	    IF ((REC_BUF = GETSTG (LEN_STB_BUF + 1)) EQL 0)
 323	    THEN
 324		ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 325	    ELSE
 326		BEGIN
 327	
 328		IF ((GSD_BUF = GETSTG (8)) EQL 0)
 329		THEN
 330		    ERRMSG (0, 1, ROUTINE_NAME, 0, 0, 0, 0)
 331		ELSE
 332		    BEGIN
 333		    REC_BUF [0] = 0;
 334	!
 335	! THE MODULE NAME AND IDENT COME FROM THE FIRST MODULE
 336	!  WITH A NON-BLANK IDENT
 337	!
 338		    MODU_PTR = FND_CHAIN (.MODU_CHAIN, SEL_MODU, 0);
 339	
 340		    IF (.MODU_PTR NEQ 0)
 341		    THEN
 342			BEGIN
 343			ATOR50 (MODU_PTR [MODU_NAME], .GSD_BUF);
 344			GSD_BUF [4] = 0;
 345			GSD_BUF [5] = 0;
 346			GSD_BUF [6] = 0;
 347			GSD_BUF [7] = 0;
 348			WR_GSD (.CHAN, .REC_BUF, .GSD_BUF);
 349			ATOR50 (MODU_PTR [MODU_IDENT], .GSD_BUF);
 350			GSD_BUF [4] = 0;
 351			GSD_BUF [5] = 6;
 352			GSD_BUF [6] = 0;
 353			GSD_BUF [7] = 0;
 354			WR_GSD (.CHAN, .REC_BUF, .GSD_BUF);
 355			END
 356		    ELSE
 357			BEGIN
 358	!
 359	! THERE IS NO MODULE WITH AN IDENT.  THEREFORE WE TAKE THE MODULE
 360	!  NAME FROM THE NAME OF THE TASK FILE, AND PROVIDE NO IDENT.
 361	!
 362			ATOR50 (FILE_PTR [FILE_NAME], .GSD_BUF);
 363			GSD_BUF [4] = 0;
 364			GSD_BUF [5] = 0;
 365			GSD_BUF [6] = 0;
 366			GSD_BUF [7] = 0;
 367			WR_GSD (.CHAN, .REC_BUF, .GSD_BUF);
 368			END;
 369	
 370		    GLOBL_PTR1 = .GLOBL_PTR;
 371	
 372		    WHILE (.GLOBL_PTR1 NEQ 0) DO
 373			BEGIN
 374			ATOR50 (GLOBL_PTR1 [GBL_NAME], .GSD_BUF);
 375			GSD_BUF [4] = .GLOBL_PTR1 [GBL_FLAGS] AND ( NOT (1^GBL_FLG_REL));
 376			GSD_BUF [5] = 4;
 377			GLOBAL_VALUE = GBL_VAL (.GLOBL_PTR1);
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

 378			GSD_BUF [6] = .GLOBAL_VALUE<0, 8>;
 379			GSD_BUF [7] = .GLOBAL_VALUE<8, 8>;
 380			WR_GSD (.CHAN, .REC_BUF, .GSD_BUF);
 381			GLOBL_PTR1 = .GLOBL_PTR1 [GBL_NEXT];
 382			END;
 383	
 384	!
 385	! FINISH OFF THIS RECORD
 386	!
 387		    WR_REC (.CHAN, .REC_BUF);
 388	!
 389	! END WITH END GSD FOLLOWED BY END MODULE
 390	!
 391		    REC_BUF [0] = 2;
 392		    REC_BUF [1] = 2;
 393		    REC_BUF [2] = 0;
 394		    WR_REC (.CHAN, .REC_BUF);
 395		    REC_BUF [0] = 2;
 396		    REC_BUF [1] = 6;
 397		    REC_BUF [2] = 0;
 398		    WR_REC (.CHAN, .REC_BUF);
 399		    FRESTG (.REC_BUF, LEN_STB_BUF + 1);
 400		    FRESTG (.GSD_BUF, 8);
 401		    END;
 402	
 403		END;
 404	
 405	    END;					!OF WSTB
 406	
 407	END
 408	
 409	ELUDOM
 410	! Local Modes:
 411	! Comment Start:!
 412	! Comment Column:36
 413	! Auto Save Mode:2
 414	! Mode:Fundamental
 415	! End:
		DSK:WSTB.XRF[4,31]               31-Aug-79 15:06

ATOR50		  94*	 343	 349	 362	 374
CHAN		 104	 150	 151	 154	 158	 205	 266
		 348	 354	 367	 380	 387	 394	 398
COUNTER		 153	 154	 219	 220
ERRMSG		  95	 324	 330
ERROR		  96
FILE_BLOCK	 310
FILE_NAME	 362
FILE_PTR	 266	 310	 362
FND_CHAIN	  97	 338
FRESTG		  98	 399	 400
GBL_FLAGS	 375
GBL_FLG_REL	 375
GBL_NAME	 374
GBL_NEXT	 381
GBL_VAL		  99	 377
GETSTG		 100	 322	 328
GLOBAL_VALUE	 315	 377#	 378	 379
GLOBL_BLOCK	 311	 316
GLOBL_PTR	 266	 311	 370
GLOBL_PTR1	 316	 370#	 372	 374	 375	 377	 381#
GSD_BUF		 158	 200	 220	 317	 328#	 343	 344#
		 345#	 346#	 347#	 348	 349	 350#	 351#
		 352#	 353#	 354	 362	 363#	 364#	 365#
		 366#	 367	 374	 375#	 376#	 378#	 379#
		 380	 400
LEN		 147	 149#	 150	 153	 203	 207#	 216#
		 220	 222
LEN_STB_BUF	  83#	 205	 322	 399
MODU_BLOCK	 260	 318
MODU_CHAIN	 266	 338
MODU_FLAG_IDENT	 262
MODU_IDENT	 349
MODU_NAME	 343
MODU_PTR	 224	 260	 262	 318	 338#	 340	 343
		 349
OUTNUM		 101
OUTPUT		 102	 150	 151	 154
PSECT_BLOCK	 312
PSECT_PTR	 266	 312
RECBUF		 104	 144	 149	 154	 156#	 158	 199
		 205	 207	 213#	 214#	 215#	 220#	 222#
REC_BUF		 319	 322#	 333#	 348	 354	 367	 380
		 387	 391#	 392#	 393#	 394	 395#	 396#
		 397#	 398	 399
ROUTINE_NAME	 141#	 196#	 307#	 324	 330
SEARCH_DONE	 320
SEL_MODU	 224*	 338
UNUSED		 224
WR_GSD		  56	 158*	 348	 354	 367	 380
WR_REC		  55	 104*	 205	 387	 394	 398
WSTB		   2#	  57#	 266*