Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If it wasn't for Newton, we wouldn't have to eat bruised apples.


devel / comp.lang.forth / gnuforth ascii terminal colors

SubjectAuthor
* gnuforth ascii terminal colorsgobli...@gmail.com
+* Re: gnuforth ascii terminal colorsLorem Ipsum
|`* Re: gnuforth ascii terminal colorsAnton Ertl
| `- Re: gnuforth ascii terminal colorsLorem Ipsum
+* Re: gnuforth ascii terminal colorsminforth
|`- Re: gnuforth ascii terminal colorsBrian Fox
+* Re: gnuforth ascii terminal colorsBrian Fox
|`* Re: gnuforth ascii terminal colorsdxforth
| +- Re: gnuforth ascii terminal colorsS Jack
| `- Re: gnuforth ascii terminal colorsBrian Fox
+- Re: gnuforth ascii terminal colorsAnton Ertl
`- Re: gnuforth ascii terminal colorsnone

1
gnuforth ascii terminal colors

<7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1007:b0:74c:ed4d:7916 with SMTP id z7-20020a05620a100700b0074ced4d7916mr3783468qkj.12.1683139712299;
Wed, 03 May 2023 11:48:32 -0700 (PDT)
X-Received: by 2002:a05:622a:1802:b0:3ef:3b04:b8e2 with SMTP id
t2-20020a05622a180200b003ef3b04b8e2mr360533qtc.0.1683139712086; Wed, 03 May
2023 11:48:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!45.76.7.193.MISMATCH!3.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.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, 3 May 2023 11:48:31 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:db46:809a:732b:3978;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:db46:809a:732b:3978
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Subject: gnuforth ascii terminal colors
From: goblinri...@gmail.com (gobli...@gmail.com)
Injection-Date: Wed, 03 May 2023 18:48:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: gobli...@gmail.com - Wed, 3 May 2023 18:48 UTC

hello,

I'm using gnu-forth currently as interpreter,
I use escape sequences for coloration of strings in terminal with a

decimal
27 constant ESC \ to manage escape sequences used as colorations
: COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL

so I can use it as

31 colorize ." print something" 0 colorize

for example.

is this a good method for my xterm compatibles ascii-terminals ?
is there a better way to do so ?

regards.

Re: gnuforth ascii terminal colors

<c343ed07-afde-4af8-a4cb-d8ec4bcec6cen@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:14a3:b0:61b:5c7a:b51e with SMTP id bo3-20020a05621414a300b0061b5c7ab51emr1694935qvb.4.1683147478938;
Wed, 03 May 2023 13:57:58 -0700 (PDT)
X-Received: by 2002:ae9:e007:0:b0:751:8176:c3f5 with SMTP id
m7-20020ae9e007000000b007518176c3f5mr1024081qkk.7.1683147478726; Wed, 03 May
2023 13:57:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.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, 3 May 2023 13:57:58 -0700 (PDT)
In-Reply-To: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=172.56.168.141; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 172.56.168.141
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c343ed07-afde-4af8-a4cb-d8ec4bcec6cen@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: gnuarm.d...@gmail.com (Lorem Ipsum)
Injection-Date: Wed, 03 May 2023 20:57:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 39
 by: Lorem Ipsum - Wed, 3 May 2023 20:57 UTC

On Wednesday, May 3, 2023 at 2:48:33 PM UTC-4, gobli...@gmail.com wrote:
> hello,
>
> I'm using gnu-forth currently as interpreter,
> I use escape sequences for coloration of strings in terminal with a
>
> decimal
> 27 constant ESC \ to manage escape sequences used as colorations
> : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL
>
> so I can use it as
>
> 31 colorize ." print something" 0 colorize
>
> for example.
>
> is this a good method for my xterm compatibles ascii-terminals ?
> is there a better way to do so ?

Maybe I'm missing something, or don't understand BASE. I thought it is the address where the number conversion base is stored. You save it on the return stack, then restore it after printing the number, but I don't see where you change it. So why save and restore if you are not going to change it?

