REFILL, SOURCE and SOURCE-ID current practice? 
Author Message
 REFILL, SOURCE and SOURCE-ID current practice?

Every Forth must have some way of changing SOURCE and SOURCE-ID, even
if it's hidden deep in the source code - otherwise EVALUATE and
INCLUDE could not be implemented.  

So the question is this - what is the effect in your Forth of REFILL
after changing either on its own?

IMHO, the most rational behaviour is:

SOURCE on its own changes input to the new buffer  REFILL changes it
back to the next line of the original source if it was REFILLable

SOURCE-ID on its own has no effect until REFILL, which changes input
to the next line of the new source if it is refillable.  The 'next
line' of a file depends on its current FILE-POSTION (if the file has
just been opened, it will be the first line)

-1 SOURCE-ID!  in an INCLUDEd file will stop interpretation at the end
of the current line.

So, how many Forths will this work on?

Jenny  Brien
http://www.*-*-*.com/
Home of the Fig UK website



Wed, 11 Feb 2004 03:54:05 GMT  
 REFILL, SOURCE and SOURCE-ID current practice?



Quote:
> Every Forth must have some way of changing SOURCE and SOURCE-ID, even
> if it's hidden deep in the source code - otherwise EVALUATE and
> INCLUDE could not be implemented.

> So the question is this - what is the effect in your Forth of REFILL
> after changing either on its own?

> IMHO, the most rational behaviour is:

> SOURCE on its own changes input to the new buffer  REFILL changes it
> back to the next line of the original source if it was REFILLable

I'm not aware that SOURCE changes input, it only gives the address and
length of
the _current_ input line, the one after the last REFILL
INCLUDE / LOAD / EVALUATE change the address and length, and these are
returned by SOURCE

Quote:
> SOURCE-ID on its own has no effect until REFILL, which changes input
> to the next line of the new source if it is refillable.  The 'next
> line' of a file depends on its current FILE-POSTION (if the file has
> just been opened, it will be the first line)

> -1 SOURCE-ID!  in an INCLUDEd file will stop interpretation at the end
> of the current line.

> So, how many Forths will this work on?

Mine does, but alas: the file is still open.
Better:

: \S        \ end the interpreting of the current file
     postpone \
     source-id file-size throw
     source-id reposition file throw
;

Quote:
> Jenny  Brien
> http://www.fig-uk.org
> Home of the Fig UK website

Coos, implementer of CHForth


Wed, 11 Feb 2004 07:32:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. EVALUATE SOURCE-ID if it is present ( ANS standard)

2. Is Source-id a VALUE?

3. NI 4351 current source instability

4. where/how does a current source fit in the IVI class structure

5. Current PD source ported to Windows?

6. Source to learn current/near future OO Cobol ?

7. pychecking current source file in pythonwin

8. APL2C source to source adapter?

9. The source and the sink different type with its source code

10. Metacompile assembly source to assembly source ?

11. Find Forth source (was: 8031 Forth Source Code Needed)

12. Source->Source Transformations in Haskell

 

 
Powered by phpBB® Forum Software