Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

E = MC ** 2 +- 3db


devel / comp.lang.forth / Compound Forth word

SubjectAuthor
* Compound Forth wordS Jack
`* Re: Compound Forth wordS Jack
 +* Re: Compound Forth wordS Jack
 |`* Re: Compound Forth wordS Jack
 | `* Re: Compound Forth wordS Jack
 |  `- Re: Compound Forth wordS Jack
 `* Re: Compound Forth wordS Jack
  +- Re: Compound Forth wordS Jack
  `* Re: Compound Forth wordS Jack
   `* Re: Compound Forth wordRuvim
    `* Re: Compound Forth wordS Jack
     `- Re: Compound Forth wordS Jack

1
Compound Forth word

<438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:3d49:: with SMTP id u9mr4735531qtf.264.1633273258305;
Sun, 03 Oct 2021 08:00:58 -0700 (PDT)
X-Received: by 2002:ad4:57ac:: with SMTP id g12mr18339346qvx.49.1633273258131;
Sun, 03 Oct 2021 08:00:58 -0700 (PDT)
Path: rocksolid2!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: Sun, 3 Oct 2021 08:00:57 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:1c8d:3c13:9564:fb67;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:1c8d:3c13:9564:fb67
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
Subject: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sun, 03 Oct 2021 15:00:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 48
 by: S Jack - Sun, 3 Oct 2021 15:00 UTC

WRK DEFINITIONS
( A compound Forth word having a data area and a code area (called MAIN).
Data area typically holds strings and headless anonymous out-of-flow code
i.e. code that doesn't alter code flow in MAIN .
Program flow starts at MAIN .
)

\ VAL, ( a -- ) Headless value, holds a data reference and returns
\ xt of the value
\ {{ ( -- a ) Begins the compile of headless anonymous code
\ }} ( -- a ) IMMEDIATE ends headless anonymous code
\ []! ( x u a -- ) Store x in nth cell of array at address a
\ MAIN (a.k.a. VDOES) Vectors latest word to HERE
\ /FORGET ( xt -- ) Forget word of xt (non-parsing FORGET)

CREATE PARMBLK 16 CELLS ALLOT \ Array for holding upto 16 parameters
: [X0] PARMBLK @ COMPILE, ; IMMEDIATE
: [X1] PARMBLK CELL+ @ COMPILE, ; IMMEDIATE
CREATE BAR \ for testing, has current HERE
CREATE FOO \ the compound word
HERE ," Today's date is " VAL, PARMBLK !
HERE ," date" VAL, 1 PARMBLK []!
{{ [x1] /SYS }} VAL, 1 PARMBLK []!
MAIN
[X0] COUNT TYPE
[X1] CATCH THROW
;

CR FOO
Today's date is Вс окт 3 09:55:51 CDT 2021

WORDS
CURRENT and CONTEXT are WRK
FOO BAR [X1] [X0] PARMBLK
' FOO /FORGET \ remove FOO from dictionary
WORDS
CURRENT and CONTEXT are WRK
BAR [X1] [X0] PARMBLK
( When a compound word is forgotten, it's local data is reclaimed. )
BAR HERE - 0= TRUE assert-1 PASS

+echo
-fin-
ok
--
me

Re: Compound Forth word

<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:2c4:: with SMTP id a4mr9283613qtx.92.1633284335390;
Sun, 03 Oct 2021 11:05:35 -0700 (PDT)
X-Received: by 2002:a0c:f38c:: with SMTP id i12mr4510349qvk.23.1633284335206;
Sun, 03 Oct 2021 11:05:35 -0700 (PDT)
Path: rocksolid2!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: Sun, 3 Oct 2021 11:05:35 -0700 (PDT)
In-Reply-To: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:1c8d:3c13:9564:fb67;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:1c8d:3c13:9564:fb67
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sun, 03 Oct 2021 18:05:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 70
 by: S Jack - Sun, 3 Oct 2021 18:05 UTC

:) frogd
ELF32X86_64 Frog Version 1.0d

"wrk" job FORGET isn't unique

A compound Forth word has a data area, referred here as local data, and a code
area, called MAIN. The data area typically holds strings and reference code,
code that is compiled apart from the main code but is referenced by the main
code. Such reference code is headless, anonymous and not linked into the
dictionary.

Data references can be passed to MAIN via a parameter block where
parameters are execution tokens (XT) of values. Each parameter value
hold a data reference. The parameter values are compiled into the MAIN
code at appropriate points and each place a data reference on the
data stack when executed.

Program flow starts at MAIN.

In this arrangement referencing data and code by main code can perform
without exacting branching penalties.

Removal of a compound word from the dictionary by FORGET will also
reclaim the word's local data. No modification of FORGET should be
required.

\ VAL, ( a -- xt ) Headless value, holds data reference,
\ xt of the value is returned
\ {{ Begin compile of headless anonymous code
\ }} ( -- xt ) IMMEDIATE
\ End compile of headless anonymous code
\ []! ( x n a -- ) Store x in nth cell of array at address a
\ MAIN (a.k.a. VDOES) Vectors latest word to HERE

CREATE PARMBLK 16 CELLS ALLOT \ Array for holding up to 16 parameters
\ (Array size is whatever will do)
( A couple of words for compiling the first two parameters )
: [X0] PARMBLK @ COMPILE, ; IMMEDIATE
: [X1] PARMBLK CELL+ @ COMPILE, ; IMMEDIATE
CREATE BAR \ for testing, has current HERE

( A compound word )
CREATE FOO
HERE ," Today's date is " VAL, PARMBLK !
HERE ," date" VAL, 1 PARMBLK []!
{{ [x1] /SYS }} VAL, 1 PARMBLK []!
MAIN
[X0] COUNT TYPE \ print date text
[X1] CATCH THROW \ tell host to print the date
;

CR FOO
Today's date is Sun 03 Oct 2021 12:58:20 PM CDT


WORDS
CURRENT and CONTEXT are WRK
FOO BAR [X1] [X0] PARMBLK

FORGET FOO \ remove FOO from dictionary
WORDS
CURRENT and CONTEXT are WRK
BAR [X1] [X0] PARMBLK
( local data also reclaimed )
BAR HERE - 0= TRUE space assert -1 PASS

-fin-
ok
--
me

Re: Compound Forth word

<802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:c9:: with SMTP id d9mr7482370qtg.189.1633449213792;
Tue, 05 Oct 2021 08:53:33 -0700 (PDT)
X-Received: by 2002:ac8:4347:: with SMTP id a7mr20399707qtn.169.1633449213640;
Tue, 05 Oct 2021 08:53:33 -0700 (PDT)
Path: rocksolid2!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: Tue, 5 Oct 2021 08:53:33 -0700 (PDT)
In-Reply-To: <2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:45c9:8e14:1339:c4e5;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:45c9:8e14:1339:c4e5
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com> <2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Tue, 05 Oct 2021 15:53:33 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 28
 by: S Jack - Tue, 5 Oct 2021 15:53 UTC

On Sunday, October 3, 2021 at 1:05:36 PM UTC-5, S Jack wrote:
> :) frogd
> ( A compound word )
> CREATE FOO
> HERE ," Today's date is " VAL, PARMBLK !
> HERE ," date" VAL, 1 PARMBLK []!
> {{ [x1] /SYS }} VAL, 1 PARMBLK []!
> MAIN
> [X0] COUNT TYPE \ print date text
> [X1] CATCH THROW \ tell host to print the date
> ;
>
A cosmetic change, using PASS in place of PARMBLK to reduce clutter.
Note by doing so parameter order and duplication (none here) comes into play.

( A compound word )
CREATE FOO
HERE ," date" VAL,
PASS {{ [ COMPILE, ] /SYS }} VAL,
HERE ," Today's date is " VAL,
PASS PASS MAIN
[ COMPILE, ] COUNT TYPE \ print date text
[ COMPILE, ] EXECUTE \ tell host to print the date
;

CR FOO
Today's date is Tue 05 Oct 2021 10:37:25 AM CDT
--
me

Re: Compound Forth word

<1cf61909-147e-4edf-af01-d56329e6e27dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:b6c1:: with SMTP id g184mr12978295qkf.270.1633909997588;
Sun, 10 Oct 2021 16:53:17 -0700 (PDT)
X-Received: by 2002:ac8:19:: with SMTP id a25mr11894639qtg.360.1633909997438;
Sun, 10 Oct 2021 16:53:17 -0700 (PDT)
Path: rocksolid2!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: Sun, 10 Oct 2021 16:53:17 -0700 (PDT)
In-Reply-To: <802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:46f:ce1d:8f8e:aba2;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:46f:ce1d:8f8e:aba2
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1cf61909-147e-4edf-af01-d56329e6e27dn@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sun, 10 Oct 2021 23:53:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 55
 by: S Jack - Sun, 10 Oct 2021 23:53 UTC

On Tuesday, October 5, 2021 at 10:53:34 AM UTC-5, S Jack wrote:

Compound word vs. Data quotation

CREATE FOO ( s -- )
HERE >R 6 ALLOT CSI R SMV "33m" R S+ R> val,
HERE >R 4 ALLOT CSI R SMV "m" R S+ R> val,
2 PARMS MAIN
[P1] WA SWA S+
[P0] SWA S+
SWA COUNT DUMP
SWA COUNT ADUMP
SWA CR TELL ;
cr "Compound word example" foo

1B 5B 33 33 6D 43 6F 6D 70 6F 75 6E 64 20 77 6F 72 64 20 65 78 61
6D 70 6C 65 1B 5B 6D
•1B[33mCompound word example•1B[m
Compound word example

: BAR ( s -- )
[, HERE >R 6 ALLOT CSI R SMV "32m" R S+ R> val, P0! ,]
[P0] WA SWA S+
[, HERE >R 4 ALLOT CSI R SMV "m" R S+ R> val, P0! ,]
[P0] SWA S+
SWA COUNT DUMP
SWA COUNT ADUMP
SWA CR TELL ;
cr "Data quotation example" bar

1B 5B 33 32 6D 44 61 74 61 20 71 75 6F 74 61 74 69 6F 6E 20 65 78
61 6D 70 6C 65 1B 5B 6D
•1B[32mData quotation example•1B[m
Data quotation example

-fin-

Notes:
i. WA ( s -- ) Place string s in buffer SWA
i. SWA ( -- a) Working string buffer, 256 bytes
i. SMV ( s a --) Move string s to address a
i. S+ ( s1 s2 --) Append string s1 to string s2
i. VAL, ( x -- xt) Headless value, holds x returns value xt
i. P0! ( x -- ) Store x in parameter block 1st cell
i. PARMS ( xn..x1 n -- ) Store n parms in parameter block
i. [Pn] Compile nth parameter
i. DUMP ( a u --) Dump u bytes as hex values starting at address a
i. ADUMP ( a u --) Dump u bytes as characters starting at address a
Non-printables are shown as hex values preceded by
big dot (value 149 in KOI8R codepage)
i. Tell ( s -- ) Print string s (same as "count type")
ok
--
me

Re: Compound Forth word

<92837670-c06f-4f2a-ad6c-3e998d6503d5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:584d:: with SMTP id h13mr5637767qth.267.1633911167043;
Sun, 10 Oct 2021 17:12:47 -0700 (PDT)
X-Received: by 2002:a05:620a:4154:: with SMTP id k20mr12702699qko.316.1633911166905;
Sun, 10 Oct 2021 17:12:46 -0700 (PDT)
Path: rocksolid2!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: Sun, 10 Oct 2021 17:12:46 -0700 (PDT)
In-Reply-To: <1cf61909-147e-4edf-af01-d56329e6e27dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:46f:ce1d:8f8e:aba2;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:46f:ce1d:8f8e:aba2
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>
<1cf61909-147e-4edf-af01-d56329e6e27dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <92837670-c06f-4f2a-ad6c-3e998d6503d5n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Mon, 11 Oct 2021 00:12:47 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: S Jack - Mon, 11 Oct 2021 00:12 UTC

On Sunday, October 10, 2021 at 6:53:18 PM UTC-5, S Jack wrote:
> On Tuesday, October 5, 2021 at 10:53:34 AM UTC-5, S Jack wrote:
>
> Compound word vs. Data quotation
>
> Notes:
> me

Notes: addendum
i. CSI ( -- s) String, Control Sequence Introducer, ESC [
--
me

Re: Compound Forth word

<ca4bfb4d-3763-4d1a-b1be-8bc9e98d65ebn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:12:: with SMTP id a18mr17759233qtg.157.1633993357353;
Mon, 11 Oct 2021 16:02:37 -0700 (PDT)
X-Received: by 2002:a0c:e003:: with SMTP id j3mr27637393qvk.42.1633993357215;
Mon, 11 Oct 2021 16:02:37 -0700 (PDT)
Path: rocksolid2!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: Mon, 11 Oct 2021 16:02:36 -0700 (PDT)
In-Reply-To: <92837670-c06f-4f2a-ad6c-3e998d6503d5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:45f9:8028:4c2b:dc8f;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:45f9:8028:4c2b:dc8f
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <802ad6f4-46bb-453c-9cfc-e53c71dfcbe1n@googlegroups.com>
<1cf61909-147e-4edf-af01-d56329e6e27dn@googlegroups.com> <92837670-c06f-4f2a-ad6c-3e998d6503d5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca4bfb4d-3763-4d1a-b1be-8bc9e98d65ebn@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Mon, 11 Oct 2021 23:02:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 70
 by: S Jack - Mon, 11 Oct 2021 23:02 UTC

Data quotation

Hid HERE and VAL, in data quotation [, ... ,]
In data quotation parameter P0 holds HERE of the beginning data.
After data quotation P0 holds xt of headless value that
holds HERE of the beginning data. The headless value is compiled
after the data quotation.

27 CONSTANT ESC \ escape character

: STRING_ADD_PREFIX ( s -- s' )
"WA SWA S+" EVALUATE ; IMMEDIATE

: STRING_ADD_POSTFIX ( s -- s' )
"SWA S+" EVALUATE ; IMMEDIATE

: RETURN_STRING ( -- s )
"SWA" EVALUATE ; IMMEDIATE

\ Data quotation example1
\ Add data prefix and postfix to string
\ Output string is in work buffer SWA
: STRING_MAKE_GREEN ( s -- s' )
[, ," x[32m" ESC P0 CHAR+ C! ,] STRING_ADD_PREFIX
[, ," x[m" ESC P0 CHAR+ C! ,] STRING_ADD_POSTFIX
RETURN_STRING ;

"Hello World!" STRING_MAKE_GREEN
DUP SPACE TELL Hello World!
COUNT 2DUP
DUMP
1B 5B 33 32 6D 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 1B 5B 6D
ADUMP
•1B[32mHello World!•1B[m

\ Example 2
: STRING_MAKE_BROWN ( s -- s' )
[, '"[33m*** " HOLDS ESC HOLD' /S, ,] STRING_ADD_PREFIX
[, '"[m" HOLDS ESC HOLD " ***" HOLDS' /S, ,] STRING_ADD_POSTFIX
RETURN_STRING ;

"Good-bye" STRING_MAKE_BROWN
space tell *** Good-bye ***


-fin-

Notes:
i. s Notation of counted string with byte count
i. P0 ( -- x ) First parameter (in parameter block)
i. P0! ( x -- ) Store x as first parameter
i. [P0] Compile first parameter
i. VAL, ( x -- xt) Compiles headless value, holds x returns value xt
i. [, Start data quotation, P0 is HERE at data beginning
i. ,] ( -- a) End data quotation, Retrun address a of data block
i. SWA ( -- a) String variable, 256 bytes
i. WA ( s -- ) Move string s to string variable SWA
i. ," ( ccc<"> -- s) Parse to double-quote and return string s
i. SMV ( s a --) Move string s to address a
i. S+ ( s1 s2 --) Append string s1 to string s2
i. DUMP ( a u --) Dump u byte hex values starting at address a
i. ADUMP ( a u --) Dump u byte characters starting at address a
Non-printables are shown as hex values preceeded by
big dot (value 149 in KOI8R codepage)
i. Tell ( s -- ) Print string s (same as "count type")
i. /S, ( d -- ) Compile pictured string (no numeric conversions)
ok
--
me

Re: Compound Forth word

<abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:73d5:: with SMTP id v21mr25230924qtp.128.1634065914111;
Tue, 12 Oct 2021 12:11:54 -0700 (PDT)
X-Received: by 2002:a0c:90c8:: with SMTP id p66mr32111833qvp.55.1634065913921;
Tue, 12 Oct 2021 12:11:53 -0700 (PDT)
Path: rocksolid2!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: Tue, 12 Oct 2021 12:11:53 -0700 (PDT)
In-Reply-To: <2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:352a:3e28:90ee:d1ce;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:352a:3e28:90ee:d1ce
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com> <2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Tue, 12 Oct 2021 19:11:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 26
 by: S Jack - Tue, 12 Oct 2021 19:11 UTC

Compound word vs. Data quotation

CREATE SBROWN ( s -- s')
[- "x[33m" S, ESC R CHAR+ C! -]
[- "x[m" S, ESC R CHAR+ C! -]
2 PARMS MAIN
[P1] STRING_ADD_PREFIX
[P0] STRING_ADD_SUFFIX
RETURN_STRING ;

"Compound word example" SBROWN count adump
•1B[33mCompound word example•1B[m

: SGREEN ( s -- s' )
[, "x[32m" S, ESC R CHAR+ C! ,] STRING_ADD_PREFIX
[, "x[m" S, ESC R CHAR+ C! ,] STRING_ADD_SUFFIX
RETURN_STRING ;

"Data quotation example" SGREEN count adump
•1B[32mData quotation example•1B[m

-fin-
--
me

Re: Compound Forth word

<daaf0271-e772-439f-999a-910b90a7b31en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:3d49:: with SMTP id u9mr27208297qtf.264.1634090450101;
Tue, 12 Oct 2021 19:00:50 -0700 (PDT)
X-Received: by 2002:a37:a4c5:: with SMTP id n188mr1019266qke.312.1634090449919;
Tue, 12 Oct 2021 19:00:49 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.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: Tue, 12 Oct 2021 19:00:49 -0700 (PDT)
In-Reply-To: <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:352a:3e28:90ee:d1ce;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:352a:3e28:90ee:d1ce
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <daaf0271-e772-439f-999a-910b90a7b31en@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Wed, 13 Oct 2021 02:00:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 128
 by: S Jack - Wed, 13 Oct 2021 02:00 UTC

Standard data compare non-quotation vs. quotation

Data non-quotation

27 CONSTANT ESC
\ Standard data example
: FOO ( s -- s' )
AHEAD
[ HERE >R S" x[32m" STRING_COMPILE ESC R@ CHAR+ C! R> -ROT ]
THEN LITERAL STRING_ADD_PREFIX
AHEAD
[ HERE >R S" x[m" STRING_COMPILE ESC R@ CHAR+ C! R> -ROT ]
THEN LITERAL STRING_ADD_SUFFIX
: STRING_ADD_PREFIX "wa swa s+" eval ; IMM
RETURN_STRING

;

S" Hello World!" FOO ADUMP
•1B[32mHello World!•1B[m


Standard data compare non-quotation vs. quotation

Data non-quotation

Standard data compare non-quotation vs. quotation

Data non-quotation

27 CONSTANT ESC
\ Standard data example
: FOO ( s -- s' )
AHEAD
[ HERE >R DATA_GREEN_ATTRIBUTE R> -ROT ] ? missing data

' eval see
EVAL
134532404 COUNT
134532408 GEVAL
134532412 ;S ok
' geval see

GEVAL
134532356 SIB
134532360 >R
134532364 >R
134532368 2R
134532372 CMOVE
134532376 2R>
134532380 (EVAL)
134532384 ;S ok
' (eval) see
' fi aka then
Standard data compare non-quotation vs. quotation

Data non-quotation

27 CONSTANT ESC
\ Standard data example
: FOO ( s -- s' )
AHEAD
[ HERE >R DATA_GREEN_ATTRIBUTE R> -ROT ]
THEN LITERAL STRING_ADD_PREFIX
AHEAD
[ HERE >R S" x[m" STRING_COMPILE ESC R@ CHAR+ C! R> -ROT ]
THEN LITERAL STRING_ADD_SUFFIX
THEN LITERAL STRING_ADD_PREFIX
RETURN_STRING
;

Standard data compare non-quotation vs. quotation

Data non-quotation

27 CONSTANT ESC
\ Standard data example
: FOO ( s -- s' )
AHEAD
[ HERE >R DATA_GREEN_ATTRIBUTE R> -ROT ]
THEN LITERAL STRING_ADD_PREFIX
AHEAD
[ HERE >R DATA_ATTRIBUTE_OFF R> -ROT ]
THEN LITERAL STRING_ADD_SUFFIX
RETURN_STRING
;

S" Hello World!" FOO ADUMP
•1B[32mHello World!•1B[m

Data quotation

\ Data quotation example
: BAR ( s -- s' )
[, DATA_GREEN_ATTRIBUTE ,] STRING_ADD_PREFIX
[, DATA_ATTRIBUTE_OFF ,] STRING_ADD_SUFFIX
RETURN_STRING
;

S" Hello World!" BAR ADUMP
•1B[32mHello World!•1B[m

-fin-
--
me

Re: Compound Forth word

<3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:13cc:: with SMTP id p12mr21888799qtk.227.1634135310468;
Wed, 13 Oct 2021 07:28:30 -0700 (PDT)
X-Received: by 2002:ac8:7319:: with SMTP id x25mr29795639qto.147.1634135310242;
Wed, 13 Oct 2021 07:28:30 -0700 (PDT)
Path: rocksolid2!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: Wed, 13 Oct 2021 07:28:30 -0700 (PDT)
In-Reply-To: <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:c19:d559:cdb7:e852;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:c19:d559:cdb7:e852
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Wed, 13 Oct 2021 14:28:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 36
 by: S Jack - Wed, 13 Oct 2021 14:28 UTC

Standard data compare non-quotation vs. quotation

Data non-quotation

27 CONSTANT ESC
\ Standard data example
: FOO ( s -- s' )
AHEAD
[ HERE >R DATA_GREEN_ATTRIBUTE R> -ROT ]
THEN LITERAL STRING_ADD_PREFIX
AHEAD
[ HERE >R DATA_ATTRIBUTE_OFF R> -ROT ]
THEN LITERAL STRING_ADD_SUFFIX
RETURN_STRING
;

S" Hello World!" FOO ADUMP
•1B[32mHello World!•1B[m

Data quotation

\ Data quotation example
: BAR ( s -- s' )
[, DATA_GREEN_ATTRIBUTE ,] STRING_ADD_PREFIX
[, DATA_ATTRIBUTE_OFF ,] STRING_ADD_SUFFIX
RETURN_STRING
;

S" Hello World!" BAR ADUMP
•1B[32mHello World!•1B[m

-fin-
--
me

Re: Compound Forth word

<sk7lrh$j0k$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Compound Forth word
Date: Thu, 14 Oct 2021 01:16:14 +0300
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <sk7lrh$j0k$1@dont-email.me>
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com>
<abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
<3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 13 Oct 2021 22:16:17 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fd6a36f0527e0b7d6d8c69a8e1d91bf3";
logging-data="19476"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Qw8waCcVcWpWoBaPqRm0v"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.2.0
Cancel-Lock: sha1:jRwCcn3FI/WEZ+UOkjTHMdDZFtg=
In-Reply-To: <3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com>
Content-Language: en-US
 by: Ruvim - Wed, 13 Oct 2021 22:16 UTC

On 2021-10-13 17:28, S Jack wrote:
> Standard data compare non-quotation vs. quotation
>
> Data non-quotation
>
> 27 CONSTANT ESC
> \ Standard data example
> : FOO ( s -- s' )
> AHEAD
> [ HERE >R DATA_GREEN_ATTRIBUTE R> -ROT ]
> THEN LITERAL STRING_ADD_PREFIX
> AHEAD
> [ HERE >R DATA_ATTRIBUTE_OFF R> -ROT ]
> THEN LITERAL STRING_ADD_SUFFIX
> RETURN_STRING
> ;
>
> S" Hello World!" FOO ADUMP
> •1B[32mHello World!•1B[m
>
>
> Data quotation
>
>
> \ Data quotation example
> : BAR ( s -- s' )
> [, DATA_GREEN_ATTRIBUTE ,] STRING_ADD_PREFIX
> [, DATA_ATTRIBUTE_OFF ,] STRING_ADD_SUFFIX
> RETURN_STRING
> ;
>
> S" Hello World!" BAR ADUMP
> •1B[32mHello World!•1B[m
>

In both cases, an interface is not separated from its implementation.
That don't look great. What problem it solves?

--
Ruvim

Re: Compound Forth word

<560bca2c-ec9f-4bfb-a798-269d29d3d6d8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:238a:: with SMTP id fw10mr6477410qvb.30.1634231373000;
Thu, 14 Oct 2021 10:09:33 -0700 (PDT)
X-Received: by 2002:a37:9581:: with SMTP id x123mr5971267qkd.477.1634231372803;
Thu, 14 Oct 2021 10:09:32 -0700 (PDT)
Path: rocksolid2!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: Thu, 14 Oct 2021 10:09:32 -0700 (PDT)
In-Reply-To: <sk7lrh$j0k$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:a8b3:13d3:5300:acf1;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:a8b3:13d3:5300:acf1
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
<3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com> <sk7lrh$j0k$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <560bca2c-ec9f-4bfb-a798-269d29d3d6d8n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Thu, 14 Oct 2021 17:09:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 35
 by: S Jack - Thu, 14 Oct 2021 17:09 UTC

On Wednesday, October 13, 2021 at 5:16:18 PM UTC-5, Ruvim wrote:

> In both cases, an interface is not separated from its implementation.

True in the first case, the -ROT assumes AHEAD puts two values on
control-stack. But a system could do this and provide the user with
a word where this is hidden.
Don't see interface problem in second case; not much shows.

> That don't look great. What problem it solves?

Solves no problem that I'm aware of. More of a matter of style and
alternatives.

The second case has two advantages over the first. First, it's abstracted,
so a system with Anton's data sections could put the compiled data there
and other systems could just compile the data in the word that uses it.
The second advantage, but only where the data is being compiled in the
word, is that the Literal is replaced by a headless Value (no second
branch penalty).

I may be the only one but I like the structured style:
: FOO
[, data1 ,] word1
[, data2 ,] word2
...
[, dataN ,] wordN
;

A reminder, data is compiled character string which characters are
values maybe with some mixture of text. 'S"' which is text only could
not be used by itself to provide the data. What goes between "[," and
",]" are words to compile the data. "]," provides the following word
with a reference to the beginning of the compiled data.
--
me

Re: Compound Forth word

<6c0281f0-5923-41cd-bca3-af7414888619n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:9586:: with SMTP id x128mr46788qkd.49.1634747140420;
Wed, 20 Oct 2021 09:25:40 -0700 (PDT)
X-Received: by 2002:ac8:19:: with SMTP id a25mr140191qtg.360.1634747140155;
Wed, 20 Oct 2021 09:25:40 -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: Wed, 20 Oct 2021 09:25:39 -0700 (PDT)
In-Reply-To: <560bca2c-ec9f-4bfb-a798-269d29d3d6d8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:78e4:5c6f:fbd8:a031;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:78e4:5c6f:fbd8:a031
References: <438c634a-c680-4ae2-ad5b-15b1f9aaad70n@googlegroups.com>
<2ccba8ab-52d3-4b6a-93af-5582109c663bn@googlegroups.com> <abc7275e-0e1e-4c7a-a62d-282a5239a951n@googlegroups.com>
<3ab87192-a37c-4d16-9cd2-e0406429ddf4n@googlegroups.com> <sk7lrh$j0k$1@dont-email.me>
<560bca2c-ec9f-4bfb-a798-269d29d3d6d8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c0281f0-5923-41cd-bca3-af7414888619n@googlegroups.com>
Subject: Re: Compound Forth word
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Wed, 20 Oct 2021 16:25:40 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 60
 by: S Jack - Wed, 20 Oct 2021 16:25 UTC

:) cat job
[#] demo_ipc -- IPC demo
--.
347 LOAD \ PARMS
cr
h1 IPC demo
cr
cr
h2 Pipe to Bash EXPR for REGEX operation
cr
CREATE EXPR
[[ %'expr "% S, ]] \ P2, Prefix string constant
[[ %" : "% S, ]] \ P1, Middle string constant
[[ %"'% S, ]] \ P0, Suffix string constant
3 PARMS MAIN
IPC:H 0= IF IPC:OPEN FI
[P2] WA \ place Prefix in SWA buffer
SWA S+ \ append topic string
[P1] SWA S+ \ append Middle
SWA S+ \ append REGEX string
[P0] SWA S+ \ append Suffix
SWA IPC:WRITE \ write to IPC channel
PAD 80 IPC:READL \ read ipc line
;

MARKER myJob \ Mark beginning of job memory
:[ IPC:SRC 2@ TYPE ]: IS IPC:READL \ IPC response action
".*\(X.*Y\).*" \ REGEX expression
"Old magic XYZZY still works" \ topic string
cr EXPR \ apply REGEX to topic string
cr
cr .( Sent: ) SWA TELL \ view what was sent
myJob \ release job memory
cr
cr done
cr
( Notes:
i. [[...]] ( -- xt ) headless value with reference to enclosed data
i. :[...]: ( -- xt ) anonymous and headless word
) --.
[#] //
:) job=job
:) GO=$job frogd
ELF32X86_64 Frog Version 1.0d

getgo ok
go
IPC demo

Pipe to Bash EXPR for REGEX operation

XYZZY

Sent: 'expr "Old magic XYZZY still works" : ".*\(X.*Y\).*"'

-fin-
ok
bye :)
--
me

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor