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.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26432 invoked from network); 31 Jan 2022 20:46:44 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 31 Jan 2022 20:46:44 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 5CB809BDAE; Tue, 1 Feb 2022 06:46:42 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 793B0951B7; Tue, 1 Feb 2022 06:46:28 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MnCBGvPS"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 8ED019518E; Tue, 1 Feb 2022 06:46:26 +1000 (AEST) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by minnie.tuhs.org (Postfix) with ESMTPS id BF0FE9518E for ; Tue, 1 Feb 2022 06:46:25 +1000 (AEST) Received: by mail-ot1-f48.google.com with SMTP id l12-20020a0568302b0c00b005a4856ff4ceso6083135otv.13 for ; Mon, 31 Jan 2022 12:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:from :subject; bh=p8nYc0IWkicvxcXzDxgrfmGN9CpvHtjbin3xTP2xDfs=; b=MnCBGvPSiwsga/bPm0GAFoFVgAvqXezcUl7J2L88EwgL36DrVrkCdK+NX6epkoe8IF +Il3BgnvCEoYBsNZ7HmQAmxLc76SLkaMfSxxMcwvMXHVF/zBtWSzC6n+g6YBpgBw7OrV BgwoHl04chhdcJGOdI6+U68I2Fj5NWbV1y1xMPCv9vWBzuL644OlkuHAdFTj6QCGqxrO E6M2IywvF+Rg6QZ/pXigzn0bNyz7CIZAatmFbe40SvIzMgt5uAKrxIeJR2G7+vAybCMC kA78X6b5rSiIqFhbX73zzHez5bqFcuKCVUWKNL2/AOX9qu+cEp7LV8Id/XyO5XpTCheH UnnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject; bh=p8nYc0IWkicvxcXzDxgrfmGN9CpvHtjbin3xTP2xDfs=; b=UiaxTlk1RLr+PolW0G1wUZJBRP7+Siv3IYU7/g7MP1I9rvp8/2+vr47wfveZhIV97x urEdHOcLRVLWY7D67aksSIdc3Bs04bUb4Msxql1VKzO3NWxanNh60AlxZwCHeh5Uu3KB CkkVoMzD9jM9wbElFBHftpofNTAWlc+yhEggZol6im6UySbv1BsoSgkPU56FznbIhArr bI9RKwQcbVZ2w2j9s9Q4SU83MpgM9+JP9eux2NJf0fdS2lszbI8g7PwOcYOSZxohm7FQ q7KBLiagTpoJ6+ZTzpLUCL6e7OhZN/FCKDXFAuavrDPX3jRxNBy0nC+PyJQqpmWYwUsr B2iA== X-Gm-Message-State: AOAM533M+RBeHx5QLp0GgM+6dgSvMR6xpsYijgJwtm7dRxBt7ol2Ntql twNgJYF1wwJcG2nR4fFDEVCiV2cOWk4= X-Google-Smtp-Source: ABdhPJzoWpWDNIRa3S//lJm+CFpjiGByh3ZjA+qJ1B7V2hElEjQayeZ/VlPTR0csXtoQC24t9+SIfg== X-Received: by 2002:a9d:6c13:: with SMTP id f19mr12779298otq.87.1643661984554; Mon, 31 Jan 2022 12:46:24 -0800 (PST) Received: from [192.168.1.215] (035-134-121-000.res.spectrum.com. [35.134.121.0]) by smtp.gmail.com with ESMTPSA id d7sm12855579oia.39.2022.01.31.12.46.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 12:46:24 -0800 (PST) Content-Type: multipart/alternative; boundary="------------F0pkOhHdI7i5FkiNhS1UHiQo" Message-ID: Date: Mon, 31 Jan 2022 14:46:23 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: TUHS main list From: Will Senn Subject: [TUHS] ratfor vibe 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: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" This is a multi-part message in MIME format. --------------F0pkOhHdI7i5FkiNhS1UHiQo Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit All, I have been doing some language exploration in v7/4.3bsd and came across Software Tools (not the pascal version). It's written using ratfor, which I had seen in the v7 UPM. I fired up v7 and tried my hand at the first example: # copy - copy input characters to output         integer getc         integer c         while(getc(c) != EOF)                 call putc(c)         stop         end The first thing I noticed was that it read more like C than Fortran (I know C quite well, Fortran just a smidge)... awesome, right? So I ran the preprocessor on it and got the following f77 code: c copy - copy input characters to output       integer getc       integer c c     while 23000 if(.not.(getc(c) .ne. eof))goto 23001          call putc(c)          goto 23000 c     endwhile 23001 continue       stop       end Cool. The way it translated the EOF test is weird, but ok. Trying to compile it results in complaints about missing getc and putc: $ f77 copy.f copy.f:    MAIN: Undefined: _getc_ _putc_ _end Ah well, no worries. I know that they're in the c lib, but don't about fortran libs... Meanwhile, over on 4.3BSD, it compiles without issue. But running it is no joy: $ ./a.out This is a test $ I remembered that the authors mentioned something about EOF, so I tweaked the code (changed EOF to -1) and rebuilt/reran: $ ./a.out This is a test This is a test $ Fascinating. Dunno why no complaints from F77 about the undefined EOF (or maybe mis-defined), but hey, it works and it's fun. I'm curious how much ratfor was used in bell labs and other locations running v6, v7, and the BSD's. When I first came across it, I was under the impression that it was a wrapper to make f66 bearable, but the manpage says it's best used with f77, so that's not quite right. As someone coming from c, I totally appreciate what it does to make the control structures I know and love available, but that wasn't the case back then, was it? C was pretty new... Was it just a temporary fix to a problem that just went away, or is there tons of ratfor out there in the wild that I just haven't seen? I found ratfor77 and it runs just fine on my mac with a few tweaks, so it's not dead: ratfor77 -C copy.r | tee copy.f C Output from Public domain Ratfor, version 1.0 C copy - copy input characters to output       integer getc       integer c 23000 if(getc(c) .ne. eof)then       call putc(c)       goto 23000       endif 23001 continue       stop       end What's the story? Oh, and in v6 it looks like it was rc - ratfor compiler, which is not present in v7 or 4.3BSD - is there a backstory there, too? Will --------------F0pkOhHdI7i5FkiNhS1UHiQo Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit All,

