Re: bye with exit status

Liste des GroupesRevenir à cl forth 
Sujet : Re: bye with exit status
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forth
Date : 07. Nov 2024, 12:56:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vgi9tn$2kmb0$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 2024-11-06 22:27, mhx wrote:
iForth:
 T: BYE  ( -- ) 0 TERMINATE T; ANS
 TERMINATE                                              IFORTH
     ( n -- )
     Disconnect the server from the processor. Remove the server
     program on the host computer and let the server return the
     implementation defined error code n to the operating system.
     See also: BYE
 : TERMINATE
     ??CR [ =FILES ] [IF] FLUSH BLOCK-FID @ ?DUP
                          IF CLOSE-FILE DROP 0 BLOCK-FID ! THEN
                   [THEN]
     BYE! T;  ( error-level -- )
 BYE!                                                 IFORTH
     ( -- )
     Send the 'disconnect server' command over the boot link to the
     server (if there is one). The server disconnects upon receiving
     this message and exits itself. All knowledge about open files
     is lost. If there is no server this command is the same as BYE .
     See also: BYE
 

Same as remarked by minforth: there is a exit-handler chain in
which the user can plug arbitrary routines.
 The chained handlers were very popular with Hanno Schwalm because
he loved generating executables. I don't use them myself because
iForth is the default shell for my main activities.
It's common thing in mature Forth systems.
For example, in SP-Forth/4 the following chains are used:
   AT-PROCESS-STARTING
   AT-PROCESS-FINISHING
   AT-THREAD-STARTING
   AT-THREAD-FINISHING
They are implemented using the "Scattering a Colon Definition" technique [1].
When a chain of actions is used, any additional actions or output messages on termination (if any) are controlled by the user/program.
I meant that `bye-status` shall not show any messages by itself.
I would like to find a more appropriate name for this word than "bye-status".
I think the name "bye-code" is worse than "bye-status" because the term "code" has many meanings and is used with another meaning in the names like `CODE` and `;CODE`.
`terminate` is a good candidate, but it's unclear what it should terminate — a thread/task, or a process, or the own process, or the own thread.
In SP-Forth/4  `TERMINATE` terminates the thread of the caller.
[1] <https://rawcdn.githack.com/rufig/spf4-utf8/master/devel/~mlg/ScatColn/ScatteredColonDef.html>
--
Ruvim

Date Sujet#  Auteur
6 Nov 24 * bye with exit status19Ruvim
6 Nov 24 +- Re: bye with exit status1albert
6 Nov 24 `* Re: bye with exit status17Anthony Howe
6 Nov 24  `* Re: bye with exit status16minforth
6 Nov 24   `* Re: bye with exit status15mhx
7 Nov 24    +* Re: bye with exit status10Ruvim
7 Nov 24    i`* Re: bye with exit status9Anthony Howe
7 Nov 24    i +* Re: bye with exit status5Ruvim
8 Nov 24    i i+- Re: bye with exit status1mhx
8 Nov 24    i i`* Re: bye with exit status3Anthony Howe
8 Nov 24    i i `* Re: bye with exit status2Ruvim
8 Nov 24    i i  `- Re: bye with exit status1Anthony Howe
8 Nov 24    i +- Re: bye with exit status1Ron AARON
8 Nov 24    i `* Re: bye with exit status2albert
8 Nov 24    i  `- Re: bye with exit status1minforth
8 Nov 24    `* Re: bye with exit status4Anton Ertl
8 Nov 24     `* Re: bye with exit status3Ruvim
8 Nov 24      `* Re: bye with exit status2Anton Ertl
8 Nov 24       `- Re: bye with exit status1Ruvim

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal