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

version 1.34, 1999/05/20 20:34:56 version 1.35, 1999/05/21 20:35:37
Line 3901  Defer greet Line 3901  Defer greet
 : bar ... greet ... ;  : bar ... greet ... ;
 : greet1 ." Good morning" ;  : greet1 ." Good morning" ;
 : greet2 ." Hello" ;  : greet2 ." Hello" ;
 ' greet2 IS greet  \ make greet behave like greet2  ' greet2 <IS> greet  \ make greet behave like greet2
   @end example
   
   One thing to note is that @code{<IS>} consumes it's name when it is
   executed.  If you want to specify the name at compile time, use
   @code{[IS]}:
   
   @example
   : set-greet ( xt -- )
     [IS] greet ;
   
   ' greet1 set-greet
 @end example  @end example
   
 A deferred word can only inherit default semantics from the xt (because  A deferred word can only inherit default semantics from the xt (because
Line 3914  itself can be modified at the time that Line 3925  itself can be modified at the time that
 Defer fred immediate  Defer fred immediate
 Defer jim  Defer jim
   
 ' bar IS jim  \ jim has default semantics  ' bar <IS> jim  \ jim has default semantics
 ' bar IS fred \ fred is immediate  ' bar <IS> fred \ fred is immediate
 @end example  @end example
   
 doc-defer  doc-defer
 doc-is  doc-<is>
 @comment TODO document these: what's defers <is> [is]  doc-[is]
   @comment TODO document these: what's defers [is]
 doc-what's  doc-what's
 doc-defers  doc-defers
   
Line 4819  represented using 2's-complement arithme Line 4831  represented using 2's-complement arithme
 @item  @item
 A string of the form @{+ -@}<decimal digit>@{.@}<decimal digit>*@{e  A string of the form @{+ -@}<decimal digit>@{.@}<decimal digit>*@{e
 E@}@{+ -@}<decimal digit><decimal digit>* is treated as a floating-point  E@}@{+ -@}<decimal digit><decimal digit>* is treated as a floating-point
 number. Examples are 1e0 1.e 1.e0 +1e+0 (which all represent the same  number. Examples are 1e 1e0 1.e 1.e0 +1e+0 (which all represent the same
 number) +12.E-4  number) +12.E-4
 @end itemize  @end itemize
   
 By default, the number base used for integer number conversion is given  By default, the number base used for integer number conversion is given
 by the contents of the variable @code{BASE}. Base 10 (decimal) is  by the contents of the variable @code{base}.  Note that a lot of
 always used for floating-point number conversion.  confusion can result from unexpected values of @code{base}.  If you
   change @code{base} anywhere, make sure to save the old value and restore
   it afterwards.  In general I recommend keeping @code{base} decimal, and
   using the prefixes described below for the popular non-decimal bases.
   
 doc-dpl  doc-dpl
 doc-base  doc-base
Line 4836  doc-decimal Line 4851  doc-decimal
 @cindex &-prefix for decimal numbers  @cindex &-prefix for decimal numbers
 @cindex %-prefix for binary numbers  @cindex %-prefix for binary numbers
 @cindex $-prefix for hexadecimal numbers  @cindex $-prefix for hexadecimal numbers
 Gforth allows you to override the value of @code{BASE} by using a  Gforth allows you to override the value of @code{base} by using a
 prefix@footnote{Some Forth implementations provide a similar scheme by  prefix@footnote{Some Forth implementations provide a similar scheme by
 implementing @code{$} etc. as parsing words that process the subsequent  implementing @code{$} etc. as parsing words that process the subsequent
 number in the input stream and push it onto the stack. For example, see  number in the input stream and push it onto the stack. For example, see
Line 4847  of an (integer) number. Four prefixes ar Line 4862  of an (integer) number. Four prefixes ar
   
 @itemize @bullet  @itemize @bullet
 @item  @item
 @code{&} -- decimal number  @code{&} -- decimal
 @item  @item
 @code{%} -- binary number  @code{%} -- binary
 @item  @item
 @code{$} -- hexadecimal number  @code{$} -- hexadecimal
 @item  @item
 @code{'} -- base 256 number  @code{'} -- base @code{max-char+1}
 @end itemize  @end itemize
   
 Here are some examples, with the equivalent decimal number shown after  Here are some examples, with the equivalent decimal number shown after
Line 4871  Number conversion has a number of traps Line 4886  Number conversion has a number of traps
 @itemize @bullet  @itemize @bullet
 @item  @item
 You cannot determine the current number base using the code sequence  You cannot determine the current number base using the code sequence
 @code{BASE @@ .} -- the number base is always 10 in the current number  @code{base @@ .} -- the number base is always 10 in the current number
 base. Instead, use something like @code{BASE @@ DECIMAL DUP . BASE !}  base. Instead, use something like @code{base @@ dec.}
 @item  @item
 If the number base is set to a value greater than 14 (for example,  If the number base is set to a value greater than 14 (for example,
 hexadecimal), the number 123E4 is ambiguous; the conversion rules allow  hexadecimal), the number 123E4 is ambiguous; the conversion rules allow
Line 4893  anywhere after the first digit is a Gfor Line 4908  anywhere after the first digit is a Gfor
 The number conversion process does not check for overflow.  The number conversion process does not check for overflow.
 @item  @item
 In Gforth, number conversion to floating-point numbers always use base  In Gforth, number conversion to floating-point numbers always use base
 10, irrespective of the value of @code{BASE}. In ANS Forth,  10, irrespective of the value of @code{base}. In ANS Forth,
 conversion to floating-point numbers whilst the value of  conversion to floating-point numbers whilst the value of
 @code{BASE} is not 10 is an ambiguous condition.  @code{base} is not 10 is an ambiguous condition.
 @end itemize  @end itemize
   
 @ref{Input} describes words that you can use to read numbers into your  @ref{Input} describes words that you can use to read numbers into your
Line 4913  starts interpreting. When @code{]} is ex Line 4928  starts interpreting. When @code{]} is ex
 to compile state and therefore the text interpreter starts  to compile state and therefore the text interpreter starts
 compiling. The most common usage for these words is to compile literals,  compiling. The most common usage for these words is to compile literals,
 as shown in @ref{Literals}. However, they give you the freedom to switch  as shown in @ref{Literals}. However, they give you the freedom to switch
 modes at will. Here is an example of building a jump-table of execution  modes at will.
   
   @c This is a bad example: It's non-standard, and it's not necessary.
   @c However, I can't think of a good example for switching into compile
   @c state when there is no current word (@code{state}-smart words are not a
   @c good reason).  So maybe we should use an example for switching into
   @c interpret @code{state} in a colon def. - anton
   
   Here is an example of building a jump-table of execution
 tokens:  tokens:
   
 @example  @example
Line 5653  The assignment of a block to a block buf Line 5676  The assignment of a block to a block buf
 or @code{buffer}. Use @code{block} when you wish to modify the existing  or @code{buffer}. Use @code{block} when you wish to modify the existing
 contents of a block. Use @code{buffer} when you don't care about the  contents of a block. Use @code{buffer} when you don't care about the
 existing contents of the block@footnote{The ANS Forth definition of  existing contents of the block@footnote{The ANS Forth definition of
 @code{block} is intended not to cause disk I/O; if the data associated  @code{buffer} is intended not to cause disk I/O; if the data associated
 with the particular block is already stored in a block buffer due to an  with the particular block is already stored in a block buffer due to an
 earlier @code{block} command, @code{buffer} will return that block  earlier @code{block} command, @code{buffer} will return that block
 buffer and the existing contents of the block will be  buffer and the existing contents of the block will be
Line 5722  mechanism to toggle between code and com Line 5745  mechanism to toggle between code and com
 @item  @item
 Load blocks; a single block (typically block 1) contains a number of  Load blocks; a single block (typically block 1) contains a number of
 @code{thru} commands which @code{load} the whole of the application.  @code{thru} commands which @code{load} the whole of the application.
 @item  
 Chaining blocks; a block terminates with a @code{-->} so that a whole  
 application can be @code{load}ed by @code{load}ing a single block.  
 @end itemize  @end itemize
   
 See Frank Sergeant's Pygmy Forth to see just how well blocks can be  See Frank Sergeant's Pygmy Forth to see just how well blocks can be
Line 5753  doc-load Line 5773  doc-load
 doc-thru  doc-thru
 doc-+load  doc-+load
 doc-+thru  doc-+thru
 doc---block--->  xdoc--gforth--->
 doc-block-included  doc-block-included
   
 @c -------------------------------------------------------------  @c -------------------------------------------------------------
Line 9830  Infinity. Line 9850  Infinity.
 System-dependent. Typically results in an alignment fault like other  System-dependent. Typically results in an alignment fault like other
 alignment violations.  alignment violations.
   
 @item @code{BASE} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.}):  @item @code{base} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.}):
 @cindex @code{BASE} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.})  @cindex @code{base} is not decimal (@code{REPRESENT}, @code{F.}, @code{FE.}, @code{FS.})
 The floating-point number is converted into decimal nonetheless.  The floating-point number is converted into decimal nonetheless.
   
 @item Both arguments are equal to zero (@code{FATAN2}):  @item Both arguments are equal to zero (@code{FATAN2}):

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


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