$Header: /home/radek/cvs/forth-book/dictionary/ansi/2216.source,v 1.1 2003/12/28 18:21:57 radek Exp $

Jméno

SOURCE — adresa a velikost vstupního buferu

CORE

Přehled

( → c-addr u )

c-addr je adresa vstupního bufferu a u počet znaků v něm.

Definováno v: dpANS Forth 6.1.2216 CORE

Popis

FIXME:

Description

The current point of interpret can be gotten through SOURCE. The buffer may flag out TIB or BLK or a FILE and IN gives you the offset therein. Traditionally, if the current SOURCE buffer is used up, REFILL is called that asks for another input-line or input-block. This scheme would have made it impossible to stretch an [IF] ... [THEN] over different blocks, unless [IF] does call REFILL

SOURCE simplifies the process of directly accessing the input buffer by hiding the differences between its location for different input sources. This also gives implementors more flexibility in their implementation of buffering mechanisms for different input sources. The committee moved away from an input buffer specification consisting of a collection of individual variables, declaring TIB and #TIB obsolescent.

SOURCE in this form exists in F83, POLYFORTH, LMI's Forths and others. In conventional systems it is equivalent to the phrase

BLK @  IF BLK @ BLOCK 1024  ELSE TIB #TIB @ THEN

Příklad použití

*FIXME:

Strojový kod slova v Qurtus Forthu

Příklad 85. Kód slova SOURCE *:[90]

                                 ; variable: STATE
01B0= 81B2: 81A2 9D18                         DW      $81a2 → $9D18    ; link to STATE
01B2= 81B4: 0653 4F55 5243 4500               DB      6, "SOURCE"
01BA= 81BC: 3907                 SOURCE:      MOVE    TOS, -(SP)        ;= 94 @
01BC= 81BE: 3E2D 005E                         MOVE    94(DS), TOS       ;+
01C0= 81C2: 3907                              MOVE    TOS, -(SP)        ;= 96 @
01C2= 81C4: 3E29 0060                         MOVE    96(DS), TOS       ;+
01C6= 81C8: 4E75                              RTS                       ;= EXIT