Win32Forth example 
Author Message
 Win32Forth example

(( WINSTACK.F                                   7/26/96 BNE

Here is a simple application for win32forth.  You should be
able to fload this file and have it start up.  The only thing
I don't like about it is that you can't fload files while the
stack window is active.  I tried using source-id to avoid this,
but it didn't work in my case (using win32s under windows 3.1).
Maybe somebody can find the fix.

-- Brad

Displays the contents of the data stack after each INTERPRET.

))

only forth also definitions wincon also
anew stuff
decimal

   0 value forthsp              \ pointers to Forth's stack
   0 value forthdepth
   defer   stackinterpret       \ extended version of interpret

:Object STACK-WINDOW <super window

int the-font

   8 value maxcells             \ # of displayable cells
  13 value cellwidth            \ width in characters of each cell
   8 value char-width           \ character size in pixels
  14 value char-height
   4 value margin

:M On_Paint:    ( -- )          \ screen redraw procedure
                the-font SelectObject: dc >r
                maxcells 0
                do      i maxcells forthdepth - -
                        dup 0<
                        if      drop s" "
                        else    forthdepth maxcells - 0 max - \ push down

                        then
                        temp$ 20 blank  temp$ place     \ place string
                        margin char-height i *
                        temp$ 1+ 20 TextOut: dc
                loop
                r> SelectObject: dc drop        \ restore the font
                s" Stack: ["            temp$  place

                forthdepth (.)          temp$ +place
                s" :"                   temp$ +place
                dup (.)                 temp$ +place
                base !  s" ]"           temp$ +place
                temp$ count SetTitle: self
                ;M

:M On_Init:     ( -- )
                On_Init: super
                char-width char-height z" System"
                CreateScreenFont: dc to the-font
                ['] stackinterpret is interpret
                ;M

:M On_Done:     ( -- )
                ['] _interpret is interpret
                the-font DeleteObject: dc
                On_Done: super
                ;M

:M StartSize:   ( -- width height )     \ starting window size
                cellwidth char-width  *
                margin 2* +
                maxcells char-height  *
                ;M

:M MaxSize:     StartSize: self ;M
:M MinSize:     StartSize: self ;M
:M StartPos:    400 100 ;M

:M WindowTitle: ( -- Zstring )          \ window caption
                z" Stack"
                ;M

:M WindowStyle: ( -- style )
                WS_CAPTION
                WS_SIZEBOX or
                WS_SYSMENU or
                ;M

:M ExWindowStyle: ( -- style )
                WS_EX_TOPMOST ;M

;Object

: wininterpret  ( -- )
                _interpret
                depth to forthdepth

                source-id 0=
                if      paint: stack-window
                then    ;

' wininterpret is stackinterpret

start: stack-window



Fri, 15 Jan 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Win32 API Programming Examples in Win32forth

2. nephyte needs f83 examples & examples

3. nephyte needs f83 examples & examples

4. nephyte needs f83 examples & examples

5. Aef's examples: DDE example ( dde.zip 1/3)

6. Aef's examples: DDE example (dde.zip 0/3)

7. Aef's examples:DDE example (dde.zip3/3)

8. Aef's examples: DDE example (dde.zip 2/3)

9. Announce: TimingAnalyzer Diagram Examples, Scripting Examples, App Note

10. Announce: TimingAnalyzer Diagram Examples, Scripting Examples, App Note

11. Arpack example not clear, any simpler examples

12. Shared lib package example (other than tcl-example)?

 

 
Powered by phpBB® Forum Software