Listing: 1 IMPLEMENTATION MODULE StrInput; 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/strinput.mov 1.7 10 Mar 1991 15:33:36 coleb $ 12 * 13 *) 14 15 16 (*EntryDiag: 17 IMPORT Diagnostics; 18 :EntryDiag*) 19 20 IMPORT BigSets; 21 IMPORT ErrorManager; 22 IMPORT KbdInput; 23 IMPORT Key; 24 IMPORT LowLevel; 25 IMPORT M2Strings; 26 IMPORT Numbers; 27 IMPORT PosUtils; 28 IMPORT Spkr; 29 IMPORT StrConv; 30 IMPORT StrEdit; 31 IMPORT SYSTEM; 32 IMPORT VWindows; 33 34 VAR 35 Initialized : BOOLEAN; 36 37 PROCEDURE Init(); 38 BEGIN 39 IF Initialized THEN 40 RETURN; 41 ELSE 42 Initialized := TRUE; 43 END; 44 (*EntryDiag: 45 Diagnostics.Init(); 46 :EntryDiag*) 47 48 BigSets.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 49 ErrorManager.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 KbdInput.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 Key.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 LowLevel.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 53 M2Strings.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 54 Numbers.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 55 PosUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 56 Spkr.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 57 StrConv.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 58 StrEdit.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 59 VWindows.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 60 (*EntryDiag: 61 Diagnostics.diagS( 'Entering StrInput', '' ); 62 :EntryDiag*) 63 64 BeepAtNumbers := TRUE; ***** ^ undeclared identifier 65 66 (*EntryDiag: 67 Diagnostics.diagS( 'Exiting StrInput', '' ); 68 :EntryDiag*) 69 END Init; ***** ^ not supported yet 70 71 72 CONST 73 Minus = 45; (* ORD('-') *) 74 DecimalKey = 46; (* ORD('.') *) 75 CurrencySymbol = '$'; 76 blank = ' '; 77 78 79 PROCEDURE ReadWithEdits( WindowHandle: VWindows.AWindowHandle; ***** ^ not supported yet 80 VAR TheStr : ARRAY OF CHAR; col1, row1, FieldWidth: ***** ^ not supported yet 81 CARDINAL; VAR CursorPos: CARDINAL; VAR InsertMode: BOOLEAN; 82 scrolling: BOOLEAN; VAR LastKey : CARDINAL; VAR LegalKeys, 83 ExitKeys : KbdInput.KeyNumSet ); ***** ^ not supported yet 84 85 VAR 86 bufch : CHAR; 87 done, RedrawNeeded : BOOLEAN; 88 SavedHeight, StrNdx, CharsScrolled, TheStrLen : CARDINAL; 89 AllOkKeys: KbdInput.KeyNumSet; ***** ^ not supported yet 90 (* CursorPos = current offset of cursor from start of field *) 91 92 PROCEDURE redraw( BeginningAt: CARDINAL ); 93 VAR 94 TmpStr: ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 95 BEGIN 96 IF (BeginningAt < CharsScrolled) THEN 97 HALT(); ***** ^ undeclared identifier ***** ^ not supported yet 98 END; 99 M2Strings.Copy( TheStr, BeginningAt, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 100 M2Strings.Length(TheStr) - BeginningAt, TmpStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 101 BeginningAt := BeginningAt - CharsScrolled; 102 StrEdit.SetLength( TmpStr, FieldWidth - BeginningAt ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 IF (BeginningAt < FieldWidth) THEN 104 VWindows.DrawStr( WindowHandle, col1 + BeginningAt, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 105 row1, SYSTEM.ADR(TmpStr), FieldWidth - BeginningAt ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 106 RedrawNeeded := FALSE; 107 END; 108 END redraw; ***** ^ not supported yet 109 110 PROCEDURE MoveToPos( StrOffset: CARDINAL ); 111 BEGIN 112 WHILE (CursorPos + CharsScrolled) > StrOffset DO 113 (* we are moving backwards *) 114 IF CursorPos > 0 THEN 115 DEC( CursorPos ); ***** ^ undeclared identifier ***** ^ not supported yet 116 ELSE 117 RedrawNeeded := TRUE; 118 DEC( CharsScrolled ); ***** ^ undeclared identifier ***** ^ not supported yet 119 END; 120 DEC( StrNdx ); ***** ^ undeclared identifier ***** ^ not supported yet 121 END; 122 WHILE (CursorPos + CharsScrolled) < StrOffset DO 123 (* we are moving forewards *) 124 IF CursorPos < FieldWidth THEN 125 INC( CursorPos ); ***** ^ undeclared identifier ***** ^ not supported yet 126 ELSE 127 RedrawNeeded := TRUE; 128 INC( CharsScrolled ); ***** ^ undeclared identifier ***** ^ not supported yet 129 END; 130 INC( StrNdx ); ***** ^ undeclared identifier ***** ^ not supported yet 131 END; 132 END MoveToPos; ***** ^ not supported yet 133 134 PROCEDURE LeftToChar( TheChar: CHAR ); 135 BEGIN 136 WHILE (StrNdx > 0) AND (TheStr[ StrNdx ] # TheChar) DO ***** ^ not supported yet ***** ^ not supported yet 137 MoveToPos( StrNdx - 1 ); ***** ^ not supported yet ***** ^ not supported yet 138 END; 139 END LeftToChar; ***** ^ not supported yet 140 141 PROCEDURE RightToChar( TheChar: CHAR ); 142 BEGIN 143 WHILE (StrNdx < TheStrLen) AND (TheStr[ StrNdx ] # TheChar) DO ***** ^ not supported yet ***** ^ not supported yet 144 MoveToPos( StrNdx + 1 ); ***** ^ not supported yet ***** ^ not supported yet 145 END; 146 END RightToChar; ***** ^ not supported yet 147 148 PROCEDURE SkipLeftOver( TheChar: CHAR ); 149 BEGIN 150 WHILE (StrNdx > 0) AND (TheStr[ StrNdx ] = TheChar) DO ***** ^ not supported yet ***** ^ not supported yet 151 MoveToPos( StrNdx - 1 ); ***** ^ not supported yet ***** ^ not supported yet 152 END; 153 END SkipLeftOver; ***** ^ not supported yet 154 155 PROCEDURE SkipRightOver( TheChar: CHAR ); 156 BEGIN 157 WHILE (StrNdx < TheStrLen) AND (TheStr[ StrNdx ] = TheChar) DO ***** ^ not supported yet ***** ^ not supported yet 158 MoveToPos( StrNdx + 1 ); ***** ^ not supported yet ***** ^ not supported yet 159 END; 160 END SkipRightOver; ***** ^ not supported yet 161 162 BEGIN 163 (* ReadWithEdits *) 164 SavedHeight := VWindows.GetCursorHeight(WindowHandle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 165 TheStrLen := M2Strings.Length( TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 166 BigSets.SetUnion( LegalKeys, ExitKeys, AllOkKeys); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 167 FieldWidth := Numbers.Min( HIGH(TheStr) + 1, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 168 IF FieldWidth = 0 THEN 169 (* This means you can pass 0 to FieldWidth if your only 170 width concern is preventing overflow of TheStr. *) 171 FieldWidth := HIGH( TheStr ) + 1; ***** ^ undeclared identifier ***** ^ not supported yet 172 IF FieldWidth > (VWindows.EndCol(WindowHandle) - col1) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 173 FieldWidth := VWindows.EndCol(WindowHandle) - col1; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 174 END; 175 END; 176 WHILE TheStrLen < FieldWidth DO 177 StrEdit.Append( TheStr, blank ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 178 INC( TheStrLen ); ***** ^ undeclared identifier ***** ^ not supported yet 179 END; 180 IF (NOT scrolling) AND (TheStrLen > FieldWidth) THEN 181 StrEdit.SetLength( TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 182 TheStrLen := FieldWidth; 183 END; 184 CharsScrolled := 0; 185 StrNdx := CursorPos; 186 VWindows.GotoXY( WindowHandle, col1 + CursorPos, row1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 187 IF InsertMode THEN 188 VWindows.SetCursorHeight( WindowHandle, 6 ) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 189 ELSE 190 VWindows.SetCursorHeight( WindowHandle, 2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 191 END; 192 (*turns on cursor*) 193 done := FALSE; 194 RedrawNeeded := TRUE; 195 REPEAT 196 IF RedrawNeeded THEN 197 redraw( CharsScrolled ); ***** ^ not supported yet ***** ^ not supported yet 198 END; 199 VWindows.GotoXY( WindowHandle, col1 + CursorPos, row1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 200 LastKey := KbdInput.KeyHit( AllOkKeys); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 201 CASE LastKey OF 202 203 Key.Left : (* move to prior character position *) ***** ^ not supported yet ***** ^ not supported yet 204 IF StrNdx > 0 THEN 205 MoveToPos( StrNdx - 1 ); ***** ^ not supported yet ***** ^ not supported yet 206 ELSE 207 IF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 208 (* left arrow at start moves to prior field if 209 Key.Left in ExitKeys *) 210 done := TRUE; 211 END; 212 END; 213 214 | Key.Right : (* move to next character position *) ***** ^ not supported yet ***** ^ not supported yet 215 IF StrNdx + 1 < TheStrLen THEN 216 MoveToPos( StrNdx + 1 ); ***** ^ not supported yet ***** ^ not supported yet 217 ELSE 218 IF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 219 (* left arrow at end moves to next field if 220 Key.Right in ExitKeys *) 221 done := TRUE; 222 END; 223 END; 224 225 | Key.Del : (* Delete char under cursor *) ***** ^ not supported yet ***** ^ not supported yet 226 M2Strings.Delete( TheStr, StrNdx, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 227 StrEdit.Append( TheStr, blank ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 228 redraw( StrNdx ); ***** ^ not supported yet ***** ^ not supported yet 229 230 | Key.Home : (* Go to beginning of field *) ***** ^ not supported yet ***** ^ not supported yet 231 IF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 232 done := TRUE; 233 ELSE 234 MoveToPos( 0 ); ***** ^ not supported yet ***** ^ not supported yet 235 END; 236 237 | Key.End : (* Go past last character written *) ***** ^ not supported yet ***** ^ not supported yet 238 IF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 239 done := TRUE; 240 ELSE 241 MoveToPos( TheStrLen - 1 ); ***** ^ not supported yet ***** ^ not supported yet 242 SkipLeftOver( blank ); ***** ^ not supported yet ***** ^ not supported yet 243 RightToChar( blank ); ***** ^ not supported yet ***** ^ not supported yet 244 END; 245 246 | Key.CtrlRight, Key.Tab : (* Go to next word *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 247 IF ((StrNdx = TheStrLen) OR (LastKey = Key.Tab)) AND ***** ^ not supported yet ***** ^ not supported yet 248 BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 249 (* Tab or no next word found, so exit *) 250 done := TRUE; 251 ELSE 252 IF TheStr[ StrNdx ] = blank THEN ***** ^ not supported yet ***** ^ not supported yet 253 SkipRightOver( blank ); ***** ^ not supported yet ***** ^ not supported yet 254 ELSE 255 RightToChar( blank ); ***** ^ not supported yet ***** ^ not supported yet 256 SkipRightOver( blank ); ***** ^ not supported yet ***** ^ not supported yet 257 END; 258 END; 259 260 | Key.CtrlLeft, Key.BackTab : (* Go to previous word *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 261 IF ((StrNdx = 0) OR (LastKey = Key.BackTab)) AND BigSets.InSet( ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 262 ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet 263 (* BackTab or no previous word, so exit *) 264 done := TRUE; 265 ELSE 266 IF TheStr[ StrNdx ] # blank THEN ***** ^ not supported yet ***** ^ not supported yet 267 LeftToChar( blank ); ***** ^ not supported yet ***** ^ not supported yet 268 END; 269 SkipLeftOver( blank ); ***** ^ not supported yet ***** ^ not supported yet 270 LeftToChar( blank ); ***** ^ not supported yet ***** ^ not supported yet 271 SkipRightOver( blank ); ***** ^ not supported yet ***** ^ not supported yet 272 END; 273 274 | Key.AltD : (* Erase the entire entry *) ***** ^ not supported yet ***** ^ not supported yet 275 LowLevel.Fill( SYSTEM.ADR( TheStr ), TheStrLen, blank ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 276 MoveToPos( 0 ); ***** ^ not supported yet ***** ^ not supported yet 277 RedrawNeeded := TRUE; 278 279 | Key.AltE : (* Erase to the end of the field *) ***** ^ not supported yet ***** ^ not supported yet 280 LowLevel.Fill( LowLevel.AddAddr( SYSTEM.ADR(TheStr), ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 281 StrNdx), TheStrLen - StrNdx, blank ); ***** ^ not supported yet ***** ^ not supported yet 282 redraw( StrNdx ); ***** ^ not supported yet ***** ^ not supported yet 283 284 | Key.Ins : (* Toggle insert mode on and off *) ***** ^ not supported yet ***** ^ not supported yet 285 InsertMode := NOT InsertMode; 286 IF InsertMode THEN 287 VWindows.SetCursorHeight( WindowHandle, 6 ) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 288 ELSE 289 VWindows.SetCursorHeight(WindowHandle, 2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 290 END; 291 292 | Key.Escape : ***** ^ not supported yet ***** ^ not supported yet 293 done := TRUE; 294 (* Unconditionally exit if the user presses ESC. *) 295 296 | Key.BackSpace : ***** ^ not supported yet ***** ^ not supported yet 297 IF (StrNdx > 0) THEN 298 MoveToPos( StrNdx - 1 ); ***** ^ not supported yet ***** ^ not supported yet 299 IF InsertMode THEN 300 M2Strings.Delete( TheStr, StrNdx, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 301 StrEdit.Append( TheStr, blank ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 302 ELSE 303 TheStr[ StrNdx ] := blank; ***** ^ not supported yet ***** ^ not supported yet 304 END; 305 redraw( StrNdx ); ***** ^ not supported yet ***** ^ not supported yet 306 ELSIF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 307 done := TRUE; 308 END; 309 310 ELSE 311 IF BigSets.InSet( ExitKeys, LastKey ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 312 done := TRUE; 313 ELSIF (StrNdx < TheStrLen) AND (LastKey < 314 KbdInput.Extended) THEN ***** ^ not supported yet ***** ^ not supported yet 315 (* normal key pressed and cursor is not past end *) 316 IF InsertMode THEN 317 IF NOT scrolling THEN 318 M2Strings.Delete( TheStr, TheStrLen - 1, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 319 END; 320 bufch := CHR( LastKey ); ***** ^ undeclared identifier ***** ^ not supported yet 321 M2Strings.Insert( bufch, TheStr, StrNdx ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 322 ELSE 323 TheStr[ StrNdx ] := CHR( LastKey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 324 END; 325 redraw( StrNdx ); ***** ^ not supported yet ***** ^ not supported yet 326 MoveToPos( StrNdx + 1 ); ***** ^ not supported yet ***** ^ not supported yet 327 ELSE 328 Spkr.Noise( Spkr.Warble, Spkr.Normal, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 329 Spkr.Short); ***** ^ not supported yet ***** ^ not supported yet 330 END; 331 END; 332 UNTIL done; 333 StrEdit.SetLength( TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 334 (*We do this because TheStr may have gotten longer if 335 we've been scrolling.*) 336 VWindows.SetCursorHeight( WindowHandle, SavedHeight ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 337 END ReadWithEdits; ***** ^ not supported yet 338 339 340 PROCEDURE ReadNumeric( WindowHandle: 341 VWindows.AWindowHandle; VAR TheStr : ARRAY OF ***** ^ not supported yet 342 CHAR; col1, row1, FieldWidth: CARDINAL; ***** ^ not supported yet 343 DecimalPlaces: CARDINAL; FloatingPoint: BOOLEAN; 344 VAR InDecimals: BOOLEAN; VAR LastKey : CARDINAL; 345 VAR ExitKeys : KbdInput.KeyNumSet ); ***** ^ not supported yet 346 347 VAR 348 SavedHeight, cnt, DecimalSpot, InsertionPoint, 349 NonBlankLength: CARDINAL; 350 AtLeadingZero: BOOLEAN; 351 LegalKeys, AllOkKeys: KbdInput.KeyNumSet; ***** ^ not supported yet 352 DumStr: ARRAY [0..0] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 353 354 BEGIN 355 (* First we make sure the FieldWidth is okay. *) 356 IF FieldWidth = 0 THEN 357 FieldWidth := HIGH( TheStr ) + 1; ***** ^ undeclared identifier ***** ^ not supported yet 358 ELSE 359 FieldWidth := Numbers.Min( HIGH(TheStr) + 1, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 360 END; 361 FieldWidth := Numbers.Min( VWindows.EndCol(WindowHandle) - col1, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 362 FieldWidth ); ***** ^ not supported yet 363 StrEdit.RightJustify( TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 364 SavedHeight := VWindows.GetCursorHeight(WindowHandle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 365 VWindows.SetCursorHeight( WindowHandle, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 366 367 (* Now we make sure DecimalPlaces is consistent with 368 TheStr; if it's not, the number of DecimalPlaces in 369 TheStr overrides. If there's no decimal point in TheStr 370 at all, however, we'll make it consistent with 371 DecimalPlaces. *) 372 IF PosUtils.PresentPos( CHR(DecimalKey), TheStr, DecimalSpot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 373 IF (DecimalSpot + 1) # (FieldWidth - DecimalPlaces) THEN 374 DecimalPlaces := (FieldWidth - DecimalSpot) - 1; 375 END; 376 ELSIF (DecimalPlaces > 0) OR FloatingPoint THEN 377 IF DecimalPlaces = 0 THEN 378 (*We're here because FloatingPoint was true.*) 379 DecimalPlaces := 1; 380 (*Makes sure that we've at least got 0.0 in TheStr if 381 FloatingPoint is true; prevents InsertionPoint from 382 incrementing beyond FieldWidth, below.*) 383 END; 384 IF PosUtils.IsBlank( TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 385 StrEdit.InsertRightJustified( '0', TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 386 END; 387 StrEdit.InsertRightJustified( '.', TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 388 FOR cnt := 1 TO DecimalPlaces DO 389 StrEdit.InsertRightJustified( '0', TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 390 END; 391 DecimalSpot := PosUtils.Pos( CHR(DecimalKey), TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 392 ELSE 393 DecimalSpot := M2Strings.Length( TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 394 IF PosUtils.IsBlank( TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 395 (* Mike McCarthy's bug fix. *) 396 StrEdit.InsertRightJustified( '0', TheStr, FieldWidth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 397 END; 398 END; 399 400 (* Now force FloatingPoint to false if CurrencySymbol is in 401 TheStr. *) 402 IF PosUtils.Present( CurrencySymbol, TheStr ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 403 FloatingPoint := FALSE; 404 END; 405 406 (* Now we find the insertion point. *) 407 InsertionPoint := DecimalSpot; 408 IF InDecimals THEN 409 REPEAT 410 INC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 411 UNTIL (InsertionPoint >= FieldWidth) OR 412 (TheStr[InsertionPoint] = '0'); ***** ^ not supported yet ***** ^ not supported yet 413 ELSE 414 IF (TheStr[ InsertionPoint - 1 ] = '0') AND ( (InsertionPoint <= ***** ^ not supported yet ***** ^ not supported yet 415 1) OR (NOT PosUtils.Present(TheStr[InsertionPoint - 2], ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 416 '0123456789'))) THEN ***** ^ not supported yet 417 AtLeadingZero := TRUE; 418 ELSE 419 AtLeadingZero := FALSE; 420 END; 421 END; 422 423 BigSets.InitSet( LegalKeys ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 424 BigSets.AppendSet( LegalKeys, "{8, 331, '.', '-', '0'..'9'}" ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 425 BigSets.SetUnion( LegalKeys, ExitKeys, AllOkKeys); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 426 REPEAT 427 VWindows.DrawStr( WindowHandle, col1, row1, SYSTEM.ADR(TheStr), 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 428 VWindows.GotoXY( WindowHandle, col1 + InsertionPoint, row1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 429 LastKey := KbdInput.KeyHit( AllOkKeys); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 430 CASE LastKey OF 431 48..57: (* ASCII values of '0' to '9' *) 432 IF InDecimals THEN 433 IF (InsertionPoint = FieldWidth) THEN 434 IF FloatingPoint AND (TheStr[0] = blank) THEN ***** ^ not supported yet ***** ^ not supported yet 435 DumStr[0] := CHR(LastKey); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 436 IF BeepAtNumbers THEN ***** ^ undeclared identifier 437 Spkr.TimedNoise( (LastKey * 100) - 4400, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 438 END; 439 StrEdit.InsertRightJustified( DumStr, TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 440 InsertionPoint ); ***** ^ not supported yet 441 DEC( DecimalSpot ); ***** ^ undeclared identifier ***** ^ not supported yet 442 ELSE 443 Spkr.Noise( Spkr.Warble, Spkr.Normal, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 444 Spkr.Short); ***** ^ not supported yet ***** ^ not supported yet 445 END; 446 ELSE 447 IF BeepAtNumbers THEN ***** ^ undeclared identifier 448 Spkr.TimedNoise( (LastKey * 100) - 4400, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 449 END; 450 TheStr[ InsertionPoint ] := CHR( LastKey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 451 INC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 452 END; 453 ELSE 454 IF AtLeadingZero THEN 455 IF CHR(LastKey) # '0' THEN ***** ^ undeclared identifier ***** ^ not supported yet 456 IF BeepAtNumbers THEN ***** ^ undeclared identifier 457 Spkr.TimedNoise( (LastKey * 100) - 4400, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 458 END; 459 TheStr[ InsertionPoint - 1 ] := CHR( LastKey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 460 AtLeadingZero := FALSE; 461 END 462 ELSE 463 IF TheStr[0] = blank THEN ***** ^ not supported yet ***** ^ not supported yet 464 DumStr[0] := CHR(LastKey); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 465 IF BeepAtNumbers THEN ***** ^ undeclared identifier 466 Spkr.TimedNoise( (LastKey * 100) - 4400, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 467 END; 468 StrEdit.InsertRightJustified( DumStr, TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 469 InsertionPoint ); ***** ^ not supported yet 470 ELSE 471 Spkr.Noise( Spkr.Warble, Spkr.Normal, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 472 Spkr.Short); ***** ^ not supported yet ***** ^ not supported yet 473 END; 474 END; 475 END; 476 | Minus: (* '-' *) ***** ^ not supported yet 477 IF AtLeadingZero AND (InsertionPoint > 1) THEN 478 IF (TheStr[InsertionPoint - 2] # '-') THEN ***** ^ not supported yet ***** ^ not supported yet 479 TheStr[ InsertionPoint - 1 ] := CHR( LastKey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 480 StrEdit.InsertRightJustified( '0', TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 481 InsertionPoint ); ***** ^ not supported yet 482 (* Note that we're still AtLeadingZero here. *) 483 END; 484 END; 485 | DecimalKey: ***** ^ not supported yet 486 IF (NOT InDecimals) AND (FloatingPoint OR (DecimalPlaces 487 > 0)) THEN 488 InDecimals := TRUE; 489 INC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 490 END; 491 | Key.BackSpace: ***** ^ not supported yet ***** ^ not supported yet 492 IF InDecimals THEN 493 IF InsertionPoint = (DecimalSpot + 1) THEN 494 InDecimals := FALSE; 495 DEC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 496 IF (NOT PosUtils.Present(TheStr[InsertionPoint - 1], ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 497 '0123456789')) THEN ***** ^ not supported yet 498 AtLeadingZero := TRUE; 499 StrEdit.InsertRightJustified( '0', TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 500 InsertionPoint ); ***** ^ not supported yet 501 END; 502 ELSE 503 IF FloatingPoint THEN 504 IF (InsertionPoint = FieldWidth) THEN 505 IF (InsertionPoint > (DecimalSpot + 1) ) THEN 506 StrEdit.DeleteRightJustified( TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 507 InsertionPoint - 1, 1 ); ***** ^ not supported yet 508 INC( DecimalSpot ); ***** ^ undeclared identifier ***** ^ not supported yet 509 ELSE 510 InDecimals := FALSE; 511 DEC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 512 END; 513 ELSE 514 TheStr[ InsertionPoint - 1 ] := '0'; ***** ^ not supported yet ***** ^ not supported yet 515 DEC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 516 END; 517 ELSE 518 TheStr[ InsertionPoint - 1 ] := '0'; ***** ^ not supported yet ***** ^ not supported yet 519 DEC( InsertionPoint ); ***** ^ undeclared identifier ***** ^ not supported yet 520 END; 521 END; 522 ELSE 523 IF NOT AtLeadingZero THEN 524 StrEdit.DeleteRightJustified( TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 525 InsertionPoint - 1, 1 ); ***** ^ not supported yet 526 IF (NOT PosUtils.Present(TheStr[InsertionPoint - 1], ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 527 '0123456789')) THEN ***** ^ not supported yet 528 AtLeadingZero := TRUE; 529 IF TheStr[InsertionPoint - 1] = '-' THEN ***** ^ not supported yet ***** ^ not supported yet 530 (*Get rid of the minus sign, if it's there.*) 531 StrEdit.DeleteRightJustified( TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 532 InsertionPoint - 1, 1 ); ***** ^ not supported yet 533 END; 534 StrEdit.InsertRightJustified( '0', TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 535 InsertionPoint ); ***** ^ not supported yet 536 END; 537 END; 538 END; 539 ELSE 540 END; 541 UNTIL BigSets.InSet( ExitKeys, LastKey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 542 VWindows.SetCursorHeight( WindowHandle, SavedHeight ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 543 END ReadNumeric; ***** ^ not supported yet 544 545 546 BEGIN 547 Initialized := FALSE; 548 Init(); ***** ^ not supported yet ***** ^ not supported yet 549 END StrInput. ***** ^ not supported yet 583 errors