User Tools

Site Tools


cdc:nos2.source:nam5871:ssttmr

SSTTMR

Table Of Contents

  • [00003] PROC SSTTMR
  • [00004] TABLE MANAGER ROUTINES.
  • [00008] TABLE MANAGER ROUTINES.
  • [00057] PROC ABORT
  • [00058] PROC MESSAGE
  • [00059] PROC MOVEI
  • [00060] PROC RECALL
  • [00061] PROC SSTRCM
  • [00073] PROC SSTASU
  • [00074] PROC SSTATS
  • [00075] PROC SSTDFL
  • [00076] PROC SSTETS
  • [00077] PROC SSTITM
  • [00078] PROC SSTRTS
  • [00079] PROC SSTSDA
  • [00135] PROC CVT(TBL$PNTR)
  • [00136] CHECK VALIDITY OF TABLE POINTER.
  • [00140] CVT - CHECK VALIDITY OF TABLE POINTER.
  • [00217] PROC PTO(AVAIL,INCR)
  • [00218] PROCESS TABLE OVERFLOW.
  • [00222] PTO - PROCESS TABLE OVERFLOW.
  • [00287] PROC RAS(K,AVAIL,INCR,SUM,BASE,NEWL)
  • [00288] RE-ALLOCATE STORAGE.
  • [00292] RAS - RE-ALLOCATE STORAGE.
  • [00374] PROC RFL(NEED,AVAIL,OVL,INCR)
  • [00375] REQUEST FIELD LENGTH.
  • [00379] RFL - REQUEST FIELD LENGTH.
  • [00468] PROC SSTASU
  • [00469] ACCUMULATE STORAGE USED.
  • [00473] SSTASU - ACCUMULATE STORAGE USED.
  • [00519] PROC SSTATS(P$TABLE$,(INCR))
  • [00520] ALLOCATE TABLE SPACE.
  • [00524] SSTATS - ALLOCATE TABLE SPACE.
  • [00608] PROC SSTDFL
  • [00609] SSTDFL - DECREASE FIELD LENGTH.
  • [00613] SSTDFL - DECREASE FIELD LENGTH.
  • [00688] PROC SSTETS (P$TABLE$,(P),(N))
  • [00689] SSTETS - ENLARGE TABLE SPACE.
  • [00693] SSTETS - ENLARGE TABLE SPACE.
  • [00781] PROC SSTITM( PTABLES, TEND ,LOADBASE )
  • [00782] INITIALIZE TABLE MANAGER.
  • [00786] SSTITM - INITIALIZE TABLE MANAGER.
  • [00865] PROC SSTRTS (P$TABLE$,(P),(N))
  • [00866] SSTRTS - REMOVE TABLE SPACE.
  • [00870] SSTRTS - REMOVE TABLE SPACE.
  • [00943] PROC SSTSDA 1)
1)
NB),MEMSTAT,DONE)
  • [00944] SET DYNAMIC AREA BASE.
  • [00948] SSTSDA - SET DYNAMIC AREA BASE ADDRESS.
</WRAP> === Source Code ===
SSTTMR.txt
  1. *DECK SSTTMR
  2. USETEXT TEXTSS
  3. PROC SSTTMR;
  4. # TITLE - TABLE MANAGER ROUTINES. #
  5.  
  6. BEGIN # SSTTMR #
  7. #
  8. ** SSTTMR - TABLE MANAGER ROUTINES.
  9. *
  10. * R. H. GOODELL. 76/06/17. WRITTEN FOR USE WITH *DDLCG*.
  11. * R. H. GOODELL. 80/02/15. ADAPTED FOR USE WITH *DDLVAX*.
  12. * S. H. FISCHER 81/09/03. ADAPTED FOR USE WITH NETWORKS.
  13. * F. HOU. 81/07/27 ADD ENLARGE AND REMOVE SPACE.
  14. *
  15. * THIS SYMPL SUBPROGRAM IS ROUGHLY EQUIVALENT TO THE STANDARD
  16. * COMMON DECK *COMCMTP* WHICH CONTAINS A COMPASS MANAGED TABLE
  17. * PACKAGE WRITTEN BY G. R. MANSFIELD.
  18. *
  19. * PROC SSTTMR
  20. *
  21. * ENTRY NONE.
  22. *
  23. * EXIT NONE.
  24. *
  25. * NOTE - MANAGED TABLE POINTERS.
  26. *
  27. * DUE TO LANGUAGE RESTRICTIONS IN SYMPL, THE STORAGE AREA
  28. * CONTAINING THE MANAGED (DYNAMIC) TABLE POINTERS MUST BE
  29. * DECLARED IN TWO DIFFERENT WAYS. IN THE MAIN
  30. * PROGRAM MODULE IT IS A SERIES OF BASED ARRAYS AND
  31. * LENGTH ITEMS, BUT IN THE *SSTTMR* MODULE THE SAME AREA
  32. * IS AN ARRAY OF TWO-WORD ENTRIES. THIS RESULTS IN THE
  33. * FOLLOWING CORRESPONDENCE OF STORAGE LOCATIONS.
  34. *
  35. * MAIN SSTTMR VIA
  36. * NAME TABLES ITEM DEF
  37. *
  38. * TABLES TABF [0] BASE
  39. * FL TABL [0] FL
  40. * P<XXX> TABF [1] -
  41. * XXXL TABL [1] -
  42. * TABF [2] -
  43. * . TABL [2] -
  44. * . ... -
  45. * . TABF [N] -
  46. * TABL [N] -
  47. * P<TEND> TABF [N+1] -
  48. * TENDL TABL [N+1] SU
  49. *
  50. #
  51.  
  52. #
  53. **** PROC SSTTMR - XREF LIST.
  54. #
  55. XREF
  56. BEGIN
  57. PROC ABORT; # ABORT JOB #
  58. PROC MESSAGE; # ISSUE MESSAGE TO DAYFILE #
  59. PROC MOVEI; # MOVE BLOCK OF DATA, INDIRECT #
  60. PROC RECALL; # RETURN CONTROL WHEN COMPLETE #
  61. PROC SSTRCM; # REQUEST FIELD LENGTH #
  62. END
  63. #
  64. ****
  65. #
  66.  
  67.  
  68. #
  69. **** PROC SSTTMR - XDEF LIST.
  70. #
  71. XDEF
  72. BEGIN
  73. PROC SSTASU; # ACCUMULATE STORAGE USED #
  74. PROC SSTATS; # ALLOCATE TABLE SPACE #
  75. PROC SSTDFL; # DECREASE FIELD LENGTH #
  76. PROC SSTETS; # ENLARGE TABLE SPACE #
  77. PROC SSTITM; # INITIALIZE TABLE MANAGER #
  78. PROC SSTRTS; # REMOVE TABLE SPACE #
  79. PROC SSTSDA; # SET DYNAMIC AREA BASE ADDRESS #
  80. END
  81. #
  82. ****
  83. #
  84.  
  85.  
  86. DEF BASE #TABF [0]# ; # FWA TABLE AREA #
  87. DEF FL #TABL [0]# ; # FIELD LENGTH #
  88. DEF FLMUL # O"4000" #; # FIELD LENGTH MULTIPLE #
  89. DEF SLOP # O"1000" #; # MINIMUM TOTAL AVAIL SPACE #
  90. DEF SU #TABL [NTAB+1] #; # STORAGE USED #
  91.  
  92.  
  93. #
  94. * LOCAL DATA.
  95. #
  96. ITEM AVAIL; # TOTAL AVAIL SPACE #
  97. ITEM EXP; # FIXED EXPANSION SPACE #
  98. ITEM FRSTTBL; # ADDRESS OF FIRST TABLE POINTER #
  99. ITEM I; # TABLE VECTOR INDEX #
  100. ITEM INCR; # CHANGE IN TABLE SIZE #
  101. ITEM K; # CURRENT TABLE INDEX #
  102. ITEM LASTTBL; # ADDRESS OF LAST TABLE POINTER #
  103. ITEM MAXFL; # MAXIMUM FIELD LENGTH ALLOWED #
  104. ITEM MEMWORD; # WORD FOR PTO CM FL REQUESTS #
  105. ITEM NEWA; # NEW FWA OF TABLE #
  106. ITEM NEWL; # NEW LENGTH OF TABLE K #
  107. ITEM NTAB; # NUMBER OF TABLES #
  108. ITEM OVL; # NONZERO FOR IMMEDIATE MEMORY REQUEST #
  109. ITEM OVLBASE; # BASE FOR LOADING OVERLAYS #
  110. ITEM OVLFLRQ B = FALSE;# TRUE WHEN OVERLAY REQ ACTIVE #
  111. ITEM SUM; # TOTAL OF ALL TABLE LENGTHS #
  112.  
  113. #
  114. * THIS BASED ARRAY POINTS TO THE MEMORY REQUEST WORD.
  115. #
  116. BASED ARRAY MREQ[0:0] S(1);
  117. BEGIN
  118. ITEM MREQ$FL I(00,00,30); # REQUEST AND RETURN CMFL #
  119. ITEM MREQ$C B(00,59,01); # COMPLETION BIT #
  120. END
  121.  
  122.  
  123. #
  124. * THIS BASED ARRAY POINTS TO THE TABLE POINTERS TO BE MAINTAINED.
  125. #
  126. BASED ARRAY TABLES [00:00] S(2);
  127. BEGIN # TABLE POINTER VECTOR #
  128. ITEM TABA U(00,00,30); # NEW FWA #
  129. ITEM TABB U(00,42,18); # OLD FWA #
  130. ITEM TABF I(00,00,60); # CURRENT FWA #
  131. ITEM TABL I(01,00,60); # LENGTH ALLOCATED TO TABLE #
  132. END
  133. CONTROL EJECT;
  134. $BEGIN
  135. PROC CVT(TBL$PNTR);
  136. # TITLE - CHECK VALIDITY OF TABLE POINTER. #
  137.  
  138. BEGIN # CVT #
  139. #
  140. ** CVT - CHECK VALIDITY OF TABLE POINTER.
  141. *
  142. * D.K. ENDO 82/06/01
  143. *
  144. * THIS PROCEDURE CHECKS IF THE POINTER FOR THE MANAGED TABLE IS
  145. * VALID.
  146. *
  147. * PROC CVT(TBL$PNTR)
  148. *
  149. * ENTRY 1. TBL$PNTR - TABLE POINTER TO BE VALIDATED.
  150. *
  151. * EXIT 1. NONE, IF POINTER IS O.K.
  152. * 2. DAYFILE MESSAGE AND ABORT, IF INVALID.
  153. *
  154. #
  155.  
  156. ITEM TBL$PNTR; # TABLE POINTER TO BE CHECKED #
  157. ITEM TBL$LOC; # TABLE POINTER LOCATION #
  158.  
  159.  
  160. #
  161. * THIS ARRAY DEFINES THE -NOT A TABLE POINTER- MESSAGE TEXT SENT
  162. * WHEN THE POINTER IS NOT WITHIN THE RANGE OF MANAGED TBL POINTERS
  163. #
  164. ARRAY NP$TXT [00:00] S(4);
  165. BEGIN
  166. ITEM NP$MSG1 C(00,00,20) = ["ILLEGAL TABLE POINTE"];
  167. ITEM NP$MSG2 C(02,00,10) = ["R - SSTTMR"];
  168. ITEM NP$ZBYT U(03,00,60) = [0];
  169. END
  170.  
  171.  
  172. #
  173. * THIS ARRAY DEFINES THE -ERRONEOUS POINTER VALUE- MESSAGE TEXT SENT
  174. * WHEN THE TABLE POINTER DOES NOT POINT INTO THE MANAGED TABLE AREA.
  175. #
  176. ARRAY EPV$TXT [00:00] S(4);
  177. BEGIN
  178. ITEM EPV$MSG1 C(00,00,20) =["ERRONEOUS TABLE POIN"];
  179. ITEM EPV$MSG2 C(02,00,18) = ["TER VALUE - SSTTMR"];
  180. ITEM EPV$ZBYT U(03,48,12) = [0];
  181. END
  182.  
  183.  
  184. #
  185. * CVT CODE BEGINS HERE
  186. *
  187. *
  188. * IF THE TABLE POINTER IS NOT A MANAGED TABLE POINTER, THEN SEND AN
  189. * ERROR MESSAGE INDICATING SO AND ABORT.
  190. #
  191. TBL$LOC = LOC(TBL$PNTR);
  192. IF TBL$LOC LS FRSTTBL OR
  193. TBL$LOC GR LASTTBL
  194. THEN
  195. BEGIN
  196. MESSAGE(NP$TXT,0);
  197. ABORT;
  198. END
  199.  
  200.  
  201. #
  202. * IF POINTER NOT POINTING INTO THE MANAGED TABLE AREA, THEN
  203. * SEND A MESSAGE INDICATING SO AND ABORT.
  204. #
  205. IF TBL$PNTR LS BASE
  206. THEN
  207. BEGIN
  208. MESSAGE(EPV$TXT,0);
  209. ABORT;
  210. END
  211.  
  212.  
  213. RETURN; # **** RETURN **** #
  214. END # CVT #
  215. $END
  216. CONTROL EJECT;
  217. PROC PTO(AVAIL,INCR);
  218. # TITLE - PROCESS TABLE OVERFLOW. #
  219.  
  220. BEGIN # PTO #
  221. #
  222. ** PTO - PROCESS TABLE OVERFLOW.
  223. *
  224. * R. H. GOODELL 76/06/17
  225. * S. H. FISCHER 82/06/01 ADD CHECK FOR MEM REQUEST IN
  226. * PROGRESS
  227. *
  228. * THIS PROCEDURE IS CALLED BY *SSTATS* WHEN AVAIL MEMORY SPACE IS
  229. * TOO SMALL.
  230. *
  231. * PROC PTO(AVAIL,INCR)
  232. *
  233. * ENTRY 1. AVAIL = AMOUNT OF SPACE CURRENTLY AVAILABLE
  234. * 2. INCR = AMOUNT OF SPACE NEEDED.
  235. *
  236. * EXIT 1. MORE SPACE FOR TABLE EXPANSION.
  237. *
  238. #
  239.  
  240. ITEM AVAIL; # AMOUNT OF AVAILABLE SPACE LEFT #
  241. ITEM INCR; # AMOUNT OF CP WORDS TO INCREASE/DECREASE #
  242. ITEM NEED; # AMOUNT OF SPACE NEEDED #
  243. ITEM NEWFL; # FIELD LENGTH AFTER MEM REQ IS COMPLETE #
  244.  
  245. #
  246. * PTO CODE BEGINS HERE
  247. *
  248. *
  249. * IF A MEMORY REQUEST IS ALREADY IN PROGRESS, WAIT UNTIL IT IS
  250. * COMPLETE, SAVE THE NEW FIELD LENGTH VALUE, AND CALCULATE THE
  251. * NEW AMOUNT OF AVAILABLE SPACE.
  252. #
  253. IF OVLFLRQ
  254. THEN # OVL CM REQ IN PROGRESS #
  255. BEGIN
  256. IF NOT MREQ$C[0]
  257. THEN
  258. BEGIN
  259. RECALL( MREQ[0] );
  260. END
  261.  
  262. NEWFL = MREQ$FL[0];
  263. AVAIL = AVAIL + NEWFL - FL;
  264. FL = NEWFL;
  265. TABF [NTAB+1] = FL - 8 ;
  266. OVLFLRQ = FALSE;
  267. END
  268.  
  269. #
  270. * CALCULATE THE AMOUNT OF SPACE NEEDED TO INCREASE THE TABLE.
  271. * IF MORE SPACE IS NEEDED THEN REQUEST FOR IT.
  272. #
  273. NEED = INCR + SLOP - AVAIL ;
  274.  
  275. IF NEED GR 0
  276. THEN
  277. BEGIN
  278. OVL = 1;
  279. RFL(NEED,AVAIL,OVL,INCR);
  280. END
  281.  
  282.  
  283. RETURN; # **** RETURN **** #
  284.  
  285. END # PTO #
  286. CONTROL EJECT;
  287. PROC RAS(K,AVAIL,INCR,SUM,BASE,NEWL);
  288. # TITLE - RE-ALLOCATE STORAGE. #
  289.  
  290. BEGIN # RAS #
  291. #
  292. ** RAS - RE-ALLOCATE STORAGE.
  293. *
  294. * S. H. FISCHER. 82/05/17.
  295. *
  296. * *RAS* IS CALLED WHEN ALL TABLES MUST BE MOVED TO ACCOMODATE THE
  297. * EXPANSION OF ONE TABLE OR TO COMPACT THE TABLES TO ALLOW FOR
  298. * FIELD LENGTH REDUCTION.
  299. *
  300. * PROC RAS(K,AVAIL,INCR,SUM,BASE,NEWL)
  301. *
  302. * ENTRY:
  303. * AVAIL = AVAILABLE FREE MEMORY.
  304. * K = TABLE INDEX FOR TABLE TO GROW.
  305. * INCR = AMOUNT TABLE MUST GROW.
  306. * NEWL = NEW LENGTH OF TABLE K ( INCLUDED INCR ).
  307. * BASE = POINTER TO BEGINNING OF MANAGED TABLES.
  308. * SUM = SUMMATION OF ALL TABLE LENGTHS.
  309. *
  310. * EXIT:
  311. * TABLES MOVED AROUND IN MEMORY.
  312. *
  313. * NOTES:
  314. * EXPANSION SPACE ABOVE EACH TABLE IS AS FOLLOWS.
  315. * GUARANTEE ONE FREE WORD ABOVE EACH TABLE.
  316. * DIVIDE ONE HALF OF TOTAL AVAILABLE SPACE EQUALLY AMONG ALL
  317. * TABLES.
  318. * DIVIDE THE OTHER HALF PROPORTIONALLY TO THE SIZE OF EACH TABLE.
  319. *
  320. #
  321.  
  322. ITEM K; # INDEX TO TABLE POINTER #
  323. ITEM AVAIL; # AMOUNT OF AVAILABLE SPACE #
  324. ITEM INCR; # AMOUNT OF CP WORDS TO INCREASE/DECREASE #
  325. ITEM SUM; # TOTAL AMOUNT OF TABLE SPACE ALLOCATED #
  326. ITEM BASE; # POINTS TO THE BEGINNING OF MANAGED TBLS #
  327. ITEM NEWL; # NEW LENGTH OF THE TABLE TO BE CHANGED #
  328. ITEM NEWA; # NEW ADDRESS OF TABLE #
  329.  
  330. #
  331. * RAS CODE BEGINS HERE
  332. #
  333.  
  334. AVAIL = AVAIL - INCR; # ADJUST FOR CHANGE #
  335. SUM = SUM + INCR;
  336. TABL[K] = NEWL;
  337. EXP = (AVAIL/2) / (NTAB + 1); # FIXED SPACE ABOVE EACH #
  338. NEWA = BASE;
  339. FOR I = 1 STEP 1 UNTIL NTAB
  340. DO
  341. BEGIN # COMPUTE NEW FWA FOR EACH TABLE #
  342. TABA[I] = NEWA;
  343. NEWA = NEWA+TABL[I]+EXP+((AVAIL/2)*TABL[I])/SUM;
  344. END
  345.  
  346. TABL[K] = TABL[K] - INCR;
  347.  
  348. FOR I = NTAB STEP -1 UNTIL 1 # MOVE TABLES UP #
  349. DO
  350. BEGIN
  351. IF TABA[I] GR TABB[I]
  352. THEN
  353. BEGIN
  354. MOVEI( TABL[I], TABB[I], TABA[I] );
  355. END
  356. END
  357.  
  358. FOR I = 1 STEP 1 UNTIL NTAB # MOVE TABLES DOWN #
  359. DO
  360. BEGIN
  361. IF TABA[I] LS TABB[I]
  362. THEN
  363. BEGIN
  364. MOVEI( TABL[I], TABB[I], TABA[I] );
  365. END
  366. TABF[I] = TABA[I];
  367. TABA[I] = 0; # RESET POINTERS #
  368. END
  369.  
  370. RETURN; # **** RETURN **** #
  371.  
  372. END # RAS #
  373. CONTROL EJECT;
  374. PROC RFL(NEED,AVAIL,OVL,INCR);
  375. # TITLE - REQUEST FIELD LENGTH. #
  376.  
  377. BEGIN # RFL #
  378. #
  379. ** RFL - REQUEST FIELD LENGTH.
  380. *
  381. * S. H. FISCHER. 82/05/11.
  382. *
  383. * *RFL* IS CALLED TO REQUEST ADJUSTMENT IN THE CENTRAL
  384. * MEMORY FIELD LENGTH FOR THE PROGRAM.
  385. *
  386. * PROC RFL(NEED,AVAIL,OVL,INCR)
  387. *
  388. * ENTRY:
  389. * NEED = FIELD LENGTH INCREASE NEEDED.
  390. * AVAIL = AMOUNT OF MEMORY AVAILABLE FOR TABLE EXPANSION.
  391. * OVL = ZERO IF MEMORY CAN BE WAITED FOR.
  392. * INCR = AMOUNT OF SPACE TO ADD TO TABLE.
  393. *
  394. * EXIT:
  395. * IF OVL = NONZERO, AVAIL, FL UPDATED.
  396. * = ZERO, AVAIL, FL UPDATED IF MEMORY REQUEST
  397. * WAS SATISFIED IMMEDIATELY.
  398. * OTHERWISE THE MEMORY REQUEST IS STILL PENDING.
  399. *
  400. *
  401. #
  402.  
  403.  
  404. ITEM NEED; # AMOUNT OF TOTAL SPACE NEEDED #
  405. ITEM AVAIL; # AMOUNT OF AVAILABLE SPACE #
  406. ITEM OVL; # NONZERO IF IMMEDIATE MEMORY REQUEST #
  407. ITEM INCR; # AMOUNT OF CP WORDS TO INCREASE/DECREASE #
  408. ITEM NEWFL; # CALCULATED NEW FIELD LENGTH #
  409.  
  410.  
  411. #
  412. * THIS ARRAY DEFINES THE MESSAGE SENT WHEN NO MORE FIELD LENGTH
  413. * CAN BE ALLOCATED TO THIS JOB.
  414. #
  415. ARRAY NOSPACE [00:00] S(4);
  416. BEGIN
  417. ITEM NS$MSG1 C(00,00,20) = [" INSUFFICIENT CM SP"];
  418. ITEM NS$MSG2 C(02,00,17) = ["ACE, JOB ABORTED."];
  419. ITEM NS$ZBYT U(03,42,18) = [ 0 ];
  420. END
  421. #
  422. * RFL CODE BEGINS HERE
  423. *
  424. *
  425. * CALCULATE THE NEW FIELD LENGTH REQUIRED. IF THE NEW FIELD
  426. * LENGTH REQUIRED IS LARGER THAN THE MAXIMUM FIELD LENGTH ALLOWED
  427. * BY THE SYSTEM, THEN SET THE NEW FIELD LENGTH VALUE TO THE
  428. * MAXIMUM ALLOWED, IF THAT STILL IS NOT ENOUGH ROOM, THEN SEND
  429. * A DAYFILE MESSAGE AND ABORT.
  430. #
  431. NEWFL = ((FL + NEED + FLMUL -1) / FLMUL) * FLMUL;
  432.  
  433. IF NEWFL GR MAXFL
  434. THEN
  435. BEGIN
  436. NEWFL = MAXFL;
  437. IF INCR GR (AVAIL + NEWFL - FL )
  438. THEN
  439. BEGIN
  440. MESSAGE(NOSPACE, 0);
  441. ABORT;
  442. END
  443. END
  444.  
  445. #
  446. * MAKE A MEMORY REQUEST WITH THE CALCULATED NEW FIELD LENGTH. IF
  447. * THE REQUEST IS COMPLETE, THEN SAVE THE NEW FIELD LENGTH AND
  448. * THE AMOUNT OF SPACE AVAILABLE.
  449. #
  450. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  451. SVT$VAL[SVL"RCM"] = SVT$VAL[SVL"RCM"] + 1;
  452. $END
  453. SSTRCM( NEWFL, OVL, MREQ[0] );
  454.  
  455. IF MREQ$C[0]
  456. THEN
  457. BEGIN
  458. NEWFL = MREQ$FL[0];
  459. AVAIL = AVAIL + NEWFL - FL;
  460. FL = NEWFL;
  461. TABF [NTAB+1] = FL - 8 ;
  462. END
  463.  
  464. RETURN; # **** RETURN **** #
  465.  
  466. END # RFL #
  467. CONTROL EJECT;
  468. PROC SSTASU;
  469. # TITLE - ACCUMULATE STORAGE USED. #
  470.  
  471. BEGIN # SSTASU #
  472. #
  473. ** SSTASU - ACCUMULATE STORAGE USED.
  474. *
  475. * R. H. GOODELL 76/06/17
  476. *
  477. * *ASU* KEEPS TRACK OF THE MAXIMUM AMOUNT OF STORAGE USED,
  478. * I.E. - THE MINIMUM FIELD LENGTH THAT IS ENOUGH TO RUN THE
  479. * JOB SUCCESSFULLY.
  480. *
  481. * PROC SSTASU
  482. *
  483. * ENTRY 1. NONE
  484. *
  485. * EXIT 1. NONE
  486. *
  487. * NOTE:
  488. *
  489. * *ASU* MUST ALWAYS BE CALLED BEFORE ANY TABLE IS MADE
  490. * SMALLER. IN PARTICULAR, TO CLEAR A TABLE OUT YOU CAN
  491. * USE SSTATS (P<TXXX>, - TXXXL) OR TXXXL = 0
  492. * BUT IF YOU CHOOSE THE LATTER, YOU MUST CALL *ASU* FIRST.
  493. *
  494. #
  495.  
  496. ITEM INUSE; # CALCULATED AMOUNT OF MEMORY IN USE #
  497.  
  498. #
  499. * SSTASU CODE BEGINS HERE
  500. #
  501. INUSE = BASE + NTAB + 8 ; # SUM BASE OF MANAGED SPACE #
  502.  
  503. FOR I = 1 STEP 1 UNTIL NTAB
  504. DO
  505. BEGIN
  506. INUSE = INUSE + TABL [I] ; # + SUM OF TABLE LENGTHS #
  507. END
  508.  
  509. IF INUSE GR SU
  510. THEN
  511. BEGIN
  512. SU = INUSE ; # SU = MAX (SU, SUM) #
  513. END
  514.  
  515. RETURN; # **** RETURN **** #
  516.  
  517. END # SSTASU #
  518. CONTROL EJECT;
  519. PROC SSTATS(P$TABLE$,(INCR));
  520. # TITLE - ALLOCATE TABLE SPACE. #
  521.  
  522. BEGIN # SSTATS #
  523. #
  524. ** SSTATS - ALLOCATE TABLE SPACE.
  525. *
  526. * R. H. GOODELL 76/06/17
  527. *
  528. * *SSTATS* INCREASESE OR DECREASES THE AMOUNT OF MEMORY SPACE
  529. * ALLOCATED TO THE SPECIFIED TABLE.
  530. *
  531. * PROC SSTATS(P$TABLE$,(INCR))
  532. *
  533. * ENTRY 1. P$TABLE$ = TABLE POINTER (P<XXX>)
  534. * 2. INCR = AMOUNT TO INCREASE/DECREASE TABLE LENGTH.
  535. *
  536. * EXIT 1. TABLE INCREASED/DECREASED.
  537. *
  538. #
  539.  
  540. ITEM P$TABLE$; # TABLE POINTER #
  541. ITEM INCR; # AMOUNT TO INCREASE/DECREASE TABLE LENGTH#
  542.  
  543. #
  544. * SSTATS CODE BEGINS HERE
  545. *
  546. *
  547. * CHECK THE TABLE POINTER FOR VALIDITY.
  548. #
  549.  
  550. $BEGIN
  551. CVT(P$TABLE$);
  552. $END
  553.  
  554.  
  555. #
  556. * IF TABLE IS TO BE DECREASED, THEN ACCUMULATE STORAGE USED.
  557. #
  558. IF INCR LS 0
  559. THEN
  560. BEGIN
  561. SSTASU;
  562. END
  563.  
  564. #
  565. * CALCULATE THE TABLE INDEX. CALCULATE AND SAVE THE NEW TABLE
  566. * LENGTH. IF TABLE INCREASE CAUSES IT TO OVERLAP THE NEXT TABLE,
  567. * THEN CALCULATE THE TOTAL AVAILABLE SPACE, AND IF IT IS LESS
  568. * THAN *SLOP*, THEN GET MORE MEMORY, FINALLY SHIFT THE TABLES
  569. * AROUND TO ACCOMODATE THE NEW TABLE LENGTH.
  570. #
  571. K = (LOC (P$TABLE$) - LOC (TABLES)) / 2 ;
  572.  
  573. NEWL = TABL [K] + INCR ;
  574.  
  575. IF (TABF [K] + NEWL) GQ TABF [K+1]
  576. THEN
  577. BEGIN
  578. SUM = TABL [1] ;
  579. FOR I = 2 STEP 1 UNTIL NTAB
  580. DO
  581. BEGIN
  582. SUM = SUM + TABL [I] ;
  583. END
  584.  
  585. AVAIL = TABF [NTAB+1] - BASE - NTAB - SUM ;
  586. IF AVAIL LS (INCR + SLOP)
  587. THEN
  588. BEGIN
  589. PTO(AVAIL, INCR);
  590. END
  591.  
  592. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  593. SVT$VAL[SVL"RAS1"] = SVT$VAL[SVL"RAS1"] + 1;
  594. $END
  595. RAS(K,AVAIL,INCR,SUM,BASE,NEWL);
  596. END
  597. #
  598. * STORE THE NEW TABLE LENGTH.
  599. #
  600.  
  601. TABL [K] = NEWL ;
  602.  
  603. RETURN; # **** RETURN **** #
  604.  
  605.  
  606. END # SSTATS #
  607. CONTROL EJECT;
  608. PROC SSTDFL;
  609. # TITLE SSTDFL - DECREASE FIELD LENGTH. #
  610.  
  611. BEGIN # SSTDFL #
  612. #
  613. ** SSTDFL - DECREASE FIELD LENGTH.
  614. *
  615. * S. H. FISCHER. 82/05/13.
  616. *
  617. * THIS PROCEDURE WILL REMOVE THE OVERLAY AREA, MOVE TABLES DOWM
  618. * WITH ONLY THE MINIMUM FREE SPACE AVAILABLE AND THEN REDUCE
  619. * THE PROGRAMS FIELD LENGTH.
  620. *
  621. * PROC SSTDFL
  622. *
  623. * ENTRY:
  624. * THE OVERLAY AREA SHOULD BE ABLE TO BE REMOVED.
  625. *
  626. * EXIT:
  627. * THE FIELD LENGTH OF THE PROGRAM REDUCED IF POSSIBLE.
  628. *
  629. #
  630.  
  631.  
  632. ITEM NEED; # AMOUNT OF FIELD LENGTH NEEDED #
  633.  
  634. #
  635. * SSTDFL CODE BEGIN HERE
  636. *
  637. *
  638. * SELECT ANY TABLE (ITS LENGTH IS NOT CHANGED) AND SET THE INCRE-
  639. * MENT TO ZERO, SAVE THE LENGTH, AND SET THE AMOUNT OF AVAILABLE
  640. * MEMORY TO SLOP.
  641. #
  642. INCR = 0;
  643. K = 1; # SELECTED FIRST TABLE #
  644. NEWL = TABL[K];
  645. AVAIL = SLOP;
  646. #
  647. * CALCULATE TOTAL TABLE SPACE USED.
  648. #
  649.  
  650. SUM = TABL[1];
  651. FOR I = 2 STEP 1 UNTIL NTAB
  652. DO
  653. BEGIN
  654. SUM = SUM + TABL[I];
  655. END
  656. #
  657. * CALCULATE THE AMOUNT OF SPACE NOT BEING USED. IF IT IS GREATER
  658. * THAN *SLOP* THEN SQUEEZE OUT THE UNNECESSARY SPACE.
  659. #
  660.  
  661. NEED = FL - (BASE + SUM);
  662. IF NEED GR AVAIL
  663. THEN
  664. BEGIN
  665. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  666. SVT$VAL[SVL"RAS2"] = SVT$VAL[SVL"RAS2"] + 1;
  667. $END
  668. RAS(K,AVAIL,INCR,SUM,BASE,NEWL);
  669. END
  670. #
  671. * CALCULATE THE TOTAL FIELD LENGTH NEEDED WITH THE TOTAL AVAIL-
  672. * ABLE SPACE SET TO *SLOP*. IF A FIELD LENGTH ADJUSTMENT IS
  673. * NEEDED, THEN DO IT.
  674. #
  675.  
  676. NEED = BASE + SUM + AVAIL - FL;
  677.  
  678. IF NEED NQ 0
  679. THEN
  680. BEGIN
  681. RFL(NEED, AVAIL, OVL, INCR);
  682. END
  683.  
  684. RETURN; # **** RETURN **** #
  685.  
  686. END # SSTDFL #
  687. CONTROL EJECT;
  688. PROC SSTETS (P$TABLE$,(P),(N)) ;
  689. # TITLE SSTETS - ENLARGE TABLE SPACE. #
  690.  
  691. BEGIN # SSTETS #
  692. #
  693. ** SSTETS - ENLARGE TABLE SPACE.
  694. *
  695. * FLORENCE HOU 81/08/21
  696. *
  697. * THIS PROCEDURE ENLARGES THE SPECIFIED TABLE WITH THE AMOUNT OF
  698. * MEMORY SPACE *N*.
  699. *
  700. * PROC SSTETS(P<TXXX>,P,N)
  701. *
  702. * ENTRY P<TXXX> = TABLE POINTER.
  703. * P = POSITION WITHIN TABLE TO ENLARGE TABLE.
  704. * N = NUMBER OF WORDS TO ADD.
  705. *
  706. * EXIT TABLE IS ENLARGED.
  707. *
  708. * NOTES NONE.
  709. *
  710. * METHOD
  711. *
  712. * SSTETS ADDS N TO THE TABLE LENGTH WORD TXXXL.
  713. * ANY OR ALL OF THE TABLES MAY GET MOVED AROUND IN MEMORY,
  714. * AND THEIR POINTERS UPDATES, IF *SSTETS* FINDS THIS TO BE
  715. * NECESSARY OR APPROPRIATE. *SSTETS* MAY ALSO INCREASE THE
  716. * JOB FIELD LENGTH TO GET MORE SPACE.
  717. *
  718. #
  719.  
  720. ITEM P$TABLE$ ; # ARGUMENT IS P<TXXX> #
  721. ITEM P I; # POSITION WITHIN TABLE #
  722. ITEM N I; # NUMBER OF WORDS TO ADD #
  723.  
  724.  
  725. ITEM I I; # LOOP VARIABLE #
  726. ITEM K I; # CURRENT TABLE INDEX #
  727. ITEM COUNT I; # COUNT OF WORDS TO MOVE #
  728. ITEM FROM I; # FIRST WORD OF THE *FROM* BLOCK #
  729. ITEM TO I; # FIRST WORD OF THE *TO* BLOCK #
  730.  
  731. BASED ARRAY DUMMY[0:0] S(1); # DUMMY BASED ARRAY #
  732. BEGIN
  733. ITEM DUMMYY U(00,00,60);
  734. END
  735.  
  736.  
  737. #
  738. * SSTETS CODE BEGINS HERE
  739. #
  740.  
  741. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  742. SVT$VAL[SVL"ETS"] = SVT$VAL[SVL"ETS"] + 1;
  743.  
  744. CVT(P$TABLE$); # VALIDATE TABLE POINTER #
  745. $END
  746.  
  747.  
  748. K=(LOC(P$TABLE$)-LOC(TABLES)) / 2 ; # TABLE INDEX #
  749.  
  750. $BEGIN
  751. IF ((N LQ 0) OR (P GR TABL[K]))
  752. THEN
  753. BEGIN
  754. ABORT;
  755. END
  756. $END
  757.  
  758.  
  759. COUNT = TABL[K]-P ; # COUNT THE NUM OF WORDS TO MOVE #
  760. SSTATS (P$TABLE$,N) ; # ALLOCATE *N* TABLE SPACE #
  761. FROM = TABF[K]+P ; # FIRST WORD OF FROM BLOCK #
  762. TO = TABF[K]+P+N ; # FIRST WORD OF *TO* BLOCK #
  763.  
  764. IF (COUNT NQ 0)
  765. THEN
  766. BEGIN
  767. MOVEI (COUNT,FROM,TO); # MOVE *COUNT* WORDS #
  768. END
  769.  
  770. FOR I=FROM STEP 1 UNTIL TO-1
  771. DO
  772. BEGIN
  773. P<DUMMY>=I;
  774. DUMMYY[0]=0; # ZERO THE ENLARGED SPACE #
  775. END
  776.  
  777. RETURN ;
  778.  
  779. END # SSTETS #
  780. CONTROL EJECT;
  781. PROC SSTITM( PTABLES, TEND ,LOADBASE );
  782. # TITLE - INITIALIZE TABLE MANAGER. #
  783.  
  784. BEGIN # SSTITM #
  785. #
  786. ** SSTITM - INITIALIZE TABLE MANAGER.
  787. *
  788. * R. H. GOODELL 76/06/17
  789. * D. K. ENDO 82/06/01
  790. *
  791. * THIS PROCEDURE INITIALIZES THE TABLE MANAGER AND THE TABLE
  792. * POINTERS.
  793. *
  794. * PROC SSTITM(PTABLES, TEND, LOADBASE)
  795. *
  796. * ENTRY 1. PTABLES = FIRST WORD OF TABLE POINTERS.
  797. * 2. TEND = LAST TABLE POINTER (DUMMY ENTRY).
  798. * 3. LOADBASE = POINTER TO WHERE OVERLAYS ARE
  799. * LOADED.
  800. *
  801. * EXIT 1. TABLE MANAGER INITIALIZED.
  802. * 2. TABLE POINTERS INITIALIZED.
  803. *
  804. #
  805.  
  806. ITEM PTABLES; # FIRST WORD OF TABLE POINTERS #
  807. ITEM TEND; # LAST TABLE POINTER (DUMMY ENTRY) #
  808. ITEM LOADBASE; # POINTER TO WHERE OVERLAYS ARE LOADED #
  809. ITEM I; # LOOP INDUCTION VARIABLE #
  810.  
  811. #
  812. * SSTITM CODE BEGINS HERE
  813. *
  814. *
  815. * SAVE THE ADDRESS OF THE FIRST AND LAST TABLE POINTERS.
  816. * SAVE THE LOAD BASE VALUE.
  817. #
  818.  
  819. FRSTTBL = LOC(PTABLES);
  820. LASTTBL = LOC(TEND);
  821.  
  822. OVLBASE = LOADBASE;
  823.  
  824.  
  825. #
  826. * POINT THE MANAGER-S TABLES BASED ARRAY TO THE TABLE POINTERS.
  827. * CALCULATE THE NUMBER OF TABLES DEFINED.
  828. * PRESET ALL TABLE POINTERS. NOTE - (BASE) HAS ALREADY
  829. * BEEN SET, BY MAIN.
  830. #
  831.  
  832. P<TABLES> = LOC(PTABLES) ;
  833. NTAB = (LOC (TEND) - LOC (TABLES)) / 2 - 1 ;
  834. FOR I = 1 STEP 1 UNTIL NTAB
  835. DO
  836. BEGIN
  837. TABF [I] = BASE + I - 1 ;
  838. TABL [I] = 0 ;
  839. END
  840. #
  841. * GET THE CURRENT FIELD LENGTH AND STORE IT.
  842. #
  843.  
  844. P<MREQ> = LOC(MEMWORD);
  845. SSTRCM( 0, TRUE, MREQ );
  846. FL = MREQ$FL[0];
  847. #
  848. * GET THE MAXIMUM FIELD LENGTH ALLOWED AND SAVE IT.
  849. #
  850.  
  851. SSTRCM( -1, TRUE, MREQ );
  852. MAXFL = MREQ$FL[0];
  853. #
  854. * CALCULATE AND STORE THE SPACE ABOVE THE LAST TABLE.
  855. * INITIALIZE THE STORAGE USED.
  856. #
  857.  
  858. TABF [NTAB+1] = FL - 8 ;
  859. SU = TABF [NTAB] + 8 ;
  860.  
  861. RETURN; # **** RETURN **** #
  862.  
  863. END # SSTITM #
  864. CONTROL EJECT;
  865. PROC SSTRTS (P$TABLE$,(P),(N)) ;
  866. # TITLE SSTRTS - REMOVE TABLE SPACE. #
  867.  
  868. BEGIN # SSTRTS #
  869. #
  870. ** SSTRTS - REMOVE TABLE SPACE.
  871. *
  872. * FLORENCE HOU 81/08/21
  873. *
  874. * THIS PROCEDURE REMOVES THE AMOUNT OF MEMORY SPACE ALLOCATED
  875. * TO THE SPECIFIED TABLE.
  876. *
  877. * PROC SSTRTS(P<TXXX>,P,N)
  878. *
  879. * ENTRY P<TXXX> = TABLE POINTER.
  880. * P = POSITION WITHIN TABLE TO REMOVE WORDS.
  881. * N = NUMBER OF WORDS TO REMOVE.
  882. *
  883. * EXIT TABLE SPACE IS REMOVED.
  884. *
  885. * NOTES NONE.
  886. *
  887. * METHOD
  888. * SSTRTS SUBTRACTS N TO THE TABLE LENGTH WORD TXXXL.
  889. * NONE OF THE TABLES GET MOVED AROUND IN MEMORY, AND
  890. * THEIR POINTERS NOT CHANGED.
  891. *
  892. #
  893.  
  894. ITEM P$TABLE$ ; # ARGUMENT IS P<TXXX> #
  895. ITEM P I; # POSITION WITHIN TABLE #
  896. ITEM N I; # NUMBER OF WORDS TO REMOVE #
  897. ITEM K I; # CURRENT TABLE INDEX #
  898. ITEM COUNT I; # COUNT OF WORDS TO MOVE #
  899. ITEM FROM I; # FIRST WORD OF THE *FROM* BLOCK #
  900. ITEM TO I; # FIRST WORD OF THE *TO* BLOCK #
  901.  
  902.  
  903.  
  904. #
  905. * SSTRTS CODE BEGINS HERE
  906. #
  907.  
  908. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  909. SVT$VAL[SVL"RTS"] = SVT$VAL[SVL"RTS"] + 1;
  910.  
  911. CVT(P$TABLE$); # VALIDATE TABLE POINTER #
  912. $END
  913.  
  914.  
  915. K=(LOC(P$TABLE$)-LOC(TABLES)) / 2 ; # TABLE INDEX #
  916.  
  917. $BEGIN
  918. IF((N LQ 0) OR (P GR TABL[K]))
  919. THEN
  920. BEGIN
  921. ABORT;
  922. END
  923. $END
  924.  
  925. COUNT = TABL[K]-P-N; # COUNT THE NUM OF WORDS TO MOVE #
  926. FROM = TABF[K]+P+N; # FIRST WORD OF FROM BLOCK #
  927. TO = TABF[K] + P ; # FIRST WORD OF *TO* BLOCK #
  928.  
  929. IF (COUNT NQ 0)
  930. THEN
  931. BEGIN
  932. MOVEI(COUNT,FROM,TO); # MOVE *COUNT* WORDS #
  933. END
  934.  
  935. SSTASU ; # ACCUMULATE STORAGE USED #
  936.  
  937. TABL[K]=TABL[K] - N; # NEW LENGTH OF TABLE #
  938.  
  939. RETURN; # **** RETURN **** #
  940.  
  941. END # SSTRTS #
  942. CONTROL EJECT;
  943. PROC SSTSDA ((NB),MEMSTAT,DONE) ;
  944. # TITLE - SET DYNAMIC AREA BASE. #
  945.  
  946. BEGIN # SSTRTS #
  947. #
  948. ** SSTSDA - SET DYNAMIC AREA BASE ADDRESS.
  949. *
  950. * R. H. GOODELL 76/06/17
  951. * S. H. FISCHER 82/06/01
  952. *
  953. * THIS PROCEDURE ADJUSTS THE LOWER LIMIT OF THE MEMORY AREA IN
  954. * WHICH THE MANAGED TABLES CAN EXIST, I.E. - THE SPACE FROM
  955. * (BASE) TO (FL). *SSTSDA* IS CALLED AS EACH OVERLAY IS LOADED
  956. * SO THAT (BASE) IS ALWAYS EQUAL TO THE LWA+1 OF THE CURRENT
  957. * OVERLAY AND NO MEMORY SPACE IS WASTED.
  958. *
  959. * PROC SSTSDA((NB),MEMSTAT,DONE)
  960. *
  961. * ENTRY 1. NB = NEW BASE ADDRESS.
  962. * 2. MEMSTAT = STATUS WORD FOR OVERLAY MEM REQ.
  963. *
  964. * EXIT 1. DONE = RETURN STATUS TO MOVE IS DONE.
  965. *
  966. #
  967.  
  968. ITEM NB; # NEW BASE ADDRESS #
  969. ITEM MEMSTAT; # STATUS WORD FOR OVERLAY MEM REQ #
  970. ITEM DONE B; # RETURN STATUS TO MOVE IS DONE #
  971. ITEM L; # FIRST TABLE LENGTH #
  972. ITEM NEED; # AMOUNT OF FIELD LENGTH NEEDED #
  973.  
  974. #
  975. * SSTSDA CODE BEGINS HERE
  976. *
  977. *
  978. * CLEAR THE DONE FLAG.
  979. * CALCULATE THE TOTAL AMOUNT OF TABLE SPACE CURRENTLY ALLOCATED.
  980. #
  981.  
  982. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  983. SVT$VAL[SVL"SDA"] = SVT$VAL[SVL"SDA"] + 1;
  984. $END
  985.  
  986.  
  987. DONE = FALSE;
  988. SUM = TABL[1];
  989. FOR I = 2 STEP 1 UNTIL NTAB
  990. DO
  991. BEGIN
  992. SUM = SUM + TABL[I];
  993. END
  994. #
  995. * CALCULATE THE AMOUNT OF MEMORY AVAILABLE. IF THERE IS NOT
  996. * ENOUGH FIELD LENGTH TO MOVE THE TABLES TO NEW BASE ADDRESS,
  997. * THEN CALCULATE THE SPACE NEEDED AND MAKE A MEMORY REQUEST.
  998. * IF THE REQUEST IS NOT COMPLETE, THEN RETURN. REPOINT BASED ARRAY
  999. * TO TABLE MANAGER-S MEMORY REQUEST STATUS WORD AND CLEAR MEM REQ
  1000. * FLAG.
  1001. #
  1002.  
  1003. AVAIL = TABF[NTAB+1] - OVLBASE - NTAB - SUM;
  1004.  
  1005. IF AVAIL LS ( NB - OVLBASE + SLOP )
  1006. THEN
  1007. BEGIN
  1008. OVL = 0;
  1009. INCR = 0;
  1010. P<MREQ> = LOC(MEMSTAT);
  1011. NEED = (NB - OVLBASE + SLOP) - AVAIL;
  1012. OVLFLRQ = TRUE;
  1013. RFL(NEED, AVAIL, OVL, INCR);
  1014. IF NOT MREQ$C[0]
  1015. THEN
  1016. BEGIN
  1017. RETURN;
  1018. END
  1019. P<MREQ> = LOC(MEMWORD);
  1020. OVLFLRQ = FALSE;
  1021. END
  1022. #
  1023. * IF THE TABLES NEED TO BE MOVED UP, THEN CALCULATE THE NEW AMOUNT
  1024. * OF AVAILABLE SPACE AND MOVE THE TABLES.
  1025. #
  1026.  
  1027.  
  1028. IF NB GR TABF [1]
  1029. THEN # MUST RELOCATE TABLES #
  1030. BEGIN
  1031. I = 1; # TABLE INDEX, ANY TABLE WILL DO#
  1032. L = TABL [1] ; # FIRST TABLE LENGTH #
  1033. INCR = 0; # NO TABLE SIZE CHG INVOLVED #
  1034. AVAIL = TABF[NTAB+1] - NB - NTAB - SUM; # ADJ FOR NEW BASE #
  1035.  
  1036. $BEGIN # INCREMENT COUNT FOR STATISTICS #
  1037. SVT$VAL[SVL"RAS3"] = SVT$VAL[SVL"RAS3"] + 1;
  1038. $END
  1039. RAS (I, AVAIL, INCR, SUM, NB, L); # MOVE TABLES #
  1040. END
  1041. #
  1042. * STORE THE NEW BASE ADDRESS, CALCULATE ACCUMULATE STORAGE USED
  1043. * AND SET THE DONE STATUS.
  1044. #
  1045.  
  1046. BASE = NB ; # SET NEW BASE ADDRESS #
  1047. SSTASU; # ACCUMULATE STORAGE USED #
  1048. DONE = TRUE;
  1049.  
  1050. RETURN; # **** RETURN **** #
  1051.  
  1052. END # SSTSDA #
  1053.  
  1054. END # SSTTMR #
  1055. TERM
cdc/nos2.source/nam5871/ssttmr.txt ยท Last modified: 2023/08/05 17:23 by Site Administrator