Pocket Forth bug fix 
Author Message
 Pocket Forth bug fix

I came up with my own answer to a question I posted on the net a few weeks
ago. Basically, for users of Pocket forth, there is  a problem with the
word interpret (which interprets the contents of the text input buffer).
Specifically, you can fill the text input buffer, but you can't reset the
input stream easily because there is no user variable to mark current
position in the input stream. I have come up with a simple fix:

: 0>is ( -- ) ( resets the input stream to the text input buffer )
     tib            ( -- buffer.addr )
     a>r            ( single --     r: -- double )
     2r>            ( -- double.length.buffer.addr    r: -- )
     ,$ 285E        ( compile inline code for MOVEA.L [A6]+, A4 )
     ; macro        ( in pocket forth, the top of the parameter stack )
                    ( is in A6 and the absolute position of the text  )
                    ( input buffer in memory is in A4 )

( example of usage of the above )
: query   tib 80 32 fill   ( empty the tib)
          0>is             ( reset the input stream pointer)
          tib 80 expect interpret ." hello" ;

This only solves one problem; now text can be transferred to the input
and correctly interpreted. Afterwards, however, control does not return to
word in which 'interpret' is contained. "hello" would never appear on the
display. This is because interpret empties out the return stack and the
parameter stack ( arrgh! ). Is this standard (for this question, I mean F83
or MMSFORTH standard) behavior for this word? And is there any way to patch
this behavior?

Comments and insight appreciated.

                                 Randolph Peters
                                 Suite C, 3rd Floor Silverstein
                                 Hospital of the University of Pennsylvania
                                 34th and Spruce Streets, Phila PA 19104

Fri, 02 Jun 1995 23:00:02 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Forth and Pocket Forth in France ?

2. What ANS Forth misses /was: Fix Forth, please

3. Forth for Pocket PC

4. ANN: Randolph Peters' Pocket Forth Utilities

5. Pocket Forth for WinCE2?

6. Anyone here using Pocket Forth?

7. Pocket Forth/QForth question

8. Pocket Forth users!!

9. Object Oriented Extensions to Pocket Forth (repost)

10. Object Orienting Pocket Forth

11. A Pocket Forth question...

12. Color & Pocket Forth


Powered by phpBB® Forum Software