

; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 1

;

;	0001	MODULE ENTER (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0010'

;	0004			) =

;	0005	BEGIN

;	0006	

;	0007	!

;	0008	! Copyright (c) 1977

;	0009	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0010	!

;	0011	! This software is furnished  under a license for use only on a single

;	0012	! computer  system and  may be  copied only with  the inclusion of the

;	0013	! above copyright notice.  This software, or any other copies thereof,

;	0014	! may not be provided or  otherwise made available to any other person

;	0015	! except for use on such system and to one who agrees to these license

;	0016	! terms.  Title to and  ownership of the  software  shall at all times

;	0017	! remain in DEC.

;	0018	!

;	0019	! The information in this software is subject to change without notice

;	0020	! and should  not be construed  as a commitment  by Digital  Equipment

;	0021	! Corporation.

;	0022	!

;	0023	! DEC assumes  no  responsibility  for  the use or  reliability of its

;	0024	! software on equipment which is not supplied by DEC.

;	0025	

;	0026	!++

;	0027	!

;	0028	! FACILITY:  F11ACP Structure Level 1

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This routine enters the given file name in the specified directory.

;	0033	!

;	0034	! ENVIRONMENT:

;	0035	!

;	0036	!	STARLET operating system, including privileged system services

;	0037	!	and internal exec routines.

;	0038	!

;	0039	!--

;	0040	!

;	0041	!

;	0042	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  30-Mar-1977  15:05

;	0043	!

;	0044	! REVISION HISTORY:

;	0045	!

;	0046	!   Andrew C. Goldstein, 5-Apr-1977  11:43

;	0047	!   X0002 - Add first level extension (use of previously allocated blocks)

;	0048	!

;	0049	!   Andrew C. Goldstein, 5-Apr-1977  16:50

;	0050	!   X0003 - Remove FCB and window arguments from DIRGET call

;	0051	!

;	0052	!   Andrew C. Goldstein, 7-Apr-1977  14:17

;	0053	!   X0004 - Add supersede subfunction logic

;	0054	!

;	0055	!   Andrew C. Goldstein, 19-Apr-1977  11:44



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 1-1

;

;	0056	!   X0005 - Add directory extension call

;	0057	!

;	0058	!   Andrew C. Goldstein, 26-Aug-1977  10:34

;	0059	!   X0006 - Add performance metering

;	0060	!

;	0061	!   Andrew C. Goldstein, 26-Sep-1977  18:07

;	0062	!   X0007 - Add higher and lower version flagging

;	0063	!

;	0064	!   Andrew C. Goldstein, 26-Jan-1978  16:11

;	0065	!   X0008 - Edge condition on maximize version

;	0066	!

;	0067	!   Andrew C. Goldstein, 23-APR-78  19:50

;	0068	!   X0009 - Add multi-block arg to DIRGET

;	0069	!

;	0070	!   Andrew C. Goldstein, 21-Jun-78  17:43

;	0071	!   A0010 - Use separate storage for superseded file ID

;	0072	!

;	0073	!**

;	0074	

;	0075	

;	0076	LIBRARY 'SYS$LIBRARY:LIB.L32';

;	0077	REQUIRE 'SRC$:FCPDEF.B32';



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2

;

;	0396	GLOBAL ROUTINE ENTER (ABD, FIB, RESULT_LENGTH, RESULT) : NOVALUE =

;	0397	

;	0398	!++

;	0399	!

;	0400	! FUNCTIONAL DESCRIPTION:

;	0401	!

;	0402	!	This routine enters the given file name in the specified directory.

;	0403	!

;	0404	! CALLING SEQUENCE:

;	0405	!	ENTER (ARG1, ARG2, ARG3, ARG4)

;	0406	!

;	0407	! INPUT PARAMETERS:

;	0408	!	ARG1: address of buffer descriptor packet

;	0409	!	ARG2: address of FIB of operation

;	0410	!

;	0411	! IMPLICIT INPUTS:

;	0412	!	NONE

;	0413	!

;	0414	! OUTPUT PARAMETERS:

;	0415	!	ARG3: address of longword to receive length of result string

;	0416	!	ARG4: address of result string buffer

;	0417	!

;	0418	! IMPLICIT OUTPUTS:

;	0419	!	DIR_RECORD: record number of new directory entry

;	0420	!

;	0421	! ROUTINE VALUE:

;	0422	!	NONE

;	0423	!

;	0424	! SIDE EFFECTS:

;	0425	!	directory altered, result string and length written into buffer packet

;	0426	!

;	0427	!--

;	0428	

;	0429	BEGIN

;	0430	

;	0431	MAP

;	0432		ABD		: REF BBLOCKVECTOR [,ABD$C_LENGTH],

;	0433						! descriptor list arg

;	0434		FIB		: REF BBLOCK,	! FIB argument

;	0435		RESULT		: REF VECTOR [,BYTE]; ! result string arg

;	0436	

;	0437	LOCAL

;	0438		NAMEBLOCK	: BBLOCK [NMB$C_LENGTH],

;	0439						! RAD-50 name block

;	0440		COUNT,				! count of name string

;	0441		STRINGP,			! address of name string

;	0442		RECADDR		: REF BBLOCK;	! pointer to found directory entry

;	0443	

;	0444	EXTERNAL

;	0445		CLEANUP_FLAGS	: BITVECTOR,	! cleanup action flags

;	0446		HIGHEST_VERSION	: SIGNED WORD,	! highest version encountered

;	0447		LOWEST_VERSION	: SIGNED WORD,	! lowest version number encountered

;	0448		FIRST_FREE,			! record number of free slot in directory

;	0449		DIR_RECORD,			! record number of entry created

;	0450		SUPER_FID	: BBLOCK;	! file ID of superseded file



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2-1

;

;	0451	

;	0452	EXTERNAL ROUTINE

;	0453		PMS_START_SUB,			! start subfunction metering

;	0454		PMS_END_SUB,			! end subfunction metering

;	0455		DIR_ACCESS,			! access the directory

;	0456		MAKE_NAMEBLOCK,			! construct name block

;	0457		DIR_SCAN,			! search the directory

;	0458		EXTEND_DIR,			! extend the directory

;	0459		DIRGET,				! read a directory record

;	0460		DIRPUT,				! write a directory record

;	0461		MAKE_STRING,			! convert directory entry to string

;	0462		RETURN_DIR;			! return data to buffer packet

;	0463	

;	0464	

;	0465	! Start metering for this subfunction.

;	0466	!

;	0467	

;	0468	PMS_START_SUB (PMS_ENTER);

;	0469	

;	0470	! The file ID to be entered must be non-zero

;	0471	!

;	0472	

;	0473	IF .FIB[FIB$W_FID_NUM] EQL 0

;	0474	THEN ERR_EXIT (SS$_BADPARAM);

;	0475	

;	0476	! Find the name string in the buffer packet. Construct the RAD-50 name block

;	0477	! from it and the other data in the FIB. Mask out the wild card bits, since

;	0478	! they are ignored.

;	0479	!

;	0480	

;	0481	COUNT = .ABD[ABD$C_NAME, ABD$W_COUNT];

;	0482	STRINGP = .ABD[ABD$C_NAME, ABD$W_TEXT] + ABD[ABD$C_NAME, ABD$W_TEXT] + 1;

;	0483	

;	0484	MAKE_NAMEBLOCK (.COUNT, .STRINGP, NAMEBLOCK);

;	0485	CH$MOVE (FIB$S_FID, FIB[FIB$W_FID], NAMEBLOCK[NMB$W_FID]);

;	0486	NAMEBLOCK[NMB$W_FLAGS] = .FIB[FIB$W_NMCTL] AND FIB$M_NEWVER;

;	0487	NAMEBLOCK[NMB$W_CONTEXT] = 0;

;	0488	

;	0489	! Access the directory.

;	0490	!

;	0491	

;	0492	DIR_ACCESS (.FIB, 1);

;	0493	

;	0494	! Now search the directory. If the search succeeds, we have a duplicate

;	0495	! entry. If superseding is enabled, save away the old file ID for

