Jon Steinhart <jon(a)fourwinds.com> asked this question (not on tuhs).
It highlights some less well known contributors to research Unix.
> I'm trying to find out who came up with strcmp and the idea of
> returning -1,0,1 for a string comparison. I can see that it's not in
> my V6 manual but is in V7. Don't see anything in Algol, PL/I, BCPL, or B
The -1,0,1 return from comparisons stems from the interface of qsort,
which was written by Lee McMahon. As far as I know, the interface for
the comparison-function parameter originated with him, but conceivably
he borrowed it from some other sort utility. The negative-zero-positive
convention for the return value encouraged (and perhaps was motivated by)
this trivial comparison function for integers
int compar(a,b) { return(a-b); }
This screws up on overflow, so cautious folks would write it with
comparisons. And -1,0,1 were the easiest conventional values to return:
int compar(a,b) {
if(a<b) return(-1);
if(a>b) return(1);
return(0);
}
qsort was in v2. In v3 a string-comparison routine called "compar"
appeared, with a man page titled "string comparison for sort". So the
convention was established early on.
Compar provided the model for strcmp, one of a package of basic string
operations that came much later, in v7, under the banner of string.h
and ctype.h.
These packages were introduced at the urging of Nils-Peter Nelson, a
good friend of the Unix lab, who was in the Bell Labs comp center.
Here's the story in his own words.
I wrote a memo to dmr with some suggestions for additions to C. I asked
for the str... because the mainframes had single instructions to implement
them. I know for sure I had a blindingly fast implementation of isupper,
ispunct, etc. I had a table of length 128 integers for the ascii character
set; I assigned bits for upper, lower, numeric, punct, control, etc. So
ispunct(c) became
#define PUNCT 0400
return(qtable[c]&PUNCT)
instead of
if(c==':' || c ==';' || ...
[or
switch(c) {
default:
return 0;
case ':':
case ';':
...
return 1;
}
MDM]
dmr argued people could easily write their own but when I showed
him my qtable was 20 times faster he gave in. I also asked for type
logical which dmr implemented as unsigned, which was especially useful
when bitfields were implemented (a 2 bit int would have values -2, -1,
0, 1 instead of 0, 1, 2, 3). I requested a way to interject assembler,
which became asm() (yes, a bad idea).
TL;DR - I learned procedural programming in Fortran, wrote essentially the same queueing network solution algorithms and simulator in Fortran, then PL/I, then Pascal. For those purposes, PL/I seemed best, but Fortran was OK. (With Fortran and PL/I) the critical issue was to avoid undesirable constructs of the language.
When I got started with procedural programming at U.T. Austin C.S. in 1971, the dominant machine and language was CDC 6600 Fortran. For my dissertation I needed to write a queueing network simulator to attempt to validate approximate numerical methods I developed. Though by then Pascal was an option, Fortran seemed expedient.
In 1975 I joined IBM Yorktown and was asked to dramatically enhance my simulator. It became the core of the “Research Queueing Package” (http://web.archive.org/web/20130627040507/http://www.research.ibm.com/comps…) For the first year or so, I continued to use Fortran. From my perspective, the biggest problems weren’t the bad features, which I could avoid, but the lack of more natural control structures, pointers, and something like structs. My managers lamented that I wasn’t using PL/I. I spent a couple of weeks crafting a SNOBOL program to successfully translate the Fortran to PL/I. For the next decade plus, RESQ development was in PL/I (even after I left Yorktown and subsequently left IBM).
While writing Computer Systems Performance Modeling (https://www.amazon.com/exec/obidos/ISBN=0131651757/0596-2808191-282542) I wanted to illustrate the analysis, algorithms, and simulation concepts developed with RESQ, but be careful not to take anything directly from RESQ. So I wrote everything for the book in PASCAL.
For a variety of reasons, I remember much preferring PL/I over Fortran and Pascal. The Pascal development environments I used weren’t as productive as the PL/I environments. Fortran was missing very useful constructs. But Fortran was OK, in my experience.
--
voice: +1.512.784.7526 e-mail: sauer(a)technologists.com <mailto:sauer@technologists.com>
fax: +1.512.346.5240 web: http://technologists.com/sauer/ <http://technologists.com/sauer/>
Facebook/Google/Skype/Twitter: CharlesHSauer
On 2017-08-13 19:24, Dave Horsfall <dave(a)horsfall.org> wrote:
> On Sat, 12 Aug 2017, Steve Johnson wrote:
>> A little Googling shows that the IF I mentioned was called the
>> "arithmetic IF".
> Ah yes. It was in FORTRAN II, as I recall.
Still there in FORTRAN 77.
>> There was also a Computed GOTO that branched to one of N labels
>> depending on the value of the expression.
> I think that was still in FORTRAN IV?
Still there in FORTRAN 77.
>> And an Assigned GOTO whose main use, as I remember, was to allow for
>> error recovery when a subroutine failed...
> A real ugly statement; you assigned a statement number to a variable, then
> did a sort of indirect GOTO (or did the compiler recognise "GOTO I")?
The compiler recognize "GOTO I". And I have to be assigned to a
statement number (label). It has to be an integer variable, and when you
assign it to a label, you cannot do any arithmetic with it anymore. And
you assign it with a special statement. Thus, it can be used to store
what label to jump to, but you cannot use arithmetic to set what it
should jump to.
> How those poor devils ever debugged their code with such monstrous
> constructions I'll never know.
It's actually not that hard. All this stuff is fairly simple to deal
with. The real horror in FORTRAN is EQUIVALENCE, which can give C a fair
fight for real horror stories.
But of course, bad programmers can mess things up beyond belief in any
language.
(And I never went beyond FORTRAN 77, so I don't know how current
versions look like. I stayed with PDP-11s (well, still do), and nothing
newer than FORTRAN 77 exists there. :-) )
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt(a)softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401792
I think this qualifies as history :-) At least for me personally, the
last 12 years feel like a lifetime.
It is significant that so far the report has not been ported forward to
a newer emacs version (as it had been previously from 21 to 24). I have
no newer version installed so I cannot check but I bet the bug is still
present. Maybe someone else on the list can check?
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.
Hi all, sorry for this off-topic posting.
I just came across this series of videos where a guy built a CPU out
of 7400 series chips on a breadboard: https://eater.net/8bit/
Anyway, I thought it would be fun to do something similar but with
a bigger address space and as few chips as I could get away with.
I've got a design that works in Logisim, but I've never actually
built anything before with real chips. So, if there's someone on the
list who could quickly look at what I've done and point out problems
or gotchas (or indeed, what ROM/RAM chips to use), that would be great!
The design so far: https://github.com/DoctorWkt/eeprom_cpu
Thanks in advance, Warren
Hi all,
Sorry if this is the wrong place to ask...
I started my home UNIX hobby in the mid-1980's with Microport SVR2 on Intel
286. With a couple of modems I started a public access UNIX system in
Hampton Roads, VA.
That system graduated to SVR3.0, 3.1, 3.2 on 386, and finally 4.2 with 4
modems running on an AST 4-port card on 486. That was about 1992 when I
started an ISP using SVR4.2. That ISP, also in Hampton Roads, grew quite
large. We were in 100 cities and partnered with newspapers and managed
their content on the brand new web. By then we had graduated to large Alpha
systems and Sun Enterprise.
Now I'm all grown up and and experiencing a 2nd childhood. I run SVR4.2MP
here on a real dual processor Pentium system, but I'd like to get back to
SVR3.2 on period hardware, and later to r2.
My problem is I don't have a copy and don't know where to find one. Do any
of you happen to have a diskette (or disk image) set you can part with?
Ideally I'd like a development system and networking. But I've always been
an optimist :)
I'm happy to pay reasonable fees.
Tom
Thanks for the replies!
I figured that like other lists I frequent, most here would be BSDish folk.
Glad to know there are others with commercial AT&T experience.
I know r2 has no networking and used UUCP extensively back when. I'll be
using it for local transfer along with Kermit.
My particular sickness requires me to run these operating systems on mostly
period hardware. My SVR4 runs on all period stuff except I use SCSI2SD for
the disk. Old disks are becoming hard to find and expensive, and I really
don't want to be playing with MFM or RLL anymore. I'll likely try to find
some kind of substitute. I know they are out there.
I think r3.2 supported SCSI, so I should be ok there.
Tom