[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: es on ultrix with dec cc?



Date: 	Thu, 15 Apr 1993 19:12:44 -0400
From: rittle@comm.mot.com (Loren James Rittle)
Subject: Re:  es on ultrix with dec cc?

| es will not build under the plain cc as shipped with ultrix.
| I have built es with gcc 2.3.^(1 2) and dec's ansi c.
| both work fine.  The shipped cc is not ansi or anywhere close
| (doesn't take new style function declarations, etc).

I'm no fan of the RISC Ultrix cc, but it does accept some ANSI C usage,
including function declarations.  Just to see if it could be done, I
built es on Ultrix 4.2, DECstation 5000/240.  It took an hour, and I did
have to modify a couple of source files.  Mainly, however, there were a
couple of switches that are already in the source, that helped a lot.
Specifically, -DREISER_CPP=1 -DUSE_VOLATILE=0 -DUSE_CONST=0.  Obviously
someone has given some thought to portability.

A couple of patches are included below, but they aren't really adequate.
If it really needs to compile under the RISC Ultrix cc, dump.c needs to
know how to print out the TreeTypes macro, and I didn't bother to figure
that out (I just copied it out of dump.c, and resumed the build, which
of course had failed at initial.c.)  In fact, I hesitated to include
these patches because I don't claim to have looked into any of it very
hard.

The result did run, although I didn't test it extensively.  Size:
text    data    bss     dec     hex
155648  77824   3088    236560  39c10
(that's with neither -O nor -g)

	Donn Cave, University Computing Services, University of Washington
	donn@cac.washington.edu
-------------------------------
*** dump.c.dist	Mon Apr 12 00:40:59 1993
--- dump.c	Thu Apr 15 17:17:03 1993
***************
*** 113,119 ****
  			panic("dumptree: bad node kind %d", tree->kind);
  		case nWord: case nQword: case nPrim:
  			print(
! 				"static const Tree_s %s = { n%s, { (char *) %s } };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumpstring(tree->u[0].s)
--- 113,119 ----
  			panic("dumptree: bad node kind %d", tree->kind);
  		case nWord: case nQword: case nPrim:
  			print(
! 				"static const Tree_s %s = { n%s, {{ (char *) %s }} };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumpstring(tree->u[0].s)
***************
*** 121,127 ****
  			break;
  		case nCall: case nThunk: case nVar:
  			print(
! 				"static const Tree_p %s = { n%s, { (Tree *) %s } };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumptree(tree->u[0].p)
--- 121,127 ----
  			break;
  		case nCall: case nThunk: case nVar:
  			print(
! 				"static const Tree_p %s = { n%s, {{ (Tree *) %s }} };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumptree(tree->u[0].p)
***************
*** 131,137 ****
  		case nLambda: case nLet: case nList:  case nLocal:
  		case nMatch: case nVarsub:
  			print(
! 				"static const Tree_pp %s = { n%s, { (Tree *) %s, (Tree *) %s } };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumptree(tree->u[0].p),
--- 131,137 ----
  		case nLambda: case nLet: case nList:  case nLocal:
  		case nMatch: case nVarsub:
  			print(
! 				"static const Tree_pp %s = { n%s, {{ (Tree *) %s}, { (Tree *) %s }} };\n",
  				name + 1,
  				nodename(tree->kind),
  				dumptree(tree->u[0].p),
*** input.c.dist	Mon Apr 12 00:41:00 1993
--- input.c	Thu Apr 15 16:52:41 1993
***************
*** 281,286 ****
--- 281,289 ----
  extern List *runinput(Input *in, int flags) {
  	Handler h;
  	List *e, *repl, *arg, *result;
+ #ifdef ULTRIX
+ 	static
+ #endif
  	const char *dispatcher[] = {
  		"fn-%eval-noprint",
  		"fn-%eval-print",
*** input.h.dist	Mon Apr 12 00:41:05 1993
--- input.h	Thu Apr 15 16:51:20 1993
***************
*** 4,11 ****
--- 4,16 ----
  
  typedef struct Input Input;
  struct Input {
+ #ifdef ULTRIX
+ 	int (*fill)(), (*rfill)();
+ 	void (*cleanup)();
+ #else
  	int (*fill)(Input *self), (*rfill)(Input *self);
  	void (*cleanup)(Input *self);
+ #endif
  	Input *prev;
  	const char *name;
  	unsigned char *buf, *bufend, *bufbegin, *rbuf;
*** main.c.dist	Mon Apr 12 00:41:01 1993
--- main.c	Thu Apr 15 16:58:52 1993
***************
*** 47,64 ****
  /* usage -- print usage message and die */
  static noreturn usage(void) {
  	eprint(
! 		"usage: es [-c command] [-silevxnpo] [file [args ...]]\n"
! 		"	-c cmd	execute argument\n"
! 		"	-s	read commands from standard input; stop option parsing\n"
! 		"	-i	interactive shell\n"
! 		"	-l	login shell\n"
! 		"	-e	exit if any command exits with false status\n"
! 		"	-v	print input to standard error\n"
! 		"	-x	print commands to standard error before executing\n"
! 		"	-n	just parse; don't execute\n"
! 		"	-p	don't load functions from the environment\n"
! 		"	-o	don't open stdin, stdout, and stderr if they were closed\n"
! 		"	-d	don't ignore SIGQUIT or SIGTERM\n"
  	);
  	exit(1);
  }
--- 47,64 ----
  /* usage -- print usage message and die */
  static noreturn usage(void) {
  	eprint(
! 		"usage: es [-c command] [-silevxnpo] [file [args ...]]\n\
! 	-c cmd	execute argument\n\
! 	-s	read commands from standard input; stop option parsing\n\
! 	-i	interactive shell\n\
! 	-l	login shell\n\
! 	-e	exit if any command exits with false status\n\
! 	-v	print input to standard error\n\
! 	-x	print commands to standard error before executing\n\
! 	-n	just parse; don't execute\n\
! 	-p	don't load functions from the environment\n\
! 	-o	don't open stdin, stdout, and stderr if they were closed\n\
! 	-d	don't ignore SIGQUIT or SIGTERM\n"
  	);
  	exit(1);
  }
*** print.h.dist	Mon Apr 12 00:41:05 1993
--- print.h	Thu Apr 15 16:48:49 1993
***************
*** 9,15 ****
--- 9,19 ----
      /* for the buffer maintainence routines */
  	char *buf, *bufbegin, *bufend;
  	int flushed;
+ #ifdef ULTRIX /* quick hack */
+ 	void (*grow)(Format *, unsigned long);
+ #else
  	void (*grow)(Format *, size_t);
+ #endif
  	union { int n; void *p; } u;
  };