[comp.sources.unix] v22i034: Update kit for p2c Pascal to C translator, Part01/02

rsalz@uunet.uu.net (Rich Salz) (05/08/90)

Submitted-by: David Gillespie <daveg@csvax.caltech.edu>
Posting-number: Volume 22, Issue 34
Archive-name: p2cpatches/part01

The following patches convert p2c version 1.14 into p2c version 1.15.  To
apply them automatically with Patch v2.0, first cd into your p2c
distribution directory (with subdirectories src, examples, etc.), then
execute "patch -p0 <p2c.patch", where "p2c.patch" is name of this file,
then "cd src" and execute "make install".

These patches do not cover the example files, nor reproducible files such
as "p2c.hdrs" and "p2c.cat".  Those files will be rebuilt by "make
install".

Enjoy!
							-- Dave

Dave Gillespie
256-80 Caltech, Pasadena CA 91125
daveg@csvax.caltech.edu, ...!cit-vax!daveg



*** README	Thu Mar 22 14:27:56 1990
--- ../dist/README	Fri Apr 13 20:59:32 1990
***************
*** 1,5 ****
  
! This directory contains "p2c" version 1.14, a Pascal to C translator.
  
  "p2c"  Copyright 1989  Dave Gillespie
                         256-80 Caltech
--- 1,5 ----
  
! This directory contains "p2c" version 1.15, a Pascal to C translator.
  
  "p2c"  Copyright 1989  Dave Gillespie
                         256-80 Caltech
Files Makefile and ../dist/Makefile are identical
Files src/COPYING and ../dist/src/COPYING are identical
diff -c -N -r -s src/HISTORY ../dist/src/HISTORY
*** src/HISTORY	Thu Mar 22 14:27:23 1990
--- ../dist/src/HISTORY	Fri Apr 13 20:58:54 1990
***************
*** 4,9 ****
--- 4,44 ----
  ------- -- ------- --  ---
  
  
+ Version 1.15:
+ 
+  * Taught the line breaker to handle logical/relational operators specially.
+ 
+  * Improved code generation for large set constructors.
+ 
+  * Changed makeexpr_assign to handle EK_LITCAST's on the lefthand side.
+ 
+  * Changed makeexpr_addr to handle casts.
+ 
+  * Changed FieldMacros so that the substituted base expr retains its type.
+ 
+  * Bug fix in p2c.h: Rewrote P_getbits_US and other small-packed-array macros.
+    Symptom: On many architectures, these macros didn't work at all!
+    NOTE: These now pack small arrays in the opposite direction (LSB first).
+ 
+  * Bug fix in funcs.c:handleread_text: changed strread of string to use %255s.
+    Symptom: Previous translation of %255c did not append a null character.
+ 
+  * Bug fix in p2clib.c:strrtrim: Added test for empty string input.
+    Symptom: Incorrect behavior on strrtrim("").
+ 
+  * Bug fix in p2clib.c:P_addsetr: Changed to signed comparison of v1 and v2.
+    Symptom: Adding [0..-1] to a set failed.
+ 
+  * Bug fix in p2clib.c:P_expset: Don't write to d[1] if set is empty.
+    Symptom: Sets allocated to store 0 elements didn't work properly.
+ 
+  * Added to sys.p2crc/trans.h the following configuration parameters:
+ 
+     LogBreakPenalty         Like OpBreakPenalty, but for && and ||.
+     LogBreakExtraPenalty    Like OpBreakExtraPenalty, but for && and ||.
+     RelBreakPenalty         Like OpBreakPenalty, but for <, ==, etc.
+     RelBreakExtraPenalty    Like OpBreakExtraPenalty, but for <, ==, etc.
+ 
  Version 1.14:
  
   * Added partial support for Oregon Software Pascal's delete(f) procedure.
***************
*** 41,47 ****
  
   * Added some extra parentheses to the P_clrbits macros. (!)
  
!  * Added to sys.p2crc/trans.h the following configuration parameter:
  
      CharFileText    Treat "file of char" as identical to "text".
      UseStrncmp	    Use strncmp, not memcmp, to compare packed arrays of char.
--- 76,82 ----
  
   * Added some extra parentheses to the P_clrbits macros. (!)
  
!  * Added to sys.p2crc/trans.h the following configuration parameters:
  
      CharFileText    Treat "file of char" as identical to "text".
      UseStrncmp	    Use strncmp, not memcmp, to compare packed arrays of char.
