Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.forth > #133559

Re: THROW codes and ambiguous conditions

Newsgroups comp.lang.forth
References <f827ba6fc80427f3ce0317835bd8ae47a4445e07@i2pn2.org> <2025May31.080248@mips.complang.tuwien.ac.at> <nnd$65b3b146$477283fb@00316544219466ac> <2025May31.180736@mips.complang.tuwien.ac.at>
From albert@spenarnc.xs4all.nl
Subject Re: THROW codes and ambiguous conditions
Message-ID <nnd$5c501e87$383f11cb@a5c2a2bcc067e6c0> (permalink)
Organization KPN B.V.
Date 2025-06-01 12:47 +0200

Show all headers | View raw


In article <2025May31.180736@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>albert@spenarnc.xs4all.nl writes:
>>In article <2025May31.080248@mips.complang.tuwien.ac.at>,
>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>xxxxxxxx.fs /tmp/x.fs
>>>  -514        -525    Gforth
>>>   -37         -37    iforth 5.1-mini
>>>  -261        -261    lxf 1.7-172-983
>>>  -199        -199    SwiftForth i386-Linux 3.11.0
>>>   -69         -69    SwiftForth x64-Linux 4.0.0-RC89
>>>  -258        -258    VFX Forth 64 5.43
>>
>>    -2         -13     ciforth on (whatever) linux
>>
>>    -13 MESSAGE
>>    : Permission denied
>>    OK
>>    -2 MESSAGE
>>    : No such file or directory
>>    OK
>>
>>Am I the only to use the Unix error codes?
>
>You seem to be the only one who remaps them by just negating them.
>This remaps them right into the range of throw codes that are
>preassigned by the Forth standard in table 9.1.
>

Actually, the error returns from system calls are negative
numbers. So I do approximately:
    ( open file )  DUP 0 MIN THROW \ Now the result is a file channel id.
So I was puzzled at the term remapping. Indeed the man 3 errno
reveals that positive numbers are intended.

>If you look at the results above, you will find that Gforth remaps
>errno into the ior -512-errno (e.g., -514 for "No such file or
>directory, and -525 for "permission denied"), and INCLUDED THROWs that
>ior.

I could add -512 to them. ciforth has as one of its names
"close to ISO" Forth. This discussion proves that adhering to
the exact throw cause is of dubious value.
One of my design goals was simplicity and usability at the expense of
speed and traditional expectations. This was one of the corners cut
off. The positive errors are not compliant anyway.
E.g. gforth error number 13 (not-found compliant) is split into error 10
(malformed number) and 12 (not found in the search order).

>
>For Unix signals, if Gforth does not translate them to one of the
>predefined throw codes or handles the signal in some other way (e.g.,
>SIGWINCH just changes what FORM returns, and is otherwise
>transparent), it throws -256-sig.

gforth is a politically correct implementation. That is much
appreciated. It takes a team to maintain that and study the
standard extensively. That niche has been filled, so if that
was my priority I'd join the gforth team.

ciforth has no gratituous deviations from the standard
(by my arbitration), but it violates traditional expectations.

>
>- anton

Groetjes Albert
-- 
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-05-31 11:10 +1000
  Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-05-31 06:02 +0000
    Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-05-31 20:53 +1000
      Re: THROW codes and ambiguous conditions sjack@dontemail.me (sjack) - 2025-06-03 20:48 +0000
    Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-05-31 13:53 +0200
      Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-05-31 16:07 +0000
        Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-01 12:47 +0200
          Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-06-01 15:15 +0000
            Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-01 19:35 +0200
  Re: THROW codes and ambiguous conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2025-06-01 19:44 +0200
    Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-02 14:58 +1000
    Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-02 12:44 +0200
      Re: THROW codes and ambiguous conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2025-06-02 21:20 +0200
        Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-03 13:23 +1000
          Re: THROW codes and ambiguous conditions mhx@iae.nl (mhx) - 2025-06-03 06:04 +0000
            Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-04 12:03 +1000
              Re: THROW codes and ambiguous conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2025-06-06 12:47 +0200
          Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-06-03 06:10 +0000
            Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-05 00:44 +1000
              Re: THROW codes and ambiguous conditions sean@conman.org - 2025-06-04 19:25 +0000
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-05 16:09 +1000
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-05 12:17 +0200
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-06 10:47 +1000
                Re: THROW codes and ambiguous conditions sean@conman.org - 2025-06-06 06:15 +0000
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-06 13:00 +0200
                Re: THROW codes and ambiguous conditions sean@conman.org - 2025-06-06 21:06 +0000
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-07 13:10 +1000
                Re: THROW codes and ambiguous conditions sean@conman.org - 2025-06-07 04:26 +0000
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-07 14:42 +1000
                Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-06-07 09:43 +0000
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-08 00:06 +1000
                Re: THROW codes and ambiguous conditions Paul Rubin <no.email@nospam.invalid> - 2025-06-07 12:58 -0700
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-08 01:31 +0200
                Re: THROW codes and ambiguous conditions Paul Rubin <no.email@nospam.invalid> - 2025-06-07 18:49 -0700
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-08 13:36 +1000
                Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-06-08 08:07 +0000
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-08 13:34 +0200
                Re: THROW codes and ambiguous conditions Paul Rubin <no.email@nospam.invalid> - 2025-06-10 14:11 -0700
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-08 12:16 +1000
                Re: THROW codes and ambiguous conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-06-08 07:56 +0000
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-08 13:51 +0200
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-09 00:45 +1000
                Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-09 12:49 +0200
                Re: THROW codes and ambiguous conditions dxf <dxforth@gmail.com> - 2025-06-09 21:36 +1000
                Re: THROW codes and ambiguous conditions zbigniew2011@gmail.com (LIT) - 2025-06-09 12:24 +0000
                Re: THROW codes and ambiguous conditions zbigniew2011@gmail.com (LIT) - 2025-06-07 14:41 +0000
              Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-05 12:12 +0200
          Re: THROW codes and ambiguous conditions John <john@somewhere> - 2025-06-03 03:43 -0500
        Re: THROW codes and ambiguous conditions albert@spenarnc.xs4all.nl - 2025-06-03 12:30 +0200
          Re: THROW codes and ambiguous conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2025-06-03 15:10 +0200

csiph-web