Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Truth has always been found to promote the best interests of mankind... -- Percy Bysshe Shelley


devel / comp.lang.forth / how to trap ctrl+c key ?

SubjectAuthor
* how to trap ctrl+c key ?gobli...@gmail.com
+* Re: how to trap ctrl+c key ?none
|+* Re: how to trap ctrl+c key ?Brian Fox
||+- Re: how to trap ctrl+c key ?dxforth
||+* Re: how to trap ctrl+c key ?gobli...@gmail.com
|||+- Re: how to trap ctrl+c key ?gobli...@gmail.com
|||+* Re: how to trap ctrl+c key ?Brian Fox
||||`- Re: how to trap ctrl+c key ?Anton Ertl
|||`* Re: how to trap ctrl+c key ?Anton Ertl
||| `- Re: how to trap ctrl+c key ?none
||`* Re: how to trap ctrl+c key ?none
|| `* Re: how to trap ctrl+c key ?minforth
||  +* Re: how to trap ctrl+c key ?dxforth
||  |`* Re: how to trap ctrl+c key ?Anton Ertl
||  | `* Re: how to trap ctrl+c key ?dxforth
||  |  `* Re: how to trap ctrl+c key ?none
||  |   `* Re: how to trap ctrl+c key ?dxforth
||  |    `* Re: how to trap ctrl+c key ?none
||  |     `* Re: how to trap ctrl+c key ?dxforth
||  |      `* Re: how to trap ctrl+c key ?David Schultz
||  |       `- Re: how to trap ctrl+c key ?dxforth
||  `- Re: how to trap ctrl+c key ?S Jack
|`* Re: how to trap ctrl+c key ?gobli...@gmail.com
| `- Re: how to trap ctrl+c key ?Anton Ertl
+- Re: how to trap ctrl+c key ?Krishna Myneni
`- Re: how to trap ctrl+c key ?none

Pages:12
how to trap ctrl+c key ?

<08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24285&group=comp.lang.forth#24285

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:48c:b0:762:1e66:3920 with SMTP id 12-20020a05620a048c00b007621e663920mr27664qkr.11.1692199791109;
Wed, 16 Aug 2023 08:29:51 -0700 (PDT)
X-Received: by 2002:a63:5b1f:0:b0:564:4a9e:1b80 with SMTP id
p31-20020a635b1f000000b005644a9e1b80mr1001291pgb.6.1692199790756; Wed, 16 Aug
2023 08:29:50 -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!peer03.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, 16 Aug 2023 08:29:50 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
Subject: how to trap ctrl+c key ?
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Wed, 16 Aug 2023 15:29:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1494
 by: gobli...@gmail.com - Wed, 16 Aug 2023 15:29 UTC

hello

how could I trap ctrl+c key to call a word ?
just like

: test
\ some stuff
key
case
81 of dosomething endof
ctrlc of callaword endof
\etc...
;

without breaking forth interpretor execution but really using it as a key or input flow

currently whatever I tryied yet continues to use ctrl-c as BREAK signal...

Re: how to trap ctrl+c key ?

<nnd$1060c0f4$254f0f14@1a919eee9872ce30>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24286&group=comp.lang.forth#24286

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$1060c0f4$254f0f14@1a919eee9872ce30>
Organization: KPN B.V.
Date: Wed, 16 Aug 2023 20:17:01 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 29
Injection-Date: Wed, 16 Aug 2023 20:17:01 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1584
 by: none - Wed, 16 Aug 2023 18:17 UTC

In article <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>,
gobli...@gmail.com <goblinrieur@gmail.com> wrote:
>hello
>
>how could I trap ctrl+c key to call a word ?
>just like
>
>: test
>\ some stuff
>key
>case
>81 of dosomething endof
>ctrlc of callaword endof
>\etc...
>;
>
>without breaking forth interpretor execution but really using it as a
>key or input flow
>
>currently whatever I tryied yet continues to use ctrl-c as BREAK signal...
>
It is unbelievable that some one posts this kind of question without
mentioning the compiler or operating system.
--
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: how to trap ctrl+c key ?

<f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24287&group=comp.lang.forth#24287

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:8ce:b0:641:8969:a279 with SMTP id da14-20020a05621408ce00b006418969a279mr29918qvb.9.1692213731977;
Wed, 16 Aug 2023 12:22:11 -0700 (PDT)
X-Received: by 2002:a63:3644:0:b0:566:128:80aa with SMTP id
d65-20020a633644000000b00566012880aamr472442pga.7.1692213731531; Wed, 16 Aug
2023 12:22:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.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, 16 Aug 2023 12:22:11 -0700 (PDT)
In-Reply-To: <nnd$1060c0f4$254f0f14@1a919eee9872ce30>
Injection-Info: google-groups.googlegroups.com; posting-host=162.253.129.227; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 162.253.129.227
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: brian.fox@brianfox.ca (Brian Fox)
Injection-Date: Wed, 16 Aug 2023 19:22:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1541
 by: Brian Fox - Wed, 16 Aug 2023 19:22 UTC

On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:

> It is unbelievable that some one posts this kind of question without
> mentioning the compiler or operating system.

I get the sense that younger people think of GForth like they think of GCC.
ie: GForth "is" Forth. What else would you use bro'? :-)

Re: how to trap ctrl+c key ?

<3a1d8ac8-ced8-4ebe-beec-312ef9e5e77fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24288&group=comp.lang.forth#24288

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a7b:c3d7:0:b0:3fb:4100:fdf3 with SMTP id t23-20020a7bc3d7000000b003fb4100fdf3mr29575wmj.2.1692246427144;
Wed, 16 Aug 2023 21:27:07 -0700 (PDT)
X-Received: by 2002:a17:902:e743:b0:1b8:a555:3865 with SMTP id
p3-20020a170902e74300b001b8a5553865mr1400470plf.6.1692246426250; Wed, 16 Aug
2023 21:27:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 16 Aug 2023 21:27:05 -0700 (PDT)
In-Reply-To: <nnd$1060c0f4$254f0f14@1a919eee9872ce30>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a1d8ac8-ced8-4ebe-beec-312ef9e5e77fn@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Thu, 17 Aug 2023 04:27:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: gobli...@gmail.com - Thu, 17 Aug 2023 04:27 UTC

Le mercredi 16 août 2023 à 20:17:05 UTC+2, none albert a écrit :
> In article <08895bfe-78fe-486c...@googlegroups.com>,
> gobli...@gmail.com <gobli...@gmail.com> wrote:
> >hello
> >
> >how could I trap ctrl+c key to call a word ?
> >just like
> >
> >: test
> >\ some stuff
> >key
> >case
> >81 of dosomething endof
> >ctrlc of callaword endof
> >\etc...
> >;
> >
> >without breaking forth interpretor execution but really using it as a
> >key or input flow
> >
> >currently whatever I tryied yet continues to use ctrl-c as BREAK signal....
> >
> It is unbelievable that some one posts this kind of question without
> mentioning the compiler or operating system.
> --
> 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 -

this was general purpose question, not specific to one or one other forth interpretor for any operating system ! so of course I could'nt mention a system in the question

Re: how to trap ctrl+c key ?

<ubk7kd$3l77k$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24289&group=comp.lang.forth#24289

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Thu, 17 Aug 2023 14:27:56 +1000
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ubk7kd$3l77k$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30>
<f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 17 Aug 2023 04:27:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d365c6cde78885b3995bad3bca8cc9f";
logging-data="3841268"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4N1evdAlOhPT6ENekKsVP"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:nDDL+u1Bz4vJ0rj1XwhcdG6g/6Y=
Content-Language: en-GB
In-Reply-To: <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
 by: dxforth - Thu, 17 Aug 2023 04:27 UTC

On 17/08/2023 5:22 am, Brian Fox wrote:
> On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
>
>> It is unbelievable that some one posts this kind of question without
>> mentioning the compiler or operating system.
>
> I get the sense that younger people think of GForth like they think of GCC.
> ie: GForth "is" Forth. What else would you use bro'? :-)

"Computer says no"

Re: how to trap ctrl+c key ?

<79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24290&group=comp.lang.forth#24290

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a7b:c049:0:b0:3fe:1166:e32b with SMTP id u9-20020a7bc049000000b003fe1166e32bmr40159wmc.3.1692246598443;
Wed, 16 Aug 2023 21:29:58 -0700 (PDT)
X-Received: by 2002:a17:902:eccc:b0:1bc:2547:b17c with SMTP id
a12-20020a170902eccc00b001bc2547b17cmr1752419plh.1.1692246598111; Wed, 16 Aug
2023 21:29:58 -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, 16 Aug 2023 21:29:57 -0700 (PDT)
In-Reply-To: <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Thu, 17 Aug 2023 04:29:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 26
 by: gobli...@gmail.com - Thu, 17 Aug 2023 04:29 UTC

Le mercredi 16 août 2023 à 21:22:13 UTC+2, Brian Fox a écrit :
> On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
>
> > It is unbelievable that some one posts this kind of question without
> > mentioning the compiler or operating system.
> I get the sense that younger people think of GForth like they think of GCC.
> ie: GForth "is" Forth. What else would you use bro'? :-)

Hello,

On other forum someone give a clue, specific to gforth but might be usable/adaptable to other forth interpretors.

Redefining the "key" word as :

-28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
: key ( -- x ) \ redefine key to manage trap on CTRL+C
['] key catch dup key-ctrl-c-ior = if exit then throw
;

and this does the job.

Re: how to trap ctrl+c key ?

<31d5105c-4036-42df-98d6-4227cc49dfe8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24291&group=comp.lang.forth#24291

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:943:b0:649:9ae9:2924 with SMTP id dn3-20020a056214094300b006499ae92924mr17806qvb.11.1692246866475;
Wed, 16 Aug 2023 21:34:26 -0700 (PDT)
X-Received: by 2002:a17:90a:c906:b0:262:ffae:56cf with SMTP id
v6-20020a17090ac90600b00262ffae56cfmr754685pjt.8.1692246866013; Wed, 16 Aug
2023 21:34:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!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, 16 Aug 2023 21:34:25 -0700 (PDT)
In-Reply-To: <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb;
posting-account=3HjpJwoAAACwXD1UyRZwC1Lkp4Lq1jcg
NNTP-Posting-Host: 2a01:e0a:118:ea0:7e:3b3e:47f5:d1eb
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
<79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <31d5105c-4036-42df-98d6-4227cc49dfe8n@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: goblinrieur@gmail.com (gobli...@gmail.com)
Injection-Date: Thu, 17 Aug 2023 04:34:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 36
 by: gobli...@gmail.com - Thu, 17 Aug 2023 04:34 UTC

Le jeudi 17 août 2023 à 06:30:01 UTC+2, gobli...@gmail.com a écrit :
> Le mercredi 16 août 2023 à 21:22:13 UTC+2, Brian Fox a écrit :
> > On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
> >
> > > It is unbelievable that some one posts this kind of question without
> > > mentioning the compiler or operating system.
> > I get the sense that younger people think of GForth like they think of GCC.
> > ie: GForth "is" Forth. What else would you use bro'? :-)
> Hello,
>
> On other forum someone give a clue, specific to gforth but might be usable/adaptable to other forth interpretors.
>
> Redefining the "key" word as :
>
> -28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
> : key ( -- x ) \ redefine key to manage trap on CTRL+C
> ['] key catch dup key-ctrl-c-ior = if exit then throw
> ;
>
> and this does the job.

the same idea can be used to call a special action with
: main
['] main catch
case ( ior )
\ ....
key-ctrl-c-ior of dostuff 0 (bye) endof
\ ...
endcase
;

Re: how to trap ctrl+c key ?

<2023Aug17.093527@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24292&group=comp.lang.forth#24292

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Thu, 17 Aug 2023 07:35:27 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 31
Message-ID: <2023Aug17.093527@mips.complang.tuwien.ac.at>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <3a1d8ac8-ced8-4ebe-beec-312ef9e5e77fn@googlegroups.com>
Injection-Info: dont-email.me; posting-host="375392cab78ae53127f103eb12c2991a";
logging-data="3897630"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FRNMWymScci9UnyZpDOWV"
Cancel-Lock: sha1:i4krvbgQGfOIp+v7krzZFPOhtUE=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 17 Aug 2023 07:35 UTC

"gobli...@gmail.com" <goblinrieur@gmail.com> writes:
>this was general purpose question, not specific to one or one other forth i=
>nterpretor for any operating system ! so of course I could'nt mention a sy=
>stem in the question

But it depends on the operating system.

In particular, I can tell you how to do it on Unix. On Unix, the
terminal handler by default catches the Ctrl-C coming from the
terminal and does not pass it as a key press to the application (e.g.,
a Forth system), but instead sends a SIGINT signal. So the way to do
what you want is to change this behaviour of the terminal handler.
E.g., you can change the terminal handler to use Ctrl-_ instead of
Ctrl-C for sending SIGINT with

stty intr '^_'

before starting the Forth system. I have done this and then tried

key .

in a number of Forth systems (Gforth, sf64, vfx64, iforth, lxf), and
pressed Ctrl-C when key waited for input. All these systems then
printed "3".

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

Re: how to trap ctrl+c key ?

<nnd$5bdb29e0$4d2e6789@929445885b591507>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24293&group=comp.lang.forth#24293

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$5bdb29e0$4d2e6789@929445885b591507>
Organization: KPN B.V.
Date: Thu, 17 Aug 2023 12:08:03 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!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!abe005.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 25
Injection-Date: Thu, 17 Aug 2023 12:08:03 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1838
 by: none - Thu, 17 Aug 2023 10:08 UTC

In article <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>,
Brian Fox <brian.fox@brianfox.ca> wrote:
>On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
>
>> It is unbelievable that some one posts this kind of question without
>> mentioning the compiler or operating system.
>
>I get the sense that younger people think of GForth like they think of GCC.
>ie: GForth "is" Forth. What else would you use bro'? :-)

Even if we assume that GForth is so universal,
that doesn't cut it.
The answer is dependant on Gforth under MS-windows,
probably on versions, 0.7.3 and the latest, gforth fast etc.

Only if the team spent considerable effort to make this portable,
is there an answer.

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: how to trap ctrl+c key ?

<9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24294&group=comp.lang.forth#24294

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1350:b0:403:e8cd:284c with SMTP id w16-20020a05622a135000b00403e8cd284cmr40967qtk.12.1692273855020; Thu, 17 Aug 2023 05:04:15 -0700 (PDT)
X-Received: by 2002:a63:3e4c:0:b0:565:564f:e214 with SMTP id l73-20020a633e4c000000b00565564fe214mr968266pga.2.1692273854753; Thu, 17 Aug 2023 05:04:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.11.MISMATCH!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: Thu, 17 Aug 2023 05:04:14 -0700 (PDT)
In-Reply-To: <nnd$5bdb29e0$4d2e6789@929445885b591507>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f21:9621:2ce5:67c0:105d:a9d5; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f21:9621:2ce5:67c0:105d:a9d5
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <nnd$5bdb29e0$4d2e6789@929445885b591507>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: minforth@arcor.de (minforth)
Injection-Date: Thu, 17 Aug 2023 12:04:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 22
 by: minforth - Thu, 17 Aug 2023 12:04 UTC

none albert schrieb am Donnerstag, 17. August 2023 um 12:08:08 UTC+2:
> In article <f72d3dbe-8e0a-441f...@googlegroups.com>,
> Brian Fox <bria...@brianfox.ca> wrote:
> >On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
> >
> >> It is unbelievable that some one posts this kind of question without
> >> mentioning the compiler or operating system.
> >
> >I get the sense that younger people think of GForth like they think of GCC.
> >ie: GForth "is" Forth. What else would you use bro'? :-)
> Even if we assume that GForth is so universal,
> that doesn't cut it.
> The answer is dependant on Gforth under MS-windows,
> probably on versions, 0.7.3 and the latest, gforth fast etc.

Even on Windoze you can use different terminals instead of the default
console. In addition Windows consoles have changed in the past
between different OS generations eg regarding ANSI VT support.

So there is no universal answer to the original question.

Re: how to trap ctrl+c key ?

<e0b473e7-28fc-45cd-9fdf-dcb4e45b3394n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24297&group=comp.lang.forth#24297

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5f85:0:b0:403:fe96:5779 with SMTP id j5-20020ac85f85000000b00403fe965779mr6899qta.5.1692300267969;
Thu, 17 Aug 2023 12:24:27 -0700 (PDT)
X-Received: by 2002:a05:6a00:2d15:b0:687:3110:7faa with SMTP id
fa21-20020a056a002d1500b0068731107faamr243749pfb.5.1692300267366; Thu, 17 Aug
2023 12:24:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!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, 17 Aug 2023 12:24:26 -0700 (PDT)
In-Reply-To: <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=104.254.92.242; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 104.254.92.242
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
<79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e0b473e7-28fc-45cd-9fdf-dcb4e45b3394n@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: brian.fox@brianfox.ca (Brian Fox)
Injection-Date: Thu, 17 Aug 2023 19:24:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Brian Fox - Thu, 17 Aug 2023 19:24 UTC

On Thursday, August 17, 2023 at 12:30:01 AM UTC-4, gobli...@gmail.com wrote:
> Le mercredi 16 août 2023 à 21:22:13 UTC+2, Brian Fox a écrit :
> > On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
> >
> > > It is unbelievable that some one posts this kind of question without
> > > mentioning the compiler or operating system.
> > I get the sense that younger people think of GForth like they think of GCC.
> > ie: GForth "is" Forth. What else would you use bro'? :-)
> Hello,
>
> On other forum someone give a clue, specific to gforth but might be usable/adaptable to other forth interpretors.
>
> Redefining the "key" word as :
>
> -28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
> : key ( -- x ) \ redefine key to manage trap on CTRL+C
> ['] key catch dup key-ctrl-c-ior = if exit then throw
> ;
>
> and this does the job.

Since you seem to be trying to learn more about Forth I will say
congratulations on making the leap into something that might
challenge what you think you know about computers.

As you may have read here in the other posts, for better or worse, your
code will work on GForth and only on GForth.
Something similar may exist in another Forth for the same hardware but
it might use a different name for "key-ctrl-c-ior". Or it may not have that
feature at all and you would expected to write it yourself.

It's hard for programmers who work on a desktop with an operating system
and big languages to GROK that Forth can also run on and a tiny system
with 8Kbytes of memory.
But of course such a system has made compromises to only include what is
really needed and will bear very little resemblance to a desktop Forth.

The saying by the late Neil Baud is:
"If you have seen one Forth, you have seen ONE Forth."

Enjoy your journey.

Re: how to trap ctrl+c key ?

<ubmjkv$3vhv2$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24300&group=comp.lang.forth#24300

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Fri, 18 Aug 2023 12:05:20 +1000
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <ubmjkv$3vhv2$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30>
<f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
<nnd$5bdb29e0$4d2e6789@929445885b591507>
<9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 18 Aug 2023 02:05:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8c95e3d72b2ddb5a4211ea75bbbf6201";
logging-data="4179938"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PwPGzN1pqd7Vus6vJ1ZIc"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:3Odl2/0BHrQbQvixCj4l/EipUl4=
In-Reply-To: <9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
Content-Language: en-GB
 by: dxforth - Fri, 18 Aug 2023 02:05 UTC

On 17/08/2023 10:04 pm, minforth wrote:
> none albert schrieb am Donnerstag, 17. August 2023 um 12:08:08 UTC+2:
>> In article <f72d3dbe-8e0a-441f...@googlegroups.com>,
>> Brian Fox <bria...@brianfox.ca> wrote:
>>> On Wednesday, August 16, 2023 at 2:17:05 PM UTC-4, none albert wrote:
>>>
>>>> It is unbelievable that some one posts this kind of question without
>>>> mentioning the compiler or operating system.
>>>
>>> I get the sense that younger people think of GForth like they think of GCC.
>>> ie: GForth "is" Forth. What else would you use bro'? :-)
>> Even if we assume that GForth is so universal,
>> that doesn't cut it.
>> The answer is dependant on Gforth under MS-windows,
>> probably on versions, 0.7.3 and the latest, gforth fast etc.
>
> Even on Windoze you can use different terminals instead of the default
> console. In addition Windows consoles have changed in the past
> between different OS generations eg regarding ANSI VT support.
>
> So there is no universal answer to the original question.

What he said. It's the implementer's job to sort this stuff out assuming
support for the platform. In addition to the ctrl-c issue, Gforth Win
doesn't respond to crtl-s, ctrl-q, ctrl-z. The last Win release was three
years ago. This tells me it's either low priority or no longer supported.
That's fine. It's in the conditions of use - no warranty.

Re: how to trap ctrl+c key ?

<2023Aug18.112528@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24305&group=comp.lang.forth#24305

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Fri, 18 Aug 2023 09:25:28 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 27
Message-ID: <2023Aug18.112528@mips.complang.tuwien.ac.at>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="a7c9d4ae395aed9912cda3e3d3b97471";
logging-data="222534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lTSQjmTE7OF+j84Y4lvJa"
Cancel-Lock: sha1:LIALT4uk3Ewk2wM7IkwHrKoWn5I=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 18 Aug 2023 09:25 UTC

"gobli...@gmail.com" <goblinrieur@gmail.com> writes:
> -28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
>: key ( -- x ) \ redefine key to manage trap on CTRL+C
> ['] key catch dup key-ctrl-c-ior = if exit then throw
>;

This produces -28 as result of KEY in case of a Ctrl-C. The value 3
(what you get if Ctrl-C is not converted into a signal) would be more
appropriate. I.e.:

-28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
: key ( -- x ) \ redefine key to manage trap on CTRL+C
['] key catch dup key-ctrl-c-ior = if drop 3 exit then throw ;

This works on Gforth without having to reconfigure the environment to
actually pass through the Ctrl-C as key, but testing it on sd64,
vfx64, iforth, lxf, it does not work on any other system (only iforth
converts the signal into a Forth exception, but it does not throw
-28).

- anton

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

Re: how to trap ctrl+c key ?

<2023Aug18.113508@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24306&group=comp.lang.forth#24306

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Fri, 18 Aug 2023 09:35:08 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 25
Message-ID: <2023Aug18.113508@mips.complang.tuwien.ac.at>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com> <e0b473e7-28fc-45cd-9fdf-dcb4e45b3394n@googlegroups.com>
Injection-Info: dont-email.me; posting-host="a7c9d4ae395aed9912cda3e3d3b97471";
logging-data="222534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197XZ6WxjGn6csuf3dhPzgt"
Cancel-Lock: sha1:l3H9c1lN/6Am1o93r7rh4TwGXCc=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 18 Aug 2023 09:35 UTC

Brian Fox <brian.fox@brianfox.ca> writes:
>On Thursday, August 17, 2023 at 12:30:01=E2=80=AFAM UTC-4, gobli...@gmail.c=
>om wrote:
>> -28 constant key-ctrl-c-ior \ trap control+c key code for the gforth inte=
>rpretor=20
>> : key ( -- x ) \ redefine key to manage trap on CTRL+C=20
>> ['] key catch dup key-ctrl-c-ior =3D if exit then throw=20
>> ;=20
....
>As you may have read here in the other posts, for better or worse, your
>code will work on GForth and only on GForth.=20
>Something similar may exist in another Forth for the same hardware but
>it might use a different name for "key-ctrl-c-ior".

The name does not come from Gforth, but the OP introduced it. The
exception number -28 comes from the standard ("User Interrupt"), and
all the words used above are standard words, but you are still right,
among the five systems I tested, this works only in Gforth.

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

Re: how to trap ctrl+c key ?

<nnd$6625a0fc$6b506470@b433cb852e760a19>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24309&group=comp.lang.forth#24309

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <79538566-b091-480d-b2d4-010d52646eb8n@googlegroups.com> <2023Aug18.112528@mips.complang.tuwien.ac.at>
Subject: Re: how to trap ctrl+c key ?
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$6625a0fc$6b506470@b433cb852e760a19>
Organization: KPN B.V.
Date: Fri, 18 Aug 2023 13:17:30 +0200
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!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 65
Injection-Date: Fri, 18 Aug 2023 13:17:30 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3597
 by: none - Fri, 18 Aug 2023 11:17 UTC

In article <2023Aug18.112528@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>"gobli...@gmail.com" <goblinrieur@gmail.com> writes:
>> -28 constant key-ctrl-c-ior \ trap control+c key code for the gforth
>interpretor
>>: key ( -- x ) \ redefine key to manage trap on CTRL+C
>> ['] key catch dup key-ctrl-c-ior = if exit then throw
>>;
>
>This produces -28 as result of KEY in case of a Ctrl-C. The value 3
>(what you get if Ctrl-C is not converted into a signal) would be more
>appropriate. I.e.:
>
>-28 constant key-ctrl-c-ior \ trap control+c key code for the gforth interpretor
>: key ( -- x ) \ redefine key to manage trap on CTRL+C
> ['] key catch dup key-ctrl-c-ior = if drop 3 exit then throw ;
>
>This works on Gforth without having to reconfigure the environment to
>actually pass through the Ctrl-C as key, but testing it on sd64,
>vfx64, iforth, lxf, it does not work on any other system (only iforth
>converts the signal into a Forth exception, but it does not throw
>-28).

As much as Gforth tries to shield user from unexpected things,
one must pay great attention to all control and interrupt keys.
They are named control for a reason.
For example you can trap keys that are intended to be interrupting.
But consider this case [ ubuntu/gnome/gforth 0.7.3 ]

~/PROJECT/ciforths/ciforth/LISPAOL/mal-forth/tests: gforth
Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
KEY

[ ^S / ^Q holds output temporarily on a scrolling terminal ]

Now type in ^S. KEY has received 13 allright, but nothing seems
to be happening. It becomes apparent if you type ^Q. All the
stuff you have typed shows on the screen.
If you type only ^Q you can see the 13.
If type `` .S '' 13 has disappeared. And the code for ^Q (17)
nowhere to be seen.

Even weirder is if you type in ^Q and then return.
Now you expect 17, but it is actually ... 13.

So hold on to what the standard permits, and if you must use it
be aware under what circumstances it works.

You can hang a VT100 terminal (or an emulator) off a Linux system.
You can run an editor like vim allright (if you tell him to use
VT100 for the terminal capacity database.)
But the behaviour of ^S/^Q is confined to the terminal and Linux
can not know what happened.
>
>- anton

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: how to trap ctrl+c key ?

<2023Aug18.171937@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24311&group=comp.lang.forth#24311

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Fri, 18 Aug 2023 15:19:37 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 51
Message-ID: <2023Aug18.171937@mips.complang.tuwien.ac.at>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <nnd$5bdb29e0$4d2e6789@929445885b591507> <9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com> <ubmjkv$3vhv2$1@dont-email.me>
Injection-Info: dont-email.me; posting-host="a7c9d4ae395aed9912cda3e3d3b97471";
logging-data="341663"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qhC+QvAXxTYozxryL6qlk"
Cancel-Lock: sha1:YN5Vn2idTGo9ru8ez2Hf+L6mAY0=
X-newsreader: xrn 10.11
 by: Anton Ertl - Fri, 18 Aug 2023 15:19 UTC

dxforth <dxforth@gmail.com> writes:
>In addition to the ctrl-c issue, Gforth Win
>doesn't respond to crtl-s, ctrl-q, ctrl-z.

In the following session on Unix, in the "key ." lines I pressed
Ctrl-C, Ctrl-S, CTRL-Q, and Ctrl-Z, in this order:

[~:142535] stty -a
speed 38400 baud; rows 50; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc
[~:142538] stty intr '' start '' stop '' susp ''
[~:142539] stty -a
speed 38400 baud; rows 50; columns 80; line = 0;
intr = <undef>; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>; susp = <undef>;
rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc
[~:142540] gforth
Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
key . 3 ok
key . 19 ok
key . 17 ok
key . 26 ok

If Gforth does not respond to you pressing these keys, it's because
the environment does not pass them to Gforth.

As for "Gforth Win", using Gforth is certainly a win; or did you mean
something else?

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

Re: how to trap ctrl+c key ?

<179dba5e-2e80-4bdd-a460-f2185599697an@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24314&group=comp.lang.forth#24314

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1a27:b0:40d:4c6:bce4 with SMTP id f39-20020a05622a1a2700b0040d04c6bce4mr35308qtb.11.1692377518270; Fri, 18 Aug 2023 09:51:58 -0700 (PDT)
X-Received: by 2002:a17:902:cec7:b0:1bd:b678:4bd6 with SMTP id d7-20020a170902cec700b001bdb6784bd6mr1128263plg.4.1692377518003; Fri, 18 Aug 2023 09:51:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.15.MISMATCH!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: Fri, 18 Aug 2023 09:51:57 -0700 (PDT)
In-Reply-To: <9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:b80f:87eb:7d0a:4319; posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:b80f:87eb:7d0a:4319
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <nnd$1060c0f4$254f0f14@1a919eee9872ce30> <f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com> <nnd$5bdb29e0$4d2e6789@929445885b591507> <9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <179dba5e-2e80-4bdd-a460-f2185599697an@googlegroups.com>
Subject: Re: how to trap ctrl+c key ?
From: sdwjack69@gmail.com (S Jack)
Injection-Date: Fri, 18 Aug 2023 16:51:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 9
 by: S Jack - Fri, 18 Aug 2023 16:51 UTC

On Thursday, August 17, 2023 at 7:04:16 AM UTC-5, minforth wrote:
>
> So there is no universal answer to the original question.
I had good things to say about the ATARI 800 when I
found that useful system calls were exposed as
software pointer. Replaced their pointer to their
ctl-c handler to point to ValForth warm start and
all was good.
--
me

Re: how to trap ctrl+c key ?

<ubpbgq$jjn1$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24317&group=comp.lang.forth#24317

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Sat, 19 Aug 2023 13:04:59 +1000
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <ubpbgq$jjn1$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<nnd$1060c0f4$254f0f14@1a919eee9872ce30>
<f72d3dbe-8e0a-441f-a424-1449865e968dn@googlegroups.com>
<nnd$5bdb29e0$4d2e6789@929445885b591507>
<9598aee4-c346-4b04-82fe-00a2550fa1acn@googlegroups.com>
<ubmjkv$3vhv2$1@dont-email.me> <2023Aug18.171937@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 19 Aug 2023 03:04:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c703e859e831bcd392af0f5ee652605";
logging-data="642785"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DUjtHdInuCKfdKYcLml2d"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:q212fQrv7KfVVG8qXKXxwrldTQM=
In-Reply-To: <2023Aug18.171937@mips.complang.tuwien.ac.at>
Content-Language: en-GB
 by: dxforth - Sat, 19 Aug 2023 03:04 UTC

On 19/08/2023 1:19 am, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>> In addition to the ctrl-c issue, Gforth Win
>> doesn't respond to crtl-s, ctrl-q, ctrl-z.
>
> key . 3 ok
> key . 19 ok
> key . 17 ok
> key . 26 ok
>
> If Gforth does not respond to you pressing these keys, it's because
> the environment does not pass them to Gforth.
>
> As for "Gforth Win", using Gforth is certainly a win; or did you mean
> something else?

Clearly it's a loss for Gforth application writers. If DOSBOX can
extract keystrokes from the Windows environment, so can others.

Re: how to trap ctrl+c key ?

<nnd$218e055f$1af4d598@8c6d0f3cbb65a691>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24319&group=comp.lang.forth#24319

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <ubmjkv$3vhv2$1@dont-email.me> <2023Aug18.171937@mips.complang.tuwien.ac.at> <ubpbgq$jjn1$1@dont-email.me>
Subject: Re: how to trap ctrl+c key ?
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
Organization: KPN B.V.
Date: Sat, 19 Aug 2023 10:40:41 +0200
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news-2.dfn.de!news.dfn.de!npeer.as286.net!npeer-ng0.as286.net!peer01.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: 57
Injection-Date: Sat, 19 Aug 2023 10:40:41 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3133
 by: none - Sat, 19 Aug 2023 08:40 UTC

In article <ubpbgq$jjn1$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>On 19/08/2023 1:19 am, Anton Ertl wrote:
>> dxforth <dxforth@gmail.com> writes:
>>> In addition to the ctrl-c issue, Gforth Win
>>> doesn't respond to crtl-s, ctrl-q, ctrl-z.
>>
>> key . 3 ok
>> key . 19 ok
>> key . 17 ok
>> key . 26 ok
>>
>> If Gforth does not respond to you pressing these keys, it's because
>> the environment does not pass them to Gforth.
>>
>> As for "Gforth Win", using Gforth is certainly a win; or did you mean
>> something else?
>
>Clearly it's a loss for Gforth application writers. If DOSBOX can
>extract keystrokes from the Windows environment, so can others.
>

I don't think so. DOSBOX is a fairly primitive emulator, for a
fairly primitive system. But it is an *emulator* of an *environment*.
I was impressed that a Forth editor that writes directly in the
screen memory $B000 works in DOSBOX.

gforth and lina live in a rich environent of a gui etc.
They try to play nice with the environment and that greatly enhance
the usability of the compilers. For example both compilers can be
used as filters and scripts.
I can not give expert analysis of gforth but I can give an example
for lina.
lina doesn't have a command repeater (with cursor up) and have
limited line editing (only backspace).
But if you wish you can start lina as follows:
rlwrap lina
then rlwrap adds these facilities.

You can catch traps in the 32 bit version of lina, not so in the
64 bit version, and not so in the MS-Windows version.
Each require a separate effort and until such time they are not present.
The situation may be better in gforth because they can lean on
c-libraries. The burden of portability is merely shifted. The
c-libraries use different system calls to catch traps in 32 and 64 bit
system.

As Anton Ertl has pointed out the manipulations going on before
keys arriving into Forth are extensive. Always realize that
that requires adaptation to programs.

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: how to trap ctrl+c key ?

<ubqchf$ptjj$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24321&group=comp.lang.forth#24321

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Sat, 19 Aug 2023 22:28:31 +1000
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <ubqchf$ptjj$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<ubmjkv$3vhv2$1@dont-email.me> <2023Aug18.171937@mips.complang.tuwien.ac.at>
<ubpbgq$jjn1$1@dont-email.me> <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 19 Aug 2023 12:28:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c703e859e831bcd392af0f5ee652605";
logging-data="849523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PufdtdqTNMfZVAaKx2Z+Z"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:Z0EmcXWi10oEQnh7gn/5gaCdisg=
Content-Language: en-GB
In-Reply-To: <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
 by: dxforth - Sat, 19 Aug 2023 12:28 UTC

On 19/08/2023 6:40 pm, albert wrote:
> In article <ubpbgq$jjn1$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>> On 19/08/2023 1:19 am, Anton Ertl wrote:
>>> dxforth <dxforth@gmail.com> writes:
>>>> In addition to the ctrl-c issue, Gforth Win
>>>> doesn't respond to crtl-s, ctrl-q, ctrl-z.
>>>
>>> key . 3 ok
>>> key . 19 ok
>>> key . 17 ok
>>> key . 26 ok
>>>
>>> If Gforth does not respond to you pressing these keys, it's because
>>> the environment does not pass them to Gforth.
>>>
>>> As for "Gforth Win", using Gforth is certainly a win; or did you mean
>>> something else?
>>
>> Clearly it's a loss for Gforth application writers. If DOSBOX can
>> extract keystrokes from the Windows environment, so can others.
>>
>
> I don't think so. DOSBOX is a fairly primitive emulator, for a
> fairly primitive system. But it is an *emulator* of an *environment*.
> I was impressed that a Forth editor that writes directly in the
> screen memory $B000 works in DOSBOX.
> ...
> As Anton Ertl has pointed out the manipulations going on before
> keys arriving into Forth are extensive. Always realize that
> that requires adaptation to programs.

Win32Forth, SwiftForth, NT/Forth all work with the aforementioned keys
without issue. Quality of implementation? VFX handles them with the
exception of crtl-c.

Re: how to trap ctrl+c key ?

<nnd$4ef2c032$0ee65050@20ffc6d966fe462a>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24322&group=comp.lang.forth#24322

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com> <ubpbgq$jjn1$1@dont-email.me> <nnd$218e055f$1af4d598@8c6d0f3cbb65a691> <ubqchf$ptjj$1@dont-email.me>
Subject: Re: how to trap ctrl+c key ?
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$4ef2c032$0ee65050@20ffc6d966fe462a>
Organization: KPN B.V.
Date: Sat, 19 Aug 2023 16:06:42 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 65
Injection-Date: Sat, 19 Aug 2023 16:06:42 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3590
 by: none - Sat, 19 Aug 2023 14:06 UTC

In article <ubqchf$ptjj$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>On 19/08/2023 6:40 pm, albert wrote:
>> In article <ubpbgq$jjn1$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>>> On 19/08/2023 1:19 am, Anton Ertl wrote:
>>>> dxforth <dxforth@gmail.com> writes:
>>>>> In addition to the ctrl-c issue, Gforth Win
>>>>> doesn't respond to crtl-s, ctrl-q, ctrl-z.
>>>>
>>>> key . 3 ok
>>>> key . 19 ok
>>>> key . 17 ok
>>>> key . 26 ok
>>>>
>>>> If Gforth does not respond to you pressing these keys, it's because
>>>> the environment does not pass them to Gforth.
>>>>
>>>> As for "Gforth Win", using Gforth is certainly a win; or did you mean
>>>> something else?
>>>
>>> Clearly it's a loss for Gforth application writers. If DOSBOX can
>>> extract keystrokes from the Windows environment, so can others.
>>>
>>
>> I don't think so. DOSBOX is a fairly primitive emulator, for a
>> fairly primitive system. But it is an *emulator* of an *environment*.
>> I was impressed that a Forth editor that writes directly in the
>> screen memory $B000 works in DOSBOX.
>> ...
>> As Anton Ertl has pointed out the manipulations going on before
>> keys arriving into Forth are extensive. Always realize that
>> that requires adaptation to programs.
>
>Win32Forth, SwiftForth, NT/Forth all work with the aforementioned keys
>without issue. Quality of implementation? VFX handles them with the
>exception of crtl-c.
>

What do you mean? The function of ^C is to break off the program.
The function of ^\ is to break off the program with prejudice.
The function of ^S is to hold the program's output.
The function of ^Z is to put the program in the background (in linux).

Only in the context of single key presses can you say that they work
without issue, that is it returns the number that *you* expect.
The standard recognize printable character in the range {20..7E}.
A command line ends when an "implementation-defined line terminator is
received.".
Everything outside of this range is not portable, or implementation
defined.

In wina (running under wine) the line terminator is <return> ^J and ^M.
They map onto ^M (0x13) as far as KEY is concerned.
In lina (running under linux) the line terminator is <return> ^J and ^M.
They map onto ^J (0x10) as far as KEY is concerned.

Remember wordperfect? You could type 8bit characters with a alt
<number> . Why do you expand your expectations to the ALT key?

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: how to trap ctrl+c key ?

<ubqlcb$sh5i$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24324&group=comp.lang.forth#24324

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Sun, 20 Aug 2023 00:59:22 +1000
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <ubqlcb$sh5i$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<ubpbgq$jjn1$1@dont-email.me> <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
<ubqchf$ptjj$1@dont-email.me> <nnd$4ef2c032$0ee65050@20ffc6d966fe462a>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 19 Aug 2023 14:59:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5c703e859e831bcd392af0f5ee652605";
logging-data="935090"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3DJxrt7jJaND7zLVLLCqh"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:/HtYbHIidzCsI6d6r65W+Uq3/XE=
Content-Language: en-GB
In-Reply-To: <nnd$4ef2c032$0ee65050@20ffc6d966fe462a>
 by: dxforth - Sat, 19 Aug 2023 14:59 UTC

On 20/08/2023 12:06 am, albert wrote:
> In article <ubqchf$ptjj$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>> On 19/08/2023 6:40 pm, albert wrote:
>>> In article <ubpbgq$jjn1$1@dont-email.me>, dxforth <dxforth@gmail.com> wrote:
>>>> On 19/08/2023 1:19 am, Anton Ertl wrote:
>>>>> dxforth <dxforth@gmail.com> writes:
>>>>>> In addition to the ctrl-c issue, Gforth Win
>>>>>> doesn't respond to crtl-s, ctrl-q, ctrl-z.
>>>>>
>>>>> key . 3 ok
>>>>> key . 19 ok
>>>>> key . 17 ok
>>>>> key . 26 ok
>>>>>
>>>>> If Gforth does not respond to you pressing these keys, it's because
>>>>> the environment does not pass them to Gforth.
>>>>>
>>>>> As for "Gforth Win", using Gforth is certainly a win; or did you mean
>>>>> something else?
>>>>
>>>> Clearly it's a loss for Gforth application writers. If DOSBOX can
>>>> extract keystrokes from the Windows environment, so can others.
>>>>
>>>
>>> I don't think so. DOSBOX is a fairly primitive emulator, for a
>>> fairly primitive system. But it is an *emulator* of an *environment*.
>>> I was impressed that a Forth editor that writes directly in the
>>> screen memory $B000 works in DOSBOX.
>>> ...
>>> As Anton Ertl has pointed out the manipulations going on before
>>> keys arriving into Forth are extensive. Always realize that
>>> that requires adaptation to programs.
>>
>> Win32Forth, SwiftForth, NT/Forth all work with the aforementioned keys
>> without issue. Quality of implementation? VFX handles them with the
>> exception of crtl-c.
>>
>
> What do you mean? The function of ^C is to break off the program.

The function of ^C is whatever the application determines it to be.
It would be a poor outcome if a WordStar user pressed ^C and the
program aborted.

Re: how to trap ctrl+c key ?

<XAedncS1Gdu5g3z5nZ2dnZfqn_WdnZ2d@earthlink.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24330&group=comp.lang.forth#24330

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 19 Aug 2023 19:55:16 +0000
Date: Sat, 19 Aug 2023 14:55:16 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
From: david.schultz@earthlink.net (David Schultz)
Subject: Re: how to trap ctrl+c key ?
Newsgroups: comp.lang.forth
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<ubpbgq$jjn1$1@dont-email.me> <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
<ubqchf$ptjj$1@dont-email.me> <nnd$4ef2c032$0ee65050@20ffc6d966fe462a>
<ubqlcb$sh5i$1@dont-email.me>
Content-Language: en-US
In-Reply-To: <ubqlcb$sh5i$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <XAedncS1Gdu5g3z5nZ2dnZfqn_WdnZ2d@earthlink.com>
Lines: 29
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 108.194.109.122
X-Trace: sv3-4VWUZ3DhCBsVk4nyjflDTtzeel410vJZfYv5k8eul04gYuvCuBnBegaPLussxAMJXiFewyEjdYQI7fv!3rh/TZYTdNnlw1XJMO2vRihwY0X5c1gJ56QbF95tgDsYGsoQhkgHNh4R/afbTFyQ3ykwSHdWabQw!hXeKr77Yf4o65J3aeNv22UQeQ/jFCLl6cgh9v40dnok=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: David Schultz - Sat, 19 Aug 2023 19:55 UTC

On 8/19/23 9:59 AM, dxforth wrote:
>> What do you mean? The function of ^C is to break off the program.
>
> The function of ^C is whatever the application determines it to be.
> It would be a poor outcome if a WordStar user pressed ^C and the
> program aborted.
>
Only sort of true.

Going back to CP/M days, there were two type of console I/O available.

The usual route was to use a BDOS call and in this case the I/O was
"cooked" in that various things like ^C were handled. With no
interaction with the application.

You could bypass the things that the BDOS did to the console I/O and use
a direct BIOS call. This prevented the BDOS from ever seeing the
characters. Mostly.

As I found when using CP/M-68K which is variant of CP/M-2.2, calling the
BDOS console output function will result in the BDOS checking for an
input character. Just in case the user typed XOFF. So if you want to use
a BIOS call for input to avoid BDOS processing, you also have to use the
BIOS output call.

--
http://davesrocketworks.com
David Schultz

Re: how to trap ctrl+c key ?

<ubrvjs$16tes$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24332&group=comp.lang.forth#24332

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Sun, 20 Aug 2023 13:00:12 +1000
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <ubrvjs$16tes$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
<ubpbgq$jjn1$1@dont-email.me> <nnd$218e055f$1af4d598@8c6d0f3cbb65a691>
<ubqchf$ptjj$1@dont-email.me> <nnd$4ef2c032$0ee65050@20ffc6d966fe462a>
<ubqlcb$sh5i$1@dont-email.me>
<XAedncS1Gdu5g3z5nZ2dnZfqn_WdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 20 Aug 2023 03:00:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1c23d69999e203d6847361792e6eb6c7";
logging-data="1275356"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1991Ty8vzMcgxTb8kX4RxwB"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:S/i9rGsX80vyTfb2pbCBeBgfxgk=
Content-Language: en-GB
In-Reply-To: <XAedncS1Gdu5g3z5nZ2dnZfqn_WdnZ2d@earthlink.com>
 by: dxforth - Sun, 20 Aug 2023 03:00 UTC

On 20/08/2023 5:55 am, David Schultz wrote:
> On 8/19/23 9:59 AM, dxforth wrote:
>>> What do you mean? The function of ^C is to break off the program.
>>
>> The function of ^C is whatever the application determines it to be.
>> It would be a poor outcome if a WordStar user pressed ^C and the
>> program aborted.
>>
> Only sort of true.
>
> Going back to CP/M days, there were two type of console I/O available.
>
> The usual route was to use a BDOS call and in this case the I/O was "cooked" in that various things like ^C were handled. With no interaction with the application.
>
> You could bypass the things that the BDOS did to the console I/O and use a direct BIOS call. This prevented the BDOS from ever seeing the characters. Mostly.
>

Same carried through to MS-DOS. Programmer had the choice of using cooked
I/O through INT21 or directly through INT16. In DX-Forth this is provided
through via functions DOS-IO and BIOS-IO.

> As I found when using CP/M-68K which is variant of CP/M-2.2, calling the BDOS console output function will result in the BDOS checking for an input character. Just in case the user typed XOFF. So if you want to use a BIOS call for input to avoid BDOS processing, you also have to use the BIOS output call.
>

For reasons I no longer recall DOS-IO under CP/M only redirects console output.
Input is still via BIOS. This meant intercepting ^C to exit the app.
XON XOFF presume the display is slow enough for a user to react - making them
useless on today's machines. Controlling a console listing is now left to the app.

Re: how to trap ctrl+c key ?

<uci0e8$1m32o$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24460&group=comp.lang.forth#24460

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: krishna.myneni@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: how to trap ctrl+c key ?
Date: Mon, 28 Aug 2023 06:29:10 -0500
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <uci0e8$1m32o$1@dont-email.me>
References: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 11:29:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0209b97712b0c73ca49b7b500770c0cc";
logging-data="1772632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qSIuDh7bc6IWho10oAwDX"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:bIzNKMvHmJFgaawmroVK4MJMQzg=
In-Reply-To: <08895bfe-78fe-486c-83ef-9cce636a790fn@googlegroups.com>
Content-Language: en-US
 by: Krishna Myneni - Mon, 28 Aug 2023 11:29 UTC

On 8/16/23 10:29, gobli...@gmail.com wrote:
> hello
>
> how could I trap ctrl+c key to call a word ?
> just like
>
> : test
> \ some stuff
> key
> case
> 81 of dosomething endof
> ctrlc of callaword endof
> \etc...
> ;
>
....
In kForth (32 or 64-bit versions) running under Linux, a Forth handler
to respond to the SIGINT signal, generated when Ctrl-C is pressed, may
be installed as follows

include signal.4th

\ Define a handler for SIGINT

: ctrl-c-handler ( n -- ) drop cr ." Ctrl-C pressed." cr ;

\ Install handler using non-standard, kForth word FORTH-SIGNAL

' ctrl-c-handler SIGINT forth-signal drop

\ Now, press CTRL-c to test
^C
Ctrl-C pressed.

CATCH and THROW are not used for signal handling in kForth, so Anton's
example in redefining KEY would not work for returning a key code in
kForth, but KEY could be redefined to check a flag set by the handler,
and return a key code.

--
Krishna Myneni

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor