NDXFILES.LST 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394
  1. Listing:
  2. 1 IMPLEMENTATION MODULE NdxFiles;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1992 PMI
  8. 7 * Green Bay, Wisconsin
  9. 8 * All rights reserved
  10. 9 * (414) 468-6040
  11. 10 *
  12. 11 * $Header: D:/logfiles/mods/ndxfiles.mov 1.8 10 Mar 1991 15:30:18 coleb $
  13. 12 *
  14. 13 *)
  15. 14
  16. 15 IMPORT FAPI;
  17. 16 (*EntryDiag:
  18. 17 IMPORT Diagnostics;
  19. 18 :EntryDiag*)
  20. 19
  21. 20 IMPORT Drectory;
  22. 21 IMPORT ErrorManager;
  23. 22 IMPORT ErrorNames;
  24. 23 IMPORT HandleIO;
  25. 24 IMPORT GenLists;
  26. 25 IMPORT ListUtils;
  27. 26 IMPORT LowLevel;
  28. 27 IMPORT M2Strings;
  29. 28 IMPORT NdxBones;
  30. 29 IMPORT NdxTypes;
  31. 30 FROM NdxTypes IMPORT NdxRecord;
  32. ***** ^ duplicate identifier
  33. 31 IMPORT Numbers;
  34. 32 IMPORT NumTypes;
  35. 33 IMPORT PosUtils;
  36. 34 IMPORT StrEdit;
  37. 35 IMPORT StringIO;
  38. 36 IMPORT SYSTEM;
  39. 37 IMPORT VStorage;
  40. 38
  41. 39 VAR
  42. 40 Initialized : BOOLEAN;
  43. 41
  44. 42 VAR
  45. 43 NulHandle: VStorage.MemHandle;
  46. ***** ^ not supported yet
  47. 44
  48. 45
  49. 46 PROCEDURE NoMemMessage( message: ARRAY OF CHAR );
  50. ***** ^ not supported yet
  51. 47 VAR
  52. 48 tmpstr: ARRAY [0..79] OF CHAR;
  53. ***** ^ not supported yet
  54. ***** ^ not supported yet
  55. 49 BEGIN
  56. 50 StrEdit.AssignStr( 'Ran out of memory in ', tmpstr );
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. 51 StrEdit.Append( tmpstr, message );
  62. ***** ^ not supported yet
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. 52 ErrorManager.WARN( tmpstr );
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. 53 END NoMemMessage;
  71. ***** ^ not supported yet
  72. 54
  73. 55
  74. 56 PROCEDURE CreateNdxFile( VAR NdxFile: NdxTypes.NdxFileType; fname,
  75. ***** ^ not supported yet
  76. 57 Structure: ARRAY OF CHAR );
  77. ***** ^ not supported yet
  78. 58 (*Structure should look something like this:
  79. 59 "Name, Password, AcctBal, Address {Street, City, State}'
  80. 60 Names listed here can be used to access specific fields
  81. 61 within records, using the Get and Put procedures below.
  82. 62 All procedures that use field names are case sensitive. *)
  83. 63 VAR
  84. 64 TmpName: ARRAY [0..255] OF CHAR;
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. 65 StruSize: CARDINAL;
  88. 66 BytesWritten: LONGINT;
  89. 67 SavedMessage: CARDINAL;
  90. 68
  91. 69 PROCEDURE MakeStructure( VAR StruList: GenLists.GenList; Structure:
  92. ***** ^ not supported yet
  93. 70 ARRAY OF CHAR );
  94. ***** ^ not supported yet
  95. 71 VAR
  96. 72 NextSpot, BraceSpot, CommaSpot: CARDINAL;
  97. 73 SubList: GenLists.GenList;
  98. ***** ^ not supported yet
  99. 74 NameStr: ARRAY [0..255] OF CHAR;
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. 75
  103. 76 PROCEDURE PosCloseBrace( Start: CARDINAL; Structure:
  104. 77 ARRAY OF CHAR): CARDINAL;
  105. ***** ^ not supported yet
  106. 78 (* find the closing brace that matches this open brace *)
  107. 79 VAR
  108. 80 OpenSpot, CloseSpot: CARDINAL;
  109. 81 BEGIN
  110. 82 CloseSpot := PosUtils.Positn( '}', Structure, Start);
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. 83 OpenSpot := PosUtils.Positn( '{', Structure, Start);
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. 84 IF (CloseSpot < OpenSpot) OR
  121. 85 (CloseSpot > HIGH( Structure)) THEN
  122. ***** ^ undeclared identifier
  123. ***** ^ not supported yet
  124. 86 RETURN CloseSpot;
  125. 87 ELSE
  126. 88 RETURN PosCloseBrace( 1+PosCloseBrace( OpenSpot + 1,
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 89 Structure), Structure);
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 90 END;
  133. 91 END PosCloseBrace;
  134. ***** ^ not supported yet
  135. 92
  136. 93 BEGIN
  137. 94 (*MakeStructure*)
  138. 95 IF M2Strings.Length(Structure) = 0 THEN
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. 96 RETURN;
  143. 97 END;
  144. 98 IF Structure[ M2Strings.Length(Structure) - 1 ] # ',' THEN
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 99 StrEdit.Append(Structure, ",");
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. 100 (*Makes all names end the same way for the
  156. 101 convenience of the loop below; nothing will
  157. 102 be appended, however, if a constant structure
  158. 103 string was passed because it completely fills
  159. 104 its array.*)
  160. 105 END;
  161. 106 WHILE M2Strings.Length(Structure) > 0 DO
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. 107 CommaSpot := PosUtils.Pos(',', Structure);
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. 108 (*OK if no comma*)
  170. 109 BraceSpot := PosUtils.Pos('{', Structure);
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 110 IF CommaSpot < BraceSpot THEN
  175. 111 NextSpot := CommaSpot;
  176. 112 ELSE
  177. 113 NextSpot := BraceSpot;
  178. 114 END;
  179. 115 IF NextSpot = 0 THEN
  180. 116 ErrorNames.WarningName( 'NoNam' );
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. 117 RETURN;
  185. 118 END;
  186. 119 M2Strings.Copy( Structure, 0, NextSpot, NameStr );
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. 120 (*Copy everything up to the next separator, but not the
  192. 121 separator itself.*)
  193. 122 M2Strings.Delete( Structure, 0, NextSpot );
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 123 (*Delete everything up to but not including
  199. 124 the separator.*)
  200. 125 IF M2Strings.Length( Structure ) > 0 THEN
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 126 M2Strings.Delete( Structure, 0, 1 );
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. 127 (*Delete the separator, if present.*)
  210. 128 END;
  211. 129 GenLists.ListInsert( NameStr, GenLists.StrCode, StruList, 65535);
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. 130 (* insert this name into the list *)
  220. 131 IF (NextSpot = BraceSpot) AND (BraceSpot <= HIGH(Structure)) THEN
  221. ***** ^ undeclared identifier
  222. ***** ^ not supported yet
  223. 132 (* the preceeding name has a sublist *)
  224. 133 GenLists.NewList( SubList);
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 134 GenLists.ListInsert( SubList, GenLists.ListCode, StruList, 65535);
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. 135 (* insert a sublist into the list *)
  237. 136 BraceSpot := PosCloseBrace( 0, Structure);
  238. ***** ^ not supported yet
  239. ***** ^ not supported yet
  240. 137 IF BraceSpot > HIGH( Structure) THEN
  241. ***** ^ undeclared identifier
  242. ***** ^ not supported yet
  243. 138 ErrorNames.WarningName( 'NdxBrac' );
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. ***** ^ not supported yet
  247. 139 RETURN;
  248. 140 END;
  249. 141 M2Strings.Copy( Structure, 0, BraceSpot, NameStr );
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. 142 (*Copy everything up to the next brace, but not the
  255. 143 brace itself.*)
  256. 144 M2Strings.Delete( Structure, 0, BraceSpot + 1 );
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 145 (*Delete everything up to and including the brace.*)
  262. 146 IF M2Strings.Length( Structure) > 0 THEN
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. 147 (* now delete comma after closing brace *)
  267. 148 IF Structure[0] # ',' THEN
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. 149 ErrorNames.WarningName( 'NdxCmm' );
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 150 RETURN;
  275. 151 ELSE
  276. 152 M2Strings.Delete( Structure, 0, 1);
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. 153 END;
  282. 154 END;
  283. 155 MakeStructure( SubList, NameStr);
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. 156 END;
  288. 157 END;
  289. 158 END MakeStructure;
  290. ***** ^ not supported yet
  291. 159
  292. 160 BEGIN
  293. 161 (*CreateNdxFile*)
  294. 162 NdxTypes.InitNdxFile( NdxFile );
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. 163 StrEdit.AssignStr( fname, NdxFile^.name );
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. 164 WITH NdxFile^ DO
  305. ***** ^ not supported yet
  306. 165 StringIO.PrintMessage( HandleIO.CreateFile( handle, name ) );
  307. ***** ^ not supported yet
  308. ***** ^ not supported yet
  309. ***** ^ not supported yet
  310. ***** ^ not supported yet
  311. ***** ^ undeclared identifier
  312. ***** ^ undeclared identifier
  313. 166 UpdateNeeded := TRUE;
  314. ***** ^ undeclared identifier
  315. 167 GenLists.NewList( Ndx);
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ undeclared identifier
  319. 168 GenLists.NilList( AltKeys );
  320. ***** ^ not supported yet
  321. ***** ^ not supported yet
  322. ***** ^ undeclared identifier
  323. 169 GenLists.NewList( ListBuf);
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. ***** ^ undeclared identifier
  327. 170 GenLists.NewList( StructLst);
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. ***** ^ undeclared identifier
  331. 171 END;
  332. ***** ^ not supported yet
  333. 172 StrEdit.DeleteChar( ' ', Structure );
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ undeclared identifier
  337. 173 StrEdit.CAPstr(Structure);
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. ***** ^ undeclared identifier
  341. 174 StringIO.WriteStr( NdxFile^.handle, '00' );
  342. ***** ^ not supported yet
  343. ***** ^ not supported yet
  344. ***** ^ undeclared identifier
  345. ***** ^ not supported yet
  346. ***** ^ not supported yet
  347. 175 (* space at start of file for size of structure to be put *)
  348. 176 MakeStructure( NdxFile^.StructLst, Structure);
  349. ***** ^ undeclared identifier
  350. ***** ^ undeclared identifier
  351. ***** ^ not supported yet
  352. ***** ^ undeclared identifier
  353. 177 M2Strings.Concat( NdxBones.IsGarbageByte, NdxBones.StructName, TmpName);
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. ***** ^ not supported yet
  357. ***** ^ not supported yet
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. ***** ^ undeclared identifier
  361. 178 GenLists.ListInsert( TmpName, GenLists.StrCode, NdxFile^.StructLst, 1);
  362. ***** ^ not supported yet
  363. ***** ^ not supported yet
  364. ***** ^ undeclared identifier
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. ***** ^ undeclared identifier
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. 179 (* add structure name to structure list *)
  371. 180 SavedMessage := ListUtils.ListToFileHandle(
  372. ***** ^ undeclared identifier
  373. ***** ^ not supported yet
  374. ***** ^ not supported yet
  375. 181 NdxFile^.StructLst, NdxFile^.handle, NdxBones.StartSep,
  376. ***** ^ undeclared identifier
  377. ***** ^ not supported yet
  378. ***** ^ undeclared identifier
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. 182 NdxBones.EndSep, 0, BytesWritten );
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ undeclared identifier
  386. 183 StruSize := Numbers.C( BytesWritten );
  387. ***** ^ undeclared identifier
  388. ***** ^ not supported yet
  389. ***** ^ not supported yet
  390. ***** ^ undeclared identifier
  391. 184 IF (SavedMessage # StringIO.NoError) THEN
  392. ***** ^ undeclared identifier
  393. ***** ^ not supported yet
  394. ***** ^ not supported yet
  395. 185 ErrorNames.WarningName( 'StructCreate' );
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. ***** ^ not supported yet
  399. 186 END;
  400. 187 GenLists.ListDelete( NdxFile^.StructLst, 1, 1);
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. ***** ^ undeclared identifier
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. 188 (* deletes the StructName from the Structure *)
  407. 189 NdxFile^.NdxFilePtr := Numbers.Lc( 2 + StruSize);
  408. ***** ^ undeclared identifier
  409. ***** ^ not supported yet
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ undeclared identifier
  413. 190 (* Point to NdxMarker *)
  414. 191 StringIO.WriteStr( NdxFile^.handle, NdxBones.NdxMarker );
  415. ***** ^ not supported yet
  416. ***** ^ not supported yet
  417. ***** ^ undeclared identifier
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. 192 StringIO.PrintMessage( HandleIO.BlockWrite( NdxFile^.handle,
  422. ***** ^ not supported yet
  423. ***** ^ not supported yet
  424. ***** ^ not supported yet
  425. ***** ^ not supported yet
  426. ***** ^ undeclared identifier
  427. ***** ^ not supported yet
  428. 193 SYSTEM.ADR(NdxFile^.NdxFilePtr), 4));
  429. ***** ^ not supported yet
  430. ***** ^ not supported yet
  431. ***** ^ undeclared identifier
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. 194 (* write ndxmarker & position out to end of file *)
  435. 195 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, Numbers.Lc( 0));
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. ***** ^ undeclared identifier
  439. ***** ^ not supported yet
  440. ***** ^ not supported yet
  441. ***** ^ not supported yet
  442. ***** ^ not supported yet
  443. ***** ^ not supported yet
  444. ***** ^ not supported yet
  445. 196 StringIO.PrintMessage( HandleIO.BlockWrite( NdxFile^.handle,
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. ***** ^ not supported yet
  449. ***** ^ not supported yet
  450. ***** ^ undeclared identifier
  451. ***** ^ not supported yet
  452. 197 SYSTEM.ADR( StruSize), 2));
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ undeclared identifier
  456. ***** ^ not supported yet
  457. 198 (* write size of structure out to start of file *)
  458. 199 NdxBones.MakeEmptyBuf( NdxFile^.StructLst, NdxFile^.ListBuf );
  459. ***** ^ not supported yet
  460. ***** ^ not supported yet
  461. ***** ^ undeclared identifier
  462. ***** ^ not supported yet
  463. ***** ^ undeclared identifier
  464. ***** ^ not supported yet
  465. 200 END CreateNdxFile;
  466. ***** ^ not supported yet
  467. 201
  468. 202
  469. 203 PROCEDURE WriteNdx( NdxFile: NdxTypes.NdxFileType );
  470. ***** ^ not supported yet
  471. 204 VAR
  472. 205 BytesWritten: LONGINT;
  473. 206 BEGIN
  474. 207 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart,
  475. ***** ^ not supported yet
  476. ***** ^ not supported yet
  477. ***** ^ not supported yet
  478. ***** ^ not supported yet
  479. ***** ^ not supported yet
  480. ***** ^ not supported yet
  481. 208 NdxFile^.NdxFilePtr );
  482. ***** ^ not supported yet
  483. ***** ^ not supported yet
  484. 209 (*Go to end of data area.*)
  485. 210 StringIO.WriteStr( NdxFile^.handle, NdxBones.NdxMarker);
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. ***** ^ not supported yet
  489. ***** ^ not supported yet
  490. ***** ^ not supported yet
  491. ***** ^ not supported yet
  492. 211 (*Write NdxMarker.*)
  493. 212 IF StringIO.NoError # ListUtils.ListToFileHandle(
  494. ***** ^ not supported yet
  495. ***** ^ not supported yet
  496. ***** ^ not supported yet
  497. ***** ^ not supported yet
  498. 213 NdxFile^.Ndx, NdxFile^.handle, '', '', 0, BytesWritten ) THEN
  499. ***** ^ not supported yet
  500. ***** ^ not supported yet
  501. ***** ^ not supported yet
  502. ***** ^ not supported yet
  503. ***** ^ not supported yet
  504. 214 (*The nulls mean "don't write delimiters."*)
  505. 215 ErrorNames.WarningName( 'NdxWrt' );
  506. ***** ^ not supported yet
  507. ***** ^ not supported yet
  508. ***** ^ not supported yet
  509. 216 END;
  510. 217 StringIO.PrintMessage( HandleIO.BlockWrite( NdxFile^.handle,
  511. ***** ^ not supported yet
  512. ***** ^ not supported yet
  513. ***** ^ not supported yet
  514. ***** ^ not supported yet
  515. ***** ^ not supported yet
  516. ***** ^ not supported yet
  517. 218 SYSTEM.ADR(NdxFile^.NdxFilePtr), 4) );
  518. ***** ^ not supported yet
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. ***** ^ not supported yet
  522. ***** ^ not supported yet
  523. 219 (* write starting position of index *)
  524. 220 StringIO.PrintMessage(Drectory.SetFileLength(NdxFile^.handle,
  525. ***** ^ not supported yet
  526. ***** ^ not supported yet
  527. ***** ^ not supported yet
  528. ***** ^ not supported yet
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. 221 HandleIO.GetFilePtr(NdxFile^.handle)));
  532. ***** ^ not supported yet
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. ***** ^ not supported yet
  536. 222 HandleIO.UpdateDisk(NdxFile^.handle);
  537. ***** ^ not supported yet
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. ***** ^ not supported yet
  541. 223 SetFileUpdate( NdxFile^.handle, NdxBones.NotGarbageByte);
  542. ***** ^ undeclared identifier
  543. ***** ^ not supported yet
  544. ***** ^ not supported yet
  545. ***** ^ not supported yet
  546. ***** ^ not supported yet
  547. 224 NdxFile^.UpdateNeeded := FALSE;
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. 225 END WriteNdx;
  551. ***** ^ not supported yet
  552. 226
  553. 227 PROCEDURE SetFileUpdate( handle: CARDINAL; GbgByte: CHAR);
  554. 228 BEGIN
  555. 229 (* Puts the passed character in the file's UpdateNeeded
  556. 230 Byte (use IsGarbageByte when file index needs update,
  557. 231 and NotGarbageByte when update no longer needed). *)
  558. 232 HandleIO.SetFilePtr( handle, HandleIO.FromStart, Numbers.Lc( 10));
  559. ***** ^ not supported yet
  560. ***** ^ not supported yet
  561. ***** ^ not supported yet
  562. ***** ^ not supported yet
  563. ***** ^ not supported yet
  564. ***** ^ not supported yet
  565. ***** ^ not supported yet
  566. 233 StringIO.WriteStr( handle, GbgByte);
  567. ***** ^ not supported yet
  568. ***** ^ not supported yet
  569. ***** ^ not supported yet
  570. 234 END SetFileUpdate;
  571. ***** ^ not supported yet
  572. 235
  573. 236 PROCEDURE CloseNdxFile( VAR NdxFile: NdxTypes.NdxFileType );
  574. ***** ^ not supported yet
  575. 237 BEGIN
  576. 238 NdxTypes.CheckInit( NdxFile );
  577. ***** ^ not supported yet
  578. ***** ^ not supported yet
  579. ***** ^ not supported yet
  580. 239 IF NdxFile^.UpdateNeeded THEN
  581. ***** ^ not supported yet
  582. ***** ^ not supported yet
  583. 240 WriteNdx( NdxFile);
  584. ***** ^ not supported yet
  585. ***** ^ not supported yet
  586. 241 (* Write Ndx if it has been changed *)
  587. 242 END;
  588. 243 WITH NdxFile^ DO
  589. ***** ^ not supported yet
  590. 244 GenLists.DisposeList( ListBuf);
  591. ***** ^ not supported yet
  592. ***** ^ not supported yet
  593. ***** ^ undeclared identifier
  594. 245 GenLists.DisposeList( StructLst);
  595. ***** ^ not supported yet
  596. ***** ^ not supported yet
  597. ***** ^ undeclared identifier
  598. 246 GenLists.DisposeList( Ndx );
  599. ***** ^ not supported yet
  600. ***** ^ not supported yet
  601. ***** ^ undeclared identifier
  602. 247 GenLists.DisposeList( AltKeys );
  603. ***** ^ not supported yet
  604. ***** ^ not supported yet
  605. ***** ^ undeclared identifier
  606. 248 (*Note that we don't dispose of the FileBufPtr because
  607. 249 it should always have been absorbed into the ListBuf.*)
  608. 250 IF handle # 0 THEN
  609. ***** ^ undeclared identifier
  610. 251 (*handle may be 0 if the NdxFile record was initialized
  611. 252 but never passed to OpenNdxFile.*)
  612. 253 StringIO.PrintMessage( HandleIO.CloseHandle( handle) );
  613. ***** ^ not supported yet
  614. ***** ^ not supported yet
  615. ***** ^ not supported yet
  616. ***** ^ not supported yet
  617. ***** ^ undeclared identifier
  618. 254 END;
  619. 255 END;
  620. ***** ^ not supported yet
  621. 256 VStorage.DosDealloc( NdxFile, SYSTEM.TSIZE(NdxRecord) );
  622. ***** ^ not supported yet
  623. ***** ^ not supported yet
  624. ***** ^ undeclared identifier
  625. ***** ^ not supported yet
  626. ***** ^ not supported yet
  627. ***** ^ not supported yet
  628. 257 END CloseNdxFile;
  629. ***** ^ not supported yet
  630. 258
  631. 259
  632. 260 PROCEDURE ChangedIndex(NdxFile: NdxTypes.NdxFileType);
  633. ***** ^ not supported yet
  634. 261 BEGIN
  635. 262 (* need to account for small changes to index or just big?? *)
  636. 263 IF NdxFile^.SafetyOn THEN
  637. ***** ^ not supported yet
  638. ***** ^ not supported yet
  639. 264 WriteNdx( NdxFile);
  640. ***** ^ not supported yet
  641. ***** ^ not supported yet
  642. 265 HandleIO.UpdateDisk( NdxFile^.handle );
  643. ***** ^ not supported yet
  644. ***** ^ not supported yet
  645. ***** ^ not supported yet
  646. ***** ^ not supported yet
  647. 266 (* writes entire index at end of file *)
  648. 267 ELSE
  649. 268 IF NOT NdxFile^.UpdateNeeded THEN
  650. ***** ^ not supported yet
  651. ***** ^ not supported yet
  652. 269 SetFileUpdate( NdxFile^.handle, NdxBones.IsGarbageByte);
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. ***** ^ not supported yet
  656. ***** ^ not supported yet
  657. ***** ^ not supported yet
  658. 270 NdxFile^.UpdateNeeded := TRUE;
  659. ***** ^ not supported yet
  660. ***** ^ not supported yet
  661. 271 END;
  662. 272 END;
  663. 273 END ChangedIndex;
  664. ***** ^ not supported yet
  665. 274
  666. 275
  667. 276 PROCEDURE DeleteRecord( VAR NdxFile: NdxTypes.NdxFileType;
  668. ***** ^ not supported yet
  669. 277 RecName: ARRAY OF CHAR ): BOOLEAN;
  670. ***** ^ not supported yet
  671. 278 (*Marks RecName as garbage in the linked list so that
  672. 279 CrunchNdxFile can delete it from the file, sets garbage
  673. 280 byte in file record, and erases in current buffer (if
  674. 281 there). If SafetyOn is set for this NdxFile, also writes
  675. 282 the linked list out to the file.*)
  676. 283 VAR
  677. 284 FilePos: LONGINT;
  678. 285 UsedSize, AllocSize : CARDINAL;
  679. 286 BEGIN
  680. 287 NdxTypes.CheckInit( NdxFile );
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. ***** ^ not supported yet
  684. 288 StrEdit.CrunchBlanks( RecName );
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. ***** ^ not supported yet
  688. 289 IF (M2Strings.Length(RecName) = 0) OR
  689. ***** ^ not supported yet
  690. ***** ^ not supported yet
  691. ***** ^ not supported yet
  692. 290 (NOT NdxBones.FindRecord( NdxFile, RecName, FilePos, UsedSize,
  693. ***** ^ not supported yet
  694. ***** ^ not supported yet
  695. ***** ^ not supported yet
  696. ***** ^ not supported yet
  697. 291 AllocSize)) THEN
  698. ***** ^ not supported yet
  699. 292 (* If don't find record in index, return FALSE *)
  700. 293 RETURN FALSE;
  701. 294 END;
  702. 295 IF NOT ChangeNdxEntry( RecName, '', FilePos, AllocSize,
  703. ***** ^ undeclared identifier
  704. ***** ^ not supported yet
  705. 296 NdxFile) THEN
  706. ***** ^ not supported yet
  707. 297 RETURN FALSE;
  708. 298 END;
  709. 299 (* change index entry to garbage *)
  710. 300 INC( FilePos, 8 );
  711. ***** ^ undeclared identifier
  712. ***** ^ not supported yet
  713. 301 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, FilePos);
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. ***** ^ not supported yet
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. ***** ^ not supported yet
  721. 302 StringIO.WriteStr( NdxFile^.handle, NdxBones.IsGarbageByte);
  722. ***** ^ not supported yet
  723. ***** ^ not supported yet
  724. ***** ^ not supported yet
  725. ***** ^ not supported yet
  726. ***** ^ not supported yet
  727. ***** ^ not supported yet
  728. 303 (* write garbage byte in old record *)
  729. 304 IF PosUtils.Equal(RecName, NdxFile^.BufRecName) THEN
  730. ***** ^ not supported yet
  731. ***** ^ not supported yet
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. 305 (* if record is now in buffer, erase it *)
  736. 306 StrEdit.SetLength( NdxFile^.BufRecName, 0);
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. ***** ^ not supported yet
  741. ***** ^ not supported yet
  742. 307 END;
  743. 308 ChangedIndex( NdxFile);
  744. ***** ^ not supported yet
  745. ***** ^ not supported yet
  746. 309 RETURN TRUE;
  747. 310 END DeleteRecord;
  748. ***** ^ not supported yet
  749. 311
  750. 312
  751. 313 PROCEDURE EncodeList( VAR TheList: GenLists.GenList);
  752. ***** ^ not supported yet
  753. 314
  754. 315 PROCEDURE EnCodeField( OldAddr: SYSTEM.ADDRESS; OldSize,
  755. ***** ^ not supported yet
  756. 316 NumberFound: CARDINAL; VAR NewAddr: SYSTEM.ADDRESS;
  757. ***** ^ not supported yet
  758. 317 VAR NewSize: CARDINAL);
  759. 318 (* Change all occurences of CodeChar to CodedStr *)
  760. 319 VAR
  761. 320 tmpsize, toskip : CARDINAL;
  762. 321 Source, Dest: SYSTEM.ADDRESS;
  763. ***** ^ not supported yet
  764. 322 BEGIN
  765. 323 NewSize := NumberFound + OldSize;
  766. 324 VStorage.DosAlloc( NewAddr, NewSize);
  767. ***** ^ not supported yet
  768. ***** ^ not supported yet
  769. ***** ^ not supported yet
  770. ***** ^ not supported yet
  771. 325 (* max size needed *)
  772. 326 tmpsize := OldSize;
  773. 327 Source := OldAddr;
  774. ***** ^ not supported yet
  775. ***** ^ not supported yet
  776. 328 (* starting address *)
  777. 329 Dest := NewAddr;
  778. ***** ^ not supported yet
  779. ***** ^ not supported yet
  780. 330 LOOP
  781. 331 toskip := LowLevel.ScanEQ( tmpsize, NdxBones.CodeChar, Source);
  782. ***** ^ not supported yet
  783. ***** ^ not supported yet
  784. ***** ^ not supported yet
  785. ***** ^ not supported yet
  786. ***** ^ not supported yet
  787. 332 (* look for next CodeChar *)
  788. 333 LowLevel.Move( Source, Dest, toskip);
  789. ***** ^ not supported yet
  790. ***** ^ not supported yet
  791. ***** ^ not supported yet
  792. ***** ^ not supported yet
  793. ***** ^ not supported yet
  794. 334 IF toskip >= tmpsize THEN
  795. 335 EXIT;
  796. 336 END;
  797. 337 Dest := LowLevel.AddAddr( Dest, toskip );
  798. ***** ^ not supported yet
  799. ***** ^ not supported yet
  800. ***** ^ not supported yet
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. 338 LowLevel.Move( SYSTEM.ADR( NdxBones.CodedStr), Dest, 2);
  804. ***** ^ not supported yet
  805. ***** ^ not supported yet
  806. ***** ^ not supported yet
  807. ***** ^ not supported yet
  808. ***** ^ not supported yet
  809. ***** ^ not supported yet
  810. ***** ^ not supported yet
  811. ***** ^ not supported yet
  812. 339 Dest := LowLevel.AddAddr( Dest, 2 );
  813. ***** ^ not supported yet
  814. ***** ^ not supported yet
  815. ***** ^ not supported yet
  816. ***** ^ not supported yet
  817. ***** ^ not supported yet
  818. 340 INC( OldSize);
  819. ***** ^ undeclared identifier
  820. ***** ^ not supported yet
  821. 341 Source := LowLevel.AddAddr( Source, toskip + 1 );
  822. ***** ^ not supported yet
  823. ***** ^ not supported yet
  824. ***** ^ not supported yet
  825. ***** ^ not supported yet
  826. ***** ^ not supported yet
  827. 342 DEC( tmpsize, toskip + 1);
  828. ***** ^ undeclared identifier
  829. ***** ^ not supported yet
  830. 343 END;
  831. 344 END EnCodeField;
  832. ***** ^ not supported yet
  833. 345
  834. 346 VAR
  835. 347 NumberFound, OldSize, NewSize, ElmntType, cnt, leng: CARDINAL;
  836. 348 SubList: GenLists.GenList;
  837. ***** ^ not supported yet
  838. 349 OldAddr, NewAddr: SYSTEM.ADDRESS;
  839. ***** ^ not supported yet
  840. 350 BEGIN
  841. 351 leng := GenLists.ListLength( TheList );
  842. ***** ^ not supported yet
  843. ***** ^ not supported yet
  844. ***** ^ not supported yet
  845. 352 FOR cnt := 1 TO leng DO
  846. 353 GenLists.GetElmtAdr( TheList, cnt, OldAddr, OldSize, ElmntType);
  847. ***** ^ not supported yet
  848. ***** ^ not supported yet
  849. ***** ^ not supported yet
  850. ***** ^ not supported yet
  851. ***** ^ not supported yet
  852. 354 IF ElmntType # GenLists.ListCode THEN
  853. ***** ^ not supported yet
  854. ***** ^ not supported yet
  855. 355 NumberFound := PosUtils.ByteCount( OldSize,
  856. ***** ^ not supported yet
  857. ***** ^ not supported yet
  858. 356 NdxBones.CodeChar, OldAddr );
  859. ***** ^ not supported yet
  860. ***** ^ not supported yet
  861. ***** ^ not supported yet
  862. 357 IF NumberFound > 0 THEN
  863. 358 (* do not replace unless code chars found *)
  864. 359 EnCodeField( OldAddr, OldSize, NumberFound, NewAddr, NewSize );
  865. ***** ^ not supported yet
  866. ***** ^ not supported yet
  867. ***** ^ not supported yet
  868. ***** ^ not supported yet
  869. 360 GenLists.ListReplaceAdr( NewAddr, NewSize, ElmntType,
  870. ***** ^ not supported yet
  871. ***** ^ not supported yet
  872. ***** ^ not supported yet
  873. 361 TheList, cnt);
  874. ***** ^ not supported yet
  875. ***** ^ not supported yet
  876. 362 VStorage.DosDealloc( NewAddr,NewSize ); (* 9/14/91
  877. ***** ^ not supported yet
  878. ***** ^ not supported yet
  879. ***** ^ not supported yet
  880. ***** ^ not supported yet
  881. 363 per report from J March *)
  882. 364 END;
  883. 365 ELSE
  884. 366 (* this element is a list *)
  885. 367 GenLists.GetChildList( TheList, cnt, SubList);
  886. ***** ^ not supported yet
  887. ***** ^ not supported yet
  888. ***** ^ not supported yet
  889. ***** ^ not supported yet
  890. 368 IF GenLists.Initialized( SubList ) THEN
  891. ***** ^ not supported yet
  892. ***** ^ not supported yet
  893. ***** ^ not supported yet
  894. 369 (*Make sure it's not a nil list.*)
  895. 370 EncodeList( SubList );
  896. ***** ^ not supported yet
  897. ***** ^ not supported yet
  898. 371 (* encode this sublist *)
  899. 372 END;
  900. 373 END;
  901. 374 END;
  902. 375 END EncodeList;
  903. ***** ^ not supported yet
  904. 376
  905. 377
  906. 378 PROCEDURE WriteRecord( VAR NdxFile: NdxTypes.NdxFileType;
  907. ***** ^ not supported yet
  908. 379 RecName: ARRAY OF CHAR ): BOOLEAN;
  909. ***** ^ not supported yet
  910. 380 (*First checks to see whether RecName is in the List buffer
  911. 381 created by the Put routines below. Returns FALSE if it
  912. 382 isn't. If it is, then checks to see whether RecName is in
  913. 383 the list of existing record names. If so, and if the
  914. 384 record will still fit in its old spot in the file,
  915. 385 WriteRecord overwrites the old spot in the file with the
  916. 386 data in the list buffer. Otherwise, it adds the record to
  917. 387 the end of the NdxFile, overwriting the ndx, and if the
  918. 388 record is not new, marks the spot it formerly occupied as
  919. 389 garbage. If the NdxFile's SafetyOn feature has been turned
  920. 390 on, a new ndx will be written each time a record is added
  921. 391 to the end of the NdxFile. Otherwise, the new ndx will be
  922. 392 written only when CloseNdxFile is called.*)
  923. 393 VAR
  924. 394 OldTotalBytes, OldUsedBytes, NewTotData, NumLsts:
  925. 395 CARDINAL;
  926. 396 BytesWritten, NumElmts, NewFilePtr, offset, TotMem: LONGINT;
  927. 397 OldEntry, RecordExists: BOOLEAN;
  928. 398 TmpStr: ARRAY [0..79] OF CHAR;
  929. ***** ^ not supported yet
  930. ***** ^ not supported yet
  931. 399 SavedMessage: CARDINAL;
  932. 400 BEGIN
  933. 401 (* WriteRecord *)
  934. 402 NdxTypes.CheckInit( NdxFile );
  935. ***** ^ not supported yet
  936. ***** ^ not supported yet
  937. ***** ^ not supported yet
  938. 403 StrEdit.CrunchBlanks( RecName );
  939. ***** ^ not supported yet
  940. ***** ^ not supported yet
  941. ***** ^ not supported yet
  942. 404 IF NOT PosUtils.Equal(RecName, NdxFile^.BufRecName) THEN
  943. ***** ^ not supported yet
  944. ***** ^ not supported yet
  945. ***** ^ not supported yet
  946. ***** ^ not supported yet
  947. ***** ^ not supported yet
  948. 405 (* if record not in buffer, return FALSE *)
  949. 406 RETURN( FALSE );
  950. 407 END;
  951. 408 StrEdit.AssignStr( RecName, TmpStr );
  952. ***** ^ not supported yet
  953. ***** ^ not supported yet
  954. ***** ^ not supported yet
  955. ***** ^ not supported yet
  956. 409 M2Strings.Insert( NdxBones.NotGarbageByte, TmpStr, 0 );
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. ***** ^ not supported yet
  960. ***** ^ not supported yet
  961. ***** ^ not supported yet
  962. ***** ^ not supported yet
  963. 410 GenLists.ListInsert( TmpStr, GenLists.StrCode,
  964. ***** ^ not supported yet
  965. ***** ^ not supported yet
  966. ***** ^ not supported yet
  967. ***** ^ not supported yet
  968. ***** ^ not supported yet
  969. 411 NdxFile^.ListBuf, 1 );
  970. ***** ^ not supported yet
  971. ***** ^ not supported yet
  972. ***** ^ not supported yet
  973. 412 (*Put the record name into the ListBuf.*)
  974. 413 StrEdit.SetLength( NdxFile^.BufRecName, 0);
  975. ***** ^ not supported yet
  976. ***** ^ not supported yet
  977. ***** ^ not supported yet
  978. ***** ^ not supported yet
  979. ***** ^ not supported yet
  980. 414 (*We set BufRecName to null to guarantee that this record
  981. 415 gets read from the file next time it is needed, because
  982. 416 we are about to encode it.*)
  983. 417 OldTotalBytes := 0;
  984. 418 RecordExists := NdxBones.FindRecord( NdxFile, RecName,
  985. ***** ^ not supported yet
  986. ***** ^ not supported yet
  987. ***** ^ not supported yet
  988. ***** ^ not supported yet
  989. 419 offset, OldUsedBytes, OldTotalBytes);
  990. ***** ^ not supported yet
  991. 420 EncodeList( NdxFile^.ListBuf );
  992. ***** ^ not supported yet
  993. ***** ^ not supported yet
  994. ***** ^ not supported yet
  995. 421 NewTotData := Numbers.C( GenLists.ListSize( NdxFile^.ListBuf,
  996. ***** ^ not supported yet
  997. ***** ^ not supported yet
  998. ***** ^ not supported yet
  999. ***** ^ not supported yet
  1000. ***** ^ not supported yet
  1001. ***** ^ not supported yet
  1002. 422 NumElmts, NumLsts, TotMem));
  1003. ***** ^ not supported yet
  1004. 423 (* find out maximum size of data in record to be written *)
  1005. 424 INC( NewTotData, 6 + 6 * Numbers.C( NumElmts));
  1006. ***** ^ undeclared identifier
  1007. ***** ^ not supported yet
  1008. ***** ^ not supported yet
  1009. ***** ^ not supported yet
  1010. 425 (* add room for: 2 char start & end seps for record,
  1011. 426 2 char start & end seps for every element, and
  1012. 427 2 char TypeCode for every element & for record *)
  1013. 428 OldEntry := RecordExists AND (NewTotData <= OldTotalBytes);
  1014. 429 (* whether record exists and old file spot is big enough *)
  1015. 430 IF OldEntry THEN
  1016. 431 (* rewrite in old spot if not too big *)
  1017. 432 IF NOT ChangeNdxEntry( RecName, RecName, offset,
  1018. ***** ^ undeclared identifier
  1019. ***** ^ not supported yet
  1020. ***** ^ not supported yet
  1021. 433 NewTotData, NdxFile) THEN
  1022. ***** ^ not supported yet
  1023. 434 RETURN FALSE;
  1024. 435 END;
  1025. 436 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, offset );
  1026. ***** ^ not supported yet
  1027. ***** ^ not supported yet
  1028. ***** ^ not supported yet
  1029. ***** ^ not supported yet
  1030. ***** ^ not supported yet
  1031. ***** ^ not supported yet
  1032. ***** ^ not supported yet
  1033. 437 NewFilePtr := offset;
  1034. 438 (*I'm not sure this assignment is necessary, but it
  1035. 439 prevents confusion.*)
  1036. 440 ELSE
  1037. 441 (* new entry is too big; so delete old index entry and
  1038. 442 write at end *)
  1039. 443 IF RecordExists THEN
  1040. 444 (* change old entry to garbage *)
  1041. 445 IF NOT ChangeNdxEntry( RecName, '', offset,
  1042. ***** ^ undeclared identifier
  1043. ***** ^ not supported yet
  1044. 446 OldTotalBytes, NdxFile) THEN
  1045. ***** ^ not supported yet
  1046. 447 RETURN FALSE;
  1047. 448 END;
  1048. 449 INC( offset, 8 );
  1049. ***** ^ undeclared identifier
  1050. ***** ^ not supported yet
  1051. 450 (*We skip past the record's first NdxBones.StartSep and
  1052. 451 its ListCode, plus the NdxBones.StartSep for the
  1053. 452 RecordName and its StrCode. Using a numeric literal
  1054. 453 here is dangerous.*)
  1055. 454 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, offset);
  1056. ***** ^ not supported yet
  1057. ***** ^ not supported yet
  1058. ***** ^ not supported yet
  1059. ***** ^ not supported yet
  1060. ***** ^ not supported yet
  1061. ***** ^ not supported yet
  1062. ***** ^ not supported yet
  1063. 455 StringIO.WriteStr( NdxFile^.handle, NdxBones.IsGarbageByte);
  1064. ***** ^ not supported yet
  1065. ***** ^ not supported yet
  1066. ***** ^ not supported yet
  1067. ***** ^ not supported yet
  1068. ***** ^ not supported yet
  1069. ***** ^ not supported yet
  1070. 456 (* write garbage byte in old record *)
  1071. 457 END;
  1072. 458 NewFilePtr := NdxFile^.NdxFilePtr;
  1073. ***** ^ not supported yet
  1074. ***** ^ not supported yet
  1075. 459 (*NdxFile^.NdxFilePtr always points at the end of the
  1076. 460 NdxFile's data area--at the NdxMarker, in other words.*)
  1077. 461 OldTotalBytes := NewTotData;
  1078. 462 (* initialize two variables that InsertNdxEntry will
  1079. 463 update if it finds old garbage space to re-use *)
  1080. 464 IF NOT InsertNdxEntry( RecName, NewFilePtr, NewTotData,
  1081. ***** ^ undeclared identifier
  1082. ***** ^ not supported yet
  1083. 465 OldTotalBytes, NdxFile) THEN
  1084. ***** ^ not supported yet
  1085. 466 (* make new entry for this record, or re-use garbage
  1086. 467 space *)
  1087. 468 RETURN FALSE;
  1088. 469 END;
  1089. 470 (* make new index entry *)
  1090. 471 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, NewFilePtr);
  1091. ***** ^ not supported yet
  1092. ***** ^ not supported yet
  1093. ***** ^ not supported yet
  1094. ***** ^ not supported yet
  1095. ***** ^ not supported yet
  1096. ***** ^ not supported yet
  1097. ***** ^ not supported yet
  1098. 472 (* put file pointer at start of this new record *)
  1099. 473 END;
  1100. 474 SavedMessage := ListUtils.ListToFileHandle( NdxFile^.ListBuf,
  1101. ***** ^ not supported yet
  1102. ***** ^ not supported yet
  1103. ***** ^ not supported yet
  1104. ***** ^ not supported yet
  1105. 475 NdxFile^.handle, NdxBones.StartSep, NdxBones.EndSep, 0,
  1106. ***** ^ not supported yet
  1107. ***** ^ not supported yet
  1108. ***** ^ not supported yet
  1109. ***** ^ not supported yet
  1110. ***** ^ not supported yet
  1111. ***** ^ not supported yet
  1112. 476 BytesWritten );
  1113. ***** ^ not supported yet
  1114. 477 IF BytesWritten # Numbers.Lc(NewTotData) THEN
  1115. ***** ^ not supported yet
  1116. ***** ^ not supported yet
  1117. ***** ^ not supported yet
  1118. 478 (*we've miscalculated NewTotData*)
  1119. 479 (*
  1120. 480 Diagnostics.diagL( "Unexpected value for BytesWritten", BytesWritten );
  1121. 481 Diagnostics.diagC( "Should be", NewTotData );
  1122. 482 *)
  1123. 483 END;
  1124. 484 IF NewTotData < OldTotalBytes THEN
  1125. 485 (* garbage space at end of record to fill *)
  1126. 486 DEC( OldTotalBytes, NewTotData);
  1127. ***** ^ undeclared identifier
  1128. ***** ^ not supported yet
  1129. 487 IF HandleIO.FillFile( NdxFile^.handle, OldTotalBytes, 0C ) #
  1130. ***** ^ not supported yet
  1131. ***** ^ not supported yet
  1132. ***** ^ not supported yet
  1133. ***** ^ not supported yet
  1134. ***** ^ not supported yet
  1135. 488 StringIO.NoError THEN
  1136. ***** ^ not supported yet
  1137. ***** ^ not supported yet
  1138. 489 (* fill end of record with nulls *)
  1139. 490 RETURN FALSE;
  1140. 491 END;
  1141. 492 END;
  1142. 493 IF (NOT OldEntry) OR (NewTotData # OldUsedBytes) THEN
  1143. 494 (* if not using old index entry *)
  1144. 495 IF NewFilePtr = NdxFile^.NdxFilePtr THEN
  1145. ***** ^ not supported yet
  1146. ***** ^ not supported yet
  1147. 496 NdxFile^.NdxFilePtr := NdxFile^.NdxFilePtr + Numbers.Lc( NewTotData );
  1148. ***** ^ not supported yet
  1149. ***** ^ not supported yet
  1150. ***** ^ not supported yet
  1151. ***** ^ not supported yet
  1152. ***** ^ not supported yet
  1153. ***** ^ not supported yet
  1154. ***** ^ not supported yet
  1155. 497 StringIO.WriteStr( NdxFile^.handle, NdxBones.NdxMarker);
  1156. ***** ^ not supported yet
  1157. ***** ^ not supported yet
  1158. ***** ^ not supported yet
  1159. ***** ^ not supported yet
  1160. ***** ^ not supported yet
  1161. ***** ^ not supported yet
  1162. 498 (* correct ndxfileptr and write ndxmarker if adding
  1163. 499 to end of file *)
  1164. 500 END;
  1165. 501 ChangedIndex( NdxFile);
  1166. ***** ^ not supported yet
  1167. ***** ^ not supported yet
  1168. 502 (* write changed index to file, or set UpdateNeeded *)
  1169. 503 END;
  1170. 504 GenLists.DisposeList( NdxFile^.ListBuf );
  1171. ***** ^ not supported yet
  1172. ***** ^ not supported yet
  1173. ***** ^ not supported yet
  1174. ***** ^ not supported yet
  1175. 505 (*Might as well dispose of the list buffer since it's no good once
  1176. 506 we've encoded it.*)
  1177. 507 StrEdit.SetLength( NdxFile^.BufRecName, 0);
  1178. ***** ^ not supported yet
  1179. ***** ^ not supported yet
  1180. ***** ^ not supported yet
  1181. ***** ^ not supported yet
  1182. ***** ^ not supported yet
  1183. 508 (*Set BufRecName to null again because ChangeNdxEntry may
  1184. 509 have put the name back in.*)
  1185. 510 RETURN TRUE;
  1186. 511 END WriteRecord;
  1187. ***** ^ not supported yet
  1188. 512
  1189. 513
  1190. 514 PROCEDURE ResetBuf( VAR TheBuf: GenLists.GenList );
  1191. ***** ^ not supported yet
  1192. 515 VAR
  1193. 516 ElmntBytes, ElmntType, theleng, cnt: CARDINAL;
  1194. 517 TmpAddr: SYSTEM.ADDRESS;
  1195. ***** ^ not supported yet
  1196. 518 sublst: GenLists.GenList;
  1197. ***** ^ not supported yet
  1198. 519 BEGIN
  1199. 520 theleng := GenLists.ListLength( TheBuf);
  1200. ***** ^ not supported yet
  1201. ***** ^ not supported yet
  1202. ***** ^ not supported yet
  1203. 521 IF theleng # 0 THEN
  1204. 522 FOR cnt := 1 TO theleng DO
  1205. 523 GenLists.GetElmtAdr( TheBuf, cnt, TmpAddr, ElmntBytes, ElmntType);
  1206. ***** ^ not supported yet
  1207. ***** ^ not supported yet
  1208. ***** ^ not supported yet
  1209. ***** ^ not supported yet
  1210. ***** ^ not supported yet
  1211. 524 IF ElmntType = GenLists.ListCode THEN
  1212. ***** ^ not supported yet
  1213. ***** ^ not supported yet
  1214. 525 GenLists.GetChildList( TheBuf, cnt, sublst);
  1215. ***** ^ not supported yet
  1216. ***** ^ not supported yet
  1217. ***** ^ not supported yet
  1218. ***** ^ not supported yet
  1219. 526 ResetBuf( sublst);
  1220. ***** ^ not supported yet
  1221. ***** ^ not supported yet
  1222. 527 ELSIF ElmntType = GenLists.StrCode THEN
  1223. ***** ^ not supported yet
  1224. ***** ^ not supported yet
  1225. 528 LowLevel.Fill( TmpAddr, 1, 0C);
  1226. ***** ^ not supported yet
  1227. ***** ^ not supported yet
  1228. ***** ^ not supported yet
  1229. ***** ^ not supported yet
  1230. 529 ELSE
  1231. 530 LowLevel.Fill( TmpAddr, ElmntBytes, 0C);
  1232. ***** ^ not supported yet
  1233. ***** ^ not supported yet
  1234. ***** ^ not supported yet
  1235. ***** ^ not supported yet
  1236. 531 END;
  1237. 532 END;
  1238. 533 END;
  1239. 534 END ResetBuf;
  1240. ***** ^ not supported yet
  1241. 535
  1242. 536
  1243. 537 PROCEDURE FindField( StruList: GenLists.GenList; FieldName: ARRAY OF CHAR;
  1244. ***** ^ not supported yet
  1245. ***** ^ not supported yet
  1246. 538 VAR DataList: GenLists.GenList; VAR spot: CARDINAL): BOOLEAN;
  1247. ***** ^ not supported yet
  1248. 539 (* flip thru structure to find field & return the sublist
  1249. 540 it is in & its position in that list;
  1250. 541 if can't find, return FALSE.
  1251. 542 Start counting with spot.*)
  1252. 543 VAR
  1253. 544 NameSize, NameType, PeriodSpot, indx, cnt,
  1254. 545 FieldLeng, ElmntBytes, ElmntType: CARDINAL;
  1255. 546 TmpPtr, NamePtr: LowLevel.Address8086;
  1256. ***** ^ not supported yet
  1257. 547 SubName: ARRAY [0..255] OF CHAR;
  1258. ***** ^ not supported yet
  1259. ***** ^ not supported yet
  1260. 548 NotFound, StillMatches: BOOLEAN;
  1261. 549 SubStruList, SubDataList: GenLists.GenList;
  1262. ***** ^ not supported yet
  1263. 550 TmpAddr: SYSTEM.ADDRESS;
  1264. ***** ^ not supported yet
  1265. 551 BEGIN
  1266. 552 (*FindField*)
  1267. 553 StrEdit.CAPstr(FieldName);
  1268. ***** ^ not supported yet
  1269. ***** ^ not supported yet
  1270. ***** ^ not supported yet
  1271. 554 IF PosUtils.Equal( FieldName, 'RECORD') THEN
  1272. ***** ^ not supported yet
  1273. ***** ^ not supported yet
  1274. ***** ^ not supported yet
  1275. ***** ^ not supported yet
  1276. 555 spot := 0;
  1277. 556 RETURN TRUE;
  1278. 557 END;
  1279. 558 cnt := 1;
  1280. 559 NotFound := TRUE;
  1281. 560 PeriodSpot := PosUtils.Pos( '.', FieldName);
  1282. ***** ^ not supported yet
  1283. ***** ^ not supported yet
  1284. ***** ^ not supported yet
  1285. 561 StrEdit.SetLength( SubName, 0);
  1286. ***** ^ not supported yet
  1287. ***** ^ not supported yet
  1288. ***** ^ not supported yet
  1289. ***** ^ not supported yet
  1290. 562 IF PeriodSpot <= HIGH( FieldName) THEN
  1291. ***** ^ undeclared identifier
  1292. ***** ^ not supported yet
  1293. 563 (* period found -> subfields specified *)
  1294. 564 IF PeriodSpot = M2Strings.Length(FieldName) - 1 THEN
  1295. ***** ^ not supported yet
  1296. ***** ^ not supported yet
  1297. ***** ^ not supported yet
  1298. 565 StrEdit.SetLength( FieldName, M2Strings.Length( FieldName) - 1);
  1299. ***** ^ not supported yet
  1300. ***** ^ not supported yet
  1301. ***** ^ not supported yet
  1302. ***** ^ not supported yet
  1303. ***** ^ not supported yet
  1304. ***** ^ not supported yet
  1305. ***** ^ not supported yet
  1306. 566 (* delete period if alone at end of field name *)
  1307. 567 ELSE
  1308. 568 M2Strings.Copy( FieldName, PeriodSpot + 1,
  1309. ***** ^ not supported yet
  1310. ***** ^ not supported yet
  1311. ***** ^ not supported yet
  1312. 569 M2Strings.Length(FieldName) -PeriodSpot - 1,
  1313. ***** ^ not supported yet
  1314. ***** ^ not supported yet
  1315. ***** ^ not supported yet
  1316. 570 SubName);
  1317. ***** ^ not supported yet
  1318. 571 (* SubName is the name of the subfields *)
  1319. 572 StrEdit.SetLength( FieldName, PeriodSpot);
  1320. ***** ^ not supported yet
  1321. ***** ^ not supported yet
  1322. ***** ^ not supported yet
  1323. ***** ^ not supported yet
  1324. 573 (* make field name the name at the first level *)
  1325. 574 END;
  1326. 575 END;
  1327. 576 FieldLeng := M2Strings.Length( FieldName);
  1328. ***** ^ not supported yet
  1329. ***** ^ not supported yet
  1330. ***** ^ not supported yet
  1331. 577 (* length of name sought *)
  1332. 578 WHILE (cnt <= GenLists.ListLength( StruList)) AND NotFound DO
  1333. ***** ^ not supported yet
  1334. ***** ^ not supported yet
  1335. ***** ^ not supported yet
  1336. 579 (* flip thru structure to find field *)
  1337. 580 GenLists.GetElmtAdr( StruList, cnt, NamePtr.a, NameSize, NameType);
  1338. ***** ^ not supported yet
  1339. ***** ^ not supported yet
  1340. ***** ^ not supported yet
  1341. ***** ^ not supported yet
  1342. ***** ^ not supported yet
  1343. ***** ^ not supported yet
  1344. 581 (* read next field *)
  1345. 582 INC( cnt);
  1346. ***** ^ undeclared identifier
  1347. ***** ^ not supported yet
  1348. 583 IF (NameType # GenLists.ListCode) THEN
  1349. ***** ^ not supported yet
  1350. ***** ^ not supported yet
  1351. 584 (* if not a list, see if it is the sought name *)
  1352. 585 INC( spot);
  1353. ***** ^ undeclared identifier
  1354. ***** ^ not supported yet
  1355. 586 (* inc the field counter *)
  1356. 587 IF NameSize = (1 + FieldLeng) THEN
  1357. 588 (* compare this field name to name sought *)
  1358. 589 indx := 0;
  1359. 590 TmpPtr := NamePtr;
  1360. ***** ^ not supported yet
  1361. ***** ^ not supported yet
  1362. 591 StillMatches := TRUE;
  1363. 592 WHILE StillMatches AND (indx < FieldLeng) DO
  1364. 593 StillMatches := FieldName[ indx] = TmpPtr.b^;
  1365. ***** ^ not supported yet
  1366. ***** ^ not supported yet
  1367. ***** ^ not supported yet
  1368. ***** ^ not supported yet
  1369. 594 IF StillMatches THEN
  1370. 595 INC( indx);
  1371. ***** ^ undeclared identifier
  1372. ***** ^ not supported yet
  1373. 596 LowLevel.IncAddr( TmpPtr.a, 1 );
  1374. ***** ^ not supported yet
  1375. ***** ^ not supported yet
  1376. ***** ^ not supported yet
  1377. ***** ^ not supported yet
  1378. ***** ^ not supported yet
  1379. 597 END;
  1380. 598 END;
  1381. 599 NotFound := NOT StillMatches;
  1382. 600 END;
  1383. 601 END;
  1384. 602 END;
  1385. 603 IF NotFound THEN
  1386. 604 RETURN FALSE ;
  1387. 605 END;
  1388. 606 IF M2Strings.Length( SubName) # 0 THEN
  1389. ***** ^ not supported yet
  1390. ***** ^ not supported yet
  1391. ***** ^ not supported yet
  1392. 607 GenLists.GetElmtAdr( StruList, cnt, TmpAddr, ElmntBytes, ElmntType);
  1393. ***** ^ not supported yet
  1394. ***** ^ not supported yet
  1395. ***** ^ not supported yet
  1396. ***** ^ not supported yet
  1397. ***** ^ not supported yet
  1398. 608 IF ElmntType = GenLists.ListCode THEN
  1399. ***** ^ not supported yet
  1400. ***** ^ not supported yet
  1401. 609 (* if this field has a sub list *)
  1402. 610 GenLists.GetChildList( StruList, cnt, SubStruList);
  1403. ***** ^ not supported yet
  1404. ***** ^ not supported yet
  1405. ***** ^ not supported yet
  1406. ***** ^ not supported yet
  1407. 611 GenLists.GetChildList( DataList, spot, SubDataList);
  1408. ***** ^ not supported yet
  1409. ***** ^ not supported yet
  1410. ***** ^ not supported yet
  1411. ***** ^ not supported yet
  1412. 612 DataList := SubDataList;
  1413. ***** ^ not supported yet
  1414. ***** ^ not supported yet
  1415. 613 spot := 0;
  1416. 614 IF NOT FindField( SubStruList, SubName, DataList, spot)
  1417. ***** ^ not supported yet
  1418. ***** ^ not supported yet
  1419. ***** ^ not supported yet
  1420. ***** ^ not supported yet
  1421. ***** ^ not supported yet
  1422. 615 THEN
  1423. 616 RETURN FALSE;
  1424. 617 END;
  1425. 618 ELSE
  1426. 619 RETURN FALSE;
  1427. 620 END;
  1428. 621 END;
  1429. 622 RETURN TRUE;
  1430. 623 END FindField;
  1431. ***** ^ not supported yet
  1432. 624
  1433. 625 PROCEDURE AddRecord( NdxFile: NdxTypes.NdxFileType; RecName:
  1434. ***** ^ not supported yet
  1435. 626 ARRAY OF CHAR);
  1436. ***** ^ not supported yet
  1437. 627 (* Adds new record to file by:
  1438. 628 putting record name in BufRecName
  1439. 629 (don't add to index; WriteRec will do it)
  1440. 630 and creating empty list buffer *)
  1441. 631 BEGIN
  1442. 632 StrEdit.AssignStr(RecName, NdxFile^.BufRecName);
  1443. ***** ^ not supported yet
  1444. ***** ^ not supported yet
  1445. ***** ^ not supported yet
  1446. ***** ^ not supported yet
  1447. ***** ^ not supported yet
  1448. 633 ResetBuf( NdxFile^.ListBuf );
  1449. ***** ^ not supported yet
  1450. ***** ^ not supported yet
  1451. ***** ^ not supported yet
  1452. 634 (* initialize empty ListBuf *)
  1453. 635 END AddRecord;
  1454. ***** ^ not supported yet
  1455. 636
  1456. 637
  1457. 638 PROCEDURE PutField( VAR NdxFile: NdxTypes.NdxFileType;
  1458. ***** ^ not supported yet
  1459. 639 RecName, FieldName: ARRAY OF CHAR; TheType: CARDINAL;
  1460. ***** ^ not supported yet
  1461. 640 TheField: ARRAY OF SYSTEM.BYTE ): BOOLEAN;
  1462. ***** ^ not supported yet
  1463. 641 BEGIN
  1464. 642 RETURN PutFieldAdr( NdxFile, RecName, FieldName, TheType,
  1465. ***** ^ undeclared identifier
  1466. ***** ^ not supported yet
  1467. ***** ^ not supported yet
  1468. ***** ^ not supported yet
  1469. 643 SYSTEM.ADR(TheField), HIGH(TheField) + 1 );
  1470. ***** ^ not supported yet
  1471. ***** ^ not supported yet
  1472. ***** ^ not supported yet
  1473. ***** ^ undeclared identifier
  1474. ***** ^ not supported yet
  1475. ***** ^ not supported yet
  1476. 644 END PutField;
  1477. ***** ^ not supported yet
  1478. 645
  1479. 646
  1480. 647 PROCEDURE GetField( VAR NdxFile: NdxTypes.NdxFileType;
  1481. ***** ^ not supported yet
  1482. 648 RecName, FieldName: ARRAY OF CHAR; VAR TheType: CARDINAL;
  1483. ***** ^ not supported yet
  1484. 649 VAR TheField: ARRAY OF SYSTEM.BYTE ): BOOLEAN;
  1485. ***** ^ not supported yet
  1486. 650 VAR
  1487. 651 TmpAdr: SYSTEM.ADDRESS;
  1488. ***** ^ not supported yet
  1489. 652 TmpSize: CARDINAL;
  1490. 653 found: BOOLEAN;
  1491. 654 BEGIN
  1492. 655 found := GetFieldAdr( NdxFile, RecName, FieldName, TheType,
  1493. ***** ^ undeclared identifier
  1494. ***** ^ not supported yet
  1495. ***** ^ not supported yet
  1496. ***** ^ not supported yet
  1497. 656 TmpAdr, TmpSize );
  1498. ***** ^ not supported yet
  1499. ***** ^ not supported yet
  1500. 657 IF found THEN
  1501. 658 LowLevel.Move( TmpAdr, SYSTEM.ADR(TheField),
  1502. ***** ^ not supported yet
  1503. ***** ^ not supported yet
  1504. ***** ^ not supported yet
  1505. ***** ^ not supported yet
  1506. ***** ^ not supported yet
  1507. ***** ^ not supported yet
  1508. 659 Numbers.Min(TmpSize, HIGH(TheField) + 1) );
  1509. ***** ^ not supported yet
  1510. ***** ^ not supported yet
  1511. ***** ^ undeclared identifier
  1512. ***** ^ not supported yet
  1513. ***** ^ not supported yet
  1514. 660 IF TheType = GenLists.StrCode THEN
  1515. ***** ^ not supported yet
  1516. ***** ^ not supported yet
  1517. 661 IF (HIGH(TheField) + 2) < TmpSize THEN
  1518. ***** ^ undeclared identifier
  1519. ***** ^ not supported yet
  1520. 662 (*Ignore the fact that we couldn't store the null
  1521. 663 terminator.*)
  1522. 664 found := FALSE;
  1523. 665 END;
  1524. 666 ELSIF (HIGH(TheField) + 1) < TmpSize THEN
  1525. ***** ^ undeclared identifier
  1526. ***** ^ not supported yet
  1527. 667 (*We do this to warn user that there's been an
  1528. 668 overflow.*)
  1529. 669 found := FALSE;
  1530. 670 END;
  1531. 671 END;
  1532. 672 RETURN found;
  1533. 673 END GetField;
  1534. ***** ^ not supported yet
  1535. 674
  1536. 675
  1537. 676 PROCEDURE PutFieldAdr( VAR NdxFile: NdxTypes.NdxFileType; RecName,
  1538. ***** ^ not supported yet
  1539. 677 FieldName: ARRAY OF CHAR; TheType: CARDINAL; TheFieldAdr:
  1540. ***** ^ not supported yet
  1541. 678 SYSTEM.ADDRESS; TheFieldSize: CARDINAL ): BOOLEAN;
  1542. ***** ^ not supported yet
  1543. 679 (*Returns FALSE if FieldName is not in the structure list
  1544. 680 associated with NdxFile, or if not of TheType. It
  1545. 681 calls InitBuffer to: do a Retrieve if current contents of
  1546. 682 RecName are not in the read buffer, and then it transfers
  1547. 683 from the read buffer into the list buffer (actually it
  1548. 684 allocates a list element for every field in the read
  1549. 685 buffer). If the RecName does not exist, it is created.
  1550. 686 Then it looks for FieldName in that list (the list
  1551. 687 buffer), encodes the incoming string and puts it over the
  1552. 688 current value. Doesn't actually write anything to the
  1553. 689 file; you have to use WriteRecord before doing a Put with
  1554. 690 any different record, else the stuff you've stored in the
  1555. 691 list buffer will be lost.*)
  1556. 692 VAR
  1557. 693 len1, len2, spot: CARDINAL;
  1558. 694 TmpList, DataList: GenLists.GenList;
  1559. ***** ^ not supported yet
  1560. 695 BEGIN
  1561. 696 spot := 0;
  1562. 697 StrEdit.CrunchBlanks( RecName );
  1563. ***** ^ not supported yet
  1564. ***** ^ not supported yet
  1565. ***** ^ not supported yet
  1566. 698 len1 := M2Strings.Length(RecName);
  1567. ***** ^ not supported yet
  1568. ***** ^ not supported yet
  1569. ***** ^ not supported yet
  1570. 699 IF len1 > NdxTypes.RecNameLength THEN
  1571. ***** ^ not supported yet
  1572. ***** ^ not supported yet
  1573. 700 StrEdit.SetLength( RecName, NdxTypes.RecNameLength );
  1574. ***** ^ not supported yet
  1575. ***** ^ not supported yet
  1576. ***** ^ not supported yet
  1577. ***** ^ not supported yet
  1578. ***** ^ not supported yet
  1579. 701 END;
  1580. 702 IF len1 = 0 THEN
  1581. 703 RETURN FALSE;
  1582. 704 ELSIF NOT NdxBones.InitBuffer( NdxFile, RecName) THEN
  1583. ***** ^ not supported yet
  1584. ***** ^ not supported yet
  1585. ***** ^ not supported yet
  1586. ***** ^ not supported yet
  1587. 705 (*Loads file data if exists, or else creates new record.*)
  1588. 706 AddRecord( NdxFile, RecName);
  1589. ***** ^ not supported yet
  1590. ***** ^ not supported yet
  1591. ***** ^ not supported yet
  1592. 707 END;
  1593. 708 DataList := NdxFile^.ListBuf;
  1594. ***** ^ not supported yet
  1595. ***** ^ not supported yet
  1596. ***** ^ not supported yet
  1597. 709 IF NOT FindField( NdxFile^.StructLst, FieldName, DataList, spot) THEN
  1598. ***** ^ not supported yet
  1599. ***** ^ not supported yet
  1600. ***** ^ not supported yet
  1601. ***** ^ not supported yet
  1602. ***** ^ not supported yet
  1603. ***** ^ not supported yet
  1604. 710 (* locates field; returns list and position *)
  1605. 711 RETURN FALSE;
  1606. 712 END;
  1607. 713 IF (spot = 0) THEN
  1608. 714 (* replacing the entire record *)
  1609. 715 IF (TheType # GenLists.ListCode) THEN
  1610. ***** ^ not supported yet
  1611. ***** ^ not supported yet
  1612. 716 (*This used to be illegal. Now we anticipate what
  1613. 717 they're trying to do.*)
  1614. 718 GenLists.NewList( TmpList );
  1615. ***** ^ not supported yet
  1616. ***** ^ not supported yet
  1617. ***** ^ not supported yet
  1618. 719 GenLists.ListInsertAdr( TheFieldAdr, TheFieldSize,
  1619. ***** ^ not supported yet
  1620. ***** ^ not supported yet
  1621. ***** ^ not supported yet
  1622. 720 TheType, TmpList, 1 );
  1623. ***** ^ not supported yet
  1624. ***** ^ not supported yet
  1625. 721 ELSIF NOT GenLists.AdrToList( TheFieldAdr, TheFieldSize, TmpList ) THEN
  1626. ***** ^ not supported yet
  1627. ***** ^ not supported yet
  1628. ***** ^ not supported yet
  1629. ***** ^ not supported yet
  1630. 722 HALT();
  1631. ***** ^ undeclared identifier
  1632. ***** ^ not supported yet
  1633. 723 END;
  1634. 724 len1 := GenLists.ListLength(TmpList);
  1635. ***** ^ not supported yet
  1636. ***** ^ not supported yet
  1637. ***** ^ not supported yet
  1638. 725 len2 := GenLists.ListLength(DataList);
  1639. ***** ^ not supported yet
  1640. ***** ^ not supported yet
  1641. ***** ^ not supported yet
  1642. 726 IF ( 1 + len1 ) >= len2 THEN
  1643. 727 (* only allow if list as big as structure *)
  1644. 728 IF SYSTEM.ADDRESS(NdxFile^.ListBuf) # SYSTEM.ADDRESS(TmpList) THEN
  1645. ***** ^ not supported yet
  1646. ***** ^ not supported yet
  1647. ***** ^ not supported yet
  1648. ***** ^ not supported yet
  1649. ***** ^ not supported yet
  1650. ***** ^ not supported yet
  1651. ***** ^ not supported yet
  1652. 729 (*We do this test because it's likely that ListBuf and
  1653. 730 TmpList will be the same--GetField gives you the real
  1654. 731 ListBuf, not a copy of it, so people may be modifying
  1655. 732 the ListBuf directly and then passing it back to
  1656. 733 PutField. The PutField in that case isn't necessary,
  1657. 734 since PutField's only purpose is to modify the
  1658. 735 ListBuf.*)
  1659. 736 GenLists.DisposeList( NdxFile^.ListBuf);
  1660. ***** ^ not supported yet
  1661. ***** ^ not supported yet
  1662. ***** ^ not supported yet
  1663. ***** ^ not supported yet
  1664. 737 NdxFile^.ListBuf := TmpList;
  1665. ***** ^ not supported yet
  1666. ***** ^ not supported yet
  1667. ***** ^ not supported yet
  1668. 738 (* dispose of old buffer and use new data as buffer *)
  1669. 739 END;
  1670. 740 ELSE
  1671. 741 RETURN FALSE;
  1672. 742 END;
  1673. 743 ELSE
  1674. 744 GenLists.ListReplaceAdr( TheFieldAdr, TheFieldSize, TheType,
  1675. ***** ^ not supported yet
  1676. ***** ^ not supported yet
  1677. ***** ^ not supported yet
  1678. 745 DataList, spot );
  1679. ***** ^ not supported yet
  1680. ***** ^ not supported yet
  1681. 746 (* puts new data in list buffer in proper spot *)
  1682. 747 END;
  1683. 748 RETURN TRUE;
  1684. 749 END PutFieldAdr;
  1685. ***** ^ not supported yet
  1686. 750
  1687. 751
  1688. 752 PROCEDURE GetFieldAdr( VAR NdxFile: NdxTypes.NdxFileType; RecName,
  1689. ***** ^ not supported yet
  1690. 753 FieldName: ARRAY OF CHAR; VAR TheType: CARDINAL; VAR
  1691. ***** ^ not supported yet
  1692. 754 TheFieldAdr: SYSTEM.ADDRESS; VAR TheFieldSize: CARDINAL ):
  1693. ***** ^ not supported yet
  1694. 755 BOOLEAN;
  1695. 756 (*GetFieldAdr first calls InitBuffer to do retrieve if
  1696. 757 needed & finds field in index list if it is there. If
  1697. 758 problem with either, return FALSE. Then get the element
  1698. 759 out of the ListBuffer *)
  1699. 760 VAR
  1700. 761 spot: CARDINAL;
  1701. 762 DataList: GenLists.GenList;
  1702. ***** ^ not supported yet
  1703. 763 offset: LONGINT; (*Not used.*)
  1704. 764 RecSize, ListSpot: CARDINAL; (*Not used.*)
  1705. 765
  1706. 766 BEGIN
  1707. 767 spot := 0;
  1708. 768 StrEdit.CrunchBlanks( RecName );
  1709. ***** ^ not supported yet
  1710. ***** ^ not supported yet
  1711. ***** ^ not supported yet
  1712. 769 IF (M2Strings.Length(RecName)=0) OR (NOT NdxBones.FindRecord(
  1713. ***** ^ not supported yet
  1714. ***** ^ not supported yet
  1715. ***** ^ not supported yet
  1716. ***** ^ not supported yet
  1717. ***** ^ not supported yet
  1718. 770 NdxFile, RecName, offset, RecSize, ListSpot )) THEN
  1719. ***** ^ not supported yet
  1720. ***** ^ not supported yet
  1721. ***** ^ not supported yet
  1722. 771 RETURN FALSE;
  1723. 772 END;
  1724. 773 IF NOT NdxBones.InitBuffer( NdxFile, RecName) THEN
  1725. ***** ^ not supported yet
  1726. ***** ^ not supported yet
  1727. ***** ^ not supported yet
  1728. ***** ^ not supported yet
  1729. 774 RETURN FALSE;
  1730. 775 END;
  1731. 776 DataList := NdxFile^.ListBuf;
  1732. ***** ^ not supported yet
  1733. ***** ^ not supported yet
  1734. ***** ^ not supported yet
  1735. 777 IF NOT FindField( NdxFile^.StructLst, FieldName,
  1736. ***** ^ not supported yet
  1737. ***** ^ not supported yet
  1738. ***** ^ not supported yet
  1739. ***** ^ not supported yet
  1740. 778 DataList, spot) THEN
  1741. ***** ^ not supported yet
  1742. ***** ^ not supported yet
  1743. 779 RETURN FALSE;
  1744. 780 END;
  1745. 781 IF spot = 0 THEN
  1746. 782 (* entire record requested *)
  1747. 783 TheFieldSize := (*SYSTEM.TSIZE(GenLists.GenList)*) 4;
  1748. 784 TheFieldAdr := GenLists.AdrOfList( NdxFile^.ListBuf );
  1749. ***** ^ not supported yet
  1750. ***** ^ not supported yet
  1751. ***** ^ not supported yet
  1752. ***** ^ not supported yet
  1753. ***** ^ not supported yet
  1754. 785 TheType := GenLists.ListCode;
  1755. ***** ^ not supported yet
  1756. ***** ^ not supported yet
  1757. 786 RETURN TRUE;
  1758. 787 ELSE
  1759. 788 GenLists.GetElmtAdr( DataList, spot, TheFieldAdr,
  1760. ***** ^ not supported yet
  1761. ***** ^ not supported yet
  1762. ***** ^ not supported yet
  1763. ***** ^ not supported yet
  1764. 789 TheFieldSize, TheType);
  1765. ***** ^ not supported yet
  1766. 790 (* try to retrieve the requested element *)
  1767. 791 END;
  1768. 792 RETURN TRUE;
  1769. 793 END GetFieldAdr;
  1770. ***** ^ not supported yet
  1771. 794
  1772. 795
  1773. 796 PROCEDURE FileStructure( NdxFile: NdxTypes.NdxFileType;
  1774. ***** ^ not supported yet
  1775. 797 VAR Structure: ARRAY OF CHAR );
  1776. ***** ^ not supported yet
  1777. 798 (*Returns a string containing the names of all fields
  1778. 799 defined for the NdxFile, in the form used by the
  1779. 800 Structure parameter of the CreateNdxFile procedure.*)
  1780. 801
  1781. 802 PROCEDURE AddTheList( TheList: GenLists.GenList);
  1782. ***** ^ not supported yet
  1783. 803 VAR
  1784. 804 leng, cnt, TheType, TmpSize: CARDINAL;
  1785. 805 tmpbuf: ARRAY [0..NdxTypes.RecNameLength] OF CHAR;
  1786. ***** ^ not supported yet
  1787. ***** ^ not supported yet
  1788. ***** ^ not supported yet
  1789. 806 TmpAddr: SYSTEM.ADDRESS;
  1790. ***** ^ not supported yet
  1791. 807 SubList: GenLists.GenList;
  1792. ***** ^ not supported yet
  1793. 808 BEGIN
  1794. 809 leng := GenLists.ListLength( TheList);
  1795. ***** ^ not supported yet
  1796. ***** ^ not supported yet
  1797. ***** ^ not supported yet
  1798. 810 FOR cnt := 1 TO leng DO
  1799. 811 GenLists.GetElmtAdr( TheList, cnt, TmpAddr, TmpSize, TheType);
  1800. ***** ^ not supported yet
  1801. ***** ^ not supported yet
  1802. ***** ^ not supported yet
  1803. ***** ^ not supported yet
  1804. ***** ^ not supported yet
  1805. 812 IF TheType # GenLists.ListCode THEN
  1806. ***** ^ not supported yet
  1807. ***** ^ not supported yet
  1808. 813 IF cnt # 1 THEN
  1809. 814 StrEdit.Append( Structure, ',');
  1810. ***** ^ not supported yet
  1811. ***** ^ not supported yet
  1812. ***** ^ not supported yet
  1813. ***** ^ not supported yet
  1814. 815 END;
  1815. 816 IF TmpSize <= (NdxTypes.RecNameLength + 1) THEN
  1816. ***** ^ not supported yet
  1817. ***** ^ not supported yet
  1818. 817 LowLevel.Move( TmpAddr, SYSTEM.ADR(tmpbuf), TmpSize);
  1819. ***** ^ not supported yet
  1820. ***** ^ not supported yet
  1821. ***** ^ not supported yet
  1822. ***** ^ not supported yet
  1823. ***** ^ not supported yet
  1824. ***** ^ not supported yet
  1825. ***** ^ not supported yet
  1826. 818 ELSE
  1827. 819 LowLevel.Move( TmpAddr, SYSTEM.ADR(tmpbuf),
  1828. ***** ^ not supported yet
  1829. ***** ^ not supported yet
  1830. ***** ^ not supported yet
  1831. ***** ^ not supported yet
  1832. ***** ^ not supported yet
  1833. ***** ^ not supported yet
  1834. 820 (NdxTypes.RecNameLength + 1));
  1835. ***** ^ not supported yet
  1836. ***** ^ not supported yet
  1837. ***** ^ not supported yet
  1838. 821 END;
  1839. 822 StrEdit.Append( Structure, tmpbuf);
  1840. ***** ^ not supported yet
  1841. ***** ^ not supported yet
  1842. ***** ^ not supported yet
  1843. ***** ^ not supported yet
  1844. 823 ELSE
  1845. 824 StrEdit.Append( Structure, '{');
  1846. ***** ^ not supported yet
  1847. ***** ^ not supported yet
  1848. ***** ^ not supported yet
  1849. ***** ^ not supported yet
  1850. 825 GenLists.GetChildList( TheList, cnt, SubList);
  1851. ***** ^ not supported yet
  1852. ***** ^ not supported yet
  1853. ***** ^ not supported yet
  1854. ***** ^ not supported yet
  1855. 826 AddTheList( SubList);
  1856. ***** ^ not supported yet
  1857. ***** ^ not supported yet
  1858. 827 StrEdit.Append( Structure, '}');
  1859. ***** ^ not supported yet
  1860. ***** ^ not supported yet
  1861. ***** ^ not supported yet
  1862. ***** ^ not supported yet
  1863. 828 END;
  1864. 829 END;
  1865. 830 END AddTheList;
  1866. ***** ^ not supported yet
  1867. 831
  1868. 832 BEGIN
  1869. 833 NdxTypes.CheckInit( NdxFile );
  1870. ***** ^ not supported yet
  1871. ***** ^ not supported yet
  1872. ***** ^ not supported yet
  1873. 834 StrEdit.SetLength( Structure, 0);
  1874. ***** ^ not supported yet
  1875. ***** ^ not supported yet
  1876. ***** ^ not supported yet
  1877. ***** ^ not supported yet
  1878. 835 AddTheList( NdxFile^.StructLst);
  1879. ***** ^ not supported yet
  1880. ***** ^ not supported yet
  1881. ***** ^ not supported yet
  1882. 836 END FileStructure;
  1883. ***** ^ not supported yet
  1884. 837
  1885. 838
  1886. 839 PROCEDURE RecordExists( NdxFile: NdxTypes.NdxFileType; VAR
  1887. ***** ^ not supported yet
  1888. 840 RecName: ARRAY OF CHAR ): BOOLEAN;
  1889. ***** ^ not supported yet
  1890. 841 VAR
  1891. 842 offset: LONGINT; (*Not used.*)
  1892. 843 RecSize, ListSpot: CARDINAL; (*Not used.*)
  1893. 844 BEGIN
  1894. 845 NdxTypes.CheckInit( NdxFile );
  1895. ***** ^ not supported yet
  1896. ***** ^ not supported yet
  1897. ***** ^ not supported yet
  1898. 846 StrEdit.CrunchBlanks( RecName );
  1899. ***** ^ not supported yet
  1900. ***** ^ not supported yet
  1901. ***** ^ not supported yet
  1902. 847 RETURN (M2Strings.Length(RecName) # 0) AND
  1903. ***** ^ not supported yet
  1904. ***** ^ not supported yet
  1905. ***** ^ not supported yet
  1906. 848 (NdxBones.FindRecord( NdxFile, RecName, offset, RecSize, ListSpot ));
  1907. ***** ^ not supported yet
  1908. ***** ^ not supported yet
  1909. ***** ^ not supported yet
  1910. ***** ^ not supported yet
  1911. ***** ^ not supported yet
  1912. 849 END RecordExists;
  1913. ***** ^ not supported yet
  1914. 850
  1915. 851 PROCEDURE SafetyOn( VAR NdxFile: NdxTypes.NdxFileType );
  1916. ***** ^ not supported yet
  1917. 852 (*After SafetyOn is called, every time WriteRecord adds a
  1918. 853 record to the end of an NdxFile and thereby overwrites the
  1919. 854 ndx, it writes out a new copy of the ndx at the end of the
  1920. 855 file. NdxFiles are initialized with Safety off.*)
  1921. 856 BEGIN
  1922. 857 NdxTypes.CheckInit( NdxFile );
  1923. ***** ^ not supported yet
  1924. ***** ^ not supported yet
  1925. ***** ^ not supported yet
  1926. 858 NdxFile^.SafetyOn := TRUE;
  1927. ***** ^ not supported yet
  1928. ***** ^ not supported yet
  1929. 859 END SafetyOn;
  1930. ***** ^ not supported yet
  1931. 860
  1932. 861 PROCEDURE SafetyOff( VAR NdxFile: NdxTypes.NdxFileType );
  1933. ***** ^ not supported yet
  1934. 862 (*After SafetyOff is called, the ndx at the end of an NdxFile
  1935. 863 can be overwritten, and will be restored only when
  1936. 864 CloseNdxFile is called.*)
  1937. 865 BEGIN
  1938. 866 NdxTypes.CheckInit( NdxFile );
  1939. ***** ^ not supported yet
  1940. ***** ^ not supported yet
  1941. ***** ^ not supported yet
  1942. 867 NdxFile^.SafetyOn := FALSE;
  1943. ***** ^ not supported yet
  1944. ***** ^ not supported yet
  1945. 868 END SafetyOff;
  1946. ***** ^ not supported yet
  1947. 869
  1948. 870
  1949. 871 PROCEDURE FindBlankSpace( VAR Ndx: GenLists.GenList; VAR NewElmt:
  1950. ***** ^ not supported yet
  1951. 872 NdxTypes.NdxElement; VAR OldElmt: CARDINAL): BOOLEAN;
  1952. ***** ^ not supported yet
  1953. 873 (* if can find space for NewElmt in deleted records at end of
  1954. 874 index, change NewElmt to point to the empty spot, return
  1955. 875 the cardinal position of the re-used garbage element of
  1956. 876 the index, and return TRUE *)
  1957. 877 VAR
  1958. 878 TheType: CARDINAL;
  1959. 879 TmpElmt: NdxTypes.NdxElement;
  1960. ***** ^ not supported yet
  1961. 880 BEGIN
  1962. 881 IF (M2Strings.Length( NewElmt.RecName) = 0) OR
  1963. ***** ^ not supported yet
  1964. ***** ^ not supported yet
  1965. ***** ^ not supported yet
  1966. ***** ^ not supported yet
  1967. 882 (NewElmt.UsedChars = 0) OR
  1968. ***** ^ not supported yet
  1969. ***** ^ not supported yet
  1970. 883 (GenLists.ListLength(Ndx) = 0) THEN
  1971. ***** ^ not supported yet
  1972. ***** ^ not supported yet
  1973. ***** ^ not supported yet
  1974. 884 (* don't try this for garbage entries or empty index *)
  1975. 885 RETURN FALSE;
  1976. 886 ELSE
  1977. 887 GenLists.GetElmt( Ndx, GenLists.ListLength(Ndx), TmpElmt, TheType);
  1978. ***** ^ not supported yet
  1979. ***** ^ not supported yet
  1980. ***** ^ not supported yet
  1981. ***** ^ not supported yet
  1982. ***** ^ not supported yet
  1983. ***** ^ not supported yet
  1984. ***** ^ not supported yet
  1985. ***** ^ not supported yet
  1986. 888 END;
  1987. 889 WHILE M2Strings.Length(TmpElmt.RecName) = 0 DO
  1988. ***** ^ not supported yet
  1989. ***** ^ not supported yet
  1990. ***** ^ not supported yet
  1991. ***** ^ not supported yet
  1992. 890 (* search through all entries in index with no name
  1993. 891 (garbage entries) *)
  1994. 892 IF TmpElmt.Allocated >= NewElmt.Allocated THEN
  1995. ***** ^ not supported yet
  1996. ***** ^ not supported yet
  1997. ***** ^ not supported yet
  1998. ***** ^ not supported yet
  1999. 893 (* found an entry to re-use *)
  2000. 894 NewElmt.Allocated := TmpElmt.Allocated;
  2001. ***** ^ not supported yet
  2002. ***** ^ not supported yet
  2003. ***** ^ not supported yet
  2004. ***** ^ not supported yet
  2005. 895 NewElmt.FilePos := TmpElmt.FilePos;
  2006. ***** ^ not supported yet
  2007. ***** ^ not supported yet
  2008. ***** ^ not supported yet
  2009. ***** ^ not supported yet
  2010. 896 OldElmt := GenLists.ElmtNow( Ndx);
  2011. ***** ^ not supported yet
  2012. ***** ^ not supported yet
  2013. ***** ^ not supported yet
  2014. 897 RETURN TRUE;
  2015. 898 END;
  2016. 899 IF GenLists.ElmtNow( Ndx ) = 1 THEN
  2017. ***** ^ not supported yet
  2018. ***** ^ not supported yet
  2019. ***** ^ not supported yet
  2020. 900 (* if can't back up any more, return FALSE *)
  2021. 901 RETURN FALSE;
  2022. 902 END;
  2023. 903 GenLists.NextElmt( Ndx, -1, TmpElmt, TheType);
  2024. ***** ^ not supported yet
  2025. ***** ^ not supported yet
  2026. ***** ^ not supported yet
  2027. ***** ^ not supported yet
  2028. ***** ^ not supported yet
  2029. 904 END;
  2030. 905 RETURN FALSE;
  2031. 906 END FindBlankSpace;
  2032. ***** ^ not supported yet
  2033. 907
  2034. 908 (*$O-*)
  2035. 909 (*We turn off optimization in this procedure to avoid a bug in
  2036. 910 the beta copy of Logitech's v3.0 compiler.*)
  2037. 911
  2038. 912 PROCEDURE InsertNdxEntry( RecName: ARRAY OF CHAR;
  2039. ***** ^ not supported yet
  2040. 913 VAR FilePos: LONGINT; UsedChars: CARDINAL;
  2041. 914 VAR AllocatedChars: CARDINAL; VAR NdxFile: NdxTypes.NdxFileType ):
  2042. ***** ^ not supported yet
  2043. 915 BOOLEAN;
  2044. 916 VAR
  2045. 917 dummylong: LONGINT;
  2046. 918 TheElmt, dummycard, OldElmt, NameLength: CARDINAL;
  2047. 919 TmpElmt: NdxTypes.NdxElement;
  2048. ***** ^ not supported yet
  2049. 920 BEGIN
  2050. 921 NameLength := M2Strings.Length(RecName);
  2051. ***** ^ not supported yet
  2052. ***** ^ not supported yet
  2053. ***** ^ not supported yet
  2054. 922 IF NameLength < (HIGH(RecName) + 1) THEN
  2055. ***** ^ undeclared identifier
  2056. ***** ^ not supported yet
  2057. 923 LowLevel.Fill( LowLevel.AddAddr(SYSTEM.ADR(RecName), NameLength ),
  2058. ***** ^ not supported yet
  2059. ***** ^ not supported yet
  2060. ***** ^ not supported yet
  2061. ***** ^ not supported yet
  2062. ***** ^ not supported yet
  2063. ***** ^ not supported yet
  2064. ***** ^ not supported yet
  2065. ***** ^ not supported yet
  2066. 924 1 + HIGH(RecName) - NameLength, 0C );
  2067. ***** ^ undeclared identifier
  2068. ***** ^ not supported yet
  2069. ***** ^ not supported yet
  2070. 925 (*We do this to initialize end space in the Ndx; makes it
  2071. 926 easier to read when debugging.*)
  2072. 927 END;
  2073. 928 LowLevel.Fill( SYSTEM.ADR(TmpElmt.RecName),
  2074. ***** ^ not supported yet
  2075. ***** ^ not supported yet
  2076. ***** ^ not supported yet
  2077. ***** ^ not supported yet
  2078. ***** ^ not supported yet
  2079. ***** ^ not supported yet
  2080. 929 M2Strings.Length(TmpElmt.RecName), 0C );
  2081. ***** ^ not supported yet
  2082. ***** ^ not supported yet
  2083. ***** ^ not supported yet
  2084. ***** ^ not supported yet
  2085. ***** ^ not supported yet
  2086. 930 StrEdit.AssignStr( RecName, TmpElmt.RecName );
  2087. ***** ^ not supported yet
  2088. ***** ^ not supported yet
  2089. ***** ^ not supported yet
  2090. ***** ^ not supported yet
  2091. ***** ^ not supported yet
  2092. 931 TmpElmt.FilePos := FilePos;
  2093. ***** ^ not supported yet
  2094. ***** ^ not supported yet
  2095. 932 TmpElmt.UsedChars := UsedChars;
  2096. ***** ^ not supported yet
  2097. ***** ^ not supported yet
  2098. 933 TmpElmt.Allocated := AllocatedChars;
  2099. ***** ^ not supported yet
  2100. ***** ^ not supported yet
  2101. 934 IF NOT NdxBones.FindRecord(NdxFile, RecName, dummylong,
  2102. ***** ^ not supported yet
  2103. ***** ^ not supported yet
  2104. ***** ^ not supported yet
  2105. ***** ^ not supported yet
  2106. 935 dummycard, TheElmt) THEN
  2107. ***** ^ not supported yet
  2108. 936 (*The FindRecord returns the alphabetically correct
  2109. 937 insertion point, TheElmt.*)
  2110. 938 IF FindBlankSpace( NdxFile^.Ndx, TmpElmt, OldElmt) THEN
  2111. ***** ^ not supported yet
  2112. ***** ^ not supported yet
  2113. ***** ^ not supported yet
  2114. ***** ^ not supported yet
  2115. ***** ^ not supported yet
  2116. 939 (* if can find space for record in existing garbage, use it
  2117. 940 and delete the garbage index entry *)
  2118. 941 FilePos := TmpElmt.FilePos;
  2119. ***** ^ not supported yet
  2120. ***** ^ not supported yet
  2121. 942 AllocatedChars := TmpElmt.Allocated;
  2122. ***** ^ not supported yet
  2123. ***** ^ not supported yet
  2124. 943 GenLists.ListDelete( NdxFile^.Ndx, OldElmt, 1);
  2125. ***** ^ not supported yet
  2126. ***** ^ not supported yet
  2127. ***** ^ not supported yet
  2128. ***** ^ not supported yet
  2129. ***** ^ not supported yet
  2130. 944 END;
  2131. 945 GenLists.ListInsert( TmpElmt, NdxTypes.NdxTypeCode,
  2132. ***** ^ not supported yet
  2133. ***** ^ not supported yet
  2134. ***** ^ not supported yet
  2135. ***** ^ not supported yet
  2136. ***** ^ not supported yet
  2137. 946 NdxFile^.Ndx, TheElmt);
  2138. ***** ^ not supported yet
  2139. ***** ^ not supported yet
  2140. ***** ^ not supported yet
  2141. 947 RETURN TRUE;
  2142. 948 ELSE
  2143. 949 RETURN FALSE;
  2144. 950 END;
  2145. 951 END InsertNdxEntry;
  2146. ***** ^ not supported yet
  2147. 952 (*$O=*)
  2148. 953
  2149. 954
  2150. 955 PROCEDURE ChangeNdxEntry( OldRecName, NewRecName: ARRAY OF CHAR;
  2151. ***** ^ not supported yet
  2152. 956 FilePos: LONGINT; NumUsed: CARDINAL; VAR NdxFile: NdxTypes.NdxFileType):
  2153. ***** ^ not supported yet
  2154. 957 BOOLEAN;
  2155. 958 VAR
  2156. 959 TmpElmt: NdxTypes.NdxElement;
  2157. ***** ^ not supported yet
  2158. 960 dummylong: LONGINT;
  2159. 961 dummycard, NewElmt, OldElmt: CARDINAL;
  2160. 962 ToGarbage: BOOLEAN;
  2161. 963 BEGIN
  2162. 964 LowLevel.Fill( SYSTEM.ADR(TmpElmt.RecName),
  2163. ***** ^ not supported yet
  2164. ***** ^ not supported yet
  2165. ***** ^ not supported yet
  2166. ***** ^ not supported yet
  2167. ***** ^ not supported yet
  2168. ***** ^ not supported yet
  2169. 965 M2Strings.Length(TmpElmt.RecName), 0C );
  2170. ***** ^ not supported yet
  2171. ***** ^ not supported yet
  2172. ***** ^ not supported yet
  2173. ***** ^ not supported yet
  2174. ***** ^ not supported yet
  2175. 966 StrEdit.AssignStr( NewRecName, TmpElmt.RecName );
  2176. ***** ^ not supported yet
  2177. ***** ^ not supported yet
  2178. ***** ^ not supported yet
  2179. ***** ^ not supported yet
  2180. ***** ^ not supported yet
  2181. 967 ToGarbage := M2Strings.Length( NewRecName)=0;
  2182. ***** ^ not supported yet
  2183. ***** ^ not supported yet
  2184. ***** ^ not supported yet
  2185. 968 IF ToGarbage THEN
  2186. 969 TmpElmt.UsedChars := 0;
  2187. ***** ^ not supported yet
  2188. ***** ^ not supported yet
  2189. 970 (* Marks the entry as garbage if you change name to '' *)
  2190. 971 ELSE
  2191. 972 TmpElmt.UsedChars := NumUsed;
  2192. ***** ^ not supported yet
  2193. ***** ^ not supported yet
  2194. 973 END;
  2195. 974 TmpElmt.FilePos := FilePos;
  2196. ***** ^ not supported yet
  2197. ***** ^ not supported yet
  2198. 975 TmpElmt.Allocated := NumUsed;
  2199. ***** ^ not supported yet
  2200. ***** ^ not supported yet
  2201. 976 IF NdxBones.FindRecord(NdxFile, OldRecName, dummylong,
  2202. ***** ^ not supported yet
  2203. ***** ^ not supported yet
  2204. ***** ^ not supported yet
  2205. ***** ^ not supported yet
  2206. 977 dummycard, dummycard) THEN
  2207. ***** ^ not supported yet
  2208. 978 IF NdxBones.CompareProc( OldRecName, NewRecName) # 0 THEN
  2209. ***** ^ not supported yet
  2210. ***** ^ not supported yet
  2211. ***** ^ not supported yet
  2212. ***** ^ not supported yet
  2213. 979 (* to change record names, find and save old position,
  2214. 980 if new name does not exist then delete old and insert
  2215. 981 new *)
  2216. 982 OldElmt := GenLists.ElmtNow(NdxFile^.Ndx);
  2217. ***** ^ not supported yet
  2218. ***** ^ not supported yet
  2219. ***** ^ not supported yet
  2220. ***** ^ not supported yet
  2221. 983 IF ToGarbage OR (NOT NdxBones.FindRecord(NdxFile, NewRecName,
  2222. ***** ^ not supported yet
  2223. ***** ^ not supported yet
  2224. ***** ^ not supported yet
  2225. ***** ^ not supported yet
  2226. 984 dummylong, dummycard, dummycard)) THEN
  2227. ***** ^ not supported yet
  2228. 985 GenLists.ListDelete( NdxFile^.Ndx, OldElmt, 1);
  2229. ***** ^ not supported yet
  2230. ***** ^ not supported yet
  2231. ***** ^ not supported yet
  2232. ***** ^ not supported yet
  2233. ***** ^ not supported yet
  2234. 986 (*If new name does not exist (or represents garbage)
  2235. 987 and old entry can be deleted, return success of
  2236. 988 trying to insert new name *)
  2237. 989 ToGarbage := NdxBones.FindRecord(NdxFile, NewRecName, dummylong,
  2238. ***** ^ not supported yet
  2239. ***** ^ not supported yet
  2240. ***** ^ not supported yet
  2241. ***** ^ not supported yet
  2242. 990 dummycard, NewElmt);
  2243. ***** ^ not supported yet
  2244. 991 (*We do not need this result. We need NewElmt. *)
  2245. 992 IF ToGarbage THEN
  2246. 993 (* if found new value in file already, it is a
  2247. 994 garbage entry; insert at that point *)
  2248. 995 NewElmt := GenLists.ElmtNow( NdxFile^.Ndx);
  2249. ***** ^ not supported yet
  2250. ***** ^ not supported yet
  2251. ***** ^ not supported yet
  2252. ***** ^ not supported yet
  2253. 996 END;
  2254. 997 GenLists.ListInsert( TmpElmt, NdxTypes.NdxTypeCode,
  2255. ***** ^ not supported yet
  2256. ***** ^ not supported yet
  2257. ***** ^ not supported yet
  2258. ***** ^ not supported yet
  2259. ***** ^ not supported yet
  2260. 998 NdxFile^.Ndx, NewElmt);
  2261. ***** ^ not supported yet
  2262. ***** ^ not supported yet
  2263. ***** ^ not supported yet
  2264. 999 RETURN TRUE;
  2265. 1000 ELSE
  2266. 1001 RETURN FALSE;
  2267. 1002 END;
  2268. 1003 (* if changed name, delete old and add new *)
  2269. 1004 END;
  2270. 1005 GenLists.ListReplace( TmpElmt, NdxTypes.NdxTypeCode, NdxFile^.Ndx,
  2271. ***** ^ not supported yet
  2272. ***** ^ not supported yet
  2273. ***** ^ not supported yet
  2274. ***** ^ not supported yet
  2275. ***** ^ not supported yet
  2276. ***** ^ not supported yet
  2277. ***** ^ not supported yet
  2278. 1006 GenLists.ElmtNow(NdxFile^.Ndx));
  2279. ***** ^ not supported yet
  2280. ***** ^ not supported yet
  2281. ***** ^ not supported yet
  2282. ***** ^ not supported yet
  2283. 1007 RETURN TRUE;
  2284. 1008 ELSE
  2285. 1009 RETURN FALSE;
  2286. 1010 END;
  2287. 1011 END ChangeNdxEntry;
  2288. ***** ^ not supported yet
  2289. 1012
  2290. 1013
  2291. 1014 PROCEDURE Init();
  2292. 1015 BEGIN
  2293. 1016 IF Initialized THEN
  2294. 1017 RETURN;
  2295. 1018 ELSE
  2296. 1019 Initialized := TRUE;
  2297. 1020 END;
  2298. 1021 (*EntryDiag:
  2299. 1022 Diagnostics.Init();
  2300. 1023 :EntryDiag*)
  2301. 1024
  2302. 1025 Drectory.Init();
  2303. ***** ^ not supported yet
  2304. ***** ^ not supported yet
  2305. ***** ^ not supported yet
  2306. 1026 ErrorManager.Init();
  2307. ***** ^ not supported yet
  2308. ***** ^ not supported yet
  2309. ***** ^ not supported yet
  2310. 1027 ErrorNames.Init();
  2311. ***** ^ not supported yet
  2312. ***** ^ not supported yet
  2313. ***** ^ not supported yet
  2314. 1028 HandleIO.Init();
  2315. ***** ^ not supported yet
  2316. ***** ^ not supported yet
  2317. ***** ^ not supported yet
  2318. 1029 GenLists.Init();
  2319. ***** ^ not supported yet
  2320. ***** ^ not supported yet
  2321. ***** ^ not supported yet
  2322. 1030 ListUtils.Init();
  2323. ***** ^ not supported yet
  2324. ***** ^ not supported yet
  2325. ***** ^ not supported yet
  2326. 1031 LowLevel.Init();
  2327. ***** ^ not supported yet
  2328. ***** ^ not supported yet
  2329. ***** ^ not supported yet
  2330. 1032 M2Strings.Init();
  2331. ***** ^ not supported yet
  2332. ***** ^ not supported yet
  2333. ***** ^ not supported yet
  2334. 1033 NdxBones.Init();
  2335. ***** ^ not supported yet
  2336. ***** ^ not supported yet
  2337. ***** ^ not supported yet
  2338. 1034 NdxTypes.Init();
  2339. ***** ^ not supported yet
  2340. ***** ^ not supported yet
  2341. ***** ^ not supported yet
  2342. 1035 Numbers.Init();
  2343. ***** ^ not supported yet
  2344. ***** ^ not supported yet
  2345. ***** ^ not supported yet
  2346. 1036 NumTypes.Init();
  2347. ***** ^ not supported yet
  2348. ***** ^ not supported yet
  2349. ***** ^ not supported yet
  2350. 1037 PosUtils.Init();
  2351. ***** ^ not supported yet
  2352. ***** ^ not supported yet
  2353. ***** ^ not supported yet
  2354. 1038 StrEdit.Init();
  2355. ***** ^ not supported yet
  2356. ***** ^ not supported yet
  2357. ***** ^ not supported yet
  2358. 1039 StringIO.Init();
  2359. ***** ^ not supported yet
  2360. ***** ^ not supported yet
  2361. ***** ^ not supported yet
  2362. 1040 VStorage.Init();
  2363. ***** ^ not supported yet
  2364. ***** ^ not supported yet
  2365. ***** ^ not supported yet
  2366. 1041 (*EntryDiag:
  2367. 1042 Diagnostics.diagS( 'Entering NdxFiles', '' );
  2368. 1043 :EntryDiag*)
  2369. 1044
  2370. 1045 VStorage.NilHandle( NulHandle );
  2371. ***** ^ not supported yet
  2372. ***** ^ not supported yet
  2373. ***** ^ not supported yet
  2374. 1046
  2375. 1047 (*EntryDiag:
  2376. 1048 Diagnostics.diagS( 'Exiting NdxFiles', '' );
  2377. 1049 :EntryDiag*)
  2378. 1050
  2379. 1051 END Init;
  2380. ***** ^ not supported yet
  2381. 1052
  2382. 1053
  2383. 1054 BEGIN
  2384. 1055 Initialized := FALSE;
  2385. 1056 Init();
  2386. ***** ^ not supported yet
  2387. ***** ^ not supported yet
  2388. 1057 END NdxFiles.
  2389. ***** ^ not supported yet
  2390. 1331 errors