MODBASE3.LST 124 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794
  1. Listing:
  2. 1
  3. 2 IMPLEMENTATION MODULE ModBase3;
  4. 3
  5. 4 (*
  6. 5 * ModBase
  7. 6 * Release 3.0
  8. 7 * (c) Copyright 1986 - 1991 Donald G. Fletcher
  9. 8 * (c) Copyright 1986 - 1991 PMI
  10. 9 * P.O. Box 8402
  11. 10 * Green Bay Wi 53308
  12. 11 * All Rights Reserved
  13. 12 * August 6, 1987 - modifications to use Logitech 3.0
  14. 13 *)
  15. 14
  16. 15 (* This Module exports a type called DBFile which contains
  17. 16 pertinent information concerning the structure of the dBase
  18. 17 file. All operations on a dBase data file must specify this
  19. 18 parameter usually as an "alias" using the first 2 or 3 letters
  20. 19 of the dBase Filename. Date of Last Modification: April 16,
  21. 20 1987. Repertoire Input Output routines used.
  22. 21 *)
  23. 22
  24. 23 (* 5/11/88 added safety to modbase; if TRUE file integrity should
  25. 24 be preserved as long as the power doesn't fail during a write.
  26. 25 also added changes concerning memos to be finished later*)
  27. 26
  28. 27 (* 6/88 Changed to add transparent handling of memo files *)
  29. 28
  30. 29 (* 10/20/88 changes to add following:
  31. 30 Automatic updating of dbindexes
  32. 31 Made fieldlist a Pointer and only allocate as needed
  33. 32 saving quite a bit of memory
  34. 33 Added appending flag to speed append operations *)
  35. 34 (* Logitech modules*)
  36. 35
  37. 36
  38. 37 FROM M2Strings IMPORT
  39. 38 Assign,Pos;
  40. 39
  41. 40 FROM StrEdit IMPORT
  42. 41 Append;
  43. 42
  44. 43
  45. 44 FROM SYSTEM IMPORT
  46. 45 BYTE,ADDRESS, ADR, TSIZE;
  47. 46
  48. 47 (* Repertoire modules *)
  49. 48
  50. 49 IMPORT
  51. 50 EnvironUtils;
  52. 51 FROM StringIO IMPORT
  53. 52 ErrorMessage, NoError, PrintMessage;
  54. 53
  55. 54 FROM HandleIO IMPORT
  56. 55 BlockRead, BlockWrite, CloseHandle, OpenFile, SetFilePtr,
  57. 56 CreateFile,UpdateDisk, FileOffSet,GetFilePtr;
  58. 57
  59. 58 FROM LowLevel IMPORT
  60. 59 Address8086, Fill, Move, AddAddr;
  61. 60
  62. 61 FROM MiscFunctions IMPORT FieldNameChar,Alph;
  63. 62
  64. 63 FROM Numbers IMPORT
  65. 64 Min;
  66. 65
  67. 66 FROM ErrorManager IMPORT
  68. 67 WARN;
  69. 68
  70. 69 FROM VStorage IMPORT
  71. 70 DosAlloc, DosDealloc;
  72. 71
  73. 72 IMPORT Locks,FAPI;
  74. 73 IMPORT PosUtils;
  75. 74
  76. 75 PROCEDURE DEALLOCATE(VAR loc:ADDRESS;size:CARDINAL);
  77. 76 BEGIN
  78. 77 DosDealloc(loc,size);
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. 78 END DEALLOCATE;
  83. ***** ^ not supported yet
  84. 79
  85. 80 PROCEDURE ALLOCATE(VAR loc:ADDRESS;size:CARDINAL);
  86. 81 BEGIN
  87. 82 DosAlloc(loc,size);
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. 83 END ALLOCATE;
  92. ***** ^ not supported yet
  93. 84
  94. 85
  95. 86 CONST
  96. 87 Blank = " ";
  97. 88 Null = 0C;
  98. 89 EndOfHeader = 0DH;
  99. 90 HdrLenPos = 8;
  100. 91 DatePosition = 1; (* position of the first byte of the last update *)
  101. 92 RecNumLoPos = 4;
  102. 93 RecNumHiPos = 6;
  103. 94 FieldNameLength = 10;
  104. 95 InitCode =61353;
  105. 96 one=VAL( LONGINT, 1 );
  106. ***** ^ undeclared identifier
  107. ***** ^ not supported yet
  108. 97
  109. 98 (* ************************* EXPORTED PROCEDURES **************************)
  110. 99 TYPE
  111. 100
  112. 101 DBFileRec =
  113. 102 RECORD
  114. 103 fileID,
  115. 104 MemoHandle: CARDINAL;
  116. 105 open,
  117. 106 MemoOpen,
  118. 107 (* will open only if accessed *)
  119. 108 Safety: BOOLEAN;
  120. 109 (* if true keeps disk up to date *)
  121. 110 autolock,
  122. 111 exclusive,
  123. 112 appending,
  124. 113 hasmemo: BOOLEAN;
  125. 114 recordmode:RecordModeType;
  126. ***** ^ undeclared identifier
  127. 115 fixup:FixUpProcedure;
  128. ***** ^ undeclared identifier
  129. 116 ErrorCode,
  130. 117 Init,
  131. 118 numberoffields: CARDINAL;
  132. 119 lastupdate: ARRAY[0..2] OF CARDINAL;
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. 120 length: CARDINAL; (* of records in BYTES *)
  136. 121 fieldlist: DBFieldPtr;
  137. ***** ^ undeclared identifier
  138. 122 numofrecords: LONGINT;
  139. 123 currentrecnum: LONGINT;
  140. 124 headerlength: CARDINAL;
  141. 125 ReReadPtr,SavePtr,currentrec,BufferPtr: POINTER TO ARRAY
  142. 126 [1..MaxRecLength] OF CHAR;
  143. ***** ^ undeclared identifier
  144. ***** ^ not supported yet
  145. 127 name,
  146. 128 MemoName: ARRAY [0..NameLen] OF CHAR;
  147. ***** ^ undeclared identifier
  148. ***** ^ not supported yet
  149. 129 dbbuffer : ADDRESS;
  150. 130 buffersize, (* requested size *)
  151. 131 size : CARDINAL; (* size of buffer in bytes *)
  152. 132 start : LONGINT; (* first record number *)
  153. 133 MaxRecords, NumRecords : CARDINAL;
  154. 134 IndexList:ADDRESS;
  155. 135 END;
  156. ***** ^ not supported yet
  157. 136 DBFile=POINTER TO DBFileRec;
  158. ***** ^ not supported yet
  159. 137
  160. 138 PROCEDURE DBError( alias:DBFile):CARDINAL;
  161. 139 BEGIN
  162. 140 RETURN alias^.ErrorCode;
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. 141 END DBError;
  166. ***** ^ not supported yet
  167. 142
  168. 143 PROCEDURE FileName(alias:DBFile;VAR Name:ARRAY OF CHAR);
  169. ***** ^ not supported yet
  170. 144 BEGIN
  171. 145 Assign(alias^.name,Name);
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 146 END FileName;
  177. ***** ^ not supported yet
  178. 147
  179. 148 PROCEDURE SafetySet(alias:DBFile):BOOLEAN;
  180. 149 BEGIN
  181. 150 RETURN alias^.Safety;
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. 151 END SafetySet;
  185. ***** ^ not supported yet
  186. 152
  187. 153 PROCEDURE RecordLength(alias:DBFile):CARDINAL;
  188. 154 BEGIN
  189. 155 RETURN alias^.length;
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 156 END RecordLength;
  193. ***** ^ not supported yet
  194. 157
  195. 158 PROCEDURE HasMemo(alias:DBFile):BOOLEAN;
  196. 159 BEGIN
  197. 160 RETURN alias^.hasmemo;
  198. ***** ^ not supported yet
  199. ***** ^ not supported yet
  200. 161 END HasMemo;
  201. ***** ^ not supported yet
  202. 162
  203. 163 PROCEDURE NumberOfFields(alias:DBFile):CARDINAL;
  204. 164 BEGIN
  205. 165 RETURN alias^.numberoffields;
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. 166 END NumberOfFields;
  209. ***** ^ not supported yet
  210. 167
  211. 168 PROCEDURE Appending(alias:DBFile):BOOLEAN;
  212. 169 BEGIN
  213. 170 RETURN alias^.appending;
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 171 END Appending;
  217. ***** ^ not supported yet
  218. 172
  219. 173 PROCEDURE RecordPtr(alias:DBFile):ADDRESS;
  220. 174 BEGIN
  221. 175 RETURN alias^.currentrec;
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. 176 END RecordPtr;
  225. ***** ^ not supported yet
  226. 177
  227. 178 PROCEDURE IndexList(alias:DBFile):ADDRESS;
  228. 179 BEGIN
  229. 180 RETURN alias^.IndexList;
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. 181 END IndexList;
  233. ***** ^ not supported yet
  234. 182
  235. 183 PROCEDURE SetIndexList(alias:DBFile;ndx:ADDRESS);
  236. 184 BEGIN
  237. 185 alias^.IndexList:=ndx;
  238. ***** ^ not supported yet
  239. ***** ^ not supported yet
  240. ***** ^ not supported yet
  241. 186 END SetIndexList;
  242. ***** ^ not supported yet
  243. 187
  244. 188 PROCEDURE Record(alias:DBFile):LONGINT;
  245. 189 BEGIN
  246. 190 RETURN alias^.currentrecnum;
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. 191 END Record;
  250. ***** ^ not supported yet
  251. 192
  252. 193 PROCEDURE FieldList(alias:DBFile):DBFieldPtr;
  253. ***** ^ undeclared identifier
  254. 194 BEGIN
  255. 195 RETURN alias^.fieldlist;
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. 196 END FieldList;
  259. ***** ^ not supported yet
  260. 197
  261. 198 PROCEDURE BufferSize(alias:DBFile):CARDINAL;
  262. 199 BEGIN
  263. 200 RETURN alias^.buffersize;
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. 201 END BufferSize;
  267. ***** ^ not supported yet
  268. 202
  269. 203 PROCEDURE NumberRecords(alias:DBFile):LONGINT;
  270. 204 BEGIN
  271. 205 IF NOT alias^.exclusive THEN
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 206 SetFilePtr( alias^.fileID, FromStart, VAL(LONGINT,4 ));
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. ***** ^ not supported yet
  278. ***** ^ undeclared identifier
  279. ***** ^ undeclared identifier
  280. ***** ^ not supported yet
  281. 207 PrintMessage(Locks.ReadRetry( alias^.fileID, ADR(alias^.numofrecords),
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. 208 4,10,alias^.name ));
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. 209 END;
  294. 210 RETURN alias^.numofrecords;
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. 211 END NumberRecords;
  298. ***** ^ not supported yet
  299. 212
  300. 213 PROCEDURE InitDBF(filename: ARRAY OF CHAR; VAR alias:
  301. ***** ^ not supported yet
  302. 214 DBFile; BufferSize:CARDINAL; safety,Exclusive,AutoLock:BOOLEAN;
  303. 215 FixUp:FixUpProcedure );
  304. ***** ^ undeclared identifier
  305. 216
  306. 217
  307. 218 BEGIN
  308. 219 NEW(alias);
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. 220 IF Exclusive THEN
  312. 221 AutoLock:= FALSE
  313. 222 END;
  314. 223 WITH alias^ DO
  315. ***** ^ not supported yet
  316. 224 open:=FALSE;
  317. ***** ^ undeclared identifier
  318. 225 exclusive:=Exclusive OR Locks.ExclusiveOnly;
  319. ***** ^ undeclared identifier
  320. ***** ^ not supported yet
  321. ***** ^ not supported yet
  322. 226 autolock:=AutoLock;
  323. ***** ^ undeclared identifier
  324. 227 fixup:=FixUp;
  325. ***** ^ undeclared identifier
  326. ***** ^ not supported yet
  327. 228 MemoOpen:=FALSE;
  328. ***** ^ undeclared identifier
  329. 229 Safety:=safety;
  330. ***** ^ undeclared identifier
  331. 230 Init:=InitCode;
  332. ***** ^ undeclared identifier
  333. 231 Assign(filename,name);
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ undeclared identifier
  337. 232 fieldlist:=NIL;
  338. ***** ^ undeclared identifier
  339. 233 currentrec:=NIL;
  340. ***** ^ undeclared identifier
  341. 234 BufferPtr:=NIL;
  342. ***** ^ undeclared identifier
  343. 235 SavePtr:=NIL;
  344. ***** ^ undeclared identifier
  345. 236 ReReadPtr:=NIL;
  346. ***** ^ undeclared identifier
  347. 237 dbbuffer:=NIL;
  348. ***** ^ undeclared identifier
  349. 238 IndexList:=NIL;
  350. ***** ^ not supported yet
  351. 239 size:=0;
  352. ***** ^ undeclared identifier
  353. 240 buffersize:=BufferSize;
  354. ***** ^ undeclared identifier
  355. 241 recordmode:=CurrentRec;
  356. ***** ^ undeclared identifier
  357. ***** ^ undeclared identifier
  358. 242 END;
  359. ***** ^ not supported yet
  360. 243
  361. 244 END InitDBF;
  362. ***** ^ not supported yet
  363. 245
  364. 246 PROCEDURE NilDBF(VAR alias:DBFile);
  365. 247 BEGIN
  366. 248 alias:=NIL;
  367. ***** ^ not supported yet
  368. 249 END NilDBF;
  369. ***** ^ not supported yet
  370. 250
  371. 251 PROCEDURE Initialized(alias:DBFile):BOOLEAN;
  372. 252 BEGIN
  373. 253 IF alias=NIL THEN RETURN FALSE END;
  374. ***** ^ not supported yet
  375. 254 IF alias^.Init=InitCode THEN
  376. ***** ^ not supported yet
  377. ***** ^ not supported yet
  378. 255 RETURN TRUE
  379. 256 END;
  380. 257 RETURN FALSE;
  381. 258 END Initialized;
  382. ***** ^ not supported yet
  383. 259
  384. 260 PROCEDURE DisposeDBF(VAR alias:DBFile);
  385. 261 BEGIN
  386. 262 IF alias=NIL THEN RETURN END;
  387. ***** ^ not supported yet
  388. 263 IF alias^.open THEN CloseDBF(alias) END;
  389. ***** ^ not supported yet
  390. ***** ^ not supported yet
  391. ***** ^ undeclared identifier
  392. ***** ^ not supported yet
  393. 264 DISPOSE(alias);
  394. ***** ^ undeclared identifier
  395. ***** ^ not supported yet
  396. 265 END DisposeDBF;
  397. ***** ^ not supported yet
  398. 266
  399. 267 PROCEDURE OpenMemo(alias:DBFile):BOOLEAN;
  400. 268 BEGIN
  401. 269 IF alias^.MemoOpen THEN RETURN TRUE END;
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. 270 alias^.MemoOpen:=OpenFile(alias^.MemoHandle,alias^.MemoName)=0;
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. ***** ^ not supported yet
  409. ***** ^ not supported yet
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. 271 RETURN alias^.MemoOpen;
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. 272 END OpenMemo;
  416. ***** ^ not supported yet
  417. 273
  418. 274 PROCEDURE MemoHandle(alias:DBFile):CARDINAL;
  419. 275 BEGIN
  420. 276 RETURN alias^.MemoHandle;
  421. ***** ^ not supported yet
  422. ***** ^ not supported yet
  423. 277 END MemoHandle;
  424. ***** ^ not supported yet
  425. 278
  426. 279 PROCEDURE SetDBSafetyOn( alias: DBFile);
  427. 280 BEGIN
  428. 281 UpdateDBFile(alias);
  429. ***** ^ undeclared identifier
  430. ***** ^ not supported yet
  431. 282 alias^.Safety:=TRUE;
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. 283 END SetDBSafetyOn;
  435. ***** ^ not supported yet
  436. 284
  437. 285 PROCEDURE SetDBSafetyOff( alias: DBFile);
  438. 286 BEGIN
  439. 287 alias^.Safety:=FALSE;
  440. ***** ^ not supported yet
  441. ***** ^ not supported yet
  442. 288 END SetDBSafetyOff;
  443. ***** ^ not supported yet
  444. 289
  445. 290 PROCEDURE SetRecordMode(alias: DBFile;Mode:RecordModeType);
  446. ***** ^ undeclared identifier
  447. 291 BEGIN
  448. 292 IF alias^.recordmode=Mode THEN RETURN END;
  449. ***** ^ not supported yet
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. 293 IF alias^.recordmode=CurrentRec
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ undeclared identifier
  456. 294 THEN
  457. 295 alias^.SavePtr:=alias^.currentrec;
  458. ***** ^ not supported yet
  459. ***** ^ not supported yet
  460. ***** ^ not supported yet
  461. ***** ^ not supported yet
  462. 296 END;
  463. 297 CASE Mode OF
  464. ***** ^ not supported yet
  465. 298 CurrentRec: alias^.currentrec:=alias^.SavePtr;
  466. ***** ^ undeclared identifier
  467. ***** ^ not supported yet
  468. ***** ^ not supported yet
  469. ***** ^ not supported yet
  470. ***** ^ not supported yet
  471. 299 |Buffer: alias^.currentrec:=alias^.BufferPtr;
  472. ***** ^ undeclared identifier
  473. ***** ^ not supported yet
  474. ***** ^ not supported yet
  475. ***** ^ not supported yet
  476. ***** ^ not supported yet
  477. 300 |ReRead: alias^.currentrec:=alias^.ReReadPtr
  478. ***** ^ undeclared identifier
  479. ***** ^ not supported yet
  480. ***** ^ not supported yet
  481. ***** ^ not supported yet
  482. ***** ^ not supported yet
  483. 301 END;
  484. 302 alias^.recordmode:=Mode;
  485. ***** ^ not supported yet
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. 303 END SetRecordMode;
  489. ***** ^ not supported yet
  490. 304
  491. 305
  492. 306 PROCEDURE OpenDBF
  493. 307 (alias : DBFile ):BOOLEAN;
  494. 308
  495. 309
  496. 310 VAR
  497. 311 firstbyte : CHAR;
  498. 312 i :CARDINAL;
  499. 313 ActionTaken:CARDINAL;
  500. 314 filemode:BITSET;
  501. ***** ^ undeclared identifier
  502. 315
  503. 316
  504. 317
  505. 318 PROCEDURE MakeDBFile;
  506. 319
  507. 320 VAR
  508. 321 dbh : ARRAY[ 0 .. MaxHeaderLen - 1 ] OF CHAR;
  509. ***** ^ undeclared identifier
  510. ***** ^ not supported yet
  511. ***** ^ not supported yet
  512. 322
  513. 323
  514. 324 PROCEDURE ReadDBHeader;
  515. 325 (* HeaderLength must always be 32n+2 where n is a number equal to one
  516. 326 more than the number of fields in the record *)
  517. 327
  518. 328 BEGIN
  519. 329 SetFilePtr( alias^.fileID, FromStart, VAL( LONGINT, HdrLenPos ) );
  520. ***** ^ not supported yet
  521. ***** ^ not supported yet
  522. ***** ^ not supported yet
  523. ***** ^ undeclared identifier
  524. ***** ^ undeclared identifier
  525. ***** ^ not supported yet
  526. 330 PrintMessage( Locks.ReadRetry( alias^.fileID, ADR( alias^.headerlength ), 2 ,
  527. ***** ^ not supported yet
  528. ***** ^ not supported yet
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. ***** ^ not supported yet
  532. ***** ^ not supported yet
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. 331 10,alias^.name));
  536. ***** ^ not supported yet
  537. ***** ^ not supported yet
  538. 332 SetFilePtr( alias^.fileID, FromStart, VAL( LONGINT, 0 ) );
  539. ***** ^ not supported yet
  540. ***** ^ not supported yet
  541. ***** ^ not supported yet
  542. ***** ^ undeclared identifier
  543. ***** ^ undeclared identifier
  544. ***** ^ not supported yet
  545. 333 PrintMessage(Locks.ReadRetry( alias^.fileID, ADR( dbh ), alias^.headerlength,
  546. ***** ^ not supported yet
  547. ***** ^ not supported yet
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. ***** ^ not supported yet
  551. ***** ^ not supported yet
  552. ***** ^ not supported yet
  553. ***** ^ not supported yet
  554. ***** ^ not supported yet
  555. 334 10,alias^.name ));
  556. ***** ^ not supported yet
  557. ***** ^ not supported yet
  558. 335 END ReadDBHeader;
  559. ***** ^ not supported yet
  560. 336
  561. 337
  562. 338 PROCEDURE GetLastUpdate;
  563. 339
  564. 340 VAR
  565. 341 i : CARDINAL;
  566. 342
  567. 343 BEGIN
  568. 344 FOR i := 0 TO 2 DO
  569. 345 alias^.lastupdate[i] := ORD( dbh[1 + i] );
  570. ***** ^ not supported yet
  571. ***** ^ not supported yet
  572. ***** ^ not supported yet
  573. ***** ^ undeclared identifier
  574. ***** ^ not supported yet
  575. ***** ^ not supported yet
  576. 346 END; (* for *)
  577. 347 END GetLastUpdate;
  578. ***** ^ not supported yet
  579. 348
  580. 349
  581. 350 PROCEDURE GetNumberOfRecords;
  582. 351
  583. 352 BEGIN
  584. 353 Move( ADR( dbh[4] ), ADR( alias^.numofrecords ), 4 )
  585. ***** ^ not supported yet
  586. ***** ^ not supported yet
  587. ***** ^ not supported yet
  588. ***** ^ not supported yet
  589. ***** ^ not supported yet
  590. ***** ^ not supported yet
  591. ***** ^ not supported yet
  592. ***** ^ not supported yet
  593. 354 END GetNumberOfRecords;
  594. ***** ^ not supported yet
  595. 355
  596. 356
  597. 357 PROCEDURE GetHeaderLength;
  598. 358
  599. 359 BEGIN
  600. 360 alias^.headerlength := ( ORD( dbh[9] ) * 100H ) + ORD( dbh[8] );
  601. ***** ^ not supported yet
  602. ***** ^ not supported yet
  603. ***** ^ undeclared identifier
  604. ***** ^ not supported yet
  605. ***** ^ not supported yet
  606. ***** ^ undeclared identifier
  607. ***** ^ not supported yet
  608. ***** ^ not supported yet
  609. 361 END GetHeaderLength;
  610. ***** ^ not supported yet
  611. 362
  612. 363
  613. 364 PROCEDURE GetRecordLength;
  614. 365
  615. 366 BEGIN
  616. 367 alias^.length := ( ORD( dbh[11] ) * 100H ) + ORD( dbh[10] );
  617. ***** ^ not supported yet
  618. ***** ^ not supported yet
  619. ***** ^ undeclared identifier
  620. ***** ^ not supported yet
  621. ***** ^ not supported yet
  622. ***** ^ undeclared identifier
  623. ***** ^ not supported yet
  624. ***** ^ not supported yet
  625. 368 END GetRecordLength;
  626. ***** ^ not supported yet
  627. 369
  628. 370
  629. 371 PROCEDURE GetFieldList;
  630. 372
  631. 373 VAR
  632. 374 j,
  633. 375 k,
  634. 376 fieldindex : CARDINAL;
  635. 377 finished : BOOLEAN;
  636. 378
  637. 379
  638. 380 PROCEDURE InitFieldList;
  639. 381
  640. 382 BEGIN
  641. 383 FOR j := 1 TO alias^.numberoffields DO
  642. ***** ^ not supported yet
  643. ***** ^ not supported yet
  644. 384 Fill( ADR( alias^.fieldlist^[j].name ), FieldNameLength, 0C );
  645. ***** ^ not supported yet
  646. ***** ^ not supported yet
  647. ***** ^ not supported yet
  648. ***** ^ not supported yet
  649. ***** ^ not supported yet
  650. ***** ^ not supported yet
  651. ***** ^ not supported yet
  652. 385 alias^.fieldlist^[j].fldtype := " ";
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. ***** ^ not supported yet
  656. ***** ^ not supported yet
  657. 386 alias^.fieldlist^[j].size := 0;
  658. ***** ^ not supported yet
  659. ***** ^ not supported yet
  660. ***** ^ not supported yet
  661. ***** ^ not supported yet
  662. 387 alias^.fieldlist^[j].decplaces := 0;
  663. ***** ^ not supported yet
  664. ***** ^ not supported yet
  665. ***** ^ not supported yet
  666. ***** ^ not supported yet
  667. 388 alias^.fieldlist^[j].offset := 0;
  668. ***** ^ not supported yet
  669. ***** ^ not supported yet
  670. ***** ^ not supported yet
  671. ***** ^ not supported yet
  672. 389 (* index position in CurrentRecord *)
  673. 390 END; (* FOR *)
  674. 391 END InitFieldList;
  675. ***** ^ not supported yet
  676. 392
  677. 393 BEGIN
  678. 394 alias^.numberoffields:= (alias^.headerlength DIV 32)-1;
  679. ***** ^ not supported yet
  680. ***** ^ not supported yet
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. 395 ALLOCATE(alias^.fieldlist,
  684. ***** ^ not supported yet
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 396 (TSIZE(DBFieldArray)DIV MaxField)*(alias^.numberoffields));
  688. ***** ^ not supported yet
  689. ***** ^ undeclared identifier
  690. ***** ^ undeclared identifier
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. ***** ^ not supported yet
  694. 397 InitFieldList;
  695. ***** ^ not supported yet
  696. 398 alias^.fieldlist^[1].offset := 2;
  697. ***** ^ not supported yet
  698. ***** ^ not supported yet
  699. ***** ^ not supported yet
  700. ***** ^ not supported yet
  701. 399 finished := FALSE;
  702. 400 FOR j:=1 TO alias^.numberoffields DO
  703. ***** ^ not supported yet
  704. ***** ^ not supported yet
  705. 401 fieldindex := ( j - 1 ) * 32;
  706. 402 k := 0;
  707. 403 Move( ADR( dbh[32 + fieldindex] ), ADR( alias^.fieldlist^[j].name ),
  708. ***** ^ not supported yet
  709. ***** ^ not supported yet
  710. ***** ^ not supported yet
  711. ***** ^ not supported yet
  712. ***** ^ not supported yet
  713. ***** ^ not supported yet
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. 404 FieldNameLength );
  718. ***** ^ not supported yet
  719. 405 alias^.fieldlist^[j].fldtype := dbh[43 + fieldindex];
  720. ***** ^ not supported yet
  721. ***** ^ not supported yet
  722. ***** ^ not supported yet
  723. ***** ^ not supported yet
  724. ***** ^ not supported yet
  725. ***** ^ not supported yet
  726. 406 alias^.fieldlist^[j].size := ORD( dbh[48 + fieldindex] );
  727. ***** ^ not supported yet
  728. ***** ^ not supported yet
  729. ***** ^ not supported yet
  730. ***** ^ not supported yet
  731. ***** ^ undeclared identifier
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. 407 (* Get fieldsize *)
  735. 408 alias^.fieldlist^[j].decplaces := ORD( dbh[49 + fieldindex] );
  736. ***** ^ not supported yet
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. ***** ^ undeclared identifier
  741. ***** ^ not supported yet
  742. ***** ^ not supported yet
  743. 409 (* Get number of decimal places *)
  744. 410 IF j > 1
  745. 411 THEN
  746. 412 alias^.fieldlist^[j].offset := alias^.fieldlist^[j - 1].offset +
  747. ***** ^ not supported yet
  748. ***** ^ not supported yet
  749. ***** ^ not supported yet
  750. ***** ^ not supported yet
  751. ***** ^ not supported yet
  752. ***** ^ not supported yet
  753. ***** ^ not supported yet
  754. ***** ^ not supported yet
  755. 413 alias^.fieldlist^[j - 1].size;
  756. ***** ^ not supported yet
  757. ***** ^ not supported yet
  758. ***** ^ not supported yet
  759. ***** ^ not supported yet
  760. 414 END; (* IF *)
  761. 415 END; (* for *)
  762. 416 END GetFieldList;
  763. ***** ^ not supported yet
  764. 417
  765. 418 BEGIN (* MakeDBFile *)
  766. 419 ReadDBHeader;
  767. ***** ^ not supported yet
  768. 420 (* Fill out the Record *)
  769. 421 GetNumberOfRecords;
  770. ***** ^ not supported yet
  771. 422 GetLastUpdate;
  772. ***** ^ not supported yet
  773. 423 GetRecordLength;
  774. ***** ^ not supported yet
  775. 424 GetHeaderLength;
  776. ***** ^ not supported yet
  777. 425 GetFieldList;
  778. ***** ^ not supported yet
  779. 426 END MakeDBFile;
  780. ***** ^ not supported yet
  781. 427
  782. 428 (* Procedure Description -- OpendBF -- Looks up a file with the parameter
  783. 429 given as a name -- Checks to see if it is a dBaseIII type file --
  784. 430 Creates a record of the type DBFile containing the pertinent information
  785. 431 from the header of the dBase File -- If the file is already opened it
  786. 432 does nothing *)
  787. 433
  788. 434 BEGIN (* OpenDBF *)
  789. 435 IF alias^.Init=InitCode
  790. ***** ^ not supported yet
  791. ***** ^ not supported yet
  792. 436 THEN
  793. 437 IF alias^.open
  794. ***** ^ not supported yet
  795. ***** ^ not supported yet
  796. 438 THEN
  797. 439 RETURN TRUE;
  798. 440 END;
  799. 441 ELSE
  800. 442 WARN('UnInititalized DBFile In OpenDBF');
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. 443 END;
  804. 444 IF alias^.exclusive THEN
  805. ***** ^ not supported yet
  806. ***** ^ not supported yet
  807. 445 filemode:={1,4}
  808. ***** ^ not supported yet
  809. ***** ^ not supported yet
  810. ***** ^ not supported yet
  811. 446 ELSE
  812. 447 filemode:={1,6} (* allow all *)
  813. ***** ^ not supported yet
  814. ***** ^ not supported yet
  815. ***** ^ not supported yet
  816. 448 END;
  817. 449 alias^.ErrorCode := FAPI.DOSOPEN( ADR(alias^.name),
  818. ***** ^ not supported yet
  819. ***** ^ not supported yet
  820. ***** ^ not supported yet
  821. ***** ^ not supported yet
  822. ***** ^ not supported yet
  823. ***** ^ not supported yet
  824. ***** ^ not supported yet
  825. 450 ADR(alias^.fileID), ADR(ActionTaken), VAL(LONGINT,0), FAPI.FILE_NORMAL,
  826. ***** ^ not supported yet
  827. ***** ^ not supported yet
  828. ***** ^ not supported yet
  829. ***** ^ not supported yet
  830. ***** ^ not supported yet
  831. ***** ^ undeclared identifier
  832. ***** ^ not supported yet
  833. ***** ^ not supported yet
  834. ***** ^ not supported yet
  835. 451 CARDINAL({0}), CARDINAL(filemode), VAL(LONGINT,0) );
  836. ***** ^ not supported yet
  837. ***** ^ not supported yet
  838. ***** ^ undeclared identifier
  839. ***** ^ not supported yet
  840. 452
  841. 453 IF alias^.ErrorCode # NoError
  842. ***** ^ not supported yet
  843. ***** ^ not supported yet
  844. ***** ^ not supported yet
  845. 454 THEN
  846. 455 RETURN FALSE;
  847. 456 END;
  848. 457 IF (NOT alias^.exclusive) AND Locks.NoLocking(alias^.fileID) THEN
  849. ***** ^ not supported yet
  850. ***** ^ not supported yet
  851. ***** ^ not supported yet
  852. ***** ^ not supported yet
  853. ***** ^ not supported yet
  854. ***** ^ not supported yet
  855. 458 alias^.exclusive:=TRUE
  856. ***** ^ not supported yet
  857. ***** ^ not supported yet
  858. 459 END;
  859. 460
  860. 461 (* make sure the file is a dBase file *)
  861. 462 IF NoError # Locks.ReadRetry( alias^.fileID, ADR( firstbyte ), 1,10,alias^.name )
  862. ***** ^ not supported yet
  863. ***** ^ not supported yet
  864. ***** ^ not supported yet
  865. ***** ^ not supported yet
  866. ***** ^ not supported yet
  867. ***** ^ not supported yet
  868. ***** ^ not supported yet
  869. ***** ^ not supported yet
  870. ***** ^ not supported yet
  871. 463 THEN
  872. 464 RETURN FALSE
  873. 465 END;
  874. 466 IF ( firstbyte = CHR( 03H ) )
  875. ***** ^ undeclared identifier
  876. ***** ^ not supported yet
  877. 467 THEN
  878. 468 alias^.hasmemo := FALSE;
  879. ***** ^ not supported yet
  880. ***** ^ not supported yet
  881. 469 alias^.open := TRUE;
  882. ***** ^ not supported yet
  883. ***** ^ not supported yet
  884. 470 ELSIF ( firstbyte = CHR( 83H ) )
  885. ***** ^ undeclared identifier
  886. ***** ^ not supported yet
  887. 471 THEN
  888. 472 alias^.hasmemo := TRUE;
  889. ***** ^ not supported yet
  890. ***** ^ not supported yet
  891. 473 alias^.open := TRUE;
  892. ***** ^ not supported yet
  893. ***** ^ not supported yet
  894. 474 ELSE
  895. 475 alias^.ErrorCode := CloseHandle( alias^.fileID );
  896. ***** ^ not supported yet
  897. ***** ^ not supported yet
  898. ***** ^ not supported yet
  899. ***** ^ not supported yet
  900. ***** ^ not supported yet
  901. 476 alias^.open := FALSE;
  902. ***** ^ not supported yet
  903. ***** ^ not supported yet
  904. 477 RETURN FALSE;
  905. 478 (* WARN( "File is not a dBase III - type file -- proc-OpenDBF3" );*)
  906. 479 END; (* IF *)
  907. 480 (* construct a dBFileDesc *)
  908. 481 IF alias^.open
  909. ***** ^ not supported yet
  910. ***** ^ not supported yet
  911. 482 THEN
  912. 483 MakeDBFile;
  913. ***** ^ not supported yet
  914. 484 IF alias^.autolock THEN
  915. ***** ^ not supported yet
  916. ***** ^ not supported yet
  917. 485 ALLOCATE( alias^.ReReadPtr, alias^.length );
  918. ***** ^ not supported yet
  919. ***** ^ not supported yet
  920. ***** ^ not supported yet
  921. ***** ^ not supported yet
  922. ***** ^ not supported yet
  923. 486 END;
  924. 487 ALLOCATE( alias^.currentrec, alias^.length );
  925. ***** ^ not supported yet
  926. ***** ^ not supported yet
  927. ***** ^ not supported yet
  928. ***** ^ not supported yet
  929. ***** ^ not supported yet
  930. 488 IF alias^.numofrecords=VAL(LONGINT,0)
  931. ***** ^ not supported yet
  932. ***** ^ not supported yet
  933. ***** ^ undeclared identifier
  934. ***** ^ not supported yet
  935. 489 THEN
  936. 490 alias^.currentrecnum:=VAL(LONGINT,0);
  937. ***** ^ not supported yet
  938. ***** ^ not supported yet
  939. ***** ^ undeclared identifier
  940. ***** ^ not supported yet
  941. 491 ELSE
  942. 492 alias^.currentrecnum:=VAL(LONGINT,1);
  943. ***** ^ not supported yet
  944. ***** ^ not supported yet
  945. ***** ^ undeclared identifier
  946. ***** ^ not supported yet
  947. 493 END;
  948. 494 alias^.NumRecords := 0 ;
  949. ***** ^ not supported yet
  950. ***** ^ not supported yet
  951. 495 alias^.start := VAL( LONGINT, 0 );
  952. ***** ^ not supported yet
  953. ***** ^ not supported yet
  954. ***** ^ undeclared identifier
  955. ***** ^ not supported yet
  956. 496 alias^.size := 0;
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. 497 SetDBBuffer(alias,alias^.buffersize);
  960. ***** ^ undeclared identifier
  961. ***** ^ not supported yet
  962. ***** ^ not supported yet
  963. ***** ^ not supported yet
  964. 498 IF alias^.hasmemo THEN
  965. ***** ^ not supported yet
  966. ***** ^ not supported yet
  967. 499 alias^.MemoOpen:=FALSE;
  968. ***** ^ not supported yet
  969. ***** ^ not supported yet
  970. 500 Assign(alias^.name,alias^.MemoName);
  971. ***** ^ not supported yet
  972. ***** ^ not supported yet
  973. ***** ^ not supported yet
  974. ***** ^ not supported yet
  975. ***** ^ not supported yet
  976. 501 i:=Pos( ".", alias^.MemoName);
  977. ***** ^ not supported yet
  978. ***** ^ not supported yet
  979. ***** ^ not supported yet
  980. 502 IF i<=HIGH(alias^.MemoName) THEN
  981. ***** ^ undeclared identifier
  982. ***** ^ not supported yet
  983. ***** ^ not supported yet
  984. 503 alias^.MemoName[i]:=0C;
  985. ***** ^ not supported yet
  986. ***** ^ not supported yet
  987. ***** ^ not supported yet
  988. 504 END;
  989. 505 Append(alias^.MemoName,'.DBT' );
  990. ***** ^ not supported yet
  991. ***** ^ not supported yet
  992. ***** ^ not supported yet
  993. ***** ^ not supported yet
  994. 506 END;
  995. 507 END; (* IF alias^.open *)
  996. 508 RETURN TRUE;
  997. 509 END OpenDBF;
  998. ***** ^ not supported yet
  999. 510
  1000. 511 PROCEDURE SetDBBuffer(alias:DBFile ;BufferSize:CARDINAL );
  1001. 512
  1002. 513 BEGIN
  1003. 514 alias^.buffersize:=BufferSize;
  1004. ***** ^ not supported yet
  1005. ***** ^ not supported yet
  1006. 515 IF alias^.open THEN
  1007. ***** ^ not supported yet
  1008. ***** ^ not supported yet
  1009. 516 IF alias^.size#0
  1010. ***** ^ not supported yet
  1011. ***** ^ not supported yet
  1012. 517 THEN
  1013. 518 DEALLOCATE(alias^.dbbuffer, alias^.size );
  1014. ***** ^ not supported yet
  1015. ***** ^ not supported yet
  1016. ***** ^ not supported yet
  1017. ***** ^ not supported yet
  1018. ***** ^ not supported yet
  1019. 519 END;
  1020. 520 (* calculate buffer size *)
  1021. 521 alias^.MaxRecords := BufferSize DIV alias^.length ;
  1022. ***** ^ not supported yet
  1023. ***** ^ not supported yet
  1024. ***** ^ not supported yet
  1025. ***** ^ not supported yet
  1026. 522 IF alias^.MaxRecords=0
  1027. ***** ^ not supported yet
  1028. ***** ^ not supported yet
  1029. 523 THEN
  1030. 524 alias^.MaxRecords:=1;
  1031. ***** ^ not supported yet
  1032. ***** ^ not supported yet
  1033. 525 END;
  1034. 526 alias^.size := alias^.MaxRecords *
  1035. ***** ^ not supported yet
  1036. ***** ^ not supported yet
  1037. ***** ^ not supported yet
  1038. ***** ^ not supported yet
  1039. 527 alias^.length;
  1040. ***** ^ not supported yet
  1041. ***** ^ not supported yet
  1042. 528
  1043. 529 ALLOCATE( alias^.dbbuffer, alias^.size );
  1044. ***** ^ not supported yet
  1045. ***** ^ not supported yet
  1046. ***** ^ not supported yet
  1047. ***** ^ not supported yet
  1048. ***** ^ not supported yet
  1049. 530 alias^.start:=VAL(LONGINT,0);
  1050. ***** ^ not supported yet
  1051. ***** ^ not supported yet
  1052. ***** ^ undeclared identifier
  1053. ***** ^ not supported yet
  1054. 531 alias^.NumRecords:=0;
  1055. ***** ^ not supported yet
  1056. ***** ^ not supported yet
  1057. 532 IF alias^.numofrecords > VAL( LONGINT, 0 )
  1058. ***** ^ not supported yet
  1059. ***** ^ not supported yet
  1060. ***** ^ undeclared identifier
  1061. ***** ^ not supported yet
  1062. 533 THEN
  1063. 534 ReadDBRec( alias, alias^.currentrecnum );
  1064. ***** ^ undeclared identifier
  1065. ***** ^ not supported yet
  1066. ***** ^ not supported yet
  1067. ***** ^ not supported yet
  1068. 535 (* read the currentrecord *)
  1069. 536 ELSE
  1070. 537 alias^.BufferPtr:=alias^.dbbuffer;
  1071. ***** ^ not supported yet
  1072. ***** ^ not supported yet
  1073. ***** ^ not supported yet
  1074. ***** ^ not supported yet
  1075. 538 Fill( alias^.currentrec, alias^.length, 0C );
  1076. ***** ^ not supported yet
  1077. ***** ^ not supported yet
  1078. ***** ^ not supported yet
  1079. ***** ^ not supported yet
  1080. ***** ^ not supported yet
  1081. ***** ^ not supported yet
  1082. 539 Fill( alias^.BufferPtr, alias^.length, 0C );
  1083. ***** ^ not supported yet
  1084. ***** ^ not supported yet
  1085. ***** ^ not supported yet
  1086. ***** ^ not supported yet
  1087. ***** ^ not supported yet
  1088. ***** ^ not supported yet
  1089. 540 END (* if alias^.numofrecords *);
  1090. 541 END;
  1091. 542 END SetDBBuffer;
  1092. ***** ^ not supported yet
  1093. 543
  1094. 544 PROCEDURE UpdateDBHeader( alias :DBFile );
  1095. 545 VAR
  1096. 546 month,
  1097. 547 day,
  1098. 548 year : CARDINAL;
  1099. 549 datestr : ARRAY[ 1 .. 3 ] OF CHAR;
  1100. ***** ^ not supported yet
  1101. ***** ^ not supported yet
  1102. 550 dumstr : ARRAY[ 0 .. 15 ] OF CHAR;
  1103. ***** ^ not supported yet
  1104. ***** ^ not supported yet
  1105. 551 lock:Locks.RangeRec;
  1106. ***** ^ not supported yet
  1107. 552
  1108. 553 BEGIN
  1109. 554 IF NOT alias^.open
  1110. ***** ^ not supported yet
  1111. ***** ^ not supported yet
  1112. 555 THEN
  1113. 556 RETURN;
  1114. 557 END (* if not alias^.open *);
  1115. 558 IF NOT alias^.exclusive THEN
  1116. ***** ^ not supported yet
  1117. ***** ^ not supported yet
  1118. 559 lock.FileOffset := VAL( LONGINT,0);
  1119. ***** ^ not supported yet
  1120. ***** ^ not supported yet
  1121. ***** ^ undeclared identifier
  1122. ***** ^ not supported yet
  1123. 560 lock.RangeLength:=VAL(LONGINT,32);
  1124. ***** ^ not supported yet
  1125. ***** ^ not supported yet
  1126. ***** ^ undeclared identifier
  1127. ***** ^ not supported yet
  1128. 561 alias^.ErrorCode:=Locks.LockRetry(alias^.fileID,lock,10,alias^.name);
  1129. ***** ^ not supported yet
  1130. ***** ^ not supported yet
  1131. ***** ^ not supported yet
  1132. ***** ^ not supported yet
  1133. ***** ^ not supported yet
  1134. ***** ^ not supported yet
  1135. ***** ^ not supported yet
  1136. ***** ^ not supported yet
  1137. ***** ^ not supported yet
  1138. 562 IF alias^.ErrorCode#0 THEN WARN('Unable to lock in UpdateDBHeader') END;
  1139. ***** ^ not supported yet
  1140. ***** ^ not supported yet
  1141. ***** ^ not supported yet
  1142. ***** ^ not supported yet
  1143. 563 END;
  1144. 564 EnvironUtils.GetDate( month, day, year, dumstr, dumstr );
  1145. ***** ^ not supported yet
  1146. ***** ^ not supported yet
  1147. ***** ^ not supported yet
  1148. ***** ^ not supported yet
  1149. 565 alias^.numofrecords := NumberRecords(alias);
  1150. ***** ^ not supported yet
  1151. ***** ^ not supported yet
  1152. ***** ^ not supported yet
  1153. ***** ^ not supported yet
  1154. 566 SetFilePtr( alias^.fileID, FromStart, VAL( LONGINT, DatePosition ) );
  1155. ***** ^ not supported yet
  1156. ***** ^ not supported yet
  1157. ***** ^ not supported yet
  1158. ***** ^ undeclared identifier
  1159. ***** ^ undeclared identifier
  1160. ***** ^ not supported yet
  1161. 567 datestr[1] := CHR( year MOD 100 );
  1162. ***** ^ not supported yet
  1163. ***** ^ not supported yet
  1164. ***** ^ undeclared identifier
  1165. ***** ^ not supported yet
  1166. 568 datestr[2] := CHR( month );
  1167. ***** ^ not supported yet
  1168. ***** ^ not supported yet
  1169. ***** ^ undeclared identifier
  1170. ***** ^ not supported yet
  1171. 569 datestr[3] := CHR( day );
  1172. ***** ^ not supported yet
  1173. ***** ^ not supported yet
  1174. ***** ^ undeclared identifier
  1175. ***** ^ not supported yet
  1176. 570 alias^.ErrorCode := BlockWrite( alias^.fileID, ADR( datestr ), 3 );
  1177. ***** ^ not supported yet
  1178. ***** ^ not supported yet
  1179. ***** ^ not supported yet
  1180. ***** ^ not supported yet
  1181. ***** ^ not supported yet
  1182. ***** ^ not supported yet
  1183. ***** ^ not supported yet
  1184. ***** ^ not supported yet
  1185. 571 alias^.ErrorCode := BlockWrite( alias^.fileID, ADR( alias^.numofrecords ), 4 );
  1186. ***** ^ not supported yet
  1187. ***** ^ not supported yet
  1188. ***** ^ not supported yet
  1189. ***** ^ not supported yet
  1190. ***** ^ not supported yet
  1191. ***** ^ not supported yet
  1192. ***** ^ not supported yet
  1193. ***** ^ not supported yet
  1194. ***** ^ not supported yet
  1195. 572 alias^.ErrorCode := BlockWrite( alias^.fileID, ADR( alias^.headerlength ), 2 );
  1196. ***** ^ not supported yet
  1197. ***** ^ not supported yet
  1198. ***** ^ not supported yet
  1199. ***** ^ not supported yet
  1200. ***** ^ not supported yet
  1201. ***** ^ not supported yet
  1202. ***** ^ not supported yet
  1203. ***** ^ not supported yet
  1204. ***** ^ not supported yet
  1205. 573 IF NOT alias^.exclusive THEN
  1206. ***** ^ not supported yet
  1207. ***** ^ not supported yet
  1208. 574 alias^.ErrorCode:=Locks.UnLock(alias^.fileID,lock);
  1209. ***** ^ not supported yet
  1210. ***** ^ not supported yet
  1211. ***** ^ not supported yet
  1212. ***** ^ not supported yet
  1213. ***** ^ not supported yet
  1214. ***** ^ not supported yet
  1215. ***** ^ not supported yet
  1216. 575 IF alias^.ErrorCode#0 THEN WARN('Unable to Unlock in UpdateDBHeader') END;
  1217. ***** ^ not supported yet
  1218. ***** ^ not supported yet
  1219. ***** ^ not supported yet
  1220. ***** ^ not supported yet
  1221. 576 END;
  1222. 577
  1223. 578 END UpdateDBHeader;
  1224. ***** ^ not supported yet
  1225. 579
  1226. 580 PROCEDURE UpdateDBFile(alias :DBFile);
  1227. 581
  1228. 582 BEGIN
  1229. 583 IF alias^.open
  1230. ***** ^ not supported yet
  1231. ***** ^ not supported yet
  1232. 584 THEN
  1233. 585 UpdateDBHeader(alias);
  1234. ***** ^ not supported yet
  1235. ***** ^ not supported yet
  1236. 586 UpdateDisk(alias^.fileID);
  1237. ***** ^ not supported yet
  1238. ***** ^ not supported yet
  1239. ***** ^ not supported yet
  1240. 587 IF alias^.MemoOpen
  1241. ***** ^ not supported yet
  1242. ***** ^ not supported yet
  1243. 588 THEN
  1244. 589 UpdateDisk(alias^.MemoHandle);
  1245. ***** ^ not supported yet
  1246. ***** ^ not supported yet
  1247. ***** ^ not supported yet
  1248. 590 END;
  1249. 591 END;
  1250. 592 END UpdateDBFile;
  1251. ***** ^ not supported yet
  1252. 593
  1253. 594 PROCEDURE CloseDBF
  1254. 595 ( alias : DBFile );
  1255. 596 (* updates the header and closes the file *)
  1256. 597
  1257. 598 BEGIN
  1258. 599 IF alias = NIL THEN
  1259. ***** ^ not supported yet
  1260. 600 RETURN
  1261. 601 END;
  1262. 602 IF NOT alias^.open
  1263. ***** ^ not supported yet
  1264. ***** ^ not supported yet
  1265. 603 THEN
  1266. 604 RETURN;
  1267. 605 END (* if not alias^.open *);
  1268. 606 UpdateDBHeader(alias);
  1269. ***** ^ not supported yet
  1270. ***** ^ not supported yet
  1271. 607 DEALLOCATE(alias^.fieldlist,
  1272. ***** ^ not supported yet
  1273. ***** ^ not supported yet
  1274. ***** ^ not supported yet
  1275. 608 (TSIZE(DBFieldArray)DIV MaxField)*(alias^.numberoffields));
  1276. ***** ^ not supported yet
  1277. ***** ^ undeclared identifier
  1278. ***** ^ undeclared identifier
  1279. ***** ^ not supported yet
  1280. ***** ^ not supported yet
  1281. ***** ^ not supported yet
  1282. 609 DEALLOCATE( alias^.dbbuffer, alias^.size );
  1283. ***** ^ not supported yet
  1284. ***** ^ not supported yet
  1285. ***** ^ not supported yet
  1286. ***** ^ not supported yet
  1287. ***** ^ not supported yet
  1288. 610 DEALLOCATE( alias^.currentrec, alias^.length );
  1289. ***** ^ not supported yet
  1290. ***** ^ not supported yet
  1291. ***** ^ not supported yet
  1292. ***** ^ not supported yet
  1293. ***** ^ not supported yet
  1294. 611 IF alias^.autolock THEN
  1295. ***** ^ not supported yet
  1296. ***** ^ not supported yet
  1297. 612 DEALLOCATE( alias^.ReReadPtr, alias^.length );
  1298. ***** ^ not supported yet
  1299. ***** ^ not supported yet
  1300. ***** ^ not supported yet
  1301. ***** ^ not supported yet
  1302. ***** ^ not supported yet
  1303. 613 END;
  1304. 614 alias^.ErrorCode := CloseHandle( alias^.fileID );
  1305. ***** ^ not supported yet
  1306. ***** ^ not supported yet
  1307. ***** ^ not supported yet
  1308. ***** ^ not supported yet
  1309. ***** ^ not supported yet
  1310. 615 IF alias^.MemoOpen
  1311. ***** ^ not supported yet
  1312. ***** ^ not supported yet
  1313. 616 THEN
  1314. 617 alias^.ErrorCode := CloseHandle( alias^.MemoHandle );
  1315. ***** ^ not supported yet
  1316. ***** ^ not supported yet
  1317. ***** ^ not supported yet
  1318. ***** ^ not supported yet
  1319. ***** ^ not supported yet
  1320. 618 alias^.MemoOpen := FALSE;
  1321. ***** ^ not supported yet
  1322. ***** ^ not supported yet
  1323. 619 END;
  1324. 620 alias^.open := FALSE;
  1325. ***** ^ not supported yet
  1326. ***** ^ not supported yet
  1327. 621 END CloseDBF;
  1328. ***** ^ not supported yet
  1329. 622
  1330. 623 (*$O- *)
  1331. 624
  1332. 625 PROCEDURE ReadDBRec
  1333. 626 (alias : DBFile;
  1334. 627 recnum : LONGINT );
  1335. 628 (* deposits the fetched string in the currentrec field of alias *)
  1336. 629 CONST
  1337. 630 one=VAL( LONGINT, 1 );
  1338. ***** ^ undeclared identifier
  1339. ***** ^ not supported yet
  1340. 631
  1341. 632 VAR
  1342. 633 recordpos : LONGINT;
  1343. 634 i,
  1344. 635 temp :CARDINAL;
  1345. 636 long1,long2 :LONGINT;
  1346. 637 test :BOOLEAN;
  1347. 638
  1348. 639 BEGIN
  1349. 640 IF NOT alias^.open
  1350. ***** ^ not supported yet
  1351. ***** ^ not supported yet
  1352. 641 THEN (* check to make sure the file is open *)
  1353. 642 WARN('DBF file not open in ReadDBFile');
  1354. ***** ^ not supported yet
  1355. ***** ^ not supported yet
  1356. 643 END;
  1357. 644 alias^.appending:=FALSE;
  1358. ***** ^ not supported yet
  1359. ***** ^ not supported yet
  1360. 645 (* compiler bug forced braking down *)
  1361. 646 long1:= recnum - alias^.start;
  1362. ***** ^ not supported yet
  1363. ***** ^ not supported yet
  1364. 647 long2:=VAL(LONGINT,alias^.NumRecords) - VAL(LONGINT,1);
  1365. ***** ^ undeclared identifier
  1366. ***** ^ not supported yet
  1367. ***** ^ not supported yet
  1368. ***** ^ undeclared identifier
  1369. ***** ^ not supported yet
  1370. 648 test:=(long1 >
  1371. 649 long2 );
  1372. 650 IF ( long1<VAL(LONGINT,0) ) OR test
  1373. ***** ^ undeclared identifier
  1374. ***** ^ not supported yet
  1375. 651 THEN (* is not in buffer *)
  1376. 652 IF ( recnum > alias^.numofrecords ) OR
  1377. ***** ^ not supported yet
  1378. ***** ^ not supported yet
  1379. 653 (recnum=VAL(LONGINT,0))
  1380. ***** ^ undeclared identifier
  1381. ***** ^ not supported yet
  1382. 654 THEN
  1383. 655 WARN( "Record number out of range in ReadDBRec" )
  1384. ***** ^ not supported yet
  1385. ***** ^ not supported yet
  1386. 656 END; (* IF *)
  1387. 657 IF VAL(LONGINT,alias^.MaxRecords) > alias^.numofrecords
  1388. ***** ^ undeclared identifier
  1389. ***** ^ not supported yet
  1390. ***** ^ not supported yet
  1391. ***** ^ not supported yet
  1392. ***** ^ not supported yet
  1393. 658 THEN (* underflow *)
  1394. 659 alias^.start := one;
  1395. ***** ^ not supported yet
  1396. ***** ^ not supported yet
  1397. 660 alias^.NumRecords := VAL(CARDINAL,alias^.numofrecords);
  1398. ***** ^ not supported yet
  1399. ***** ^ not supported yet
  1400. ***** ^ undeclared identifier
  1401. ***** ^ not supported yet
  1402. ***** ^ not supported yet
  1403. 661 ELSE
  1404. 662 alias^.NumRecords := alias^.MaxRecords;
  1405. ***** ^ not supported yet
  1406. ***** ^ not supported yet
  1407. ***** ^ not supported yet
  1408. ***** ^ not supported yet
  1409. 663 IF recnum < alias^.start
  1410. ***** ^ not supported yet
  1411. ***** ^ not supported yet
  1412. 664 THEN (* currec at top going down *)
  1413. 665 IF recnum > VAL(LONGINT,alias^.MaxRecords)
  1414. ***** ^ undeclared identifier
  1415. ***** ^ not supported yet
  1416. ***** ^ not supported yet
  1417. 666 THEN
  1418. 667 alias^.start := recnum - VAL(LONGINT,alias^.MaxRecords) + one;
  1419. ***** ^ not supported yet
  1420. ***** ^ not supported yet
  1421. ***** ^ undeclared identifier
  1422. ***** ^ not supported yet
  1423. ***** ^ not supported yet
  1424. 668 (* 2 to give 1 overlap ??*)
  1425. 669 ELSE
  1426. 670 alias^.start := one;
  1427. ***** ^ not supported yet
  1428. ***** ^ not supported yet
  1429. 671 END (* if recnum *);
  1430. 672 ELSE (* recnum at bottom going up*)
  1431. 673 IF ( recnum + VAL(LONGINT,alias^.MaxRecords) - one ) >
  1432. ***** ^ undeclared identifier
  1433. ***** ^ not supported yet
  1434. ***** ^ not supported yet
  1435. 674 alias^.numofrecords
  1436. ***** ^ not supported yet
  1437. ***** ^ not supported yet
  1438. 675 THEN
  1439. 676 alias^.start := alias^.numofrecords - VAL(LONGINT,alias^.MaxRecords)
  1440. ***** ^ not supported yet
  1441. ***** ^ not supported yet
  1442. ***** ^ not supported yet
  1443. ***** ^ not supported yet
  1444. ***** ^ undeclared identifier
  1445. ***** ^ not supported yet
  1446. ***** ^ not supported yet
  1447. 677 + one;
  1448. 678 ELSE
  1449. 679 alias^.start := recnum;
  1450. ***** ^ not supported yet
  1451. ***** ^ not supported yet
  1452. 680 END ;
  1453. 681 END ;
  1454. 682 END;
  1455. 683 recordpos := ( alias^.start - one ) *
  1456. ***** ^ not supported yet
  1457. ***** ^ not supported yet
  1458. 684 VAL( LONGINT,alias^.length ) + VAL( LONGINT, alias^.headerlength );
  1459. ***** ^ undeclared identifier
  1460. ***** ^ not supported yet
  1461. ***** ^ not supported yet
  1462. ***** ^ undeclared identifier
  1463. ***** ^ not supported yet
  1464. ***** ^ not supported yet
  1465. 685 SetFilePtr( alias^.fileID, FromStart, VAL( LONGINT, recordpos ) );
  1466. ***** ^ not supported yet
  1467. ***** ^ not supported yet
  1468. ***** ^ not supported yet
  1469. ***** ^ undeclared identifier
  1470. ***** ^ undeclared identifier
  1471. ***** ^ not supported yet
  1472. 686 PrintMessage( Locks.ReadRetry( alias^.fileID, alias^.dbbuffer ,
  1473. ***** ^ not supported yet
  1474. ***** ^ not supported yet
  1475. ***** ^ not supported yet
  1476. ***** ^ not supported yet
  1477. ***** ^ not supported yet
  1478. ***** ^ not supported yet
  1479. ***** ^ not supported yet
  1480. 687 alias^.length * alias^.NumRecords ,10,alias^.name ));
  1481. ***** ^ not supported yet
  1482. ***** ^ not supported yet
  1483. ***** ^ not supported yet
  1484. ***** ^ not supported yet
  1485. ***** ^ not supported yet
  1486. ***** ^ not supported yet
  1487. 688 END (* if *);
  1488. 689 recordpos:=recnum - alias^.start;
  1489. ***** ^ not supported yet
  1490. ***** ^ not supported yet
  1491. 690 i:=VAL( CARDINAL, recordpos );
  1492. ***** ^ undeclared identifier
  1493. ***** ^ not supported yet
  1494. 691 temp:=alias^.length * i;
  1495. ***** ^ not supported yet
  1496. ***** ^ not supported yet
  1497. 692 alias^.BufferPtr := AddAddr( alias^.dbbuffer, temp);
  1498. ***** ^ not supported yet
  1499. ***** ^ not supported yet
  1500. ***** ^ not supported yet
  1501. ***** ^ not supported yet
  1502. ***** ^ not supported yet
  1503. ***** ^ not supported yet
  1504. 693 (* Make copy of buffer *)
  1505. 694 Move(alias^.BufferPtr,alias^.currentrec,alias^.length);
  1506. ***** ^ not supported yet
  1507. ***** ^ not supported yet
  1508. ***** ^ not supported yet
  1509. ***** ^ not supported yet
  1510. ***** ^ not supported yet
  1511. ***** ^ not supported yet
  1512. ***** ^ not supported yet
  1513. 695
  1514. 696 alias^.currentrecnum := recnum;
  1515. ***** ^ not supported yet
  1516. ***** ^ not supported yet
  1517. 697 alias^.appending:=FALSE;
  1518. ***** ^ not supported yet
  1519. ***** ^ not supported yet
  1520. 698 END ReadDBRec;(*$O= *)
  1521. ***** ^ not supported yet
  1522. 699
  1523. 700 PROCEDURE CompareBlock( adr1,adr2:ADDRESS;size:CARDINAL):CARDINAL;
  1524. 701 VAR
  1525. 702 count:CARDINAL;
  1526. 703 p1,p2:Address8086;
  1527. 704 BEGIN
  1528. 705 count:=0;
  1529. 706 p1.a:=adr1;
  1530. ***** ^ not supported yet
  1531. ***** ^ not supported yet
  1532. ***** ^ not supported yet
  1533. 707 p2.a:=adr2;
  1534. ***** ^ not supported yet
  1535. ***** ^ not supported yet
  1536. ***** ^ not supported yet
  1537. 708 WHILE count<size
  1538. 709 DO
  1539. 710 IF p1.b^#p2.b^
  1540. ***** ^ not supported yet
  1541. ***** ^ not supported yet
  1542. ***** ^ not supported yet
  1543. ***** ^ not supported yet
  1544. 711 THEN
  1545. 712 RETURN count;
  1546. 713 END;
  1547. 714 INC(count);
  1548. ***** ^ undeclared identifier
  1549. ***** ^ not supported yet
  1550. 715 INC(p1.off);
  1551. ***** ^ undeclared identifier
  1552. ***** ^ not supported yet
  1553. ***** ^ not supported yet
  1554. 716 INC(p2.off);
  1555. ***** ^ undeclared identifier
  1556. ***** ^ not supported yet
  1557. ***** ^ not supported yet
  1558. 717 END (* while *);
  1559. 718 RETURN count;
  1560. 719 END CompareBlock;
  1561. ***** ^ not supported yet
  1562. 720
  1563. 721
  1564. 722 PROCEDURE WriteDBRec
  1565. 723 ( alias : DBFile );
  1566. 724
  1567. 725 VAR
  1568. 726 lock:Locks.RangeRec;
  1569. ***** ^ not supported yet
  1570. 727 recordpos : LONGINT;
  1571. 728 NeedToWrite:BOOLEAN;
  1572. 729 BEGIN
  1573. 730 IF NOT alias^.open
  1574. ***** ^ not supported yet
  1575. ***** ^ not supported yet
  1576. 731 THEN (* check to make sure the file is open *)
  1577. 732 WARN('DBFile not open in WriteDBRec');
  1578. ***** ^ not supported yet
  1579. ***** ^ not supported yet
  1580. 733 END;
  1581. 734 IF alias^.appending THEN (* if appending we have to prepare*)
  1582. ***** ^ not supported yet
  1583. ***** ^ not supported yet
  1584. 735 IF NOT alias^.exclusive THEN
  1585. ***** ^ not supported yet
  1586. ***** ^ not supported yet
  1587. 736 lock.FileOffset := VAL( LONGINT,0);
  1588. ***** ^ not supported yet
  1589. ***** ^ not supported yet
  1590. ***** ^ undeclared identifier
  1591. ***** ^ not supported yet
  1592. 737 lock.RangeLength:=VAL(LONGINT,32);
  1593. ***** ^ not supported yet
  1594. ***** ^ not supported yet
  1595. ***** ^ undeclared identifier
  1596. ***** ^ not supported yet
  1597. 738 alias^.ErrorCode:=Locks.LockRetry(alias^.fileID,lock,10,alias^.name);
  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. ***** ^ not supported yet
  1605. ***** ^ not supported yet
  1606. ***** ^ not supported yet
  1607. 739 IF alias^.ErrorCode#0 THEN WARN('Unable to lock in Header in WriteDBRec') END;
  1608. ***** ^ not supported yet
  1609. ***** ^ not supported yet
  1610. ***** ^ not supported yet
  1611. ***** ^ not supported yet
  1612. 740 SetFilePtr( alias^.fileID, FromStart, VAL(LONGINT,4 ));
  1613. ***** ^ not supported yet
  1614. ***** ^ not supported yet
  1615. ***** ^ not supported yet
  1616. ***** ^ undeclared identifier
  1617. ***** ^ undeclared identifier
  1618. ***** ^ not supported yet
  1619. 741 alias^.ErrorCode := BlockRead( alias^.fileID, ADR(alias^.numofrecords),
  1620. ***** ^ not supported yet
  1621. ***** ^ not supported yet
  1622. ***** ^ not supported yet
  1623. ***** ^ not supported yet
  1624. ***** ^ not supported yet
  1625. ***** ^ not supported yet
  1626. ***** ^ not supported yet
  1627. ***** ^ not supported yet
  1628. 742 4 );
  1629. ***** ^ not supported yet
  1630. 743 END;
  1631. 744 INC( alias^.numofrecords );
  1632. ***** ^ undeclared identifier
  1633. ***** ^ not supported yet
  1634. ***** ^ not supported yet
  1635. 745 alias^.currentrecnum := alias^.numofrecords;
  1636. ***** ^ not supported yet
  1637. ***** ^ not supported yet
  1638. ***** ^ not supported yet
  1639. ***** ^ not supported yet
  1640. 746 alias^.start:=alias^.numofrecords;
  1641. ***** ^ not supported yet
  1642. ***** ^ not supported yet
  1643. ***** ^ not supported yet
  1644. ***** ^ not supported yet
  1645. 747 IF NOT alias^.exclusive THEN
  1646. ***** ^ not supported yet
  1647. ***** ^ not supported yet
  1648. 748 SetFilePtr( alias^.fileID, FromStart, VAL(LONGINT,4 ));
  1649. ***** ^ not supported yet
  1650. ***** ^ not supported yet
  1651. ***** ^ not supported yet
  1652. ***** ^ undeclared identifier
  1653. ***** ^ undeclared identifier
  1654. ***** ^ not supported yet
  1655. 749 alias^.ErrorCode := BlockWrite( alias^.fileID, ADR(alias^.numofrecords),
  1656. ***** ^ not supported yet
  1657. ***** ^ not supported yet
  1658. ***** ^ not supported yet
  1659. ***** ^ not supported yet
  1660. ***** ^ not supported yet
  1661. ***** ^ not supported yet
  1662. ***** ^ not supported yet
  1663. ***** ^ not supported yet
  1664. 750 4 );
  1665. ***** ^ not supported yet
  1666. 751 END;
  1667. 752
  1668. 753 IF alias^.Safety
  1669. ***** ^ not supported yet
  1670. ***** ^ not supported yet
  1671. 754 THEN
  1672. 755 UpdateDisk(alias^.fileID);
  1673. ***** ^ not supported yet
  1674. ***** ^ not supported yet
  1675. ***** ^ not supported yet
  1676. 756 END;
  1677. 757
  1678. 758 END;
  1679. 759 IF alias^.autolock AND (LockRec(alias,alias^.currentrecnum)#0) THEN
  1680. ***** ^ not supported yet
  1681. ***** ^ not supported yet
  1682. ***** ^ undeclared identifier
  1683. ***** ^ not supported yet
  1684. ***** ^ not supported yet
  1685. ***** ^ not supported yet
  1686. 760 WARN('LockRec Failure in WriteDBRec')
  1687. ***** ^ not supported yet
  1688. ***** ^ not supported yet
  1689. 761 END;
  1690. 762 recordpos := ( alias^.currentrecnum - one ) * VAL( LONGINT,alias^.length
  1691. ***** ^ not supported yet
  1692. ***** ^ not supported yet
  1693. ***** ^ undeclared identifier
  1694. ***** ^ not supported yet
  1695. ***** ^ not supported yet
  1696. 763 ) + VAL( LONGINT, alias^.headerlength );
  1697. ***** ^ undeclared identifier
  1698. ***** ^ not supported yet
  1699. ***** ^ not supported yet
  1700. 764 IF alias^.appending THEN
  1701. ***** ^ not supported yet
  1702. ***** ^ not supported yet
  1703. 765 NeedToWrite:=TRUE;
  1704. 766 (* unlock header only after locking record *)
  1705. 767 IF NOT alias^.exclusive THEN
  1706. ***** ^ not supported yet
  1707. ***** ^ not supported yet
  1708. 768 alias^.ErrorCode:=Locks.UnLock(alias^.fileID,lock);
  1709. ***** ^ not supported yet
  1710. ***** ^ not supported yet
  1711. ***** ^ not supported yet
  1712. ***** ^ not supported yet
  1713. ***** ^ not supported yet
  1714. ***** ^ not supported yet
  1715. ***** ^ not supported yet
  1716. 769 IF alias^.ErrorCode#0 THEN WARN('Unable to unlock Header in WriteDBRec') END;
  1717. ***** ^ not supported yet
  1718. ***** ^ not supported yet
  1719. ***** ^ not supported yet
  1720. ***** ^ not supported yet
  1721. 770 END;
  1722. 771 ELSE
  1723. 772 NeedToWrite:=CompareBlock(alias^.currentrec,alias^.BufferPtr,alias^.length)<
  1724. ***** ^ not supported yet
  1725. ***** ^ not supported yet
  1726. ***** ^ not supported yet
  1727. ***** ^ not supported yet
  1728. ***** ^ not supported yet
  1729. ***** ^ not supported yet
  1730. ***** ^ not supported yet
  1731. 773 alias^.length;
  1732. ***** ^ not supported yet
  1733. ***** ^ not supported yet
  1734. 774 IF alias^.autolock AND NeedToWrite THEN
  1735. ***** ^ not supported yet
  1736. ***** ^ not supported yet
  1737. 775 SetFilePtr( alias^.fileID, FromStart, recordpos );
  1738. ***** ^ not supported yet
  1739. ***** ^ not supported yet
  1740. ***** ^ not supported yet
  1741. ***** ^ undeclared identifier
  1742. ***** ^ not supported yet
  1743. 776 PrintMessage( BlockRead( alias^.fileID, alias^.ReReadPtr ,
  1744. ***** ^ not supported yet
  1745. ***** ^ not supported yet
  1746. ***** ^ not supported yet
  1747. ***** ^ not supported yet
  1748. ***** ^ not supported yet
  1749. ***** ^ not supported yet
  1750. 777 alias^.length ));
  1751. ***** ^ not supported yet
  1752. ***** ^ not supported yet
  1753. 778 IF CompareBlock(alias^.ReReadPtr,alias^.BufferPtr,alias^.length)<
  1754. ***** ^ not supported yet
  1755. ***** ^ not supported yet
  1756. ***** ^ not supported yet
  1757. ***** ^ not supported yet
  1758. ***** ^ not supported yet
  1759. ***** ^ not supported yet
  1760. ***** ^ not supported yet
  1761. 779 alias^.length
  1762. ***** ^ not supported yet
  1763. ***** ^ not supported yet
  1764. 780 THEN
  1765. 781 NeedToWrite:=alias^.fixup(alias);
  1766. ***** ^ not supported yet
  1767. ***** ^ not supported yet
  1768. ***** ^ not supported yet
  1769. 782 (* we update BufferPtr so Update of indexes works *)
  1770. 783 Move(alias^.ReReadPtr,alias^.BufferPtr,alias^.length);
  1771. ***** ^ not supported yet
  1772. ***** ^ not supported yet
  1773. ***** ^ not supported yet
  1774. ***** ^ not supported yet
  1775. ***** ^ not supported yet
  1776. ***** ^ not supported yet
  1777. ***** ^ not supported yet
  1778. 784 ELSE
  1779. 785 NeedToWrite:=TRUE; (*File was not changed *)
  1780. 786 END;
  1781. 787 END;
  1782. 788
  1783. 789 END (*alias^.appendinng*);
  1784. 790 IF NeedToWrite THEN
  1785. 791 (* Find the file position for the BEGINNING of the record *)
  1786. 792 SetFilePtr( alias^.fileID, FromStart, recordpos );
  1787. ***** ^ not supported yet
  1788. ***** ^ not supported yet
  1789. ***** ^ not supported yet
  1790. ***** ^ undeclared identifier
  1791. ***** ^ not supported yet
  1792. 793 (* Write the current record *)
  1793. 794 alias^.ErrorCode := BlockWrite( alias^.fileID, alias^.currentrec ,
  1794. ***** ^ not supported yet
  1795. ***** ^ not supported yet
  1796. ***** ^ not supported yet
  1797. ***** ^ not supported yet
  1798. ***** ^ not supported yet
  1799. ***** ^ not supported yet
  1800. ***** ^ not supported yet
  1801. 795 alias^.length );
  1802. ***** ^ not supported yet
  1803. ***** ^ not supported yet
  1804. 796 IF alias^.IndexList#NIL
  1805. ***** ^ not supported yet
  1806. ***** ^ not supported yet
  1807. 797 THEN (* most do this before modifying Buffer*)
  1808. 798 UpDateIndexes(alias);
  1809. ***** ^ undeclared identifier
  1810. ***** ^ not supported yet
  1811. 799 END;
  1812. 800 (* copy into buffer *)
  1813. 801 Move(alias^.currentrec,alias^.BufferPtr,alias^.length);
  1814. ***** ^ not supported yet
  1815. ***** ^ not supported yet
  1816. ***** ^ not supported yet
  1817. ***** ^ not supported yet
  1818. ***** ^ not supported yet
  1819. ***** ^ not supported yet
  1820. ***** ^ not supported yet
  1821. 802 IF alias^.Safety
  1822. ***** ^ not supported yet
  1823. ***** ^ not supported yet
  1824. 803 THEN
  1825. 804 UpdateDisk(alias^.fileID);
  1826. ***** ^ not supported yet
  1827. ***** ^ not supported yet
  1828. ***** ^ not supported yet
  1829. 805 IF alias^.MemoOpen
  1830. ***** ^ not supported yet
  1831. ***** ^ not supported yet
  1832. 806 THEN
  1833. 807 UpdateDisk(alias^.MemoHandle);
  1834. ***** ^ not supported yet
  1835. ***** ^ not supported yet
  1836. ***** ^ not supported yet
  1837. 808 END;
  1838. 809 END;
  1839. 810 END(* needtowrite*);
  1840. 811 IF alias^.autolock AND (UnLockRec(alias,alias^.currentrecnum)#0) THEN
  1841. ***** ^ not supported yet
  1842. ***** ^ not supported yet
  1843. ***** ^ undeclared identifier
  1844. ***** ^ not supported yet
  1845. ***** ^ not supported yet
  1846. ***** ^ not supported yet
  1847. 812 WARN('UnLockRec Failure in WriteDBF')
  1848. ***** ^ not supported yet
  1849. ***** ^ not supported yet
  1850. 813 END;
  1851. 814 alias^.appending:=FALSE;
  1852. ***** ^ not supported yet
  1853. ***** ^ not supported yet
  1854. 815 END WriteDBRec;
  1855. ***** ^ not supported yet
  1856. 816
  1857. 817
  1858. 818 PROCEDURE GetField
  1859. 819 ( alias : DBFile;
  1860. 820 fieldnumber : CARDINAL;
  1861. 821 VAR field : ARRAY OF CHAR );
  1862. ***** ^ not supported yet
  1863. 822 (* operates on the currently active record *)
  1864. 823
  1865. 824 VAR
  1866. 825 limit : CARDINAL;
  1867. 826
  1868. 827 BEGIN
  1869. 828 (* Find offset of field *)
  1870. 829 IF ( fieldnumber <= alias^.numberoffields ) AND ( fieldnumber > 0 )
  1871. ***** ^ not supported yet
  1872. ***** ^ not supported yet
  1873. 830 THEN
  1874. 831 WITH alias^.fieldlist^[fieldnumber] DO
  1875. ***** ^ not supported yet
  1876. ***** ^ not supported yet
  1877. ***** ^ not supported yet
  1878. 832 limit := Min( HIGH( field )+1, size );
  1879. ***** ^ not supported yet
  1880. ***** ^ undeclared identifier
  1881. ***** ^ not supported yet
  1882. ***** ^ undeclared identifier
  1883. 833 Move( ADR( alias^.currentrec^[ offset] ),
  1884. ***** ^ not supported yet
  1885. ***** ^ not supported yet
  1886. ***** ^ not supported yet
  1887. ***** ^ not supported yet
  1888. ***** ^ undeclared identifier
  1889. 834 ADR( field ), limit );
  1890. ***** ^ not supported yet
  1891. ***** ^ not supported yet
  1892. ***** ^ not supported yet
  1893. 835 END;
  1894. ***** ^ not supported yet
  1895. 836 IF ( limit <= HIGH( field ) )
  1896. ***** ^ undeclared identifier
  1897. ***** ^ undeclared identifier
  1898. ***** ^ undeclared identifier
  1899. 837 THEN
  1900. 838 field[limit] := 0C
  1901. ***** ^ undeclared identifier
  1902. ***** ^ undeclared identifier
  1903. 839 END (* if *);
  1904. 840 ELSE
  1905. 841 WARN('Ilegal field number in GetField');
  1906. ***** ^ not supported yet
  1907. ***** ^ not supported yet
  1908. 842 END; (* IF *)
  1909. 843 END GetField;
  1910. ***** ^ not supported yet
  1911. 844
  1912. 845 PROCEDURE Replace(alias: DBFile; fieldnumber: CARDINAL;
  1913. 846 field: ARRAY OF CHAR);
  1914. ***** ^ not supported yet
  1915. 847 VAR j, k: CARDINAL;
  1916. 848 EndOfStr: BOOLEAN;
  1917. 849 BEGIN
  1918. 850 EndOfStr := FALSE;
  1919. 851 k := 0;
  1920. 852 WITH alias^.fieldlist^[fieldnumber] DO
  1921. ***** ^ not supported yet
  1922. ***** ^ not supported yet
  1923. ***** ^ not supported yet
  1924. 853 FOR j := (offset) TO
  1925. ***** ^ undeclared identifier
  1926. 854 (offset
  1927. ***** ^ undeclared identifier
  1928. 855 + size - 1) DO
  1929. ***** ^ undeclared identifier
  1930. ***** ^ FOR needs integer variable and bounds
  1931. 856 IF NOT EndOfStr THEN
  1932. 857 IF (k <= HIGH(field)) AND (field[k] # 0C) THEN
  1933. ***** ^ undeclared identifier
  1934. ***** ^ not supported yet
  1935. ***** ^ not supported yet
  1936. ***** ^ not supported yet
  1937. 858 alias^.currentrec^[j] := field[k];
  1938. ***** ^ not supported yet
  1939. ***** ^ not supported yet
  1940. ***** ^ not supported yet
  1941. ***** ^ not supported yet
  1942. ***** ^ not supported yet
  1943. 859 ELSE
  1944. 860 EndOfStr := TRUE;
  1945. 861 alias^.currentrec^[j] := ' ';
  1946. ***** ^ not supported yet
  1947. ***** ^ not supported yet
  1948. ***** ^ not supported yet
  1949. 862 END;
  1950. 863 ELSE
  1951. 864 alias^.currentrec^[j] := ' ';
  1952. ***** ^ not supported yet
  1953. ***** ^ not supported yet
  1954. ***** ^ not supported yet
  1955. 865 END;
  1956. 866 INC(k);
  1957. ***** ^ undeclared identifier
  1958. ***** ^ not supported yet
  1959. 867 END; (* FOR *)
  1960. 868 END;
  1961. ***** ^ not supported yet
  1962. 869 END Replace;
  1963. ***** ^ not supported yet
  1964. 870
  1965. 871 PROCEDURE PosOfField(alias: DBFile; fieldname: ARRAY OF CHAR): CARDINAL;
  1966. ***** ^ not supported yet
  1967. 872 VAR i: CARDINAL;
  1968. 873 BEGIN
  1969. 874 i := 1;
  1970. 875 (* field names are null terminated *)
  1971. 876 WHILE (i <= alias^.numberoffields) AND (NOT PosUtils.Equal(fieldname,
  1972. ***** ^ not supported yet
  1973. ***** ^ not supported yet
  1974. ***** ^ not supported yet
  1975. ***** ^ not supported yet
  1976. ***** ^ not supported yet
  1977. 877
  1978. 878 alias^.fieldlist^[i].name)) DO
  1979. ***** ^ not supported yet
  1980. ***** ^ not supported yet
  1981. ***** ^ not supported yet
  1982. ***** ^ not supported yet
  1983. 879 INC(i);
  1984. ***** ^ undeclared identifier
  1985. ***** ^ not supported yet
  1986. 880 END;
  1987. 881 IF i > alias^.numberoffields THEN
  1988. ***** ^ not supported yet
  1989. ***** ^ not supported yet
  1990. 882 i := 0;
  1991. 883 END;
  1992. 884 RETURN i;
  1993. 885 END PosOfField;
  1994. ***** ^ not supported yet
  1995. 886
  1996. 887 (* $O- *)
  1997. 888
  1998. 889 PROCEDURE AppendBlank
  1999. 890 ( alias : DBFile );
  2000. 891
  2001. 892
  2002. 893 BEGIN
  2003. 894 IF NOT alias^.open
  2004. ***** ^ not supported yet
  2005. ***** ^ not supported yet
  2006. 895 THEN (* check to make sure the file is open *)
  2007. 896 WARN('DBFile not open in Append Blank');
  2008. ***** ^ not supported yet
  2009. ***** ^ not supported yet
  2010. 897 END;
  2011. 898 (* set buffer values *)
  2012. 899 alias^.appending:=TRUE;
  2013. ***** ^ not supported yet
  2014. ***** ^ not supported yet
  2015. 900 alias^.NumRecords:=1;
  2016. ***** ^ not supported yet
  2017. ***** ^ not supported yet
  2018. 901 alias^.BufferPtr:=alias^.dbbuffer;
  2019. ***** ^ not supported yet
  2020. ***** ^ not supported yet
  2021. ***** ^ not supported yet
  2022. ***** ^ not supported yet
  2023. 902 alias^.currentrecnum:=MAX(LONGINT);
  2024. ***** ^ not supported yet
  2025. ***** ^ not supported yet
  2026. ***** ^ undeclared identifier
  2027. ***** ^ not supported yet
  2028. 903 (* Write Recordsize number of blanks *)
  2029. 904 Fill( alias^.currentrec, alias^.length, Blank );
  2030. ***** ^ not supported yet
  2031. ***** ^ not supported yet
  2032. ***** ^ not supported yet
  2033. ***** ^ not supported yet
  2034. ***** ^ not supported yet
  2035. ***** ^ not supported yet
  2036. 905 END AppendBlank;
  2037. ***** ^ not supported yet
  2038. 906
  2039. 907 (* $O= *)
  2040. 908
  2041. 909
  2042. 910 PROCEDURE DeleteRecord
  2043. 911 ( alias : DBFile );
  2044. 912
  2045. 913 BEGIN
  2046. 914 alias^.currentrec^[1] := '*';
  2047. ***** ^ not supported yet
  2048. ***** ^ not supported yet
  2049. ***** ^ not supported yet
  2050. 915 WriteDBRec( alias );
  2051. ***** ^ not supported yet
  2052. ***** ^ not supported yet
  2053. 916 END DeleteRecord;
  2054. ***** ^ not supported yet
  2055. 917
  2056. 918
  2057. 919 PROCEDURE UnDeleteRecord
  2058. 920 ( alias : DBFile );
  2059. 921
  2060. 922 BEGIN
  2061. 923 alias^.currentrec^[1] := Blank;
  2062. ***** ^ not supported yet
  2063. ***** ^ not supported yet
  2064. ***** ^ not supported yet
  2065. 924 WriteDBRec( alias );
  2066. ***** ^ not supported yet
  2067. ***** ^ not supported yet
  2068. 925 END UnDeleteRecord;
  2069. ***** ^ not supported yet
  2070. 926
  2071. 927
  2072. 928 PROCEDURE Deleted
  2073. 929 ( alias : DBFile ) : BOOLEAN;
  2074. 930
  2075. 931 BEGIN
  2076. 932 RETURN alias^.currentrec^[1] = '*';
  2077. ***** ^ not supported yet
  2078. ***** ^ not supported yet
  2079. ***** ^ not supported yet
  2080. 933 END Deleted;
  2081. ***** ^ not supported yet
  2082. 934
  2083. 935 PROCEDURE LockRec(alias: DBFile;recnum:LONGINT):CARDINAL;
  2084. 936 VAR
  2085. 937 lock:Locks.RangeRec;
  2086. ***** ^ not supported yet
  2087. 938 BEGIN
  2088. 939 lock.FileOffset := ( recnum -one) *
  2089. ***** ^ not supported yet
  2090. ***** ^ not supported yet
  2091. 940 VAL( LONGINT,alias^.length ) + VAL( LONGINT, alias^.headerlength );
  2092. ***** ^ undeclared identifier
  2093. ***** ^ not supported yet
  2094. ***** ^ not supported yet
  2095. ***** ^ undeclared identifier
  2096. ***** ^ not supported yet
  2097. ***** ^ not supported yet
  2098. 941 lock.RangeLength:=VAL(LONGINT,alias^.length);
  2099. ***** ^ not supported yet
  2100. ***** ^ not supported yet
  2101. ***** ^ undeclared identifier
  2102. ***** ^ not supported yet
  2103. ***** ^ not supported yet
  2104. 942 RETURN Locks.LockRetry(alias^.fileID,lock,10,alias^.name);
  2105. ***** ^ not supported yet
  2106. ***** ^ not supported yet
  2107. ***** ^ not supported yet
  2108. ***** ^ not supported yet
  2109. ***** ^ not supported yet
  2110. ***** ^ not supported yet
  2111. ***** ^ not supported yet
  2112. 943 END LockRec;
  2113. ***** ^ not supported yet
  2114. 944
  2115. 945 PROCEDURE UnLockRec(alias: DBFile;recnum:LONGINT):CARDINAL;
  2116. 946 VAR
  2117. 947 lock:Locks.RangeRec;
  2118. ***** ^ not supported yet
  2119. 948 BEGIN
  2120. 949 lock.FileOffset := ( recnum -one) *
  2121. ***** ^ not supported yet
  2122. ***** ^ not supported yet
  2123. 950 VAL( LONGINT,alias^.length ) + VAL( LONGINT, alias^.headerlength );
  2124. ***** ^ undeclared identifier
  2125. ***** ^ not supported yet
  2126. ***** ^ not supported yet
  2127. ***** ^ undeclared identifier
  2128. ***** ^ not supported yet
  2129. ***** ^ not supported yet
  2130. 951 lock.RangeLength:=VAL(LONGINT,alias^.length);
  2131. ***** ^ not supported yet
  2132. ***** ^ not supported yet
  2133. ***** ^ undeclared identifier
  2134. ***** ^ not supported yet
  2135. ***** ^ not supported yet
  2136. 952 RETURN Locks.UnLock(alias^.fileID,lock);
  2137. ***** ^ not supported yet
  2138. ***** ^ not supported yet
  2139. ***** ^ not supported yet
  2140. ***** ^ not supported yet
  2141. ***** ^ not supported yet
  2142. 953 END UnLockRec;
  2143. ***** ^ not supported yet
  2144. 954
  2145. 955 PROCEDURE InitMemo(handle:CARDINAL) ;
  2146. 956 VAR
  2147. 957 buf:ARRAY[0..511] OF CHAR;
  2148. ***** ^ not supported yet
  2149. ***** ^ not supported yet
  2150. 958 i :CARDINAL;
  2151. 959 BEGIN
  2152. 960 FOR i:=1 TO 511 DO
  2153. 961 buf[i]:=0C;
  2154. ***** ^ not supported yet
  2155. ***** ^ not supported yet
  2156. 962 END (* for *);
  2157. 963 buf[0]:=1C;
  2158. ***** ^ not supported yet
  2159. ***** ^ not supported yet
  2160. 964 PrintMessage(BlockWrite(handle,ADR(buf),512));
  2161. ***** ^ not supported yet
  2162. ***** ^ not supported yet
  2163. ***** ^ not supported yet
  2164. ***** ^ not supported yet
  2165. ***** ^ not supported yet
  2166. 965 END InitMemo;
  2167. ***** ^ not supported yet
  2168. 966
  2169. 967
  2170. 968 PROCEDURE BuildDBF( fields: ARRAY OF
  2171. 969 DBFieldDescriptor;NumFields:CARDINAL; alias: DBFile):CARDINAL;
  2172. ***** ^ undeclared identifier
  2173. 970
  2174. 971 (* THIS PROCEDURE WILL SILENTLY OVERWRITE ANY FILE WITH THE
  2175. 972 SAME NAME AS filename -- When used in a program, the
  2176. 973 existing files must be checked and an appropriate warning
  2177. 974 should be given. *)
  2178. 975 (* THIS PROCEDURE DOES NOT CLOSE THE CREATED FILE -- CloseDBF
  2179. 976 must be called to close the file *)
  2180. 977 (* The procedure is to read each field descriptor in the
  2181. 978 array until an illegal name (ie. any name that doesn't
  2182. 979 begin with a letter) is encountered) *)
  2183. 980 (* NOTE THAT FIELDNAMES IN DBASE3 ARE PADDED WITH 0C *)
  2184. 981
  2185. 982 VAR month, day, year, i, j,
  2186. 983 ActionTaken, offset: CARDINAL;
  2187. 984 dumstr, zstr: ARRAY [1..50] OF CHAR;
  2188. ***** ^ not supported yet
  2189. ***** ^ not supported yet
  2190. 985 (* zstr is initialized to nulls (0C) and used with
  2191. 986 HandleIO.BlockWrite to write blanks to the
  2192. 987 file *)
  2193. 988 tmpchar: CHAR; (* used to write CHAR values with BlockWrite *)
  2194. 989 filemode:BITSET;
  2195. ***** ^ undeclared identifier
  2196. 990 longtmp: LONGINT; (* used to avoid Function Type Coercion *)
  2197. 991 BEGIN
  2198. 992 IF alias^.Init#InitCode
  2199. ***** ^ not supported yet
  2200. ***** ^ not supported yet
  2201. 993 THEN
  2202. 994 WARN('Unitalized DBF in DBCreate')
  2203. ***** ^ not supported yet
  2204. ***** ^ not supported yet
  2205. 995 END;
  2206. 996 alias^.exclusive:=TRUE;
  2207. ***** ^ not supported yet
  2208. ***** ^ not supported yet
  2209. 997 alias^.hasmemo := FALSE;
  2210. ***** ^ not supported yet
  2211. ***** ^ not supported yet
  2212. 998 alias^.length := 1; (* even with no fields, the length is 1 *)
  2213. ***** ^ not supported yet
  2214. ***** ^ not supported yet
  2215. 999 alias^.headerlength := 0;
  2216. ***** ^ not supported yet
  2217. ***** ^ not supported yet
  2218. 1000 alias^.numofrecords := VAL(LONGINT,0);
  2219. ***** ^ not supported yet
  2220. ***** ^ not supported yet
  2221. ***** ^ undeclared identifier
  2222. ***** ^ not supported yet
  2223. 1001 alias^.currentrecnum:= VAL(LONGINT,0);
  2224. ***** ^ not supported yet
  2225. ***** ^ not supported yet
  2226. ***** ^ undeclared identifier
  2227. ***** ^ not supported yet
  2228. 1002 alias^.open := TRUE;
  2229. ***** ^ not supported yet
  2230. ***** ^ not supported yet
  2231. 1003 EnvironUtils.GetDate( month, day, year, dumstr, dumstr );
  2232. ***** ^ not supported yet
  2233. ***** ^ not supported yet
  2234. ***** ^ not supported yet
  2235. ***** ^ not supported yet
  2236. 1004 (* open exclusive *)
  2237. 1005 (* create if the file does not exist; truncate if it does exist *)
  2238. 1006 IF alias^.exclusive THEN
  2239. ***** ^ not supported yet
  2240. ***** ^ not supported yet
  2241. 1007 filemode:={1,4}
  2242. ***** ^ not supported yet
  2243. ***** ^ not supported yet
  2244. ***** ^ not supported yet
  2245. 1008 ELSE
  2246. 1009 filemode:={1,6} (* allow all *)
  2247. ***** ^ not supported yet
  2248. ***** ^ not supported yet
  2249. ***** ^ not supported yet
  2250. 1010 END;
  2251. 1011 alias^.ErrorCode := FAPI.DOSOPEN( ADR(alias^.name),
  2252. ***** ^ not supported yet
  2253. ***** ^ not supported yet
  2254. ***** ^ not supported yet
  2255. ***** ^ not supported yet
  2256. ***** ^ not supported yet
  2257. ***** ^ not supported yet
  2258. ***** ^ not supported yet
  2259. 1012 ADR(alias^.fileID), ADR(ActionTaken), VAL(LONGINT,0),
  2260. ***** ^ not supported yet
  2261. ***** ^ not supported yet
  2262. ***** ^ not supported yet
  2263. ***** ^ not supported yet
  2264. ***** ^ not supported yet
  2265. ***** ^ undeclared identifier
  2266. ***** ^ not supported yet
  2267. 1013 FAPI.FILE_NORMAL, CARDINAL({1,4}), CARDINAL(filemode),
  2268. ***** ^ not supported yet
  2269. ***** ^ not supported yet
  2270. ***** ^ not supported yet
  2271. ***** ^ not supported yet
  2272. ***** ^ not supported yet
  2273. 1014 VAL(LONGINT,0) );
  2274. ***** ^ undeclared identifier
  2275. ***** ^ not supported yet
  2276. 1015 IF alias^.ErrorCode#0 THEN RETURN alias^.ErrorCode END;
  2277. ***** ^ not supported yet
  2278. ***** ^ not supported yet
  2279. ***** ^ not supported yet
  2280. ***** ^ not supported yet
  2281. 1016 Fill(ADR(zstr),HIGH(zstr), 0C);
  2282. ***** ^ not supported yet
  2283. ***** ^ not supported yet
  2284. ***** ^ not supported yet
  2285. ***** ^ undeclared identifier
  2286. ***** ^ not supported yet
  2287. ***** ^ not supported yet
  2288. 1017 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(zstr),32);
  2289. ***** ^ not supported yet
  2290. ***** ^ not supported yet
  2291. ***** ^ not supported yet
  2292. ***** ^ not supported yet
  2293. ***** ^ not supported yet
  2294. ***** ^ not supported yet
  2295. ***** ^ not supported yet
  2296. ***** ^ not supported yet
  2297. 1018 (* Initialize the first 32 bytes of the header structure *)
  2298. 1019 i := 0;
  2299. 1020 offset := 2;
  2300. 1021 WHILE (i <= HIGH(fields)) AND
  2301. ***** ^ undeclared identifier
  2302. ***** ^ not supported yet
  2303. 1022 (i<NumFields) AND Alph(fields[i].name[0]) DO
  2304. ***** ^ not supported yet
  2305. ***** ^ not supported yet
  2306. ***** ^ not supported yet
  2307. ***** ^ not supported yet
  2308. ***** ^ not supported yet
  2309. 1023 fields[i].offset := offset;
  2310. ***** ^ not supported yet
  2311. ***** ^ not supported yet
  2312. ***** ^ not supported yet
  2313. 1024 FOR j := 0 TO 9 DO
  2314. 1025 IF FieldNameChar(fields[i].name[j]) THEN
  2315. ***** ^ not supported yet
  2316. ***** ^ not supported yet
  2317. ***** ^ not supported yet
  2318. ***** ^ not supported yet
  2319. ***** ^ not supported yet
  2320. 1026 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2321. ***** ^ not supported yet
  2322. ***** ^ not supported yet
  2323. ***** ^ not supported yet
  2324. ***** ^ not supported yet
  2325. ***** ^ not supported yet
  2326. 1027 ADR(fields[i].name[j]), 1);
  2327. ***** ^ not supported yet
  2328. ***** ^ not supported yet
  2329. ***** ^ not supported yet
  2330. ***** ^ not supported yet
  2331. ***** ^ not supported yet
  2332. ***** ^ not supported yet
  2333. 1028 ELSE
  2334. 1029 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2335. ***** ^ not supported yet
  2336. ***** ^ not supported yet
  2337. ***** ^ not supported yet
  2338. ***** ^ not supported yet
  2339. ***** ^ not supported yet
  2340. 1030 ADR(zstr), 1);
  2341. ***** ^ not supported yet
  2342. ***** ^ not supported yet
  2343. ***** ^ not supported yet
  2344. 1031 END;
  2345. 1032 END; (* for *)
  2346. 1033 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(zstr),
  2347. ***** ^ not supported yet
  2348. ***** ^ not supported yet
  2349. ***** ^ not supported yet
  2350. ***** ^ not supported yet
  2351. ***** ^ not supported yet
  2352. ***** ^ not supported yet
  2353. ***** ^ not supported yet
  2354. 1034 1); (* puts a byte in the 11th space *)
  2355. ***** ^ not supported yet
  2356. 1035 IF CAP(fields[i].fldtype) = 'M' THEN
  2357. ***** ^ undeclared identifier
  2358. ***** ^ not supported yet
  2359. ***** ^ not supported yet
  2360. ***** ^ not supported yet
  2361. 1036 alias^.hasmemo := TRUE;
  2362. ***** ^ not supported yet
  2363. ***** ^ not supported yet
  2364. 1037 fields[i].size := 10;
  2365. ***** ^ not supported yet
  2366. ***** ^ not supported yet
  2367. ***** ^ not supported yet
  2368. 1038 ELSIF CAP(fields[i].fldtype) = 'L' THEN
  2369. ***** ^ undeclared identifier
  2370. ***** ^ not supported yet
  2371. ***** ^ not supported yet
  2372. ***** ^ not supported yet
  2373. 1039 fields[i].size := 1;
  2374. ***** ^ not supported yet
  2375. ***** ^ not supported yet
  2376. ***** ^ not supported yet
  2377. 1040 ELSIF CAP(fields[i].fldtype) = 'D' THEN
  2378. ***** ^ undeclared identifier
  2379. ***** ^ not supported yet
  2380. ***** ^ not supported yet
  2381. ***** ^ not supported yet
  2382. 1041 fields[i].size := 8;
  2383. ***** ^ not supported yet
  2384. ***** ^ not supported yet
  2385. ***** ^ not supported yet
  2386. 1042 ELSIF (CAP(fields[i].fldtype) # 'C') AND
  2387. ***** ^ undeclared identifier
  2388. ***** ^ not supported yet
  2389. ***** ^ not supported yet
  2390. ***** ^ not supported yet
  2391. 1043 (CAP(fields[i].fldtype) # 'N') THEN
  2392. ***** ^ undeclared identifier
  2393. ***** ^ not supported yet
  2394. ***** ^ not supported yet
  2395. ***** ^ not supported yet
  2396. 1044 WARN('Illegal type encountered in BuildDBF');
  2397. ***** ^ not supported yet
  2398. ***** ^ not supported yet
  2399. 1045 END;
  2400. 1046 tmpchar := CAP(fields[i].fldtype);
  2401. ***** ^ undeclared identifier
  2402. ***** ^ not supported yet
  2403. ***** ^ not supported yet
  2404. ***** ^ not supported yet
  2405. 1047 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2406. ***** ^ not supported yet
  2407. ***** ^ not supported yet
  2408. ***** ^ not supported yet
  2409. ***** ^ not supported yet
  2410. ***** ^ not supported yet
  2411. ***** ^ not supported yet
  2412. ***** ^ not supported yet
  2413. ***** ^ not supported yet
  2414. 1048 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(zstr), 4);
  2415. ***** ^ not supported yet
  2416. ***** ^ not supported yet
  2417. ***** ^ not supported yet
  2418. ***** ^ not supported yet
  2419. ***** ^ not supported yet
  2420. ***** ^ not supported yet
  2421. ***** ^ not supported yet
  2422. ***** ^ not supported yet
  2423. 1049 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2424. ***** ^ not supported yet
  2425. ***** ^ not supported yet
  2426. ***** ^ not supported yet
  2427. ***** ^ not supported yet
  2428. ***** ^ not supported yet
  2429. 1050 ADR(fields[i].size), 1);
  2430. ***** ^ not supported yet
  2431. ***** ^ not supported yet
  2432. ***** ^ not supported yet
  2433. ***** ^ not supported yet
  2434. ***** ^ not supported yet
  2435. 1051 offset := offset + fields[i].size;
  2436. ***** ^ not supported yet
  2437. ***** ^ not supported yet
  2438. ***** ^ not supported yet
  2439. 1052 IF CAP(fields[i].fldtype) = 'N' THEN
  2440. ***** ^ undeclared identifier
  2441. ***** ^ not supported yet
  2442. ***** ^ not supported yet
  2443. ***** ^ not supported yet
  2444. 1053 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2445. ***** ^ not supported yet
  2446. ***** ^ not supported yet
  2447. ***** ^ not supported yet
  2448. ***** ^ not supported yet
  2449. ***** ^ not supported yet
  2450. 1054 ADR(fields[i].decplaces), 1);
  2451. ***** ^ not supported yet
  2452. ***** ^ not supported yet
  2453. ***** ^ not supported yet
  2454. ***** ^ not supported yet
  2455. ***** ^ not supported yet
  2456. 1055 ELSE
  2457. 1056 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(zstr), 1)
  2458. ***** ^ not supported yet
  2459. ***** ^ not supported yet
  2460. ***** ^ not supported yet
  2461. ***** ^ not supported yet
  2462. ***** ^ not supported yet
  2463. ***** ^ not supported yet
  2464. ***** ^ not supported yet
  2465. ***** ^ not supported yet
  2466. 1057 END;
  2467. 1058 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(zstr), 14);
  2468. ***** ^ not supported yet
  2469. ***** ^ not supported yet
  2470. ***** ^ not supported yet
  2471. ***** ^ not supported yet
  2472. ***** ^ not supported yet
  2473. ***** ^ not supported yet
  2474. ***** ^ not supported yet
  2475. ***** ^ not supported yet
  2476. 1059 alias^.length := alias^.length + fields[i].size;
  2477. ***** ^ not supported yet
  2478. ***** ^ not supported yet
  2479. ***** ^ not supported yet
  2480. ***** ^ not supported yet
  2481. ***** ^ not supported yet
  2482. ***** ^ not supported yet
  2483. ***** ^ not supported yet
  2484. 1060 INC(i);
  2485. ***** ^ undeclared identifier
  2486. ***** ^ not supported yet
  2487. 1061 END; (* while *)
  2488. 1062 alias^.numberoffields := i ;
  2489. ***** ^ not supported yet
  2490. ***** ^ not supported yet
  2491. 1063 IF NumFields<i THEN
  2492. 1064 alias^.numberoffields:=NumFields
  2493. ***** ^ not supported yet
  2494. ***** ^ not supported yet
  2495. 1065 END;
  2496. 1066 ALLOCATE(alias^.fieldlist,
  2497. ***** ^ not supported yet
  2498. ***** ^ not supported yet
  2499. ***** ^ not supported yet
  2500. 1067 (TSIZE(DBFieldArray)DIV MaxField)*(alias^.numberoffields));
  2501. ***** ^ not supported yet
  2502. ***** ^ undeclared identifier
  2503. ***** ^ undeclared identifier
  2504. ***** ^ not supported yet
  2505. ***** ^ not supported yet
  2506. ***** ^ not supported yet
  2507. 1068 FOR i := 0 TO alias^.numberoffields-1 DO
  2508. ***** ^ not supported yet
  2509. ***** ^ not supported yet
  2510. ***** ^ FOR needs integer variable and bounds
  2511. 1069 alias^.fieldlist^[i+1] := fields[i];
  2512. ***** ^ not supported yet
  2513. ***** ^ not supported yet
  2514. ***** ^ not supported yet
  2515. ***** ^ not supported yet
  2516. ***** ^ not supported yet
  2517. 1070 END;
  2518. 1071 tmpchar := CHR(0DH);
  2519. ***** ^ undeclared identifier
  2520. ***** ^ not supported yet
  2521. 1072 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2522. ***** ^ not supported yet
  2523. ***** ^ not supported yet
  2524. ***** ^ not supported yet
  2525. ***** ^ not supported yet
  2526. ***** ^ not supported yet
  2527. ***** ^ not supported yet
  2528. ***** ^ not supported yet
  2529. ***** ^ not supported yet
  2530. 1073 (* write the header terminator *)
  2531. 1074 longtmp := GetFilePtr(alias^.fileID);
  2532. ***** ^ not supported yet
  2533. ***** ^ not supported yet
  2534. ***** ^ not supported yet
  2535. 1075 alias^.headerlength := VAL(INTEGER,longtmp);
  2536. ***** ^ not supported yet
  2537. ***** ^ not supported yet
  2538. ***** ^ undeclared identifier
  2539. ***** ^ not supported yet
  2540. 1076 (*
  2541. 1077 alias^.headerlength := VAL(INTEGER,HandleIO.GetFilePtr(alias^.fileID));
  2542. 1078 *)
  2543. 1079 (* Next, set the first byte of the file to 03H or 83H *)
  2544. 1080 SetFilePtr(alias^.fileID,FromStart,VAL(LONGINT,0));
  2545. ***** ^ not supported yet
  2546. ***** ^ not supported yet
  2547. ***** ^ not supported yet
  2548. ***** ^ undeclared identifier
  2549. ***** ^ undeclared identifier
  2550. ***** ^ not supported yet
  2551. 1081 IF alias^.hasmemo THEN
  2552. ***** ^ not supported yet
  2553. ***** ^ not supported yet
  2554. 1082 tmpchar := CHR(83H); (* the file has memo fields *)
  2555. ***** ^ undeclared identifier
  2556. ***** ^ not supported yet
  2557. 1083 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2558. ***** ^ not supported yet
  2559. ***** ^ not supported yet
  2560. ***** ^ not supported yet
  2561. ***** ^ not supported yet
  2562. ***** ^ not supported yet
  2563. ***** ^ not supported yet
  2564. ***** ^ not supported yet
  2565. ***** ^ not supported yet
  2566. 1084 Assign(alias^.name,alias^.MemoName);
  2567. ***** ^ not supported yet
  2568. ***** ^ not supported yet
  2569. ***** ^ not supported yet
  2570. ***** ^ not supported yet
  2571. ***** ^ not supported yet
  2572. 1085 i:=Pos( ".", alias^.MemoName);
  2573. ***** ^ not supported yet
  2574. ***** ^ not supported yet
  2575. ***** ^ not supported yet
  2576. 1086 IF i<=HIGH(alias^.MemoName) THEN
  2577. ***** ^ undeclared identifier
  2578. ***** ^ not supported yet
  2579. ***** ^ not supported yet
  2580. 1087 alias^.MemoName[i]:=0C;
  2581. ***** ^ not supported yet
  2582. ***** ^ not supported yet
  2583. ***** ^ not supported yet
  2584. 1088 END;
  2585. 1089 Append(alias^.MemoName,'.DBT' );
  2586. ***** ^ not supported yet
  2587. ***** ^ not supported yet
  2588. ***** ^ not supported yet
  2589. ***** ^ not supported yet
  2590. 1090 PrintMessage(CreateFile(alias^.MemoHandle,alias^.MemoName));
  2591. ***** ^ not supported yet
  2592. ***** ^ not supported yet
  2593. ***** ^ not supported yet
  2594. ***** ^ not supported yet
  2595. ***** ^ not supported yet
  2596. ***** ^ not supported yet
  2597. 1091 alias^.MemoOpen:=TRUE;
  2598. ***** ^ not supported yet
  2599. ***** ^ not supported yet
  2600. 1092 InitMemo(alias^.MemoHandle);
  2601. ***** ^ not supported yet
  2602. ***** ^ not supported yet
  2603. ***** ^ not supported yet
  2604. 1093 ELSE
  2605. 1094 tmpchar := 03C;
  2606. 1095 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2607. ***** ^ not supported yet
  2608. ***** ^ not supported yet
  2609. ***** ^ not supported yet
  2610. ***** ^ not supported yet
  2611. ***** ^ not supported yet
  2612. ***** ^ not supported yet
  2613. ***** ^ not supported yet
  2614. ***** ^ not supported yet
  2615. 1096 (* the file doesn't have memos *)
  2616. 1097 END; (* if *)
  2617. 1098 tmpchar := CHR(year MOD 100);
  2618. ***** ^ undeclared identifier
  2619. ***** ^ not supported yet
  2620. 1099 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2621. ***** ^ not supported yet
  2622. ***** ^ not supported yet
  2623. ***** ^ not supported yet
  2624. ***** ^ not supported yet
  2625. ***** ^ not supported yet
  2626. ***** ^ not supported yet
  2627. ***** ^ not supported yet
  2628. ***** ^ not supported yet
  2629. 1100 (* Write the year *)
  2630. 1101 tmpchar := CHR(month);
  2631. ***** ^ undeclared identifier
  2632. ***** ^ not supported yet
  2633. 1102 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2634. ***** ^ not supported yet
  2635. ***** ^ not supported yet
  2636. ***** ^ not supported yet
  2637. ***** ^ not supported yet
  2638. ***** ^ not supported yet
  2639. ***** ^ not supported yet
  2640. ***** ^ not supported yet
  2641. ***** ^ not supported yet
  2642. 1103 (* Write the month *)
  2643. 1104 tmpchar := CHR(day);
  2644. ***** ^ undeclared identifier
  2645. ***** ^ not supported yet
  2646. 1105 alias^.ErrorCode := BlockWrite(alias^.fileID, ADR(tmpchar), 1);
  2647. ***** ^ not supported yet
  2648. ***** ^ not supported yet
  2649. ***** ^ not supported yet
  2650. ***** ^ not supported yet
  2651. ***** ^ not supported yet
  2652. ***** ^ not supported yet
  2653. ***** ^ not supported yet
  2654. ***** ^ not supported yet
  2655. 1106 (* Write the day *)
  2656. 1107 SetFilePtr(alias^.fileID, FromStart, VAL(LONGINT,8));
  2657. ***** ^ not supported yet
  2658. ***** ^ not supported yet
  2659. ***** ^ not supported yet
  2660. ***** ^ undeclared identifier
  2661. ***** ^ undeclared identifier
  2662. ***** ^ not supported yet
  2663. 1108 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2664. ***** ^ not supported yet
  2665. ***** ^ not supported yet
  2666. ***** ^ not supported yet
  2667. ***** ^ not supported yet
  2668. ***** ^ not supported yet
  2669. 1109 ADR(alias^.headerlength), 2);
  2670. ***** ^ not supported yet
  2671. ***** ^ not supported yet
  2672. ***** ^ not supported yet
  2673. ***** ^ not supported yet
  2674. 1110 alias^.ErrorCode := BlockWrite(alias^.fileID,
  2675. ***** ^ not supported yet
  2676. ***** ^ not supported yet
  2677. ***** ^ not supported yet
  2678. ***** ^ not supported yet
  2679. ***** ^ not supported yet
  2680. 1111 ADR(alias^.length), 2);
  2681. ***** ^ not supported yet
  2682. ***** ^ not supported yet
  2683. ***** ^ not supported yet
  2684. ***** ^ not supported yet
  2685. 1112 alias^.size:=0;
  2686. ***** ^ not supported yet
  2687. ***** ^ not supported yet
  2688. 1113 ALLOCATE(alias^.currentrec,alias^.length);
  2689. ***** ^ not supported yet
  2690. ***** ^ not supported yet
  2691. ***** ^ not supported yet
  2692. ***** ^ not supported yet
  2693. ***** ^ not supported yet
  2694. 1114 SetDBBuffer(alias,1);(* minnimum size *)
  2695. ***** ^ not supported yet
  2696. ***** ^ not supported yet
  2697. ***** ^ not supported yet
  2698. 1115 RETURN 0;
  2699. 1116 END BuildDBF;
  2700. ***** ^ not supported yet
  2701. 1117
  2702. 1118 PROCEDURE DefaultFixUp(alias:DBFile):BOOLEAN;
  2703. 1119 (* what we do here is determine if we want to write
  2704. 1120 in which case we return TRUE. If we need to write we will
  2705. 1121 have to fix up any conflicts in the changed data.
  2706. 1122 Here is what the default does:
  2707. 1123 The record is fixed up on a field by field basis as follows:
  2708. 1124 If all same nochange.
  2709. 1125 If currentrec field # current buffer field then use current.
  2710. 1126 if currentrec field = current buffer field then use disk version;
  2711. 1127 We write always.
  2712. 1128 *)
  2713. 1129
  2714. 1130 VAR
  2715. 1131 field:ARRAY[CurrentRec..ReRead] OF ARRAY[0..(MaxField-1)] OF CHAR;
  2716. ***** ^ undeclared identifier
  2717. ***** ^ undeclared identifier
  2718. ***** ^ undeclared identifier
  2719. ***** ^ not supported yet
  2720. ***** ^ not supported yet
  2721. 1132 RM:RecordModeType;
  2722. ***** ^ undeclared identifier
  2723. 1133 fld:CARDINAL;
  2724. 1134 BEGIN
  2725. 1135 FOR fld:=1 TO alias^.numberoffields DO
  2726. ***** ^ not supported yet
  2727. ***** ^ not supported yet
  2728. 1136 FOR RM:=CurrentRec TO ReRead DO
  2729. ***** ^ FOR needs integer variable and bounds
  2730. ***** ^ undeclared identifier
  2731. ***** ^ undeclared identifier
  2732. 1137 SetRecordMode(alias,RM);
  2733. ***** ^ not supported yet
  2734. ***** ^ not supported yet
  2735. ***** ^ not supported yet
  2736. 1138 GetField(alias,fld,field[RM]);
  2737. ***** ^ not supported yet
  2738. ***** ^ not supported yet
  2739. ***** ^ not supported yet
  2740. ***** ^ not supported yet
  2741. 1139 END (*for*);
  2742. 1140 IF NOT PosUtils.Equal(field[ReRead],field[Buffer])
  2743. ***** ^ not supported yet
  2744. ***** ^ not supported yet
  2745. ***** ^ not supported yet
  2746. ***** ^ undeclared identifier
  2747. ***** ^ not supported yet
  2748. ***** ^ undeclared identifier
  2749. 1141 THEN (* disk and buffer copys are different so we have a problem*)
  2750. 1142 IF NOT PosUtils.Equal(field[ReRead],field[CurrentRec])
  2751. ***** ^ not supported yet
  2752. ***** ^ not supported yet
  2753. ***** ^ not supported yet
  2754. ***** ^ undeclared identifier
  2755. ***** ^ not supported yet
  2756. ***** ^ undeclared identifier
  2757. 1143 THEN (* is new the same as on the disk?*)
  2758. 1144 IF PosUtils.Equal(field[Buffer],field[CurrentRec])
  2759. ***** ^ not supported yet
  2760. ***** ^ not supported yet
  2761. ***** ^ not supported yet
  2762. ***** ^ undeclared identifier
  2763. ***** ^ not supported yet
  2764. ***** ^ undeclared identifier
  2765. 1145 THEN (* did this transaction actually changer the field?*)
  2766. 1146 (* if not set to disk version*)
  2767. 1147 SetRecordMode(alias,CurrentRec);
  2768. ***** ^ not supported yet
  2769. ***** ^ not supported yet
  2770. ***** ^ undeclared identifier
  2771. 1148 Replace(alias,fld,field[ReRead]);
  2772. ***** ^ not supported yet
  2773. ***** ^ not supported yet
  2774. ***** ^ not supported yet
  2775. ***** ^ undeclared identifier
  2776. 1149 END;
  2777. 1150 END;
  2778. 1151 END;
  2779. 1152 END(*for *);
  2780. 1153 SetRecordMode(alias,CurrentRec);
  2781. ***** ^ not supported yet
  2782. ***** ^ not supported yet
  2783. ***** ^ undeclared identifier
  2784. 1154 RETURN TRUE(* this version always does the write*)
  2785. 1155 END DefaultFixUp;
  2786. ***** ^ not supported yet
  2787. 1156
  2788. 1157 END ModBase3.
  2789. ***** ^ not supported yet
  2790. 1631 errors