lister.13 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <DEFINE SFIND (GZORK "OPTIONAL" (D ,TVASS)) #DECL ((GZORK) FIX (D) ASYLUM)
  2. <PRINC "
  3. Id Address Length Data">
  4. <REPEAT ((CT 0)(UV1 ,DUV1)(FROB <+ <* <MFDPAGE ,TVASS> 1024> ,DIRPTRS>))
  5. #DECL ((CT FROB) FIX (UV1) <UVECTOR <PRIMTYPE WORD>>)
  6. <COND (<0? <CHTYPE <1 <GET-LOC .FROB .UV1>> FIX>>
  7. <RETURN>)
  8. (T
  9. <FINDIT .CT .D .GZORK>
  10. <SET CT <+ .CT 1>>
  11. <SET FROB <+ .FROB 1>>)>>>
  12. <DEFINE FINDIT (DIRNUM D "OPTIONAL" (TARGET 0)
  13. "AUX" LOC HI (DUV ,DATUV) (UV1 ,DUV1) DPAGE TEMP)
  14. #DECL ((DIRNUM TARGET TEMP) FIX (D) ASYLUM (LOC HI) FIX (DPAGE) <OR FALSE FIX>
  15. (UV1) <UVECTOR [1 WORD]> (DUV) <UVECTOR [4 WORD]>)
  16. <COND
  17. (<SET DPAGE <DIR-FIND .D <* .DIRNUM ,DIRSIZE>>>
  18. <SET HI <CHTYPE <1 <GET-LOC <+ ,HIGHID <* <MFDPAGE .D> 1024>> .UV1>> FIX>>
  19. <SET LOC <+ <* .DPAGE 1024> ,OBJSTART>>
  20. <REPEAT ((NAME <* .DIRNUM ,DIRSIZE>) (FOO ,DIRSIZE) BAR)
  21. #DECL ((NAME FOO BAR) FIX)
  22. <COND
  23. (<OR <1? .FOO> <G? .NAME .HI>> <PRINC .DIRNUM> <RETURN>)
  24. (T
  25. <SET BAR <CHTYPE <NTH <GET-LOC .LOC ,NAMUV> <+ ,NAMDATA 1>> FIX>>
  26. <COND (<==? .TARGET <CHTYPE <NTH ,NAMUV <+ ,NAMMISC 1>> FIX>>
  27. <CRLF>
  28. <PRIN1 .NAME>
  29. <INDENT-TO 7>
  30. <AND <==? <NTH ,NAMUV 1> #WORD *0*> <PRINC "*">>
  31. <PRIN1 .BAR>
  32. <INDENT-TO 19>
  33. <PRIN1 <CHTYPE <NTH ,NAMUV <+ ,NAMCHNCDR 1>> FIX>>
  34. <INDENT-TO 29>
  35. <PRIN1 <COND (<OR <0? .TARGET>
  36. <N==?
  37. <SET TEMP
  38. <CHTYPE <NTH ,NAMUV <+ ,NAMMISC 1>> FIX>>
  39. .TARGET>> .TEMP)
  40. ("**WINNER**")>>)>
  41. <SET NAME <+ .NAME 1>>
  42. <SET FOO <- .FOO 1>>
  43. <SET LOC <+ .LOC ,NAMBLKLEN>>)>>)>>
  44. <DEFINE LISTF (DIRNUM D "AUX" LOC HI (DUV ,DATUV) (UV1 ,DUV1) DPAGE)
  45. #DECL ((DIRNUM) FIX (D) ASYLUM (LOC HI) FIX (DPAGE) <OR FALSE FIX>
  46. (UV1) <UVECTOR [1 WORD]> (DUV) <UVECTOR [4 WORD]>)
  47. <COND
  48. (<SET DPAGE <DIR-FIND .D <* .DIRNUM ,DIRSIZE>>>
  49. <SET HI <CHTYPE <1 <GET-LOC <+ ,HIGHID <* <MFDPAGE .D> 1024>> .UV1>> FIX>>
  50. <SET LOC <+ <* .DPAGE 1024> ,OBJSTART>>
  51. <PRINC "
  52. Id Address Length Data">
  53. <REPEAT ((NAME <* .DIRNUM ,DIRSIZE>) (FOO ,DIRSIZE) BAR)
  54. #DECL ((NAME FOO BAR) FIX)
  55. <COND
  56. (<OR <1? .FOO> <G? .NAME .HI>> <RETURN <CRLF>>)
  57. (T
  58. <COND (<AND <0? <SET BAR
  59. <CHTYPE <NTH <GET-LOC .LOC ,NAMUV>
  60. <+ ,NAMDATA 1>>
  61. FIX>>>
  62. <==? <NTH ,NAMUV <+ ,NAMMISC 1>> #WORD *0*>>
  63. <COND (<0? <SET BAR
  64. <CHTYPE <NTH ,NAMUV <+ ,NAMCHNCDR 1>> FIX>>>)
  65. (<CRLF>
  66. <PRINC !"[>
  67. <PRIN1 .NAME>
  68. <PRINC !"]>)>)
  69. (<CRLF>
  70. <PRIN1 .NAME>
  71. <INDENT-TO 7>
  72. <AND <==? <NTH ,NAMUV 1> #WORD *0*> <PRINC "*">>
  73. <PRIN1 .BAR>
  74. <INDENT-TO 19>
  75. <PRIN1 <CHTYPE <NTH ,NAMUV <+ ,NAMCHNCDR 1>> FIX>>
  76. <INDENT-TO 29>
  77. <PRIN1 <CHTYPE <NTH ,NAMUV <+ ,NAMMISC 1>> FIX>>)>
  78. <SET NAME <+ .NAME 1>>
  79. <SET FOO <- .FOO 1>>
  80. <SET LOC <+ .LOC ,NAMBLKLEN>>)>>)>>
  81. <DEFINE LISTA (D
  82. "AUX" (MFD <* <MFDPAGE .D> 1024>) (ALLOC <* <ALLOCPAGE .D> 1024>)
  83. HIGH LO CNT ALOC)
  84. #DECL ((D) ASYLUM (MFD ALLOC CNT ALOC) FIX)
  85. <ALLOC-MAP .D>
  86. <PRINC "
  87. Database Allocator Statistics">
  88. <SET ALPTR <1 <GET-LOC .ALLOC ,DUV1>>>
  89. <SET CNT
  90. <CHTYPE <ORB <GETBITS .ALPTR <BITS 18 18>> #WORD *777777000000*>
  91. FIX>>
  92. <CRLF>
  93. <SET ALOC
  94. <+ <CHTYPE <ANDB <GETBITS .ALPTR <BITS 18 0>> #WORD *000000001777*>
  95. FIX>
  96. .ALLOC>>
  97. <CRLF>
  98. <PRINC "From To Length">
  99. <REPEAT ((UV ,AUV2))
  100. <GET-LOC .ALOC .UV>
  101. <CRLF>
  102. <PRIN1 <SET LO <CHTYPE <2 .UV> FIX>>>
  103. <PRINC " ">
  104. <PRIN1 <SET HIGH <+ .LO <CHTYPE <1 .UV> FIX>>>>
  105. <PRINC " ">
  106. <PRIN1 <- .HIGH .LO>>
  107. <SET ALOC <+ .ALOC 2>>
  108. <SET CNT <+ .CNT 2>>
  109. <AND <0? .CNT> <RETURN <CRLF>>>>>
  110. <DEFINE LISTM (D
  111. "AUX" (MFD <* <MFDPAGE .D> 1024>) (ALLOC <* <ALLOCPAGE .D> 1024>)
  112. HIGH LO CNT ALOC (DUV ,DUV1) A)
  113. #DECL ((D) ASYLUM (MFD ALLOC CNT ALOC) FIX (DUV) <UVECTOR [1 WORD]>
  114. (A) <PRIMTYPE WORD>)
  115. <SET A <1 <GET-LOC <+ .MFD ,DPGLOCK> .DUV>>>
  116. <PRINC "
  117. MFD Lock -- ">
  118. <COND (<==? .A #WORD *000000000000*> <PRINC "LOCKED">)
  119. (<PRINC "UNLOCKED">)>
  120. <PRINC "
  121. UP time -- ">
  122. <PDSKDATE <1 <GET-LOC <+ .MFD ,DINITRQ> .DUV>>>
  123. <PRINC "
  124. ALTER time -- ">
  125. <PDSKDATE <1 <GET-LOC <+ .MFD ,DINITDN> .DUV>>>
  126. <SET CNT
  127. <CHTYPE <ORB <GETBITS <1 <GET-LOC .ALLOC .DUV>>
  128. <BITS 18 18>>
  129. #WORD *777777000000*>
  130. FIX>>
  131. <PRINC "
  132. ALLOCATOR Use -- ">
  133. <PRIN1 <SET ALOC </ <- .CNT> 2>>>
  134. <PRINC " entries [">
  135. <PRIN1 </ <* .ALOC 100> 511>>
  136. <PRINC "%]">
  137. <PRINC "
  138. ALLOCATOR Lock -- ">
  139. <COND (<==? <1 <GET-LOC <+ .MFD ,ALLOCLOCK> .DUV>>
  140. #WORD *000000000000*>
  141. <PRINC "LOCKED">)
  142. (<PRINC "UNLOCKED">)>
  143. <PRINC "
  144. High Address -- ">
  145. <PRIN1 <SET A <CHTYPE <1 <GET-LOC <+ .MFD ,HIGHADR> .DUV>> FIX>>>
  146. <PRINC " [Page ">
  147. <PRIN1 </ .A 1024>>
  148. <PRINC "]">
  149. <PRINC "
  150. Maximum Address -- ">
  151. <PRIN1 <SET A <CHTYPE <1 <GET-LOC <+ .MFD ,MAXADR> .DUV>> FIX>>>
  152. <PRINC " [Page ">
  153. <PRIN1 </ .A 1024>>
  154. <PRINC "]">
  155. <PRINC "
  156. High ID -- ">
  157. <PRIN1 <CHTYPE <1 <GET-LOC <+ .ALLOC ,HIGHID> .DUV>> FIX>>
  158. <REPEAT ((N ,DIRPTRS) (DIR 0))
  159. #DECL ((N DIR) FIX)
  160. <COND (<0? <SET A <CHTYPE <1 <GET-LOC <+ .MFD .N> .DUV>> FIX>>>
  161. <RETURN>)
  162. (<CRLF>
  163. <PRINC "Directory ">
  164. <PRIN1 .DIR>
  165. <PRINC " at ">
  166. <PRIN1 .A>
  167. <PRINC " [Page ">
  168. <PRIN1 </ .A 1024>>
  169. <PRINC "]">
  170. <SET N <+ .N 1>>
  171. <SET DIR <+ .DIR 1>>)>>
  172. <REPEAT ((N ,PGLOCKS))
  173. <COND (<==? .N 1024> <RETURN>)
  174. (T
  175. <COND (<==? <1 <GET-LOC <+ .MFD .N> .DUV>>
  176. #WORD *000000000000*>
  177. <PRINC "
  178. Pages Locked from ">
  179. <PRIN1 <SET A </ <- .N ,PGLOCKS> .P/L>>>
  180. <PRINC " to ">
  181. <PRIN1 <+ .A ,P/L>>)>
  182. <SET N <+ .N 1>>)>>
  183. ,NULL>
  184. <DEFINE LISTB (DC "OPTIONAL" (VERB <>) (SALV <>)
  185. "AUX" (MFD <* <MFDPAGE .DC> 1024>) (UV1 ,DUV1) (DUV ,NAMUV)
  186. (ALLOCK <+ .MFD ,ALLOCLOCK>) DF HI FROB (LOST 0) MOBY)
  187. #DECL ((DC) ASYLUM (MFD ALLOCK) FIX (UV1) <UVECTOR [1 WORD]> (HI) WORD
  188. (LOST) FIX (DUV) <UVECTOR [4 WORD]> (DF) <OR FALSE FIX>
  189. (MOBY) <UVECTOR [REST WORD]> (VERB SALV) <OR 'T FALSE>)
  190. <ALLOC-MAP .DC>
  191. <SET HI <1 <GET-LOC <+ ,HIGHID <* <ALLOCPAGE .DC> 1024>> .UV1>>>
  192. <SET ALPTR
  193. <+ <* 1024 <ALLOCPAGE .DC>>
  194. <CHTYPE <ANDB <1 <GET-LOC <* <ALLOCPAGE .DC> 1024> .UV1>>
  195. #WORD *000000001777*>
  196. FIX>>>
  197. <SET MOBY
  198. <IUVECTOR <+ 4
  199. <* <CHTYPE .HI FIX> 2>
  200. <SET ALLEN <- <+ 1023 <* <ALLOCPAGE .DC> 1024>> .ALPTR>>>
  201. #WORD *000000000000*>>
  202. <GET-LOC-X .ALPTR <REST .MOBY 2> .ALLEN>
  203. <PUT .MOBY 1 #WORD *777777003777*>
  204. <PUT .MOBY 2 #WORD *000000000001*>
  205. <SET MOBY <REST .MOBY <+ 2 .ALLEN>>>
  206. <REPEAT ((DIR <+ .MFD ,DIRPTRS>) (DIRNUM 0) (ID 0))
  207. #DECL ((DIR DIRNUM ID) FIX)
  208. <COND
  209. (<OR <0? <CHTYPE .DIR FIX>>
  210. <NOT <SET DF <DIR-FIND .DC <* .DIRNUM ,DIRSIZE>>>>>
  211. <RETURN>)
  212. (<SET DPG <+ ,OBJSTART <* 1024 .DF>>>
  213. <REPEAT ((NUM ,DIRSIZE) (WHR 0) WD)
  214. <COND (<OR <EMPTY? .MOBY> <0? .NUM>> <RETURN>)
  215. (<GET-LOC .DPG .DUV>
  216. <AND <==? <NTH .DUV <+ ,NAMDATA 1>> #WORD *000000000000*>
  217. <SET DPG <+ .DPG ,NAMBLKLEN>>
  218. <SET LOST <+ .LOST 2>>
  219. <SET NUM <- .NUM 1>>
  220. <SET WHR <+ .WHR 1>>
  221. <AGAIN>>
  222. <PUT .MOBY 2 <NTH .DUV <+ ,NAMDATA 1>>>
  223. <SET WD <NTH .DUV <+ ,NAMCHNCDR 1>>>
  224. <PUT .MOBY
  225. 1
  226. <PUTBITS .WD
  227. <BITS 18 18>
  228. <CHTYPE <+ <* .DIRNUM ,DIRSIZE> .WHR>
  229. WORD>>>
  230. <SET MOBY <REST .MOBY 2>>
  231. <SET DPG <+ .DPG ,NAMBLKLEN>>
  232. <SET NUM <- .NUM 1>>
  233. <SET WHR <+ .WHR 1>>)>>
  234. <SET DIRNUM <+ .DIRNUM 1>>)>>
  235. <SET MOBY <SORT <> <TOP .MOBY> 2 1>>
  236. <AND .VERB
  237. <PRINC "
  238. From To Length Use">>
  239. <REPEAT ((M .MOBY) LO HI (LSTLO -1) (LSTHI -1) (LSTM -1))
  240. #DECL ((LO HI LSTLO LSTHI) FIX (M) UVECTOR)
  241. <AND <EMPTY? .M> <RETURN>>
  242. <AND <==? <1 .M> #WORD *000000000000*>
  243. <SET M <REST .M 2>>
  244. <AGAIN>>
  245. <SET LO <CHTYPE <2 .M> FIX>>
  246. <SET HI <+ <CHTYPE <2 .M> FIX>
  247. <CHTYPE <GETBITS <1 .M> <BITS 18>> FIX>>>
  248. <COND (<==? .LO .LSTLO>
  249. <SALVERR "**SHARED BLOCK**" .LSTLO .LSTHI .LSTM .LO .HI <1 .M>>)
  250. (<L? .LO .LSTHI>
  251. <SALVERR "**BLOCKS OVERLAP**" .LSTLO .LSTHI .LSTM .LO .HI <1 .M>>)
  252. (<AND .SALV
  253. <G? .LO .LSTHI>
  254. <0? <CHTYPE <GETBITS <1 .M> <BITS 18 18>> FIX>>
  255. <0? <CHTYPE <GETBITS .LSTM <BITS 18 18>> FIX>>>
  256. <CRLF>
  257. <PRINC "DEALLOCATING BLOCK - Length = ">
  258. <PRIN1 <- .LO .LSTHI>>
  259. <PRINC " Location = ">
  260. <PRIN1 .LSTHI>
  261. <SALVDEALLOC .DC <- .LO .LSTHI> .LSTHI>)>
  262. <AND .VERB
  263. <PBLOCK .LO .HI <1 .M>>>
  264. <SET LSTLO .LO>
  265. <SET LSTHI .HI>
  266. <SET LSTM <1 .M>>
  267. <SET M <REST .M 2>>>>
  268. <DEFINE PRTYPE (WD "AUX" HOW)
  269. #DECL ((WD) WORD (HOW) FIX)
  270. <COND (<0? <SET HOW <CHTYPE <GETBITS .WD <BITS 18 18>> FIX>>>
  271. <PRINC "Unallocated">)
  272. (<==? <CHTYPE .HOW WORD> #WORD *000000777777*>
  273. <PRINC "Reserved">)
  274. (<PRINC "Object #"> <PRIN1 .HOW>)>>
  275. <DEFINE SALVERR (ERR LLO LHI LM LO HI M)
  276. #DECL ((ERR) STRING (LLO LHI LO HI) FIX (LM M) WORD)
  277. <PRINC "
  278. ERROR -- ">
  279. <PRINC .ERR>
  280. <PBLOCK .LLO .LHI .LM>
  281. <PBLOCK .LO .HI .M>
  282. <CRLF>>
  283. <DEFINE PBLOCK (LO HI M)
  284. #DECL ((LO HI) FIX (M) WORD)
  285. <CRLF>
  286. <PRIN1 .LO>
  287. <INDENT-TO 9>
  288. <PRIN1 .HI>
  289. <INDENT-TO 16>
  290. <PRIN1 <CHTYPE <GETBITS .M <BITS 18>> FIX>>
  291. <INDENT-TO 26>
  292. <PRTYPE .M>>
  293. <DEFINE LISTU ("AUX" (ALL <* 1024 <ALLOCPAGE ,TVASS>>) HI V)
  294. #DECL ((ALL HI) FIX (V) UVECTOR)
  295. <SET HI <CHTYPE <1 <GET-LOC <+ .ALL ,HIGHID> ,DUV1>> FIX>>
  296. <SET V <AIUVECTOR ,MOBYSPACE <- .HI 1> 0>>
  297. <REPEAT ((VEC .V) (N 1) FX)
  298. #DECL ((VEC) UVECTOR (N FX) FIX)
  299. <AND <==? .N .HI> <RETURN>>
  300. <SET FX <CHTYPE <DATA-READW .N ,TVASS> FIX>>
  301. <COND (<AND <G? .FX 0> <L? .FX .HI>>
  302. <PUT .VEC .FX 1>)>
  303. <SET N <+ .N 1>>>
  304. <MAPR <>
  305. <FUNCTION (X "AUX" FOO)
  306. #DECL ((X) UVECTOR (FOO) FIX)
  307. <COND (<1? <1 .X>>)
  308. (<DATA-AREAD ,TVASS <SET FOO <- <LENGTH .V> <LENGTH .X> -1>>
  309. <ARESET ,TVSPACE>>
  310. <COND (<OR <MEMQ <- .FOO 3> ,LOSSTABLE>
  311. <MEMQ <- .FOO 6> ,LOSSTABLE>>)
  312. (<PRINC "
  313. Non-referenced object #">
  314. <PRIN1 .FOO>)>)>>
  315. .V>
  316. ,NULL>