| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138 |
- 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
|