parameterize number of digits in the exponent of real numbers
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 9 Apr 1983 07:45:20 +0000 (23:45 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 9 Apr 1983 07:45:20 +0000 (23:45 -0800)
SCCS-vsn: usr.bin/pascal/src/proc.c 1.18
SCCS-vsn: usr.bin/pascal/src/pcproc.c 1.21

usr/src/usr.bin/pascal/src/pcproc.c
usr/src/usr.bin/pascal/src/proc.c

index d7084c6..daeb13a 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)pcproc.c 1.20 %G%";
+static char sccsid[] = "@(#)pcproc.c 1.21 %G%";
 
 #include "whoami.h"
 #ifdef PC
 
 #include "whoami.h"
 #ifdef PC
@@ -16,6 +16,9 @@ static        char sccsid[] = "@(#)pcproc.c 1.20 %G%";
 #include "tmps.h"
 
 /*
 #include "tmps.h"
 
 /*
+ * The constant EXPOSIZE specifies the number of digits in the exponent
+ * of real numbers.
+ *
  * The constant REALSPC defines the amount of forced padding preceeding
  * real numbers when they are printed. If REALSPC == 0, then no padding
  * is added, REALSPC == 1 adds one extra blank irregardless of the width
  * The constant REALSPC defines the amount of forced padding preceeding
  * real numbers when they are printed. If REALSPC == 0, then no padding
  * is added, REALSPC == 1 adds one extra blank irregardless of the width
@@ -23,7 +26,8 @@ static        char sccsid[] = "@(#)pcproc.c 1.20 %G%";
  *
  * N.B. - Values greater than one require program mods.
  */
  *
  * N.B. - Values greater than one require program mods.
  */
-#define        REALSPC 0
+#define EXPOSIZE       2
+#define        REALSPC         0
 
 /*
  * The following array is used to determine which classes may be read
 
 /*
  * The following array is used to determine which classes may be read
@@ -482,8 +486,8 @@ pcproc(r)
                             tdouble:
                                switch (fmtspec) {
                                case NIL:
                             tdouble:
                                switch (fmtspec) {
                                case NIL:
-                                       field = 21;
-                                       prec = 14;
+                                       field = 14 + (5 + EXPOSIZE);
+                                       prec = field - (5 + EXPOSIZE);
                                        fmt = 'e';
                                        fmtspec = CONWIDTH + CONPREC;
                                        break;
                                        fmt = 'e';
                                        fmtspec = CONWIDTH + CONPREC;
                                        break;
@@ -491,7 +495,7 @@ pcproc(r)
                                        field -= REALSPC;
                                        if (field < 1)
                                                field = 1;
                                        field -= REALSPC;
                                        if (field < 1)
                                                field = 1;
-                                       prec = field - 7;
+                                       prec = field - (5 + EXPOSIZE);
                                        if (prec < 1)
                                                prec = 1;
                                        fmtspec += CONPREC;
                                        if (prec < 1)
                                                prec = 1;
                                        fmtspec += CONPREC;
@@ -685,7 +689,9 @@ pcproc(r)
                                                tempnlp -> extra_flags ,
                                                P2INT );
                                            tmpfree(&soffset);
                                                tempnlp -> extra_flags ,
                                                P2INT );
                                            tmpfree(&soffset);
-                                           putleaf( P2ICON , 7 + REALSPC , 0 , P2INT , 0 );
+                                           putleaf( P2ICON ,
+                                               5 + EXPOSIZE + REALSPC ,
+                                               0 , P2INT , 0 );
                                            putop( P2LISTOP , P2INT );
                                            putleaf( P2ICON , 1 , 0 , P2INT , 0 );
                                            putop( P2LISTOP , P2INT );
                                            putop( P2LISTOP , P2INT );
                                            putleaf( P2ICON , 1 , 0 , P2INT , 0 );
                                            putop( P2LISTOP , P2INT );
index b33ecfe..b274c53 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)proc.c 1.17 %G%";
+static char sccsid[] = "@(#)proc.c 1.18 %G%";
 
 #include "whoami.h"
 #ifdef OBJ
 
 #include "whoami.h"
 #ifdef OBJ
@@ -14,6 +14,9 @@ static char sccsid[] = "@(#)proc.c 1.17 %G%";
 #include "tmps.h"
 
 /*
 #include "tmps.h"
 
 /*
+ * The constant EXPOSIZE specifies the number of digits in the exponent
+ * of real numbers.
+ *
  * The constant REALSPC defines the amount of forced padding preceeding
  * real numbers when they are printed. If REALSPC == 0, then no padding
  * is added, REALSPC == 1 adds one extra blank irregardless of the width
  * The constant REALSPC defines the amount of forced padding preceeding
  * real numbers when they are printed. If REALSPC == 0, then no padding
  * is added, REALSPC == 1 adds one extra blank irregardless of the width
@@ -21,7 +24,8 @@ static char sccsid[] = "@(#)proc.c 1.17 %G%";
  *
  * N.B. - Values greater than one require program mods.
  */
  *
  * N.B. - Values greater than one require program mods.
  */
-#define        REALSPC 0
+#define EXPOSIZE       2
+#define        REALSPC         0
 
 /*
  * The following array is used to determine which classes may be read
 
 /*
  * The following array is used to determine which classes may be read
@@ -424,12 +428,8 @@ proc(r)
                             tdouble:
                                switch (fmtspec) {
                                case NIL:
                             tdouble:
                                switch (fmtspec) {
                                case NIL:
-#                                      ifdef DEC11
-                                           field = 21;
-#                                      else
-                                           field = 22;
-#                                      endif DEC11
-                                       prec = 14;
+                                       field = 14 + (5 + EXPOSIZE);
+                                       prec = field - (5 + EXPOSIZE);
                                        fmt = 'e';
                                        fmtspec = CONWIDTH + CONPREC;
                                        break;
                                        fmt = 'e';
                                        fmtspec = CONWIDTH + CONPREC;
                                        break;
@@ -437,11 +437,7 @@ proc(r)
                                        field -= REALSPC;
                                        if (field < 1)
                                                field = 1;
                                        field -= REALSPC;
                                        if (field < 1)
                                                field = 1;
-#                                      ifdef DEC11
-                                           prec = field - 7;
-#                                      else
-                                           prec = field - 8;
-#                                      endif DEC11
+                                       prec = field - (5 + EXPOSIZE);
                                        if (prec < 1)
                                                prec = 1;
                                        fmtspec += CONPREC;
                                        if (prec < 1)
                                                prec = 1;
                                        fmtspec += CONPREC;
@@ -544,11 +540,8 @@ proc(r)
                                                put(1, O_AS4);
                                                put(2, O_RV4 | cbn << 8 + INDX,
                                                    tempnlp -> value[NL_OFFS] );
                                                put(1, O_AS4);
                                                put(2, O_RV4 | cbn << 8 + INDX,
                                                    tempnlp -> value[NL_OFFS] );
-#                                              ifdef DEC11
-                                                   put(3, O_MAX, 7 + REALSPC, 1);
-#                                              else
-                                                   put(3, O_MAX, 8 + REALSPC, 1);
-#                                              endif DEC11
+                                               put(3, O_MAX,
+                                                   5 + EXPOSIZE + REALSPC, 1);
                                                convert(nl+T4INT, INT_TYP);
                                                stkcnt += sizeof(int);
                                                put(2, O_RV4 | cbn << 8 + INDX, 
                                                convert(nl+T4INT, INT_TYP);
                                                stkcnt += sizeof(int);
                                                put(2, O_RV4 | cbn << 8 + INDX,