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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29514 invoked from network); 19 Feb 2022 16:06:17 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 19 Feb 2022 16:06:17 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 67B1E9C714; Sun, 20 Feb 2022 02:06:15 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id CAE709BA40; Sun, 20 Feb 2022 02:04:56 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (1024-bit key; unprotected) header.d=ccc.com header.i=@ccc.com header.b="ImTUlUWX"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id D213F9BA32; Sun, 20 Feb 2022 02:04:55 +1000 (AEST) Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by minnie.tuhs.org (Postfix) with ESMTPS id 3E6479BA32 for ; Sun, 20 Feb 2022 02:04:55 +1000 (AEST) Received: by mail-qv1-f53.google.com with SMTP id p7so21013112qvk.11 for ; Sat, 19 Feb 2022 08:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccc.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ti6EO2Nj3EFjBFIKmyNK/Ste6j5rMOYlWvzauD1hfXQ=; b=ImTUlUWXNII1BEmqExxDV2mVThVuaAo7qHnJ9yU2xhF1UzLfHHahpsw/lfgnTG872R 4UuDEJRzcuToXRFGfVIgOcJeVCjOOyG7lvDVkLmX2J52NNxNKlTl+3iNQJn2ulKnmxxY Yz65w6fKkaB7XGXYmJ4E1yocHie6ag6Fv6SH4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ti6EO2Nj3EFjBFIKmyNK/Ste6j5rMOYlWvzauD1hfXQ=; b=ZvrmJEMcL8Wb9PWwvHPugh0JCq/5j8bt8usD6kpARMerMm9H6PqnRsv/b7So8NxsbQ 5DBAmc+aAnivCM/n5HN5grIDQNPs0RPmp/8vXVuI1aBxCKRXV3zj1l/7HXiv2V8Cf7zP DSGwiKxdHvGo3FJj1mmxuXuYQBl0tl8yb48XBu48AY/RLDHTj7OJIzwb8aTukn3EJYft Uh504H2MHAahQFzuCaE/c1sMQyYm7UsqOvtdeVHMkwjsrASk0My/yraEVunB5mcOU9AT n0lnUh3BOCz6jSlTU8xxnGHbOFSx2SCOKYFofnQSgGhYKHVxPeibgQzSYo2WhoJ4jETt 4DZg== X-Gm-Message-State: AOAM531PndY/l/fBrFl3bV8E3WvoBg+2Atl8YkytaATShoSl3sVADA9E PbbKnPEzu8wMl+qpSZrDsm8shQ/y66zFcSMeHF+iMg== X-Google-Smtp-Source: ABdhPJznOD9xHIA/1qDvCVYelsMqnVWeFqsBL1GHkP1qKV8VQ/+T99KCxwv4Mk4zmVKbKLHrl+MQUMJFOTbXdZJF6tM= X-Received: by 2002:a05:622a:170d:b0:2dc:ec7e:139c with SMTP id h13-20020a05622a170d00b002dcec7e139cmr11285995qtk.112.1645286694123; Sat, 19 Feb 2022 08:04:54 -0800 (PST) MIME-Version: 1.0 References: <69d88b37-5817-9a0d-4971-3d8641c2d153@gmail.com> In-Reply-To: <69d88b37-5817-9a0d-4971-3d8641c2d153@gmail.com> From: Clem Cole Date: Sat, 19 Feb 2022 11:04:28 -0500 Message-ID: To: Will Senn Content-Type: multipart/alternative; boundary="000000000000f5107b05d86128c4" Subject: Re: [TUHS] v7 source code for sh X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000f5107b05d86128c4 Content-Type: text/plain; charset="UTF-8" Sure - this is lovingly referred to as 'Bourne-gol.' Steve Bourne was part of the Algol-68 development team at Cambridge before he came to BTL. Besides his being the 'editor' / 'release manager' of V7 (as Dennis is said to exclaimed 'never again' after V6), please also look at the sources to adb, srb's other major contribution (it is also written using his same macros). It's also why the syntax of his shell is basically Algol syntax. Clem On Sat, Feb 19, 2022 at 10:44 AM Will Senn wrote: > I have been poring through the v7 source code lately, and came across an > oddity I would like to know more about. Specifically, in sh. The code for > sh is c, but it makes *extensive* use of of macros, for example: > > /usr/src/cmd/sh/word.c > ... > WHILE (c=nextc(0), space(c)) DONE > ... > > The macros for sh are defined in mac.h: > > /usr/src/cmd/sh/mac.h > ... > #define BEGIN { > #define END } > #define SWITCH switch( > #define IN ){ > #define ENDSW } > #define FOR for( > #define WHILE while( > #define DO ){ > #define OD ;} > #define REP do{ > #define PER }while( > #define DONE ); > ... > > I can read the resultant code through the lens of my experience coding c, > but I'm curious why the macros and how this came about? In v6, the sh > source is straight up c. Is there a story behind it worth knowing? > > Thanks, > > Will > --000000000000f5107b05d86128c4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sure - this is lovingly=C2=A0referred=C2=A0to=C2=A0as &= #39;Bourne-gol.' =C2=A0Steve Bourne was part of the Algol-68 developmen= t team at Cambridge before he came to BTL. =C2=A0 Besides his being the = 9;editor' / 'release manager' of V7 (as Dennis is said to excla= imed 'never again' after V6), please also look at the sources=C2=A0= to adb, srb's other major contribution (it is also written using his sa= me macros).=C2=A0 It's also why the syntax of his shell is basically Al= gol syntax.

Clem

--000000000000f5107b05d86128c4--