;	0496	! deletion later on.

;	0497	!

;	0498	

;	0499	RECADDR = DIR_SCAN (NAMEBLOCK, 1);

;	0500	IF .RECADDR NEQ 0			! if success, a duplicate exists

;	0501	THEN

;	0502	    BEGIN

;	0503	    IF NOT .FIB[FIB$V_SUPERSEDE]	! see if supersede mode

;	0504	    THEN ERR_EXIT (SS$_DUPFILENAME);

;	0505	



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2-2

;

;	0506	    CH$MOVE (FIB$S_FID, RECADDR[NMB$W_FID], SUPER_FID);

;	0507	    CLEANUP_FLAGS[CLF_SUPERSEDE] = 1;

;	0508	    CLEANUP_FLAGS[CLF_REENTER] = 1;

;	0509	    END

;	0510	

;	0511	! Given that the search failed, compute the new version number. Then position

;	0512	! to the free slot found in the directory scan and insert the new entry.

;	0513	! If no empty record has been found, the directory must be extended.

;	0514	!

;	0515	

;	0516	ELSE

;	0517	    BEGIN

;	0518	    IF .NAMEBLOCK[NMB$W_VERSION] EQL 0

;	0519	    OR (.NAMEBLOCK[NMB$V_NEWVER] AND .NAMEBLOCK[NMB$W_VERSION] LEQ .HIGHEST_VERSION)

;	0520	    THEN NAMEBLOCK[NMB$W_VERSION] = .HIGHEST_VERSION + 1;

;	0521	

;	0522	    IF .FIRST_FREE EQL 0

;	0523	    THEN

;	0524		BEGIN

;	0525		RECADDR = EXTEND_DIR ();

;	0526		END

;	0527	

;	0528	    ELSE

;	0529		BEGIN

;	0530		DIR_RECORD = .FIRST_FREE;

;	0531		RECADDR = DIRGET (.FIRST_FREE, 0);

;	0532		END;

;	0533	    END;

;	0534	

;	0535	! Set the higher and lower version flags according to what the directory

;	0536	! scan found.

;	0537	!

;	0538	

;	0539	IF .HIGHEST_VERSION GTR .NAMEBLOCK[NMB$W_VERSION]

;	0540	THEN FIB[FIB$V_HIGHVER] = 1;

;	0541	IF .LOWEST_VERSION LSS .NAMEBLOCK[NMB$W_VERSION]

;	0542	THEN FIB[FIB$V_LOWVER] = 1;

;	0543	

;	0544	! Check the new version number for legality. Copy the new directory entry

;	0545	! into the record and write it back.

;	0546	!

;	0547	

;	0548	IF .NAMEBLOCK[NMB$W_VERSION] GTRU 32767

;	0549	THEN ERR_EXIT (SS$_BADFILEVER);

;	0550	

;	0551	CH$MOVE (16, NAMEBLOCK, .RECADDR);

;	0552	DIRPUT (.RECADDR);

;	0553	CLEANUP_FLAGS[CLF_REMOVE] = 1;

;	0554	

;	0555	! Finally convert the name block into the resultant string.

;	0556	!

;	0557	

;	0558	.RESULT_LENGTH = MAKE_STRING (NAMEBLOCK, .RESULT);

;	0559	KERNEL_CALL (RETURN_DIR, ..RESULT_LENGTH, .RESULT, .ABD);

;	0560	



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2-3

;

;	0561	! Stop metering of this subfunction

;	0562	!

;	0563	

;	0564	PMS_END_SUB ();

;	0565	