Files src/Makefile and ../dist/src/Makefile are identical
Files src/NOTES and ../dist/src/NOTES are identical
Files src/README and ../dist/src/README are identical
Files src/citmods.c and ../dist/src/citmods.c are identical
Files src/comment.c and ../dist/src/comment.c are identical
diff -c -N -r -s src/decl.c ../dist/src/decl.c
*** src/decl.c	Thu Mar 22 14:27:32 1990
--- ../dist/src/decl.c	Fri Apr 13 20:59:09 1990
***************
*** 2835,2841 ****
      head = NULL;
      for (mp = firstmp; mp; mp = mp->cnext) {
  	if (mp->kind == MK_FIELD) {
! 	    if (mp->val.i == 8 || mp->val.i == 16) {
  		if (!head)
  		    head = mp;
  	    } else {
--- 2835,2844 ----
      head = NULL;
      for (mp = firstmp; mp; mp = mp->cnext) {
  	if (mp->kind == MK_FIELD) {
! 	    if ((mp->val.i == 8 &&
! 		 (mp->type == tp_uint ||
! 		  hassignedchar || signedchars == 1)) ||
! 		mp->val.i == 16) {
  		if (!head)
  		    head = mp;
  	    } else {
Files src/dir.c and ../dist/src/dir.c are identical
diff -c -N -r -s src/expr.c ../dist/src/expr.c
*** src/expr.c	Thu Mar 22 14:27:33 1990
--- ../dist/src/expr.c	Fri Apr 13 20:59:11 1990
***************
*** 3505,3510 ****
--- 3505,3527 ----
          FREE(a);
          ex->val.type = type;
          return ex;
+     } else if (a->kind == EK_CAST) {
+ 	return makeexpr_cast(makeexpr_addr(a->args[0]), type);
+     } else if (a->kind == EK_ACTCAST) {
+ 	return makeexpr_actcast(makeexpr_addr(a->args[0]), type);
+     } else if (a->kind == EK_LITCAST) {
+ 	if (a->args[0]->kind == EK_NAME) {
+ 	    if (my_strchr(a->args[0]->val.s, '(') ||
+ 		my_strchr(a->args[0]->val.s, '['))
+ 		note("Constructing pointer type by adding '*' may be incorrect [322]");
+ 	    return makeexpr_bin(EK_LITCAST, tp_integer,
+ 				makeexpr_name(format_s("%s*",
+ 						       a->args[0]->val.s),
+ 					      tp_integer),
+ 				makeexpr_addr(a->args[1]));
+ 	} else
+ 	    return makeexpr_bin(EK_LITCAST, tp_integer, makeexpr_type(type),
+ 				makeexpr_addr(a->args[1]));
      } else {
          switch (a->val.type->kind) {
  	    
***************
*** 4088,4094 ****
--- 4105,4120 ----
  }
  
  
+ Meaning *totempvar(ex)
+ Expr *ex;
+ {
+     while (structuredfunc(ex))
+ 	ex = ex->args[0];
+     return istempvar(ex);
+ }
+ 
  
+ 
  Meaning *isretvar(ex)
  Expr *ex;
  {
***************
*** 4416,4432 ****
  	    return a;
  	}
      }
!     while (a->kind == EK_CAST || a->kind == EK_ACTCAST) {
! 	if (ansiC < 2 ||     /* in GNU C, a cast is an lvalue */
! 	    isarithkind(a->args[0]->kind) ||
! 	    (a->val.type->kind == TK_POINTER &&
! 	     a->args[0]->val.type->kind == TK_POINTER)) {
  	    if (a->kind == EK_CAST)
  		b = makeexpr_cast(b, a->args[0]->val.type);
  	    else
  		b = makeexpr_actcast(b, a->args[0]->val.type);
!             a = grabarg(a, 0);
!         } else
  	    break;
      }
      if (a->kind == EK_NEG)
--- 4442,4462 ----
  	    return a;
  	}
      }
!     while (a->kind == EK_CAST || a->kind == EK_ACTCAST ||
! 	   a->kind == EK_LITCAST) {
! 	if (a->kind == EK_LITCAST) {
! 	    b = makeexpr_cast(b, a->args[1]->val.type);
! 	    a = grabarg(a, 1);
! 	} else if (ansiC < 2 ||    /* in GNU C, a cast is an lvalue */
! 		   isarithkind(a->args[0]->kind) ||
! 		   (a->val.type->kind == TK_POINTER &&
! 		    a->args[0]->val.type->kind == TK_POINTER)) {
  	    if (a->kind == EK_CAST)
  		b = makeexpr_cast(b, a->args[0]->val.type);
  	    else
  		b = makeexpr_actcast(b, a->args[0]->val.type);
! 	    a = grabarg(a, 0);
! 	} else
  	    break;
      }
      if (a->kind == EK_NEG)
***************
*** 4928,4934 ****
      if (mp->constdefn) {
          nex = makeexpr(EK_MACARG, 0);
          nex->val.type = tp_integer;
!         ex3 = replaceexprexpr(copyexpr(mp->constdefn), nex, ex);
          freeexpr(ex);
          freeexpr(nex);
          ex = gentle_cast(ex3, mp->val.type);
--- 4958,4964 ----
      if (mp->constdefn) {
          nex = makeexpr(EK_MACARG, 0);
          nex->val.type = tp_integer;
!         ex3 = replaceexprexpr(copyexpr(mp->constdefn), nex, ex, 0);
          freeexpr(ex);
          freeexpr(nex);
          ex = gentle_cast(ex3, mp->val.type);
diff -c -N -r -s src/funcs.c ../dist/src/funcs.c
*** src/funcs.c	Thu Mar 22 14:27:36 1990
--- ../dist/src/funcs.c	Fri Apr 13 20:59:13 1990
***************
*** 3239,3245 ****
                      break;
  
                  case TK_STRING:     /* strread only */
!                     ex = makeexpr_string(format_d("%%%dc", strmax(fex)));
                      break;
  
                  case TK_ARRAY:      /* strread only */
--- 3239,3245 ----
                      break;
  
                  case TK_STRING:     /* strread only */
!                     ex = makeexpr_string(format_d("%%%lds", strmax(fex)));
                      break;
  
                  case TK_ARRAY:      /* strread only */
Files src/hpmods.c and ../dist/src/hpmods.c are identical
Files src/lex.c and ../dist/src/lex.c are identical
Files src/loc.p2clib.c and ../dist/src/loc.p2clib.c are identical
Files src/loc.p2crc and ../dist/src/loc.p2crc are identical
Files src/makeproto.c and ../dist/src/makeproto.c are identical
diff -c -N -r -s src/out.c ../dist/src/out.c
*** src/out.c	Thu Mar 22 14:27:28 1990
--- ../dist/src/out.c	Fri Apr 13 20:59:05 1990
***************
*** 534,539 ****
--- 534,540 ----
  
  
  
+ 
  /* The following routine explores the tree of all possible line breaks,
     pruning according to the fact that "badness" and "extra" are
     increasing functions.  The object is to find the set of breaks and
***************
*** 802,807 ****
--- 803,823 ----
  		    penalty += parenbreakpenalty + parenbreakextrapenalty*i;
  		else if (outbuf[pos-2] == ',')
  		    penalty += commabreakpenalty + commabreakextrapenalty*i;
+ 		else if (((outbuf[pos] == '&' || outbuf[pos] == '|') &&
+ 			  outbuf[pos+1] == outbuf[pos]) ||
+ 			 ((outbuf[pos-3] == '&' || outbuf[pos-3] == '|') &&
+ 			  outbuf[pos-3] == outbuf[pos-2]))
+ 		    penalty += logbreakpenalty + logbreakextrapenalty*i;
+ 		else if (((outbuf[pos] == '<' || outbuf[pos] == '>') &&
+ 			  outbuf[pos+1] != outbuf[pos]) ||
+ 			 ((outbuf[pos] == '=' || outbuf[pos] == '!') &&
+ 			  outbuf[pos+1] == '=') ||
+ 			 ((outbuf[pos-2] == '<' || outbuf[pos-2] == '>') &&
+ 			  outbuf[pos-3] != outbuf[pos-2]) ||
+ 			 ((outbuf[pos-3] == '<' || outbuf[pos-3] == '>' ||
+ 			   outbuf[pos-3] == '=' || outbuf[pos-3] == '!') &&
+ 			  outbuf[pos-2] == '='))
+ 		    penalty += relbreakpenalty + relbreakextrapenalty*i;
  		else if (outbuf[pos-2] == '=')
  		    penalty += assignbreakpenalty + assignbreakextrapenalty*i;
  		else if (outbuf[pos] == '?') {
diff -c -N -r -s src/p2c.h ../dist/src/p2c.h
*** src/p2c.h	Thu Mar 22 14:27:39 1990
--- ../dist/src/p2c.h	Fri Apr 13 20:59:19 1990
***************
*** 4,10 ****
  
  /* Header file for code generated by "p2c", the Pascal-to-C translator */
  
! /* "p2c"  Copyright (C) 1989 Dave Gillespie, version 1.14.
   * This file may be copied, modified, etc. in any way.  It is not restricted
   * by the licence agreement accompanying p2c itself.
   */
--- 4,10 ----
  
  /* Header file for code generated by "p2c", the Pascal-to-C translator */
  
! /* "p2c"  Copyright (C) 1989 Dave Gillespie, version 1.15.
   * This file may be copied, modified, etc. in any way.  It is not restricted
   * by the licence agreement accompanying p2c itself.
   */
***************
*** 250,255 ****
--- 250,256 ----
  extern Void     P_readpaoc  PP( (FILE *, Char *, int) );
  extern Void     P_readlnpaoc PP( (FILE *, Char *, int) );
  extern long     P_maxpos    PP( (FILE *) );
+ extern Char    *P_trimname  PP( (Char *, int) );
  extern long    *P_setunion  PP( (long *, long *, long *) );
  extern long    *P_setint    PP( (long *, long *, long *) );
  extern long    *P_setdiff   PP( (long *, long *, long *) );
***************
*** 351,361 ****
  				   (((~(i))&((1<<(L)-(n))-1)) << (n))) )
  
  /* small packed arrays */
! #define P_getbits_US(v,i,n)     ((int)((v) >> (~(i) << (n)) & (1<<(1<<(n)))-1))
! #define P_getbits_SS(v,i,n)     ((int)((long)(v) << (32 - (((~(i))+1) << (n))) >> (32-(1<<(n)))))
! #define P_putbits_US(v,i,x,n)   ((v) |= (x) << (~(i) << (n)))
! #define P_putbits_SS(v,i,x,n)   ((v) |= ((x) & (1<<(1<<(n)))-1) << (~(i) << (n)))
! #define P_clrbits_S(v,i,n)      ((v) &= ~( ((1<<(1<<(n)))-1) << (~(i) << (n)) ))
  
  #define P_max(a,b)   ((a) > (b) ? (a) : (b))
  #define P_min(a,b)   ((a) < (b) ? (a) : (b))
--- 352,362 ----
  				   (((~(i))&((1<<(L)-(n))-1)) << (n))) )
  
  /* small packed arrays */
! #define P_getbits_US(v,i,n)     ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1))
! #define P_getbits_SS(v,i,n)     ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n)))))
! #define P_putbits_US(v,i,x,n)   ((v) |= (x) << ((i) << (n)))
! #define P_putbits_SS(v,i,x,n)   ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n)))
! #define P_clrbits_S(v,i,n)      ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) ))
  
  #define P_max(a,b)   ((a) > (b) ? (a) : (b))
  #define P_min(a,b)   ((a) < (b) ? (a) : (b))
diff -c -N -r -s src/p2c.man ../dist/src/p2c.man
*** src/p2c.man	Thu Mar 22 14:27:24 1990
--- ../dist/src/p2c.man	Fri Apr 13 20:58:58 1990
***************
*** 1,7 ****
  .\" p2c  Copyright 1989 Dave Gillespie
  .TH P2C 1 "local"
  .SH NAME
! p2c \- Pascal to C translator, version 1.14
  .SH SYNOPSIS
  .B p2c
  [ options ] [ file [ module ] ]
--- 1,7 ----
  .\" p2c  Copyright 1989 Dave Gillespie
  .TH P2C 1 "local"
  .SH NAME
! p2c \- Pascal to C translator, version 1.15
  .SH SYNOPSIS
  .B p2c
  [ options ] [ file [ module ] ]
diff -c -N -r -s src/p2clib.c ../dist/src/p2clib.c
*** src/p2clib.c	Thu Mar 22 14:27:38 1990
--- ../dist/src/p2clib.c	Fri Apr 13 20:59:15 1990
***************
*** 236,241 ****
--- 236,243 ----
  {
      register char *s2 = s;
  
+     if (!*s)
+ 	return s;
      while (*++s2) ;
      while (s2 > s && Isspace(*--s2))
          *s2 = 0;
***************
*** 474,485 ****
  
  /* Use packed array of char for a file name. */
  
! char *P_trimname(fn, len)
! register char *fn;
  register int len;
  {
!     static char fnbuf[256];
!     register char *cp = fnbuf;
      
      while (--len >= 0 && *fn && !isspace(*fn))
  	*cp++ = *fn++;
--- 476,487 ----
  
  /* Use packed array of char for a file name. */
  
! Char *P_trimname(fn, len)
! register Char *fn;
  register int len;
  {
!     static Char fnbuf[256];
!     register Char *cp = fnbuf;
      
      while (--len >= 0 && *fn && !isspace(*fn))
  	*cp++ = *fn++;
***************
*** 620,626 ****
  {
      register long *sbase = s;
      register int b1, b2, size;
!     if (v1 > v2)
  	return sbase;
      b1 = v1 % SETBITS;
      v1 /= SETBITS;
--- 622,628 ----
  {
      register long *sbase = s;
      register int b1, b2, size;
!     if ((int)v1 > (int)v2)
  	return sbase;
      b1 = v1 % SETBITS;
      v1 /= SETBITS;
***************
*** 709,719 ****
  
  long *P_expset(d, s)                /* d := s */
  register long *d;
! long s;
  {
!     if ((d[1] = s))
!         *d = 1;
!     else
          *d = 0;
      return d;
  }
--- 711,722 ----
  
  long *P_expset(d, s)                /* d := s */
  register long *d;
! register long s;
  {
!     if (s) {
! 	d[1] = s;
! 	*d = 1;
!     } else
          *d = 0;
      return d;
  }
diff -c -N -r -s src/parse.c ../dist/src/parse.c
*** src/parse.c	Thu Mar 22 14:27:30 1990
--- ../dist/src/parse.c	Fri Apr 13 20:59:08 1990
***************
*** 1742,1755 ****
  
  /* Replace all occurrences of one expression with another expression */
  
! Expr *replaceexprexpr(ex, oldex, newex)
  Expr *ex, *oldex, *newex;
  {
      int i;
      Type *type;
  
      for (i = 0; i < ex->nargs; i++)
!         ex->args[i] = replaceexprexpr(ex->args[i], oldex, newex);
      if (exprsame(ex, oldex, 2)) {
          if (ex->val.type->kind == TK_POINTER &&
              ex->val.type->basetype == oldex->val.type) {
--- 1742,1756 ----
  
  /* Replace all occurrences of one expression with another expression */
  
! Expr *replaceexprexpr(ex, oldex, newex, keeptype)
  Expr *ex, *oldex, *newex;
+ int keeptype;
  {
      int i;
      Type *type;
  
      for (i = 0; i < ex->nargs; i++)
!         ex->args[i] = replaceexprexpr(ex->args[i], oldex, newex, keeptype);
      if (exprsame(ex, oldex, 2)) {
          if (ex->val.type->kind == TK_POINTER &&
              ex->val.type->basetype == oldex->val.type) {
***************
*** 1763,1769 ****
  	    type = ex->val.type;
              freeexpr(ex);
              ex = copyexpr(newex);
! 	    ex->val.type = type;
  	    return ex;
          }
      }
--- 1764,1771 ----
  	    type = ex->val.type;
              freeexpr(ex);
              ex = copyexpr(newex);
! 	    if (keeptype)
! 		ex->val.type = type;
  	    return ex;
          }
      }
***************
*** 1779,1789 ****
          replaceexpr(sp->stm1, oldex, newex);
          replaceexpr(sp->stm2, oldex, newex);
          if (sp->exp1)
!             sp->exp1 = replaceexprexpr(sp->exp1, oldex, newex);
          if (sp->exp2)
!             sp->exp2 = replaceexprexpr(sp->exp2, oldex, newex);
          if (sp->exp3)
!             sp->exp3 = replaceexprexpr(sp->exp3, oldex, newex);
          sp = sp->next;
      }
  }
--- 1781,1791 ----
          replaceexpr(sp->stm1, oldex, newex);
          replaceexpr(sp->stm2, oldex, newex);
          if (sp->exp1)
!             sp->exp1 = replaceexprexpr(sp->exp1, oldex, newex, 1);
          if (sp->exp2)
!             sp->exp2 = replaceexprexpr(sp->exp2, oldex, newex, 1);
          if (sp->exp3)
!             sp->exp3 = replaceexprexpr(sp->exp3, oldex, newex, 1);
          sp = sp->next;
      }
  }
***************
*** 1814,1820 ****
           exproccurs(sp->next->exp1->args[1], sp->exp1->args[0]) == 1) {
          sp->next->exp1->args[1] = replaceexprexpr(sp->next->exp1->args[1],
                                                    sp->exp1->args[0],
!                                                   sp->exp1->args[1]);
          if (mp && mp->istemporary)
              canceltempvar(mp);
          return sp->next;
--- 1816,1822 ----
           exproccurs(sp->next->exp1->args[1], sp->exp1->args[0]) == 1) {
          sp->next->exp1->args[1] = replaceexprexpr(sp->next->exp1->args[1],
                                                    sp->exp1->args[0],
!                                                   sp->exp1->args[1], 1);
          if (mp && mp->istemporary)
              canceltempvar(mp);
          return sp->next;
***************
*** 1992,1998 ****
          case EK_NE:                 /* (a<>b) -> c2 */
              if ((c1->kind == EK_NE) == not1) {
                  if (c1->args[0]->kind == EK_VAR) {
!                     ex = replaceexprexpr(copyexpr(c2), c1->args[0], c1->args[1]);
                      i = expr_is_bool(ex, !not2);
                      freeexpr(ex);
                      if (i)
--- 1994,2000 ----
          case EK_NE:                 /* (a<>b) -> c2 */
              if ((c1->kind == EK_NE) == not1) {
                  if (c1->args[0]->kind == EK_VAR) {
!                     ex = replaceexprexpr(copyexpr(c2), c1->args[0], c1->args[1], 1);
                      i = expr_is_bool(ex, !not2);
                      freeexpr(ex);
                      if (i)
***************
*** 1999,2005 ****
                          return 1;
                  }
                  if (c1->args[1]->kind == EK_VAR) {
!                     ex = replaceexprexpr(copyexpr(c2), c1->args[1], c1->args[0]);
                      i = expr_is_bool(ex, !not2);
                      freeexpr(ex);
                      if (i)
--- 2001,2007 ----
                          return 1;
                  }
                  if (c1->args[1]->kind == EK_VAR) {
!                     ex = replaceexprexpr(copyexpr(c2), c1->args[1], c1->args[0], 1);
                      i = expr_is_bool(ex, !not2);
                      freeexpr(ex);
                      if (i)
diff -c -N -r -s src/pexpr.c ../dist/src/pexpr.c
*** src/pexpr.c	Thu Mar 22 14:27:34 1990
--- ../dist/src/pexpr.c	Fri Apr 13 20:59:12 1990
***************
*** 343,349 ****
  	mp = makestmttempvar(ex->val.type, name_SET);
          ex2 = makeexpr(EK_MACARG, 0);
          ex2->val.type = ex->val.type;
! 	ex = replaceexprexpr(ex, ex2, makeexpr_var(mp));
          freeexpr(ex2);
      } else if (mp->kind == MK_CONST &&
                 (mp == mp_false ||
--- 343,349 ----
  	mp = makestmttempvar(ex->val.type, name_SET);
          ex2 = makeexpr(EK_MACARG, 0);
          ex2->val.type = ex->val.type;
! 	ex = replaceexprexpr(ex, ex2, makeexpr_var(mp), 0);
          freeexpr(ex2);
      } else if (mp->kind == MK_CONST &&
                 (mp == mp_false ||
***************
*** 2158,2173 ****
  Expr *ex;
  int env;
  {
!     Expr *ex2, *ex3, **ep;
      Type *type, *type2;
-     Meaning *mp;
      char *cp;
      char sbuf[5];
!     int i;
      Value val;
  
      if (!ex)
          return NULL;
      switch (ex->kind) {
  
          case EK_BICALL:
--- 2158,2173 ----
  Expr *ex;
  int env;
  {
!     Expr *ex2, *ex3;
      Type *type, *type2;
      char *cp;
      char sbuf[5];
!     int i, j;
      Value val;
  
      if (!ex)
          return NULL;
+     if (debug>4) {fprintf(outf, "fixexpr("); dumpexpr(ex); fprintf(outf, ")\n");}
      switch (ex->kind) {
  
          case EK_BICALL:
***************
*** 2208,2213 ****
--- 2208,2267 ----
                  ex = makeexpr_cond(ex->args[0], ex->args[2], ex2);
              } else if (!strcmp(cp, "assert")) {
                  ex->args[0] = fixexpr(ex->args[0], ENV_BOOL);
+ 	    } else if ((!strcmp(cp, setaddname) ||
+ 			!strcmp(cp, setaddrangename)) &&
+ 		       (ex2 = ex->args[0])->kind == EK_BICALL &&
+ 		       (!strcmp(ex2->val.s, setaddname) ||
+ 			!strcmp(ex2->val.s, setaddrangename))) {
+ 		while (ex2->kind == EK_BICALL &&
+ 		       (!strcmp(ex2->val.s, setaddname) ||
+ 			!strcmp(ex2->val.s, setaddrangename) ||
+ 			!strcmp(ex2->val.s, setexpandname)))
+ 		    ex2 = ex2->args[0];
+ 		if (nosideeffects(ex2, 1)) {
+ 		    ex = makeexpr_comma(ex->args[0], ex);
+ 		    ex->args[1]->args[0] = ex2;
+ 		    ex = fixexpr(ex, env);
+ 		} else
+ 		    for (i = 0; i < ex->nargs; i++)
+ 			ex->args[i] = fixexpr(ex->args[i], ENV_EXPR);
+ 	    } else if (!strcmp(cp, setunionname) &&
+ 		       (ex3 = singlevar(ex->args[0])) != NULL &&
+ 		       ((i=1, exprsame(ex->args[0], ex->args[i], 0)) ||
+ 			(i=2, exprsame(ex->args[0], ex->args[i], 0))) &&
+ 		       !exproccurs(ex3, ex->args[3-i]) &&
+ 		       ex->args[3-i]->kind == EK_BICALL &&
+ 		       (!strcmp(ex->args[3-i]->val.s, setaddname) ||
+ 			!strcmp(ex->args[3-i]->val.s, setaddrangename) ||
+ 			(!strcmp(ex->args[3-i]->val.s, setexpandname) &&
+ 			 checkconst(ex->args[3-i]->args[1], 0))) &&
+ 		       totempvar(ex->args[3-i])) {
+ 		if (!strcmp(ex->args[3-i]->val.s, setexpandname)) {
+ 		    ex = grabarg(ex, 0);
+ 		} else {
+ 		    ex = makeexpr_comma(ex, ex->args[3-i]);
+ 		    ex->args[0]->args[3-i] = ex->args[1]->args[0];
+ 		    ex->args[1]->args[0] = copyexpr(ex->args[0]->args[0]);
+ 		}
+ 		ex = fixexpr(ex, env);
+ 	    } else if (!strcmp(cp, setdiffname) && *setremname &&
+ 		       (ex3 = singlevar(ex->args[0])) != NULL &&
+ 		       exprsame(ex->args[0], ex->args[1], 0) &&
+ 		       !exproccurs(ex3, ex->args[2]) &&
+ 		       ex->args[2]->kind == EK_BICALL &&
+ 		       (!strcmp(ex->args[2]->val.s, setaddname) ||
+ 			(!strcmp(ex->args[2]->val.s, setexpandname) &&
+ 			 checkconst(ex->args[2]->args[1], 0))) &&
+ 		       totempvar(ex->args[2])) {
+ 		if (!strcmp(ex->args[2]->val.s, setexpandname)) {
+ 		    ex = grabarg(ex, 0);
+ 		} else {
+ 		    ex = makeexpr_comma(ex, ex->args[2]);
+ 		    ex->args[0]->args[2] = ex->args[1]->args[0];
+ 		    ex->args[1]->args[0] = copyexpr(ex->args[0]->args[0]);
+ 		    strchange(&ex->args[1]->val.s, setremname);
+ 		}
+ 		ex = fixexpr(ex, env);
              } else {
                  for (i = 0; i < ex->nargs; i++)
                      ex->args[i] = fixexpr(ex->args[i], ENV_EXPR);
***************
*** 2241,2246 ****
--- 2295,2301 ----
                          if (env != ENV_STMT)
                              ex = makeexpr_comma(ex, copyexpr(ex->args[1]));
                      }
+ #if 0
  		} else if (!strcmp(cp, setunionname) &&
  			   (ex3 = singlevar(ex->args[0])) != NULL &&
  			   ((i=1, exprsame(ex->args[0], ex->args[i], 0)) ||
***************
*** 2289,2294 ****
--- 2344,2350 ----
  			    ex = ex->args[2];
  			}
  		    }
+ #endif
                  } else if (!strcmp(cp, setexpandname) && env == ENV_STMT &&
                             checkconst(ex->args[1], 0)) {
                      ex = makeexpr_assign(makeexpr_hat(ex->args[0], 0),
***************
*** 2423,2436 ****
              break;
  
          case EK_COMMA:
!             for (i = 0; i < ex->nargs-1; ) {
!                 ex->args[i] = fixexpr(ex->args[i], ENV_STMT);
!                 if (nosideeffects(ex->args[i], 1))
                      delfreearg(&ex, i);
!                 else
                      i++;
              }
-             ex->args[ex->nargs-1] = fixexpr(ex->args[ex->nargs-1], env);
              if (ex->nargs == 1)
                  ex = grabarg(ex, 0);
              break;
--- 2479,2498 ----
              break;
  
          case EK_COMMA:
!             for (i = 0; i < ex->nargs; ) {
! 		j = (i < ex->nargs-1);
!                 ex->args[i] = fixexpr(ex->args[i], j ? ENV_STMT : env);
!                 if (nosideeffects(ex->args[i], 1) && j) {
                      delfreearg(&ex, i);
!                 } else if (ex->args[i]->kind == EK_COMMA) {
! 		    ex2 = ex->args[i];
! 		    ex->args[i++] = ex2->args[0];
! 		    for (j = 1; j < ex2->nargs; j++)
! 			insertarg(&ex, i++, ex2->args[j]);
! 		    FREE(ex2);
! 		} else
                      i++;
              }
              if (ex->nargs == 1)
                  ex = grabarg(ex, 0);
              break;
***************
*** 2470,2475 ****
--- 2532,2538 ----
                  ex->args[i] = fixexpr(ex->args[i], ENV_EXPR);
              break;
      }
+     if (debug>4) {fprintf(outf, "fixexpr returns "); dumpexpr(ex); fprintf(outf, "\n");}
      return fix_expression(ex, env);
  }
  
Files src/string.pas and ../dist/src/string.pas are identical
Files src/stuff.c and ../dist/src/stuff.c are identical
diff -c -N -r -s src/sys.p2crc ../dist/src/sys.p2crc
*** src/sys.p2crc	Thu Mar 22 14:27:26 1990
--- ../dist/src/sys.p2crc	Fri Apr 13 20:59:02 1990
***************
*** 1,4 ****
! # Standard configuration file for "p2c" 1.14, the Pascal to C translator
  #  Copyright (C) 1989 David Gillespie.
  #  Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  
--- 1,4 ----
! # Standard configuration file for "p2c" 1.15, the Pascal to C translator
  #  Copyright (C) 1989 David Gillespie.
  #  Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  
***************
*** 412,417 ****
--- 412,429 ----
  
  OpBreakExtraPenalty             # Additional penalty multiplied by nesting
                                  # level of the operator.  Default=20.
+ 
+ LogBreakPenalty			# Penalty for breaking at an && or || operator.
+ 				# Default=5.
+ 
+ LogBreakExtraPenalty		# Additional penalty multiplied by nesting
+ 				# level of the logical operator.  Default=1.
+ 
+ LogBreakPenalty			# Penalty for breaking at a relational
+ 				# operator.  Default=20.
+ 
+ LogBreakExtraPenalty		# Additional penalty multiplied by nesting
+ 				# level of the relational op.  Default=10.
  
  ExHyphenPenalty                 # Additional penalty for breaking a line just
                                  # after a minus sign.  Default=10.  :-)
Files src/system.imp and ../dist/src/system.imp are identical
Files src/system.m2 and ../dist/src/system.m2 are identical
Files src/trans.c and ../dist/src/trans.c are identical
diff -c -N -r -s src/trans.h ../dist/src/trans.h
*** src/trans.h	Thu Mar 22 14:27:40 1990
--- ../dist/src/trans.h	Fri Apr 13 20:59:22 1990
***************
*** 1,4 ****
! /* "p2c", a Pascal to C translator, version 1.14.
     Copyright (C) 1989 David Gillespie.
     Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  
--- 1,4 ----
! /* "p2c", a Pascal to C translator, version 1.15.
     Copyright (C) 1989 David Gillespie.
     Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  
***************
*** 134,140 ****
  extern char *p2c_home;
  #endif
  
! #define P2C_VERSION  "1.14"
  
  
  
--- 134,140 ----
  extern char *p2c_home;
  #endif
  
! #define P2C_VERSION  "1.15"
  
  
  
***************
*** 1064,1069 ****
--- 1064,1071 ----
  extern double assignbreakpenalty, assignbreakextrapenalty;
  extern double specialargbreakpenalty;
  extern double opbreakpenalty, opbreakextrapenalty, exhyphenpenalty;
+ extern double logbreakpenalty, logbreakextrapenalty;
+ extern double relbreakpenalty, relbreakextrapenalty;
  extern double morebreakpenalty, morebreakextrapenalty;
  extern double parenbreakpenalty, parenbreakextrapenalty;
  extern double qmarkbreakpenalty, qmarkbreakextrapenalty;
***************
*** 1253,1258 ****
--- 1255,1264 ----
      'R', 'V', "SPECIALARGBREAKPENALTY",(anyptr) &specialargbreakpenalty,   500,
      'R', 'V', "OPBREAKPENALTY",        (anyptr) &opbreakpenalty,          2500,
      'R', 'V', "OPBREAKEXTRAPENALTY",   (anyptr) &opbreakextrapenalty,     2000,
+     'R', 'V', "LOGBREAKPENALTY",       (anyptr) &logbreakpenalty,          500,
+     'R', 'V', "LOGBREAKEXTRAPENALTY",  (anyptr) &logbreakextrapenalty,     100,
+     'R', 'V', "RELBREAKPENALTY",       (anyptr) &relbreakpenalty,         2000,
+     'R', 'V', "RELBREAKEXTRAPENALTY",  (anyptr) &relbreakextrapenalty,    1000,
      'R', 'V', "EXHYPHENPENALTY",       (anyptr) &exhyphenpenalty,         1000,
      'R', 'V', "MOREBREAKPENALTY",      (anyptr) &morebreakpenalty,        -500,
      'R', 'V', "MOREBREAKEXTRAPENALTY", (anyptr) &morebreakextrapenalty,   -300,
Files src/turbo.imp and ../dist/src/turbo.imp are identical

exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.