The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* Re: [TUHS] v7 source code for sh
@ 2022-02-21 17:58 Norman Wilson
  2022-02-21 18:10 ` Rob Pike
  0 siblings, 1 reply; 30+ messages in thread
From: Norman Wilson @ 2022-02-21 17:58 UTC (permalink / raw)
  To: tuhs

Rob Pike:

  I did the same to adb, which turned out to have a really good debugger
  hidden under a few serious bugs of its own, which I fixed.

=====

Memories.

Was it you who replaced ptrace with /proc in adb, or did I do that?

I do remember I was the one who took ptrace out of sdb (which a
few 1127-ers, or perhaps 112-ers on alice and rabbit still used).
After which I removed ptrace from the kernel, and from the
copy of the V8 manual in the UNIX room.  Conveniently ptrace
occupied two facing pages; I glued them together.

I also later did some work to try to isolate the target-dependent
parts of adb and to make them work in host-independent ways--e.g.
assembling ints byte-by-byte rather than assuming byte order--to
make it easier to make a cross adb, e.g. to examine PDP-11 or
68K core dumps on a VAX.

I miss adb; maybe it's time to revive it, though these days I'd
be tempted to rewrite it in Python so I could just load the right
module at runtime to pick the desired target.

Norman Wilson
Toronto ON

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [TUHS] v7 source code for sh
@ 2022-02-22  3:07 Brian Walden
  2022-02-22 14:28 ` Chet Ramey
  2022-02-22 14:47 ` Clem Cole
  0 siblings, 2 replies; 30+ messages in thread
From: Brian Walden @ 2022-02-22  3:07 UTC (permalink / raw)
  To: tuhs

The one I remember using in the 80s was called "fep" written by
Kazumasa Utashiro of Software Research Associates. It was probbaly posetd
posted to comp.sources.unix usenet group.

-Brian

Chet Ramey wrote:
> On 2/20/22 4:19 PM, Lyndon Nerenberg (VE7TFX/VE6BBM) wrote:
> > Chet Ramey writes:
> >
> >> It always seemed like it would have been just the thing to implement as a
> >> tty streams module, but research Unix went in a different direction.
> >
> > I'm really surprised nobody has implemented a basic readline as a
> > tty line discipline by now.  I was poking around the OpenBSD NMEA
> > line discipline code a few weeks ago and thinking it shouldn't be
> > that hard to do.
>
> It's not that hard. The complexity is in how sophisticated you want to get
> with redisplay and whether you want to allow user-specified key bindings.
>
> > Did anyone think about doing this in the past? If yes, what made you
> > decide against doing it?  (Or a streams implementation, for that matter.)
>
> There have been several implementations (I never did one). I suspect that
> the people who were in a position to integrate that functionality into
> distributed kernels were not supportive, or the code didn't get to them
> at the right time.
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [TUHS] v7 source code for sh
@ 2022-02-20  7:24 Rudi Blom
  0 siblings, 0 replies; 30+ messages in thread
From: Rudi Blom @ 2022-02-20  7:24 UTC (permalink / raw)
  To: tuhs


[-- Attachment #1.1: Type: text/plain, Size: 388 bytes --]

Second half of the 1980-tish when the computer division of Philips
Electronics started on their own Motorola M68010 / UNIX System V.3 (don't
remember for sure I'm afraid) they used a syntax.h with macros similar to
mac.h. Only I understand it's more Pascal like. Appended the 1987 version I
found in my archive.

Cheers,
rubl

-- 
The more I learn the better I understand I know nothing.

[-- Attachment #1.2: Type: text/html, Size: 585 bytes --]

[-- Attachment #2: syntax.h --]
[-- Type: text/plain, Size: 1754 bytes --]

/*	SCCSID(" @(#)syntax.h		87/08/01 )"	*/

#ifndef	SYNTAX_H
#define SYNTAX_H

/* For a full explanation see the file syntax.help */

#define IF		if(
#define THEN		){
#define ELSIF		}else if(
#define ELSE		}else{
#define ENDIF		}
#define NOT		!
#define	AND		&&
#define	OR		||
#define CASE		switch(
#define OF		){
#define ENDCASE		break;}
#define WHEN		break;case
#define CWHEN		case
#define IMPL		:
#define COR		:case
#define BREAK		break
#define WHENOTHERS	break;default
#define CWHENOTHERS	default
#define SELECT		do{{
#define SWHEN		}if(
#define SIMPL		){
#define ENDSELECT	}}while(0)
#define SCOPE		{
#define ENDSCOPE	}
#define BLOCK		{
#define ENDBLOCK	}
#define FOREVER		for(;;
#define FOR		for(
#define SKIP
#define COND		;
#define STEP		;
#define LOOP		){
#define ENDLOOP		}
#define NULLOOP		){}
#define WHILE		while(
#define DO		do{
#define UNTIL		}while(!(
#define ENDDO		))
#define EXITWHEN(e)	if(e)break
#define CONTINUE	continue
#define RETURN		return
#define GOTO		goto
#define STRUCT		struct
#define UNION		union
#define TYPE		typedef
#define IS		
#define SIZEOF		sizeof
#define UNSIGNED	unsigned
#define CHAR		char
#define UCHAR		unsigned char
#define BYTE		char
#define UBYTE		unsigned char
#define SHORT		short
#define USHORT		unsigned short
#define INT		int
#define UINT		unsigned int
#define VOID		void
#define LONG		long
#define ULONG		unsigned long
#define FLOAT		float
#define DOUBLE		double
#define ENUM		enum
#define PRIVATE		static
#define IMPORT		extern
#define EXPORT
#define AUTO		auto
#define FAST		register
#define FALSE		0
#define TRUE		1
#define MODULE(m,id)	static char __mod__[]="m";\
	static char __file__[]=__FILE__;static char __filid__[]="id"
#define PROC		
#define ENDMODULE
#define SHOULD_NOT
#endif	/* SYNTAX_H */

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [TUHS] v7 source code for sh
@ 2022-02-19 17:44 Bakul Shah
  2022-02-19 18:44 ` Rob Pike
  0 siblings, 1 reply; 30+ messages in thread
From: Bakul Shah @ 2022-02-19 17:44 UTC (permalink / raw)
  To: Clem Cole; +Cc: TUHS main list

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

On Feb 19, 2022, at 8:11 AM, Clem Cole <clemc@ccc.com> wrote:
> 
> 
> On Sat, Feb 19, 2022 at 11:04 AM Steve Nickolas <usotsuki@buric.co> wrote:
>> Apparently Bourne was heavily into ALGOL, 
> That's sort of an understatement.  I believe that when he was at Cambridge, he was one of the people that helped to take the Algol-X proposal and turned it into the Algol-68 definition. I also believe he worked on their famous implementation of same.

Some of you may be interested in this “A history of Algol68” paper:
https://dl.acm.org/doi/pdf/10.1145/234286.1057810
The author, Charles H Lindsey, still occasionally posts on comp.lang.misc
about Algol68. Among other things Bourne was a coauthor of Algol68C,
a portable implementation of Algol68.

[-- Attachment #2: Type: text/html, Size: 1572 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread
* [TUHS] v7 source code for sh
@ 2022-02-19 15:43 Will Senn
  2022-02-19 16:03 ` Steve Nickolas
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Will Senn @ 2022-02-19 15:43 UTC (permalink / raw)
  To: TUHS main list

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1518 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2022-02-22 14:50 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 17:58 [TUHS] v7 source code for sh Norman Wilson
2022-02-21 18:10 ` Rob Pike
  -- strict thread matches above, loose matches on Subject: below --
2022-02-22  3:07 Brian Walden
2022-02-22 14:28 ` Chet Ramey
2022-02-22 14:47 ` Clem Cole
2022-02-20  7:24 Rudi Blom
2022-02-19 17:44 Bakul Shah
2022-02-19 18:44 ` Rob Pike
2022-02-19 19:29   ` Clem Cole
2022-02-19 22:39   ` John Cowan
2022-02-19 23:11     ` Sven Mascheck
2022-02-19 23:34       ` Rob Pike
2022-02-19 23:36       ` silas poulson
2022-02-20 20:54       ` Chet Ramey
2022-02-20 21:02         ` Larry McVoy
2022-02-20 21:19           ` Chet Ramey
2022-02-20 21:19         ` Lyndon Nerenberg (VE7TFX/VE6BBM)
2022-02-20 22:39           ` Chet Ramey
2022-02-21  1:01             ` Dan Cross
2022-02-22  4:54               ` Dan Stromberg
2022-02-22  5:39                 ` Rob Pike
2022-02-22  5:54                   ` George Michaelson
2022-02-19 15:43 Will Senn
2022-02-19 16:03 ` Steve Nickolas
2022-02-19 16:07   ` Clem Cole
2022-02-19 16:43   ` Steve Nickolas
2022-02-19 17:24   ` Ron Natalie
2022-02-19 16:04 ` Clem Cole
2022-02-19 16:06 ` Bakul Shah
2022-02-19 16:57   ` Will Senn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).