;	0566	END;					! end of routine ENTER





							    .TITLE  ENTER

							    .IDENT  \A0010\



							    .EXTRN  CLEANUP_FLAGS, HIGHEST_VERSION, LOWEST_VERSION

							    .EXTRN  FIRST_FREE, DIR_RECORD, SUPER_FID, PMS_START_SUB

							    .EXTRN  PMS_END_SUB, DIR_ACCESS, MAKE_NAMEBLOCK, DIR_SCAN

							    .EXTRN  EXTEND_DIR, DIRGET, DIRPUT, MAKE_STRING, RETURN_DIR

							    .EXTRN  SYS$CMKRNL



							    .PSECT  $CODE$,NOWRT,2



					 01FC 00000 	    .ENTRY  ENTER, Save R2,R3,R4,R5,R6,R7,R8			      ; 0396

		         58 	0000G  CF  9E 00002 	    MOVAB   HIGHEST_VERSION, R8					      ;

		         5E 	       14  C2 00007 	    SUBL2   #20, SP						      ;

				       07  DD 0000A 	    PUSHL   #7							      ; 0468

		  0000G  CF	       01  FB 0000C 	    CALLS   #1, PMS_START_SUB					      ;

		         50 	  08   AC  D0 00011 	    MOVL    FIB, R0						      ; 0473

				  04   A0  B5 00015 	    TSTW    4(R0)						      ;

				       02  12 00018 	    BNEQ    1$							      ;

				       14  BF 0001A 	    CHMU    #20							      ; 0474

		         50 	  04   AC  D0 0001C 1$:     MOVL    ABD, R0						      ; 0481

		         52 	  12   A0  3C 00020 	    MOVZWL  18(R0), COUNT					      ;

		         51 	  10   A0  9E 00024 	    MOVAB   16(R0), R1						      ; 0482

		         50 	       61  3C 00028 	    MOVZWL  (R1), R0						      ;

		         50 	  01 A140  9E 0002B 	    MOVAB   1(R1)[R0], STRINGP					      ;

				4001   8F  BB 00030 	    PUSHR   #^M<R0,SP>						      ; 0484

				       52  DD 00034 	    PUSHL   COUNT						      ;

		  0000G  CF	       03  FB 00036 	    CALLS   #3, MAKE_NAMEBLOCK					      ;

		         56 	  08   AC  D0 0003B 	    MOVL    FIB, R6						      ; 0485

	   6E 	    04   A6	       06  28 0003F 	    MOVC3   #6, 4(R6), NAMEBLOCK				      ;

      10   AE	    14   A6	FDFF   8F  AB 00044 	    BICW3   #-513, 20(R6), NAMEBLOCK+16				      ; 0486

				  12   AE  B4 0004C 	    CLRW    NAMEBLOCK+18					      ; 0487

				       01  DD 0004F 	    PUSHL   #1							      ; 0492

				       56  DD 00051 	    PUSHL   R6							      ;

		  0000G  CF	       02  FB 00053 	    CALLS   #2, DIR_ACCESS					      ;

				       01  DD 00058 	    PUSHL   #1							      ; 0499

				  04   AE  9F 0005A 	    PUSHAB  NAMEBLOCK						      ;

		  0000G  CF	       02  FB 0005D 	    CALLS   #2, DIR_SCAN					      ;

		         57 	       50  D0 00062 	    MOVL    R0, RECADDR						      ;

				       1A  13 00065 	    BEQL    3$							      ; 0500

	   04 	    15   A6	       02  E0 00067 	    BBS     #2, 21(R6), 2$					      ; 0503

				0868   8F  BF 0006C 	    CHMU    #2152						      ; 0504

    0000G  CF	         67 	       06  28 00070 2$:     MOVC3   #6, (RECADDR), SUPER_FID				      ; 0506

		  0000G  CF 00800020   8F  C8 00076 	    BISL2   #8388640, CLEANUP_FLAGS				      ; 0508

				       34  11 0007F 	    BRB     8$							      ; 0500

				  0E   AE  B5 00081 3$:     TSTW    NAMEBLOCK+14					      ; 0518

				       0B  13 00084 	    BEQL    4$							      ;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2-4

