Google
 

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

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

  55	!
  56	! TABLE OF CONTENTS:
  57	!
  58	
  59	FORWARD ROUTINE
  60	    SEL_INPUT,					!SELECT AN INPUT FILE
  61	    SEL_OUTPUT,					!SELECT AN OUTPUT FILE
  62	    TKB20 : NOVALUE;				!MAIN PROGRAM
  63	
  64	!
  65	! INCLUDE FILES:
  66	!
  67	
  68	LIBRARY 'VNP-LIB.L36';
  69	
  70	!REQUIRE 'BLOCKH.REQ';				!PREPARE TO DEFINE STORAGE BLOCKS
  71	!REQUIRE 'FILE.REQ';				!DEFINE FILE BLOCK
  72	!REQUIRE 'FILSW.REQ';				!DEFINE FILE SWITCHES
  73	!REQUIRE 'ROOT.REQ';				!ROOT BLOCK FOR TASK BUILDER
  74	!REQUIRE 'BLOCKT.REQ';				!END OF DEFINING STORAGE BLOCKS
  75	!
  76	! MACROS:
  77	!
  78	!	NONE
  79	!
  80	! EQUATED SYMBOLS:
  81	!
  82	
  83	LITERAL
  84	    DEBUG = 1;
  85	
  86	!
  87	! OWN STORAGE:
  88	!
  89	
  90	GLOBAL
  91	    ROOT : REF ROOT_BLOCK;
  92	
  93	!
  94	! EXTERNAL REFERENCES:
  95	!
  96	
  97	EXTERNAL ROUTINE
  98	    BCOR : NOVALUE,				!BUILD CORE IMAGE
  99	    ERROR : NOVALUE,				!SIGNAL PROGRAMMING ERROR
 100	    GET_SW,					!GET A SWITCH AND VALUE
 101	    OPEN,					!OPEN A FILE
 102	    ERRMSG : NOVALUE,				!ERROR MESSAGE
 103	    GETSTG,					!GET STORAGE
 104	    CLOSE : NOVALUE,				!CLOSE A FILE
 105	    CMDLIN,					!READ A COMMAND LINE
 106	    GLOB,					!PRINT GLOBAL MAP
 107	    RDFILE,					!READ THE OBJECT FILE
 108	    RDLIBR,					!READ AN OBJECT LIBRARY
 109	    INISTG : NOVALUE,				!INITIALIZE STORAGE MANAGER
 110	    FND_CHAIN,					!FIND A BLOCK IN A CHAIN
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 111	    GETBLK,					!GET A STORAGE BLOCK
 112	    WTSK : NOVALUE,				!WRITE TASK FILE
 113	    WSTB : NOVALUE,				!WRITE STB FILE
 114	    RESET_ALL;					!RESET ALL I/O
 115	
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 116	ROUTINE SEL_INPUT (FILE_PTR, UNUSED) = 		!SELECT AN INPUT FILE
 117	
 118	!++
 119	! FUNCTIONAL DESCRIPTION:
 120	!
 121	!	SELECT AN INPUT FILE.  USED IN CALL TO FND_CHAIN.
 122	!
 123	! FORMAL PARAMETERS:
 124	!
 125	!	FILE_PTR - POINTER TO A FILE BLOCK TO BE TESTED.
 126	!	UNUSED - ARGUMENT FROM CALLER OF FND_CHAIN, NOT USED.
 127	!
 128	! IMPLICIT INPUTS:
 129	!
 130	!	NONE
 131	!
 132	! IMPLICIT OUTPUTS:
 133	!
 134	!	NONE
 135	!
 136	! ROUTINE VALUE:
 137	!
 138	!	0 IF THIS CANNOT BE AN INPUT FILE (WHICH WILL CAUSE FND_CHAIN
 139	!	 TO KEEP SEARCHING), OR THE POINTER TO THE FILE BLOCK IF
 140	!	 IT CAN BE AN INPUT FILE.
 141	!
 142	! SIDE EFFECTS
 143	!
 144	!	NONE
 145	!
 146	!--
 147	
 148	    BEGIN
 149	
 150	    MAP
 151		FILE_PTR : REF FILE_BLOCK;
 152	
 153	!
 154	
 155	    IF (.FILE_PTR [FILE_FLAG_IND] NEQ 0)
 156	    THEN
 157		BEGIN					!INDIRECT FILE
 158		FND_CHAIN (.FILE_PTR [FILE_DOWN], SEL_INPUT, 0)
 159		END
 160	    ELSE
 161		BEGIN
 162	
 163		IF (.FILE_PTR [FILE_FLAG_OUT] EQL 0) THEN .FILE_PTR ELSE 0
 164	
 165		END
 166	
 167	    END;					!OF SEL_INPUT
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 168	ROUTINE SEL_OUTPUT (FILE_PTR, UNUSED) = 	!SELECT AN OUTPUT FILE
 169	
 170	!++
 171	! FUNCTIONAL DESCRIPTION:
 172	!
 173	!	SELECT AN OUTPUT FILE.  USED IN CALL TO FND_CHAIN.
 174	!
 175	! FORMAL PARAMETERS:
 176	!
 177	!	FILE_PTR - POINTER TO A FILE BLOCK TO BE TESTED.
 178	!	UNUSED - ARGUMENT FROM CALLER OF FND_CHAIN, NOT USED.
 179	!
 180	! IMPLICIT INPUTS:
 181	!
 182	!	NONE
 183	!
 184	! IMPLICIT OUTPUTS:
 185	!
 186	!	NONE
 187	!
 188	! ROUTINE VALUE:
 189	!
 190	!	0 IF THIS CANNOT BE AN OUTPUT FILE (WHICH WILL CAUSE FND_CHAIN
 191	!	 TO KEEP SEARCHING), OR THE POINTER TO THE FILE BLOCK IF
 192	!	 IT CAN BE AN OUTPUT FILE.
 193	!
 194	! SIDE EFFECTS
 195	!
 196	!	NONE
 197	!
 198	!--
 199	
 200	    BEGIN
 201	
 202	    MAP
 203		FILE_PTR : REF FILE_BLOCK;
 204	
 205	!
 206	
 207	    IF (.FILE_PTR [FILE_FLAG_IND] NEQ 0)
 208	    THEN
 209		BEGIN					!INDIRECT FILE
 210		FND_CHAIN (.FILE_PTR [FILE_DOWN], SEL_OUTPUT, 0)
 211		END
 212	    ELSE
 213		BEGIN
 214	
 215		IF (.FILE_PTR [FILE_FLAG_IN] EQL 0) THEN .FILE_PTR ELSE 0
 216	
 217		END
 218	
 219	    END;					!OF SEL_OUTPUT
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 220	ROUTINE TKB20 : NOVALUE = 			!MAIN PGM
 221	
 222	!++
 223	! FUNCTIONAL DESCRIPTION:
 224	!
 225	!	TOP LEVEL PROGRAM FOR THE TASK BUILDER
 226	!
 227	! FORMAL PARAMETERS:
 228	!
 229	!	NONE
 230	!
 231	! IMPLICIT INPUTS:
 232	!
 233	!	NONE
 234	!
 235	! IMPLICIT OUTPUTS:
 236	!
 237	!	NONE
 238	!
 239	! ROUTINE VALUE:
 240	!
 241	!	NONE
 242	!
 243	! SIDE EFFECTS
 244	!
 245	!	WRITES OUT THE VARIOUS FILES WHICH REPRESENT AN RSX-11M TASK
 246	!
 247	!--
 248	
 249	    BEGIN
 250	
 251	    BIND
 252		ROUTINE_NAME = UPLIT (%ASCIZ'TKB20');
 253	
 254	    LOCAL
 255		FAKE_FILE_PTR : REF FILE_BLOCK,
 256		FILE_PTR : REF FILE_BLOCK,
 257		MAP_CHAN,
 258		MAP_FILE : REF FILE_BLOCK,
 259		SEARCH_DONE,
 260		STACK_BASE,
 261		STB_CHAN,
 262		STB_FILE : REF FILE_BLOCK,
 263		TASK_CHAN,
 264		TASK_FILE : REF FILE_BLOCK;
 265	
 266	    RESET_ALL ();				!RESET ALL I/O
 267	    INISTG (2000);				!INITIALIZE STORAGE MANAGER
 268	!
 269	! GET STORAGE FOR THE BLOCK THAT LIVES AT THE ROOT OF THE
 270	!  DATA STRUCTURE.
 271	!
 272	    ROOT = GETBLK (ROOT_TYP, ROOT_LEN);
 273	!
 274	! GET STORAGE FOR THE FAKE FILE BLOCK THAT THE FILES GROW FROM
 275	!
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 276	    FAKE_FILE_PTR = GETBLK (FILE_TYP, FILE_LEN);
 277	    FAKE_FILE_PTR [FILE_HIGH] = .ROOT;
 278	    FAKE_FILE_PTR [FILE_FLAG_FAKE] = 1;
 279	    ROOT [ROOT_TOP_FILE] = .FAKE_FILE_PTR;
 280	!
 281	! SCAN A COMMAND
 282	!
 283	
 284	    IF (CMDLIN (0, .FAKE_FILE_PTR, UPLIT (%ASCIZ'TKB20>')) NEQ 0)
 285	    THEN
 286		BEGIN
 287		MAP_CHAN = -1;
 288		MAP_FILE = 0;
 289		STB_CHAN = -1;
 290		STB_FILE = 0;
 291		TASK_CHAN = -1;
 292		TASK_FILE = 0;
 293	
 294		IF ((FILE_PTR = FND_CHAIN (.FAKE_FILE_PTR [FILE_DOWN], SEL_OUTPUT, 0)) NEQ 0)
 295		THEN
 296		    BEGIN
 297		    SEARCH_DONE = 0;
 298	
 299		    WHILE (.SEARCH_DONE EQL 0) DO
 300			BEGIN
 301	
 302			IF (GET_SW (.FILE_PTR, UPLIT (%ASCIZ'MAP', 0)) NEQ 0)
 303			THEN
 304			    BEGIN
 305	
 306			    IF (.MAP_CHAN GTR 0)
 307			    THEN
 308				ERRMSG (0, 19, ROUTINE_NAME, FILE_PTR [FILE_NAME],
 309				    UPLIT (%ASCIZ'map'), 0, 0)
 310			    ELSE
 311				BEGIN
 312	
 313				IF ((OPEN (1, FILE_PTR [FILE_NAME], 1, 1, UPLIT (%ASCIZ'MAP'))) NEQ 0)
 314				THEN
 315				    BEGIN
 316				    MAP_CHAN = 1;
 317				    MAP_FILE = .FILE_PTR;
 318				    END;
 319	
 320				END;
 321	
 322			    END
 323			ELSE
 324	
 325			    IF (GET_SW (.FILE_PTR, UPLIT (%ASCIZ'TASK', 0)) NEQ 0)
 326			    THEN
 327				BEGIN
 328	
 329				IF (.TASK_CHAN GTR 0)
 330				THEN
 331				    ERRMSG (0, 19, ROUTINE_NAME, FILE_PTR [FILE_NAME],
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 332					UPLIT (%ASCIZ'task'), 0, 0)
 333				ELSE
 334				    BEGIN
 335	
 336				    IF ((OPEN (2, FILE_PTR [FILE_NAME], 2, 1, UPLIT (%ASCIZ'TSK'))) NEQ 0)
 337				    THEN
 338					BEGIN
 339					TASK_CHAN = 2;
 340					TASK_FILE = .FILE_PTR;
 341					END;
 342	
 343				    END;
 344	
 345				END
 346			    ELSE
 347	
 348				IF (GET_SW (.FILE_PTR, UPLIT (%ASCIZ'STB', 0)) NEQ 0)
 349				THEN
 350				    BEGIN
 351	
 352				    IF (.STB_CHAN GTR 0)
 353				    THEN
 354					ERRMSG (0, 19, ROUTINE_NAME, FILE_PTR [FILE_NAME],
 355					    UPLIT (%ASCIZ'symbol table'
 356					    ), 0, 0)
 357				    ELSE
 358					BEGIN
 359	
 360					IF ((OPEN (3, FILE_PTR [FILE_NAME], 2, 1, UPLIT (%ASCIZ'STB'))) NEQ 0)
 361					THEN
 362					    BEGIN
 363					    STB_CHAN = 3;
 364					    STB_FILE = .FILE_PTR;
 365					    END;
 366	
 367					END;
 368	
 369				    END
 370				ELSE
 371				    ERRMSG (0, 20, ROUTINE_NAME, FILE_PTR [FILE_NAME], 0, 0, 0);
 372	
 373			IF ((FILE_PTR = .FILE_PTR [FILE_NEXT]) EQL 0)
 374			THEN
 375			    SEARCH_DONE = 1
 376			ELSE
 377	
 378			    IF (.FILE_PTR [FILE_FLAG_IN] NEQ 0) THEN SEARCH_DONE = 1;
 379	
 380			END
 381	
 382		    END;				!OF WHILE SEARCH_DONE
 383	
 384		FILE_PTR = FND_CHAIN (.FAKE_FILE_PTR [FILE_DOWN], SEL_INPUT, 0);
 385	
 386		IF (.FILE_PTR EQL 0)
 387		THEN
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 388		    ERRMSG (0, 21, ROUTINE_NAME, 0, 0, 0, 0)
 389		ELSE
 390		    BEGIN				!FOUND AN INPUT FILE
 391	
 392		    WHILE (.FILE_PTR NEQ 0) DO
 393			BEGIN
 394	
 395			IF ((OPEN (4, FILE_PTR [FILE_NAME], 2, 0, UPLIT (%ASCIZ'OBJ'))) NEQ 0)
 396			THEN
 397			    BEGIN
 398			    (IF (GET_SW (.FILE_PTR, UPLIT (%ASCIZ'LB', 0)) NEQ 0) THEN RDLIBR ELSE RDFILE) (4,
 399				.FILE_PTR);
 400			    CLOSE (4);
 401			    END;			!SUCCESSFUL INPUT OPEN
 402	
 403			FILE_PTR = .FILE_PTR [FILE_NEXT];
 404			END;
 405	
 406		    IF ((FILE_PTR = GETBLK (FILE_TYP, FILE_LEN)) NEQ 0)
 407		    THEN
 408			BEGIN
 409			CH$MOVE (11, CH$PTR (UPLIT (%ASCIZ'SYSLIB.OLB')), CH$PTR (FILE_PTR [FILE_NAME]));
 410	
 411			IF (OPEN (4, FILE_PTR [FILE_NAME], 2, 0, UPLIT (%ASCIZ'OBJ')))
 412			THEN
 413			    BEGIN
 414			    RDLIBR (4, .FILE_PTR);
 415			    CLOSE (4);
 416			    END;
 417	
 418			BCOR (.ROOT [ROOT_PSECTS], .ROOT [ROOT_GLOBALS], .ROOT [ROOT_MODULES], .TASK_FILE, .ROOT);
 419			GLOB (.MAP_CHAN, .ROOT [ROOT_GLOBALS]);
 420	
 421			IF (.MAP_CHAN GTR 0) THEN CLOSE (.MAP_CHAN);
 422	
 423			IF (.TASK_CHAN GTR 0)
 424			THEN
 425			    BEGIN
 426			    WTSK (.ROOT [ROOT_CIMAGE], .ROOT [ROOT_CSIZE], .ROOT [ROOT_LBL], .ROOT [ROOT_LSIZE],
 427				.TASK_FILE, .TASK_CHAN);
 428			    CLOSE (.TASK_CHAN);
 429			    END;
 430	
 431			IF (.STB_CHAN GTR 0)
 432			THEN
 433			    BEGIN
 434			    WSTB (.STB_CHAN, .ROOT [ROOT_MODULES], .ROOT [ROOT_PSECTS], .ROOT [ROOT_GLOBALS],
 435				.TASK_FILE);
 436			    CLOSE (.STB_CHAN);
 437			    END;
 438	
 439			END;
 440	
 441		    END;				!FOUND AN INPUT FILE
 442	
 443		END
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

 444	
 445	    END;
 446	END
 447	
 448	ELUDOM
 449	! Local Modes:
 450	! Mode:Fundamental
 451	! Auto Save Mode:2
 452	! Comment Start:!
 453	! Comment Column:36
 454	! End:
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

BCOR		  98*	 418
CLOSE		 104	 400	 415	 421	 428	 436
CMDLIN		 105	 284
ERRMSG		 102	 308	 331	 354	 371	 388
ERROR		  99
FAKE_FILE_PTR	 255	 276#	 277#	 278#	 279	 284	 294
		 384
FILE_BLOCK	 151	 203	 255	 256	 258	 262	 264
FILE_DOWN	 158	 210	 294	 384
FILE_FLAG_FAKE	 278
FILE_FLAG_IN	 215	 378
FILE_FLAG_IND	 155	 207
FILE_FLAG_OUT	 163
FILE_HIGH	 277
FILE_LEN	 276	 406
FILE_NAME	 308	 313	 331	 336	 354	 360	 371
		 395	 409	 411
FILE_NEXT	 373	 403
FILE_PTR	 116	 151	 155	 158	 163	 168	 203
		 207	 210	 215	 256	 294#	 302	 308
		 313	 317	 325	 331	 336	 340	 348
		 354	 360	 364	 371	 373#	 378	 384#
		 386	 392	 395	 398	 399	 403#	 406#
		 409	 411	 414
FILE_TYP	 276	 406
FND_CHAIN	 110	 158	 210	 294	 384
GETBLK		 111	 272	 276	 406
GETSTG		 103
GET_SW		 100	 302	 325	 348	 398
GLOB		 106	 419
INISTG		 109	 267
MAP_CHAN	 257	 287#	 306	 316#	 419	 421
MAP_FILE	 258	 288#	 317#
OPEN		 101	 313	 336	 360	 395	 411
RDFILE		 107	 398
RDLIBR		 108	 398	 414
RESET_ALL	 114	 266
ROOT		  91	 272#	 277	 279#	 418	 419	 426
		 434
ROOT_BLOCK	  91
ROOT_CIMAGE	 426
ROOT_CSIZE	 426
ROOT_GLOBALS	 418	 419	 434
ROOT_LBL	 426
ROOT_LEN	 272
ROOT_LSIZE	 426
ROOT_MODULES	 418	 434
ROOT_PSECTS	 418	 434
ROOT_TOP_FILE	 279
ROOT_TYP	 272
ROUTINE_NAME	 252#	 308	 331	 354	 371	 388
SEARCH_DONE	 259	 297#	 299	 375#	 378#
SEL_INPUT	  60	 116*	 158	 384
SEL_OUTPUT	  61	 168*	 210	 294
STACK_BASE	 260
		DSK:TKB20.XRF[4,31]              31-Aug-79 15:03

STB_CHAN	 261	 289#	 352	 363#	 431	 434	 436
STB_FILE	 262	 290#	 364#
TASK_CHAN	 263	 291#	 329	 339#	 423	 427	 428
TASK_FILE	 264	 292#	 340#	 418	 427	 435
TKB20		   3#	   5	  62#	 220*
UNUSED		 116	 168
WSTB		 113	 434
WTSK		 112	 426