I have a copy of a spiral-bound booklet with yellow covers called "The C
Programmer's Reference" by Morris I. Bolsky of the Systems Training
Center, AT&T Bell Laboratories, (C) 1985. A curious little snapshot of
1980s pre-ANSI C.
I posted a picture of the front cover (with table of contents) at
https://twitter.com/fanf/status/1475407500946157570
I think I rescued it from the office clear-out in 2013 when Cambridge
University Computing Service moved out of the old city-centre offices. I
probably picked it up from a stack of old books that were to be chucked;
wherever I found it, I can't remember who it belonged to. And now I no
longer work for the University, it has come home with me.
Tony.
--
f.anthony.n.finch <dot(a)dotat.at> https://dotat.at/
Southwest Forties, Cromarty, Forth, Tyne, Dogger: Southerly or
southeasterly, backing easterly or northeasterly later, 4 to 6,
becoming variable 3 for a time in Cromarty and Forth. Moderate,
occasionally rough at first in southwest Forties, Cromarty and Dogger.
Rain or showers, fog patches developing. Moderate or good,
occasionally very poor.
> It would be nice to hear about the rationale from a primary source.
Assembly language was deemed a last resort, especially as portability
was coming to the fore. As I wrote in A Research Unix Reader,
"Assembly language and magic constants gradually declined from the
status of the 'real truth' (v4) to utterly forgotten (v8)." In v7,
assembler usage was demoted to the bottom of syscall man pages. It
could also be found in /usr/src/libc/sys/*.s
Doug
Well, hallelujah, after much travail (I've tried this every Christmas
for at least 5 years now), I have succeeded in building vi on v7 from
2bsd. Had to patch the c compiler to enlarge the symbol table, tweak
some stuff here and there, but it finally built and installed without
any errors, yay.
Now, I just want it to do some editing, preferably in visual mode. I can
call it as ex or vi:
# ex
:
or
# vi
:
and q will exit, yay, again!
I have at least two problems:
1. It's not going "full" screen, even with TERM=vt100 or TERM=ansi set
(not that I was surprised, but it'd be nice)...
2. If I type a for append and type something, there's no way to get back
to the : prompt (ESC doesn't seem to work).
3. I'd like manpages (figure they might help with the above), but
they're on the tape as .u files?
I'm hoping this triggers some, oh yeah I remember that, type responses.
Thanks,
Will
So,
in v6, it was possible to use the mesg function from the system library
with:
ed hello.s
/ hello world using external mesg routine
.globl mesg
mov sp,r5
jsr r5,mesg; <Hello, World!\n\0>; .even
sys exit
as hello.sld -s a.out -l
a.out
Hello, World!
This was because v6 included mesg in the library, in v7, it doesn't look
like mesg is included, so doing the same thing as above requires that
code to write the message out be included and in addition system call
names are not predefined, so exit and write have to be looked up in
/usr/include/sys.s, resulting in the v7 equivalent file:
ed hello2.s
/ hello world using internal mesg routine
       mov    sp,r5
       jsr    r5,mesg; <Hello, World!\n\0>; .even
       sys    1
mesg:
       mov    r0,-(sp)
       mov    r5,r0
       mov    r5,0f
1:
       tstb   (r5)+
       bne    1b
       sub    r5,r0
       com    r0
       mov    r0,0f+2
       mov    $1,r0
       sys    0; 9f
.data
9:
       sys    4; 0:..; ..
.text
       inc    r5
       bic    $1,r5
       mov    (sp)+,r0
       rts    r5
as hello2.s
a.out
Hello, World!
My questions are:
1. Is mesg or an equivalent available in v7?
2. If not, what was the v7 way of putting strings out?
3. Why aren't the system call names defined?
4. What was the v7 way of naming system calls?
Will
All,
I've completed a new version of my "Installing and Using Research Unix
Version 7 in the SimH PDP-11/45 and 11/70 Emulators" tutorial/document
(wow, that's a mouthful). I'm calling it Version 2.0 - It is a
completely reorganized, updated, and edited version of the document.
The blog post announcement is on the blog: https://decuser.blogspot.com/
and the pdf is on google drive:
https://drive.google.com/file/d/1gDBxULlpLwezH-1RO_3ou_W7trElgSgT/view?usp=…
The new doc covers building a working v7 instance from tape files that
will run on the SimH emulator. First, the reader is led through the
restoration of a pristine v7 instance from tape to disk. Next, the
reader is led through adding a regular user, making the system
multi-user. Then, the reader is shown how to make the system
multi-session cable allowing multiple simultaneous sessions. Finally,
the system is put to use with hello world, DMR style, and the learn
system is enabled. It also includes a hyperlinked table of contents.
My hope is that the new version will be more useful than the prior
version, as well as more accurate. I really appreciate the input and
feedback y'all have given me over the intervening years.
Regards,
Will
> From: John Cowan
> Why use C syntax? What was wrong with Fortran, Lisp, or Cobol syntax,
> extended to do what you wanted?
Why do all hammers look basically the same? Because there's an 'ideal
hammer', and over time hammer design has asymtoted toward that 'ideal hammer'
design. One can't just keep improving the design indefinitely - diminishing
returns set in.
So I suspect there is, to some degree, a Platonic 'ideal syntax' for a
'classic block-structured' programming language, and to me, C came pretty
close to it.
I except LISP from that assessment, because LISP is built around a
fundamentally different model of how computations/algorithms are organized,
and C and LISP aren't directly comparable.
But that realization points to a deeper bug with the 'Platonic ideal
language' concept above, which is that languages are fundamentally, albeit at
a very deep conceptual level, tied to the basic concept of the computing
hardware they are to run on. C/COBOL/FORTRAN/etc are all for von Neumann-like
(in a broad sense) computing engines - a single thread of computation, which
happens sequentially.
But we've pushed that paradigm about as far as it can go, we're into
diminishing returns territory on that one. The future, starting with the
hardware, will be very different - and will need quite different languages.
(Go, from what little I know of it, is a baby step in this direction - it is
intended to make it easy to use multiple simultaneous loci of execution,
making use of the mutiple cores that are common now.)
I suspect we'll be shifting to radically different paradigms, 50 years from
now - massively parallel computing meshes (think Connection Machines on
steroids - or the human brain), and those will use fundamentally different
computing paradigms, and programming languages for them, which in turn will
need very different syntax.
Noel
> Lisp, _that's_ elegant.
The machine shines through Lisp even more brightly than it does
through C. Lisp attains incredible power from a tiny base: car, cdr,
cons, cond, T, F, null, lambda, def, exuding elegance that survives
even in a raging sea of parentheses.
For Lisp-friendly applications nowadays, I prefer Haskell, which is
much further away from the machine. Haskell code approaches--and
sometimes surpasses--the cleanliness of good mathematical notation.
For string processing, I remember Snobol 3 with great fondness.
But for everyday work with arrays and numbers, C is the workhorse.
Still, I wish that C would evaluate comma expressions in parallel
rather than in series, as in (a,b) = (b,a).
Doug
I enabled user accounting on my v7 instance and I noticed it "growing
without bound" and while this is noted as a possibility in the ac(1) man
page, I was pretty sure the original authors didn't mean 30k a second. I
scratched my head and thought for a while and then started experimenting
to see what the heck was going on. I removed /usr/adm/wtmp (which I had
created to enable accounting in the first place) and the little red disk
write arrow on my mac went away, but not the little green disk read
arrow... hmm. Something was keeping my v7 instance very busy reading
disk, that was for sure. I went through a few (dozens) more tests and
experiments, reread a bunch of man pages, Ritchie's v7 install note, and
thought some more and here's what I came up with...
If you modify your system to add dci lines and you enable some ttys in
/etc/ttys and you enable user accounting. Then, the next time you boot
into a kernel that doesn't have dci support, init or some other process
will try and fail to read the enabled ttys, log something in
/usr/adm/wtmp, if it exists, and then loop (very quickly), over and over
and over. If you aren't paying attention, this will hardly be noticeable
on modern hardware running simh, but I'm guessing this would have been
disastrous, back in the day.
The simple solution is to boot w/dci enabled when you have ttys enabled,
and only boot w/o dci enabled when you have disabled the ttys.
I'm guessing that this wasn't really ever an issue, back in the day, as
folks prolly didn't just yank their dci's and reboot a different kernel?
But, such are the joys of simulation.
Anyhow, if this doesn't sound like a very likely or reasonable analysis
of what was happening, I'd appreciate your letting me know, or if you've
experienced something like it before, it'd be great to know that I'm not
alone in this silliness.
Will
I'm pretty sure that I asked about learn ages back, but I couldn't find
any reference to it in the archives. So, I thought I would close the
possibly imaginary loop on it. Cuz, I figured it out, and it may prove
useful to others or with my track record, even myself in the future :).
Learn works fine in v7. It just needs to be properly installed. The
command is there already, so you may not need to follow all of the steps
below, but it doesn't hurt:
I did this as root, but it could possibly be done as another user, I'm
not sure.
cd /usr/src/cmd/learn
make
make lessons
make play; make log
That's it. make will complain about missing files that it tries to
delete, but these can be safely ignored, since make then creates them
anyway.
Here's the result run as a normal user:
$ learn
These are the available courses -
 files
 editor
 morefiles
 macros
 eqn
 C
If you want more information about the courses,
or if you have never used 'learn' before,
type 'return'; otherwise type the name of
the course you want, followed by 'return'.
macros
If you were in the middle of this subject
and want to start where you left off, type
the last lesson number the computer printed.
To start at the beginning, just hit return.
This script deals with the use of the "-ms" macro
package to produce Bell Laboratories style documents.
Before trying it, you should be familiar with the
editor. To test that, please enter the file
typed below, exactly as is, into file "decl". Then
type "ready".
.PP
When in the course of human events, it becomes
necessary for one people to dissolve the political bands which have
connected them with another, and to assume among the
powers of the earth the separate and equal station to which
the laws of Nature and of Nature's God entitle them, a decent
respect to the opinions of mankind requires that they should
declare the causes which impel them to the separation.
$ ed decl
?decl
a
.PP
When in the course of human events, it becomes
necessary for one people to dissolve the political bands which have
connected them with another, and to assume among the
powers of the earth the separate and equal station to which
the laws of Nature and of Nature's God entitle them, a decent
respect to the opinions of mankind requires that they should
declare the causes which impel them to the separation.
.
w
410
q
$ ready
Good. Lesson 1.1a (1)
When you have some document typed in "-ms" style,
you run it off on your terminal by saying:
 nroff -ms file
where "file" is the name of the file it is on. For example,
the file "decl" in this directory is in a suitable format
for running off this way. Do so. Then type "ready".
$
Interrupt.
Want to go on? n
Bye.
$
Pretty slick, really, once you realize that the $ prompt isn't really
your shell, it's a shell within learn. Also, there's no learn manpage
although there is a document in vol2 of the programmer's manual that
describes the program. I couldn't figure out the canonical way to exit,
so I just CTRL-DELETE on my mac, which I figure it CTRL-BREAK (^C?).
That seems to work.
Oh, and according to /usr/src/cmd/learn/README, if you have any trouble:
Please report problems, bad lessons, etc., to
Brian Kernighan, MH 6021, 2C-518, or
Mike Lesk, MH 6377, 2C-572. Thanks.
Enjoy, and happy New Year, folks!
Will
> Joy’s original 2BSD tape will give you UCB Pascal.
While I agree with Kernighan that Pascal is not my favorite
programming language, UCB Pascal is my favorite compiler because of
its spectacularly good syntax diagnostics. The diagnostics are
automatically generated, so they have a completely consistent style
and never go down rabbit holes trying to explain an error.
The UCB trick is to report the exact spot where LR parsing chokes and
suggest a canonical alternate token that allows progress. This simple
strategy is startlingly effective; the compiler taught me Pascal in an
evening.
It occurred to me that Pascal would be a suitable language in which to
express a certain algorithm. Having skimmed the Pascal report a year
or more earlier, I knew it was a pretty typical language, so I grabbed
a sample program from somewhere and plowed ahead. I made mistake after
mistake, but every diagnostic was instantly suggestive. By the end of
the session I had a polished working program. In due time it was
accepted for publication.
Doug