DBF2DES.LST 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Listing:
  2. 1 MODULE DBF2DES;
  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 (* given a dbase3 file - create a descriptor for it *)
  15. 14
  16. 15 FROM ModBase3 IMPORT UpdateDBFile,WriteDBRec,DeleteRecord,ReadDBRec,
  17. 16 AppendBlank,DBFile,InitDBF,OpenDBF,DefaultFixUp,FieldList,NumberOfFields,
  18. 17 DBFieldPtr;
  19. 18 FROM ScrnTypes IMPORT InitDisplayFrame,DisplayFrame,AFrameName,ImageElement;
  20. 19 FROM DataTypes IMPORT DataElmtRec;
  21. 20 FROM PosUtils IMPORT Present,Pos;
  22. 21 FROM Prompts IMPORT PromptStr;
  23. 22 FROM HandleIO IMPORT FileExists,BlockRead,BlockWrite,CreateFile,CloseHandle;
  24. 23 IMPORT InitCompilerMods;
  25. 24 FROM StrEdit IMPORT CrunchBlanks,DeleteRightJustified,CAPstr,Append,SetLength;
  26. 25 FROM M2Strings IMPORT Length,Assign;
  27. 26 FROM LowLevel IMPORT Fill;
  28. 27 FROM EnvironUtils IMPORT ReadEnvironment,ParsedParam;
  29. 28 FROM SYSTEM IMPORT ADR,SIZE;
  30. 29 IMPORT VWindows;
  31. 30
  32. 31 VAR
  33. 32 FileName : ARRAY[0..30] OF CHAR;
  34. ***** ^ not supported yet
  35. ***** ^ not supported yet
  36. 33 FileName2 : ARRAY[0..20] OF CHAR;
  37. ***** ^ not supported yet
  38. ***** ^ not supported yet
  39. 34 Environ : ARRAY[0..30] OF CHAR;
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. 35 DF : DisplayFrame;
  43. 36 Elmt : DataElmtRec;
  44. 37 DBF : DBFile;
  45. 38 J : CARDINAL;
  46. 39 H : CARDINAL;
  47. 40 FldList : DBFieldPtr;
  48. 41 NbrFlds : CARDINAL;
  49. 42 B : BOOLEAN;
  50. 43 EM : CARDINAL;
  51. 44 PROCEDURE OpenFile();
  52. 45 BEGIN
  53. 46 B := ParsedParam(1,FileName);
  54. ***** ^ not supported yet
  55. ***** ^ not supported yet
  56. 47 IF NOT B
  57. 48 THEN
  58. 49 InitDisplayFrame(DF,VWindows.CurrentWindow);
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. 50 Fill(ADR(FileName),SIZE(FileName),0);
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. 51 PromptStr('Enter name of Database File ',FileName);
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. 52 END;
  75. 53 CrunchBlanks(FileName);
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. 54 IF Present('.',FileName)
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. 55 THEN SetLength(FileName,Pos('.',FileName));
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. ***** ^ not supported yet
  86. 56 END;
  87. 57 Assign(FileName, FileName2);
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. 58 Append(FileName2,'.DBF');
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 59 InitDBF(FileName2,DBF,2,FALSE,FALSE,FALSE,DefaultFixUp);
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. 60 IF NOT OpenDBF(DBF)
  101. ***** ^ not supported yet
  102. ***** ^ not supported yet
  103. 61 THEN
  104. 62 HALT;
  105. ***** ^ undeclared identifier
  106. 63 END;
  107. 64 CrunchBlanks(FileName);
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. 65 Append(FileName,'.DDF');
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 66 EM := CreateFile(H,FileName);
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 67 END OpenFile;
  118. ***** ^ not supported yet
  119. 68
  120. 69 BEGIN
  121. 70
  122. 71 OpenFile();
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. 72 FldList := FieldList(DBF);
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 73 NbrFlds := NumberOfFields(DBF);
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 74 FOR J := 1 TO NbrFlds DO
  133. 75 Assign( FldList^[J].name,Elmt.Name );
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. ***** ^ not supported yet
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. 76 Elmt.Type := FldList^[J].fldtype;
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. 77 Elmt.Len := FldList^[J].size;
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. 78 Elmt.Dec := FldList^[J].decplaces;
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. 79 Elmt.Idx := ' ';
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. 80 Elmt.Desc := '';
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. 81 EM := BlockWrite(H,ADR(Elmt),SIZE(Elmt));
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. 82 END;
  171. 83 EM := CloseHandle(H);
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 84
  175. 85 END DBF2DES.
  176. 89 errors