Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Frankly, Scarlett, I don't have a fix. -- Rhett Buggler


devel / comp.lang.forth / Show human-readable time

SubjectAuthor
* Show human-readable timePaul Rubin
+* Re: Show human-readable timePaul Rubin
|`* Re: Show human-readable timedxforth
| `* Re: Show human-readable timePaul Rubin
|  +* Re: Show human-readable timedxforth
|  |`* Re: Show human-readable timeHans Bezemer
|  | `* Re: Show human-readable timedxforth
|  |  `* Re: Show human-readable timeHans Bezemer
|  |   `* Re: Show human-readable timedxforth
|  |    `- Re: Show human-readable timeHans Bezemer
|  `* Re: Show human-readable timeAnton Ertl
|   +* Re: Show human-readable timePaul Rubin
|   |+- Re: Show human-readable timedxforth
|   |+* Re: Show human-readable timeAnton Ertl
|   ||+- Re: Show human-readable timedxforth
|   ||+* Re: Show human-readable timePaul Rubin
|   |||`* Re: Show human-readable timeAnton Ertl
|   ||| `* Re: Show human-readable timePaul Rubin
|   |||  `* Re: Show human-readable timeAnton Ertl
|   |||   `- Re: Show human-readable timeS Jack
|   ||`* Re: Show human-readable timePaul Rubin
|   || `- Re: Show human-readable timeAnton Ertl
|   |`* Re: Show human-readable timeBrian Fox
|   | +* Re: Show human-readable timeAnton Ertl
|   | |`- Re: Show human-readable timeBrian Fox
|   | +* Re: Show human-readable timedxforth
|   | |+* Re: Show human-readable timeAnton Ertl
|   | ||+* Re: Show human-readable timeS Jack
|   | |||+- Re: Show human-readable timedxforth
|   | |||`* Re: Show human-readable timeAnton Ertl
|   | ||| `* Re: Show human-readable timeS Jack
|   | |||  `* Re: Show human-readable timeS Jack
|   | |||   `- Re: Show human-readable timeS Jack
|   | ||`* Compiling string literals (was: Show human-readable time)Ruvim
|   | || `- Re: Compiling string literals (was: Show human-readable time)Anton Ertl
|   | |`* Re: Show human-readable timeS Jack
|   | | `* Re: Show human-readable timedxforth
|   | |  `* Re: Show human-readable timeS Jack
|   | |   `- Re: Show human-readable timedxforth
|   | `* Re: Show human-readable timePaul Rubin
|   |  +- Re: Show human-readable timeBrian Fox
|   |  `- Re: Show human-readable timedxforth
|   `* Re: Show human-readable timePaul Rubin
|    `- Re: Show human-readable timeBranimir Maksimovic
`- Re: Show human-readable timeS Jack

Pages:12
Show human-readable time

<8735pvuern.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Show human-readable time
Date: Thu, 23 Sep 2021 15:07:56 -0700
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <8735pvuern.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="21271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NlJPJ/pOjDPJXVXKts9lI"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:qRtKFUS631/84Jmk8+uW/0BOLFY=
sha1:W3jUBohexxbRAB6p0cDZeT8NHP4=
 by: Paul Rubin - Thu, 23 Sep 2021 22:07 UTC

AFAICT, Peter Honeyman invented this concept decades ago: a command that
tells the current time in English rounded to the nearest five minutes,
like "Five til three" for 2:54. He wrote a version in C and used it
all the time. I later also wrote one in C and used it for a while.
Here it is in Gforth (set file to executable and run it):
\ ----------------------------------------------------------------
#! /usr/bin/gforth
: str-array ( n -- ) create 2 cells * allot
does> ( n -- a ) swap 2 cells * + ;

12 str-array hours
12 str-array minutes

variable a \ "address register"
: 2!a+ ( n n -- ) a @ 2! 2 cells a +! ;
: aa 2!a+ ; \ easier to type

0 hours a !
s" twelve" aa s" one" aa s" two" aa s" three" aa
s" four" aa s" five" aa s" six" aa s" seven" aa
s" eight" aa s" nine" aa s" ten" aa s" eleven" aa

0 minutes a !
s" o'clock" aa s" five after" aa
s" ten after" aa s" quarter past" aa
s" twenty after" aa s" twenty-five after" aa
s" half past" aa s" twenty-five til" aa
s" twenty til" aa s" quarter til" aa
s" ten til" aa s" five til" aa

: capitalize-letter ( c -- C ) \ precondition: c is a letter
$20 invert and ;

: capitalize-and-type ( a u -- ) \ precondition: u > 0
\ take string like "foo" and type it out as "Foo"
swap dup c@ capitalize-letter emit 1+ swap 1- type ;

: hms-time.1 ( seconds minutes hours day month year -- hours minutes seconds )
drop drop drop -rot swap ;
: hms-time ( -- hours minutes seconds ) time&date hms-time.1 ;

: rounded-time.1 ( hours minutes seconds -- hours minutes )
\ round to nearest 5 minutes by adding 2.5 minutes (150 seconds )
\ this is funky because time&date factor is currently not exposed
\ now requested at: https://savannah.gnu.org/bugs/index.php?61212
150 + 60 / + ( h mm ) dup 5 mod -
60 /mod swap >r + 12 mod r> ;
: rounded-time hms-time rounded-time.1 ;

: tshow.1 ( hours minutes -- )
5 / dup if
dup minutes 2@ capitalize-and-type bl emit
6 > if 1+ then hours 2@ type
else
swap hours 2@ capitalize-and-type bl emit
minutes 2@ type
then cr ;

: tshow ( -- ) rounded-time tshow.1 ;

tshow bye
\ ----------------------------------------------------------------

Re: Show human-readable time

<87y27nszv4.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Thu, 23 Sep 2021 15:15:11 -0700
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <87y27nszv4.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="21271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KbYkLUde3+O6NdzRcaW9d"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:9xBV7pJn7yXwIY4SiqaZpA4oTjA=
sha1:PznB+9N244u700Ql2BYKAyAWhqA=
 by: Paul Rubin - Thu, 23 Sep 2021 22:15 UTC

Oops, I forgot an adjustment at close to 12 o'clock. Fixed version:

----------------------------------------------------------------
#! /usr/bin/gforth
: str-array ( n -- ) create 2 cells * allot
does> ( n -- a ) swap 2 cells * + ;

12 str-array hours
12 str-array minutes

variable a \ "address register"
: 2!a+ ( n n -- ) a @ 2! 2 cells a +! ;
: aa 2!a+ ; \ easier to type

0 hours a !
s" twelve" aa s" one" aa s" two" aa s" three" aa
s" four" aa s" five" aa s" six" aa s" seven" aa
s" eight" aa s" nine" aa s" ten" aa s" eleven" aa

0 minutes a !
s" o'clock" aa s" five after" aa
s" ten after" aa s" quarter past" aa
s" twenty after" aa s" twenty-five after" aa
s" half past" aa s" twenty-five til" aa
s" twenty til" aa s" quarter til" aa
s" ten til" aa s" five til" aa

: capitalize-letter ( c -- C ) \ precondition: c is a letter
$20 invert and ;

: capitalize-and-type ( a u -- ) \ precondition: u > 0
\ take string like "foo" and type it out as "Foo"
swap dup c@ capitalize-letter emit 1+ swap 1- type ;

: hms-time.1 ( seconds minutes hours day month year -- hours minutes seconds )
drop drop drop -rot swap ;
: hms-time ( -- hours minutes seconds ) time&date hms-time.1 ;

: rounded-time.1 ( hours minutes seconds -- hours minutes )
\ round to nearest 5 minutes by adding 2.5 minutes (150 seconds )
\ this is funky because time&date factor is currently not exposed
\ now requested at: https://savannah.gnu.org/bugs/index.php?61212
150 + 60 / + ( h mm ) dup 5 mod -
60 /mod swap >r + 12 mod r> ;
: rounded-time hms-time rounded-time.1 ;

: tshow.1 ( hours minutes -- )
5 / dup if
dup minutes 2@ capitalize-and-type bl emit
6 > if 1+ then 12 mod hours 2@ type
else
swap 12 mod hours 2@ capitalize-and-type bl emit
minutes 2@ type
then cr ;

: tshow ( -- ) rounded-time tshow.1 ;

tshow bye

Re: Show human-readable time

<sijev1$14c7$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 12:59:45 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sijev1$14c7$1@gioia.aioe.org>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="37255"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 24 Sep 2021 02:59 UTC

On 24/09/2021 08:15, Paul Rubin wrote:
> Oops, I forgot an adjustment at close to 12 o'clock. Fixed version:

'Look Ma, no locals'

The program seems to depend on multiple interpretive S" strings that
persist. Usually the strings would be compiled.

Re: Show human-readable time

<87ilyqbqqf.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Thu, 23 Sep 2021 20:24:24 -0700
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <87ilyqbqqf.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="21763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LTATxR/xMfGGaDPkRtfZO"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:wuCu62zYylI7V5HpoAKLGGwoUM8=
sha1:aUO6oFJ+jk9emPWufuCLqOk6sm0=
 by: Paul Rubin - Fri, 24 Sep 2021 03:24 UTC

dxforth <dxforth@gmail.com> writes:
> The program seems to depend on multiple interpretive S" strings that
> persist. Usually the strings would be compiled.

Oh hmm, I didn't realize they didn't automatically persist. I had
already resisted doing something like:

s" One" s" Two" .... s" Twelve"
CREATE HOURS 2, 2, 2, 2, ...

Ok, here is new version, with a little bit of unrelated additional
refactoring:

----------------------------------------------------------------

#! /usr/bin/gforth
: str-array ( n -- ) create 2 cells * allot
does> ( n -- a ) swap 2 cells * + ;

12 str-array hours
12 str-array minutes

variable a \ "address register"
: 2!a+ ( n n -- ) a @ 2! 2 cells a +! ;
: aa 2!a+ ; \ easier to type

: make-hours.1 ( -- )
0 hours a !
s" twelve" aa s" one" aa s" two" aa s" three" aa
s" four" aa s" five" aa s" six" aa s" seven" aa
s" eight" aa s" nine" aa s" ten" aa s" eleven" aa ;

make-hours.1

: make-minutes.1 ( -- )
0 minutes a !
s" o'clock" aa s" five after" aa
s" ten after" aa s" quarter past" aa
s" twenty after" aa s" twenty-five after" aa
s" half past" aa s" twenty-five til" aa
s" twenty til" aa s" quarter til" aa
s" ten til" aa s" five til" aa ;

make-minutes.1

: capitalize-letter ( c -- C ) \ precondition: c is a letter
$20 invert and ;

: capitalize-and-type ( a u -- ) \ precondition: u > 0
\ take string like "foo" and type it out as "Foo"
swap dup c@ capitalize-letter emit 1+ swap 1- type ;

: seconds.1 ( seconds minutes hours day month year -- seconds )
drop drop drop 60 * swap + 60 * + 86400 mod ;

: rounded-time.1 ( seconds minutes hours day month year -- seconds )
\ round to nearest 5 minutes
seconds.1 150 + dup 300 mod - ;

: s>hms ( seconds -- hours minutes seconds )
60 /mod 60 /mod 12 mod ( s m h ) -rot swap ;

: rounded-time ( -- seconds )
time&date ( seconds minutes hours day month year )
rounded-time.1 ( seconds ) ;
: rounded-hm ( -- hours minutes ) rounded-time s>hms drop ;

: tshow.1 ( hours minutes -- )
5 / dup if
dup minutes 2@ capitalize-and-type space
6 > if 1+ then 12 mod hours 2@ type
else
swap 12 mod hours 2@ capitalize-and-type space
minutes 2@ type
then cr ;

: tshow ( -- ) rounded-hm tshow.1 ;

tshow bye

Re: Show human-readable time

<sijitf$4e1$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 14:07:11 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sijitf$4e1$1@gioia.aioe.org>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="4545"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 24 Sep 2021 04:07 UTC

On 24/09/2021 13:24, Paul Rubin wrote:
>
> Ok, here is new version, with a little bit of unrelated additional
> refactoring:
>
> ----------------------------------------------------------------
>
> #! /usr/bin/gforth
> : str-array ( n -- ) create 2 cells * allot
> does> ( n -- a ) swap 2 cells * + ;
>
> 12 str-array hours
> 12 str-array minutes
>
> variable a \ "address register"
> : 2!a+ ( n n -- ) a @ 2! 2 cells a +! ;
> : aa 2!a+ ; \ easier to type
>
> : make-hours.1 ( -- )
> 0 hours a !
> s" twelve" aa s" one" aa s" two" aa s" three" aa
> s" four" aa s" five" aa s" six" aa s" seven" aa
> s" eight" aa s" nine" aa s" ten" aa s" eleven" aa ;
>
> make-hours.1

That's an approach I hadn't considered. Somewhat more traditionally...

: str-array ( n -- ) create cells allot
does> ( n -- a ) swap cells + ;

12 str-array hours
12 str-array minutes

: @minutes ( a -- adr len ) minutes @ count ;
: @hours ( a -- adr len ) hours @ count ;

: ," ( a "ccc<quote>" -- a' )
[char] " parse 2>r here r@ 1+ chars allot
( a here ) 2dup swap ! 2r> rot place ( a) cell+ ;

0 hours ( a)
," twelve" ," one" ," two" ," three"
," four" ," five" ," six" ," seven"
," eight" ," nine" ," ten" ," eleven"
drop

0 minutes ( a)
," o'clock" ," five after"
," ten after" ," quarter past"
," twenty after" ," twenty-five after"
," half past" ," twenty-five til"
," twenty til" ," quarter til"
," ten til" ," five til"
drop

....

: tshow.1 ( hours minutes -- )
5 / dup if
dup @minutes capitalize-and-type bl emit
6 > if 1+ then 12 mod @hours type
else
swap 12 mod @hours capitalize-and-type bl emit
@minutes type
then cr ;

Re: Show human-readable time

<2021Sep24.082437@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 06:24:37 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 18
Message-ID: <2021Sep24.082437@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="10576c6f0c83c2f1d40feb39a5b048a0";
logging-data="15438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1837rCSjdWX/DhNU/MVWhBB"
Cancel-Lock: sha1:8B+GDveYvVmtXYlm6Z/4skj3A0s=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 24 Sep 2021 06:24 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>dxforth <dxforth@gmail.com> writes:
>> The program seems to depend on multiple interpretive S" strings that
>> persist. Usually the strings would be compiled.
>
>Oh hmm, I didn't realize they didn't automatically persist.

In Gforth they persist until the end of the session, but your new
version will also work when saved in an image.

You could upload it to theforth.net.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<87ee9ebgof.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 00:01:36 -0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <87ee9ebgof.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="16758"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++8qX/RSMbheSYgUOb5eUZ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:TOcHvcCg44bsiVfCGpS+zvS4UEM=
sha1:E7SFyyab8CuYCU2sbk8/5JTUJjY=
 by: Paul Rubin - Fri, 24 Sep 2021 07:01 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> In Gforth they persist until the end of the session, but your new
> version will also work when saved in an image.

Interesting. It looked from the docs that putting the s" ..." into a
colon definition would compile the string into the dictionary, but I
wasn't sure of that, so have been intending to study dxforth's version
too. Compiling into the dictionary would also generate a jump over the
string(?), which seems slightly clumsy.

The program also uses time&date which is gforth-specific, so it might
have been ok to leave the strings alone. I don't know whether there are
any other gforth-isms in there.

> You could upload it to theforth.net.

Hmm, I hadn't looked at that site much before. I managed to make an
account after a few tries at solving the rather annoying captcha. The
upload procedure looks a bit complicated so I'll wait til tomorrow or so
before trying to figure it out, as it is getting late here now.

It might make an interesting task for Rosetta Code as well.

Re: Show human-readable time

<sik00r$fvg$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 17:50:51 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sik00r$fvg$1@gioia.aioe.org>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="16368"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 24 Sep 2021 07:50 UTC

On 24/09/2021 17:01, Paul Rubin wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> In Gforth they persist until the end of the session, but your new
>> version will also work when saved in an image.
>
> Interesting. It looked from the docs that putting the s" ..." into a
> colon definition would compile the string into the dictionary, but I
> wasn't sure of that, so have been intending to study dxforth's version
> too. Compiling into the dictionary would also generate a jump over the
> string(?), which seems slightly clumsy.

s" inside a colon definition only requires the string be compiled - where
that is in relation to executable code is implementation-dependent.

The code I posted still contained a lot of redundancy.

\ parse & compile as counted string
: ," ( "ccc<quote>" )
[char] " parse here over 1+ chars allot place ;

\ define array action
: does does> swap 0 ?do count + loop count ;

create @hours does ( n -- adr len )
," twelve" ," one" ," two" ," three"
," four" ," five" ," six" ," seven"
," eight" ," nine" ," ten" ," eleven"

create @minutes does ( n -- adr len )
," o'clock" ," five after"
," ten after" ," quarter past"
," twenty after" ," twenty-five after"
," half past" ," twenty-five til"
," twenty til" ," quarter til"
," ten til" ," five til"

Re: Show human-readable time

<2021Sep24.094110@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 07:41:10 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 40
Message-ID: <2021Sep24.094110@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="10576c6f0c83c2f1d40feb39a5b048a0";
logging-data="20934"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191dH9GdliQD9VOXt6cQe8h"
Cancel-Lock: sha1:yYjzwtQ1wMiGIZg17QO+b2eDi5k=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 24 Sep 2021 07:41 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> In Gforth they persist until the end of the session, but your new
>> version will also work when saved in an image.
>
>Interesting. It looked from the docs that putting the s" ..." into a
>colon definition would compile the string into the dictionary

It does. By contrast, interpretive S" in Gforth ALLOCATEs the string,
and Gforth does not preserve ALLOCATEd data in images.

>Compiling into the dictionary would also generate a jump over the
>string(?),

Not in recent snapshots:

: foo s" flip" s" flop" ;
simple-see foo \ output:
$7F7F70532630 lit
$7F7F70532638 $7F7F702ABCB8
$7F7F70532640 lit
$7F7F70532648 #4
$7F7F70532650 lit
$7F7F70532658 $7F7F702ABCC0
$7F7F70532660 lit
$7F7F70532668 #4
$7F7F70532670 ;s ok

>The program also uses time&date which is gforth-specific

TIME&DATE has been standardized since 1994:

https://forth-standard.org/standard/facility/TIMEandDATE

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<sik4gp$hsr$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 19:07:37 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sik4gp$hsr$1@gioia.aioe.org>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com>
<2021Sep24.094110@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="18331"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 24 Sep 2021 09:07 UTC

On 24/09/2021 17:41, Anton Ertl wrote:
> Paul Rubin <no.email@nospam.invalid> writes:
>>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>>> In Gforth they persist until the end of the session, but your new
>>> version will also work when saved in an image.
>>
>>Interesting. It looked from the docs that putting the s" ..." into a
>>colon definition would compile the string into the dictionary
>
> It does. By contrast, interpretive S" in Gforth ALLOCATEs the string,
> and Gforth does not preserve ALLOCATEd data in images.
>
>>Compiling into the dictionary would also generate a jump over the
>>string(?),
>
> Not in recent snapshots:
>
> : foo s" flip" s" flop" ;
> simple-see foo \ output:
> $7F7F70532630 lit
> $7F7F70532638 $7F7F702ABCB8
> $7F7F70532640 lit
> $7F7F70532648 #4
> $7F7F70532650 lit
> $7F7F70532658 $7F7F702ABCC0
> $7F7F70532660 lit
> $7F7F70532668 #4
> $7F7F70532670 ;s ok

Even less need for S, ," to explicitly ALIGN

Re: Show human-readable time

<614DD60B.3080602@rogers.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: brian....@rogers.com (Brian Fox)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 09:43:39 -0400
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <614DD60B.3080602@rogers.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="b32d9bb5a50d0b333199f2c12ba40cc2";
logging-data="23103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ww1n7SMC9UZa3MKXU9W7obOCiJgXBA7s="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
Cancel-Lock: sha1:j74/8iCAk2330KlmNOsTdsbDb6Y=
In-Reply-To: <87ee9ebgof.fsf@nightsong.com>
 by: Brian Fox - Fri, 24 Sep 2021 13:43 UTC

On 2021-09-24 3:01 AM, Paul Rubin wrote:
> Compiling into the dictionary would also generate a jump over the
> string(?), which seems slightly clumsy.
>

GForth's allocated string solution is rather posh. ;-)

Why when I was a boy, we put our strings in the dictionary
like real men and we jumped over them. :-)

In case you are curious here was one way to do it in ITC systems.
( Camel99 Forth )

: S, ( c-addr u -- ) HERE OVER 1+ ALLOT PLACE ALIGN ;

: (S") ( -- c-addr u) R> COUNT 2DUP + ALIGNED >R ;

: S" ( -- c-addr u) [CHAR] " PARSE COMPILE (S") S, ;

The clever bit IMHO is pulling the IP of the string from the
return stack to perform COUNT, computing the jump over the string
and then pushing the new IP back onto the return stack.

Jump accomplished.

Re: Show human-readable time

<2021Sep24.171509@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 15:15:09 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 21
Message-ID: <2021Sep24.171509@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <614DD60B.3080602@rogers.com>
Injection-Info: reader02.eternal-september.org; posting-host="10576c6f0c83c2f1d40feb39a5b048a0";
logging-data="28579"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7QHS+KsG0SPwg6EagWD3D"
Cancel-Lock: sha1:lYGEDNJdnpLvInuQWZ4muI4Glvo=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 24 Sep 2021 15:15 UTC

Brian Fox <brian.fox@rogers.com> writes:
>GForth's allocated string solution is rather posh. ;-)
>
>Why when I was a boy, we put our strings in the dictionary
>like real men and we jumped over them. :-)

Gforth's compiled strings are in the dictionary, and have always been.

In the beginning we used return-address manipulation like your (S").
When I did experiments with native-code generation (~2004), I
eliminated that (it would not work in gforth-native) and replaced it
with an explicit branch around the string. Recently we put the
strings in a different section of the dictionary, so we no longer need
to branch around the string in any way.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<022766bc-ebf3-4af7-afc4-2d84f3a8553en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7dd4:: with SMTP id c20mr5109080qte.46.1632499390680;
Fri, 24 Sep 2021 09:03:10 -0700 (PDT)
X-Received: by 2002:a37:b902:: with SMTP id j2mr11030834qkf.286.1632499390477;
Fri, 24 Sep 2021 09:03:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 24 Sep 2021 09:03:10 -0700 (PDT)
In-Reply-To: <8735pvuern.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:f50c:606f:9fba:c866;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:f50c:606f:9fba:c866
References: <8735pvuern.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <022766bc-ebf3-4af7-afc4-2d84f3a8553en@googlegroups.com>
Subject: Re: Show human-readable time
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Fri, 24 Sep 2021 16:03:10 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: S Jack - Fri, 24 Sep 2021 16:03 UTC

On Thursday, September 23, 2021 at 5:07:58 PM UTC-5, Paul Rubin wrote:
> AFAICT, Peter Honeyman invented this concept decades ago: a command that
> tells the current time in English rounded to the nearest five minutes,

Long ago I made a Forth version of the classic Eliza program. Then I
modified it to make a human command/response interface one that just
looked for key words nothing sophisticated. It worked better than I
had imagined. Since only key words mattered a request could be worded
different ways and still result in the wanted action:
get my file foo
get a file named foo
get the foo file
and it would respond something like:
You want the file name foo?
at which point the user would enter "yes" or "no".

If the program failed to understand what the user requested, it assumed
there was something wrong with the user and would go into the
Eliza psychoanalysis mode.
--
me

Re: Show human-readable time

<877df6aqwm.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 09:18:17 -0700
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <877df6aqwm.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
<87ee9ebgof.fsf@nightsong.com>
<2021Sep24.094110@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="32739"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hvCdlO74Ik2Fqsiv73PSQ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:lDSP10dT45ryRgJFoydfxsXSePI=
sha1:8YSGAYFzaYyxdX5aRp3ki0RlMGg=
 by: Paul Rubin - Fri, 24 Sep 2021 16:18 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> Not in recent snapshots:
> : foo s" flip" s" flop" ;

Hmm, what happens with longer strings? In 0.7.3 (not so recent),
I see a branch.

Re: Show human-readable time

<2021Sep24.183924@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 16:39:24 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 39
Message-ID: <2021Sep24.183924@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <2021Sep24.094110@mips.complang.tuwien.ac.at> <877df6aqwm.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="10576c6f0c83c2f1d40feb39a5b048a0";
logging-data="10771"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/a5UTK+HnU8qnIoRkZYk28"
Cancel-Lock: sha1:zFmUpChng+hHjvQwdWuQ6wsQJtA=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 24 Sep 2021 16:39 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> Not in recent snapshots:
>> : foo s" flip" s" flop" ;
>
>Hmm, what happens with longer strings? In 0.7.3 (not so recent),
>I see a branch.

With recent, I mean, a few months ago or more recent. Anyway:

: foo
s" What happens with longer strings?"
s" The same happens with longer strings."
s" Compare the addresses of the strings with the addresses of the threaded code"
;

simple-see foo
$7F0C2D9F0630 lit
$7F0C2D9F0638 $7F0C2D769CB8
$7F0C2D9F0640 lit
$7F0C2D9F0648 #33
$7F0C2D9F0650 lit
$7F0C2D9F0658 $7F0C2D769CE0
$7F0C2D9F0660 lit
$7F0C2D9F0668 #37
$7F0C2D9F0670 lit
$7F0C2D9F0678 $7F0C2D769D08
$7F0C2D9F0680 lit
$7F0C2D9F0688 #76
$7F0C2D9F0690 ;s ok

The strings are in a different section than the threaded code.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<614E1027.3050401@rogers.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: brian....@rogers.com (Brian Fox)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 13:51:35 -0400
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <614E1027.3050401@rogers.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <614DD60B.3080602@rogers.com> <2021Sep24.171509@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="b32d9bb5a50d0b333199f2c12ba40cc2";
logging-data="15635"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iLFHG5Ap5hFtXqHh0ogxe2A86McExP0M="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
Cancel-Lock: sha1:aqvPRGdDdx5dn2A0tEjoTBTGvp0=
In-Reply-To: <2021Sep24.171509@mips.complang.tuwien.ac.at>
 by: Brian Fox - Fri, 24 Sep 2021 17:51 UTC

On 2021-09-24 11:15 AM, Anton Ertl wrote:
>
> In the beginning we used return-address manipulation like your (S").
> When I did experiments with native-code generation (~2004), I
> eliminated that (it would not work in gforth-native) and replaced it
> with an explicit branch around the string. Recently we put the
> strings in a different section of the dictionary, so we no longer need
> to branch around the string in any way.
>
> - anton
>

Thank you. That's good to know. I am playing with a native code
generator now for my own amusement.
I was wondering how best to handle S".

Re: Show human-readable time

<87y27lddml.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 11:36:50 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <87y27lddml.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
<87ee9ebgof.fsf@nightsong.com>
<2021Sep24.094110@mips.complang.tuwien.ac.at>
<877df6aqwm.fsf@nightsong.com>
<2021Sep24.183924@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="31bf8a7a6b084e33399de25f55838989";
logging-data="26952"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GKSxjH9jFL0aIV/k4U949"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:UbOVWpneIRr3sAhVT5DO4hAgWMI=
sha1:/QQdwYKIQ9M1JNe738Ck5qLlTUE=
 by: Paul Rubin - Fri, 24 Sep 2021 18:36 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> The strings are in a different section than the threaded code.

Does that mean you now have a post-compilation assembly or linking phase
to fix up the addresses of the different sections? Did you have that
before? Do you reserve a chunk of memory for the strings and hope it's
big enough, or what?

Re: Show human-readable time

<87tui9d0fr.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Fri, 24 Sep 2021 16:21:44 -0700
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <87tui9d0fr.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
<87ee9ebgof.fsf@nightsong.com>
<2021Sep24.094110@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="bf0c93672b1b7226efe7c489dfaaad93";
logging-data="9899"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/h+ks2fVl+2xNnjhD+yIRf"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:c9GdawPU68nwpHbPBhCp8PZ0R0w=
sha1:3n+KdWkzV3JYbQ2o9Df50BikyKc=
 by: Paul Rubin - Fri, 24 Sep 2021 23:21 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> TIME&DATE has been standardized since 1994:
> https://forth-standard.org/standard/facility/TIMEandDATE

Hmm, the online gforth manual says it's a gforth word. Maybe you want
to update that.

Re: Show human-readable time

<sim0bd$fcq$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 12:08:45 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sim0bd$fcq$1@gioia.aioe.org>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com>
<614DD60B.3080602@rogers.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="15770"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sat, 25 Sep 2021 02:08 UTC

On 24/09/2021 23:43, Brian Fox wrote:
> On 2021-09-24 3:01 AM, Paul Rubin wrote:
>> Compiling into the dictionary would also generate a jump over the
>> string(?), which seems slightly clumsy.
>>
>
> GForth's allocated string solution is rather posh. ;-)
>
> Why when I was a boy, we put our strings in the dictionary
> like real men and we jumped over them. :-)
>
> In case you are curious here was one way to do it in ITC systems.
> ( Camel99 Forth )
>
> : S, ( c-addr u -- ) HERE OVER 1+ ALLOT PLACE ALIGN ;
>
> : (S") ( -- c-addr u) R> COUNT 2DUP + ALIGNED >R ;
>
> : S" ( -- c-addr u) [CHAR] " PARSE COMPILE (S") S, ;
>
> The clever bit IMHO is pulling the IP of the string from the
> return stack to perform COUNT, computing the jump over the string
> and then pushing the new IP back onto the return stack.
>
> Jump accomplished.
>

Even VFX appears to do that. I was expecting something more posh :)
OTOH one doesn't normally place significant/frequently referenced
data in a colon definition.

The bigger annoyance is code alignment which some implementations
put into ," etc instead of handling it separately. ," is a really
handy function for compiling string constant data; but with
implementations that variously align, null-terminate and others
that don't, standardization becomes impossible.

Re: Show human-readable time

<2021Sep25.084456@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 06:44:56 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2021Sep25.084456@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <2021Sep24.094110@mips.complang.tuwien.ac.at> <877df6aqwm.fsf@nightsong.com> <2021Sep24.183924@mips.complang.tuwien.ac.at> <87y27lddml.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="4c980819df9f1819655b9a12f1a9a889";
logging-data="20691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188w8Hu/ZCsiUYO+DFOlOgp"
Cancel-Lock: sha1:gJCdVrhGAgKTHihrVsp+J07rSPI=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 25 Sep 2021 06:44 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> The strings are in a different section than the threaded code.
>
>Does that mean you now have a post-compilation assembly or linking phase
>to fix up the addresses of the different sections?

No. The string is put into the next section, and its address is then
compiled with LITERAL:

: SLiteral ( Compilation c-addr1 u ; run-time -- c-addr2 u ) \ string
\G Compilation: compile the string specified by @i{c-addr1},
\G @i{u} into the current definition. Run-time: return
\G @i{c-addr2 u} describing the address and length of the
\G string.
tuck 2>r next-section here 2r> chars mem, align >r previous-section
r> postpone literal postpone literal ; immediate restrict

>Did you have that
>before?

Sections have been there for a few years, but we have only made use of
them in SLITERAL a few months ago.

>Do you reserve a chunk of memory for the strings and hope it's
>big enough, or what?

Just like the dictionary, section sizes are fixed at startup, so I
guess the answer to your question is yes.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<87pmsxcccv.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 01:01:52 -0700
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <87pmsxcccv.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="bf0c93672b1b7226efe7c489dfaaad93";
logging-data="14602"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wGohGe8ysZmp3BcQKMR7N"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:x8XRRSD6B9QKm6T5o69ZBMRtl3U=
sha1:5esv6Y+t8lfNk7TtlpRkYceuT3w=
 by: Paul Rubin - Sat, 25 Sep 2021 08:01 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> You could upload it to theforth.net.

I tried to do this but the upload failed with a gateway timeout. Oh
well. I appreciate the sentiment behind the site, but I miss Forth Freaks.

Re: Show human-readable time

<2BE3J.44943$3p3.3627@fx16.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!rocksolid2!news.neodome.net!news.uzoreto.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
Newsgroups: comp.lang.forth
From: branimir...@gmail.com (Branimir Maksimovic)
Subject: Re: Show human-readable time
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
<87pmsxcccv.fsf@nightsong.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 12
Message-ID: <2BE3J.44943$3p3.3627@fx16.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sat, 25 Sep 2021 12:27:42 UTC
Organization: usenet-news.net
Date: Sat, 25 Sep 2021 12:27:42 GMT
X-Received-Bytes: 1126
 by: Branimir Maksimovic - Sat, 25 Sep 2021 12:27 UTC

On 2021-09-25, Paul Rubin <no.email@nospam.invalid> wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> You could upload it to theforth.net.
>
> I tried to do this but the upload failed with a gateway timeout. Oh
> well. I appreciate the sentiment behind the site, but I miss Forth Freaks.

Learned Forth with Fig Forth on ZX Spectrum.

--
7-77-777
Evil Sinner!

Re: Show human-readable time

<2021Sep25.184522@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 16:45:22 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 18
Message-ID: <2021Sep25.184522@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <2021Sep24.094110@mips.complang.tuwien.ac.at> <87tui9d0fr.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="4c980819df9f1819655b9a12f1a9a889";
logging-data="19338"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Oz2KshzgUCCpYH93GO6y9"
Cancel-Lock: sha1:n+f28di8TmAnG9oZOUHvebc5Wv0=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 25 Sep 2021 16:45 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> TIME&DATE has been standardized since 1994:
>> https://forth-standard.org/standard/facility/TIMEandDATE
>
>Hmm, the online gforth manual says it's a gforth word. Maybe you want
>to update that.

Thanks for the report. Interestingly, this had been fixed since 0.7
(what the online manual documents), just become broken again, and
checking your report resulted in me fixing that:-).

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<2021Sep25.184814@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 16:48:14 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 19
Message-ID: <2021Sep25.184814@mips.complang.tuwien.ac.at>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com> <sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com> <2021Sep24.082437@mips.complang.tuwien.ac.at> <87ee9ebgof.fsf@nightsong.com> <614DD60B.3080602@rogers.com> <sim0bd$fcq$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="4c980819df9f1819655b9a12f1a9a889";
logging-data="19338"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CWHxN1q/UGkFIDc6VJ5c1"
Cancel-Lock: sha1:wmk1DH8UDHZPUzd21y8d3GInGLw=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 25 Sep 2021 16:48 UTC

dxforth <dxforth@gmail.com> writes:
>On 24/09/2021 23:43, Brian Fox wrote:
>> : (S") ( -- c-addr u) R> COUNT 2DUP + ALIGNED >R ;
....
>Even VFX appears to do that.

Yes, surprisingly much return-address manipulation words with native
code, too. It did not work with gforth-native, because the string
would land in data space, and the code in code space.

However, this technique incurs a branch misprediction (~20 cycles) on
return from (S"), so I don't recommend it for native-code systems.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: Show human-readable time

<8735psqyj2.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Show human-readable time
Date: Sat, 25 Sep 2021 11:51:29 -0700
Organization: A noiseless patient Spider
Lines: 4
Message-ID: <8735psqyj2.fsf@nightsong.com>
References: <8735pvuern.fsf@nightsong.com> <87y27nszv4.fsf@nightsong.com>
<sijev1$14c7$1@gioia.aioe.org> <87ilyqbqqf.fsf@nightsong.com>
<2021Sep24.082437@mips.complang.tuwien.ac.at>
<87ee9ebgof.fsf@nightsong.com> <614DD60B.3080602@rogers.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="bf0c93672b1b7226efe7c489dfaaad93";
logging-data="27904"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jaSOAGFHQsRRlZdWa3Lrw"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:mYsV2JI1fr5kLN9WcmMIkuKfMx4=
sha1:cVuN8oETIlDqfJM1jUBxXyHxG5o=
 by: Paul Rubin - Sat, 25 Sep 2021 18:51 UTC

Brian Fox <brian.fox@rogers.com> writes:
> : (S") ( -- c-addr u) R> COUNT 2DUP + ALIGNED >R ;

This is both awesome and terrifying.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor