From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,MIME_HTML_ONLY,MIME_HTML_ONLY_MULTI, MIME_QP_LONG_LINE,MPART_ALT_DIFF autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13949 invoked from network); 19 Mar 2023 16:54:12 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 19 Mar 2023 16:54:12 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id AEC7D4132A; Mon, 20 Mar 2023 02:54:07 +1000 (AEST) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by minnie.tuhs.org (Postfix) with ESMTPS id 9039C41329 for ; Mon, 20 Mar 2023 02:53:58 +1000 (AEST) Received: by mail-pj1-x102b.google.com with SMTP id e15-20020a17090ac20f00b0023d1b009f52so14103286pjt.2 for ; Sun, 19 Mar 2023 09:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20210112.gappssmtp.com; s=20210112; t=1679244837; h=to:cc:date:message-id:subject:mime-version:from :content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=8bPzLZM/TjW0YkWrrp6PkBp3iiwmbNI0O9lMxM3PZCM=; b=12szz0coGv3c7bFbgQ1rkhuDSUAdd5kreDF2jhJpLIXI3u5HGsF1MwQLZPhSpwSYd5 jKRrqhAL0QkbqfHyqQeZ1L+BBv/z933XV5nVYzoFfEYFk/ScKyc6nMmt2KBuRBQ6atyB i2bAd584hUsnoNhizTUekM4ONxX1CPntCtD0A775jJ5rDnm0KCS+4WbIVYJsQ0kftJ1G HqFMbHnaTj1yIkcGtxu5k7XntPr30TptAz06syryeNtU4KMTa8HMB2V6osL0u0FRSq6g cls6BdJil2kXFZJgtINqPwrJlKfHarCGug+s/+rsO9tvWxdEJELmaqcUBR1JcpSZI6SZ sW1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679244837; h=to:cc:date:message-id:subject:mime-version:from :content-transfer-encoding:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=8bPzLZM/TjW0YkWrrp6PkBp3iiwmbNI0O9lMxM3PZCM=; b=0qFcbzizKYSK4YicTiP1m966BF323bLq2M0F5QtfDxYBRwENwg2P3R99JpKW7BbdoM zJaNetsHDj/j421jpFEjipunok1Ye9eL0G0k9aORBcQnyYaC+oXjbIeIoVQ5JHoxyzwj i8l1G36af9UOgxokjrZ2OzRUM5TaMRD2MI0bwmDYR4VsBzrYNeRNtXEaEAxsQpt8rde2 5GDN29OIcBX7ihKVV25InjYgB5+hnpXN6vYNk2p2OXyKZLlAXjBBEY31bZ0PIwqhuvtB o6mOSKht0cPiaiaajvvKkv97OMCf0A+gQGqSwZSx+wqsuqLRmHx0Enx8eP5YYbdHG8Su 6kWQ== X-Gm-Message-State: AO0yUKXbTAFysQkpSaU4yTaV/v6c2mphzFL/c/UrmUMPk2U/aPqhxDsH L3zhUojUQXLcia0rf7RhCoXKOx7syQLCGMgLtP4= X-Google-Smtp-Source: AK7set94nGqRui+VYT0ZNvXUm3pCiPSmVOO1iu/XRN0gjjIFrp4rkcaDZT+qjX+xsTyVsMoSwtznIg== X-Received: by 2002:a05:6a21:7893:b0:c6:bd82:ea2d with SMTP id bf19-20020a056a21789300b000c6bd82ea2dmr18449895pzc.2.1679244837242; Sun, 19 Mar 2023 09:53:57 -0700 (PDT) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id h7-20020a635307000000b00502ea3898a7sm4691171pgb.31.2023.03.19.09.53.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Mar 2023 09:53:56 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-88710E4E-F9D7-49E9-801F-64385572E5FD Content-Transfer-Encoding: 7bit From: Bakul Shah Mime-Version: 1.0 (1.0) Message-Id: Date: Sun, 19 Mar 2023 09:53:45 -0700 To: srb@acm.org X-Mailer: iPad Mail (20D67) Message-ID-Hash: 3GTMCX4ZGITYTHV3AO5F6WYS7SJPT2MS X-Message-ID-Hash: 3GTMCX4ZGITYTHV3AO5F6WYS7SJPT2MS X-MailFrom: bakul@iitbombay.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tuhs@tuhs.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: GOTO etc. List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Apple-Mail-88710E4E-F9D7-49E9-801F-64385572E5FD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=EF=BB=BFThanks! Is this w= here unix setjmp/longjmp names come from? (I assume setmp in your message is= a typo?)

Algol68 Revised Report h= as this delightful example in section 5.4.4:

proc void m :=3D goto north berwick=

:-) If m is passed as an argu= ment to another function, calling m can return to within the parent f= unction of m but it may *not* be in the scope of the called function (= somewhat like unix setjmp/longjmp) though I don=E2=80=99t recall now if Algo= l68 allows passing such functions.

Could setjmp/lon= gjmp have been used to allow some register caching since register held value= s would be restored upon longjmp? But that can't be quite right since the sa= me values can be modified by code after the label. [No idea about the state o= f optimizations in those days]

On Mar 19, 2023, at 8:41 AM, Steve <srb@unixsh.com> wrote= :

=EF=BB= =BF =20 =20 =20
After some digging - in the Algol68C compiler we used the names s=
etmp and longjmp for the code generation routines to implement non local got=
o.  So
as you say they were not part of the Algol68 language. =20

Steve

From: Bakul Shah <bakul@iitbombay.org>
Subject: [TUHS] Re: GOTO etc
To: srb@acm.org

Perhaps you=E2=80=99re talking about non-local GOTOs in Algol68, where you c=
an jump from a nested procedure to a label in a lexically enclosing procedur=
e. Pascal has this too. C has no nested procedures but its setjmp/longjmp is=
 much more powerful (& dangerous). Though both can be used to the top le=
vel of a REPL or to jump to a known place after an error.

On Mar 12, 2023, at 11:24 AM, S=
teve <s=
rb@unixsh.com> wrote:

=EF=BB=BF Dennis added setjmp() and longjmp() so the shell could handle erro=
rs in a reasonable way.
There are two places where setjmp was used in the original shell (7th editio=
n) code as I recall.  Both at the top level
in main.c.

The idea came from Algol68 but I do not know where it was originally invente=
d.  longjmp() was used in the "exitsh"
function that got called on the exit command, default trap routine and a fau=
lt with no trap set.

It was also used when executing a subshell to avoid a fork and exec.  In thi=
s case the setjmp() was at top level
in the initial sh setup.

Hope this makes sense.  But these were two different uses.  One for error re=
covery and one to reset the execution environment
back to initial state.

Steve
=20
= --Apple-Mail-88710E4E-F9D7-49E9-801F-64385572E5FD--