![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

How to reply: Use your email client's "Reply All" function to reply to the
entire list (preferred). Use "Reply" for a private reply to the sender.
--------------------------------------------------------------------------
Why do some vectored output words update X#/Y#
before executing the vector [ TYPE EMIT ]
after executing the vector [ PAGE AT-XY ]
before and after the vector [ CR ]
Perhaps there is reason to the rhyme. However, to me it seems best to
either update them all before or after so the executed word would have
consistent values in X# and Y# . I like the idea of these words setting X#
and Y# before the @EXECUTE so that the executed word can alter the values as
desired. For instance, CR is such that the line-feed (1 Y# +!) is assumed
but if 'CR knows that the system is set for carriage-return only (vs. CRLF)
it can undo the 1+ by decrementing Y# . This type of thing cannot be done
with AT-XY because X# and Y# are set after the executed word (ie. if the
executed word modifies X# and Y#, they will be overwritten). One might ask
why 'ATXY would want to modify X# and Y#? Well, perhaps the display is
double-height and positioning can only be done to even lines, then 'ATXY
could accommodate. Whether the vectored words should modify X# and Y# is
not really the issue. But what if they needed to know where the cursor was
to do their job (ie. act differently if on line 25)? With some updates
before and others after, the vectored words would have to be written for the
inconsistency.
________________________________________
Line 33 in file: SWIFTX\SRC\VIO.F
{ ---------------------------------------------------------------------
Vectored output
TYPE calls the 'TYPE vector to output a string if its length is non-zero.
EMIT call the 'EMIT vector to output a character.
AT-XY passes the x and y display coordinates to the vectored handler.
--------------------------------------------------------------------- }
: TYPE ( c-addr n -- ) DUP IF DUP X# +! 'TYPE @EXECUTE EXIT THEN 2DROP
;
: EMIT ( char -- ) 1 X# +! 'EMIT @EXECUTE ;
: CR ( -- ) 1 Y# +! 'CR @EXECUTE 0 X# ! ;
: PAGE ( -- ) 'PAGE @EXECUTE 0 X# ! 0 Y# ! ;
: AT-XY ( x y -- ) 2DUP 'ATXY @EXECUTE Y# ! X# ! ;
: GET-XY ( -- x y ) 'GETXY @EXECUTE ;
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" 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/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Thu Oct 03 2002 - 06:26:42 PDT
This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 03:04:21 PST