Also, at the very beginning, you change the value stored at BASE to 10 with the word decimal. Is that intentional? the word decimal is not going to have any impact if BASE is changed elsewhere in the code, before colorize is called.

What am I missing?

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: gnuforth ascii terminal colors

<ddf05680-a796-4e6a-a108-031d6c2ebcf5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:164a:b0:74d:f227:d25a with SMTP id c10-20020a05620a164a00b0074df227d25amr2505239qko.2.1683149726233;
Wed, 03 May 2023 14:35:26 -0700 (PDT)
X-Received: by 2002:ad4:551d:0:b0:5f5:8214:b104 with SMTP id
pz29-20020ad4551d000000b005f58214b104mr1723858qvb.0.1683149725727; Wed, 03
May 2023 14:35:25 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.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, 3 May 2023 14:35:25 -0700 (PDT)
In-Reply-To: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=87.157.111.83; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 87.157.111.83
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ddf05680-a796-4e6a-a108-031d6c2ebcf5n@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: minfo...@arcor.de (minforth)
Injection-Date: Wed, 03 May 2023 21:35:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 79
 by: minforth - Wed, 3 May 2023 21:35 UTC

gobli...@gmail.com schrieb am Mittwoch, 3. Mai 2023 um 20:48:33 UTC+2:
> hello,
>
> I'm using gnu-forth currently as interpreter,
> I use escape sequences for coloration of strings in terminal with a
>
> decimal
> 27 constant ESC \ to manage escape sequences used as colorations
> : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL
>
> so I can use it as
>
> 31 colorize ." print something" 0 colorize
>
> for example.
>
> is this a good method for my xterm compatibles ascii-terminals ?
> is there a better way to do so ?

This is a rather subjective question. If it is good enough for you, it is good.

FWIW sometimes I use

