FILENAME.LST 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. Listing:
  2. 1 (* Release 3.10 *)
  3. 2 (*-------------------------------------------------------------------------*
  4. 3 * *
  5. 4 * FILENAME.MOD - COMMS Toolkit filename parser *
  6. 5 * *
  7. 6 * COPYRIGHT (C) 1990..1992 Clarion Software Corporation. *
  8. 7 * All Rights Reserved *
  9. 8 * *
  10. 9 *--------------------------------------------------------------------------*)
  11. 10
  12. 11 IMPLEMENTATION MODULE Filenames;
  13. 12 IMPORT Lib,Str;
  14. 13
  15. 14 PROCEDURE ParseFilename(f:ARRAY OF CHAR;VAR drive,path,name,ext:ARRAY OF CHAR):BOOLEAN;
  16. ***** ^ not supported yet
  17. ***** ^ not supported yet
  18. 15 VAR
  19. 16 Lnth,pos,NameLnth : CARDINAL;
  20. 17 BEGIN
  21. 18 drive[0]:=0C;
  22. ***** ^ not supported yet
  23. ***** ^ not supported yet
  24. 19 path[0]:=0C;
  25. ***** ^ not supported yet
  26. ***** ^ not supported yet
  27. 20 name[0]:=0C;
  28. ***** ^ not supported yet
  29. ***** ^ not supported yet
  30. 21 ext[0]:=0C;
  31. ***** ^ not supported yet
  32. ***** ^ not supported yet
  33. 22 Lnth := Str.Length(f);
  34. ***** ^ not supported yet
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. 23 IF Lnth=0 THEN
  38. 24 RETURN FALSE;
  39. 25 END;
  40. 26 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,':');
  41. ***** ^ not supported yet
  42. ***** ^ not supported yet
  43. ***** ^ undeclared identifier
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. 27 IF pos>0 THEN
  48. 28 IF pos<>2 THEN
  49. 29 RETURN(FALSE);
  50. 30 END;
  51. 31 drive[0] := CAP(f[0]);
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. ***** ^ undeclared identifier
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. 32 drive[1] := 0C;
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. 33 DEC(Lnth,2);
  61. ***** ^ undeclared identifier
  62. ***** ^ not supported yet
  63. 34 Lib.Move(ADR(f[2]),ADR(f),Lnth+1)
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. ***** ^ undeclared identifier
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ undeclared identifier
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. 35 ELSE
  73. 36 drive[0] := 0C;
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 37 END;
  77. 38 IF Lnth=0 THEN
  78. 39 RETURN(FALSE);
  79. 40 END;
  80. 41 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,'\');
  81. ***** ^ not supported yet
  82. ***** ^ not supported yet
  83. ***** ^ undeclared identifier
  84. ***** ^ not supported yet
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. 42 IF pos>0 THEN
  88. 43 Lib.Move(ADR(f),ADR(path),pos);
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. ***** ^ undeclared identifier
  92. ***** ^ not supported yet
  93. ***** ^ undeclared identifier
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. 44 DEC(Lnth,pos);
  97. ***** ^ undeclared identifier
  98. ***** ^ not supported yet
  99. 45 Lib.Move(ADR(f[pos]),ADR(f),Lnth+1);
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. ***** ^ undeclared identifier
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ undeclared identifier
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. 46 END;
  109. 47 path[pos] := 0C;
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. 48 IF Lnth=0 THEN
  113. 49 RETURN(FALSE);
  114. 50 END;
  115. 51 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,'.');
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ undeclared identifier
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. 52 IF pos>0 THEN
  123. 53 IF pos=1 THEN
  124. 54 RETURN(FALSE);
  125. 55 END;
  126. 56 IF pos-1>8 THEN
  127. 57 NameLnth:=8;
  128. 58 ELSE
  129. 59 NameLnth:=pos-1;
  130. 60 END;
  131. 61 Lib.Move(ADR(f),ADR(name),NameLnth);
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. ***** ^ undeclared identifier
  135. ***** ^ not supported yet
  136. ***** ^ undeclared identifier
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. 62 name[NameLnth]:=0C;
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. 63 DEC(Lnth,pos);
  143. ***** ^ undeclared identifier
  144. ***** ^ not supported yet
  145. 64 Lib.Move(ADR(f[pos]),ADR(f),Lnth+1);
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. ***** ^ undeclared identifier
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ undeclared identifier
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. 65 Lib.Move(ADR(f),ADR(ext),Lnth+1)
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ undeclared identifier
  158. ***** ^ not supported yet
  159. ***** ^ undeclared identifier
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. 66 ELSE
  163. 67 IF Lnth+1>8 THEN
  164. 68 NameLnth:=8;
  165. 69 ELSE
  166. 70 NameLnth:=Lnth+1;
  167. 71 END;
  168. 72 Lib.Move(ADR(f),ADR(name),NameLnth);
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. ***** ^ undeclared identifier
  172. ***** ^ not supported yet
  173. ***** ^ undeclared identifier
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 73 name[Lnth]:=0C;
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 74 ext[0] := 0C;
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. 75 END;
  183. 76 RETURN(TRUE);
  184. 77 END ParseFilename;
  185. ***** ^ not supported yet
  186. 78
  187. 79 (*.................................................*)
  188. 80
  189. 81 PROCEDURE MakeFilename(drive,path,name,ext:ARRAY OF CHAR;VAR f:ARRAY OF CHAR);
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 82 VAR
  193. 83 Lnth,LnthDest : CARDINAL;
  194. 84 BEGIN
  195. 85 f[0] := 0C;
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 86 IF drive[0]<>0C THEN
  199. ***** ^ not supported yet
  200. ***** ^ not supported yet
  201. 87 f[0]:=drive[0];
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. 88 f[1]:=':'; f[2]:=0C;
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. 89 END;
  212. 90 Str.Concat(f,f,path);
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. 91 IF path[0]<>0C THEN
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 92 Lnth := Str.Length(f);
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. 93 IF f[Lnth-1]<>'\' THEN
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 94 f[Lnth]:='\';
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 95 f[Lnth+1]:=0C;
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. 96 END;
  235. 97 END;
  236. 98 Lnth := Str.Length(name);
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. ***** ^ not supported yet
  240. 99 IF Lnth>8 THEN
  241. 100 name[8]:=0C;
  242. ***** ^ not supported yet
  243. ***** ^ not supported yet
  244. 101 END;
  245. 102 Str.Concat(f,f,name);
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 103 IF ext[0]<>0C THEN
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. 104 Lnth := Str.Length(f);
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. 105 IF ext[0]<>'.' THEN
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 106 f[Lnth]:='.';
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. 107 f[Lnth+1]:=0C;
  265. ***** ^ not supported yet
  266. ***** ^ not supported yet
  267. 108 END;
  268. 109 Str.Concat(f,f,ext);
  269. ***** ^ not supported yet
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 110 END;
  275. 111 END MakeFilename;
  276. ***** ^ not supported yet
  277. 112
  278. 113 END Filenames.
  279. ***** ^ not supported yet
  280. 165 errors