cdc:nos2.source:nam5871:hallocn
Table of Contents
HALLOCN
Table Of Contents
- [00011] PROC HALLOCN(ACBAD,ACN)
- [00063] PROC ABORT
- [00064] PROC KPUT
- [00065] PROC MGROW
- [00066] PROC XTRACE
Source Code
- HALLOCN.txt
- *DECK HALLOCN
- USETEXT ACB
- USETEXT ACNB
- USETEXT ACNT
- USETEXT DUMPFLG
- USETEXT KDIS
- USETEXT KHDRX
- USETEXT NIPDEF
- USETEXT PARAMS
- USETEXT APPSTAT
- PROC HALLOCN(ACBAD,ACN); # ALLOCATE CONNECTION NUMBER #
- STARTIMS;
- #
- *1DC HALLOCN
- * 1. PROC NAME AUTHOR DATE
- * HALLOCN C. BITTNER 81/12/01
- *
- * 2. FUNCTIONAL DESCRIPTION
- * ALLOCATE APPLICATION CONNECTION NUMBER
- *
- * 3. METHOD
- * CHECK IF ACNT HAS A FREE ENTRY (IF NOT THEN EXPAND
- * ACNT)
- * FIND NEXT FIRST FREE CONNECTION NUMBER
- * UPDATE HIGHEST CONNECTION NUMBER IN USE
- * INITIALIZE STATES IN ACNT
- * UPDATE TOTAL NUMBER OF CONNECTIONS IN ACB
- * UPDATE K-DISPLAY BUFFER
- *
- * 4. ENTRY PARAMETERS
- * ACBAD ADDRESS OF ACB TO ALLOCATE ACN FOR
- *
- * 5. EXIT PARAMETERS
- * ACN APPLICATION CONNECTION NUMBER ASSIGNED
- * = 0 IF NO CONNECTION NUMBER ASSIGNED
- *
- * 6. COMDECKS CALLED AND SYMPL TEXTS USED
- * ACB
- * ACNB
- * ACNT
- * NIPDEF
- * PARAMS
- * APPSTAT
- * KDIS
- *
- * 7. ROUTINES AND OVERLAYS CALLED
- * KPUT - UPDATE K-DISPLAY BUFFER
- * MGROW - EXPAND BUFFER
- * XTRACE - RECORD PROCEDURE CALL
- *
- * 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
- * THIS PROCEDURE IS CALLED BY PROC BLDACNB.
- *
- #
- STOPIMS;
- #
- EXTERNAL VARIABLES
- #
- XREF
- BEGIN
- PROC ABORT; # ABORT NIP #
- PROC KPUT ;
- PROC MGROW; # EXPAND BUFFER #
- PROC XTRACE; # RECORD PROCEDURE CALL #
- END
- #
- INTERNAL VARIABLES
- #
- ITEM ACBAD; # ACB ADDRESS #
- ITEM ACN; # APPLICATION CONNECTION NUMBER #
- ITEM ACNTINDX; # INDEX INTO ACNT #
- ITEM ESIZE; # SIZE TO EXPAND ACNT #
- ITEM FFCNFOUND B; # FIRST FREE CN FOUND FLAG #
- ITEM FLAG; # FLAG RETURNED IF MOVE SUCCESSFUL - MGROW#
- ITEM INDX; # INDUCTION LOOP VARIABLE #
- ITEM NUMACN; # NUMBER OF AVAILABLE CONNECTION NUMBERS #
- #**********************************************************************#
- BEGIN
- CONTROL IFEQ DEBUG,1;
- XTRACE("HLOCN") ;
- CONTROL FI;
- FFCNFOUND = FALSE; # INITIALIZE FIRST FREE CN FOUND FLAG #
- P<ACB> = ACBAD; # ACB ADDRESS #
- P<ACNT> = ACBACNT[0]; # BASE ACNT #
- NUMACN = ACNTMAXCN[0] - (ACNTBS[0] - ACNTHSIZE);
- ACNTINDX = ACNTFFCN[0] + ACNTHSIZE - ACNTMINACN[0]; # ACNT INDX #
- IF ACNTNFE[0] EQ 0
- THEN
- BEGIN # ACNT IS FULL #
- IF NUMACN LQ 0
- THEN # MAXIMUM NO OF CONNECTIONS REACHED #
- BEGIN
- ACN = 0; # NO ACN ASSIGNED - REACHED MAX ALREADY #
- RETURN ;
- END
- IF NUMACN GQ ACNTESIZE
- THEN
- ESIZE = ACNTESIZE;
- ELSE # HAVE LESS THAN ACNTESIZE CONN LEFT #
- ESIZE = NUMACN; # MAX ADDITION TO ACNT TABLE #
- MGROW(P<ACNT>,ACNTBS[0] + ESIZE,FLAG); # EXTEND BUFFER #
- ACBACNT[0] = P<ACNT>; # SET NEW ACNT ADDRESS #
- ACNTFFCN[0] = ACNTFFCN[0] + 1; # UPDATE FIRST FREE CN #
- ACNTNFE[0] = ESIZE - 1; # UPDATE NO FREE ENTRIES #
- END
- ELSE
- BEGIN # ENTRIES AVAILABLE IN ACNT #
- IF ACNTNFE[0] EQ 1
- THEN
- BEGIN # LAST AVAILABLE ENTRY IS BEING USED #
- ACNTFFCN[0] = ACNTBS[0] - ACNTHSIZE + ACNTMINACN[0];
- FFCNFOUND = TRUE; # SET FIRST FREE CN FOUND FLAG #
- ACNTNFE[0] = 0;
- END
- # FIND FIRST FREE CN #
- FOR INDX = ACNTINDX + 1 STEP 1 WHILE NOT FFCNFOUND DO
- BEGIN
- IF ACNTWD[INDX] EQ 0
- THEN
- BEGIN
- ACNTFFCN[0] = INDX - ACNTHSIZE + ACNTMINACN[0];
- # UPDATE FIRST FREE CN #
- ACNTNFE[0] = ACNTNFE[0] - 1; # UPDATE NO FREE ENTRIES #
- FFCNFOUND = TRUE;# SET FIRST FREE CN FOUND FLAG #
- END
- END
- END
- ACN = ACNTINDX - ACNTHSIZE + ACNTMINACN[0]; # APPL CONN NO #
- IF ACN GR ACNTHCN[0]
- THEN # UPDATE HIGHEST CONNECTION NUMBER #
- ACNTHCN[0] = ACN;
- ACNTCS[ACNTINDX] = STATX; # INITIALIZE CONNECTION STATE #
- ACNTIS[ACNTINDX] = STATX; # INITIALIZE IVT STATE #
- ACNTABO[ACNTINDX] = 0; # APPL BLK OUTSTANDING COUNT #
- RETURN ;
- END
- TERM
cdc/nos2.source/nam5871/hallocn.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator