[TUHS] wump.c for v6

Noel Chiappa jnc at mercury.lcs.mit.edu
Sat Jan 11 00:27:40 AEST 2020


    > From: Clem Cole <clemc at ccc.com>

    > So, unless anyone else can illuminate, I'm not sure where the first cpp
    > that some of us using v6 had originated.

I recall a prior extensive discussion about 'cpp'. I looked, and found it
(March 30, 2017) but it was a private discussion, not on TUHS (although you
were part of it :-). Here are clips of what I wrote (I don't want to re-post
what others wrote) from what I wrote, which tell most of the story:


There were a series of changes to C before V7 came out, resulting in the
so-called 'phototypsetter C compiler' (previously discussed on TUHS), and they
included the preprocessor. There's that series of short notes describing
changes to C (and the compiler), and they include mention of the preprocessor.

[Available here: http://gunkies.org/wiki/Typesetter_C for those who want to see
them.]

The MIT 'V6' Unix (which was, AFAICT, an augmented version of an early version
of PWB Unix) had that C compiler; and if you look at the PWB1 tree online, it
does have the C with 'cpp':

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/c/c

I did a diff of that 'cpp' with the MIT one, and they are basically identical.

----

I went looking for the C manual in the V6 distro, to see if it mentioned the
pre-processor. And it does:

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/doc/c/c5

(Section 12, "Compiler control lines", about half way down.) So, I'm like,
'WTF? I just looked at cc.c and no mention of cpp!'

So I looked a little harder, and if you look at the cc.c in the distro (URL
above), you see this:

	insym(&defloc, "define");
	insym(&incloc, "include");
	insym(&eifloc, "endif");
	insym(&ifdloc, "ifdef");
	insym(&ifnloc, "ifndef");
	insym(&unxloc, "unix");

The pre-processor is integrated into 'cc' in the initial V6. So we do have a very
early version of it, after all...

----

So, 'cc' in V5 also included pre-processor support (just #define and #include,
though):

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/cc.c

Although we don't have the source to 'cc' to show it, V4 also appears to have
had it, per the man page:

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man1/cc.1

"If the -p flag is used, only the macro prepass is run on all files whose name
ends in .c"; and the V4 system source:

  http://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/nsys

also has .h files.

No sign of it in the man page for cc.1 in V3, though.


This all makes sense. .h files aren't any use with[out] #include, and without
#include, you have to have the structure definition, etc in multiple source
files. So #include would have gotten added very early on.

In V3, the system was apparently still in assembler, so no need.

-----


Also, there's an error in:

    https://ewe2.ninja/computers/cno/

when it says "V6 was a very different beast for programming to V7. No c
preprocessor. The practical upshot of this is no #includes." that's
clearly incorrect (see above). Also, if you look at Lions (which is pure
early V6), in the source section, all the .c files have #include's.

      Noel


More information about the TUHS mailing list