I have been doing some language exploration in v7/4.3bsd and came across Software Tools (not the pascal version). It's written using ratfor, which I had seen in the v7 UPM. I fired up v7 and tried my hand at the first example:

# copy - copy input characters to output
        integer getc
        integer c

        while(getc(c) != EOF)
                call putc(c)
        stop
        end

The first thing I noticed was that it read more like C than Fortran (I know C quite well, Fortran just a smidge)... awesome, right? So I ran the preprocessor on it and got the following f77 code:
c copy - copy input characters to output
      integer getc
      integer c
c     while
23000 if(.not.(getc(c) .ne. eof))goto 23001
         call putc(c)
         goto 23000
c     endwhile
23001 continue
      stop
      end
Cool. The way it translated the EOF test is weird, but ok. Trying to compile it results in complaints about missing getc and putc:
$ f77 copy.f
copy.f:
   MAIN:
Undefined:
_getc_
_putc_
_end

Ah well, no worries. I know that they're in the c lib, but don't about fortran libs... Meanwhile, over on 4.3BSD, it compiles without issue. But running it is no joy:
$ ./a.out
This is a test
$

I remembered that the authors mentioned something about EOF, so I tweaked the code (changed EOF to -1) and rebuilt/reran:
$ ./a.out
This is a test
This is a test
$
Fascinating. Dunno why no complaints from F77 about the undefined EOF (or maybe mis-defined), but hey, it works and it's fun.

I'm curious how much ratfor was used in bell labs and other locations running v6, v7, and the BSD's. When I first came across it, I was under the impression that it was a wrapper to make f66 bearable, but the manpage says it's best used with f77, so that's not quite right. As someone coming from c, I totally appreciate what it does to make the control structures I know and love available, but that wasn't the case back then, was it? C was pretty new... Was it just a temporary fix to a problem that just went away, or is there tons of ratfor out there in the wild that I just haven't seen? I found ratfor77 and it runs just fine on my mac with a few tweaks, so it's not dead:

ratfor77 -C copy.r | tee copy.f
C Output from Public domain Ratfor, version 1.0
C copy - copy input characters to output
      integer getc
      integer c
23000 if(getc(c) .ne. eof)then
      call putc(c)
      goto 23000
      endif
23001 continue
      stop
      end


What's the story? Oh, and in v6 it looks like it was rc - ratfor compiler, which is not present in v7 or 4.3BSD - is there a backstory there, too?

Will




--------------F0pkOhHdI7i5FkiNhS1UHiQo--