\ : BOUNDS over + swap ;
\ : ESC[ 27 emit '[' emit ;

VARIABLE _VT \ Virtual/ANSI terminal enabled flag
-1 _VT !

: __VTSET \ ( n..1 a u -- ) set VT through string (^=ESC[, ~=number)
base @ >r decimal bounds ?DO i c@
dup '^' = IF drop esc[ ELSE
dup '~' = IF drop 0 .r ELSE
emit THEN THEN
LOOP r> base ! ;

: PAGE \ ( -- ) 10.6.1.2005 clear terminal screen
_vt @ IF s" ^2J^H" __vtset THEN ;

: AT-XY \ ( col row -- ) 10.6.1.0742 set text cursor coordinates
_vt @ IF 1+ swap 1+ swap s" ^~;~f" __vtset THEN ;

: SAVE-XY \ ( -- ) MF save cursor coordinates to memory
_vt @ IF esc[ 's' emit THEN ;

: RESTORE-XY \ ( -- ) MF restore cursor coordinates from memory
_vt @ IF esc[ 'u' emit THEN ;

: __VTCHAR \ ( n -- ) MF set terminal character attribute
_vt @ IF s" ^~m" __vtset ELSE drop THEN ;

\ text attributes
: VTNORMAL 0 __vtchar ; \ ( -- ) MF
: VTBRIGHT 1 __vtchar ; \ ( -- ) MF
: VTUNDERLINE 4 __vtchar ; \ ( -- ) MF
: VTREVERSE 7 __vtchar ; \ ( -- ) MF
: VTHIDDEN 8 __vtchar ; \ ( -- ) MF

\ text colors
: VTBLACK 30 __vtchar ; \ ( -- ) MF
: VTRED 31 __vtchar ; \ ( -- ) MF
: VTGREEN 32 __vtchar ; \ ( -- ) MF
: VTYELLOW 33 __vtchar ; \ ( -- ) MF
: VTBLUE 34 __vtchar ; \ ( -- ) MF
: VTMAGENTA 35 __vtchar ; \ ( -- ) MF
: VTCYAN 36 __vtchar ; \ ( -- ) MF
: VTWHITE 37 __vtchar ; \ ( -- ) MF

\ move cursor
: VTUP _vt @ IF s" ^~A" __vtset THEN ; \ ( n -- ) MF
: VTDOWN _vt @ IF s" ^~B" __vtset THEN ; \ ( n -- ) MF
: VTRIGHT _vt @ IF s" ^~C" __vtset THEN ; \ ( n -- ) MF
: VTLEFT _vt @ IF s" ^~D" __vtset THEN ; \ ( n -- ) MF

\ test
CR vtcyan vtbright ." !! BELLA ITALIA !!" vtreverse
CR vtgreen 18 spaces
CR vtwhite 18 spaces
CR vtred 18 spaces
CR vtwhite vtnormal

Re: gnuforth ascii terminal colors

<31cc82d3-1651-4c6a-9fb9-4ed5923336aan@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:198d:b0:3e9:75a8:942e with SMTP id u13-20020a05622a198d00b003e975a8942emr611643qtc.5.1683160028647;
Wed, 03 May 2023 17:27:08 -0700 (PDT)
X-Received: by 2002:a05:620a:13b3:b0:74e:37dd:61a6 with SMTP id
m19-20020a05620a13b300b0074e37dd61a6mr2956665qki.13.1683160028472; Wed, 03
May 2023 17:27:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 3 May 2023 17:27:08 -0700 (PDT)
In-Reply-To: <ddf05680-a796-4e6a-a108-031d6c2ebcf5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=104.245.145.10; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 104.245.145.10
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com> <ddf05680-a796-4e6a-a108-031d6c2ebcf5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <31cc82d3-1651-4c6a-9fb9-4ed5923336aan@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: brian....@brianfox.ca (Brian Fox)
Injection-Date: Thu, 04 May 2023 00:27:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4191
 by: Brian Fox - Thu, 4 May 2023 00:27 UTC

On Wednesday, May 3, 2023 at 5:35:27 PM UTC-4, minforth wrote:
> gobli...@gmail.com schrieb am Mittwoch, 3. Mai 2023 um 20:48:33 UTC+2:
> > hello,
> >
> > I'm using gnu-forth currently as interpreter,
> > I use escape sequences for coloration of strings in terminal with a
> >
> > decimal
> > 27 constant ESC \ to manage escape sequences used as colorations
> > : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL
> >
> > so I can use it as
> >
> > 31 colorize ." print something" 0 colorize
> >
> > for example.
> >
> > is this a good method for my xterm compatibles ascii-terminals ?
> > is there a better way to do so ?
> This is a rather subjective question. If it is good enough for you, it is good.
>
> FWIW sometimes I use
>
> \ : BOUNDS over + swap ;
> \ : ESC[ 27 emit '[' emit ;
>
> VARIABLE _VT \ Virtual/ANSI terminal enabled flag
> -1 _VT !
>
> : __VTSET \ ( n..1 a u -- ) set VT through string (^=ESC[, ~=number)
> base @ >r decimal bounds ?DO i c@
> dup '^' = IF drop esc[ ELSE
> dup '~' = IF drop 0 .r ELSE
> emit THEN THEN
> LOOP r> base ! ;
>
> : PAGE \ ( -- ) 10.6.1.2005 clear terminal screen
> _vt @ IF s" ^2J^H" __vtset THEN ;
>
> : AT-XY \ ( col row -- ) 10.6.1.0742 set text cursor coordinates
> _vt @ IF 1+ swap 1+ swap s" ^~;~f" __vtset THEN ;
>
> : SAVE-XY \ ( -- ) MF save cursor coordinates to memory
> _vt @ IF esc[ 's' emit THEN ;
>
> : RESTORE-XY \ ( -- ) MF restore cursor coordinates from memory
> _vt @ IF esc[ 'u' emit THEN ;
>
> : __VTCHAR \ ( n -- ) MF set terminal character attribute
> _vt @ IF s" ^~m" __vtset ELSE drop THEN ;
>
> \ text attributes
> : VTNORMAL 0 __vtchar ; \ ( -- ) MF
> : VTBRIGHT 1 __vtchar ; \ ( -- ) MF
> : VTUNDERLINE 4 __vtchar ; \ ( -- ) MF
> : VTREVERSE 7 __vtchar ; \ ( -- ) MF
> : VTHIDDEN 8 __vtchar ; \ ( -- ) MF
>
> \ text colors
> : VTBLACK 30 __vtchar ; \ ( -- ) MF
> : VTRED 31 __vtchar ; \ ( -- ) MF
> : VTGREEN 32 __vtchar ; \ ( -- ) MF
> : VTYELLOW 33 __vtchar ; \ ( -- ) MF
> : VTBLUE 34 __vtchar ; \ ( -- ) MF
> : VTMAGENTA 35 __vtchar ; \ ( -- ) MF
> : VTCYAN 36 __vtchar ; \ ( -- ) MF
> : VTWHITE 37 __vtchar ; \ ( -- ) MF
>
> \ move cursor
> : VTUP _vt @ IF s" ^~A" __vtset THEN ; \ ( n -- ) MF
> : VTDOWN _vt @ IF s" ^~B" __vtset THEN ; \ ( n -- ) MF
> : VTRIGHT _vt @ IF s" ^~C" __vtset THEN ; \ ( n -- ) MF
> : VTLEFT _vt @ IF s" ^~D" __vtset THEN ; \ ( n -- ) MF
>
> \ test
> CR vtcyan vtbright ." !! BELLA ITALIA !!" vtreverse
> CR vtgreen 18 spaces
> CR vtwhite 18 spaces
> CR vtred 18 spaces
> CR vtwhite vtnormal

Re: gnuforth ascii terminal colors

<c5669003-b14e-497d-a141-009038788a9an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:a4c:b0:61b:6026:5f34 with SMTP id ee12-20020a0562140a4c00b0061b60265f34mr976606qvb.2.1683160245261;
Wed, 03 May 2023 17:30:45 -0700 (PDT)
X-Received: by 2002:a37:e305:0:b0:74a:da50:3ce1 with SMTP id
y5-20020a37e305000000b0074ada503ce1mr3994288qki.7.1683160245091; Wed, 03 May
2023 17:30:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.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, 3 May 2023 17:30:44 -0700 (PDT)
In-Reply-To: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=104.245.145.10; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 104.245.145.10
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c5669003-b14e-497d-a141-009038788a9an@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: brian....@brianfox.ca (Brian Fox)
Injection-Date: Thu, 04 May 2023 00:30:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 31
 by: Brian Fox - Thu, 4 May 2023 00:30 UTC

On Wednesday, May 3, 2023 at 2:48:33 PM UTC-4, gobli...@gmail.com wrote:
> hello,
>
> I'm using gnu-forth currently as interpreter,
> I use escape sequences for coloration of strings in terminal with a
>
> decimal
> 27 constant ESC \ to manage escape sequences used as colorations
> : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL
>
> so I can use it as
>
> 31 colorize ." print something" 0 colorize
>
> for example.
>
> is this a good method for my xterm compatibles ascii-terminals ?
> is there a better way to do so ?
>
> regards.

I play with a retro machine where memory is tight so I broke out text
and colour.

I created a kind of "markup" for the VT100 commands
These might provide some ideas for you.

https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100.FTH
https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100COLR.FTH

Re: gnuforth ascii terminal colors

<u2v76j$1lho2$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: gnuforth ascii terminal colors
Date: Thu, 4 May 2023 13:01:40 +1000
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <u2v76j$1lho2$1@dont-email.me>
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
<c5669003-b14e-497d-a141-009038788a9an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 4 May 2023 03:01:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c67ee6ad4e60ea600a4e09c8e9bccac4";
logging-data="1754882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Mw1OP+KEXVYJeRZU69Sgw"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:ETwe/4Md4msfDq9PKGxTXSH9weY=
Content-Language: en-GB
In-Reply-To: <c5669003-b14e-497d-a141-009038788a9an@googlegroups.com>
 by: dxforth - Thu, 4 May 2023 03:01 UTC

On 4/05/2023 10:30 am, Brian Fox wrote:
>
> I created a kind of "markup" for the VT100 commands
> These might provide some ideas for you.
>
> https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100.FTH
> https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100COLR.FTH

Aren't the XY coords for VT100/ANSI 1-based rather than 0-based?

Re: gnuforth ascii terminal colors

<2023May4.101747@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!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: gnuforth ascii terminal colors
Date: Thu, 04 May 2023 08:17:47 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2023May4.101747@mips.complang.tuwien.ac.at>
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com> <c343ed07-afde-4af8-a4cb-d8ec4bcec6cen@googlegroups.com>
Injection-Info: dont-email.me; posting-host="ce1031e103e0aa744de5bfba1d1611c3";
logging-data="1856044"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WvbvOHqZ714r5pqc6E9iu"
Cancel-Lock: sha1:dlH3bnr99ir+jAvdbX13VG97y5A=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 4 May 2023 08:17 UTC

Lorem Ipsum <gnuarm.deletethisbit@gmail.com> writes:
>On Wednesday, May 3, 2023 at 2:48:33=E2=80=AFPM UTC-4, gobli...@gmail.com w=
>rote:
>> decimal=20
>> 27 constant ESC \ to manage escape sequences used as colorations=20
>> : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ A=
....
>Maybe I'm missing something, or don't understand BASE. I thought it is the=
> address where the number conversion base is stored. You save it on the re=
>turn stack, then restore it after printing the number, but I don't see wher=
>e you change it. So why save and restore if you are not going to change it=
>?=20

Yes, the BASE saving and restoring is unnecessary here.

>Also, at the very beginning, you change the value stored at BASE to 10 with=
> the word decimal. Is that intentional? the word decimal is not going to =
>have any impact if BASE is changed elsewhere in the code, before colorize i=
>s called.=20
>
>What am I missing?=20

DECIMAL ensures that the "27" is converted using decimal base.

An alternative (Forth-2012) way to ensure this is to write

#27 constant ESC

instead.

- 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 2022: https://euro.theforth.net

Re: gnuforth ascii terminal colors

<2023May4.102235@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!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: gnuforth ascii terminal colors
Date: Thu, 04 May 2023 08:22:35 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 46
Message-ID: <2023May4.102235@mips.complang.tuwien.ac.at>
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="ce1031e103e0aa744de5bfba1d1611c3";
logging-data="1867295"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GAW/HuWRfrAJanPZWM5V9"
Cancel-Lock: sha1:6vaIArwvRs98WK3sp71VYlCyfIQ=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 4 May 2023 08:22 UTC

"gobli...@gmail.com" <goblinrieur@gmail.com> writes:
>hello,
>
>I'm using gnu-forth currently as interpreter,
>I use escape sequences for coloration of strings in terminal with a
>
>decimal
>27 constant ESC \ to manage escape sequences used as colorations
>: COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ ASCII TERMINAL
>
>so I can use it as
>
>31 colorize ." print something" 0 colorize
>
>for example.
>
>is this a good method for my xterm compatibles ascii-terminals ?
>is there a better way to do so ?

Looking at COLORIZE again, I expect that you want to put DECIMAL (I
think) before the <#. You can make your program safer in the face of
exceptions by wrapping the base-change and restoration with CATCH;
Gforth provides BASE-EXECUTE
<https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Number-Conversion.html>
that does all that for you.

Gforth also provides #ESC, and in Forth-2012 you can write

s\" \e[" type

instead of

ESC EMIT ." ["

Development Gforth has various words that use escape sequences to get
coloured output on terminals/consoles that understand these escape
sequences. You can find some documentation (which could be improved)
at <https://gforth.org/manual/Terminal-output.html> and source code at
<http://git.savannah.gnu.org/cgit/gforth.git/tree/ansi.fs>

- 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 2022: https://euro.theforth.net

Re: gnuforth ascii terminal colors

<nnd$2a5470cf$2a3a462e@cded5df31ad7a5da>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$2a5470cf$2a3a462e@cded5df31ad7a5da>
Organization: KPN B.V.
Date: Thu, 04 May 2023 13:49:13 +0200
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 53
Injection-Date: Thu, 04 May 2023 13:49:13 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2222
 by: none - Thu, 4 May 2023 11:49 UTC

In article <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>,
gobli...@gmail.com <goblinrieur@gmail.com> wrote:
>hello,
>
>I'm using gnu-forth currently as interpreter,
>I use escape sequences for coloration of strings in terminal with a
>
>decimal
>27 constant ESC \ to manage escape sequences used as colorations
>: COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \

You are well advised to insert DECIMAL here.
: COLORIZE ESC EMIT ." [" base @ >R
DECIMAL
0 <# #S #> type R> base ! ." m" ; \

Suppose you have define colors like so:
35 CONSTANT pink

Further suppose you are in HEX. Suddenly
pink COLORIZE
behaves strangely.

Actually the color "number" is not in hex or decimal, it is
just a string. (Ask any VT220 ).
Using the FORMAT package of lina , it would go
: pink "%e[35" .FORMAT ;
irrespective of base.

>ASCII TERMINAL
>
>so I can use it as
>
>31 colorize ." print something" 0 colorize
>
>for example.
>
>is this a good method for my xterm compatibles ascii-terminals ?
>is there a better way to do so ?

If dictionary space permits, I would burn the "numbers" into
the words that change color.

>
>regards.

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 spinning. - the Wise from Antrim -

Re: gnuforth ascii terminal colors

<51f07643-b928-42c9-a6f3-71577e4629d3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4451:b0:74e:962:dc24 with SMTP id w17-20020a05620a445100b0074e0962dc24mr1197953qkp.0.1683203051239;
Thu, 04 May 2023 05:24:11 -0700 (PDT)
X-Received: by 2002:a05:622a:552:b0:3f2:115e:2645 with SMTP id
m18-20020a05622a055200b003f2115e2645mr1201075qtx.3.1683203051000; Thu, 04 May
2023 05:24:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 4 May 2023 05:24:10 -0700 (PDT)
In-Reply-To: <u2v76j$1lho2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:c874:dd56:7098:d15b;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:c874:dd56:7098:d15b
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
<c5669003-b14e-497d-a141-009038788a9an@googlegroups.com> <u2v76j$1lho2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <51f07643-b928-42c9-a6f3-71577e4629d3n@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Thu, 04 May 2023 12:24:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1647
 by: S Jack - Thu, 4 May 2023 12:24 UTC

On Wednesday, May 3, 2023 at 10:03:30 PM UTC-5, dxforth wrote:
> On 4/05/2023 10:30 am, Brian Fox wrote:
> Aren't the XY coords for VT100/ANSI 1-based rather than 0-based?

Terminal escape sequences are 1-based; TPUT (Linux) is
zero-base. I went with the 1-based. No problem in Forth.
Used much in Bash scripts; just don't mix with TPUT.
--
me

Re: gnuforth ascii terminal colors

<08d71f0a-ec7b-4388-b32d-3706d2738023n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:28a:b0:3ef:b4b5:7c99 with SMTP id z10-20020a05622a028a00b003efb4b57c99mr1273170qtw.11.1683207188628;
Thu, 04 May 2023 06:33:08 -0700 (PDT)
X-Received: by 2002:a05:620a:1481:b0:74c:4349:8ceb with SMTP id
w1-20020a05620a148100b0074c43498cebmr4311488qkj.14.1683207188228; Thu, 04 May
2023 06:33:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 4 May 2023 06:33:08 -0700 (PDT)
In-Reply-To: <2023May4.101747@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=172.56.160.104; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 172.56.160.104
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
<c343ed07-afde-4af8-a4cb-d8ec4bcec6cen@googlegroups.com> <2023May4.101747@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <08d71f0a-ec7b-4388-b32d-3706d2738023n@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: gnuarm.d...@gmail.com (Lorem Ipsum)
Injection-Date: Thu, 04 May 2023 13:33:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3322
 by: Lorem Ipsum - Thu, 4 May 2023 13:33 UTC

On Thursday, May 4, 2023 at 4:21:32 AM UTC-4, Anton Ertl wrote:
> Lorem Ipsum <gnuarm.del...@gmail.com> writes:
> >On Wednesday, May 3, 2023 at 2:48:33=E2=80=AFPM UTC-4, gobli...@gmail.com w=
> >rote:
> >> decimal=20
> >> 27 constant ESC \ to manage escape sequences used as colorations=20
> >> : COLORIZE ESC EMIT ." [" base @ >R 0 <# #S #> type R> base ! ." m" ; \ A=
> ...
> >Maybe I'm missing something, or don't understand BASE. I thought it is the=
> > address where the number conversion base is stored. You save it on the re=
> >turn stack, then restore it after printing the number, but I don't see wher=
> >e you change it. So why save and restore if you are not going to change it=
> >?=20
>
> Yes, the BASE saving and restoring is unnecessary here.

I think "unnecessary" is an understatement.

> >Also, at the very beginning, you change the value stored at BASE to 10 with=
> > the word decimal. Is that intentional? the word decimal is not going to =
> >have any impact if BASE is changed elsewhere in the code, before colorize i=
> >s called.=20
> >
> >What am I missing?=20
>
> DECIMAL ensures that the "27" is converted using decimal base.
>
> An alternative (Forth-2012) way to ensure this is to write
>
> #27 constant ESC
>
> instead.

I guess my concern was that the person writing the code thought the use of decimal would have impact on the words defined at run time. Correct me if I'm wrong, but the numeric conversion used, does depend on the value in BASE, no? But that value could be anything at run time. This is why BASE is saved and restored, no? Or am I missing something about numeric conversion?

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209

Re: gnuforth ascii terminal colors

<bc42d89b-3624-4ef6-9b1b-8fafb2526320n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:55e8:0:b0:61a:83a4:661c with SMTP id bu8-20020ad455e8000000b0061a83a4661cmr2129576qvb.10.1683208946985;
Thu, 04 May 2023 07:02:26 -0700 (PDT)
X-Received: by 2002:a05:622a:199c:b0:3de:bafb:82bf with SMTP id
u28-20020a05622a199c00b003debafb82bfmr1191519qtc.4.1683208946686; Thu, 04 May
2023 07:02:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 4 May 2023 07:02:26 -0700 (PDT)
In-Reply-To: <u2v76j$1lho2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=104.245.145.10; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 104.245.145.10
References: <7cf7bfb9-91d4-4778-b452-f2fe06e6a092n@googlegroups.com>
<c5669003-b14e-497d-a141-009038788a9an@googlegroups.com> <u2v76j$1lho2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bc42d89b-3624-4ef6-9b1b-8fafb2526320n@googlegroups.com>
Subject: Re: gnuforth ascii terminal colors
From: brian....@brianfox.ca (Brian Fox)
Injection-Date: Thu, 04 May 2023 14:02:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1820
 by: Brian Fox - Thu, 4 May 2023 14:02 UTC

On Wednesday, May 3, 2023 at 11:03:30 PM UTC-4, dxforth wrote:

> Aren't the XY coords for VT100/ANSI 1-based rather than 0-based?

You have caught my amateur work again Ed. Thanks.
(Can you tell nobody else uses my system?) :-)

I failed to update the repository with current files.

https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100.FTH
https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100%2B.FTH
https://github.com/bfox9900/CAMEL99-ITC/blob/master/LIB.ITC/VT100COLOR.FTH

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor