PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35

TABLE OF CONTENTS



     7-    1	**** PIPSBR VERSION M0213 ****

     8-  103	FSTOUT, NXTOUT, NXTIN, WLDVER, CWLDUI

     9-  196	STNMBK, STNBK1 - INITIALIZE NAME BLOCK ROUTINES

    10-  245	PARSE, FNDNXT, FINDFL, RMVNXT

    12-  428	USEFID, PRSREG

    13-  469	COMMON ERROR ROUTINES

    14-  516	DYNAMIC MEMORY ALLOCATION AND RELEASE ROUTINES

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 7





      1						.TITLE	PIPSBR M0213, COMMAND SUBROUTINES - PIP

						.SBTTL	**** PIPSBR VERSION M0213 ****

						.IDENT	/M0213/

      2					; ALTERED TUESDAY 21-JAN-75 8:00

      3					;

      4					; B. SCHREIBER	27-AUG-77

      5					;

      6					;	BLS025 -- ADD EXIT WITH STATUS

      7					;

      8					; B. SCHREIBER	7-JUN-78

      9					;

     10					;	BLS052 -- INTEGRATE ODS-2 CHANGES FROM A. GOLDSTEIN AND E.

     11					;		MARISON.

     12					;

     13					; B. SCHREIBER	12-JUL-78

     14					;

     15					;	BLS060 -- DETACH INPUT DEVICE IN CASE WE ATTACHED IT

     16					;

     17					; COPYRIGHT (C) 1978, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.

     18					; COPYRIGHT (C) 1977, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.

     19					; COPYRIGHT 1975, DIGITAL EQUIPMENT CORP., MAYNARD MASS.

     20					; COPYRIGHT 1974, DIGITAL EQUIPMENT CORP., MAYNARD MASS.

     21

     22					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

     23					; ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSION

     24					; OF DEC'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     25					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     26

     27					; THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

     28					; NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL

     29					; EQUIPMENT CORPORATION.

     30

     31					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

     32					; OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     33					;

     34					; PETER H. LIPMAN	2-MAY-74

     35

     36	000000					FLDSOF

     37						.MCALL	CSI$

     38	000000					CSI$

     39

     40						.MCALL	CALL,RETURN,CLOSE$,FDBF$R

     41

     42	000000					PURE.I

     43

     44					;  CLOSE THE INPUT AND OUTPUT FILES

     45	000000				CLOSE::	CALL	CLSIN

     46	000004	012700 	000000G		CLSOUT::MOV	#FDBOUT,R0

     47	000010					FDBF$R	R0,,,#0		;FORCE DEFAULT BUFFER COUNT

     48	000014	005760 	000000G			TST	F.BDB(R0)	;DON'T THINK ABOUT DETACHING IF CLOSED

     49	000020	001421 				BEQ	15$

     50	000022	132760 	000000G	000000G		BITB	#FD.REC,F.RCTL(R0) ;IF OUTPUT FILE IS REC DEV

     51	000030	001415 				BEQ	15$

     52	000032	012701 	000000G			MOV	#IO.DET,R1	;DETACH IT BEFORE CLOSING

     53	000036	005002 				CLR	R2

     54	000040					CALL	.XQIO

     55	000044	103007 				BCC	15$

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 7-1

**** PIPSBR VERSION M0213 ****



     56	000046					ERROUT	OP06,0,0	;FAILED TO DETACH

	000046	104426 				TRAP	X

	000050	000000G				.WORD	OP06SZ

	000052	000000G				.WORD	OP06MG

     57	000054					CALL	SETWAR		;SET WARNING STATUS

     58	000060	012700 	000000G			MOV	#FDBOUT,R0	;R0 CLOBBERED BY ERROR PRINTING

     59	000064				15$:	CLOSE$	R0

     60	000070	103005 				BCC	20$

     61	000072					ERROUT	OP05,0,0

	000072	104426 				TRAP	X

	000074	000000G				.WORD	OP05SZ

	000076	000000G				.WORD	OP05MG

     62	000100					CALL	SETWAR		;SET WARNING STATUS

     63	000104				20$:	RETURN

     64					;

     65					; CLOSE THE INPUT FILE

     66	000106	012700 	000000G		CLSIN::MOV	#FDBIN,R0	;POINT TO FDB					;BLS060

     67	000112	132760 	000000G	000000G		BITB	#FD.REC,F.RCTL(R0) ;IS IT RECORD ORIENTED?			;BLS060

     68	000120	001405 				BEQ	5$		;IF EQ NO					;BLS060

     69	000122	012701 	000000G			MOV	#IO.DET,R1	;YES--DETACH IT					;BLS060

     70	000126	005002 				CLR	R2		;						;BLS060

     71	000130					CALL	.XQIO		;DETACH IT					;BLS060

     72	000134				5$:	CLOSE$	R0		;CLOSE THE INPUT FILE				;BLS060

     73	000140	103005 				BCC	10$								;**-1

     74	000142					ERROUT	OP04,0,0

	000142	104426 				TRAP	X

	000144	000000G				.WORD	OP04SZ

	000146	000000G				.WORD	OP04MG

     75	000150					CALL	SETWAR		;SET WARNING STATUS

     76	000154				10$:	RETURN

     77					;+

     78					; ATTACH DEVICE IF IT IS A RECORD DEVICE.

     79					; CALLING SEQUENCE:

     80					;	CALL	RECATT

     81					; INPUTS:

     82					;	R0=FDB

     83					; OUTPUTS:

     84					;	C=0 IF OK, C=1 IF ERROR, F.ERR SET

     85					;	R1,R2 ALTERED, OTHERS PRESERVED

     86					;-

     87	000156	132760 	000000G	000000G	RECATT::BITB	#FD.REC,F.RCTL(R0)

     88	000164	001406 				BEQ	10$		;BRANCH IF NOTHING TO DO

     89	000166	012701 	000000G			MOV	#IO.ATT,R1

     90	000172	005002 				CLR	R2		;NO, EXTRA PARAMS IN DPB

     91	000174					CALL	.XQIO

     92	000200					RETURN			;NOTE THAT C BIT IS CORRECT

     93	000202	000241 			10$:	CLC

     94	000204					RETURN

     95					;

     96					; INIT THE PROTECTION VALUES TO ZERO

     97	000206	012701 	000000G		INIPRO::MOV	#WORPRO,R1

     98	000212	012702 	000000C			MOV	#<PROWRD-WORPRO>/2,R2

     99	000216	005021 			25$:	CLR	(R1)+

    100	000220					SOB	R2,25$

    101	000224					RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 8

FSTOUT, NXTOUT, NXTIN, WLDVER, CWLDUI



    103						.SBTTL	FSTOUT, NXTOUT, NXTIN, WLDVER, CWLDUI

    104					;

    105					; SET UP FOR FIRST OUTPUT SPEC - USED BY COMMANDS WHICH HAVE A LIST

    106					; OF OUTPUT SPECS AND NO INPUT SPECS

    107	000226	005767 	000000G		FSTOUT::TST	INSPEC		;NO INPUT SPECIFIER ALLOWED

    108	000232	001405 				BEQ	10$

    109	000234					ERROUT	CR01		;BAD SYNTAX

	000234	104402 				TRAP	X

	000236	000000G				.WORD	CR01SZ

	000240	000000G				.WORD	CR01MG

    110	000242	000167 	000000G			JMP	AGAIN

    111	000246	012767 	000000G	000000C	10$:	MOV	#NAMBLK,FDBOUT+F.DFNB ;SET UP DEFAULT NAME BLOCK

    112	000254	012767 	000000G	000000C		MOV	#OFNPT,FDBOUT+F.DSPT ;AND DESCRIPTOR POINTER

    113					; INITIALIZE THE DEFAULT NAME BLOCK

    114	000262	005002 				CLR	R2		;NO FILE NAME AND TYPE

    115	000264	005001 				CLR	R1		;ZERO DIRECTORY ID

    116	000266					CALL	STNMBK		;USES DEFAULT SYS DEVICE

    117	000272					RETURN

    118					; SET UP FOR NEXT OUTPUT IN LIST IF ANY, RETURN C=0 IF READY WITH

    119					; ANOTHER FILE, C=1 IF NO MORE IN LIST, OR IF ERROR

    120	000274	012700 	000000G		NXTOUT::MOV	#FDBOUT,R0

    121	000300	012701 	000000G			MOV	#OFNPT,R1

    122	000304	012702 	000000G			MOV	#OUTCSI,R2

    123	000310	000406 				BR	NXTIN1

    124	000312	012700 	000000G		NXTIN::	MOV	#FDBIN,R0

    125	000316	012701 	000000G			MOV	#IFNPT,R1

    126	000322	012702 	000000G			MOV	#INCSI,R2

    127	000326				NXTIN1::CALL	NXINOU

    128	000332					RETURN

    129					;

    130					; SET UP FOR NEXT INPUT OR OUTPUT SPEC

    131					; INPUTS:

    132					;	R0=FDB

    133					;	R1=ADDRESS OF CSI FILE NAME DESCRIPTOR

    134					;	R2=ADDR OF INCSI OR OUTCSI AS APPROPRIATE

    135	000334				NXINOU::	CLOSE$	R0

    136	000340	103415 				BCS	80$

    137	000342	032761 	000020 	000014 		BIT	#CS.MOR,N.SPEC(R1)

    138	000350	001422 				BEQ	95$

    139	000352	016767 	000000G	000000G		MOV	.LCLSW,CPYCTL

    140	000360					CALL	@R2

    141	000362	103412 				BCS	85$		;BRANCH IF BAD SWITCH OR VALUE

    142					;

    143					; IF PREVIOUS FILE NAME/TYPE WAS EXPLICIT, BUT NOT A WILD CARD

    144					; THEN USE THAT NAME/TYPE AS A DEFAULT FOR THE NEXT SPECIFIER

    145	000364					CALL	.DFLTN		;SET NEXT DEFAULT FILE NAME AND TYPE

    146	000370	000241 				CLC

    147	000372					RETURN

    148					;

    149					; CLOSE FAILURE

    150	000374				80$:	ERROUT	OP05,0,0

	000374	104426 				TRAP	X

	000376	000000G				.WORD	OP05SZ

	000400	000000G				.WORD	OP05MG

    151	000402					CALL	SETWAR		;MAKE WARNING

    152	000406	000403 				BR	95$

    153					;

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 8-1

FSTOUT, NXTOUT, NXTIN, WLDVER, CWLDUI



    154					; BAD SWITCH

    155	000410				85$:	ERROUT	CR02,1

	000410	104412 				TRAP	X

	000412	000000G				.WORD	CR02SZ

	000414	000000G				.WORD	CR02MG

    156	000416	000261 			95$:	SEC

    157	000420					RETURN

    158					;

    159					; CHECK IF WILD CARDS ARE PRESENT IN NAME OR TYPE, THAT VERSION

    160					; IS EXPLICIT OR WILD CARD

    161					; INPUTS:

    162					;	R0=FDB

    163					;	R1=FILE NAME BLOCK

    164					; OUTPUTS:

    165					;	C=0 IF OK, AND ALL REGISTERS PRESERVED

    166					;	C=1 IF NOT OK, ALL REGISTERS ALTERED

    167	000422				WLDVER::CALL	.WLDVC

    168	000426	103006 				BCC	10$

    169	000430					ERROUT	DE04,1

	000430	104412 				TRAP	X

	000432	000000G				.WORD	DE04SZ

	000434	000000G				.WORD	DE04MG

    170	000436					CALL	SETWAR		;MAKE IT WARNING

    171	000442	000261 				SEC

    172	000444				10$:	RETURN

    173					;

    174					;+

    175					; CHECK FOR LEGAL WILD CARD UIC, RESTRICT TO [*,*]

    176					; USED ONLY TO RESTRICT OUTPUT UIC'S

    177					; CALLING SEQUENCE:

    178					;	CALL	CWLDUI

    179					; INPUTS:

    180					;	R0=FDB

    181					; OUTPUTS:

    182					;	C=0 IFLEGAL, C=1 IF NOT

    183					;	ALL REGISTERS PRESERVED

    184					;-

    185	000446	032760 	000000G	000000C	CWLDUI::BIT	#NB.SDI,F.FNB+N.STAT(R0) ;LEGAL IF NO WILD UIC'S

    186	000454	001407 				BEQ	20$

    187	000456	016046 	000000C			MOV	F.FNB+N.STAT(R0),-(SP)

    188	000462	042716 	000000C			BIC	#^C<NB.SDI>,@SP

    189	000466	022726 	000000G			CMP	#NB.SDI,(SP)+

    190	000472	001002 				BNE	30$

    191	000474	000241 			20$:	CLC

    192	000476					RETURN

    193	000500	000261 			30$:	SEC

    194	000502					RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 9

STNMBK, STNBK1 - INITIALIZE NAME BLOCK ROUTINES



    196						.SBTTL	STNMBK, STNBK1 - INITIALIZE NAME BLOCK ROUTINES

    197					;+

    198					; SET UP THE FILE NAME BLOCK, NAMBLK, WITH THE FILE NAME, AND TYPE

    199					; THE DIRECTORY ID, AND THE DEVICE AND UNIT

    200					; CALLING SEQUENCE:

    201					;	JSR	PC,STNMBK

    202					; INPUTS:

    203					;	R1=VALUE TO BE STORED IN FIRST 2 LOC OF DIRECTORY ID

    204					;		=0 FOR NORMAL CASE OF NO DEFAULT DIRECTORY ID

    205					;		=-1 TO DEFAULT TO MFD

    206					;	R2=POINTER TO NAME AND TYPE TO MOVE IN

    207					;		OR = 0 IF DESIRE NULL DEFAULTS FOR FILE NAME AND TYPE

    208					; OUTPUTS:

    209					;	R0,R1,R5 PRESERVED, R3,R4 ALTERED

    210					;	R2 ALTERED IF IT POINTS AT A NAME TO MOVE, PRESERVED IF 0

    211					; OPERATION:

    212					;	ZEROS THE SPECIFIED FILE NAME BLOCK AND SET UP THE SPECIFIED

    213					; DIRECTORY ID (VALUE FROM R1), THE SYSTEM

    214					; DEVICE AND UNIT, AND THE DEFAULT FILE NAME AND TYPE IF R2 NON ZERO.

    215					;

    216					; ALTERNATE ENTRY POINT:

    217					;	JSR	PC,STNBK1

    218					; INPUTS:

    219					;	R0 = NAMBLK ADDRESS TO INITIALIZE

    220					;	OTHERWISE, SAME AS ABOVE

    221					;-

    222	000504	010046 			STNMBK::MOV	R0,-(SP)

    223	000506	012700 	000000G			MOV	#NAMBLK,R0

    224	000512					CALL	STNBK1

    225	000516	012600 				MOV	(SP)+,R0

    226	000520					RETURN

    227					;

    228	000522	010003 			STNBK1::MOV	R0,R3		;ZERO THE FILE NAME BLOCK

    229	000524	012704 	000000G			MOV	#S.FNBW,R4	;NO. OF WORDS IN FNB

    230	000530	005023 			10$:	CLR	(R3)+

    231	000532					SOB	R4,10$

    232	000536	010160 	000000G			MOV	R1,N.DID(R0)	;STORE DEFAULT DIRECTORY ID

    233	000542	010160 	000002G			MOV	R1,N.DID+2(R0)

    234	000546	016760 	000000G	000000G		MOV	.DEFDV,N.DVNM(R0) ;SET DEFAULT DEVICE

    235	000554	016760 	000000G	000000G		MOV	.DEFUN,N.UNIT(R0) ;AND UNIT

    236	000562	005702 				TST	R2		;IF DEFAULT NAME AND TYPE SPECIFIED

    237	000564	001410 				BEQ	40$

    238	000566	010003 				MOV	R0,R3		;MOVE THEM IN

    239	000570	062703 	000000G			ADD	#N.FNAM,R3

    240	000574	012704 	000000G			MOV	#S.FNTY,R4	;NUMBER OF WORDS TO MOVE

    241	000600	012223 			20$:	MOV	(R2)+,(R3)+	;MOVE FILE NAME AND TYPE

    242	000602					SOB	R4,20$

    243	000606				40$:	RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 10

PARSE, FNDNXT, FINDFL, RMVNXT



    245						.SBTTL	PARSE, FNDNXT, FINDFL, RMVNXT

    246					;+

    247					; PARSE THE FILE NAME BLOCK

    248					; CALLING SEQUENCE:

    249					;	CALL	PARSE

    250					; INPUTS:

    251					;	R0=FDB

    252					; OUTPUTS:

    253					;	C=0 IF SUCCESSFUL, C=1 IF FAILURE

    254					;	R1=FILE NAME BLOCK

    255					;	R2=FILE DESCRIPTOR POINTER

    256					;	R3=DEFAULT FILE NAME BLOCK

    257					;	R0,R4,R5 PRESERVED

    258					; OPERATION:

    259					;	HANDLES WILD CARD UIC PARSE

    260					;-

    261	000610	010446 			PARSE::	MOV	R4,-(SP)

    262	000612					CALL	PRSREG

    263	000616	005762 	000016 			TST	N.FLID(R2)	;/FI SWITCH SPECIFIED?

    264	000622	001403 				BEQ	5$		;BRANCH IF NOT

    265	000624					CALL	.PRSDV		;JUST PARSE THE DEVICE NAME

    266	000630	000407 				BR	20$

    267	000632	005704 			5$:	TST	R4

    268	000634	001403 				BEQ	10$		;BRANCH IF CALLING .PARSE

    269	000636					CALL	.WPARS

    270	000642	000402 				BR	20$

    271	000644				10$:	CALL	.PARSE

    272	000650	012604 			20$:	MOV	(SP)+,R4

    273	000652					RETURN

    274					;

    275					;+

    276					; FIND THE NEXT FILE IN THIS (OR NEXT) DIRECTORY

    277					; CALLING SEQUENCE:

    278					;	CALL	FNDNXT

    279					; INPUTS:

    280					;	R0=FDB ADDRESS

    281					;	VERSAV = ORIGINAL VERSION FROM PARSE					;BLS052

    282					; OUTPUTS:

    283					;	C=0 IF SUCCESSFUL, C=1 IF FAILURE

    284					;	R1=FILE NAME BLOCK

    285					;	R0,R2-R5 PRESERVED

    286					; OPERATION:

    287					;	FIND WILL USE EXPLICIT FILE ID IF SPECIFIED, AND WILL CROSS

    288					; DIRECTORIES IF WILD CARD UIC IS SPECIFIED

    289					;-

    290	000654	010001 			FNDNXT::MOV	R0,R1

    291	000656	062701 	000000G			ADD	#F.FNB,R1

    292	000662					CALL	USEFID

    293	000666	103022 				BCC	20$

    294						.IF DF	O$$DS2								;BLS052

    295	000670	016161 	000000G	000004G		MOV	N.FVER(R1),N.FID+4(R1)	;COPY PREVIOUS VERSION			;BLS052

    296	000676	016761 	000000G	000000G		MOV	VERSAV,N.FVER(R1)	;RESTORE ORIGINAL VERSION		;BLS052

    297	000704	052761 	010000 	000000G		BIS	#NB.WLV,N.STAT(R1)	;SET PREV VERSION ENABLE		;BLS052

    298						.ENDC									;BLS052

    299	000712	010246 				MOV	R2,-(SP)

    300	000714	016002 	000000G			MOV	F.DSPT(R0),R2

    301	000720	001402 				BEQ	10$

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 10-1

PARSE, FNDNXT, FINDFL, RMVNXT



    302	000722	062702 	000024 			ADD	#S.FIDS+S.APPD,R2

    303	000726				10$:	CALL	.FNDNX

    304	000732	012602 				MOV	(SP)+,R2

    305	000734				20$:	RETURN

    306					;

    307					;+

    308					; FIND NEXT FILE, DO NOT ALLOW FILE ID OR CROSS DIRECTORY SEARCH

    309					; CALLING SEQUENCE:

    310					;	CALL	FINDFL

    311					; INPUTS:

    312					;	R0=FDB ADDRESS

    313					; OUTPUTS:

    314					;	C=0 IF SUCCESSFUL, C=1 IF ERROR

    315					;	R1= FILE NAME BLOCK

    316					;	R0,R2-R5 PRESERVED

    317					;-

    318	000736	010001 			FINDFL::MOV	R0,R1

    319	000740	062701 	000000G			ADD	#F.FNB,R1

    320	000744	010246 				MOV	R2,-(SP)

    321	000746	005002 				CLR	R2

    322	000750					CALL	.FNDNX

    323	000754	012602 				MOV	(SP)+,R2

    324	000756					RETURN

    325					;

    326					;+

    327					; IS THERE ANOTHER FILE TO OPERATE ON IN THIS FILE SPECIFIER

    328					; CALLING SEQUENCE:

    329					;	CALL	NXTFIL

    330					; INPUTS:

    331					;	R0=FDB

    332					; OUTPUTS:

    333					;	C=0 IF THERE IS ANOTHER FILE, C=1 IF NOT

    334					;	R0,R5 PRESERVED

    335					;	R1 = FILE NAME BLOCK

    336					;	R2,R3,R4 ALTERED

    337					; OPERATION:

    338					;	SETS UP FOR THE NEXT FNDNXT, RMVNXT CALL BY CHECKING IF

    339					; A WILD CARD NAME OR DIRECTORY WAS SPECIFIED.  THIS ROUTINE WILL

    340					; CROSS DIRECTORIES IF A WILD CARD UIC IS SPECIFIED WITH NO WILD

    341					; CARDS IN THE FILE NAME.

    342					;-

    343	000760	000261 			NXTFIL::SEC			;ASSUME NO WILD CARDS

    344	000762	032760 	000000G	000000C		BIT	#NB.SFL,F.FNB+N.STAT(R0) ;ANY WILD CARDS?

    345	000770	001411 				BEQ	20$		;BRANCH IF NO

    346	000772	000241 				CLC			;NOW ASSUME SUCCESSFUL

    347	000774	032760 	000000G	000000C		BIT	#NB.SFN,F.FNB+N.STAT(R0) ;* IN NAME, TYPE, VERSION

    348	001002	001004 				BNE	20$		;BRANCH IF YES

    349					;

    350					; NO WILD CARDS IN NAME, BUT WILD CARD UIC, CROSS DIRECTORIES NOW

    351					;

    352	001004					CALL	PRSREG		;SET UP REGISTERS

    353	001010					CALL	.NXDIR		;AND CHAIN TO NEXT DIRECTORY

    354	001014				20$:	RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 11

PARSE, FNDNXT, FINDFL, RMVNXT



    356					;+

    357					; REMOVE NEXT FILE, ALLOWS CROSS DIRECTORY OPERATION

    358					; INPUTS:

    359					;	R0=FDB

    360					; OUTPUTS:

    361					;	C=0 IF REMOVED, C=1 IF ERROR

    362					;	R1=FILE NAME BLOCK ADDRESS

    363					;	OTHER REGISTERS PRESERVED

    364					; OPERATION:

    365					;	HANDLES THE SPECIAL CASE OF EXPLICIT FILE NAME AND TYPE AND

    366					; DEFAULT VERSION (0 OR -1) BY DOING A FIND AND THEN A REMOVE.  ALL

    367					; OTHER CASES JUST DO THE REMOVE.

    368					;	IF WILD CARD DIRECTORY WAS SPECIFIED, RMVNXT WILL

    369					; AUTOMATICALLY CROSS TO THE NEXT DIRECTORY.

    370					;-

    371	001016	010001 			RMVNXT::MOV	R0,R1

    372	001020	062701 	000000G			ADD	#F.FNB,R1

    373	001024					CALL	USEFID

    374	001030	103074 				BCC	70$

    375						.IF DF	O$$DS2								;BLS052

    376					;										;BLS052

    377					; ODS2 WILD CARDS								;BLS052

    378					;										;BLS052

    379	001032	016161 	000000G	000004G	5$:	MOV	N.FVER(R1),N.FID+4(R1) ;MOVE UP OLD VERSION NUMBER		;BLS052

    380	001040	016761 	000000G	000000G		MOV	VERSAV,N.FVER(R1) ;RESTORE ORIGINAL VERSION			;BLS052

    381	001046	052761 	010000 	000000G		BIS	#NB.WLV,N.STAT(R1) ;SET ODS2 WILD CARD MODE			;BLS052

    382	001054					CALL	.WLDVC		;CHECK IF WILD CARD DEFAULT VERSION		;BLS052

    383	001060	103031 				BCC	30$		;BRANCH IF NOT - NORMAL REMOVE			;BLS052

    384	001062	010246 				MOV	R2,-(SP)	;SAVE R2					;BLS052

    385	001064	016002 	000000G			MOV	F.DSPT(R0),R2	;GET DSPT					;BLS052

    386	001070	001402 				BEQ	10$								;BLS052

    387	001072	062702 	000024 			ADD	#S.FIDS+S.APPD,R2						;BLS052

    388	001076				10$:	CALL	.FNDNX		;DO GENERAL WILD CARD FIND			;BLS052

    389	001102	012602 				MOV	(SP)+,R2	;RESTORE R2					;BLS052

    390	001104	103446 				BCS	70$		;EXIT ON ERROR					;BLS052

    391	001106	016146 	000000G			MOV	N.STAT(R1),-(SP) ;SAVE STATUS WORD				;BLS052

    392	001112	016146 	000000G			MOV	N.NEXT(R1),-(SP) ;AND WILD CARD CONTEXT				;BLS052

    393	001116	005061 	000000G			CLR	N.STAT(R1)	;ZERO STATUS					;BLS052

    394	001122	005061 	000000G			CLR	N.NEXT(R1)	;AND CONTEXT					;BLS052

    395	001126					CALL	.REMOV		;AND REMOVE FOUND ENTRY				;BLS052

    396	001132	012661 	000000G			MOV	(SP)+,N.NEXT(R1) ;RESTORE CONTEXT				;BLS052

    397	001136	012661 	000000G			MOV	(SP)+,N.STAT(R1) ;AND STATUS					;BLS052

    398	001142	000427 				BR	70$								;BLS052

    399						.IFF									;BLS052

    400					5$:	BIT	#NB.SFN,N.STAT(R1) ;IF WILD CARDS

    401						BNE	30$		;JUST DO THE REMOVE

    402						TST	N.FVER(R1)	;IF DEFAULT NEWEST VERSION

    403						BEQ	10$		;MUST DO FIND FIRST

    404						CMP	#-1,N.FVER(R1)	;IF DEFAULT OLDEST VERSION

    405						BNE	30$

    406					10$:	CALL	.FIND		;MUST DO THE FIND FIRST

    407						BCS	50$

    408						CLR	N.NEXT(R1)

    409						.ENDC									;BLS052

    410	001144				30$:	CALL	.REMOV

    411	001150	103024 			50$:	BCC	70$

    412	001152	032761 	000000G	000000G		BIT	#NB.SDI,N.STAT(R1) ;ANY WILD UIC'S

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 11-1

PARSE, FNDNXT, FINDFL, RMVNXT



    413	001160	001420 				BEQ	70$		;BRANCH IF NO

    414	001162	122760 	000000G	000000G		CMPB	#IE.NSF,F.ERR(R0) ;"NO SUCH FILE" ERROR

    415	001170	001013 				BNE	60$

    416	001172	010246 				MOV	R2,-(SP)

    417	001174	010346 				MOV	R3,-(SP)

    418	001176	010446 				MOV	R4,-(SP)

    419	001200					CALL	PRSREG

    420	001204					CALL	.NXDIR		;GET NEXT WILD DIRECTORY IF ANY

    421	001210	012604 				MOV	(SP)+,R4

    422	001212	012603 				MOV	(SP)+,R3

    423	001214	012602 				MOV	(SP)+,R2

    424	001216	103305 				BCC	5$

    425	001220	000261 			60$:	SEC

    426	001222				70$:	RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 12

USEFID, PRSREG



    428						.SBTTL	USEFID, PRSREG

    429					;

    430					; CHECK IF FILE ID WAS MANUALLY SPECIFIED

    431					; IF IT WAS, MOVE IT TO THE FILE ID OF F.FNB, RETURN C=0

    432					; IF NOT, RETURN C=1

    433					; ALL REGISTER PRESERVED

    434	001224	010246 			USEFID::MOV	R2,-(SP)

    435	001226	016002 	000000G			MOV	F.DSPT(R0),R2

    436	001232	001414 				BEQ	10$

    437	001234	016261 	000016 	000000G		MOV	N.FLID(R2),N.FID(R1) ;WAS FILE ID MANUALLY SPECIFIED

    438	001242	001410 				BEQ	10$		;BRANCH IF NO

    439	001244	016261 	000020 	000002G		MOV	N.FLID+2(R2),N.FID+2(R1)

    440	001252	016261 	000022 	000004G		MOV	N.FLID+4(R2),N.FID+4(R1)

    441	001260	000241 				CLC

    442	001262	000401 				BR	20$		;NOTE CARRY BIT MUST BE CLEAR

    443	001264	000261 			10$:	SEC

    444	001266	012602 			20$:	MOV	(SP)+,R2

    445	001270					RETURN

    446					;

    447					;+

    448					; SET UP REGISTERS FOR CALL TO .WPARS, .NXDIR

    449					; CALLING SEQUENCE:

    450					;	CALL	PRSREG

    451					; INPUTS:

    452					;	R0=FDB ADDRESS

    453					; OUTPUTS:

    454					;	R0=FDB ADDRESS

    455					;	R1=FILE NAME BLOCK

    456					;	R2=FILE DESCRIPTOR POINTER

    457					;	R3=DEFAULT FILE NAME BLOCK

    458					;	R4=S.FIDS+S.APPD;(F.DSPT(R0))

    459					;-

    460	001272	010001 			PRSREG::MOV	R0,R1

    461	001274	062701 	000000G			ADD	#F.FNB,R1

    462	001300	016002 	000000G			MOV	F.DSPT(R0),R2

    463	001304	016003 	000000G			MOV	F.DFNB(R0),R3

    464	001310	010204 				MOV	R2,R4

    465	001312	001402 				BEQ	10$

    466	001314	062704 	000024 			ADD	#S.FIDS+S.APPD,R4

    467	001320				10$:	RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 13

COMMON ERROR ROUTINES



    469						.SBTTL	COMMON ERROR ROUTINES

    470					;

    471					; ERROR FROM PARSE

    472	001322	122760 	000000G	000000G	PRSERR::CMPB	#IE.NSF,F.ERR(R0) ;NO SUCH FILE?

    473	001330	001004 				BNE	20$

    474	001332					ERROUT	DI05,1		;CAN'T FIND DIRECTORY FILE

	001332	104412 				TRAP	X

	001334	000000G				.WORD	DI05SZ

	001336	000000G				.WORD	DI05MG

    475	001340	000464 				BR	WARTRN		;GO RETURN

    476	001342	122760 	000000G	000000G	20$:	CMPB	#IE.PRI,F.ERR(R0) ;PROTECTION VIOLATION

    477	001350	001404 				BEQ	30$

    478	001352					ERROUT	DE08,1,0

	001352	104432 				TRAP	X

	001354	000000G				.WORD	DE08SZ

	001356	000000G				.WORD	DE08MG

    479	001360	000454 				BR	WARTRN		;GO RETURN

    480					; PROTECTION VIOLATION  PROBABLY INDICATES

    481					; THAT THE DEVICE WAS NEVER MOUNTED

    482	001362				30$:	ERROUT	OP07,1

	001362	104412 				TRAP	X

	001364	000000G				.WORD	OP07SZ

	001366	000000G				.WORD	OP07MG

    483	001370					RETURN

    484					;

    485					; FIND ERROR - IF NO SUCH FILE, NO ERROR MESSAGE

    486					; R0=FDB, R1=FNB, ALL REGISTERS ALTERED

    487	001372	032767 	000000G	000000G	FNDERR::BIT	#FRSTIM,CPYCTL	;IF NOT THE FIRST TIM

    488	001400	001011 				BNE	20$

    489	001402	122760 	000000G	000000G		CMPB	#IE.NSF,F.ERR(R0) ;AND IF "NO SUCH FILE"

    490	001410	001404 				BEQ	10$		;NO ERROR MESSAGE

    491					;

    492					; OTHER ERROR THAN "NO SUCH FILE" - NOT THE FIRST FIND

    493	001412					ERROUT	FI01,1,0

	001412	104432 				TRAP	X

	001414	000000G				.WORD	FI01SZ

	001416	000000G				.WORD	FI01MG

    494	001420	000434 				BR	WARTRN		;GO RETURN WARNING

    495	001422				10$:	RETURN

    496					;

    497					; ERROR ON FIRST FIND

    498	001424	122760 	000000G	000000G	20$:	CMPB	#IE.NSF,F.ERR(R0)

    499	001432	001004 				BNE	30$

    500	001434					ERROUT	FI03,1		;NO SUCH FILE

	001434	104412 				TRAP	X

	001436	000000G				.WORD	FI03SZ

	001440	000000G				.WORD	FI03MG

    501	001442	000423 				BR	WARTRN		;RETURN WARNING

    502	001444				30$:	ERROUT	FI02,1,0	;CANNOT FIND FILE

	001444	104432 				TRAP	X

	001446	000000G				.WORD	FI02SZ

	001450	000000G				.WORD	FI02MG

    503	001452	000417 				BR	WARTRN		;GO RETURN

    504					;

    505					; REMOVE ERROR - LIKE FNDERR ABOVE

    506	001454	122760 	000000G	000000G	RMVERR::CMPB	#IE.NSF,F.ERR(R0)

    507	001462	001743 				BEQ	FNDERR		;IF NO SUCH FILE, THEN USE FNDERR

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 13-1

COMMON ERROR ROUTINES



    508	001464	122760 	000000G	000000G		CMPB	#IE.PRI,F.ERR(R0) ;IF PROTECTION VIOLATION

    509	001472	001004 				BNE	10$

    510	001474					ERROUT	RM02,1,0	;PROBABLY INDICATES DISK WRITE PROTECTED

	001474	104432 				TRAP	X

	001476	000000G				.WORD	RM02SZ

	001500	000000G				.WORD	RM02MG

    511	001502	000403 				BR	WARTRN		;SET WARNING AND RETURN

    512	001504				10$:	ERROUT	RM01,1,0

	001504	104432 				TRAP	X

	001506	000000G				.WORD	RM01SZ

	001510	000000G				.WORD	RM01MG

    513	001512				WARTRN:	CALL	SETWAR		;SET WARNING STATUS

    514	001516					RETURN

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 14

DYNAMIC MEMORY ALLOCATION AND RELEASE ROUTINES



    516						.SBTTL	DYNAMIC MEMORY ALLOCATION AND RELEASE ROUTINES

    517					;+

    518					; ALLOCATE BUFFER OF THE SPECIFIED SIZE (R1 BYTES) FROM THE FILE STORAGE REGION

    519					; CALLING SEQUENCE

    520					;	CALL	.DYALC

    521					; INPUTS:

    522					;	R1=BYTE COUNT TO ALLOCATE

    523					; OUTPUTS:

    524					;	R0=ADDRESS ALLOCATED

    525					;	R1-R5 PRESERVED

    526					;	.DYBUF AND .DYBYT ALSO SET TO ADDRESS AND SIZE OF BUFFER

    527					;	IF FAIL TO ALLOCATE, THEN FATAL DYNAMIC MEMORY ERROR

    528					;-

    529	001520	016700 	000000G		.DYALC::MOV	.DYBUF,R0

    530	001524	020167 	000000G			CMP	R1,.DYBYT	;DESIRED SIZE BUFFER ALREADY ALLOCATED?

    531	001530	001417 				BEQ	40$		;BRANCH IF  YES

    532	001532					CALL	.DYREL		;NO, RELEASE ANYTHING CURRENTLY ALLOCATED

    533	001536	010246 				MOV	R2,-(SP)

    534	001540	010146 				MOV	R1,-(SP)

    535	001542	013700 	000000G			MOV	@#.FSRPT,R0

    536	001546					CALL	$RQCB		;ALLOCATE FOR FILE STORAGE REGION

    537	001552	012601 				MOV	(SP)+,R1

    538	001554	012602 				MOV	(SP)+,R2

    539	001556	103405 				BCS	60$		;BRANCH IF FAILED TO ALLOCATE

    540	001560	010067 	000000G			MOV	R0,.DYBUF	;SET UP ADDRESS

    541	001564	010167 	000000G			MOV	R1,.DYBYT	;AND SIZE OF THE BUFFER ALLOCATED

    542	001570				40$:	RETURN

    543	001572				60$:	ERROUX	DY01		;NOT ENOUGH DYNAMIC MEMORY

	001572	104403 				TRAP	X

	001574	000000G				.WORD	DY01SZ

	001576	000000G				.WORD	DY01MG

    544

    545					;+

    546					; RELEASE THE CURRENTLY ALLOCATED DYNAMIC MEMORY BUFFER TO THE FILE

    547					; STORAGE REGION

    548					; CALLING SEQUENCE:

    549					;	CALL	.DYREL

    550					; INPUTS:

    551					;	NONE

    552					; OUTPUTS:

    553					;	ALL REGISTER PRESERVED

    554					;	.DYBYT ZEROED TO REFLECT BUFFER RELEASED

    555					;-

    556	001600	005767 	000000G		.DYREL::TST	.DYBYT		;IF NOTHING TO RELEASE, QUICK NOP

    557	001604	001414 				BEQ	40$

    558	001606	004567 	000000G			JSR	R5,.SAVR1

    559	001612	013700 	000000G			MOV	@#.FSRPT,R0

    560	001616	016701 	000000G			MOV	.DYBYT,R1

    561	001622	016702 	000000G			MOV	.DYBUF,R2

    562	001626					CALL	$RLCB		;RELEASE THE BUFFER (ADR IN R2, SIZE IN R1)

    563	001632	005067 	000000G			CLR	.DYBYT		;RECORD THE FACT THAT IT'S RELEASED

    564	001636				40$:	RETURN

    565					;

    566					;

    567		000001 				.END

PIPSBR M0213, COMMAND SUBROUTIN	MACRO M1110  22-AUG-78 01:35  PAGE 14-1

SYMBOL TABLE



AB.CDT  000105   	C.DSDS= 000006   	F.ERR = ****** GX	N.SPEC= 000014   	STNMBK  000504RG    002

AB.CHU  000064   	C.FILD= 000016   	F.FNB = ****** GX	N.STAT= ****** GX	S.APPD= 000010

AB.EXP  000122   	C.MKW1= 000024   	F.MBCT= ****** GX	N.UNIT= ****** GX	S.FIDS= 000014

AB.FNU  000000   	C.MKW2= 000026   	F.RCTL= ****** GX	OFNPT = ****** GX	S.FNBW= ****** GX

AB.FP   000062   	C.SIZE= 000054   	IE.NSF= ****** GX	OP04MG= ****** GX	S.FNTY= ****** GX

AB.FSQ  000002   	C.STAT= 000001   	IE.PRI= ****** GX	OP04SZ= ****** GX	USEFID  001224RG    002

AB.GC   000061   	C.SWAD= 000022   	IFNPT = ****** GX	OP05MG= ****** GX	VERSAV= ****** GX

AB.NAM  000006   	C.TYPR= 000000   	INCSI = ****** GX	OP05SZ= ****** GX	WARTRN  001512R     002

AB.PC   000060   	DE04MG= ****** GX	INIPRO  000206RG    002	OP06MG= ****** GX	WLDVER  000422RG    002

AB.RDT  000070   	DE04SZ= ****** GX	INSPEC= ****** GX	OP06SZ= ****** GX	WORPRO= ****** GX

AB.REV  000066   	DE08MG= ****** GX	IO.ATT= ****** GX	OP07MG= ****** GX	X     = 000003

AB.UAT  000020   	DE08SZ= ****** GX	IO.DET= ****** GX	OP07SZ= ****** GX	$RLCB = ****** GX

AGAIN = ****** GX	DI05MG= ****** GX	NAMBLK= ****** GX	OUTCSI= ****** GX	$RQCB = ****** GX

CLOSE   000000RG    002	DI05SZ= ****** GX	NB.NXD= 020000   	O$$DS2= 000001   	.CLOSE= ****** G

CLSIN   000106RG    002	DY01MG= ****** GX	NB.SDI= ****** GX	PARSE   000610RG    002	.DEFDV= ****** GX

CLSOUT  000004RG    002	DY01SZ= ****** GX	NB.SFL= ****** GX	PAR$$$= 000000   	.DEFUN= ****** GX

CPYCTL= ****** GX	FDBIN = ****** GX	NB.SFN= ****** GX	PROWRD= ****** GX	.DFLTN= ****** GX

CR01MG= ****** GX	FDBOUT= ****** GX	NB.WLV= 010000   	PRSERR  001322RG    002	.DYALC  001520RG    002

CR01SZ= ****** GX	FD.REC= ****** GX	NXINOU  000334RG    002	PRSREG  001272RG    002	.DYBUF= ****** GX

CR02MG= ****** GX	FINDFL  000736RG    002	NXTFIL  000760RG    002	RECATT  000156RG    002	.DYBYT= ****** GX

CR02SZ= ****** GX	FI01MG= ****** GX	NXTIN   000312RG    002	RMVERR  001454RG    002	.DYREL  001600RG    002

CS.DIF= 000002   	FI01SZ= ****** GX	NXTIN1  000326RG    002	RMVNXT  001016RG    002	.FNDNX= ****** GX

CS.DVF= 000004   	FI02MG= ****** GX	NXTOUT  000274RG    002	RM01MG= ****** GX	.FSRPT= ****** GX

CS.EQU= 000040   	FI02SZ= ****** GX	N.DEVD= 000000   	RM01SZ= ****** GX	.LCLSW= ****** GX

CS.INP= 000001   	FI03MG= ****** GX	N.DID = ****** GX	RM02MG= ****** GX	.NXDIR= ****** GX

CS.MOR= 000020   	FI03SZ= ****** GX	N.DIRD= 000004   	RM02SZ= ****** GX	.PARSE= ****** GX

CS.NMF= 000001   	FNDERR  001372RG    002	N.DVNM= ****** GX	R$$DPB= 000001   	.PRSDV= ****** GX

CS.OUT= 000002   	FNDNXT  000654RG    002	N.FID = ****** GX	R$$DYM= 000001   	.REMOV= ****** GX

CS.WLD= 000010   	FRSTIM= ****** GX	N.FLID= 000016   	R$$EIS= 000000   	.SAVR1= ****** GX

CWLDUI  000446RG    002	FSTOUT  000226RG    002	N.FNAM= ****** GX	R$$VMS= 000001   	.WLDVC= ****** GX

C.CMLD= 000002   	F.BDB = ****** GX	N.FNMD= 000010   	R$$11M= 000001   	.WPARS= ****** GX

C.DEVD= 000006   	F.DFNB= ****** GX	N.FVER= ****** GX	SETWAR= ****** GX	.XQIO = ****** GX

C.DIRD= 000012   	F.DSPT= ****** GX	N.NEXT= ****** GX	STNBK1  000522RG    002



. ABS.	000131	   000

      	000000	   001

PURE$I	001640	   002

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  3900 WORDS  ( 16 PAGES)

DYNAMIC MEMORY:  4884 WORDS  ( 18 PAGES)

ELAPSED TIME:  00:00:22

OBJ$:PIPSBR,LIS$:PIPSBR/-SP=SRC$:PIPMAC,PIPSBR

