Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Not only is UNIX dead, it's starting to smell really bad. -- Rob Pike


devel / comp.lang.forth / HELD

SubjectAuthor
* HELDdxf
`* Re: HELDmhx
 `* Re: HELDdxf
  `* Re: HELDmhx
   `* Re: HELDdxf
    `* Re: HELDdxf
     `* Re: HELDmhx
      `* Re: HELDdxf
       +- Re: HELDmhx
       +- Re: HELDalbert
       `* Re: HELDAnton Ertl
        +- Re: HELDdxf
        `- Re: HELDsjack

1
HELD

<6629b2dd$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26488&group=comp.lang.forth#26488

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 25 Apr 2024 11:33:18 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Newsgroups: comp.lang.forth
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
Subject: HELD
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <6629b2dd$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 14
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Thu, 25 Apr 2024 01:33 UTC

This is a new word introduced by MPE. It avoids some of the complications when
using #> to return the current contents of the PNO buffer. The definition is:

HELD ( -- caddr len )

Return the address and length of the string held in the pictured numeric output
buffer.

HELD is a factor of #> allowing the latter to be defined:

: #> 2DROP HELD ;

So if you've found yourself writing 0 0 #> or <# 2DUP HOLDS #> to avoid the
2DROP built into #> then HELD may be a neater solution.

Re: HELD

<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26489&group=comp.lang.forth#26489

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 25 Apr 2024 06:35:48 +0000
Subject: Re: HELD
From: mhx...@iae.nl (mhx)
Newsgroups: comp.lang.forth
X-Rslight-Site: $2y$10$3fj72ad5kD5Mwvkq9MPudOVjBDt.WX9EjJLyVQtel51J9zgkwrTnq
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <6629b2dd$1@news.ausics.net>
Organization: novaBBS
Message-ID: <77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
 by: mhx - Thu, 25 Apr 2024 06:35 UTC

dxf wrote:

> This is a new word introduced by MPE. It avoids some of the complications when
> using #> to return the current contents of the PNO buffer. The definition is:

> HELD ( -- caddr len )

> Return the address and length of the string held in the pictured numeric output
> buffer.

> HELD is a factor of #> allowing the latter to be defined:

> : #> 2DROP HELD ;

> So if you've found yourself writing 0 0 #> or <# 2DUP HOLDS #> to avoid the
> 2DROP built into #> then HELD may be a neater solution.

Doesn't everybody use the low level factors of "." etc.? Wanting to format
a number in a special way is rather infrequent, but not wanting to print a
number right away is common.

25 (.) TYPE
PI (F.) TYPE

-marcel

-marcel

Re: HELD

<662a0770$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26490&group=comp.lang.forth#26490

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 25 Apr 2024 17:34:10 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: HELD
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net>
<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
In-Reply-To: <77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <662a0770$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 23
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Thu, 25 Apr 2024 07:34 UTC

On 25/04/2024 4:35 pm, mhx wrote:
> ...
> Doesn't everybody use the low level factors of "." etc.? Wanting to format
> a number in a special way is rather infrequent, but not wanting to print a
> number right away is common.
> 25 (.)  TYPE
> PI (F.) TYPE

(F.) is an example of where I used HELD two or three times. Some others:

\ Return string right-aligned as a2 u2. Uses HOLD buffer
: RJUST ( a u +n c -- a2 u2 )
>r >r <# shold held r> over - 0 max r> nhold #> ;

\ Get the full directory path for logical disk drive u
: PATH ( u -- c-addr u2 ior )
zbuf @ 2dup 'SI ! 'DX c! $47 doscall doserr? >r
<# zcount dup if [char] \ hold then shold s" :\\" shold
>drv [char] A + hold held r> ;

HOLDS (200x) recognizes that the numeric conversion buffer can and is used for
string processing. In that situation HELD is often more appropriate than #> .

Re: HELD

<728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26492&group=comp.lang.forth#26492

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 25 Apr 2024 10:51:40 +0000
Subject: Re: HELD
From: mhx...@iae.nl (mhx)
Newsgroups: comp.lang.forth
X-Rslight-Site: $2y$10$r2EtsUJpyIQu6QIX/FNk8OHwjxoCSSQ4idfpcuBhzXSMdcEqtwATW
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <6629b2dd$1@news.ausics.net> <77c5711d42106167e3af68b6d9909b02@www.novabbs.com> <662a0770$1@news.ausics.net>
Organization: novaBBS
Message-ID: <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
 by: mhx - Thu, 25 Apr 2024 10:51 UTC

dxf wrote:

[..]
> (F.) is an example of where I used HELD two or three times. Some others:

> \ Return string right-aligned as a2 u2. Uses HOLD buffer
> : RJUST ( a u +n c -- a2 u2 )
> >r >r <# shold held r> over - 0 max r> nhold #> ;
[..]
> HOLDS (200x) recognizes that the numeric conversion buffer can and is used for
> string processing. In that situation HELD is often more appropriate than #> .

I was never really satisfied with this low-level assembly work.
Nowadays I use device redirection to a string, for example:

: dd>matlab ( F: sel -- ) ( -col -- c-addr u )
FLOCAL sel
LOCAL -col
|resudata 0= IF S" >matlab :: ERROR :: TASK-DATA is unavailable." EXIT ENDIF
<$$ ." %% iSPICE output" CR ." % "
#|params 0 ?DO I -col <> IF |head .pnames I CSTR[] .$ .FOURTABS
ENDIF
LOOP
#|results 0 ?DO I >headrow .resname .$ .FOURTABS LOOP
CR ." data = ["
#|tasks
0 ?DO -col 0> IF |head .paramdata I #|params * -col +
DFLOAT[] DF@ sel -1e-4 F~ ( equal to 0.01% )
ELSE TRUE
ENDIF
IF CR #|params 0 ?DO I -col
<> IF |head .paramdata
J #|params * I +
DFLOAT[] DF@ +E. 3 SPACES
ENDIF
LOOP
#|results 0 ?DO |resudata J #|results * I +
DFLOAT[] DF@ +E. 3 SPACES
LOOP
ENDIF
LOOP
CR ." ];"
CR
$$> ;

: .JOB>console ( -- ) 0e -1 dd>matlab TYPE ;
: .JOB>matlab ( -- ) 0e -1 dd>matlab MFILE-NAME DUMP-TO-FILE ;

-marcel

Re: HELD

<662a471a$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26493&group=comp.lang.forth#26493

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 25 Apr 2024 22:05:47 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: HELD
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net>
<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
<662a0770$1@news.ausics.net>
<728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
In-Reply-To: <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <662a471a$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 19
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Thu, 25 Apr 2024 12:05 UTC

On 25/04/2024 8:51 pm, mhx wrote:
> dxf wrote:
>
> [..]
>> (F.) is an example of where I used HELD two or three times.  Some others:
>
>> \ Return string right-aligned as a2 u2. Uses HOLD buffer
>> : RJUST ( a u +n c -- a2 u2 )
>>   >r >r  <# shold held  r> over - 0 max  r> nhold #> ;
> [..]
>> HOLDS (200x) recognizes that the numeric conversion buffer can and is used for
>> string processing.  In that situation HELD is often more appropriate than #> .
>
> I was never really satisfied with this low-level assembly work. Nowadays I use device redirection to a string, for example:
> ...

Well-factored code has a simplicity and a rightness to it. When one sees
something that irreducible, all the other machinations go out the window.

Re: HELD

<662b3650$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26498&group=comp.lang.forth#26498

  copy link   Newsgroups: comp.lang.forth
Date: Fri, 26 Apr 2024 15:06:24 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: HELD
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net>
<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
<662a0770$1@news.ausics.net>
<728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
<662a471a$1@news.ausics.net>
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
In-Reply-To: <662a471a$1@news.ausics.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <662b3650$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 25
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Fri, 26 Apr 2024 05:06 UTC

On 25/04/2024 10:05 pm, dxf wrote:
> On 25/04/2024 8:51 pm, mhx wrote:
>> dxf wrote:
>>
>> [..]
>>> (F.) is an example of where I used HELD two or three times.  Some others:
>>
>>> \ Return string right-aligned as a2 u2. Uses HOLD buffer
>>> : RJUST ( a u +n c -- a2 u2 )
>>>   >r >r  <# shold held  r> over - 0 max  r> nhold #> ;
>> [..]
>>> HOLDS (200x) recognizes that the numeric conversion buffer can and is used for
>>> string processing.  In that situation HELD is often more appropriate than #> .
>>
>> I was never really satisfied with this low-level assembly work. Nowadays I use device redirection to a string, for example:
>> ...
>
> Well-factored code has a simplicity and a rightness to it. When one sees
> something that irreducible, all the other machinations go out the window.

Regarding redirection I'd say apps intended for disk output are written that
way which implies functions have string output. If OTOH apps are written
for console output, then usually the OS has a mechanism for redirection in
which case the app writer need not concern himself.

Re: HELD

<82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26655&group=comp.lang.forth#26655

  copy link   Newsgroups: comp.lang.forth
Date: Wed, 8 May 2024 09:18:01 +0000
Subject: Re: HELD
From: mhx...@iae.nl (mhx)
Newsgroups: comp.lang.forth
X-Rslight-Site: $2y$10$srSylS/7cVMtIaaz6mCoNuf6fOaE25LvpFLfyVkpl1obl3v4vR5p6
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <6629b2dd$1@news.ausics.net> <77c5711d42106167e3af68b6d9909b02@www.novabbs.com> <662a0770$1@news.ausics.net> <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com> <662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net>
Organization: novaBBS
Message-ID: <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com>
 by: mhx - Wed, 8 May 2024 09:18 UTC

dxf wrote:

> On 25/04/2024 10:05 pm, dxf wrote:
>> On 25/04/2024 8:51 pm, mhx wrote:
>>> dxf wrote:
[..]
> Regarding redirection I'd say apps intended for disk output are written that
> way which implies functions have string output. If OTOH apps are written
> for console output, then usually the OS has a mechanism for redirection in
> which case the app writer need not concern himself.

Typically text output is meant to be read by humans, while file
output is mainly meant to be read by computers (further processing).
For debugging it is prudent to make sure the files are (somewhat)
human readable though.
I think redirection is difficult (or at least inconvenient)
from *within* a program, as is switching back and forth
between different streams.

Indeed, for trivial and conventional programs, that do not use the
Forth interpreter as an essential component, the standard OS tools
may be sufficient.

-marcel

Re: HELD

<663c1f8f$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26657&group=comp.lang.forth#26657

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 9 May 2024 10:57:52 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: HELD
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net>
<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
<662a0770$1@news.ausics.net>
<728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
<662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net>
<82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com>
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
In-Reply-To: <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <663c1f8f$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 28
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Thu, 9 May 2024 00:57 UTC

On 8/05/2024 7:18 pm, mhx wrote:
> dxf wrote:
>
>> On 25/04/2024 10:05 pm, dxf wrote:
>>> On 25/04/2024 8:51 pm, mhx wrote:
>>>> dxf wrote:
> [..]
>> Regarding redirection I'd say apps intended for disk output are written that
>> way which implies functions have string output.  If OTOH apps are written
>> for console output, then usually the OS has a mechanism for redirection in
>> which case the app writer need not concern himself.
>
> Typically text output is meant to be read by humans, while file output is mainly meant to be read by computers (further processing).
> For debugging it is prudent to make sure the files are (somewhat) human readable though.
>
> I think redirection is difficult (or at least inconvenient) from *within* a program, as is switching back and forth between different streams.
>
> Indeed, for trivial and conventional programs, that do not use the
> Forth interpreter as an essential component, the standard OS tools
> may be sufficient.

Text may have originally been intended for humans but it became so massive that
now we use computers to process it and disks to store it. Redirecting text data
intended for disk to the console might be useful in certain circumstances and
when amounts are small. But the idea of sending data to disk using console output
statements seems confusing. How does the programmer differentiate bona-fide
console output from disk output? I don't like it at all.

Re: HELD

<f47c5fa42adde43e07d1787a98c7550c@www.novabbs.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26658&group=comp.lang.forth#26658

  copy link   Newsgroups: comp.lang.forth
Date: Thu, 9 May 2024 05:29:09 +0000
Subject: Re: HELD
From: mhx...@iae.nl (mhx)
Newsgroups: comp.lang.forth
X-Rslight-Site: $2y$10$ZD25bbybRPrTLiOFjCCRl.Mz5iTHFdoV8vYy7QhrXIJtz4TyAGcom
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <6629b2dd$1@news.ausics.net> <77c5711d42106167e3af68b6d9909b02@www.novabbs.com> <662a0770$1@news.ausics.net> <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com> <662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net> <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com> <663c1f8f$1@news.ausics.net>
Organization: novaBBS
Message-ID: <f47c5fa42adde43e07d1787a98c7550c@www.novabbs.com>
 by: mhx - Thu, 9 May 2024 05:29 UTC

> How does the programmer differentiate bona-fide
> console output from disk output?

I have to admit I didn't expect that one coming.

-marcel

Re: HELD

<nnd$354348cc$480ae206@ff9c0dfbcabcb3b4>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26660&group=comp.lang.forth#26660

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net> <662b3650$1@news.ausics.net> <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com> <663c1f8f$1@news.ausics.net>
From: alb...@spenarnc.xs4all.nl
Subject: Re: HELD
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$354348cc$480ae206@ff9c0dfbcabcb3b4>
Organization: KPN B.V.
Date: Thu, 09 May 2024 13:40:00 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder9.news.weretis.net!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 62
Injection-Date: Thu, 09 May 2024 13:40:00 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: alb...@spenarnc.xs4all.nl - Thu, 9 May 2024 11:40 UTC

In article <663c1f8f$1@news.ausics.net>, dxf <dxforth@gmail.com> wrote:
>On 8/05/2024 7:18 pm, mhx wrote:
>> dxf wrote:
>>
>>> On 25/04/2024 10:05 pm, dxf wrote:
>>>> On 25/04/2024 8:51 pm, mhx wrote:
>>>>> dxf wrote:
>> [..]
>>> Regarding redirection I'd say apps intended for disk output are written that
>>> way which implies functions have string output.  If OTOH apps are written
>>> for console output, then usually the OS has a mechanism for redirection in
>>> which case the app writer need not concern himself.
>>
>> Typically text output is meant to be read by humans, while file output is mainly meant to be read by computers (further processing).
>> For debugging it is prudent to make sure the files are (somewhat) human readable though.
>>
>> I think redirection is difficult (or at least inconvenient) from *within* a program, as is switching back and forth between
>different streams.
>>
>> Indeed, for trivial and conventional programs, that do not use the
>> Forth interpreter as an essential component, the standard OS tools
>> may be sufficient.
>
>Text may have originally been intended for humans but it became so massive that
>now we use computers to process it and disks to store it. Redirecting text data
>intended for disk to the console might be useful in certain circumstances and
>when amounts are small. But the idea of sending data to disk using console output
>statements seems confusing. How does the programmer differentiate bona-fide
>console output from disk output? I don't like it at all.
>
Using EVALUATE to extend the compiler is frowned upon by some.
I use FORMAT&EVAL formatting a string, then evaluate to great advantage.
(It is similar to MPE-forth )

Example: this is a simple OO of one screen.
The FORMAT&EVAL word helps distracting detail away from defining
classes and methods.

0 ( class endclass M: M; ) \ AH B6jan23
1 "SWAP-DP" WANTED "FORMAT" WANTED VARIABLE LAST-IN
2 VARIABLE DP-MARKER DATA NAME$ 128 ALLOT DATA BLD$ 4096 ALLOT
3 : -WORD 1- BEGIN 1- DUP C@ ?BLANK UNTIL 1+ ; ( in -- firstch)
4 : {BLD PP @ LAST-IN ! ;
5 \ Retain input since {BLD excluding word name.
6 : BLD} LAST-IN @ PP @ -WORD OVER - BLD$ $+! ;
7 : class NAME NAME$ $! NAME$ $@ "VARIABLE ^%s" FORMAT&EVAL
8 "" BLD$ $! SWAP-DP HERE DP-MARKER ! {BLD ;
9 : M: BLD} HERE DP-MARKER @ - >R SWAP-DP :
10 R> NAME$ $@ "^%s @ %d +" FORMAT&EVAL ;
11 : M; POSTPONE ; SWAP-DP {BLD ; IMMEDIATE
12 : endclass BLD} DP-MARKER @ HERE - ALLOT SWAP-DP
13 BLD$ $@ NAME$ $@ ": BUILD-%s HERE >R %s R> ;" FORMAT&EVAL
14 NAME$ $@ 2DUP 2DUP 2DUP
15 ": %s CREATE BUILD-%s ^%s ! DOES> ^%s ! ;" FORMAT&EVAL ;

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -

Re: HELD

<2024May9.170226@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26662&group=comp.lang.forth#26662

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: HELD
Date: Thu, 09 May 2024 15:02:26 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 39
Message-ID: <2024May9.170226@mips.complang.tuwien.ac.at>
References: <6629b2dd$1@news.ausics.net> <77c5711d42106167e3af68b6d9909b02@www.novabbs.com> <662a0770$1@news.ausics.net> <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com> <662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net> <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com> <663c1f8f$1@news.ausics.net>
Injection-Date: Thu, 09 May 2024 17:23:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="985c0fa2ceb1cd942b6918d37505d352";
logging-data="777548"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PQFSwUBkdDFpbA0juCweQ"
Cancel-Lock: sha1:zNIYBtrJuSRGwLWe5M1cMVt2hio=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 9 May 2024 15:02 UTC

dxf <dxforth@gmail.com> writes:
>But the idea of sending data to disk using console output
>statements seems confusing.

I have been doing this for many decades without confusion, and I am
not the only one. Lots of shell and awk code works that way.

>How does the programmer differentiate bona-fide
>console output from disk output?

The typical case is that error messages should go to the console while
regular output is directed to disk. For that purpose Unix has two
file descriptors: 1 (stdout as C FILE *), and 2 (stderr as C FILE *).
If you want to print an error or warning message, you print to stderr,
otherwise to stdout.

Concerning OUTFILE-EXECUTE in Gforth, you can do the same:

[~:149311] gforth -e '." data for a file" s" error message" '"'"' type stderr outfile-execute bye' >/tmp/myfile
error message[~:149312]
[~:149312] cat /tmp/myfile
data for a file[~:149313]

You can also do a STDERR OUTFILE-EXECUTE in a definition that is
executed by OUTFILE-EXECUTE (i.e., where the other TYPEs are
redirected to some file, or (probably less common) interleave plain
TYPEs with calls to OUTFILE-EXECUTE. E.g.,

s" /tmp/myfile" w/o open-file throw constant myfile
: foo ." data for myfile" cr ;
' foo myfile outfile-execute
..( "bona-fide" console output) cr

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2023: https://euro.theforth.net/2023

Re: HELD

<663d9c50$1@news.ausics.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26664&group=comp.lang.forth#26664

  copy link   Newsgroups: comp.lang.forth
Date: Fri, 10 May 2024 14:02:25 +1000
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: HELD
Newsgroups: comp.lang.forth
References: <6629b2dd$1@news.ausics.net>
<77c5711d42106167e3af68b6d9909b02@www.novabbs.com>
<662a0770$1@news.ausics.net>
<728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com>
<662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net>
<82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com>
<663c1f8f$1@news.ausics.net> <2024May9.170226@mips.complang.tuwien.ac.at>
Content-Language: en-GB
From: dxfo...@gmail.com (dxf)
In-Reply-To: <2024May9.170226@mips.complang.tuwien.ac.at>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <663d9c50$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 51
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: dxf - Fri, 10 May 2024 04:02 UTC

On 10/05/2024 1:02 am, Anton Ertl wrote:
> dxf <dxforth@gmail.com> writes:
>> But the idea of sending data to disk using console output
>> statements seems confusing.
>
> I have been doing this for many decades without confusion, and I am
> not the only one. Lots of shell and awk code works that way.
>
>> How does the programmer differentiate bona-fide
>> console output from disk output?
>
> The typical case is that error messages should go to the console while
> regular output is directed to disk. For that purpose Unix has two
> file descriptors: 1 (stdout as C FILE *), and 2 (stderr as C FILE *).
> If you want to print an error or warning message, you print to stderr,
> otherwise to stdout.
>
> Concerning OUTFILE-EXECUTE in Gforth, you can do the same:
>
> [~:149311] gforth -e '." data for a file" s" error message" '"'"' type stderr outfile-execute bye' >/tmp/myfile
> error message[~:149312]
> [~:149312] cat /tmp/myfile
> data for a file[~:149313]
>
> You can also do a STDERR OUTFILE-EXECUTE in a definition that is
> executed by OUTFILE-EXECUTE (i.e., where the other TYPEs are
> redirected to some file, or (probably less common) interleave plain
> TYPEs with calls to OUTFILE-EXECUTE. E.g.,
>
> s" /tmp/myfile" w/o open-file throw constant myfile
> : foo ." data for myfile" cr ;
> ' foo myfile outfile-execute
> .( "bona-fide" console output) cr

The nearest I've been to what you're suggesting is this single app:

https://pastebin.com/tTUK3xmx

It defaults to console output as that's the only way I get to see
startup messages and queries. To send to disk, output must be
preceded by "DISK" - which was ok as I didn't expect errors at this
point. Problems would arise should I want to abort as the app will
ask for confirmation.

If the purpose of all this was to 'save effort' then it's questionable
because I found myself dealing with scenarios that wouldn't exist had
I sent directly to disk. As for output to console, that was never
going to be useful for this particular app. Was it useful in the sense
I could say 'Gee whizz, I'm sending to the console and it's to going to
disk'. I guess it was but such amusements tend to be short-lived.

Re: HELD

<v1l3e2$1bigh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26668&group=comp.lang.forth#26668

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sja...@dontemail.me (sjack)
Newsgroups: comp.lang.forth
Subject: Re: HELD
Date: Fri, 10 May 2024 12:20:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v1l3e2$1bigh$1@dont-email.me>
References: <6629b2dd$1@news.ausics.net> <77c5711d42106167e3af68b6d9909b02@www.novabbs.com> <662a0770$1@news.ausics.net> <728cd8ab5d148a189a1eb66b604d853b@www.novabbs.com> <662a471a$1@news.ausics.net> <662b3650$1@news.ausics.net> <82fb8fee3d133251e486f3b971e2cb0f@www.novabbs.com> <663c1f8f$1@news.ausics.net> <2024May9.170226@mips.complang.tuwien.ac.at>
Injection-Date: Fri, 10 May 2024 14:20:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="496301cb72f1e7df10d53e2168fe6d6e";
logging-data="1427985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KIiUu+lsZO1YQCCgbcSN8"
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/6.5.0-28-generic (x86_64))
Cancel-Lock: sha1:0JxanNUw4Dt1S2hmErOpG4ytiIk=
 by: sjack - Fri, 10 May 2024 12:20 UTC

Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>
> The typical case is that error messages should go to the console while
> regular output is directed to disk. For that purpose Unix has two
> file descriptors: 1 (stdout as C FILE *), and 2 (stderr as C FILE *).
> If you want to print an error or warning message, you print to stderr,
> otherwise to stdout.

Prompt and error messages send to stderr. Normally both stdout and stderr
go to console, no noticable distinction.
When desired, redirect stdout (pure data) to disk or other window with
prompt and error messages left at console.


devel / comp.lang.forth / HELD

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor