Listing: 1 (* Release 3.10 *) 2 (*-------------------------------------------------------------------------* 3 * * 4 * FILENAME.MOD - COMMS Toolkit filename parser * 5 * * 6 * COPYRIGHT (C) 1990..1992 Clarion Software Corporation. * 7 * All Rights Reserved * 8 * * 9 *--------------------------------------------------------------------------*) 10 11 IMPLEMENTATION MODULE Filenames; 12 IMPORT Lib,Str; 13 14 PROCEDURE ParseFilename(f:ARRAY OF CHAR;VAR drive,path,name,ext:ARRAY OF CHAR):BOOLEAN; ***** ^ not supported yet ***** ^ not supported yet 15 VAR 16 Lnth,pos,NameLnth : CARDINAL; 17 BEGIN 18 drive[0]:=0C; ***** ^ not supported yet ***** ^ not supported yet 19 path[0]:=0C; ***** ^ not supported yet ***** ^ not supported yet 20 name[0]:=0C; ***** ^ not supported yet ***** ^ not supported yet 21 ext[0]:=0C; ***** ^ not supported yet ***** ^ not supported yet 22 Lnth := Str.Length(f); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 23 IF Lnth=0 THEN 24 RETURN FALSE; 25 END; 26 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,':'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 27 IF pos>0 THEN 28 IF pos<>2 THEN 29 RETURN(FALSE); 30 END; 31 drive[0] := CAP(f[0]); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 32 drive[1] := 0C; ***** ^ not supported yet ***** ^ not supported yet 33 DEC(Lnth,2); ***** ^ undeclared identifier ***** ^ not supported yet 34 Lib.Move(ADR(f[2]),ADR(f),Lnth+1) ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 35 ELSE 36 drive[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet 37 END; 38 IF Lnth=0 THEN 39 RETURN(FALSE); 40 END; 41 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,'\'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 42 IF pos>0 THEN 43 Lib.Move(ADR(f),ADR(path),pos); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 44 DEC(Lnth,pos); ***** ^ undeclared identifier ***** ^ not supported yet 45 Lib.Move(ADR(f[pos]),ADR(f),Lnth+1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 46 END; 47 path[pos] := 0C; ***** ^ not supported yet ***** ^ not supported yet 48 IF Lnth=0 THEN 49 RETURN(FALSE); 50 END; 51 pos := Lnth-Lib.ScanL(ADR(f[Lnth-1]),Lnth,'.'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 IF pos>0 THEN 53 IF pos=1 THEN 54 RETURN(FALSE); 55 END; 56 IF pos-1>8 THEN 57 NameLnth:=8; 58 ELSE 59 NameLnth:=pos-1; 60 END; 61 Lib.Move(ADR(f),ADR(name),NameLnth); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 62 name[NameLnth]:=0C; ***** ^ not supported yet ***** ^ not supported yet 63 DEC(Lnth,pos); ***** ^ undeclared identifier ***** ^ not supported yet 64 Lib.Move(ADR(f[pos]),ADR(f),Lnth+1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 65 Lib.Move(ADR(f),ADR(ext),Lnth+1) ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 66 ELSE 67 IF Lnth+1>8 THEN 68 NameLnth:=8; 69 ELSE 70 NameLnth:=Lnth+1; 71 END; 72 Lib.Move(ADR(f),ADR(name),NameLnth); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 73 name[Lnth]:=0C; ***** ^ not supported yet ***** ^ not supported yet 74 ext[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet 75 END; 76 RETURN(TRUE); 77 END ParseFilename; ***** ^ not supported yet 78 79 (*.................................................*) 80 81 PROCEDURE MakeFilename(drive,path,name,ext:ARRAY OF CHAR;VAR f:ARRAY OF CHAR); ***** ^ not supported yet ***** ^ not supported yet 82 VAR 83 Lnth,LnthDest : CARDINAL; 84 BEGIN 85 f[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet 86 IF drive[0]<>0C THEN ***** ^ not supported yet ***** ^ not supported yet 87 f[0]:=drive[0]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 88 f[1]:=':'; f[2]:=0C; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 89 END; 90 Str.Concat(f,f,path); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 91 IF path[0]<>0C THEN ***** ^ not supported yet ***** ^ not supported yet 92 Lnth := Str.Length(f); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 93 IF f[Lnth-1]<>'\' THEN ***** ^ not supported yet ***** ^ not supported yet 94 f[Lnth]:='\'; ***** ^ not supported yet ***** ^ not supported yet 95 f[Lnth+1]:=0C; ***** ^ not supported yet ***** ^ not supported yet 96 END; 97 END; 98 Lnth := Str.Length(name); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 99 IF Lnth>8 THEN 100 name[8]:=0C; ***** ^ not supported yet ***** ^ not supported yet 101 END; 102 Str.Concat(f,f,name); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 IF ext[0]<>0C THEN ***** ^ not supported yet ***** ^ not supported yet 104 Lnth := Str.Length(f); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 105 IF ext[0]<>'.' THEN ***** ^ not supported yet ***** ^ not supported yet 106 f[Lnth]:='.'; ***** ^ not supported yet ***** ^ not supported yet 107 f[Lnth+1]:=0C; ***** ^ not supported yet ***** ^ not supported yet 108 END; 109 Str.Concat(f,f,ext); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 110 END; 111 END MakeFilename; ***** ^ not supported yet 112 113 END Filenames. ***** ^ not supported yet 165 errors