For reasons one can only speculate Forth Standards have by and large ignored numeric string output.
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored >> numeric string output.
There is the <# ... #> machinery. Does that count?
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored >> numeric string output.
There is the <# ... #> machinery. Does that count?
( -- ca u ) get contents of the current buffer, can be added to (hassynonym ~@
<~ ( -- ca u ) get contents of buffer, close it and open another~hold ( ch -- ) with synonym ~c+
Definitely.
: (UD.) <# #S #> ;
Actually this is a brilliant design. I was on the trail of something
similar to floating point, but I lost it.
- the pictured output buffer (POB) may be transient, can be corrupted by
the system e.g. being moved or overwritten
On 29/04/2024 17:22, Paul Rubin wrote:
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored
numeric string output.
There is the <# ... #> machinery. Does that count?
It's a nice idea but the restrictions around it and the specified >implementation render it unsuitable for building upon it if you want to
write portable software. Faults with it are:
- the pictured output buffer (POB) may be transient, can be corrupted by
the system e.g. being moved or overwritten
- POB contents are built up from right to left, making concatenationMake that a "minor inconvenience".
user hostile
- only one buffer available to the programmerSee ALLOCATE.
- cannot set POB sizeSee ALlOCATE.
- buffers not nestableSee ALLOCATE.
- POB contents can only be accessed by #> which terminates things???
- system words such as .S may use the POB, thus hindering debuggingSee nesting
- the system need not check the POB for overflowSee ALLOCATE
Some of these can be improved in a Forth system but software using the >improvements may not be portable between systems.They need not be. Only the spec's have to be updated.
I've written my own version of <# etc, with the '#' replaced by '~',
that does not have the above problems. It has:
new-buffer ( "name" xt ca u ~buf-size -- ) create a new format buffer
<~ ( -- ) open a format buffer
( -- ca u ) get contents of the current buffer, can be added to (hassynonym ~@
<~ ( -- ca u ) get contents of buffer, close it and open another~hold ( ch -- ) with synonym ~c+
~holds ( ca u -- ) with synonym ~+
~fill ( n ch -- )
~w ( n -- ) set a field width
~r ( +n -- ) set field width and right justify next conversion
~l ( -n -- ) set field width and left justify next conversion
~uc ( -- ) set upper case
~lc ( -- ) set lower case
~d ( d -- ) convert signed double integer
~i ( n -- ) convert signed integer
~ud ( ud ) convert unsigned double integer
~ui ( u -- ) convert unsigned integer
~s ( ca u -- ) hold string subject to any justification etc
~c ( ch -- ) hold character subject to any justification etc
I've used these as primitives for integer sprintf implementations
intending (when I get time and interest) to extend it to a floating
point sprintf
--
Gerry
dxf wrote:
On 30/04/2024 2:22 am, Paul Rubin wrote:
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored
numeric string output.
There is the <# ... #> machinery. Does that count?
Only as a missed opportunity. There's no cheaper way of adding string
functions than the following and it was amiss of the Standard not to
offer it.
\ Print string right-justified in a field of width chars
: S.R ( adr len width -- ) over - spaces type ; ( eForth)
\ Numeric string output
: (D.) ( d -- adr len ) tuck dabs <# #s rot sign #> ;
: (U.) ( u -- adr len ) 0 (d.) ;
: (.) ( n -- adr len ) s>d (d.) ;
\ Forth-79/83/94
: D. ( d -- ) (d.) type space ;
: U. ( u -- ) 0 d. ;
: . ( n -- ) s>d d. ;
: D.R ( d w -- ) >r (d.) r> s.r ;
: U.R ( u w -- ) 0 swap d.r ;
: .R ( n w -- ) >r s>d r> d.r ;
The only words that are necessary to define these on your own are
<# # #> DABS and SIGN. There is a reason to define these in the
Standard: the hardware details of a number need to be known if
you want to do it yourself in a portable way. The other reason
is probably that double precision is needed to implement this,
but the Double-Number word set is optional.
So far for speculation.
CFA >DFA .. and $! $@ .. and CLS .
-marcel
On 30/04/2024 2:22 am, Paul Rubin wrote:
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored
numeric string output.
There is the <# ... #> machinery. Does that count?
Only as a missed opportunity. There's no cheaper way of adding string functions than the following and it was amiss of the Standard not to
offer it.
\ Print string right-justified in a field of width chars
: S.R ( adr len width -- ) over - spaces type ; ( eForth)
\ Numeric string output
: (D.) ( d -- adr len ) tuck dabs <# #s rot sign #> ;
: (U.) ( u -- adr len ) 0 (d.) ;
: (.) ( n -- adr len ) s>d (d.) ;
\ Forth-79/83/94
: D. ( d -- ) (d.) type space ;
: U. ( u -- ) 0 d. ;
: . ( n -- ) s>d d. ;
: D.R ( d w -- ) >r (d.) r> s.r ;
: U.R ( u w -- ) 0 swap d.r ;
: .R ( n w -- ) >r s>d r> d.r ;
In article <v0otfs$1t6r0$1@dont-email.me>,
Gerry Jackson <do-not-use@swldwa.uk> wrote:
On 29/04/2024 17:22, Paul Rubin wrote:
dxf <dxforth@gmail.com> writes:
For reasons one can only speculate Forth Standards have by and large ignored
numeric string output.
There is the <# ... #> machinery. Does that count?
It's a nice idea but the restrictions around it and the specified
implementation render it unsuitable for building upon it if you want to
write portable software. Faults with it are:
- the pictured output buffer (POB) may be transient, can be corrupted by
the system e.g. being moved or overwritten
This is not a fault with <#. You can easily make it work with
ALLOCATE.
- POB contents are built up from right to left, making concatenationMake that a "minor inconvenience".
user hostile
- only one buffer available to the programmerSee ALLOCATE.
- cannot set POB sizeSee ALlOCATE.
- buffers not nestableSee ALLOCATE.
- POB contents can only be accessed by #> which terminates things
???
- system words such as .S may use the POB, thus hindering debuggingSee nesting
- the system need not check the POB for overflowSee ALLOCATE
Some of these can be improved in a Forth system but software using the
improvements may not be portable between systems.
They need not be. Only the spec's have to be updated.
It has been debunked numerous times, that adhering to a
common specification doesn't require a portable implementation.
I've written my own version of <# etc, with the '#' replaced by '~',
that does not have the above problems. It has:
new-buffer ( "name" xt ca u ~buf-size -- ) create a new format buffer
<~ ( -- ) open a format buffer
( -- ca u ) get contents of the current buffer, can be added to (hassynonym ~@
<~ ( -- ca u ) get contents of buffer, close it and open another~hold ( ch -- ) with synonym ~c+
~holds ( ca u -- ) with synonym ~+
~fill ( n ch -- )
~w ( n -- ) set a field width
~r ( +n -- ) set field width and right justify next conversion
~l ( -n -- ) set field width and left justify next conversion
~uc ( -- ) set upper case
~lc ( -- ) set lower case
~d ( d -- ) convert signed double integer
~i ( n -- ) convert signed integer
~ud ( ud ) convert unsigned double integer
~ui ( u -- ) convert unsigned integer
~s ( ca u -- ) hold string subject to any justification etc
~c ( ch -- ) hold character subject to any justification etc
I've used these as primitives for integer sprintf implementations
intending (when I get time and interest) to extend it to a floating
point sprintf
You have yet to convince that these cannot be upwards compatible.
If you want printf compatibility, why not just import a c-library?
Gerry Jackson <do-not-use@swldwa.uk> writes:
- the pictured output buffer (POB) may be transient, can be corrupted by
the system e.g. being moved or overwritten
Yeah that's a typical Forthy thing though. So after calling #> you have
to copy the output away before doing anything else that could mess with
the POB..
Moore hated double precision.From his ANS exit speech?
On 30/04/2024 8:07 pm, albert@spenarnc.xs4all.nl wrote:
...
Moore hated double precision.
From his ANS exit speech? Perhaps he was looking for things to disagree >with. Whatever precipitated his leaving, it marked the end of his >involvement with Forth standards. I imagine it was a weight off his >shoulders. It was for me when I left.
(I kind of like them, it is convenient for euler project problems.)
E.g.
-1. <# #S #> TYPE
340282366920938463463374607431768211455
It can be argued that for a simple kernel doubles are not needed.
I left it out for yourforth, 1) modifying #-words to %-words.
yourforth is slightly over 200 words, including my hobby horses, like
CFA >DFA .. and $! $@ .. and CLS .
1) An ISO alternative for jonesforth.
It's hard to ignore mixed math especially when your processor supports it.
It gives Forth an advantage over languages such as C .True, but not for many people, in yourforth is it out of place
On 1/05/2024 5:09 am, Gerry Jackson wrote:
On 29/04/2024 21:54, Paul Rubin wrote:
Gerry Jackson <do-not-use@swldwa.uk> writes:
- the pictured output buffer (POB) may be transient, can be corrupted by >>>> the system e.g. being moved or overwritten
Yeah that's a typical Forthy thing though. So after calling #> you have >>> to copy the output away before doing anything else that could mess with
the POB..
Yes I know, but that shouldn't be necessary. I guess it's a hangover from the time 40 years ago when memory was a scarce and expensive commodity. Things like this should be weeded out of the standard.
How is efficient use of a resource 'a hangover'? I've no particular allegiance
to Standard Forth and will happily argue against things that were never properly
considered e.g. the topic of this thread. Multiple HOLD buffers is like multiple
S" buffers. For some folks one is never enough.
On 1/05/2024 5:09 am, Gerry Jackson wrote:
On 29/04/2024 21:54, Paul Rubin wrote:
Gerry Jackson <do-not-use@swldwa.uk> writes:
- the pictured output buffer (POB) may be transient, can be corrupted by >>>> the system e.g. being moved or overwritten
Yeah that's a typical Forthy thing though. So after calling #> you have >>> to copy the output away before doing anything else that could mess with
the POB..
Yes I know, but that shouldn't be necessary. I guess it's a hangover from the time 40 years ago when memory was a scarce and expensive commodity. Things like this should be weeded out of the standard.
How is efficient use of a resource 'a hangover'?
I've no particular allegiance
to Standard Forth and will happily argue against things that were never properly
considered e.g. the topic of this thread. Multiple HOLD buffers is like multiple
S" buffers. For some folks one is never enough.
What has a portable implementation got to do with it, my comments were
about the using an existing Forth system that implements the <# family
doing nasty things that the standard permits such as moving the buffer >without you knowing.
If you want printf compatibility, why not just import a c-library?
Where's the fun in that?
Gerry
albert@spenarnc.xs4all.nl wrote:
[..]
Definitely.
: (UD.) <# #S #> ;
Actually this is a brilliant design. I was on the trail of something
similar to floating point, but I lost it.
Can you look again? I have at least 40 different words to format
floats and for some reason each application needs yet another one.
So how have serious forth implementations handled the Standard's lack of >numeric string output functions? Many went ahead and provided (D.) (.)
(F.) etc.
The other approach seen is redirection which involves taking the
existing standard functions D. . F. etc and sending the output to a
buffer instead of the console.
String output allows transformation - adding thousands separators
from (D.)
The only words that are necessary to define these on your own are
<# # #> DABS and SIGN. There is a reason to define these in the
Standard: the hardware details of a number need to be known if
you want to do it yourself in a portable way.
- the pictured output buffer (POB) may be transient, can be corrupted by
the system e.g. being moved or overwritten
- POB contents are built up from right to left, making concatenation
user hostile
- only one buffer available to the programmer
gives you the string, still holding it
releases the memory for the string
- cannot set POB size
- buffers not nestable
- POB contents can only be accessed by #> which terminates things
- system words such as .S may use the POB, thus hindering debugging
- the system need not check the POB for overflow
Some of these can be improved in a Forth system but software using the >improvements may not be portable between systems.
I've written my own version of <# etc, with the '#' replaced by '~',
that does not have the above problems. It has:
<~ ( -- ca u ) get contents of buffer, close it and open another
As a matter of curiosity how and where does C do numeric conversion?
Does it use a temp buffer? If so, then it must do a copy to the
destination.
Perhaps implementations vary. Subsequent to my question I remembered
I had the source for a 'small-C' for CP/M. Looking at the primitive for sprintf I found it uses a small static buffer. The numeric string is
built there after which it's copied to the user-designated buffer.
dxf <dxforth@gmail.com> writes:
Moore hated double precision.From his ANS exit speech?
Yeah I'm puzzled too. I remember hearing someplace that m*/ was one of
his prouder creations. It requires a triple precision intermediate
product, so it is hard to implement in C.
c
Neither Forth nor C give direct access to the carry and overflow flags,yet
we and many others have written M*/ in high level Forth for decades.
Today most C compilers offer some intrinsics beyound classic limited >arithmetic,
eg for addition with carry.
If the plan is multiple tasks should do fp output then things
such as REPRESENT's buffer would probably need protecting too.
The Linux man page for sprintf
and friends has the thread safety attribute "MT-Safe locale" for those >functions. I don't know what that means exactly though.
On 2/05/2024 3:57 am, Anton Ertl wrote:
dxf <dxforth@gmail.com> writes:
So how have serious forth implementations handled the Standard's lack of >>> numeric string output functions? Many went ahead and provided (D.) (.)
(F.) etc.
Gforth does not, and does not have factors that correspond to (D.) or
(.), and any such factors, if they existed, would put the onus on the
user to release the memory for the string with #>>.
What does that mean? Are you saying GForth users can't expect the following >standard code to function the same as in other forths?
: (D.) ( d -- adr len ) tuck dabs <# #s rot sign #> ;
String output allows transformation - adding thousands separators
from (D.)
Please demonstrate that that's less effort than using #, HOLD etc. for
that purpose.
I've demonstrated that it's cheaper and easier to provide string numerics >from the get-go than to provide them later. And yes, adding thousands >separators to an integer or floating-point string (works for both) requires >but a few string operators one likely already has. I posted the code just >recently. Perhaps you missed it.
\ Add commas to integer/float numeric string. Uses HOLD buffer
: +COMMA ( a1 u1 -- a2 u2 )
<# [char] . split 2swap shold
0 begin over while >r \char
r> 2dup 3 = swap digit? and
if [char] , hold drop 0 then
swap hold 1+
repeat drop #> ;
That's been tried in forth e.g. MVP math and f/p extensions. IIRC the results were neither fast nor pretty. Trying to emulate machine code
at this level appears to be of dubious benefit.
minforth@gmx.net (minforth) writes:
Today most C compilers offer some intrinsics beyound classic limited >>arithmetic, eg for addition with carry.
Yes. However, when I tried these, the code that came out was not as
well as I would have liked; see
<2016May24.093059@mips.complang.tuwien.ac.at> and <2021Mar15.104123@mips.complang.tuwien.ac.at>.
Last I tried it, in a sequence of a few such intrinsics the compilers
do ok between the intrinsics, but produce bad code at the start and
the end of the sequence.
minforth@gmx.net (minforth) writes:
Today most C compilers offer some intrinsics beyound classic limited >>arithmetic, eg for addition with carry.
Last I tried it, in a sequence of a few such intrinsics the compilers
do ok between the intrinsics, but produce bad code at the start and
the end of the sequence.
Last I tried it, in a sequence of a few such intrinsics the compilers
do ok between the intrinsics, but produce bad code at the start and
the end of the sequence.
I was also a little underwhelmed. But at least they are there and can
help to avoid some awkward comparisons or extra operations.
man 7 attributes
it tells me that MT-Safe means "thread-safe", i.e., "safe to call in
the presence of other threads."
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
man 7 attributes
it tells me that MT-Safe means "thread-safe", i.e., "safe to call in
the presence of other threads."
Yes I saw that, but it isn't clear to me from that description that
sprintf can safely be active in both threads at the same time.
On 4/05/2024 3:04 am, Anton Ertl wrote:[...]
dxf <dxforth@gmail.com> writes:
It means: Gforth does not provide (D.) and does not have factors that
correspond to (D.) or (.). If it had such factors, you would have to
use them in the following way:
( d ) (D.) ( do something with the string, and when you are done:) #>>
Standard Forth makes no such instruction.
...
\ Add commas to integer/float numeric string. Uses HOLD buffer
: +COMMA ( a1 u1 -- a2 u2 )
<# [char] . split 2swap shold
0 begin over while >r \char
r> 2dup 3 = swap digit? and
if [char] , hold drop 0 then
swap hold 1+
repeat drop #> ;
: u._ ( u -- )
0 <# begin
3 0 do
# 2dup 0. d= if
#> type unloop exit then
loop
'_' hold
again ;
The latter looks simpler to me.
Will you write another separator function for floats?
+COMMA handles both and is economic:
355000000 113 / (.) >pad +comma cr type
3,141,592 ok
Pi 1e6 f* -1 (f.) >pad +comma cr type
3,141,592.6535897932 ok
1e 0e f/ -1 (f.) >pad +comma cr type
+INF ok
...
Let's see how +COMMA fares
: +COMMA ( a1 u1 -- a2 u2 ) compiled
<# [char] . split 2swap shold
*the terminal*:12:16: error: Undefined word
<# [char] . >>>split<<< 2swap shold
So it needs additional complexity. Anyway, assuming that is fixed,
Requirements were: "a few string operators one likely already has"
: SHOLD HOLDS ;
: SPLIT ( a u c -- a2 u2 a3 u3 ) \ split at char
r 2dup r> scan 2swap 2 pick - ;
: \CHAR ( a u -- a2 u2 c ) \ extract char from end
1- 2dup + c@ ;
: DIGIT? ( char -- flag ) \ true if char is decimal digit
[char] 0 - #10 u< ;
Nothing there that forthers wouldn't have seen or used before.
dxf <dxforth@gmail.com> writes:
On 4/05/2024 3:04 am, Anton Ertl wrote:[...]
dxf <dxforth@gmail.com> writes:
It means: Gforth does not provide (D.) and does not have factors that
correspond to (D.) or (.). If it had such factors, you would have to
use them in the following way:
( d ) (D.) ( do something with the string, and when you are done:) #>>
Standard Forth makes no such instruction.
Of course not, because standard Forth has no word (D.).
- anton
On 6/05/2024 1:07 am, Anton Ertl wrote:...
...
So your complete setup is
: SHOLD HOLDS ;
: SPLIT ( a u c -- a2 u2 a3 u3 ) \ split at char
>r 2dup r> scan 2swap 2 pick - ;
: \CHAR ( a u -- a2 u2 c ) \ extract char from end
1- 2dup + c@ ;
: DIGIT? ( char -- flag ) \ true if char is decimal digit
[char] 0 - #10 u< ;
\ Add commas to integer/float numeric string. Uses HOLD buffer
: +COMMA ( a1 u1 -- a2 u2 )
<# [char] . split 2swap shold
0 begin over while >r \char
r> 2dup 3 = swap digit? and
if [char] , hold drop 0 then
swap hold 1+
repeat drop #> ;
And it works fine. Of course, because it uses <#, it does not work
with the nesting feature:
#12345. <<# #s #67890. <<# #s #> +comma cr type #>> #> cr type #>>
prints
67,890
*the terminal*:30:49: error: Result out of range
#12345. <<# #s #67890. <<# #s #> +comma cr type >>>#>><<< #> cr type #>>
Backtrace:
kernel/nio.fs:63:44: 0 $7FE0F9CB8690 throw
But that could be fixed by using <<# in +COMMA.
Have you documented that use of <## ##> can adversely impact standard forth >code and practices? It was news to me.
In article <2024May5.170709@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
dxf <dxforth@gmail.com> writes:
On 4/05/2024 3:04 am, Anton Ertl wrote:[...]
dxf <dxforth@gmail.com> writes:
It means: Gforth does not provide (D.) and does not have factors thatStandard Forth makes no such instruction.
correspond to (D.) or (.). If it had such factors, you would have to
use them in the following way:
( d ) (D.) ( do something with the string, and when you are done:) #>> >>>
Of course not, because standard Forth has no word (D.).
Indeed, surprisingly, but every Forth made in the Netherlands
apparently has at least (D.R) that was already present in figForth or
an equivalent to (D.).
In my experience those words that leave a string and doesnot TYPE immediately >are pretty essential.
The fact that #> may refer to a static buffer
cannot be concealed anyway.
).
On 6/05/2024 9:01 am, albert@spenarnc.xs4all.nl wrote:
In article <2024May5.170709@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
dxf <dxforth@gmail.com> writes:
On 4/05/2024 3:04 am, Anton Ertl wrote:[...]
dxf <dxforth@gmail.com> writes:
It means: Gforth does not provide (D.) and does not have factors that >>>>> correspond to (D.) or (.). If it had such factors, you would have to >>>>> use them in the following way:Standard Forth makes no such instruction.
( d ) (D.) ( do something with the string, and when you are done:) #>> >>>>
Of course not, because standard Forth has no word (D.).
Indeed, surprisingly, but every Forth made in the Netherlands
apparently has at least (D.R) that was already present in figForth or
an equivalent to (D.).
In my experience those words that leave a string and doesnot TYPE immediately
are pretty essential.
Indeed - what this thread was intended to convey. It's a pity Forth Standards >just ignored it with the result too many implementations also ignore it.
The fact that #> may refer to a static buffer
cannot be concealed anyway.
And with high-end forths offering circular buffers for temp string storage it >ought not to be a problem. VFX has >SYSPAD and SwiftForth something similar. >Thus far PAD has sufficed me. I'll add complexity when and if I need it.
On 7/05/2024 3:58 am, Anton Ertl wrote:
I assume you mean <<# and #>>. If you use standard code, you do not
use <<# nor #>>, and the code works as specified in the standard. In
the example above, it's the standard word <# (inside the +COMMA) that
adversely affects the usage of the HOLD buffer stack.
And it's in support of this concept of a HOLD buffer stack (that doesn't >exist in Standard Forth or any other AFAIK) that Gforth won't provide (.)
et al that's been present on virtually all desktop forths?
ISTM Gforth has a choice to make. It can do it its own thing - or it can >adopt what has been common practice. For it's clear that when there's no >common practice, nor moves towards it, there can't be a Standard.
On 8/05/2024 2:07 am, Anton Ertl wrote:
If it is common practice, and you want to see it
standardized, make a proposal; documenting the common practice in
systems and programs would be useful to support such a proposal.
It's my understanding the Technical Committee has responsibility for >maintaining Standard Forth and keeping it relevant.
That ignores the use of number strings in applications. SwiftForth did
the right thing in providing them upfront. From one of my apps:
\ Save settings to file
: !SETTINGS ( -- )
s" [options]" write
s" -s" write send.s @ (.) write
s" -c" write char.s @ (.) write
s" -d" write wspace @ (.) write
cspace @ dup 3 <> and ?dup if
[char] , writechr (.) write
then
s" -t" write tone @ (.) write
s" -o" compress @ 0= and write
s" -p" write punct @ (.) write
s" -l" lsignal @ 0<> and write
s" -u" write volume @ (.) write
writecr ;
With that word you could write !SETTINGS as:
\ Save settings to file
: .SETTINGS ( -- )
." [options]"
." -s" send.s @ .
." -c" char.s @ .
." -d" wspace @ .
cspace @ dup 3 <> and ?dup if
[char] , emit .
then
." -t" tone @ .
." -o" compress @ 0= and type
." -p" punct @ .
." -l" lsignal @ 0<> and type
." -u" volume @ .
cr ;
: !settings ( -- )
['] .settings dxf's-default-file @ outfile-execute ;
This allows you to test .SETTINGS interactively and eliminates the
need for words like WRITE, WRITECHR and WRITECR.
And have it disappear off the screen
Gforth uses numeric
primitives to build "." but won't make it available to users to send
directly to disk.
On 10/05/2024 12:57 am, Anton Ertl wrote:
dxf <dxforth@gmail.com> writes:
With that word you could write !SETTINGS as:
\ Save settings to file
: .SETTINGS ( -- )
." [options]"
." -s" send.s @ .
." -c" char.s @ .
." -d" wspace @ .
cspace @ dup 3 <> and ?dup if
[char] , emit .
then
." -t" tone @ .
." -o" compress @ 0= and type
." -p" punct @ .
." -l" lsignal @ 0<> and type
." -u" volume @ .
cr ;
: !settings ( -- )
['] .settings dxf's-default-file @ outfile-execute ;
This allows you to test .SETTINGS interactively and eliminates the
need for words like WRITE, WRITECHR and WRITECR.
And have it disappear off the screen
The output of .SETTINGS is a single line. You have a screen that
cannot display that and your system does not support scrolling back?
But even if you prefer to work in such a deprived environment, the
advantage that you need just one additional word instead of a whole
bunch is still there.
All this assumes one needs to see on screen what goes to disk. That's >exceptional in my experience.
The fact remains forth has separate words for console and disk output:
TYPE and WRITE-FILE. These take adr/len strings as arguments. The
numeric primitive for that is (.) and friends. Gforth uses numeric >primitives to build "." but won't make it available to users to send
directly to disk. Standard Forth isn't much better.
On 10/05/2024 6:34 pm, minforth wrote:
Even me, as no regular user of gforth, can inspect the code for . :
...
You agree that underlying Gforth's "." there exists a numeric string.
Perhaps dxf's problem is only, that he uses DOS memory-mapped screens, perhaps
controlled through BIOS interrupts. But only he could tell.
I don't have any problems. My interest is why forth implementations
(not all) haven't provided numeric string functions. A quick glance
suggests Minforth doesn't have them. Any comment about that?
dxf wrote:
On 10/05/2024 6:34 pm, minforth wrote:
Even me, as no regular user of gforth, can inspect the code for . :
...
You agree that underlying Gforth's "." there exists a numeric string.
Perhaps dxf's problem is only, that he uses DOS memory-mapped screens,
perhaps controlled through BIOS interrupts. But only he could tell.
I don't have any problems. My interest is why forth implementations
(not all) haven't provided numeric string functions. A quick glance
suggests Minforth doesn't have them. Any comment about that?
Yes. Look again. :-)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 505 |
Nodes: | 16 (2 / 14) |
Uptime: | 37:26:00 |
Calls: | 9,917 |
Calls today: | 4 |
Files: | 13,799 |
Messages: | 6,346,799 |