Listing: 1 IMPLEMENTATION MODULE StrEdit; 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/stredit.mov 1.7 17 Mar 1991 17:58:52 coleb $ 12 * 13 *) 14 15 IMPORT LowLevel; 16 IMPORT M2Strings; 17 IMPORT Numbers; 18 IMPORT ScanUtils; 19 IMPORT SYSTEM; 20 21 VAR 22 Initialized : BOOLEAN; 23 24 PROCEDURE Init(); 25 BEGIN 26 IF Initialized THEN 27 RETURN; 28 ELSE 29 Initialized := TRUE; 30 END; 31 LowLevel.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 32 M2Strings.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 33 Numbers.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 34 ScanUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 35 END Init; ***** ^ not supported yet 36 37 38 CONST 39 BLANK = ' '; 40 TAB = 11C; 41 42 PROCEDURE AssignStr(instr : ARRAY OF CHAR; VAR outstr : ARRAY OF CHAR); ***** ^ not supported yet ***** ^ not supported yet 43 (*Allows assignment of constants to strings; Logitech's Assign has 44 two VAR parameters. Changed 24 May 87 to use HIGH instead 45 of SYSTEM.SIZE because M2SDS's SIZE returns incorrect results.*) 46 VAR 47 insize, outsize : CARDINAL; 48 BEGIN 49 insize := 1+HIGH(instr); ***** ^ undeclared identifier ***** ^ not supported yet 50 outsize := 1+HIGH(outstr); ***** ^ undeclared identifier ***** ^ not supported yet 51 IF insize>outsize THEN 52 LowLevel.Move(SYSTEM.ADR(instr), SYSTEM.ADR(outstr), outsize); ***** ^ 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 53 ELSE 54 LowLevel.Move(SYSTEM.ADR(instr), SYSTEM.ADR(outstr), insize); ***** ^ 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 55 SetLength(outstr, M2Strings.Length(instr)); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 56 END; 57 END AssignStr; ***** ^ not supported yet 58 59 PROCEDURE Append( VAR TheStr: ARRAY OF CHAR; AppStr: ARRAY OF CHAR); ***** ^ not supported yet ***** ^ not supported yet 60 VAR 61 HighAppStr, leng, leng2: CARDINAL; 62 BEGIN 63 HighAppStr := HIGH(AppStr); ***** ^ undeclared identifier ***** ^ not supported yet 64 (* Exposes a nasty bug in Stony Brook M2. *) 65 leng := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 66 leng2 := Numbers.Min(M2Strings.Length(AppStr), (HIGH(TheStr)+1-leng)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 67 IF leng2 > 0 THEN 68 LowLevel.Move(SYSTEM.ADR(AppStr), SYSTEM.ADR(TheStr[leng]), leng2); ***** ^ 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 69 INC(leng, leng2); ***** ^ undeclared identifier ***** ^ not supported yet 70 IF leng <= HIGH(TheStr) THEN ***** ^ undeclared identifier ***** ^ not supported yet 71 TheStr[leng] := 0C; ***** ^ not supported yet ***** ^ not supported yet 72 END; 73 END; 74 END Append; ***** ^ not supported yet 75 76 PROCEDURE ReplaceTabs(VAR TheStr : ARRAY OF CHAR; tabInterval: CARDINAL); ***** ^ not supported yet 77 VAR 78 cnt, tabspot, offsetToNextTabStop : CARDINAL; 79 tabstr : ARRAY [0..15] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 80 BEGIN 81 tabspot := M2Strings.Pos(TAB, TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 WHILE (tabspot<=HIGH(TheStr)) DO ***** ^ undeclared identifier ***** ^ not supported yet 83 M2Strings.Delete(TheStr, tabspot, 1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 84 LowLevel.Fill( SYSTEM.ADR(tabstr), 16, BLANK ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 85 offsetToNextTabStop := tabInterval - (tabspot MOD tabInterval); 86 tabstr[offsetToNextTabStop] := 0C; ***** ^ not supported yet ***** ^ not supported yet 87 M2Strings.Insert(tabstr, TheStr, tabspot); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 88 tabspot := M2Strings.Pos(TAB, TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 89 END; 90 END ReplaceTabs; ***** ^ not supported yet 91 92 PROCEDURE tabStop(thespot : CARDINAL; tabInterval: CARDINAL) : BOOLEAN; 93 BEGIN 94 RETURN (((thespot MOD tabInterval) = 0) AND (thespot # 0)); 95 END tabStop; ***** ^ not supported yet 96 97 PROCEDURE InsertTabs(VAR TheStr : ARRAY OF CHAR; tabInterval: CARDINAL; ***** ^ not supported yet 98 leadingOnly: BOOLEAN); 99 VAR 100 index, leng, spaceStrLngth, tabStrLngth : CARDINAL; 101 spacestr : ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 102 tabstr : ARRAY [0..15] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 103 newstr : ARRAY [0..255] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 104 nonBlankFound: BOOLEAN; 105 106 BEGIN 107 (*InsertTabs*) 108 ReplaceTabs(TheStr, tabInterval); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 109 (* We don't want to have to deal with the complication of tabs 110 * already in TheStr, so we start by expanding them to blanks. 111 *) 112 leng := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 113 IF leng = 0 THEN 114 RETURN; 115 END; 116 DEC(leng); ***** ^ undeclared identifier ***** ^ not supported yet 117 spacestr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 118 spaceStrLngth := 0; 119 tabstr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 120 tabStrLngth := 0; 121 newstr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 122 nonBlankFound := FALSE; 123 124 FOR index := 0 TO leng DO 125 IF NOT (leadingOnly AND nonBlankFound) THEN 126 IF tabStop(index, tabInterval) AND (spaceStrLngth > 1) THEN ***** ^ not supported yet ***** ^ not supported yet 127 Append(tabstr, TAB); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 128 INC(tabStrLngth); ***** ^ undeclared identifier ***** ^ not supported yet 129 IF (spaceStrLngth > tabInterval) THEN 130 (* What's happened here is that we had a single space 131 * immediately preceding a tab stop before this last 132 * run of spaces. We refused to replace it with a 133 * tab because we had only one space to replace it 134 * with. Now, however, we see that something has to 135 * go there -- could either be a space or a tab. We 136 * choose a tab. 137 *) 138 Append(tabstr, TAB); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 139 INC(tabStrLngth); ***** ^ undeclared identifier ***** ^ not supported yet 140 END; 141 spacestr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 142 spaceStrLngth := 0; 143 END; 144 IF TheStr[index]=BLANK THEN ***** ^ not supported yet ***** ^ not supported yet 145 Append(spacestr, BLANK); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 146 INC(spaceStrLngth); ***** ^ undeclared identifier ***** ^ not supported yet 147 END; 148 IF tabStrLngth > 0 THEN 149 Append(newstr, tabstr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 150 tabstr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 151 tabStrLngth := 0; 152 END; 153 IF (spaceStrLngth > 0) AND (TheStr[index] # BLANK) THEN ***** ^ not supported yet ***** ^ not supported yet 154 (* We've hit a nonblank and we're not at a tabstop, so we're 155 * not going to get to replace this last sequence of blanks 156 * with a tab. 157 *) 158 Append(newstr, spacestr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 159 spacestr := ''; ***** ^ not supported yet ***** ^ incompatible assignment 160 spaceStrLngth := 0; 161 END; 162 END; 163 IF (TheStr[index] # BLANK) OR (leadingOnly AND nonBlankFound) THEN ***** ^ not supported yet ***** ^ not supported yet 164 Append(newstr, TheStr[index]); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 165 nonBlankFound := TRUE; 166 END; 167 END; 168 AssignStr(newstr, TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 169 END InsertTabs; ***** ^ not supported yet 170 171 PROCEDURE InsertTimes(Ch : CHAR; VAR TheStr : ARRAY OF CHAR; indx, ***** ^ not supported yet 172 times : CARDINAL); 173 VAR 174 cnt : CARDINAL; 175 BEGIN 176 IF times = 0 THEN RETURN END; 177 LowLevel.ShiftArrayRight( SYSTEM.ADR(TheStr[indx]), (HIGH(TheStr) + 1) - ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 178 indx, times ); ***** ^ not supported yet 179 FOR cnt := 1 TO times DO 180 TheStr[ indx + cnt - 1 ] := Ch; ***** ^ not supported yet ***** ^ not supported yet 181 END; 182 END InsertTimes; ***** ^ not supported yet 183 184 185 PROCEDURE InsertSubstr(str1 : ARRAY OF CHAR; start, lnth : ***** ^ not supported yet 186 CARDINAL; VAR str2 : ARRAY OF CHAR; ndx : CARDINAL); ***** ^ not supported yet 187 VAR 188 tmpstr : ARRAY [0..255] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 189 BEGIN 190 M2Strings.Copy(str1, start, lnth, tmpstr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 191 M2Strings.Insert(tmpstr, str2, ndx); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 192 END InsertSubstr; ***** ^ not supported yet 193 194 PROCEDURE OverWrite(obj : ARRAY OF CHAR; VAR targ : ARRAY OF ***** ^ not supported yet 195 CHAR; pos : CARDINAL); ***** ^ not supported yet 196 (*Unconditionally writes obj into targ beginning at pos, and for the length of 197 obj, wipes out anything that may have been in targ at that position.*) 198 VAR 199 max, i : CARDINAL; 200 BEGIN 201 max := M2Strings.Length(obj); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 202 IF max = 0 THEN RETURN END; 203 (* bug fix submitted by Henk Hofmans, 8 Feb 87 *) 204 IF (max>15) OR ((max+pos) > M2Strings.Length(targ)) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 205 (*This test is only for optimization purposes.*) 206 M2Strings.Delete(targ, pos, M2Strings.Length(obj)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 207 M2Strings.Insert(obj, targ, pos); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 208 ELSE 209 FOR i := 0 TO (max-1) DO 210 targ[pos+i] := obj[i]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 211 END; 212 END; 213 END OverWrite; ***** ^ not supported yet 214 215 216 PROCEDURE ReplaceStr( 217 searchstr, replacstr : ARRAY OF CHAR; ***** ^ not supported yet 218 VAR TheStr : ARRAY OF CHAR); ***** ^ not supported yet 219 VAR 220 spot, lngth1, lngth2 : CARDINAL; 221 repeating: BOOLEAN; 222 BEGIN 223 lngth1 := M2Strings.Length( searchstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 224 lngth2 := M2Strings.Length( replacstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 225 spot := ScanUtils.Positn( searchstr, replacstr, 0, ScanUtils.CaseSens ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 226 repeating := spot > HIGH(replacstr); ***** ^ undeclared identifier ***** ^ not supported yet 227 (* If repeating = FALSE, then the old string is embedded 228 in the new string, and we'll get hung in an infinite 229 loop if we try to replace all instances of the old 230 string. *) 231 spot := ScanUtils.Positn( searchstr, TheStr, 0, ScanUtils.CaseSens ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 232 WHILE spot<=HIGH(TheStr) DO ***** ^ undeclared identifier ***** ^ not supported yet 233 M2Strings.Delete(TheStr, spot, lngth1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 234 M2Strings.Insert(replacstr, TheStr, spot); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 235 IF repeating THEN 236 spot := ScanUtils.Positn( searchstr, TheStr, 0, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 237 ScanUtils.CaseSens ); ***** ^ not supported yet ***** ^ not supported yet 238 ELSE 239 spot := ScanUtils.Positn( searchstr, TheStr, spot + lngth2, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 240 ScanUtils.CaseSens ); ***** ^ not supported yet ***** ^ not supported yet 241 END; 242 END; 243 END ReplaceStr; ***** ^ not supported yet 244 245 246 PROCEDURE ReplaceStrInsens( 247 searchstr, replacstr : ARRAY OF CHAR; ***** ^ not supported yet 248 VAR TheStr : ARRAY OF CHAR); ***** ^ not supported yet 249 VAR 250 spot, lngth1, lngth2 : CARDINAL; 251 repeating: BOOLEAN; 252 BEGIN 253 lngth1 := M2Strings.Length( searchstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 254 lngth2 := M2Strings.Length( replacstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 255 spot := ScanUtils.Positn( searchstr, replacstr, 0, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 256 ScanUtils.CaseInsens ); ***** ^ not supported yet ***** ^ not supported yet 257 repeating := spot > HIGH(replacstr); ***** ^ undeclared identifier ***** ^ not supported yet 258 (* If repeating = FALSE, then the old string is embedded 259 in the new string, and we'll get hung in an infinite 260 loop if we try to replace all instances of the old 261 string. *) 262 spot := ScanUtils.Positn( searchstr, TheStr, 0, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 263 ScanUtils.CaseInsens ); ***** ^ not supported yet ***** ^ not supported yet 264 WHILE spot<=HIGH(TheStr) DO ***** ^ undeclared identifier ***** ^ not supported yet 265 M2Strings.Delete(TheStr, spot, lngth1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 266 M2Strings.Insert(replacstr, TheStr, spot); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 267 IF repeating THEN 268 spot := ScanUtils.Positn( searchstr, TheStr, 0, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 269 ScanUtils.CaseInsens ); ***** ^ not supported yet ***** ^ not supported yet 270 ELSE 271 spot := ScanUtils.Positn( searchstr, TheStr, spot + lngth2, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 272 ScanUtils.CaseInsens ); ***** ^ not supported yet ***** ^ not supported yet 273 END; 274 END; 275 END ReplaceStrInsens; ***** ^ not supported yet 276 277 278 PROCEDURE CrunchBlanks(VAR line : ARRAY OF CHAR); ***** ^ not supported yet 279 VAR 280 LastNotBlank : BOOLEAN; 281 LengthOfLine, ResultIndex, index, LeftOvers : CARDINAL; 282 BEGIN 283 ReplaceTabs(line, 8); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 284 LastNotBlank := FALSE; 285 LengthOfLine := M2Strings.Length(line); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 286 IF LengthOfLine = 0 THEN 287 RETURN; 288 END; 289 ResultIndex := 0; 290 FOR index := 0 TO (LengthOfLine-1) DO 291 IF line[index]<>BLANK THEN ***** ^ not supported yet ***** ^ not supported yet 292 LastNotBlank := TRUE; 293 line[ResultIndex] := line[index]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 294 INC(ResultIndex); ***** ^ undeclared identifier ***** ^ not supported yet 295 ELSIF LastNotBlank THEN 296 LastNotBlank := FALSE; 297 line[ResultIndex] := line[index]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 298 INC(ResultIndex); ***** ^ undeclared identifier ***** ^ not supported yet 299 END; 300 END; 301 IF (ResultIndex>0) AND (line[ResultIndex-1]=BLANK) THEN ***** ^ not supported yet ***** ^ not supported yet 302 DEC(ResultIndex); ***** ^ undeclared identifier ***** ^ not supported yet 303 END; 304 LeftOvers := LengthOfLine-ResultIndex; 305 IF LeftOvers>0 THEN 306 M2Strings.Delete(line, ResultIndex, LeftOvers); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 307 END; 308 END CrunchBlanks; ***** ^ not supported yet 309 310 PROCEDURE CutLeadingChars(TheChar : CHAR; VAR TheStr : ARRAY OF 311 CHAR); ***** ^ not supported yet 312 (*deletes any TheChar's at the start of TheStr*) 313 VAR 314 NonMatchFound : BOOLEAN; 315 ndx, StrLen : CARDINAL; 316 BEGIN 317 StrLen := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 318 IF StrLen=0 THEN 319 RETURN; 320 END; 321 ndx := 0; 322 IF (TheStr[ndx]=TheChar) THEN ***** ^ not supported yet ***** ^ not supported yet 323 NonMatchFound := FALSE; 324 WHILE ((ndx + 1) < StrLen) AND (NOT NonMatchFound) DO 325 INC(ndx); ***** ^ undeclared identifier ***** ^ not supported yet 326 NonMatchFound := TheStr[ndx]#TheChar; ***** ^ not supported yet ***** ^ not supported yet 327 END; 328 IF NOT NonMatchFound THEN 329 INC(ndx); ***** ^ undeclared identifier ***** ^ not supported yet 330 END; 331 M2Strings.Delete(TheStr, 0, ndx); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 332 END; 333 END CutLeadingChars; ***** ^ not supported yet 334 335 PROCEDURE CutTrailingChars(TheChar : CHAR; VAR TheStr : ARRAY 336 OF CHAR); ***** ^ not supported yet 337 (*deletes any TheChar's at the end of TheStr*) 338 VAR 339 index : CARDINAL; 340 BEGIN 341 index := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 342 IF index > 0 THEN 343 LOOP 344 IF TheStr[ index - 1] = TheChar THEN ***** ^ not supported yet ***** ^ not supported yet 345 DEC(index); ***** ^ undeclared identifier ***** ^ not supported yet 346 IF index = 0 THEN 347 TheStr[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet 348 RETURN; 349 END; 350 ELSIF index <= HIGH(TheStr) THEN ***** ^ undeclared identifier ***** ^ not supported yet 351 TheStr[index] := 0C; ***** ^ not supported yet ***** ^ not supported yet 352 RETURN; 353 ELSE 354 RETURN; 355 END; 356 END; 357 END; 358 END CutTrailingChars; ***** ^ not supported yet 359 360 PROCEDURE LowerStr(VAR TheStr : ARRAY OF CHAR); ***** ^ not supported yet 361 VAR 362 pointer, leng : CARDINAL; 363 CONST 364 shiftdown = 32; 365 BEGIN 366 leng := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 367 IF leng = 0 THEN 368 RETURN; 369 END; 370 DEC( leng); ***** ^ undeclared identifier ***** ^ not supported yet 371 FOR pointer := 0 TO leng DO 372 IF (TheStr[pointer]>='A') AND (TheStr[pointer]<='Z') THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 373 TheStr[pointer] := CHR( ORD(TheStr[pointer]) + shiftdown); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 374 END; 375 END; 376 END LowerStr; ***** ^ not supported yet 377 378 PROCEDURE CAPstr(VAR TheStr : ARRAY OF CHAR); ***** ^ not supported yet 379 VAR 380 pointer, leng : CARDINAL; 381 CONST 382 shiftdown = 32; 383 BEGIN 384 leng := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 385 IF leng = 0 THEN 386 RETURN; 387 END; 388 DEC( leng); ***** ^ undeclared identifier ***** ^ not supported yet 389 FOR pointer := 0 TO leng DO 390 TheStr[pointer] := CAP(TheStr[pointer]); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 391 END; 392 END CAPstr; ***** ^ not supported yet 393 394 PROCEDURE DeleteChar(TheChar : CHAR; VAR x : ARRAY OF CHAR); ***** ^ not supported yet 395 VAR 396 spot : CARDINAL; 397 BEGIN 398 spot := M2Strings.Pos(TheChar, x); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 399 WHILE spot<=HIGH(x) DO ***** ^ undeclared identifier ***** ^ not supported yet 400 M2Strings.Delete(x, spot, 1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 401 spot := M2Strings.Pos(TheChar, x); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 402 END; 403 END DeleteChar; ***** ^ not supported yet 404 405 PROCEDURE SetLength( VAR TheStr : ARRAY OF CHAR; NewLength : ***** ^ not supported yet 406 CARDINAL); 407 VAR 408 OldLength, MaxLength: CARDINAL; 409 BEGIN 410 OldLength := M2Strings.Length( TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 411 IF NewLength # OldLength THEN 412 MaxLength := HIGH(TheStr) + 1; ***** ^ undeclared identifier ***** ^ not supported yet 413 IF OldLength < MaxLength THEN 414 (* if a null exists that must be filled *) 415 IF OldLength > 0 THEN 416 TheStr[ OldLength] := TheStr[ OldLength - 1 ]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 417 (* the current last character in the string *) 418 ELSIF MaxLength > 1 THEN 419 TheStr[ OldLength] := TheStr[ 1 ]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 420 ELSE 421 TheStr[ OldLength] := BLANK; ***** ^ not supported yet ***** ^ not supported yet 422 END; 423 END; 424 IF NewLength < MaxLength THEN 425 (* set the new length *) 426 TheStr[ NewLength] := 0C; ***** ^ not supported yet ***** ^ not supported yet 427 END; 428 END; 429 END SetLength; ***** ^ not supported yet 430 431 PROCEDURE RightJustify( VAR TheStr: ARRAY OF CHAR; ***** ^ not supported yet 432 RequiredLength: CARDINAL ); 433 VAR strlength: CARDINAL; 434 BEGIN 435 IF NOT ScanUtils.IsBlank( TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 436 CutTrailingChars( BLANK, TheStr ); ***** ^ not supported yet ***** ^ not supported yet 437 END; 438 strlength := M2Strings.Length( TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 439 WHILE strlength > RequiredLength DO 440 M2Strings.Delete( TheStr, 0, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 441 DEC( strlength ); ***** ^ undeclared identifier ***** ^ not supported yet 442 END; 443 WHILE strlength < RequiredLength DO 444 M2Strings.Insert( BLANK, TheStr, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 445 INC( strlength ); ***** ^ undeclared identifier ***** ^ not supported yet 446 END; 447 END RightJustify; ***** ^ not supported yet 448 449 PROCEDURE LeftJustify( VAR TheStr: ARRAY OF CHAR; ***** ^ not supported yet 450 RequiredLength: CARDINAL ); 451 VAR strlength: CARDINAL; 452 BEGIN 453 IF NOT ScanUtils.IsBlank( TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 454 CutLeadingChars( BLANK, TheStr ); ***** ^ not supported yet ***** ^ not supported yet 455 END; 456 strlength := M2Strings.Length( TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 457 IF strlength > RequiredLength THEN 458 SetLength( TheStr, RequiredLength ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 459 ELSE 460 WHILE strlength < RequiredLength DO 461 Append( TheStr, BLANK ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 462 INC( strlength ); ***** ^ undeclared identifier ***** ^ not supported yet 463 END; 464 END; 465 END LeftJustify; ***** ^ not supported yet 466 467 468 PROCEDURE MakeCurrency( CurrencySymbol: ARRAY OF CHAR; ***** ^ not supported yet 469 VAR TheStr: ARRAY OF CHAR ); ***** ^ not supported yet 470 VAR 471 spot, lngth: CARDINAL; 472 BEGIN 473 DeleteChar( ' ', TheStr ); ***** ^ not supported yet ***** ^ not supported yet 474 IF NOT ScanUtils.Present( CurrencySymbol, TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 475 ScanUtils.CaseSens ) THEN ***** ^ not supported yet ***** ^ not supported yet 476 M2Strings.Insert( CurrencySymbol, TheStr, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 477 END; 478 lngth := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 479 IF lngth < 3 THEN 480 RightJustify( TheStr, 3 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 481 lngth := 3; 482 END; 483 IF NOT ScanUtils.PresentPos( '.', TheStr, spot, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 484 ScanUtils.CaseSens ) THEN ***** ^ not supported yet ***** ^ not supported yet 485 Append( TheStr, '.' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 486 INC( lngth ); ***** ^ undeclared identifier ***** ^ not supported yet 487 ELSIF spot < (lngth - 3) THEN 488 M2Strings.Delete( TheStr, spot + 3, lngth - (spot + 3) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 489 RETURN; 490 END; 491 WHILE (TheStr[ lngth - 3 ] # '.') AND (lngth < (HIGH(TheStr) + 1)) DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 492 Append( TheStr, '0' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 493 INC( lngth ); ***** ^ undeclared identifier ***** ^ not supported yet 494 END; 495 END MakeCurrency; ***** ^ not supported yet 496 497 498 PROCEDURE Center( VAR TheStr: ARRAY OF CHAR; ***** ^ not supported yet 499 RequiredLength: CARDINAL ); 500 VAR 501 PadLength, strlength: CARDINAL; 502 BEGIN 503 IF NOT ScanUtils.IsBlank( TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 504 CutLeadingChars( BLANK, TheStr ); ***** ^ not supported yet ***** ^ not supported yet 505 CutTrailingChars( BLANK, TheStr ); ***** ^ not supported yet ***** ^ not supported yet 506 END; 507 strlength := M2Strings.Length( TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 508 IF strlength > RequiredLength THEN 509 SetLength( TheStr, RequiredLength ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 510 ELSIF strlength < RequiredLength THEN 511 PadLength := (RequiredLength - strlength) DIV 2; 512 InsertTimes( ' ', TheStr, 0, PadLength ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 513 strlength := strlength + PadLength; 514 PadLength := RequiredLength - strlength; 515 InsertTimes( ' ', TheStr, strlength, PadLength ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 516 END; 517 END Center; ***** ^ not supported yet 518 519 520 PROCEDURE InsertRightJustified( str1: ARRAY OF CHAR; VAR ***** ^ not supported yet 521 str2: ARRAY OF CHAR; spot: CARDINAL ); ***** ^ not supported yet 522 523 (* Inserts str1 into str2 without changing the length of 524 str2. Deletes characters from the beginning of str2 to 525 make room for str1. Truncates str1 if necessary. *) 526 527 VAR 528 str1length, str2length: CARDINAL; 529 tmpstr: ARRAY [0..255] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 530 BEGIN 531 str1length := M2Strings.Length( str1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 532 str2length := M2Strings.Length( str2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 533 IF str1length > str2length THEN 534 SetLength( str1, str2length ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 535 str1length := str2length; 536 END; 537 LowLevel.Move( SYSTEM.ADR(str2), SYSTEM.ADR(tmpstr), Numbers.Min( HIGH(str2), HIGH(tmpstr)) + 1 ); ***** ^ 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 ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 538 (* We assign str2 to a tmpstr to avoid complications 539 associated with possible overflow of str2, and we do 540 it with a Move to avoid overhead of an AssignStr. *) 541 SetLength( tmpstr, str2length ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 542 IF spot >= str2length THEN 543 (* Means insertions beyond length of str2 will be 544 appended. *) 545 Append( str2, str1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 546 ELSE 547 M2Strings.Insert( str1, str2, spot ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 548 END; 549 M2Strings.Delete( str2, 0, str1length ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 550 END InsertRightJustified; ***** ^ not supported yet 551 552 PROCEDURE DeleteRightJustified( VAR TheStr: ARRAY OF CHAR; ***** ^ not supported yet 553 spot, HowMany: CARDINAL ); 554 (* Deletes HowMany characters from TheStr beginning with 555 spot, and fills in with blanks at the beginning of 556 TheStr to preserve its former length. *) 557 VAR 558 cnt: CARDINAL; 559 BEGIN 560 M2Strings.Delete( TheStr, spot, HowMany ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 561 FOR cnt := 1 TO HowMany DO 562 M2Strings.Insert( BLANK, TheStr, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 563 END; 564 END DeleteRightJustified; ***** ^ not supported yet 565 566 567 BEGIN 568 Initialized := FALSE; 569 Init(); ***** ^ not supported yet ***** ^ not supported yet 570 END StrEdit. ***** ^ not supported yet 600 errors