User Tools

Site Tools


cdc:nos2.source:nam5871:hallocn

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
  1. *DECK HALLOCN
  2. USETEXT ACB
  3. USETEXT ACNB
  4. USETEXT ACNT
  5. USETEXT DUMPFLG
  6. USETEXT KDIS
  7. USETEXT KHDRX
  8. USETEXT NIPDEF
  9. USETEXT PARAMS
  10. USETEXT APPSTAT
  11. PROC HALLOCN(ACBAD,ACN); # ALLOCATE CONNECTION NUMBER #
  12. STARTIMS;
  13. #
  14. *1DC HALLOCN
  15. * 1. PROC NAME AUTHOR DATE
  16. * HALLOCN C. BITTNER 81/12/01
  17. *
  18. * 2. FUNCTIONAL DESCRIPTION
  19. * ALLOCATE APPLICATION CONNECTION NUMBER
  20. *
  21. * 3. METHOD
  22. * CHECK IF ACNT HAS A FREE ENTRY (IF NOT THEN EXPAND
  23. * ACNT)
  24. * FIND NEXT FIRST FREE CONNECTION NUMBER
  25. * UPDATE HIGHEST CONNECTION NUMBER IN USE
  26. * INITIALIZE STATES IN ACNT
  27. * UPDATE TOTAL NUMBER OF CONNECTIONS IN ACB
  28. * UPDATE K-DISPLAY BUFFER
  29. *
  30. * 4. ENTRY PARAMETERS
  31. * ACBAD ADDRESS OF ACB TO ALLOCATE ACN FOR
  32. *
  33. * 5. EXIT PARAMETERS
  34. * ACN APPLICATION CONNECTION NUMBER ASSIGNED
  35. * = 0 IF NO CONNECTION NUMBER ASSIGNED
  36. *
  37. * 6. COMDECKS CALLED AND SYMPL TEXTS USED
  38. * ACB
  39. * ACNB
  40. * ACNT
  41. * NIPDEF
  42. * PARAMS
  43. * APPSTAT
  44. * KDIS
  45. *
  46. * 7. ROUTINES AND OVERLAYS CALLED
  47. * KPUT - UPDATE K-DISPLAY BUFFER
  48. * MGROW - EXPAND BUFFER
  49. * XTRACE - RECORD PROCEDURE CALL
  50. *
  51. * 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
  52. * THIS PROCEDURE IS CALLED BY PROC BLDACNB.
  53. *
  54.  #
  55. STOPIMS;
  56.  
  57.  
  58. #
  59.   EXTERNAL VARIABLES
  60. #
  61. XREF
  62. BEGIN
  63. PROC ABORT; # ABORT NIP #
  64. PROC KPUT ;
  65. PROC MGROW; # EXPAND BUFFER #
  66. PROC XTRACE; # RECORD PROCEDURE CALL #
  67. END
  68.  
  69. #
  70.   INTERNAL VARIABLES
  71. #
  72.  
  73. ITEM ACBAD; # ACB ADDRESS #
  74. ITEM ACN; # APPLICATION CONNECTION NUMBER #
  75. ITEM ACNTINDX; # INDEX INTO ACNT #
  76. ITEM ESIZE; # SIZE TO EXPAND ACNT #
  77. ITEM FFCNFOUND B; # FIRST FREE CN FOUND FLAG #
  78. ITEM FLAG; # FLAG RETURNED IF MOVE SUCCESSFUL - MGROW#
  79. ITEM INDX; # INDUCTION LOOP VARIABLE #
  80. ITEM NUMACN; # NUMBER OF AVAILABLE CONNECTION NUMBERS #
  81.  
  82. #**********************************************************************#
  83.  
  84. BEGIN
  85.  
  86. CONTROL IFEQ DEBUG,1;
  87. XTRACE("HLOCN") ;
  88. CONTROL FI;
  89.  
  90. FFCNFOUND = FALSE; # INITIALIZE FIRST FREE CN FOUND FLAG #
  91. P<ACB> = ACBAD; # ACB ADDRESS #
  92. P<ACNT> = ACBACNT[0]; # BASE ACNT #
  93. NUMACN = ACNTMAXCN[0] - (ACNTBS[0] - ACNTHSIZE);
  94. ACNTINDX = ACNTFFCN[0] + ACNTHSIZE - ACNTMINACN[0]; # ACNT INDX #
  95. IF ACNTNFE[0] EQ 0
  96. THEN
  97. BEGIN # ACNT IS FULL #
  98. IF NUMACN LQ 0
  99. THEN # MAXIMUM NO OF CONNECTIONS REACHED #
  100. BEGIN
  101. ACN = 0; # NO ACN ASSIGNED - REACHED MAX ALREADY #
  102. RETURN ;
  103. END
  104. IF NUMACN GQ ACNTESIZE
  105. THEN
  106. ESIZE = ACNTESIZE;
  107. ELSE # HAVE LESS THAN ACNTESIZE CONN LEFT #
  108. ESIZE = NUMACN; # MAX ADDITION TO ACNT TABLE #
  109. MGROW(P<ACNT>,ACNTBS[0] + ESIZE,FLAG); # EXTEND BUFFER #
  110. ACBACNT[0] = P<ACNT>; # SET NEW ACNT ADDRESS #
  111. ACNTFFCN[0] = ACNTFFCN[0] + 1; # UPDATE FIRST FREE CN #
  112. ACNTNFE[0] = ESIZE - 1; # UPDATE NO FREE ENTRIES #
  113. END
  114. ELSE
  115. BEGIN # ENTRIES AVAILABLE IN ACNT #
  116. IF ACNTNFE[0] EQ 1
  117. THEN
  118. BEGIN # LAST AVAILABLE ENTRY IS BEING USED #
  119. ACNTFFCN[0] = ACNTBS[0] - ACNTHSIZE + ACNTMINACN[0];
  120. FFCNFOUND = TRUE; # SET FIRST FREE CN FOUND FLAG #
  121. ACNTNFE[0] = 0;
  122. END
  123.  
  124. # FIND FIRST FREE CN #
  125. FOR INDX = ACNTINDX + 1 STEP 1 WHILE NOT FFCNFOUND DO
  126. BEGIN
  127. IF ACNTWD[INDX] EQ 0
  128. THEN
  129. BEGIN
  130. ACNTFFCN[0] = INDX - ACNTHSIZE + ACNTMINACN[0];
  131. # UPDATE FIRST FREE CN #
  132. ACNTNFE[0] = ACNTNFE[0] - 1; # UPDATE NO FREE ENTRIES #
  133. FFCNFOUND = TRUE;# SET FIRST FREE CN FOUND FLAG #
  134. END
  135. END
  136. END
  137.  
  138.  
  139. ACN = ACNTINDX - ACNTHSIZE + ACNTMINACN[0]; # APPL CONN NO #
  140. IF ACN GR ACNTHCN[0]
  141. THEN # UPDATE HIGHEST CONNECTION NUMBER #
  142. ACNTHCN[0] = ACN;
  143. ACNTCS[ACNTINDX] = STATX; # INITIALIZE CONNECTION STATE #
  144. ACNTIS[ACNTINDX] = STATX; # INITIALIZE IVT STATE #
  145. ACNTABO[ACNTINDX] = 0; # APPL BLK OUTSTANDING COUNT #
  146.  
  147. RETURN ;
  148. END
  149. TERM
cdc/nos2.source/nam5871/hallocn.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator