DATADEF.LST 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. Listing:
  2. 1 MODULE DataDef;
  3. 2 (*
  4. 3 * ModBase
  5. 4 * Release 3.0
  6. 5 * (c) Copyright 1986 - 1991 PMI
  7. 6 Copyright 1988 - 1991 John McMonagle
  8. 7 * P.O. Box 8402
  9. 8 * Green Bay Wi 53308
  10. 9 * All Rights Reserved
  11. 10 * by Ed Ross
  12. 11 *)
  13. 12
  14. 13 FROM Gen IMPORT GenFile;
  15. 14 FROM MakeDBF IMPORT MakeDataBaseFile;
  16. 15 FROM DataTypes IMPORT DataElmtRec,IndexElmtRec,TableName,FldList,IdxList,
  17. 16 DBFName,FullTableName;
  18. 17 FROM GenEdt IMPORT GenEdtFile;
  19. 18 FROM EnvironUtils IMPORT ReadEnvironment;
  20. 19 FROM NumTypes IMPORT Real8;
  21. 20 FROM Str IMPORT Copy;
  22. 21 FROM SmartScreen IMPORT ClearScreen;
  23. 22 FROM Hash IMPORT Define,Insert,KeyFind,HashTable,GetData;
  24. 23 FROM StrConv IMPORT RealToStr,CardinalToStr;
  25. 24 FROM ScrnUtl1 IMPORT GetFieldImageRec;
  26. 25 FROM Tables IMPORT Table,CellValue,GetCell,PutCell,BuildTable,
  27. 26 DefineTextCol,DefineIntegerCol,DefineGroupCol,DefineTable,ControlTable,
  28. 27 DeleteTable,ShowTable,NumberOfRows;
  29. 28 FROM GenLists IMPORT GenList,ListLength,GetElmtAdr,BlockToList,
  30. 29 GetElmt, ListInsertAdr,NewList,DisposeList,ListInsert,ShellSortList;
  31. 30 FROM HandleIO IMPORT BlockRead,BlockWrite,FileExists,
  32. 31 OpenFile,CloseHandle,CreateFile;
  33. 32 FROM StringIO IMPORT ErrorMessage,NoError,WriteEol,outp;
  34. 33 FROM PosUtils IMPORT Equal,Present,Pos;
  35. 34 FROM Prompts IMPORT PromptStr,PromptYN;
  36. 35 FROM M2Strings IMPORT Length,CompareStr;
  37. 36 FROM StrEdit IMPORT CAPstr,CrunchBlanks,Append,SetLength,AssignStr,LowerStr,
  38. 37 DeleteRightJustified,CAPstr;
  39. ***** ^ duplicate identifier
  40. 38 FROM ControlUtils IMPORT AddMenuItem,ChangeField,ReadInput,Control;
  41. 39 FROM DirManager IMPORT DirToFrame;
  42. 40 FROM Drectory IMPORT GetDrivePathAndName,GetCurrentDir,GetDefaultDrive,
  43. 41 SetDefaultDrive,ChDir;
  44. 42 FROM FramePainter IMPORT ShowDisplayFrame;
  45. 43 FROM InputManager IMPORT ControlFrame;
  46. 44 FROM ScrnTypes IMPORT InitDisplayFrame,DisplayFrame,AFrameName,ImageElement;
  47. 45 FROM ScrnUtl2 IMPORT CloseDisplayFrame;
  48. 46 FROM LowLevel IMPORT Fill;
  49. 47 FROM ModBase3 IMPORT DBFile, DBFieldDescriptor,AppendBlank,GetField,
  50. 48 CloseDBF,WriteDBRec,BuildDBF;
  51. 49 FROM DBIndxes IMPORT DBIndex,InitIndex,CloseIndex,BuildIndex,AddRecord,
  52. 50 InitCompIndex,BuildCompIndex;
  53. 51 FROM SYSTEM IMPORT TSIZE,ADR,ADDRESS;
  54. 52 IMPORT VWindows;
  55. 53 FROM VStorage IMPORT DosAlloc,DosDealloc;
  56. 54 FROM DBUtils IMPORT GetSelected,SelectFromScreen;
  57. 55 IMPORT InitCompilerMods;
  58. 56
  59. 57
  60. 58
  61. 59
  62. 60 VAR
  63. 61 DF : DisplayFrame;
  64. 62 Tab : Table;
  65. 63 SerList : GenList;
  66. 64 FileName : ARRAY[0..20] OF CHAR;
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. 65 Card : CARDINAL;
  70. 66 EM : ErrorMessage;
  71. 67 Code,J : CARDINAL;
  72. 68 Bool : BOOLEAN;
  73. 69 Environ : ARRAY[0..60] OF CHAR;
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 70
  77. 71 (* Table should look like this
  78. 72 1234567890123456789012345678901234567890123456789012345678901234567890123456
  79. 73 1 2 3 4 5 6 7
  80. 74 Index Name Type Length Dec Description *)
  81. 75
  82. 76
  83. 77 PROCEDURE SetupTable();
  84. 78 BEGIN
  85. 79
  86. 80 DefineTable(Tab,'Data Definitions');
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. 81 DefineTextCol(Tab,3,1,'Index',FALSE);
  91. ***** ^ not supported yet
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 82 DefineTextCol(Tab,10,10,'Name',FALSE);
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. 83 DefineTextCol(Tab,22,1,'Type',FALSE);
  101. ***** ^ not supported yet
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. 84 DefineIntegerCol(Tab,27,5,'Length',0,9999);
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. 85 DefineIntegerCol(Tab,35,2,'Dec',0,99);
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. 86 DefineTextCol(Tab,40,35,'Desc',FALSE);
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. 87 END SetupTable;
  121. ***** ^ not supported yet
  122. 88
  123. 89
  124. 90
  125. 91
  126. 92
  127. 93
  128. 94
  129. 95 PROCEDURE GetDataElmts(FileName : ARRAY OF CHAR);
  130. ***** ^ not supported yet
  131. 96
  132. 97 (* return a list of all products *)
  133. 98 VAR
  134. 99 H : CARDINAL;
  135. 100 FldDesc: DataElmtRec;
  136. 101 EM : ErrorMessage;
  137. 102 Size : CARDINAL;
  138. 103 J : CARDINAL;
  139. 104 BEGIN
  140. 105 IF FileExists(FileName)
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. 106 THEN
  144. 107 EM := OpenFile(H,FileName);
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 108 EM := BlockRead(H,ADR(FldDesc),SIZE(FldDesc)); (* get the first*)
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. ***** ^ undeclared identifier
  154. ***** ^ not supported yet
  155. 109 WHILE (EM = 0) DO
  156. ***** ^ not supported yet
  157. 110 ListInsert(FldDesc,1,FldList,1000); (* put at the end*)
  158. ***** ^ not supported yet
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. 111 EM := BlockRead(H,ADR(FldDesc),SIZE(FldDesc));
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. ***** ^ undeclared identifier
  168. ***** ^ not supported yet
  169. 112 END; (* end while *)
  170. 113 EM := CloseHandle(H);
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 114 END;
  175. 115 END GetDataElmts;
  176. ***** ^ not supported yet
  177. 116
  178. 117
  179. 118 PROCEDURE UpdateDataElmtsFile(FileName : ARRAY OF CHAR);
  180. ***** ^ not supported yet
  181. 119 VAR
  182. 120 Row : CARDINAL;
  183. 121 FldDesc : DataElmtRec;
  184. 122 Cell : CellValue;
  185. 123 Code,Size : CARDINAL;
  186. 124 H : CARDINAL;
  187. 125 EM : ErrorMessage;
  188. 126 BEGIN
  189. 127 DisposeList(FldList); (* start the list over *)
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 128 NewList(FldList);
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. 129 EM := CreateFile(H,FileName);
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 130 FOR Row := 1 TO NumberOfRows(Tab) DO (* read the screen & get elemts*)
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. 131 GetCell(Tab,1,Row,Cell);
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. 132 FldDesc.Idx := Cell.Str[0]; (* indexed field*)
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. 133 CAPstr(FldDesc.Idx);
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 134
  217. 135 GetCell(Tab,2,Row,Cell); (* fld name *)
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 136 CAPstr(Cell.Str);
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. 137 Copy(FldDesc.Name , Cell.Str);
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 138
  232. 139 GetCell(Tab, 3,Row,Cell); (* Fld Type *)
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. 140 CAPstr(Cell.Str);
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. ***** ^ not supported yet
  240. 141 FldDesc.Type := Cell.Str[0];
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. ***** ^ not supported yet
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 142
  247. 143 GetCell(Tab,4,Row,Cell); (* fld lenght *)
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 144 FldDesc.Len := Cell.I;
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 145
  257. 146 GetCell(Tab,5,Row,Cell); (* dec positions *)
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 147 FldDesc.Dec := Cell.I;
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. 148
  267. 149 GetCell(Tab,6,Row,Cell);
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. ***** ^ not supported yet
  271. 150 Copy(FldDesc.Desc , Cell.Str); (* description *)
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 151
  278. 152 IF (FldDesc.Name[0] # ' ') AND(FldDesc.Idx # 'D')
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. 153 THEN
  285. 154 ListInsert(FldDesc,1,FldList,1000); (* put at the end*)
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. 155 EM := BlockWrite(H,ADR(FldDesc),SIZE(FldDesc));
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. ***** ^ undeclared identifier
  296. ***** ^ not supported yet
  297. 156 END;
  298. 157 END; (* end for row *)
  299. 158 EM := CloseHandle(H);
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. 159
  304. 160 END UpdateDataElmtsFile;
  305. ***** ^ not supported yet
  306. 161
  307. 162
  308. 163
  309. 164 PROCEDURE DefineDataElmts(TableName : ARRAY OF CHAR);
  310. ***** ^ not supported yet
  311. 165 VAR
  312. 166 J : CARDINAL;
  313. 167 Cell : CellValue;
  314. 168 Row : CARDINAL;
  315. 169 DataElmt : POINTER TO DataElmtRec;
  316. ***** ^ not supported yet
  317. 170 Nbr : ARRAY[0..4] OF CHAR;
  318. ***** ^ not supported yet
  319. ***** ^ not supported yet
  320. 171 Size,Code : CARDINAL;
  321. 172 BEGIN
  322. 173 BuildTable(Tab,ListLength(FldList)+20); (* increase table size by 20*)
  323. ***** ^ not supported yet
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. ***** ^ not supported yet
  328. 174 FOR Row := 1 TO ListLength(FldList) DO
  329. ***** ^ not supported yet
  330. ***** ^ not supported yet
  331. 175 GetElmtAdr(FldList,Row,DataElmt,Size,Code); (* get address of data elmt *)
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. 176 Cell.Str[0] := DataElmt^.Idx;
  337. ***** ^ not supported yet
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. 177 Cell.Str[1] := 0C;
  343. ***** ^ not supported yet
  344. ***** ^ not supported yet
  345. ***** ^ not supported yet
  346. 178 PutCell(Tab,1,Row,Cell); (* indexed *)
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. ***** ^ not supported yet
  350. 179
  351. 180 Copy(Cell.Str , DataElmt^.Name); (* field names *)
  352. ***** ^ not supported yet
  353. ***** ^ not supported yet
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. ***** ^ not supported yet
  357. 181 PutCell(Tab,2,Row,Cell);
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. ***** ^ not supported yet
  361. 182
  362. 183 Cell.Str[0] := DataElmt^.Type; (* field type *)
  363. ***** ^ not supported yet
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. 184 Cell.Str[1] := 0C;
  369. ***** ^ not supported yet
  370. ***** ^ not supported yet
  371. ***** ^ not supported yet
  372. 185 PutCell(Tab,3,Row,Cell);
  373. ***** ^ not supported yet
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. 186
  377. 187 Cell.I := DataElmt^.Len; (* field length *)
  378. ***** ^ not supported yet
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. 188 PutCell(Tab,4,Row,Cell);
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. 189
  387. 190 Cell.I := DataElmt^.Dec; (* decimal positions *)
  388. ***** ^ not supported yet
  389. ***** ^ not supported yet
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. 191 PutCell(Tab,5,Row,Cell);
  393. ***** ^ not supported yet
  394. ***** ^ not supported yet
  395. ***** ^ not supported yet
  396. 192
  397. 193 Copy(Cell.Str , DataElmt^.Desc); (* Description *)
  398. ***** ^ not supported yet
  399. ***** ^ not supported yet
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. 194 PutCell(Tab,6,Row,Cell);
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. 195
  408. 196 END;
  409. 197 ControlTable(Tab,2,5,78,20);
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 198
  414. 199
  415. 200 END DefineDataElmts;
  416. ***** ^ not supported yet
  417. 201
  418. 202
  419. 203
  420. 204
  421. 205 PROCEDURE SelectTable(VAR TableName : ARRAY OF CHAR);
  422. ***** ^ not supported yet
  423. 206 VAR
  424. 207 DF : DisplayFrame;
  425. 208 NxtFrame : AFrameName;
  426. 209 ReturnVal: ARRAY[0..40] OF CHAR;
  427. ***** ^ not supported yet
  428. ***** ^ not supported yet
  429. 210 Row : CARDINAL;
  430. 211 Drive : CHAR;
  431. 212 Card : CARDINAL;
  432. 213 PathName : ARRAY[0..63] OF CHAR;
  433. ***** ^ not supported yet
  434. ***** ^ not supported yet
  435. 214 Str : ARRAY[0..12] OF CHAR;
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 215 FileName : AFrameName;
  439. 216
  440. 217 ImageRec: ImageElement;
  441. 218
  442. 219 BEGIN
  443. 220 InitDisplayFrame(DF,VWindows.CurrentWindow);
  444. ***** ^ not supported yet
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. 221 DF^.action := 'I';
  449. ***** ^ not supported yet
  450. ***** ^ not supported yet
  451. 222 AddMenuItem(DF,2,2,'NEW',30,1,'NEW');
  452. ***** ^ not supported yet
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. 223 DF^.headline := 3;
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. 224 EM := DirToFrame('*.ddf',DF,1); (* find data definition file *)
  460. ***** ^ not supported yet
  461. ***** ^ not supported yet
  462. ***** ^ not supported yet
  463. ***** ^ not supported yet
  464. ***** ^ not supported yet
  465. 225
  466. 226 ControlFrame(DF,1,'',TRUE,FileName);
  467. ***** ^ not supported yet
  468. ***** ^ not supported yet
  469. ***** ^ not supported yet
  470. 227 GetFieldImageRec( DF, DF^.CurrentField, ImageRec );
  471. ***** ^ not supported yet
  472. ***** ^ not supported yet
  473. ***** ^ not supported yet
  474. ***** ^ not supported yet
  475. ***** ^ not supported yet
  476. 228 Copy(FileName , ImageRec.text);
  477. ***** ^ not supported yet
  478. ***** ^ not supported yet
  479. ***** ^ not supported yet
  480. ***** ^ not supported yet
  481. 229 Copy(TableName , FileName);
  482. ***** ^ not supported yet
  483. ***** ^ not supported yet
  484. ***** ^ not supported yet
  485. 230 CrunchBlanks(TableName);
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. 231 IF Equal(TableName,'NEW')
  489. ***** ^ not supported yet
  490. ***** ^ not supported yet
  491. ***** ^ not supported yet
  492. 232 THEN
  493. 233 PromptStr('Enter Table Name ',TableName);
  494. ***** ^ not supported yet
  495. ***** ^ not supported yet
  496. ***** ^ not supported yet
  497. 234 CrunchBlanks(TableName);
  498. ***** ^ not supported yet
  499. ***** ^ not supported yet
  500. 235 IF Present('.',TableName)
  501. ***** ^ not supported yet
  502. ***** ^ not supported yet
  503. 236 THEN
  504. 237 SetLength(TableName,Pos('.',TableName)); (* make sure .ddf type*)
  505. ***** ^ not supported yet
  506. ***** ^ not supported yet
  507. ***** ^ not supported yet
  508. ***** ^ not supported yet
  509. 238 END;
  510. 239 Append(TableName,'.DDF')
  511. ***** ^ not supported yet
  512. ***** ^ not supported yet
  513. ***** ^ not supported yet
  514. 240 END;
  515. 241 Drive := GetDefaultDrive();
  516. ***** ^ not supported yet
  517. ***** ^ not supported yet
  518. 242 Card := GetCurrentDir(Drive,PathName);
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. 243 FullTableName[0] := Drive;
  522. ***** ^ not supported yet
  523. ***** ^ not supported yet
  524. 244 FullTableName[1] := 0C;
  525. ***** ^ not supported yet
  526. ***** ^ not supported yet
  527. 245 Append(FullTableName,':');
  528. ***** ^ not supported yet
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. 246 Append(FullTableName,PathName);
  532. ***** ^ not supported yet
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. 247 IF FullTableName[Length(FullTableName)-1] <> '\'
  536. ***** ^ not supported yet
  537. ***** ^ not supported yet
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. 248 THEN Append(FullTableName,'\');
  541. ***** ^ not supported yet
  542. ***** ^ not supported yet
  543. ***** ^ not supported yet
  544. 249 END;
  545. 250 Append(FullTableName,TableName);
  546. ***** ^ not supported yet
  547. ***** ^ not supported yet
  548. ***** ^ not supported yet
  549. 251 END SelectTable;
  550. ***** ^ not supported yet
  551. 252
  552. 253 PROCEDURE FixLists();
  553. 254
  554. 255 (* go through the list of fields and create a list of indexes *)
  555. 256 (* Give each index a accelerator key (highlighted key on menu) *)
  556. 257 (* by checking each letter in the field for an unused letter *)
  557. 258 (* the index will be given an name = Fieldname+'IDX' *)
  558. 259 (* the data base will be given the name of the table + 'DBF' *)
  559. 260
  560. 261 PROCEDURE MakeRep(VAR Item : DataElmtRec);
  561. 262 VAR Str : ARRAY [0..10] OF CHAR;
  562. ***** ^ not supported yet
  563. ***** ^ not supported yet
  564. 263 BEGIN
  565. 264 CASE Item.Type OF
  566. ***** ^ not supported yet
  567. ***** ^ not supported yet
  568. 265 'C' : IF Item.Len = 1
  569. ***** ^ not supported yet
  570. ***** ^ not supported yet
  571. 266 THEN Item.RecType := 'CHAR'
  572. ***** ^ not supported yet
  573. ***** ^ not supported yet
  574. ***** ^ not supported yet
  575. 267 ELSE Item.RecType := 'ARRAY[0..';
  576. ***** ^ not supported yet
  577. ***** ^ not supported yet
  578. ***** ^ not supported yet
  579. 268 CardinalToStr(Item.Len,3,Str);
  580. ***** ^ not supported yet
  581. ***** ^ not supported yet
  582. ***** ^ not supported yet
  583. ***** ^ not supported yet
  584. 269 Append(Item.RecType,Str);
  585. ***** ^ not supported yet
  586. ***** ^ not supported yet
  587. ***** ^ not supported yet
  588. ***** ^ not supported yet
  589. 270 Append(Item.RecType,'] OF CHAR;');
  590. ***** ^ not supported yet
  591. ***** ^ not supported yet
  592. ***** ^ not supported yet
  593. ***** ^ not supported yet
  594. 271 END;
  595. 272 |'N' : IF (Item.Dec = 0 ) AND (Item.Len < 6)
  596. ***** ^ not supported yet
  597. ***** ^ not supported yet
  598. ***** ^ not supported yet
  599. ***** ^ not supported yet
  600. 273 THEN Item.RecType := 'CARDINAL';
  601. ***** ^ not supported yet
  602. ***** ^ not supported yet
  603. ***** ^ not supported yet
  604. 274 ELSIF (Item.Dec = 0)
  605. ***** ^ not supported yet
  606. ***** ^ not supported yet
  607. 275 THEN Item.RecType := 'LONGINT';
  608. ***** ^ not supported yet
  609. ***** ^ not supported yet
  610. ***** ^ not supported yet
  611. 276 ELSE Item.RecType := 'Real8';
  612. ***** ^ not supported yet
  613. ***** ^ not supported yet
  614. ***** ^ not supported yet
  615. 277 END;
  616. 278 |'M' : Item.RecType := 'Memo';
  617. ***** ^ not supported yet
  618. ***** ^ not supported yet
  619. ***** ^ not supported yet
  620. 279 |'D' : Item.RecType := 'Date';
  621. ***** ^ not supported yet
  622. ***** ^ not supported yet
  623. ***** ^ not supported yet
  624. 280
  625. 281 |'L' : Item.RecType := 'BOOLEAN';
  626. ***** ^ not supported yet
  627. ***** ^ not supported yet
  628. ***** ^ not supported yet
  629. 282 END;
  630. 283 END MakeRep;
  631. ***** ^ not supported yet
  632. 284
  633. 285 VAR
  634. 286 J : CARDINAL;
  635. 287 Item : POINTER TO DataElmtRec;
  636. ***** ^ not supported yet
  637. 288 IdxItem : IndexElmtRec;
  638. 289 Size,Code : CARDINAL;
  639. 290 CharSet : SET OF CHAR;
  640. ***** ^ not supported yet
  641. 291 C : CHAR;
  642. 292 K : CARDINAL;
  643. 293 BEGIN
  644. 294 SetLength(TableName,Pos('.',TableName)); (* get rid of file type in name*)
  645. ***** ^ not supported yet
  646. ***** ^ not supported yet
  647. ***** ^ not supported yet
  648. ***** ^ not supported yet
  649. 295 LowerStr(TableName);
  650. ***** ^ not supported yet
  651. ***** ^ not supported yet
  652. 296 CAPstr(TableName[0]);
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. ***** ^ not supported yet
  656. 297 Copy(DBFName , TableName);
  657. ***** ^ not supported yet
  658. ***** ^ not supported yet
  659. ***** ^ not supported yet
  660. 298 Append(DBFName,'DBF');
  661. ***** ^ not supported yet
  662. ***** ^ not supported yet
  663. ***** ^ not supported yet
  664. 299 (* the index fields will become menu items in
  665. 300 the generated EDT file. Each menu item will
  666. 301 have a selection character highlighted -
  667. 302 Find an unused character in the index name to
  668. 303 highlight *)
  669. 304
  670. 305 CharSet := CharSet/CharSet; (* Charset = the set of used characters *)
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. ***** ^ not supported yet
  674. 306
  675. 307 INCL(CharSet,'F'); (* First record*)
  676. ***** ^ undeclared identifier
  677. ***** ^ not supported yet
  678. ***** ^ not supported yet
  679. 308 INCL(CharSet,'L'); (* Last record *)
  680. ***** ^ undeclared identifier
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. 309 INCL(CharSet,'N'); (* Next record *)
  684. ***** ^ undeclared identifier
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 310 INCL(CharSet,'P'); (* Prev record *)
  688. ***** ^ undeclared identifier
  689. ***** ^ not supported yet
  690. ***** ^ not supported yet
  691. 311 INCL(CharSet,'A'); (* Add Record *)
  692. ***** ^ undeclared identifier
  693. ***** ^ not supported yet
  694. ***** ^ not supported yet
  695. 312 INCL(CharSet,'Q'); (* The oddballs*)
  696. ***** ^ undeclared identifier
  697. ***** ^ not supported yet
  698. ***** ^ not supported yet
  699. 313 NewList(IdxList);
  700. ***** ^ not supported yet
  701. ***** ^ not supported yet
  702. 314 FOR J := 1 TO ListLength(FldList) DO
  703. ***** ^ not supported yet
  704. ***** ^ not supported yet
  705. 315 GetElmtAdr(FldList,J,Item,Size,Code);
  706. ***** ^ not supported yet
  707. ***** ^ not supported yet
  708. ***** ^ not supported yet
  709. ***** ^ not supported yet
  710. 316 MakeRep(Item^);
  711. ***** ^ not supported yet
  712. ***** ^ not supported yet
  713. 317 CrunchBlanks(Item^.Desc);
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. 318 IF Item^.Idx = 'I'
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. 319 THEN
  721. 320 CrunchBlanks(Item^.Name);
  722. ***** ^ not supported yet
  723. ***** ^ not supported yet
  724. ***** ^ not supported yet
  725. 321 Copy(IdxItem.FldName , Item^.Name);
  726. ***** ^ not supported yet
  727. ***** ^ not supported yet
  728. ***** ^ not supported yet
  729. ***** ^ not supported yet
  730. ***** ^ not supported yet
  731. 322 LowerStr(IdxItem.FldName);
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. 323 CAPstr(IdxItem.FldName[0]);
  736. ***** ^ not supported yet
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. 324 Copy(IdxItem.EdtName , IdxItem.FldName);
  741. ***** ^ not supported yet
  742. ***** ^ not supported yet
  743. ***** ^ not supported yet
  744. ***** ^ not supported yet
  745. ***** ^ not supported yet
  746. 325 Copy(IdxItem.IdxName , IdxItem.FldName);
  747. ***** ^ not supported yet
  748. ***** ^ not supported yet
  749. ***** ^ not supported yet
  750. ***** ^ not supported yet
  751. ***** ^ not supported yet
  752. 326 IF Equal(Item^.RecType ,'Real8')
  753. ***** ^ not supported yet
  754. ***** ^ not supported yet
  755. ***** ^ not supported yet
  756. ***** ^ not supported yet
  757. 327 THEN IdxItem.IndexType := 'R' (* real type *)
  758. ***** ^ not supported yet
  759. ***** ^ not supported yet
  760. 328 ELSIF Equal(Item^.RecType, 'CARDINAL')
  761. ***** ^ not supported yet
  762. ***** ^ not supported yet
  763. ***** ^ not supported yet
  764. ***** ^ not supported yet
  765. 329 THEN IdxItem.IndexType := 'N' (* cardinal type *)
  766. ***** ^ not supported yet
  767. ***** ^ not supported yet
  768. 330 ELSE IdxItem.IndexType := 'C'; (* everything else is char*)
  769. ***** ^ not supported yet
  770. ***** ^ not supported yet
  771. 331 END;
  772. 332
  773. 333 IF Length(IdxItem.IdxName) > 8
  774. ***** ^ not supported yet
  775. ***** ^ not supported yet
  776. ***** ^ not supported yet
  777. 334 THEN
  778. 335 IdxItem.IdxName[8] := 0C; (* set to max of 8 *)
  779. ***** ^ not supported yet
  780. ***** ^ not supported yet
  781. ***** ^ not supported yet
  782. 336 END;
  783. 337 CrunchBlanks(IdxItem.EdtName);
  784. ***** ^ not supported yet
  785. ***** ^ not supported yet
  786. ***** ^ not supported yet
  787. 338
  788. 339 K := 0;
  789. 340 LOOP
  790. 341 IF K > Length(IdxItem.FldName)
  791. ***** ^ not supported yet
  792. ***** ^ not supported yet
  793. ***** ^ not supported yet
  794. 342 THEN
  795. 343 CAPstr(IdxItem.FldName[0]); (* this will cause a compiler error*)
  796. ***** ^ not supported yet
  797. ***** ^ not supported yet
  798. ***** ^ not supported yet
  799. ***** ^ not supported yet
  800. 344 IdxItem.HighLight := 'Q';
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. 345 EXIT; (* in the generated program CASE stm*)
  804. 346 END;
  805. 347 C := IdxItem.FldName[K];
  806. ***** ^ not supported yet
  807. ***** ^ not supported yet
  808. ***** ^ not supported yet
  809. 348 CAPstr(C);
  810. ***** ^ not supported yet
  811. ***** ^ not supported yet
  812. 349 IF NOT (C IN CharSet)
  813. ***** ^ not supported yet
  814. 350 THEN
  815. 351 CAPstr(IdxItem.EdtName[K]); (* make highlighted char *)
  816. ***** ^ not supported yet
  817. ***** ^ not supported yet
  818. ***** ^ not supported yet
  819. ***** ^ not supported yet
  820. 352 INCL(CharSet,IdxItem.EdtName[K]); (* add to set of used char*)
  821. ***** ^ undeclared identifier
  822. ***** ^ not supported yet
  823. ***** ^ not supported yet
  824. ***** ^ not supported yet
  825. ***** ^ not supported yet
  826. 353 IdxItem.HighLight := IdxItem.EdtName[K];
  827. ***** ^ not supported yet
  828. ***** ^ not supported yet
  829. ***** ^ not supported yet
  830. ***** ^ not supported yet
  831. ***** ^ not supported yet
  832. 354 EXIT;
  833. 355 END;
  834. 356 INC(K);
  835. ***** ^ undeclared identifier
  836. ***** ^ not supported yet
  837. 357 END;
  838. 358 ListInsert(IdxItem,1,IdxList,100);
  839. ***** ^ not supported yet
  840. ***** ^ not supported yet
  841. ***** ^ not supported yet
  842. ***** ^ not supported yet
  843. 359 END;
  844. 360 END; (* end for j *)
  845. 361
  846. 362 END FixLists;
  847. ***** ^ not supported yet
  848. 363
  849. 364
  850. 365 BEGIN
  851. 366
  852. 367
  853. 368 NewList(FldList);
  854. ***** ^ not supported yet
  855. ***** ^ not supported yet
  856. 369 SelectTable(TableName); (* Get name of table *)
  857. ***** ^ not supported yet
  858. ***** ^ not supported yet
  859. 370
  860. 371 GetDataElmts(FullTableName); (* get the elements from the file *)
  861. ***** ^ not supported yet
  862. ***** ^ not supported yet
  863. 372 ClearScreen();
  864. ***** ^ not supported yet
  865. ***** ^ not supported yet
  866. 373 IF PromptYN('Update Table ?',DF)
  867. ***** ^ not supported yet
  868. ***** ^ not supported yet
  869. ***** ^ not supported yet
  870. 374 THEN
  871. 375 ClearScreen();
  872. ***** ^ not supported yet
  873. ***** ^ not supported yet
  874. 376 WriteEol(outp,
  875. ***** ^ not supported yet
  876. ***** ^ not supported yet
  877. 377 ' ....This may take a few minutes to create the data structures ..');
  878. ***** ^ not supported yet
  879. 378 SetupTable();
  880. ***** ^ not supported yet
  881. ***** ^ not supported yet
  882. 379 DefineDataElmts(TableName);
  883. ***** ^ not supported yet
  884. ***** ^ not supported yet
  885. 380 UpdateDataElmtsFile(FullTableName);
  886. ***** ^ not supported yet
  887. ***** ^ not supported yet
  888. 381 END;
  889. 382 FixLists();
  890. ***** ^ not supported yet
  891. ***** ^ not supported yet
  892. 383 IF PromptYN('Create New database file ?',DF)
  893. ***** ^ not supported yet
  894. ***** ^ not supported yet
  895. ***** ^ not supported yet
  896. 384 THEN
  897. 385 ClearScreen();
  898. ***** ^ not supported yet
  899. ***** ^ not supported yet
  900. 386 MakeDataBaseFile(FldList);
  901. ***** ^ not supported yet
  902. ***** ^ not supported yet
  903. 387 END;
  904. 388 (* GenCode(TableName,FldList); *)
  905. 389 IF PromptYN('Create the EDT file?',DF)
  906. ***** ^ not supported yet
  907. ***** ^ not supported yet
  908. ***** ^ not supported yet
  909. 390 THEN
  910. 391 GenEdtFile(TableName,FldList,IdxList);
  911. ***** ^ not supported yet
  912. ***** ^ not supported yet
  913. ***** ^ not supported yet
  914. ***** ^ not supported yet
  915. 392 END;
  916. 393 IF PromptYN('Generate Gode ?',DF)
  917. ***** ^ not supported yet
  918. ***** ^ not supported yet
  919. ***** ^ not supported yet
  920. 394 THEN
  921. 395 ClearScreen();
  922. ***** ^ not supported yet
  923. ***** ^ not supported yet
  924. 396 InitDisplayFrame(DF,VWindows.CurrentWindow);
  925. ***** ^ not supported yet
  926. ***** ^ not supported yet
  927. ***** ^ not supported yet
  928. ***** ^ not supported yet
  929. 397 DF^.action := 'I';
  930. ***** ^ not supported yet
  931. ***** ^ not supported yet
  932. 398 DF^.headline := 2;
  933. ***** ^ not supported yet
  934. ***** ^ not supported yet
  935. 399 EM := DirToFrame('*.TPL',DF,1); (* find data definition file *)
  936. ***** ^ not supported yet
  937. ***** ^ not supported yet
  938. ***** ^ not supported yet
  939. ***** ^ not supported yet
  940. ***** ^ not supported yet
  941. 400 SelectFromScreen(DF);
  942. ***** ^ not supported yet
  943. ***** ^ not supported yet
  944. 401 GetSelected(SerList,DF);
  945. ***** ^ not supported yet
  946. ***** ^ not supported yet
  947. ***** ^ not supported yet
  948. 402 FOR J := 1 TO ListLength(SerList) DO
  949. ***** ^ not supported yet
  950. ***** ^ not supported yet
  951. 403 GetElmt(SerList,J,FileName,Code);
  952. ***** ^ not supported yet
  953. ***** ^ not supported yet
  954. ***** ^ not supported yet
  955. ***** ^ not supported yet
  956. 404 GenFile(FileName);
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. 405 END;
  960. 406 END;
  961. 407 ClearScreen();
  962. ***** ^ not supported yet
  963. ***** ^ not supported yet
  964. 408 END DataDef.
  965. 555 errors