ods.f


\    File: ODS.f
\  Author: Dirk Busch
\ Created: January 19th, 2004 - dbu
\ Updated: January 24th, 2004 - dbu
\
\ OutputDebugString() support for Win32Forth

cr .( Loading Output-Debug-String support)

anew ods.f

INTERNAL

VARIABLE ods?       \ enable/disable ODS

EXTERNAL

: ods-on ( -- )     \ enable ODS
        ods? ON ;

: ods-off ( -- )    \ disable ODS
        ods? OFF ;

1 PROC OutputDebugString
: ods   ( addr -- ) \ sends a string to the Windows Debug Window
                    \ (e.g. 'DebugView' from www.sysinternals.com)
                    \ for display
        ods?
        IF   REL>ABS CALL OutputDebugString DROP
        ELSE DROP
        THEN ;

: d.ods ( d -- ) { \ buf$ -- }
        (D.) DUP 1+ LOCALALLOC ASCII-Z TO buf$
        buf$ ods ;

: .ods  ( n -- )
        0 d.ods ;

: ods"  ( -<text">- -- )
        STATE @
        IF   POSTPONE (Z") ,"  POSTPONE ods
        ELSE [char] " WORD
             NEW$ DUP>R OVER C@ 1+ MOVE
             R@ COUNT + OFF
             R> 1+ ods
        THEN ; IMMEDIATE

ods-on \ enable ODS by default

MODULE


This page was created with Forth to HTML.