Diff for /gforth/doc/gforth.ds between versions 1.33 and 1.34

version 1.33, 1999/05/19 19:43:24 version 1.34, 1999/05/20 20:34:56
Line 87  Copyright @copyright{} 1995-1999 Free So Line 87  Copyright @copyright{} 1995-1999 Free So
 @sp 2  @sp 2
 @center for version @value{VERSION}  @center for version @value{VERSION}
 @sp 2  @sp 2
   @center Neal Crook
 @center Anton Ertl  @center Anton Ertl
 @center Bernd Paysan  @center Bernd Paysan
 @center Jens Wilke  @center Jens Wilke
 @center Neal Crook  
 @sp 3  @sp 3
 @center This manual is permanently under construction and was last updated on 04-May-1999  @center This manual is permanently under construction and was last updated on 04-May-1999
   
Line 3707  the data space pointer (@code{HERE}) at Line 3707  the data space pointer (@code{HERE}) at
 was defined. Therefore, @code{CREATE} is a way of associating a name  was defined. Therefore, @code{CREATE} is a way of associating a name
 with the address of a region of memory.  with the address of a region of memory.
   
   doc-create
   
 By extending this example to reserve some memory in data space, we end  By extending this example to reserve some memory in data space, we end
 up with a @i{variable}. Here are two different ways to do it:  up with a @i{variable}. Here are two different ways to do it:
   
Line 3744  the same way as @code{myvariable}. Forth Line 3746  the same way as @code{myvariable}. Forth
 and @code{fvariable} for double and floating-point variables,  and @code{fvariable} for double and floating-point variables,
 respectively.  respectively.
   
   doc-variable
   doc-2variable
   doc-fvariable
   
 @cindex arrays  @cindex arrays
 A similar mechanism can be used to create arrays. For example, an  A similar mechanism can be used to create arrays. For example, an
 80-character text input buffer:  80-character text input buffer:
Line 3766  The difference is that it reserves space Line 3772  The difference is that it reserves space
 than normal data space. In a Forth system that has a multi-tasker, each  than normal data space. In a Forth system that has a multi-tasker, each
 task has its own set of user variables.  task has its own set of user variables.
   
   doc-user
   
 @comment TODO is that stuff about user variables strictly correct? Is it  @comment TODO is that stuff about user variables strictly correct? Is it
 @comment just terminal tasks that have user variables?  @comment just terminal tasks that have user variables?
 @comment should document tasker.fs (with some examples) elsewhere  @comment should document tasker.fs (with some examples) elsewhere
Line 3794  way of implementing @code{Constant}). Line 3802  way of implementing @code{Constant}).
 Gforth also provides @code{2Constant} and @code{fconstant} for defining  Gforth also provides @code{2Constant} and @code{fconstant} for defining
 double and floating-point constants, respectively.  double and floating-point constants, respectively.
   
   doc-constant
   doc-2constant
   doc-fconstant
   
   @c that's too deep, and it's not necessarily true for all ANS Forths. - anton
 Constants in Forth behave differently from their equivalents in other  Constants in Forth behave differently from their equivalents in other
 programming languages. In other languages, a constant (such as an EQU in  programming languages. In other languages, a constant (such as an EQU in
 assembler or a #define in C) only exists at compile-time; in the  assembler or a #define in C) only exists at compile-time; in the
Line 3809  since it has run-time duties to perform. Line 3822  since it has run-time duties to perform.
 : FEET-TO-INCHES ( n1 -- n2 ) INCHES-PER-FOOT * ;  : FEET-TO-INCHES ( n1 -- n2 ) INCHES-PER-FOOT * ;
 @end example  @end example
   
 @c that's too deep, and it's not necessarily true for all ANS Forths. - anton  
 @cindex in-lining of constants  @cindex in-lining of constants
 When @code{FEET-TO-INCHES} is executed, it will in turn execute the xt  When @code{FEET-TO-INCHES} is executed, it will in turn execute the xt
 associated with the constant @code{INCHES-PER-FOOT}. If you use  associated with the constant @code{INCHES-PER-FOOT}. If you use
Line 3849  to allow its value to be changed. Here a Line 3861  to allow its value to be changed. Here a
 APPLES          \ puts 34 on the top of the stack.  APPLES          \ puts 34 on the top of the stack.
 @end example  @end example
   
   doc-value
   doc-to
   
 The defining word @code{Defer} allows you to define a word by name  The defining word @code{Defer} allows you to define a word by name
 without defining its behaviour; the definition of its behaviour is  without defining its behaviour; the definition of its behaviour is
 deferred. Here are two situation where this can be useful:  deferred. Here are two situation where this can be useful:
Line 3903  Defer jim Line 3918  Defer jim
 ' bar IS fred \ fred is immediate  ' bar IS fred \ fred is immediate
 @end example  @end example
   
   doc-defer
   doc-is
   @comment TODO document these: what's defers <is> [is]
   doc-what's
   doc-defers
   
   Definitions in ANS Forth for @code{defer}, @code{<is>} and
   @code{[is]} are provided in @file{compat/defer.fs}.
   
 The defining word @code{Alias} allows you to define a word by name that  The defining word @code{Alias} allows you to define a word by name that
 has the same behaviour as some other word. Here are two situation where  has the same behaviour as some other word. Here are two situation where
 this can be useful:  this can be useful:
Line 3919  aliases). Line 3943  aliases).
 @end itemize  @end itemize
   
 The word whose behaviour the alias is to inherit is represented by an  The word whose behaviour the alias is to inherit is represented by an
 xt. Therefore, the alias can only inherits default semantics from its  xt. Therefore, the alias only inherits default semantics from its
 ancestor. The semantics of the alias itself can be modified at the time  ancestor. The semantics of the alias itself can be modified at the time
 that it is defined. For example:  that it is defined. For example:
   
Line 3930  that it is defined. For example: Line 3954  that it is defined. For example:
 ' foo Alias fooby immediate \ fooby is an immediate word  ' foo Alias fooby immediate \ fooby is an immediate word
 @end example  @end example
   
 Words that are aliases have the same xt. Their semantics can differ  @c "combined words" is an undefined term
 because the rules about a word's semantics are stored in the name  Words that are aliases have the same xt, different headers in the
 dictionary, and the aliases each have their own dictionary entry. It  dictionary, and consequently different name tokens (@pxref{Tokens for
 follows that words that are aliases have different name tokens and may  Words}) and possibly different immediate flags.  An alias can only have
 have the same or different compilation tokens. Once again, see  default or immediate compilation semantics; you can define aliases for
 @ref{Tokens for Words} for more discussions of this.  combined words with @code{interpret/compile:}.
   
 @c distribute this to the appropriate paragraphs? - anton  @c distribute this to the appropriate paragraphs? - anton
 doc-create  
 doc-variable  
 doc-2variable  
 doc-fvariable  
 doc-user  
 doc-constant  
 doc-2constant  
 doc-fconstant  
 doc-value  
 doc-to  
 doc-defer  
 doc-is  
 doc-alias  doc-alias
 @comment TODO document these: what's defers <is> [is]  
 doc-what's  
 doc-defers  
   
 Definitions in ANS Forth for @code{defer}, @code{<is>} and  
 @code{[is]} are provided in @file{compat/defer.fs}.  
   
   
 @node Colon Definitions, User-defined Defining Words, Simple Defining Words, Defining Words  @node Colon Definitions, User-defined Defining Words, Simple Defining Words, Defining Words
 @subsection Colon Definitions  @subsection Colon Definitions
Line 4553  doc-postpone Line 4558  doc-postpone
 @cindex text interpreter  @cindex text interpreter
 @cindex outer interpreter  @cindex outer interpreter
   
   @c Should we really describe all these ugly details?  IMO the text
   @c interpreter should be much cleaner, but that may not be possible within
   @c ANS Forth. - anton
   
 The text interpreter@footnote{This is an expanded version of the  The text interpreter@footnote{This is an expanded version of the
 material in @ref{Introducing the Text Interpreter}.} is an endless loop  material in @ref{Introducing the Text Interpreter}.} is an endless loop
 that processes input from the current input device. A popular  that processes input from the current input device. It is also called
 implementation technique for Forth is to implement a @dfn{forth virtual  the outer interpreter, in contrast to the inner interpreter
 machine} using a loop called the @dfn{inner interpreter}. Because of  (@pxref{Engine}) which executes the compiled Forth code on interpretive
 this naming, the text interpreter is also known as the @dfn{outer  implementations.
 interpreter}.  
   
 @cindex interpret state  @cindex interpret state
 @cindex compile state  @cindex compile state

Removed from v.1.33  
changed lines
  Added in v.1.34


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>