Diff for /gforth/doc/gforth.ds between versions 1.210 and 1.211

version 1.210, 2010/03/06 16:12:56 version 1.211, 2010/03/07 20:31:53
Line 2081  continues behind the @code{repeat}; if t Line 2081  continues behind the @code{repeat}; if t
 continues behind the @code{while}.  @code{Repeat} jumps back to  continues behind the @code{while}.  @code{Repeat} jumps back to
 @code{begin}, just like @code{again}.  @code{begin}, just like @code{again}.
   
 In Forth there are many combinations/abbreviations, like @code{1+}.  In Forth there are a number of combinations/abbreviations, like
 However, @code{2/} is not one of them; it shifts its argument right by  @code{1+}.  However, @code{2/} is not one of them; it shifts its
 one bit (arithmetic shift right):  argument right by one bit (arithmetic shift right), and viewed as
   division that always rounds towards negative infinity (floored
   division).  In contrast, @code{/} rounds towards zero on some systems
   (not on default installations of gforth (>=0.7.0), however).
   
 @example  @example
 -5 2 / .  -5 2 / . \ -2 or -3
 -5 2/ .  -5 2/ .  \ -3
 @end example  @end example
   
 @code{assert(} is no standard word, but you can get it on systems other  @code{assert(} is no standard word, but you can get it on systems other
Line 2367  v2 20 cells dump Line 2370  v2 20 cells dump
 @end example  @end example
   
 creates a word @code{v2} and reserves 20 uninitialized cells; the  creates a word @code{v2} and reserves 20 uninitialized cells; the
 address pushed by @code{v2} points to the start of these 20 cells.  You  address pushed by @code{v2} points to the start of these 20 cells.
 can use address arithmetic to access these cells:  You can use address arithmetic to access these cells:
   
 @example  @example
 3 v2 5 cells + !  3 v2 5 cells + !
Line 2399  here 10 cells allot . Line 2402  here 10 cells allot .
 here .  here .
 @end example  @end example
   
 @code{Here} pushes the start address of the memory area.  You should  The first @code{here} pushes the start address of the memory area, the
 store it somewhere, or you will have a hard time finding the memory area  second @code{here} the address after the dictionary area.  You should
 again.  store the start address somewhere, or you will have a hard time
   finding the memory area again.
   
 @code{Allot} manages dictionary memory.  The dictionary memory contains  @code{Allot} manages dictionary memory.  The dictionary memory contains
 the system's data structures for words etc. on Gforth and most other  the system's data structures for words etc. on Gforth and most other
Line 2417  Note that you cannot do this if you have Line 2421  Note that you cannot do this if you have
 meantime (because then your @code{allot}ed memory is no longer on the  meantime (because then your @code{allot}ed memory is no longer on the
 top of the dictionary ``stack'').  top of the dictionary ``stack'').
   
   Revisiting the @code{create} examples, where does @code{allot} get the
   address from?  It is the current dictinary pointer, that you can read
   with @code{here}.  And the @code{create}d word produces exactly that
   address (but keeps it):
   
   @example
   create v2a     here . v2a .
   20 cells allot here . v2a .
   @end example
   
 Alternatively, you can use @code{allocate} and @code{free} which allow  Alternatively, you can use @code{allocate} and @code{free} which allow
 freeing memory in any order:  freeing memory in any order:
   
Line 4435  this standard behaviour, or the word doe Line 4449  this standard behaviour, or the word doe
 compile time, both stack effects are shown; otherwise only the run-time  compile time, both stack effects are shown; otherwise only the run-time
 stack effect is shown.  stack effect is shown.
   
   Also note that in code templates or examples there can be comments in
   parentheses that display the stack picture at this point; there is no
   @code{--} in these places, because there is no before-after situation.
   
 @cindex pronounciation of words  @cindex pronounciation of words
 @item pronunciation  @item pronunciation
 How the word is pronounced.  How the word is pronounced.
Line 5349  CASE Line 5367  CASE
 ENDCASE ( )  ENDCASE ( )
 @end example  @end example
   
 Executes the first @i{codei}, where the @i{ni} is equal to @i{n}.  If  Executes the first @i{codei}, where the @i{ni} is equal to @i{n}.  If no
 no @i{ni} matches, the optional @i{default-code} is executed. The  @i{ni} matches, the optional @i{default-code} is executed. The optional
 optional default case can be added by simply writing the code after  default case can be added by simply writing the code after the last
 the last @code{ENDOF}. It may use @i{n}, which is on top of the stack,  @code{ENDOF}. It may use @i{n}, which is on top of the stack, but must
 but must not consume it.  The value @i{n} is consumed by this  not consume it.  The value @i{n} is consumed by this construction
 construction (either by a OF that matches, or by the ENDCASE, if no OF  (either by an @code{OF} that matches, or by the @code{ENDCASE}, if no OF
 matches).  matches).  Example:
   
   @example
   : .spell ( n -- )
    case
      0 of ." zero " endof
      1 of ." one "  endof
      2 of ." two "  endof
      dup .
    endcase ;
   @end example
   
 @progstyle  @progstyle
 To keep the code understandable, you should ensure that you change the  To keep the code understandable, you should ensure that you change the

Removed from v.1.210  
changed lines
  Added in v.1.211


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