DBFIELDS.LST 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. Listing:
  2. 1 IMPLEMENTATION MODULE DBFields;
  3. 2
  4. 3 (*
  5. 4 * ModBase
  6. 5 * Release 3.0
  7. 6 * (c) Copyright 1986 - 1991 John McMonagle & Donald G. Fletcher
  8. 7 * (c) Copyright 1986 - 1991 PMI
  9. 8 * P.O. Box 8402
  10. 9 * Green Bay Wi 53308
  11. 10 * All Rights Reserved
  12. 11 *
  13. 12 *)
  14. 13 IMPORT ModBase3;
  15. 14 FROM ModBase3 IMPORT DBFile, GetField,FieldList,DBFieldPtr;
  16. ***** ^ duplicate identifier
  17. 15 FROM DateFunctions IMPORT Date;
  18. 16 FROM StrConv IMPORT RealToStr, StrToReal;
  19. 17 FROM NumTypes IMPORT Real8;
  20. 18
  21. 19 CONST MaxDigits = 18;
  22. 20
  23. 21 PROCEDURE DataFormatToDate(dbstring: ARRAY OF CHAR; VAR d: Date);
  24. ***** ^ not supported yet
  25. 22 (* Converts a string from dbase data format (yyyymmdd) to Date *)
  26. 23 VAR i: CARDINAL;
  27. 24 BEGIN
  28. 25 IF dbstring[0] = ' ' THEN
  29. ***** ^ not supported yet
  30. ***** ^ not supported yet
  31. 26 d.yr := 0; d.mo := 0; d.day := 0
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. ***** ^ not supported yet
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. ***** ^ not supported yet
  38. 27 ELSE
  39. 28 d.yr := 0;
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. 29 FOR i := 0 TO 3 DO
  43. 30 d.yr := (d.yr * 10) + (ORD(dbstring[i])-60B)
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. ***** ^ not supported yet
  48. ***** ^ undeclared identifier
  49. ***** ^ not supported yet
  50. ***** ^ not supported yet
  51. 31 END;
  52. 32 d.mo := (ORD(dbstring[4])-60B) * 10 + (ORD(dbstring[5])-60B);
  53. ***** ^ not supported yet
  54. ***** ^ not supported yet
  55. ***** ^ undeclared identifier
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. ***** ^ undeclared identifier
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. 33 d.day := (ORD(dbstring[6])-60B) * 10 + (ORD(dbstring[7])-60B);
  62. ***** ^ not supported yet
  63. ***** ^ not supported yet
  64. ***** ^ undeclared identifier
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. ***** ^ undeclared identifier
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. 34 END;
  71. 35 END DataFormatToDate;
  72. ***** ^ not supported yet
  73. 36
  74. 37 PROCEDURE DateToDataFormat(d: Date; VAR datestring: ARRAY OF CHAR);
  75. ***** ^ not supported yet
  76. 38 BEGIN
  77. 39 datestring[0] := CHR(d.yr DIV 1000 + 60B);
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ undeclared identifier
  81. ***** ^ not supported yet
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. 40 d.yr := d.yr MOD 1000;
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. 41 datestring[1] := CHR(d.yr DIV 100 + 60B);
  90. ***** ^ not supported yet
  91. ***** ^ not supported yet
  92. ***** ^ undeclared identifier
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. 42 d.yr := d.yr MOD 100;
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. 43 datestring[2] := CHR(d.yr DIV 10 + 60B);
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ undeclared identifier
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. 44 datestring[3] := CHR(d.yr MOD 10 + 60B);
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ undeclared identifier
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. 45 datestring[4] := CHR(d.mo DIV 10 + 60B);
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ undeclared identifier
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. 46 datestring[5] := CHR(d.mo MOD 10 + 60B);
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. ***** ^ undeclared identifier
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 47 datestring[6] := CHR(d.day DIV 10 + 60B);
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. ***** ^ undeclared identifier
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. 48 datestring[7] := CHR(d.day MOD 10 + 60B);
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ undeclared identifier
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. 49 IF HIGH(datestring) > 7 THEN
  144. ***** ^ undeclared identifier
  145. ***** ^ not supported yet
  146. 50 datestring[8] := 0C;
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. 51 END;
  150. 52 END DateToDataFormat;
  151. ***** ^ not supported yet
  152. 53
  153. 54 PROCEDURE GetDateField(VAR alias: DBFile; fieldnum: CARDINAL;
  154. 55 VAR d: Date);
  155. 56 VAR datestr: ARRAY [0..7] OF CHAR;
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. 57 BEGIN
  159. 58 GetField(alias, fieldnum, datestr);
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. 59 DataFormatToDate(datestr, d);
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 60 END GetDateField;
  168. ***** ^ not supported yet
  169. 61
  170. 62 PROCEDURE GetLogicalField(VAR alias: DBFile; fieldnum: CARDINAL;
  171. 63 VAR l: BOOLEAN);
  172. 64 VAR lstring: ARRAY [0..1] OF CHAR;
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. 65 BEGIN
  176. 66 GetField(alias, fieldnum, lstring);
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. 67 IF (CAP(lstring[0]) = 'Y') OR (CAP(lstring[0]) = 'T') THEN
  181. ***** ^ undeclared identifier
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. ***** ^ undeclared identifier
  185. ***** ^ not supported yet
  186. ***** ^ not supported yet
  187. 68 l := TRUE
  188. 69 ELSE
  189. 70 l := FALSE
  190. 71 END;
  191. 72 END GetLogicalField;
  192. ***** ^ not supported yet
  193. 73
  194. 74 PROCEDURE GetNumField(VAR alias: DBFile; fieldnum: CARDINAL; VAR
  195. 75 n: Real8);
  196. 76 VAR nstring: ARRAY [1..MaxDigits] OF CHAR;
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 77 ok: BOOLEAN;
  200. 78 BEGIN
  201. 79 GetField(alias, fieldnum, nstring);
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. 80 ok:=StrToReal(nstring,0, n)
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. 81 END GetNumField;
  210. ***** ^ not supported yet
  211. 82
  212. 83 PROCEDURE Replace(VAR alias: DBFile; fieldnum: CARDINAL; s: ARRAY
  213. 84 OF CHAR);
  214. ***** ^ not supported yet
  215. 85 BEGIN
  216. 86 ModBase3.Replace(alias,fieldnum,s);
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 87 END Replace;
  222. ***** ^ not supported yet
  223. 88
  224. 89 PROCEDURE ReplaceD(VAR alias: DBFile; fieldnum: CARDINAL; d:
  225. 90 Date);
  226. 91 VAR dstring: ARRAY [0..9] OF CHAR;
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. 92 BEGIN
  230. 93 DateToDataFormat(d, dstring);
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. 94 Replace(alias, fieldnum, dstring);
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. 95 END ReplaceD;
  239. ***** ^ not supported yet
  240. 96
  241. 97 PROCEDURE ReplaceL(VAR alias: DBFile; fieldnum: CARDINAL; l:
  242. 98 BOOLEAN);
  243. 99 VAR lchar: ARRAY [0..0] OF CHAR;
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 100 BEGIN
  247. 101 IF l THEN
  248. 102 lchar[0] := 'T'
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 103 ELSE
  252. 104 lchar[0] := 'F'
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. 105 END;
  256. 106 Replace( alias, fieldnum, lchar );
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. 107 END ReplaceL;
  261. ***** ^ not supported yet
  262. 108
  263. 109 PROCEDURE ReplaceN(VAR alias: DBFile; fieldnum: CARDINAL; n:
  264. 110 Real8);
  265. 111 VAR nstring: ARRAY [0..MaxDigits] OF CHAR;
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. 112 fldptr:DBFieldPtr;
  269. 113 BEGIN
  270. 114 fldptr:=FieldList(alias);
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 115 WITH fldptr^[fieldnum] DO
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 116 IF decplaces=0 THEN
  278. ***** ^ undeclared identifier
  279. 117 RealToStr(n, decplaces,
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. ***** ^ undeclared identifier
  283. 118 size+1, nstring);(* assumes that Real to str will insert '.' *)
  284. ***** ^ undeclared identifier
  285. ***** ^ not supported yet
  286. 119 nstring[size]:=0C;
  287. ***** ^ not supported yet
  288. ***** ^ undeclared identifier
  289. 120 ELSE
  290. 121 RealToStr(n, decplaces,
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ undeclared identifier
  294. 122 size, nstring);
  295. ***** ^ undeclared identifier
  296. ***** ^ not supported yet
  297. 123 END (* IF decplaces=0 *);
  298. 124 Replace(alias, fieldnum, nstring);
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. 125 END (* With *);
  303. ***** ^ not supported yet
  304. 126 END ReplaceN;
  305. ***** ^ not supported yet
  306. 127
  307. 128 END DBFields.
  308. ***** ^ not supported yet
  309. 179 errors