| \ Number IO |
\ Number IO |
| |
|
| \ Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2006,2007,2010 Free Software Foundation, Inc. |
| |
|
| \ This file is part of Gforth. |
\ This file is part of Gforth. |
| |
|
| \ Gforth is free software; you can redistribute it and/or |
\ Gforth is free software; you can redistribute it and/or |
| \ modify it under the terms of the GNU General Public License |
\ modify it under the terms of the GNU General Public License |
| \ as published by the Free Software Foundation; either version 2 |
\ as published by the Free Software Foundation, either version 3 |
| \ of the License, or (at your option) any later version. |
\ of the License, or (at your option) any later version. |
| |
|
| \ This program is distributed in the hope that it will be useful, |
\ This program is distributed in the hope that it will be useful, |
| \ GNU General Public License for more details. |
\ GNU General Public License for more details. |
| |
|
| \ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
| \ along with this program; if not, write to the Free Software |
\ along with this program. If not, see http://www.gnu.org/licenses/. |
| \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
| |
|
| require ./io.fs |
require ./io.fs |
| |
|
| \G @var{c-addr} is the address of a transient region that can be |
\G @var{c-addr} is the address of a transient region that can be |
| \G used as temporary data storage. At least 84 characters of space |
\G used as temporary data storage. At least 84 characters of space |
| \G is available. |
\G is available. |
| here word-pno-size + aligned ; |
[ has? flash [IF] ] normal-dp @ [ [ELSE] ] here [ [THEN] ] |
| |
word-pno-size + aligned ; |
| |
|
| \ hold <# #> sign # #s 25jan92py |
\ hold <# #> sign # #s 25jan92py |
| |
|
| |
has? EC [IF] |
| |
: hld ( -- addr ) pad cell - ; |
| |
: hold ( char -- ) hld -1 over +! @ c! ; |
| |
: <# hld dup ! ; |
| |
: #> ( d -- addr +n ) 2drop hld dup @ tuck - ; |
| |
' <# alias <<# |
| |
' noop alias #>> |
| |
[ELSE] |
| : hold ( char -- ) \ core |
: hold ( char -- ) \ core |
| \G Used within @code{<#} and @code{#>}. Append the character |
\G Used within @code{<#} and @code{#>}. Append the character |
| \G @var{char} to the pictured numeric output string. |
\G @var{char} to the pictured numeric output string. |
| \G Release the hold area started with @code{<<#}. |
\G Release the hold area started with @code{<<#}. |
| holdend @ dup holdbuf-end u>= -&11 and throw |
holdend @ dup holdbuf-end u>= -&11 and throw |
| count chars bounds holdptr ! holdend ! ; |
count chars bounds holdptr ! holdend ! ; |
| |
[THEN] |
| |
|
| : sign ( n -- ) \ core |
: sign ( n -- ) \ core |
| \G Used within @code{<#} and @code{#>}. If @var{n} (a @var{single} |
\G Used within @code{<#} and @code{#>}. If @var{n} (a @var{single} |
| # 2dup or 0= |
# 2dup or 0= |
| UNTIL ; |
UNTIL ; |
| |
|
| |
: holds ( addr u -- ) |
| |
BEGIN dup WHILE 1- 2dup + c@ hold REPEAT 2drop ; |
| |
|
| \ print numbers 07jun92py |
\ print numbers 07jun92py |
| |
|
| : d.r ( d n -- ) \ double d-dot-r |
: d.r ( d n -- ) \ double d-dot-r |