Listing: 1 IMPLEMENTATION MODULE M2Strings; 2 (* 3 * REPERTOIRE 4 * Release 1.6 5 * By Charles Bradford and Cole Brecheen 6 * (c) Copyright 1985-1992 PMI 7 * Green Bay, Wisconsin 8 * All rights reserved 9 * (414) 468-6040 10 * 11 * $Header: D:/logfiles/mods/m2string.mov 1.5 10 Mar 1991 15:29:14 coleb $ 12 * 13 *) 14 15 16 IMPORT LowLevel; 17 IMPORT SYSTEM; 18 IMPORT PosUtils; 19 20 VAR 21 Initialized : BOOLEAN; 22 23 PROCEDURE Init(); 24 BEGIN 25 IF Initialized THEN 26 RETURN; 27 ELSE 28 Initialized := TRUE; 29 END; 30 LowLevel.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 31 PosUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 32 END Init; ***** ^ not supported yet 33 34 35 PROCEDURE Assign(VAR source : ARRAY OF CHAR; VAR dest : ARRAY OF CHAR); ***** ^ not supported yet ***** ^ not supported yet 36 VAR 37 size1, size2 : CARDINAL; 38 BEGIN 39 size1 := HIGH(source)+1; ***** ^ undeclared identifier ***** ^ not supported yet 40 size2 := HIGH(dest)+1; ***** ^ undeclared identifier ***** ^ not supported yet 41 IF size1>=size2 THEN 42 LowLevel.Move(SYSTEM.ADR(source), SYSTEM.ADR(dest), size2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 ELSE 44 LowLevel.Move(SYSTEM.ADR(source), SYSTEM.ADR(dest), size1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 45 dest[size1] := 0C; ***** ^ not supported yet ***** ^ not supported yet 46 END; 47 END Assign; ***** ^ not supported yet 48 49 50 PROCEDURE Insert(substr : ARRAY OF CHAR; VAR str : ARRAY OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 51 inx : CARDINAL); 52 VAR 53 room, lngth1, size2 : CARDINAL; 54 BEGIN 55 lngth1 := Length(substr); ***** ^ undeclared identifier ***** ^ not supported yet 56 IF (lngth1=0) OR (inx>HIGH(str)) THEN ***** ^ undeclared identifier ***** ^ not supported yet 57 RETURN; 58 END; 59 size2 := HIGH(str)+1; ***** ^ undeclared identifier ***** ^ not supported yet 60 room := size2-inx; 61 LowLevel.ShiftArrayRight(SYSTEM.ADR(str[inx]), room, lngth1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 IF lngth1>room THEN 63 LowLevel.Move(SYSTEM.ADR(substr), SYSTEM.ADR(str[inx]), room); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 64 ELSE 65 LowLevel.Move(SYSTEM.ADR(substr), SYSTEM.ADR(str[inx]), lngth1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 66 END; 67 END Insert; ***** ^ not supported yet 68 69 70 PROCEDURE Delete(VAR str : ARRAY OF CHAR; inx : CARDINAL; len : ***** ^ not supported yet 71 CARDINAL); 72 VAR 73 room, lngth : CARDINAL; 74 BEGIN 75 lngth := Length(str); ***** ^ undeclared identifier ***** ^ not supported yet 76 IF (len=0) OR (inx>=lngth) THEN 77 RETURN; 78 END; 79 room := lngth-inx; 80 IF len>room THEN 81 len := room; 82 END; 83 IF room>1 THEN 84 LowLevel.ShiftArrayLeft(SYSTEM.ADR(str[inx]), room, len); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 85 END; 86 str[lngth-len] := 0C; ***** ^ not supported yet ***** ^ not supported yet 87 END Delete; ***** ^ not supported yet 88 89 90 PROCEDURE Pos(substr, str : ARRAY OF CHAR) : CARDINAL; ***** ^ not supported yet 91 BEGIN 92 RETURN PosUtils.Pos(substr,str); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 93 END Pos; ***** ^ not supported yet 94 95 96 PROCEDURE Copy(str : ARRAY OF CHAR; inx : CARDINAL; len : CARDINAL; ***** ^ not supported yet 97 VAR result : ARRAY OF CHAR); ***** ^ not supported yet 98 VAR 99 lngth1, size2, room : CARDINAL; 100 BEGIN 101 lngth1 := Length(str); ***** ^ undeclared identifier ***** ^ not supported yet 102 size2 := HIGH(result)+1; ***** ^ undeclared identifier ***** ^ not supported yet 103 result[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet 104 (*This sets result to null in case we return from the 105 procedure in the next statement.*) 106 IF (len=0) OR (inx>=lngth1) THEN 107 RETURN; 108 END; 109 room := lngth1-inx; 110 IF len>room THEN 111 len := room; 112 END; 113 IF len>=size2 THEN 114 LowLevel.Move(SYSTEM.ADR(str[inx]), SYSTEM.ADR(result), size2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 115 ELSE 116 LowLevel.Move(SYSTEM.ADR(str[inx]), SYSTEM.ADR(result), len); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 117 result[len] := 0C; ***** ^ not supported yet ***** ^ not supported yet 118 END; 119 END Copy; ***** ^ not supported yet 120 121 122 PROCEDURE Concat(s1, s2 : ARRAY OF CHAR; VAR result : ARRAY OF CHAR); ***** ^ not supported yet ***** ^ not supported yet 123 BEGIN 124 Assign(s2, result); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 125 Insert(s1, result, 0); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 126 END Concat; ***** ^ not supported yet 127 128 129 PROCEDURE Length(VAR str : ARRAY OF CHAR) : CARDINAL; ***** ^ not supported yet 130 VAR 131 StrSize, skipped : INTEGER; 132 BEGIN 133 StrSize := INTEGER(HIGH(str)+1); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 134 skipped := LowLevel.ScanEQ(StrSize,0C,SYSTEM.ADR(str)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 135 RETURN CARDINAL(skipped); ***** ^ not supported yet 136 END Length; ***** ^ not supported yet 137 138 139 PROCEDURE CompareStr(s1, s2 : ARRAY OF CHAR) : INTEGER; ***** ^ not supported yet 140 VAR 141 TmpAdr1, TmpAdr2 : LowLevel.Address8086; ***** ^ not supported yet 142 len1, len2, CompLen, cnt : CARDINAL; 143 result: INTEGER; 144 BEGIN 145 result := 0; 146 TmpAdr1.a := SYSTEM.ADR(s1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 147 TmpAdr2.a := SYSTEM.ADR(s2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 148 len1 := Length(s1); ***** ^ not supported yet ***** ^ not supported yet 149 len2 := Length(s2); ***** ^ not supported yet ***** ^ not supported yet 150 IF (HIGH(s1)+1) < len1 THEN len1 := HIGH(s1)+1 END; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 151 IF (HIGH(s2)+1) < len2 THEN len2 := HIGH(s2)+1 END; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 152 CompLen := len1; 153 IF CompLen > len2 THEN 154 CompLen := len2; 155 END; 156 cnt := 0; 157 WHILE (cnt < CompLen) AND (result = 0) DO 158 IF TmpAdr1.b^ # TmpAdr2.b^ THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 159 IF TmpAdr1.b^ > TmpAdr2.b^ THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 160 result := 1; 161 RETURN result; 162 ELSE 163 result := -1; 164 RETURN result; 165 END; 166 ELSE 167 INC(cnt); ***** ^ undeclared identifier ***** ^ not supported yet 168 INC(TmpAdr1.off); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 169 INC(TmpAdr2.off); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 170 END; 171 END; 172 IF len1 = len2 THEN 173 result := 0; 174 ELSIF len1 > len2 THEN 175 result := 1; 176 ELSE 177 result := -1; 178 END; 179 RETURN result; 180 END CompareStr; ***** ^ not supported yet 181 182 183 BEGIN 184 Initialized := FALSE; 185 Init(); ***** ^ not supported yet ***** ^ not supported yet 186 END M2Strings. ***** ^ not supported yet 185 errors