Diff for /gforth/kernel/nio.fs between versions 1.6 and 1.7

version 1.6, 1999/02/21 14:55:44 version 1.7, 1999/02/22 21:39:43
Line 32 Line 32
   
 : <# ( -- ) \ core      less-number-sign  : <# ( -- ) \ core      less-number-sign
     \G Initialise/clear the pictured numeric output string.      \G Initialise/clear the pictured numeric output string.
     holdbuf-end holdptr ! ;      holdbuf-end dup holdptr ! holdend ! ;
   
 : #>      ( xd -- addr u ) \ core       number-sign-greater  : #>      ( xd -- addr u ) \ core       number-sign-greater
     \G Complete the pictured numeric output string by      \G Complete the pictured numeric output string by
     \G discarding xd and returning addr u; the address and length      \G discarding xd and returning addr u; the address and length
     \G of the formatted string. A Standard program may modify characters      \G of the formatted string. A Standard program may modify characters
     \G within the string.      \G within the string.
     2drop holdptr @ holdbuf-end over - ;      2drop holdptr @ holdend @ over - ;
   
 : <<# ( -- addr ) \ gforth      less-less-number-sign  : <<# ( -- ) \ gforth   less-less-number-sign
     \G starts a hold area that ends with @code{#>>}. Can be nested in      \G starts a hold area that ends with @code{#>>}. Can be nested in
     \G each other and in @code{<#}.  Note: if you do not match up the      \G each other and in @code{<#}.  Note: if you do not match up the
     \G @code{<<#}s with @code{#>>}s, you will eventually run out of      \G @code{<<#}s with @code{#>>}s, you will eventually run out of
     \G hold area; you can reset the hold area to empty with @code{<#}.      \G hold area; you can reset the hold area to empty with @code{<#}.
     holdptr @ ;      holdend @ holdptr @ - hold
       holdptr @ holdend ! ;
   
 : #>> ( xd addr1 -- addr u ) \ gforth   number-sign-greater-greater  : #>> ( -- ) \ gforth   number-sign-greater-greater
     \G Completes a numeric output string started with      \G releases the hold area started with @code{<<#}.
     \G @code{<<#}. @var{xd} is discarded, @var{addr1} is the value      holdend @ count
     \G produced by @code{<<#}, @var{addr u} represents the output      over holdptr !
     \G string.      chars + holdend ! ;
     \ this stack effect has been chosen to make it conventient to  
     \ replace @code{<# ... #>} with @code{<<# >r ... r> #>>}  
     >r 2drop  
     holdptr @ r@ over -  
     r> holdptr ! ;  
   
 : sign    ( n -- ) \ core  : sign    ( n -- ) \ core
     \G Used within @code{<#} and @code{#>}. If n (a @var{single} number)      \G Used within @code{<#} and @code{#>}. If n (a @var{single} number)
Line 95 Line 91
     \G Display d right-aligned in a field n characters wide. If more than      \G Display d right-aligned in a field n characters wide. If more than
     \G n characters are needed to display the number, all digits are displayed.      \G n characters are needed to display the number, all digits are displayed.
     \G If appropriate, n must include a character for a leading "-".      \G If appropriate, n must include a character for a leading "-".
     >r tuck  dabs  <<# >r #s  rot sign r> #>>      >r tuck  dabs  <<# #s  rot sign #>
     r> over - spaces  type ;      r> over - spaces  type #>> ;
   
 : ud.r ( ud n -- ) \ gforth     u-d-dot-r  : ud.r ( ud n -- ) \ gforth     u-d-dot-r
     \G Display ud right-aligned in a field n characters wide. If more than      \G Display ud right-aligned in a field n characters wide. If more than
     \G n characters are needed to display the number, all digits are displayed.      \G n characters are needed to display the number, all digits are displayed.
     >r <<# >r #s r> #>> r> over - spaces type ;      >r <<# #s #> r> over - spaces type #>> ;
   
 : .r ( n1 n2 -- ) \ core-ext    dot-r  : .r ( n1 n2 -- ) \ core-ext    dot-r
     \G Display n1 right-aligned in a field n2 characters wide. If more than      \G Display n1 right-aligned in a field n2 characters wide. If more than

Removed from v.1.6  
changed lines
  Added in v.1.7


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