Re: Fw: 2.00.3 code fails in 2.2.2

From: Robert Dickow <dickow_at_uidaho.edu>
Date: Wed, 28 Mar 2001 05:20:46 -0800

\ Rick, here is my problem code:
\ ********************************
\ line 1 - Slightly modified DosBox.f file, Bob Dickow.
\ This worked under 2.00.3 and earlier, but fails at line 71 under 2.2.2

{ ====================================================================
(C) Copyright 1999 FORTH, Inc. www.forth.com

Simple dosbox
==================================================================== }

/FORTH DECIMAL
\ PACKAGE DOS-BOX

0 IMPORT: AllocConsole
0 IMPORT: FreeConsole
1 IMPORT: GetStdHandle
5 IMPORT: WriteConsole
4 IMPORT: PeekConsoleInput
5 IMPORT: ReadConsole
2 IMPORT: SetConsoleMode
2 IMPORT: GetConsoleMode
1 IMPORT: SetConsoleTitle
2 IMPORT: SetConsoleScreenBufferSize
5 IMPORT: FillConsoleOutputAttribute

CLASS _COORD
  2 BUFFER: Coord_X
  2 BUFFER: Coord_Y
END-CLASS

_COORD builds myCoord

: PDATA ( n "name" -- )
   CREATE CELLS , DOES> @ 'PERSONALITY @ + ;

4 PDATA INH
5 PDATA OUTH
6 PDATA C#

: KEY?(C) ( -- flag )
   7 CELLS R-ALLOC >R R@ 7 CELLS ERASE
   INH @ R@ 1 OVER 6 CELLS + PeekConsoleInput DROP
   R@ H@ 1 =
   R> 7 CELLS + @ 0<> AND ;

: KEY(C) ( -- char ) 0 >R
   0 SP@ 1 INH @ -ROT RP@ 0 ReadConsole DROP R> DROP ;

: TYPE(C) ( addr n -- ) 0 >R DUP C# +!
   OUTH @ -ROT RP@ 0 WriteConsole DROP R> DROP ;

: EMIT(C) ( char -- )
   SP@ 1 TYPE(C) DROP ;

: CR(C) ( -- )
   13 EMIT(C) 10 EMIT(C) ;

create Attribs 8 allot

: INVOKE(C) ( -- )
      FreeConsole DROP
      AllocConsole DROP
      -11 ( STD_OUTPUT_HANDLE) GetStdHandle OUTH !
      -10 ( STD_INPUT_HANDLE) GetStdHandle INH !
      INH @ 0 SetConsoleMode DROP
      OUTH @
      BACKGROUND_RED BACKGROUND_GREEN OR BACKGROUND_BLUE OR
BACKGROUND_INTENSITY OR
      40 1000 *
      0 MyCOORD COORD_X W! 0 MyCOORD COORD_Y W! MyCOORD drop 0
      Attribs
      FillConsoleOutputAttribute drop \ Rick, this is the line that dies.
      Z" WebCalendar FTP Transfer" SetConsoleTitle drop
      OUTH @ 40 MyCOORD COORD_Y ! 1000 MyCOORD COORD_Y ! MyCOORD
SetConsoleScreenBufferSize DROP
      OUTH @ ENABLE_PROCESSED_OUTPUT SetConsoleMode DROP
;

{ --------------------------------------------------------------------
-------------------------------------------------------------------- }

\ PUBLIC

CREATE DOS-CONSOLE
   7 CELLS , \ datasize
        18 , \ maxvector
         0 , \ PHANDLE
         0 , \ PREVIOUS
         0 , \ inh
         0 , \ outh
         0 , \ c#
   ' INVOKE(C) , \ INVOKE ( -- )
   ' NOOP , \ REVOKE ( -- )
   ' NOOP , \ /INPUT ( -- )
   ' EMIT(C) , \ EMIT ( char -- )
   ' TYPE(C) , \ TYPE ( addr len -- )
   ' TYPE(C) , \ ?TYPE ( addr len -- )
   ' CR(C) , \ CR ( -- )
   ' NOOP , \ PAGE ( -- )
   ' DROP , \ ATTRIBUTE ( n -- )
   ' KEY(C) , \ KEY ( -- char )
   ' KEY?(C) , \ KEY? ( -- flag )
   ' KEY(C) , \ EKEY ( -- echar )
   ' KEY?(C) , \ EKEY? ( -- flag )
   ' KEY(C) , \ AKEY ( -- char )
   ' 2DROP , \ PUSHTEXT ( addr len -- )
   ' 2DROP , \ AT-XY ( x y -- )
   ' 2DUP , \ AT-XY? ( -- x y )
   ' 2DUP , \ GET-SIZE ( -- x y )

\ PRIVATE

: /DOS-CONSOLE ( -- ) DOS-CONSOLE 4 CELLS + 3 CELLS ERASE ;
\ **************************************************
QUIT
----- Original Message -----
From: "Rick VanNorman" <rick_at_forth.com>
To: <sftalk_at_forth.com>
Sent: Tuesday, March 27, 2001 10:33 PM
Subject: [sftalk] Re: Fw: 2.00.3 code fails in 2.2.2

>
> Bob,
>
> Not enough context here for a diagnosis. Please send a loadable
> snippet that fails and I promise to do my best.
>
> Thanks,
> Rick
>
> *********** REPLY SEPARATOR ***********
>
> On 3/27/2001 at 10:08 PM Robert Dickow wrote:
>
> >----- Original Message -----
> >From: "Robert Dickow" <dickow_at_uidaho.edu>
> >
> >> Why would this line result in a compile failure in 2.2.2 when it was
> >working
> >> fine in my application that was developed under 2.00.3?
> >>
> >> FillConsoleOutputAttribute drop
> >>
> >>
> >> The interpreter just prints out this when it hits the line:
> >>
> >> include lhsomcal FillConsoleOutputAttribute ?
> >> FillConsoleOutputAttribute drop
> >> At line 82 in C:\ForthInc\SwiftForth\User\exten\MyDosBox.f
> >>
> >> \ This declaration appeared earlier in the file: ...it used to work=
> fine.
> >> 5 IMPORT: FillConsoleOutputAttribute
> >> \ (customized DosBox.f)
> S

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Received on Wed Mar 28 2001 - 05:22:38 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 06-Feb-2012. Archive updated nightly.