Listing: 1 IMPLEMENTATION MODULE WindowPrims; 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/windowpr.mov 1.9 17 Mar 1991 18:01:28 coleb $ 12 * 13 *) 14 15 (*EntryDiag: 16 IMPORT Diagnostics; 17 :EntryDiag*) 18 19 IMPORT ErrorManager; 20 IMPORT KbdInput; 21 IMPORT LowLevel; 22 IMPORT M2Strings; 23 IMPORT Numbers; 24 IMPORT PosUtils; 25 IMPORT SmartScreen; 26 IMPORT StrConv; 27 IMPORT StrEdit; 28 IMPORT StringIO; 29 IMPORT VStorage; 30 IMPORT VWindows; 31 32 IMPORT SYSTEM; 33 IMPORT FAPI; 34 35 VAR 36 Initialized : BOOLEAN; 37 38 39 CONST 40 blank = ' '; 41 null = ''; 42 InsufficientMemory = 'WindowPr -- Too little memory'; ***** ^ not supported yet 43 StackError = 'Misuse of Push/Pop routines in WindowPrims'; ***** ^ not supported yet 44 OS2Error =' os/2 returned error from Video subsystem'; ***** ^ not supported yet 45 backspace = 10C; 46 CarriageReturn = 15C; 47 48 lftcol = 4; 49 toprow = 3; 50 rtcol = 44; 51 btmrow = 14; 52 midcol = 24; 53 midrow = 9; 54 (* These define the starting points for the 4 msg box areas *) 55 56 TYPE 57 Cell = 58 RECORD 59 Char, Attribute: CHAR; 60 END; ***** ^ not supported yet 61 62 VAR 63 StartingCursorHt : CARDINAL; 64 NilValue : VStorage.MemHandle; ***** ^ not supported yet 65 66 67 PROCEDURE GetCursorCoords(VAR column, row : CARDINAL); 68 BEGIN 69 IF FAPI.VIOGETCURPOS(SYSTEM.ADR(row), SYSTEM.ADR(column), 0) # 0 THEN ***** ^ 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 70 ErrorManager.WARN("VioGetCurPos"); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 71 END; 72 (* Remember that the Repertoire convention is to number 73 the top left corner 1,1; OS/2 numbers it 0,0. We ought 74 to follow the OS/2 convention, probably, but changing 75 now would be difficult. *) 76 INC(column); ***** ^ undeclared identifier ***** ^ not supported yet 77 INC(row); ***** ^ undeclared identifier ***** ^ not supported yet 78 END GetCursorCoords; ***** ^ not supported yet 79 80 81 PROCEDURE left(); 82 (*Moves the cursor one space left.*) 83 VAR 84 col, row : CARDINAL; 85 BEGIN 86 GetCursorCoords(col, row); ***** ^ not supported yet ***** ^ not supported yet 87 col := col-1; 88 SmartScreen.GotoXY(col, row); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 89 END left; ***** ^ not supported yet 90 91 PROCEDURE right(); 92 (*Moves the cursor one space right.*) 93 VAR 94 col, row : CARDINAL; 95 BEGIN 96 GetCursorCoords(col, row); ***** ^ not supported yet ***** ^ not supported yet 97 col := col+1; 98 SmartScreen.GotoXY(col, row); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 99 END right; ***** ^ not supported yet 100 101 PROCEDURE up(); 102 (*Moves the cursor one row up.*) 103 VAR 104 col, row : CARDINAL; 105 BEGIN 106 GetCursorCoords(col, row); ***** ^ not supported yet ***** ^ not supported yet 107 row := row-1; 108 SmartScreen.GotoXY(col, row); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 109 END up; ***** ^ not supported yet 110 111 PROCEDURE down(); 112 (*Moves the cursor one row down.*) 113 VAR 114 col, row : CARDINAL; 115 BEGIN 116 GetCursorCoords(col, row); ***** ^ not supported yet ***** ^ not supported yet 117 row := row+1; 118 SmartScreen.GotoXY(col, row); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 119 END down; ***** ^ not supported yet 120 121 PROCEDURE coord(ColNum, RowNum : CARDINAL) : CARDINAL; 122 (*Makes it easier to work WITH the routines below, which 123 treat the screen as a linear sequence OF 4000 bytes.*) 124 BEGIN 125 RETURN (Numbers.Between(0,RowNum-1,SmartScreen.MaxRow-1) * ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 126 SmartScreen.MaxCol+ Numbers.Between(1,ColNum, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 127 SmartScreen.MaxCol)); ***** ^ not supported yet ***** ^ not supported yet 128 END coord; ***** ^ not supported yet 129 130 PROCEDURE WriteVidCh(spot : CARDINAL; TheChar : SmartScreen.VideoMemChar); ***** ^ not supported yet 131 BEGIN 132 SmartScreen.NominalCol := spot MOD SmartScreen.MaxCol; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 133 SmartScreen.NominalRow := (spot DIV SmartScreen.MaxCol)+1; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 134 CASE SmartScreen.VideoMethod OF ***** ^ not supported yet ***** ^ not supported yet 135 SmartScreen.DMA, SmartScreen.ROM : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 136 IF FAPI.VIOWRTCELLSTR( SYSTEM.ADR(TheChar), 1, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 137 SmartScreen.NominalRow, SmartScreen.NominalCol, 0) # 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 138 ErrorManager.WARN(OS2Error); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 139 END; 140 ELSE 141 SmartScreen.GotoXY(SmartScreen.NominalCol, SmartScreen.NominalRow); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 142 StringIO.WriteStr(StringIO.outp, TheChar.ch); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 143 END; 144 END WriteVidCh; ***** ^ not supported yet 145 146 147 TYPE 148 CoordStackPtr = POINTER TO CoordStackElem; ***** ^ undeclared identifier 149 CoordStackElem = 150 RECORD 151 col, row: CARDINAL; 152 prv: CoordStackPtr; 153 END; ***** ^ not supported yet 154 VAR 155 CoordStackTop: CoordStackPtr; ***** ^ not supported yet 156 157 PROCEDURE PushCursorCoords(); 158 (*For temporary storage of a cursor position.*) 159 VAR 160 tmp: CoordStackPtr; ***** ^ not supported yet 161 BEGIN 162 VStorage.DosAlloc( tmp, SYSTEM.TSIZE(CoordStackElem) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 163 tmp^.prv := CoordStackTop; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 164 WITH tmp^ DO ***** ^ not supported yet 165 GetCursorCoords( col, row ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 166 END; ***** ^ not supported yet 167 CoordStackTop := tmp; ***** ^ not supported yet ***** ^ undeclared identifier 168 END PushCursorCoords; ***** ^ not supported yet 169 170 PROCEDURE PopCursorCoords(); 171 VAR 172 tmp: CoordStackPtr; ***** ^ not supported yet 173 BEGIN 174 tmp := CoordStackTop; ***** ^ not supported yet ***** ^ not supported yet 175 IF tmp = NIL THEN ***** ^ not supported yet 176 ErrorManager.WARN( StackError ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 177 END; 178 WITH tmp^ DO ***** ^ not supported yet 179 SmartScreen.GotoXY( col, row ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 180 SmartScreen.NominalCol := col; ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 181 SmartScreen.NominalRow := row; ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 182 END; ***** ^ not supported yet 183 CoordStackTop := CoordStackTop^.prv; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 184 VStorage.DosDealloc( tmp, SYSTEM.TSIZE(CoordStackElem) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 185 END PopCursorCoords; ***** ^ not supported yet 186 187 PROCEDURE GetCursorHeight(): CARDINAL; 188 VAR 189 CursorData: FAPI.VIOCURSORINFO; ***** ^ not supported yet 190 ErrorNum, height: CARDINAL; 191 BEGIN 192 ErrorNum := FAPI.VIOGETCURTYPE( SYSTEM.ADR(CursorData), 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 193 IF ErrorNum # 0 THEN 194 ErrorManager.WarnNumber("VIOGETCURTYPE error", ErrorNum); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 195 END; 196 IF (CursorData.cEnd 0 THEN 291 lines := Numbers.Min( vertdist, lines ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 292 ELSE 293 lines := - INTEGER(Numbers.Min( vertdist, ABS(lines) )); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 294 END; 295 IF (lines = 0) OR (ABS(lines) = vertdist) THEN ***** ^ undeclared identifier ***** ^ not supported yet 296 (* clear the entire window *) 297 SmartScreen.ClearPart( col1, row1, col2, row2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 298 ELSE 299 BackGroundCell.Char := ' '; ***** ^ not supported yet ***** ^ not supported yet 300 backg := ORD(SmartScreen.BackGround); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 301 LowLevel.ShiftLeft(backg, 4); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 302 BackGroundCell.Attribute := CHR(ORD(SmartScreen.ForeGround)+backg); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 303 IF lines < 0 THEN 304 IF FAPI.VIOSCROLLDN(row1-1,col1-1,row2-1,col2-1,ABS(lines), ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 305 SYSTEM.ADR(BackGroundCell.Char),0) # 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 306 ErrorManager.WARN('scrolldn error'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 307 END; 308 ELSE 309 IF FAPI.VIOSCROLLUP(row1-1,col1-1,row2-1,col2-1,ABS(lines), ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 310 SYSTEM.ADR(BackGroundCell.Char),0) #0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 311 ErrorManager.WARN('scrollup error'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 312 END; 313 END; 314 END; 315 END ScrollWindow; ***** ^ not supported yet 316 317 318 PROCEDURE ScreenSave(VAR scrn : ScreenType; col1, row1, col2, ***** ^ undeclared identifier 319 row2 : CARDINAL); 320 VAR 321 row, widmem : CARDINAL; 322 MemPtr: LowLevel.Address8086; ***** ^ not supported yet 323 BEGIN 324 WITH scrn DO ***** ^ not supported yet 325 width := Numbers.Between(1,col2-col1+1,SmartScreen.MaxCol); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 326 size := width * Numbers.Between(1,row2-row1+1,SmartScreen.MaxRow)*2; ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 327 (*It's *2 to make room for attribute bytes.*) 328 IF NOT VStorage.AllocMem( handle, size ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 329 StringIO.WriteEol( StringIO.outp, InsufficientMemory ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 330 IF 0 = KbdInput.KeyHit( KbdInput.AnyKeyNum ) THEN END; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 331 HALT; ***** ^ undeclared identifier 332 END; 333 MemPtr.a := VStorage.LockMem( handle ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 334 IF (col1 = 1) AND (col2 = SmartScreen.MaxCol) AND ***** ^ not supported yet ***** ^ not supported yet 335 (row1 = 1) AND (row2 = SmartScreen.MaxRow) THEN ***** ^ not supported yet ***** ^ not supported yet 336 (* to save entire screen *) 337 IF FAPI.VIOREADCELLSTR( ***** ^ not supported yet ***** ^ not supported yet 338 MemPtr.a, ***** ^ not supported yet ***** ^ not supported yet 339 SYSTEM.ADR(size), ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 340 row1 - 1, col1 - 1, 0 ) # 0 THEN ***** ^ not supported yet 341 ErrorManager.WARN( 'VioReadCellStr error' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 342 END; 343 ELSE 344 (* to save only part of screen *) 345 widmem := 2*width; ***** ^ undeclared identifier 346 FOR row := row1 TO row2 DO 347 IF FAPI.VIOREADCELLSTR( ***** ^ not supported yet ***** ^ not supported yet 348 LowLevel.AddAddr(MemPtr.a, widmem*(row-row1)), ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 349 SYSTEM.ADR(widmem), ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 350 row - 1, col1 - 1, 0 ) # 0 THEN ***** ^ not supported yet 351 ErrorManager.WARN( 'VioReadCellStr error' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 352 END; 353 END; 354 END; 355 VStorage.UnLockMem( handle ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 356 END; ***** ^ not supported yet 357 END ScreenSave; ***** ^ not supported yet 358 359 360 PROCEDURE ScreenRestore(scrn : ScreenType; col, row : CARDINAL); ***** ^ undeclared identifier 361 VAR 362 cnt, offset, widmem: CARDINAL; 363 MemPtr: LowLevel.Address8086; ***** ^ not supported yet 364 RowRestored, NumOfRowsToRestore:CARDINAL; 365 BEGIN 366 MemPtr.a := VStorage.LockMem( scrn.handle ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 367 widmem := 2 * scrn.width; ***** ^ not supported yet ***** ^ not supported yet 368 NumOfRowsToRestore := (scrn.size DIV scrn.width) DIV 2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 369 RowRestored := row-1; 370 cnt := 0; 371 REPEAT 372 offset := cnt * widmem; 373 IF FAPI.VIOWRTCELLSTR( LowLevel.AddAddr(MemPtr.a, offset), ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 374 widmem, RowRestored, col-1, 0 ) # 0 THEN ***** ^ not supported yet 375 ErrorManager.WARN("VioWrtCellStr error"); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 376 END; 377 INC(RowRestored); ***** ^ undeclared identifier ***** ^ not supported yet 378 INC(cnt); ***** ^ undeclared identifier ***** ^ not supported yet 379 UNTIL cnt >= NumOfRowsToRestore; 380 VStorage.UnLockMem( scrn.handle ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 381 VStorage.DeallocMem( scrn.handle, scrn.size ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 382 END ScreenRestore; ***** ^ not supported yet 383 384 385 PROCEDURE DrawLine( col1, row1, col2, row2: CARDINAL; TheChar: 386 CHAR ); 387 VAR 388 row : CARDINAL; 389 linestr : ARRAY [0..80] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 390 BEGIN 391 IF col1 < col2 THEN 392 (*We're drawing a horizontal line.*) 393 LowLevel.Fill( SYSTEM.ADR(linestr), 1+HIGH(linestr), TheChar); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 394 StrEdit.SetLength( linestr, col2 - col1 +1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 395 SmartScreen.WriteAt( col1, row1, linestr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 396 ELSE 397 (*We're drawing a vertical line.*) 398 FOR row := row1 TO row2 DO 399 SmartScreen.WriteAt( col1, row, TheChar ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 400 END; 401 END; 402 END DrawLine; ***** ^ not supported yet 403 404 PROCEDURE DrawBox(col1, row1, col2, row2 : CARDINAL); 405 BEGIN 406 DrawThisBox( SingleBox, col1, row1, col2, row2 ); ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 407 END DrawBox; ***** ^ not supported yet 408 409 PROCEDURE DrawDblBox(col1, row1, col2, row2 : CARDINAL); 410 BEGIN 411 DrawThisBox( DoubleBox, col1, row1, col2, row2 ); ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 412 END DrawDblBox; ***** ^ not supported yet 413 414 415 PROCEDURE DrawThisBox( BoxChars: VWindows.BoxStr; col1, ***** ^ not supported yet 416 row1, col2, row2 : CARDINAL); 417 VAR 418 row, lngth : CARDINAL; 419 UpperBound, LowerBound: CARDINAL; 420 linestr : ARRAY [0..127] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 421 BEGIN 422 LowLevel.Fill(SYSTEM.ADR(linestr), 1+HIGH(linestr), BoxChars[1] ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 423 linestr[0] := BoxChars[0]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 424 lngth := col2-col1+1; 425 StrEdit.SetLength( linestr, lngth ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 426 linestr[lngth-1] := BoxChars[2]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 427 SmartScreen.AdrWriteAt(col1, row1, SYSTEM.ADR(linestr), lngth); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 428 LowerBound := row1 + 1; 429 UpperBound := row2 - 1; 430 FOR row := LowerBound TO UpperBound DO 431 SmartScreen.AdrWriteAt(col1, row, SYSTEM.ADR(BoxChars[3]), 1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 432 SmartScreen.AdrWriteAt(col2, row, SYSTEM.ADR(BoxChars[4]), 1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 433 END; 434 LowLevel.Fill(SYSTEM.ADR(linestr), 1+HIGH(linestr), BoxChars[6] ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 435 linestr[0] := BoxChars[5]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 436 linestr[lngth-1] := BoxChars[7]; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 437 SmartScreen.AdrWriteAt(col1, row2, SYSTEM.ADR(linestr), lngth); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 438 END DrawThisBox; ***** ^ not supported yet 439 440 441 PROCEDURE MsgBox(locatn : VWindows.Compass; TheStr : ARRAY OF ***** ^ not supported yet 442 CHAR; LegalKeys: KbdInput.KeyNumSet; VAR KeyPressed : CARDINAL); ***** ^ not supported yet ***** ^ not supported yet 443 CONST 444 width = 30; 445 LastRow = 17; 446 VAR 447 leng, breakspot, lastbreak : INTEGER; 448 indx, maxleng, newleng, i, col1, row1, rowspot, colspot : CARDINAL; 449 screen : ScreenType; ***** ^ undeclared identifier 450 msgary : ARRAY [0..LastRow] OF ARRAY [0..width] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 451 BEGIN 452 PushColors(); ***** ^ not supported yet ***** ^ not supported yet 453 PushCursorCoords(); ***** ^ not supported yet ***** ^ not supported yet 454 PushCursorHeight(); ***** ^ not supported yet ***** ^ not supported yet 455 SmartScreen.SetCursorHeight(0); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 456 SmartScreen.SetAttribOrColor(MsgForeColor, MsgBackColor, MsgMonoAtrib); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ undeclared identifier 457 CASE locatn OF ***** ^ not supported yet 458 VWindows.West, VWindows.NW, VWindows.SW : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 459 col1 := lftcol; 460 | VWindows.North, VWindows.South : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 461 col1 := midcol; 462 | VWindows.East, VWindows.NE, VWindows.SE : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 463 col1 := rtcol; 464 END; 465 CASE locatn OF ***** ^ not supported yet 466 VWindows.North, VWindows.NW, VWindows.NE : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 467 row1 := toprow; 468 | VWindows.East, VWindows.West : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 469 row1 := midrow; 470 | VWindows.South, VWindows.SE, VWindows.SW : ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 471 row1 := btmrow; 472 END; 473 (* now break the text into rows and put it into msgary *) 474 leng := M2Strings.Length(TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 475 lastbreak := -1; 476 maxleng := 23; 477 indx := 0; 478 REPEAT 479 (*If the width of the window is less than the number of chars 480 yet to be written.*) 481 IF (width < (leng - lastbreak)) THEN 482 breakspot := PosUtils.BreakPoint( TheStr, lastbreak + width, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 483 " -;,\/)]}" ); ***** ^ not supported yet 484 IF breakspot <= lastbreak THEN 485 (*We didn't find any better place to break than we did last 486 time through, so we have to cut the string in the middle 487 of something.*) 488 breakspot := (lastbreak + width) - 1; 489 END; 490 ELSE 491 breakspot := leng; 492 END; 493 newleng := INTEGER(breakspot - lastbreak); ***** ^ not supported yet 494 (*INTEGER type cast necessary for JPI compiler.*) 495 M2Strings.Copy(TheStr, lastbreak+1, newleng, msgary[indx]); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 496 IF newleng>maxleng THEN 497 maxleng := newleng; 498 END; 499 INC(indx); ***** ^ undeclared identifier ***** ^ not supported yet 500 lastbreak := breakspot; 501 UNTIL (lastbreak = leng) OR (indx > LastRow); 502 ScreenSave(screen, col1, row1, col1+maxleng+3, row1+indx+3); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 503 SmartScreen.ClearPart(col1, row1, col1+maxleng+3, row1+indx+3); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 504 (* save & clear an area of the required size *) 505 DrawThisBox( SingleBox,col1, row1, col1+maxleng+3, row1+indx+3); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 506 (* draw a box of the required size *) 507 colspot := col1+2; 508 rowspot := row1+1; 509 FOR i := 1 TO indx DO 510 (* write text in window *) 511 SmartScreen.WriteAt(colspot, rowspot+i, msgary[i-1]); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 512 END; 513 KeyPressed := KbdInput.KeyHit( LegalKeys ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 514 ScreenRestore(screen, col1, row1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 515 PopCursorCoords(); ***** ^ not supported yet ***** ^ not supported yet 516 PopCursorHeight(); ***** ^ not supported yet ***** ^ not supported yet 517 PopColors(); ***** ^ not supported yet ***** ^ not supported yet 518 (* restore screen, cursor, and mode *) 519 END MsgBox; ***** ^ not supported yet 520 521 522 PROCEDURE ErrorBox( TheMessage: ARRAY OF CHAR ): BOOLEAN; ***** ^ not supported yet 523 VAR 524 dumkey: CARDINAL; 525 dummy: ARRAY [0..255] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 526 BEGIN 527 StrEdit.AssignStr( TheMessage, dummy ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 528 StrEdit.Append( dummy, '. Press C to continue, anything else to abort.' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 529 MsgBox( VWindows.NE, dummy, KbdInput.AnyKeyNum, dumkey ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 530 RETURN KbdInput.CAPkey( dumkey ) # ORD('C'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 531 END ErrorBox; ***** ^ not supported yet 532 533 PROCEDURE RestoreCursor(); 534 (*We add this procedure to ErrorManager's TermProcList below.*) 535 BEGIN 536 SmartScreen.SetCursorHeight( StartingCursorHt ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 537 END RestoreCursor; ***** ^ not supported yet 538 539 PROCEDURE Init(); 540 BEGIN 541 IF Initialized THEN 542 RETURN; 543 ELSE 544 Initialized := TRUE; 545 END; 546 (*EntryDiag: 547 Diagnostics.Init(); 548 :EntryDiag*) 549 ErrorManager.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 550 KbdInput.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 551 LowLevel.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 552 M2Strings.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 553 Numbers.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 554 PosUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 555 SmartScreen.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 556 StrConv.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 557 StrEdit.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 558 StringIO.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 559 VStorage.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 560 VWindows.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 561 562 (*EntryDiag: 563 Diagnostics.diagS( 'Entering WindowPrims', '' ); 564 :EntryDiag*) 565 566 SingleBox[0] := CHR(218); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 567 SingleBox[1] := CHR(196); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 568 SingleBox[2] := CHR(191); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 569 SingleBox[3] := CHR(179); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 570 SingleBox[4] := CHR(179); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 571 SingleBox[5] := CHR(192); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 572 SingleBox[6] := CHR(196); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 573 SingleBox[7] := CHR(217); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 574 SingleBox[8] := 0C; ***** ^ undeclared identifier ***** ^ not supported yet 575 DoubleBox[0] := CHR(201); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 576 DoubleBox[1] := CHR(205); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 577 DoubleBox[2] := CHR(187); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 578 DoubleBox[3] := CHR(186); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 579 DoubleBox[4] := CHR(186); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 580 DoubleBox[5] := CHR(200); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 581 DoubleBox[6] := CHR(205); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 582 DoubleBox[7] := CHR(188); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 583 DoubleBox[8] := 0C; ***** ^ undeclared identifier ***** ^ not supported yet 584 VStorage.NilHandle( NilValue ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 585 586 StartingCursorHt := GetCursorHeight(); ***** ^ not supported yet ***** ^ not supported yet 587 588 ErrorManager.AbortConfirmed := ErrorBox; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 589 (*This makes ErrorManager display its messages in a window 590 so as not to disturb the rest of the screen.*) 591 592 ErrorManager.AddTermProc( RestoreCursor ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 593 (*This prevents us from losing the cursor if we terminate 594 abnormally.*) 595 ColorStack := NIL; ***** ^ not supported yet 596 CoordStackTop := NIL; ***** ^ not supported yet 597 HtStackTop := NIL; ***** ^ not supported yet 598 MsgForeColor := SmartScreen.lightgrey; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 599 MsgBackColor := SmartScreen.black; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 600 MsgMonoAtrib := SmartScreen.plain; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 601 602 (*EntryDiag: 603 Diagnostics.diagS( 'Exiting WindowPrims', '' ); 604 :EntryDiag*) 605 END Init; ***** ^ not supported yet 606 607 BEGIN 608 Initialized := FALSE; 609 Init(); ***** ^ not supported yet ***** ^ not supported yet 610 END WindowPrims. ***** ^ not supported yet 790 errors