User Tools

Site Tools


cdc:nos2.source:nam5871:bfscan

BFSCAN

Table Of Contents

  • [00004] PROC BFSCAN
  • [00045] PROC ABORT
  • [00046] PROC OMSG

Source Code

BFSCAN.txt
  1. *DECK BFSCAN
  2. USETEXT NIPDEF
  3. USETEXT FREETAB
  4. PROC BFSCAN; # CHECK VALIDITY OF DYNAMIC BUFFER AREA #
  5. STARTIMS;
  6. #
  7. *1DC BFSCAN
  8. * 1. PROC NAME AUTHOR DATE
  9. * BFSCAN PC.TAM 78/07/28
  10. *
  11. * 2. FUNCTIONAL DESCRIPTION.
  12. * SCAN THE FREE BUFFER CHAIN TO FIND DISCREPANCIES.
  13. *
  14. * 3. METHOD USED.
  15. * LOOP THROUGH ALL FREE BUFFERS,
  16. * CHECK IF FORWARD AND BACKWARD POINTERS OK FOR EACH.
  17. *
  18. * 4. ENTRY PARAMETERS.
  19. * FREFBFP FREE CHAIN FORWARD POINTER.
  20. * FREFBBP FREE CHAN BACKWARD POINTER.
  21. * CTLSFWA FWA OF DYNAMIC BUFFER SPACE
  22. * CTLSLWA LWA OF DYNAMIC BUFFER SPACE
  23. *
  24. * 5. EXIT PARAMETERS.
  25. * NONE.
  26. *
  27. * 6. COMMON DECKS CALLED AND SYMPL TEXTS USED.
  28. * FREETAB NIPDEF
  29. *
  30. * 7. ROUTINES CALLED.
  31. * OMSG LOG ERROR MESSAGES
  32. * ABORT ABORT NIP
  33. *
  34. * 8. DAYFILE MESSAGES.
  35. * *FREE CHAIN ERROR*
  36. *
  37.  #
  38. STOPIMS;
  39.  
  40. BEGIN # BFSCAN #
  41.  
  42. CONTROL IFEQ BFSC,1;
  43. XREF
  44. BEGIN
  45. PROC ABORT; # ABORT NIP #
  46. PROC OMSG; # LOG ERROR MESSAGES #
  47. END
  48.  
  49.  
  50. ARRAY EMSG S(2); # ERROR MESSAGE TEXT. #
  51. BEGIN
  52. ITEM MS C(0,0,16) =["FREE CHAIN ERROR"];
  53. ITEM MS2 U(1,48,12) = [0];
  54. END
  55.  
  56. ITEM
  57. PREBUF, # PREVIOUS BUFFER #
  58. BUFWA, # CURRENT FREE BUFFER #
  59. FWPT, # FORWARD POINTER OF CURRENT BUFFER #
  60. BKPT, # BACKWARD POINTER OF CURRENT BUFFER #
  61. BLKS, # BLOCK SIZE OF CURRENT BUFFER #
  62. SIZE, # TOTAL SUM OF SIZES OF BUFFERS #
  63. I;
  64.  
  65. #**********************************************************************#
  66.  
  67. P<FREEBUF> = 0;
  68. SIZE = 0;
  69. PREBUF = LOC(FREFBFP[0]);
  70. BUFWA = FREFBFP[0];
  71.  
  72. FOR I = 1 STEP 1 WHILE I LQ FRENOFB[0]
  73. DO
  74. BEGIN
  75. FWPT = FRBFBFP[BUFWA];# FORWARD POINTER OF CURRENT BUFFER #
  76. BKPT = FRBFBBP[BUFWA];# BACKWARD POINTER OF CURRENT BUFFER #
  77. BLKS = FRBBS[BUFWA]; # BLOCK SIZE OF CURRENT BUFFER #
  78. IF BLKS LQ 0 OR
  79. (FWPT LS CTLSFWA AND FWPT NQ LOC(FREFBFP[0])) OR
  80. (BKPT LS CTLSFWA AND BKPT NQ LOC(FREFBBP[0])) OR
  81. FWPT GQ CTLSLWA OR
  82. BKPT GQ CTLSLWA OR
  83. BKPT NQ PREBUF
  84. THEN
  85. ABORT(EMSG,0);
  86.  
  87. SIZE = SIZE + BLKS;
  88. PREBUF = BUFWA;
  89. BUFWA = FRBFBFP[BUFWA];
  90. END
  91.  
  92. IF BUFWA NQ LOC(FREFBFP[0]) OR FREFBBP[0] NQ PREBUF OR
  93. SIZE NQ FRESFB[0]
  94. THEN
  95. BEGIN
  96. ABORT(EMSG,0);
  97. END
  98.  
  99. CONTROL FI;
  100.  
  101. END # BFSCAN #
  102.  
  103.  
  104. TERM
cdc/nos2.source/nam5871/bfscan.txt ยท Last modified: 2023/08/05 17:21 by Site Administrator