;

	   0B 	    11   AE	       01  E1 00086 	    BBC     #1, NAMEBLOCK+17, 5$				      ; 0519

		         68 	  0E   AE  B1 0008B 	    CMPW    NAMEBLOCK+14, HIGHEST_VERSION			      ;

				       05  14 0008F 	    BGTR    5$							      ;

      0E   AE	         68 	       01  A1 00091 4$:     ADDW3   #1, HIGHEST_VERSION, NAMEBLOCK+14			      ; 0520

		         52 	0000G  CF  D0 00096 5$:     MOVL    FIRST_FREE, R2					      ; 0522

				       07  12 0009B 	    BNEQ    6$							      ;

		  0000G  CF	       00  FB 0009D 	    CALLS   #0, EXTEND_DIR					      ; 0525

				       0E  11 000A2 	    BRB     7$							      ;

		  0000G  CF	       52  D0 000A4 6$:     MOVL    R2, DIR_RECORD					      ; 0530

				       7E  D4 000A9 	    CLRL    -(SP)						      ; 0531

				       52  DD 000AB 	    PUSHL   R2							      ;

		  0000G  CF	       02  FB 000AD 	    CALLS   #2, DIRGET						      ;

		         57 	       50  D0 000B2 7$:     MOVL    R0, RECADDR						      ;

		    0E   AE	       68  B1 000B5 8$:     CMPW    HIGHEST_VERSION, NAMEBLOCK+14			      ; 0539

				       09  15 000B9 	    BLEQ    9$							      ;

		         50 	  08   AC  D0 000BB 	    MOVL    FIB, R0						      ; 0540

		    15   A0	  80   8F  88 000BF 	    BISB2   #128, 21(R0)					      ;

		    0E   AE	0000G  CF  B1 000C4 9$:     CMPW    LOWEST_VERSION, NAMEBLOCK+14			      ; 0541

				       09  18 000CA 	    BGEQ    10$							      ;

		         50 	  08   AC  D0 000CC 	    MOVL    FIB, R0						      ; 0542

		    15   A0	  40   8F  88 000D0 	    BISB2   #64, 21(R0)						      ;

		  7FFF   8F	  0E   AE  B1 000D5 10$:    CMPW    NAMEBLOCK+14, #32767				      ; 0548

				       04  1B 000DB 	    BLEQU   11$							      ;

				0820   8F  BF 000DD 	    CHMU    #2080						      ; 0549

	   67 	         6E 	       10  28 000E1 11$:    MOVC3   #16, NAMEBLOCK, (RECADDR)				      ; 0551

				       57  DD 000E5 	    PUSHL   RECADDR						      ; 0552

		  0000G  CF	       01  FB 000E7 	    CALLS   #1, DIRPUT						      ;

		  0000G  CF	  40   8F  88 000EC 	    BISB2   #64, CLEANUP_FLAGS+2				      ; 0553

				  10   AC  DD 000F2 	    PUSHL   RESULT						      ; 0558

				  04   AE  9F 000F5 	    PUSHAB  NAMEBLOCK						      ;

		  0000G  CF	       02  FB 000F8 	    CALLS   #2, MAKE_STRING					      ;

		    0C   BC	       50  D0 000FD 	    MOVL    R0, @RESULT_LENGTH					      ;

				  04   AC  DD 00101 	    PUSHL   ABD							      ; 0559

				  10   AC  DD 00104 	    PUSHL   RESULT						      ;

				  0C   BC  DD 00107 	    PUSHL   @RESULT_LENGTH					      ;

				       03  DD 0010A 	    PUSHL   #3							      ;

				       5E  DD 0010C 	    PUSHL   SP							      ;

				0000G  CF  9F 0010E 	    PUSHAB  RETURN_DIR						      ;

	      00000000G  9F	       06  FB 00112 	    CALLS   #6, @#SYS$CMKRNL					      ;

		  0000G  CF	       00  FB 00119 	    CALLS   #0, PMS_END_SUB					      ; 0564

					   04 0011E 	    RET     							      ; 0396



; Routine Size:  287 bytes





;	0567	

;	0568	END

;	0569	ELUDOM













;				       PSECT SUMMARY



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:55:18	DBB3:[F11A.SRC]ENTER.B32;10					Page 2-5

;

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   287  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)









;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582        22         0       236











; Size:		287 code + 0 data bytes

; Run Time:	00:08.4

; Elapsed Time:	00:19.6

; Memory Used:	313 pages

; Compilation Complete

