This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Constify libdecnumber


 > > wild.  This patch constifies the string patameters, I'll do other
 > > types next.
 > > 
 > > Bootstrapped on sparc-sun-solaris2.10, okay for mainline?
 > 
 > OK.
 > Thanks, Ben

Thanks, installed.

Here are the "other types" I promised.  Turned out to be larger than I
hoped, however it should be relatively safe.  In almost completely all
the cases, I'm only adding the "const" keyword.  There's exactly one
case where I had to change code.  It occured where a const parameter
was assigned new storage and written to.  Instead, I had to use a temp
variable to assign the storage, write to it, *then* assign it to the
const parameter.  It's a relatively simple substitution, search for
"newlhs" below.

Tested on sparc-sun-solaris2.10, no regressions.  Also I tested the
code further by resetting the macros DECSUBSET, DECCHECK, DECALLOC and
DECTRACE to "1" to enable compilation of conditional code bits.  These
parts also compiled cleanly.  Furthermore, I added -Wcast-qual to get
additional assurance the code was okay.  I decided to leave in that
warning flag since it comes back clean.

Okay for mainline?

		Thanks,
		--Kaveh




2006-08-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
	* configure, config.in: Regenerate.

	* decContext.c (decContextStatusToString): Constify.
	* decContext.h (decContextStatusToString): Likewise.
	* decNumber.c (decNumberToString, decNumberToEngString,
	decNumberAbs, decNumberAdd, decNumberCompare, decNumberDivide,
	decNumberDivideInteger, decNumberMax, decNumberMin,
	decNumberMinus, decNumberPlus, decNumberMultiply,
	decNumberNormalize, decNumberPower, decNumberQuantize,
	decNumberRescale, decNumberRemainder, decNumberRemainderNear,
	decNumberSameQuantum, decNumberSquareRoot, decNumberSubtract,
	decNumberToIntegralValue, decNumberCopy, decToString, decAddOp,
	decDivideOp, decMultiplyOp, decQuantizeOp, decCompareOp,
	decCompare, decUnitCompare, decUnitAddSub, decRoundOperand,
	decCopyFit, decSetCoeff, decSetSubnormal, decGetInt, decNaNs,
	decGetDigits, decNumberShow, decDumpAr, decCheckOperands,
	decCheckNumber): Likewise.
	* decNumber.h (decNumberToString, decNumberToEngString,
	decNumberAbs, decNumberAdd, decNumberCompare, decNumberDivide,
	decNumberDivideInteger, decNumberMax, decNumberMin,
	decNumberMinus, decNumberMultiply, decNumberNormalize,
	decNumberPlus, decNumberPower, decNumberQuantize,
	decNumberRemainder, decNumberRemainderNear, decNumberRescale,
	decNumberSameQuantum, decNumberSquareRoot, decNumberSubtract,
	decNumberToIntegralValue, decNumberCopy): Likewise.
	* decUtility.c (decDensePackCoeff, decDenseUnpackCoeff):
	Likewise.
	* decUtility.h (decDensePackCoeff, decDenseUnpackCoeff):
	Likewise.
	* decimal128.c (decimal128FromNumber, decimal128ToNumber,
	decimal128ToString, decimal128ToEngString, decimal128Show):
	Likewise.
	* decimal128.h (decimal128ToString, decimal128ToEngString,
	decimal128FromNumber, decimal128ToNumber): Likewise.
	* decimal32.c (decimal32FromNumber, decimal32ToNumber,
	decimal32ToString, decimal32ToEngString, decimal32Show):
	Likewise.
	* decimal32.h (decimal32ToString, decimal32ToEngString,
	decimal32FromNumber, decimal32ToNumber): Likewise.
	* decimal64.c (decimal64FromNumber, decimal64ToNumber,
	decimal64ToString, decimal64ToEngString, decimal64Show):
	Likewise.
	* decimal64.h (decimal64ToString, decimal64ToEngString,
	decimal64FromNumber, decimal64ToNumber): Likewise.

diff -rup orig/egcc-SVN20060820/libdecnumber/configure.ac egcc-SVN20060820/libdecnumber/configure.ac
--- orig/egcc-SVN20060820/libdecnumber/configure.ac	2006-01-22 23:25:41.000000000 -0500
+++ egcc-SVN20060820/libdecnumber/configure.ac	2006-08-20 23:00:59.785466643 -0400
@@ -40,7 +40,7 @@ AC_CHECK_PROGS([AUTOHEADER], [autoheader
 
 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
 			  -Wmissing-prototypes -Wold-style-definition \
-			  -Wmissing-format-attribute])
+			  -Wmissing-format-attribute -Wcast-qual])
 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
 
 # Only enable with --enable-werror-always until existing warnings are
diff -rup orig/egcc-SVN20060820/libdecnumber/decContext.c egcc-SVN20060820/libdecnumber/decContext.c
--- orig/egcc-SVN20060820/libdecnumber/decContext.c	2006-08-20 22:02:53.264220149 -0400
+++ egcc-SVN20060820/libdecnumber/decContext.c	2006-08-20 22:02:47.672399910 -0400
@@ -109,7 +109,7 @@ decContextDefault (decContext * context,
 /*    (or no) flags are set, a generic constant message is returned.  */
 /* ------------------------------------------------------------------ */
 const char *
-decContextStatusToString (decContext * context)
+decContextStatusToString (const decContext * context)
 {
   Int status = context->status;
   if (status == DEC_Conversion_syntax)
diff -rup orig/egcc-SVN20060820/libdecnumber/decContext.h egcc-SVN20060820/libdecnumber/decContext.h
--- orig/egcc-SVN20060820/libdecnumber/decContext.h	2006-08-20 22:02:53.265247445 -0400
+++ egcc-SVN20060820/libdecnumber/decContext.h	2006-08-20 22:51:47.911130244 -0400
@@ -172,7 +172,7 @@ typedef struct
 #endif
 decContext *decContextDefault (decContext *, int32_t);
 decContext *decContextSetStatus (decContext *, uint32_t);
-const char *decContextStatusToString (decContext *);
+const char *decContextStatusToString (const decContext *);
 decContext *decContextSetStatusFromString (decContext *, const char *);
 
 #endif
diff -rup orig/egcc-SVN20060820/libdecnumber/decNumber.c egcc-SVN20060820/libdecnumber/decNumber.c
--- orig/egcc-SVN20060820/libdecnumber/decNumber.c	2006-08-20 22:02:53.274926153 -0400
+++ egcc-SVN20060820/libdecnumber/decNumber.c	2006-08-20 22:48:42.646632710 -0400
@@ -206,29 +206,30 @@ typedef unsigned long long uLong;
 #endif
 
 /* Local routines */
-static decNumber *decAddOp (decNumber *, decNumber *, decNumber *,
-			    decContext *, uByte, uInt *);
+static decNumber *decAddOp (decNumber *, const decNumber *,
+			    const decNumber *, decContext *,
+			    uByte, uInt *);
 static void decApplyRound (decNumber *, decContext *, Int, uInt *);
-static Int decCompare (decNumber * lhs, decNumber * rhs);
-static decNumber *decCompareOp (decNumber *, decNumber *, decNumber *,
+static Int decCompare (const decNumber * lhs, const decNumber * rhs);
+static decNumber *decCompareOp (decNumber *, const decNumber *, const decNumber *,
 				decContext *, Flag, uInt *);
-static void decCopyFit (decNumber *, decNumber *, decContext *,
+static void decCopyFit (decNumber *, const decNumber *, decContext *,
 			Int *, uInt *);
-static decNumber *decDivideOp (decNumber *, decNumber *, decNumber *,
+static decNumber *decDivideOp (decNumber *, const decNumber *, const decNumber *,
 			       decContext *, Flag, uInt *);
 static void decFinalize (decNumber *, decContext *, Int *, uInt *);
-static Int decGetDigits (Unit *, Int);
+static Int decGetDigits (const Unit *, Int);
 #if DECSUBSET
-static Int decGetInt (decNumber *, decContext *);
+static Int decGetInt (const decNumber *, decContext *);
 #else
-static Int decGetInt (decNumber *);
+static Int decGetInt (const decNumber *);
 #endif
-static decNumber *decMultiplyOp (decNumber *, decNumber *, decNumber *,
-				 decContext *, uInt *);
-static decNumber *decNaNs (decNumber *, decNumber *, decNumber *, uInt *);
-static decNumber *decQuantizeOp (decNumber *, decNumber *, decNumber *,
-				 decContext *, Flag, uInt *);
-static void decSetCoeff (decNumber *, decContext *, Unit *,
+static decNumber *decMultiplyOp (decNumber *, const decNumber *,
+				 const decNumber *, decContext *, uInt *);
+static decNumber *decNaNs (decNumber *, const decNumber *, const decNumber *, uInt *);
+static decNumber *decQuantizeOp (decNumber *, const decNumber *,
+				 const decNumber *, decContext *, Flag, uInt *);
+static void decSetCoeff (decNumber *, decContext *, const Unit *,
 			 Int, Int *, uInt *);
 static void decSetOverflow (decNumber *, decContext *, uInt *);
 static void decSetSubnormal (decNumber *, decContext *, Int *, uInt *);
@@ -236,17 +237,17 @@ static Int decShiftToLeast (Unit *, Int,
 static Int decShiftToMost (Unit *, Int, Int);
 static void decStatus (decNumber *, uInt, decContext *);
 static Flag decStrEq (const char *, const char *);
-static void decToString (decNumber *, char[], Flag);
+static void decToString (const decNumber *, char[], Flag);
 static decNumber *decTrim (decNumber *, Flag, Int *);
-static Int decUnitAddSub (Unit *, Int, Unit *, Int, Int, Unit *, Int);
-static Int decUnitCompare (Unit *, Int, Unit *, Int, Int);
+static Int decUnitAddSub (const Unit *, Int, const Unit *, Int, Int, Unit *, Int);
+static Int decUnitCompare (const Unit *, Int, const Unit *, Int, Int);
 
 #if !DECSUBSET
 /* decFinish == decFinalize when no subset arithmetic needed */
 #define decFinish(a,b,c,d) decFinalize(a,b,c,d)
 #else
 static void decFinish (decNumber *, decContext *, Int *, uInt *);
-static decNumber *decRoundOperand (decNumber *, decContext *, uInt *);
+static decNumber *decRoundOperand (const decNumber *, decContext *, uInt *);
 #endif
 
 /* Diagnostic macros, etc. */
@@ -275,15 +276,15 @@ uInt decAllocBytes = 0;		/* count of byt
 /* fastest routines (and adds 600+ bytes), so should not normally be */
 /* used in 'production'. */
 #define DECUNUSED (void *)(0xffffffff)
-static Flag decCheckOperands (decNumber *, decNumber *, decNumber *,
-			      decContext *);
-static Flag decCheckNumber (decNumber *, decContext *);
+static Flag decCheckOperands (decNumber *, const decNumber *,
+			      const decNumber *, decContext *);
+static Flag decCheckNumber (const decNumber *, decContext *);
 #endif
 
 #if DECTRACE || DECCHECK
 /* Optional trace/debugging routines. */
-void decNumberShow (decNumber *);	/* displays the components of a number */
-static void decDumpAr (char, Unit *, Int);
+void decNumberShow (const decNumber *);	/* displays the components of a number */
+static void decDumpAr (char, const Unit *, Int);
 #endif
 
 /* ================================================================== */
@@ -305,14 +306,14 @@ static void decDumpAr (char, Unit *, Int
 /*  No error is possible, and no status can be set.                   */
 /* ------------------------------------------------------------------ */
 char *
-decNumberToString (decNumber * dn, char *string)
+decNumberToString (const decNumber * dn, char *string)
 {
   decToString (dn, string, 0);
   return string;
 }
 
 char *
-decNumberToEngString (decNumber * dn, char *string)
+decNumberToEngString (const decNumber * dn, char *string)
 {
   decToString (dn, string, 1);
   return string;
@@ -640,7 +641,7 @@ decNumberFromString (decNumber * dn, con
 /* in which case it has the same effect as decNumberMinus.            */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberAbs (decNumber * res, decNumber * rhs, decContext * set)
+decNumberAbs (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decNumber dzero;		/* for 0 */
   uInt status = 0;		/* accumulator */
@@ -672,8 +673,8 @@ decNumberAbs (decNumber * res, decNumber
 /* ------------------------------------------------------------------ */
 /* This just calls the routine shared with Subtract                   */
 decNumber *
-decNumberAdd (decNumber * res, decNumber * lhs, decNumber * rhs,
-	      decContext * set)
+decNumberAdd (decNumber * res, const decNumber * lhs,
+	      const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decAddOp (res, lhs, rhs, set, 0, &status);
@@ -695,8 +696,8 @@ decNumberAdd (decNumber * res, decNumber
 /* C must have space for one digit.                                   */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberCompare (decNumber * res, decNumber * lhs, decNumber * rhs,
-		  decContext * set)
+decNumberCompare (decNumber * res, const decNumber * lhs,
+		  const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decCompareOp (res, lhs, rhs, set, COMPARE, &status);
@@ -718,8 +719,8 @@ decNumberCompare (decNumber * res, decNu
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberDivide (decNumber * res, decNumber * lhs,
-		 decNumber * rhs, decContext * set)
+decNumberDivide (decNumber * res, const decNumber * lhs,
+		 const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decDivideOp (res, lhs, rhs, set, DIVIDE, &status);
@@ -741,8 +742,8 @@ decNumberDivide (decNumber * res, decNum
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberDivideInteger (decNumber * res, decNumber * lhs,
-			decNumber * rhs, decContext * set)
+decNumberDivideInteger (decNumber * res, const decNumber * lhs,
+			const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decDivideOp (res, lhs, rhs, set, DIVIDEINT, &status);
@@ -764,8 +765,8 @@ decNumberDivideInteger (decNumber * res,
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberMax (decNumber * res, decNumber * lhs, decNumber * rhs,
-	      decContext * set)
+decNumberMax (decNumber * res, const decNumber * lhs,
+	      const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decCompareOp (res, lhs, rhs, set, COMPMAX, &status);
@@ -787,8 +788,8 @@ decNumberMax (decNumber * res, decNumber
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberMin (decNumber * res, decNumber * lhs, decNumber * rhs,
-	      decContext * set)
+decNumberMin (decNumber * res, const decNumber * lhs,
+	      const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decCompareOp (res, lhs, rhs, set, COMPMIN, &status);
@@ -811,7 +812,7 @@ decNumberMin (decNumber * res, decNumber
 /* We simply use AddOp for the subtract, which will do the necessary. */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberMinus (decNumber * res, decNumber * rhs, decContext * set)
+decNumberMinus (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decNumber dzero;
   uInt status = 0;		/* accumulator */
@@ -845,7 +846,7 @@ decNumberMinus (decNumber * res, decNumb
 /* check operands and apply rounding and overflow/underflow testing.  */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberPlus (decNumber * res, decNumber * rhs, decContext * set)
+decNumberPlus (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decNumber dzero;
   uInt status = 0;		/* accumulator */
@@ -876,8 +877,8 @@ decNumberPlus (decNumber * res, decNumbe
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberMultiply (decNumber * res, decNumber * lhs,
-		   decNumber * rhs, decContext * set)
+decNumberMultiply (decNumber * res, const decNumber * lhs,
+		   const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decMultiplyOp (res, lhs, rhs, set, &status);
@@ -898,7 +899,7 @@ decNumberMultiply (decNumber * res, decN
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberNormalize (decNumber * res, decNumber * rhs, decContext * set)
+decNumberNormalize (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decNumber *allocrhs = NULL;	/* non-NULL if rounded rhs allocated */
   uInt status = 0;		/* as usual */
@@ -963,13 +964,13 @@ decNumberNormalize (decNumber * res, dec
 /* Specification restriction: abs(n) must be <=999999999              */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberPower (decNumber * res, decNumber * lhs,
-		decNumber * rhs, decContext * set)
+decNumberPower (decNumber * res, const decNumber * lhs,
+		const decNumber * rhs, decContext * set)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
   decNumber *allocrhs = NULL;	/* .., rhs */
   decNumber *allocdac = NULL;	/* -> allocated acc buffer, iff used */
-  decNumber *inrhs = rhs;	/* save original rhs */
+  const decNumber *inrhs = rhs;	/* save original rhs */
   Int reqdigits = set->digits;	/* requested DIGITS */
   Int n;			/* RHS in binary */
   Int i;			/* work */
@@ -1116,6 +1117,7 @@ decNumberPower (decNumber * res, decNumb
       /* we'll invert the lhs now rather than inverting the result later */
       if (decNumberIsNegative (rhs))
 	{			/* was a **-n [hence digits>0] */
+	  decNumber * newlhs;
 	  decNumberCopy (&dnOne, dac);	/* dnOne=1;  [needed now or later] */
 #if DECSUBSET
 	  if (set->extended)
@@ -1137,13 +1139,14 @@ decNumberPower (decNumber * res, decNumb
 		      status |= DEC_Insufficient_storage;
 		      break;
 		    }
-		  lhs = alloclhs;	/* use the allocated space */
+		  newlhs = alloclhs;	/* use the allocated space */
 		}
 	      else
-		lhs = (decNumber *) lhsbuff;	/* use stack storage */
+		newlhs = (decNumber *) lhsbuff;	/* use stack storage */
 	      /* [lhs now points to buffer or allocated storage] */
-	      decNumberCopy (lhs, dac);	/* copy the 1/lhs */
+	      decNumberCopy (newlhs, dac);	/* copy the 1/lhs */
 	      decNumberCopy (dac, &dnOne);	/* restore acc=1 */
+	      lhs = newlhs;
 #if DECSUBSET
 	    }
 #endif
@@ -1248,8 +1251,8 @@ decNumberPower (decNumber * res, decNumb
 /* after the operation is guaranteed to be equal to that of B.        */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberQuantize (decNumber * res, decNumber * lhs,
-		   decNumber * rhs, decContext * set)
+decNumberQuantize (decNumber * res, const decNumber * lhs,
+		   const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decQuantizeOp (res, lhs, rhs, set, 1, &status);
@@ -1277,8 +1280,8 @@ decNumberQuantize (decNumber * res, decN
 /* after the operation is guaranteed to be equal to B.                */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberRescale (decNumber * res, decNumber * lhs,
-		  decNumber * rhs, decContext * set)
+decNumberRescale (decNumber * res, const decNumber * lhs,
+		  const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decQuantizeOp (res, lhs, rhs, set, 0, &status);
@@ -1300,8 +1303,8 @@ decNumberRescale (decNumber * res, decNu
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberRemainder (decNumber * res, decNumber * lhs,
-		    decNumber * rhs, decContext * set)
+decNumberRemainder (decNumber * res, const decNumber * lhs,
+		    const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decDivideOp (res, lhs, rhs, set, REMAINDER, &status);
@@ -1323,8 +1326,8 @@ decNumberRemainder (decNumber * res, dec
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberRemainderNear (decNumber * res, decNumber * lhs,
-			decNumber * rhs, decContext * set)
+decNumberRemainderNear (decNumber * res, const decNumber * lhs,
+			const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
   decDivideOp (res, lhs, rhs, set, REMNEAR, &status);
@@ -1343,7 +1346,7 @@ decNumberRemainderNear (decNumber * res,
 /* No errors are possible and no context is needed.                   */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberSameQuantum (decNumber * res, decNumber * lhs, decNumber * rhs)
+decNumberSameQuantum (decNumber * res, const decNumber * lhs, const decNumber * rhs)
 {
   uByte merged;			/* merged flags */
   Unit ret = 0;			/* return value */
@@ -1440,7 +1443,7 @@ decNumberSameQuantum (decNumber * res, d
 /* end sqrt                                                           */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberSquareRoot (decNumber * res, decNumber * rhs, decContext * set)
+decNumberSquareRoot (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decContext workset, approxset;	/* work contexts */
   decNumber dzero;		/* used for constant zero */
@@ -1781,8 +1784,8 @@ decNumberSquareRoot (decNumber * res, de
 /* C must have space for set->digits digits.                          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberSubtract (decNumber * res, decNumber * lhs,
-		   decNumber * rhs, decContext * set)
+decNumberSubtract (decNumber * res, const decNumber * lhs,
+		   const decNumber * rhs, decContext * set)
 {
   uInt status = 0;		/* accumulator */
 
@@ -1810,7 +1813,7 @@ decNumberSubtract (decNumber * res, decN
 /* the digits setting is ignored.                                     */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberToIntegralValue (decNumber * res, decNumber * rhs, decContext * set)
+decNumberToIntegralValue (decNumber * res, const decNumber * rhs, decContext * set)
 {
   decNumber dn;
   decContext workset;		/* working context */
@@ -1860,7 +1863,7 @@ decNumberToIntegralValue (decNumber * re
 /* so special values are unchanged and no error is possible.          */
 /* ------------------------------------------------------------------ */
 decNumber *
-decNumberCopy (decNumber * dest, decNumber * src)
+decNumberCopy (decNumber * dest, const decNumber * src)
 {
 
 #if DECCHECK
@@ -1881,7 +1884,8 @@ decNumberCopy (decNumber * dest, decNumb
   dest->lsu[0] = src->lsu[0];
   if (src->digits > DECDPUN)
     {				/* more Units to come */
-      Unit *s, *d, *smsup;	/* work */
+      Unit *d;			/* work */
+      const Unit *s, *smsup;	/* work */
       /* memcpy for the remaining Units would be safe as they cannot */
       /* overlap.  However, this explicit loop is faster in short cases. */
       d = dest->lsu + 1;	/* -> first destination */
@@ -1987,14 +1991,14 @@ decNumberZero (decNumber * dn)
   }
 
 static void
-decToString (decNumber * dn, char *string, Flag eng)
+decToString (const decNumber * dn, char *string, Flag eng)
 {
   Int exp = dn->exponent;	/* local copy */
   Int e;			/* E-part value */
   Int pre;			/* digits before the '.' */
   Int cut;			/* for counting digits in a Unit */
   char *c = string;		/* work [output pointer] */
-  Unit *up = dn->lsu + D2U (dn->digits) - 1;	/* -> msu [input pointer] */
+  const Unit *up = dn->lsu + D2U (dn->digits) - 1;	/* -> msu [input pointer] */
   uInt u, pow;			/* work */
 
 #if DECCHECK
@@ -2214,8 +2218,8 @@ decToString (decNumber * dn, char *strin
 /* to make returning as fast as possible, by flagging any allocation. */
 /* ------------------------------------------------------------------ */
 static decNumber *
-decAddOp (decNumber * res, decNumber * lhs,
-	  decNumber * rhs, decContext * set, uByte negate, uInt * status)
+decAddOp (decNumber * res, const decNumber * lhs,
+	  const decNumber * rhs, decContext * set, uByte negate, uInt * status)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
   decNumber *allocrhs = NULL;	/* .., rhs */
@@ -2439,7 +2443,7 @@ decAddOp (decNumber * res, decNumber * l
 	  Flag swapped = 0;
 	  if (padding < 0)
 	    {			/* LHS needs the padding */
-	      decNumber *t;
+	      const decNumber *t;
 	      padding = -padding;	/* will be +ve */
 	      bits = (uByte) (rhs->bits ^ negate);	/* assumed sign is now that of RHS */
 	      t = lhs;
@@ -2692,7 +2696,7 @@ decAddOp (decNumber * res, decNumber * l
 /* ------------------------------------------------------------------ */
 static decNumber *
 decDivideOp (decNumber * res,
-	     decNumber * lhs, decNumber * rhs,
+	     const decNumber * lhs, const decNumber * rhs,
 	     decContext * set, Flag op, uInt * status)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
@@ -2709,12 +2713,13 @@ decDivideOp (decNumber * res,
   Unit *var1 = varbuff;		/* -> var1 array for long subtraction */
   Unit *varalloc = NULL;	/* -> allocated buffer, iff used */
 
-  Unit *var2;			/* -> var2 array */
+  const Unit *var2;		/* -> var2 array */
 
   Int var1units, var2units;	/* actual lengths */
   Int var2ulen;			/* logical length (units) */
   Int var1initpad = 0;		/* var1 initial padding (digits) */
-  Unit *msu1, *msu2;		/* -> msu of each var */
+  Unit *msu1;			/* -> msu of each var */
+  const Unit *msu2;		/* -> msu of each var */
   Int msu2plus;			/* msu2 plus one [does not vary] */
   eInt msu2pair;		/* msu2 pair plus one [does not vary] */
   Int maxdigits;		/* longest LHS or required acc length */
@@ -2726,7 +2731,8 @@ decDivideOp (decNumber * res,
   Int maxexponent = 0;		/* DIVIDE maximum exponent if unrounded */
   uByte bits;			/* working sign */
   uByte merged;			/* merged flags */
-  Unit *target, *source;	/* work */
+  Unit *target;			/* work */
+  const Unit *source;		/* work */
   uInt const *pow;		/* .. */
   Int shift, cut;		/* .. */
 #if DECSUBSET
@@ -3049,7 +3055,8 @@ decDivideOp (decNumber * res,
 	      if (var1units == var2ulen)
 		{		/* unit-by-unit compare needed */
 		  /* compare the two numbers, from msu */
-		  Unit *pv1, *pv2, v2;	/* units to compare */
+		  Unit *pv1, v2;	/* units to compare */
+		  const Unit *pv2;	/* units to compare */
 		  pv2 = msu2;	/* -> msu */
 		  for (pv1 = msu1;; pv1--, pv2--)
 		    {
@@ -3411,15 +3418,15 @@ decDivideOp (decNumber * res,
 /* We always have to use a buffer for the accumulator.                */
 /* ------------------------------------------------------------------ */
 static decNumber *
-decMultiplyOp (decNumber * res, decNumber * lhs,
-	       decNumber * rhs, decContext * set, uInt * status)
+decMultiplyOp (decNumber * res, const decNumber * lhs,
+	       const decNumber * rhs, decContext * set, uInt * status)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
   decNumber *allocrhs = NULL;	/* .., rhs */
   Unit accbuff[D2U (DECBUFFER * 2 + 1)];	/* local buffer (+1 in case DECBUFFER==0) */
   Unit *acc = accbuff;		/* -> accumulator array for exact result */
   Unit *allocacc = NULL;	/* -> allocated buffer, iff allocated */
-  Unit *mer, *mermsup;		/* work */
+  const Unit *mer, *mermsup;	/* work */
   Int accunits;			/* Units of accumulator in use */
   Int madlength;		/* Units in multiplicand */
   Int shift;			/* Units to shift multiplicand by */
@@ -3486,7 +3493,7 @@ decMultiplyOp (decNumber * res, decNumbe
       /* multiplier (rhs) and the longer as the multiplicand (lhs) */
       if (lhs->digits < rhs->digits)
 	{			/* swap... */
-	  decNumber *hold = lhs;
+	  const decNumber *hold = lhs;
 	  lhs = rhs;
 	  rhs = hold;
 	}
@@ -3593,12 +3600,12 @@ decMultiplyOp (decNumber * res, decNumbe
 /* after the operation is guaranteed to be that requested.            */
 /* ------------------------------------------------------------------ */
 static decNumber *
-decQuantizeOp (decNumber * res, decNumber * lhs,
-	       decNumber * rhs, decContext * set, Flag quant, uInt * status)
+decQuantizeOp (decNumber * res, const decNumber * lhs,
+	       const decNumber * rhs, decContext * set, Flag quant, uInt * status)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
   decNumber *allocrhs = NULL;	/* .., rhs */
-  decNumber *inrhs = rhs;	/* save original rhs */
+  const decNumber *inrhs = rhs;	/* save original rhs */
   Int reqdigits = set->digits;	/* requested DIGITS */
   Int reqexp;			/* requested exponent [-scale] */
   Int residue = 0;		/* rounding residue */
@@ -3776,7 +3783,7 @@ decQuantizeOp (decNumber * res, decNumbe
 /* coefficient comparison if possible.                                */
 /* ------------------------------------------------------------------ */
 decNumber *
-decCompareOp (decNumber * res, decNumber * lhs, decNumber * rhs,
+decCompareOp (decNumber * res, const decNumber * lhs, const decNumber * rhs,
 	      decContext * set, Flag op, uInt * status)
 {
   decNumber *alloclhs = NULL;	/* non-NULL if rounded lhs allocated */
@@ -3873,7 +3880,7 @@ decCompareOp (decNumber * res, decNumber
 	{			/* MAX or MIN, non-NaN result */
 	  Int residue = 0;	/* rounding accumulator */
 	  /* choose the operand for the result */
-	  decNumber *choice;
+	  const decNumber *choice;
 	  if (result == 0)
 	    {			/* operands are numerically equal */
 	      /* choose according to sign then exponent (see 754r) */
@@ -3940,7 +3947,7 @@ decCompareOp (decNumber * res, decNumber
 /* ------------------------------------------------------------------ */
 /* This could be merged into decCompareOp */
 static Int
-decCompare (decNumber * lhs, decNumber * rhs)
+decCompare (const decNumber * lhs, const decNumber * rhs)
 {
   Int result;			/* result value */
   Int sigr;			/* rhs signum */
@@ -3977,7 +3984,7 @@ decCompare (decNumber * lhs, decNumber *
   if (lhs->exponent > rhs->exponent)
     {				/* LHS exponent larger */
       /* swap sides, and sign */
-      decNumber *temp = lhs;
+      const decNumber *temp = lhs;
       lhs = rhs;
       rhs = temp;
       result = -result;
@@ -4009,13 +4016,13 @@ decCompare (decNumber * lhs, decNumber *
 /*  (the only possible failure is an allocation error)                */
 /* ------------------------------------------------------------------ */
 static Int
-decUnitCompare (Unit * a, Int alength, Unit * b, Int blength, Int exp)
+decUnitCompare (const Unit * a, Int alength, const Unit * b, Int blength, Int exp)
 {
   Unit *acc;			/* accumulator for result */
   Unit accbuff[D2U (DECBUFFER + 1)];	/* local buffer */
   Unit *allocacc = NULL;	/* -> allocated acc buffer, iff allocated */
   Int accunits, need;		/* units in use or needed for acc */
-  Unit *l, *r, *u;		/* work */
+  const Unit *l, *r, *u;	/* work */
   Int expunits, exprem, result;	/* .. */
 
   if (exp == 0)
@@ -4129,10 +4136,10 @@ decUnitCompare (Unit * a, Int alength, U
 /* (IBM Warwick, UK) for some of the ideas used in this routine.      */
 /* ------------------------------------------------------------------ */
 static Int
-decUnitAddSub (Unit * a, Int alength,
-	       Unit * b, Int blength, Int bshift, Unit * c, Int m)
+decUnitAddSub (const Unit * a, Int alength,
+	       const Unit * b, Int blength, Int bshift, Unit * c, Int m)
 {
-  Unit *alsu = a;		/* A lsu [need to remember it] */
+  const Unit *alsu = a;		/* A lsu [need to remember it] */
   Unit *clsu = c;		/* C ditto */
   Unit *minC;			/* low water mark for C */
   Unit *maxC;			/* high water mark for C */
@@ -4556,7 +4563,7 @@ decShiftToLeast (Unit * uar, Int units, 
 /* is returned.                                                       */
 /* ------------------------------------------------------------------ */
 static decNumber *
-decRoundOperand (decNumber * dn, decContext * set, uInt * status)
+decRoundOperand (const decNumber * dn, decContext * set, uInt * status)
 {
   decNumber *res;		/* result structure */
   uInt newstatus = 0;		/* status from round */
@@ -4595,7 +4602,7 @@ decRoundOperand (decNumber * dn, decCont
 /* All fields are updated as required.                                */
 /* ------------------------------------------------------------------ */
 static void
-decCopyFit (decNumber * dest, decNumber * src, decContext * set,
+decCopyFit (decNumber * dest, const decNumber * src, decContext * set,
 	    Int * residue, uInt * status)
 {
   dest->bits = src->bits;
@@ -4643,14 +4650,15 @@ decCopyFit (decNumber * dest, decNumber 
 /*                             0  1  2  3  4  5  6  7  8  9 */
 static const uByte resmap[10] = { 0, 3, 3, 3, 3, 5, 7, 7, 7, 7 };
 static void
-decSetCoeff (decNumber * dn, decContext * set, Unit * lsu,
+decSetCoeff (decNumber * dn, decContext * set, const Unit * lsu,
 	     Int len, Int * residue, uInt * status)
 {
   Int discard;			/* number of digits to discard */
   uInt discard1;		/* first discarded digit */
   uInt cut;			/* cut point in Unit */
   uInt quot, rem;		/* for divisions */
-  Unit *up, *target;		/* work */
+  Unit *target;			/* work */
+  const Unit *up;		/* work */
   Int count;			/* .. */
 #if DECDPUN<=4
   uInt temp;			/* .. */
@@ -5246,8 +5254,8 @@ decSetOverflow (decNumber * dn, decConte
 /* necessary.  Underflow is set if the result is Inexact.             */
 /* ------------------------------------------------------------------ */
 static void
-decSetSubnormal (decNumber * dn, decContext * set, Int * residue,
-		 uInt * status)
+decSetSubnormal (decNumber * dn, decContext * set,
+		 Int * residue, uInt * status)
 {
   decContext workset;		/* work */
   Int etiny, adjust;		/* .. */
@@ -5342,15 +5350,15 @@ decSetSubnormal (decNumber * dn, decCont
 /* ------------------------------------------------------------------ */
 #if DECSUBSET
 static Int
-decGetInt (decNumber * dn, decContext * set)
+decGetInt (const decNumber * dn, decContext * set)
 {
 #else
 static Int
-decGetInt (decNumber * dn)
+decGetInt (const decNumber * dn)
 {
 #endif
   Int theInt;			/* result accumulator */
-  Unit *up;			/* work */
+  const Unit *up;		/* work */
   Int got;			/* digits (real or not) processed */
   Int ilength = dn->digits + dn->exponent;	/* integral length */
 
@@ -5472,7 +5480,7 @@ decStrEq (const char *str1, const char *
 /* to a qNaN and Invalid operation is set.                            */
 /* ------------------------------------------------------------------ */
 static decNumber *
-decNaNs (decNumber * res, decNumber * lhs, decNumber * rhs, uInt * status)
+decNaNs (decNumber * res, const decNumber * lhs, const decNumber * rhs, uInt * status)
 {
   /* This decision tree ends up with LHS being the source pointer, */
   /* and status updated if need be */
@@ -5543,9 +5551,9 @@ decStatus (decNumber * dn, uInt status, 
 /* ------------------------------------------------------------------ */
 /* This may be called twice during some operations. */
 static Int
-decGetDigits (Unit * uar, Int len)
+decGetDigits (const Unit * uar, Int len)
 {
-  Unit *up = uar + len - 1;	/* -> msu */
+  const Unit *up = uar + len - 1;	/* -> msu */
   Int digits = len * DECDPUN;	/* maximum possible digits */
   uInt const *pow;		/* work */
 
@@ -5584,9 +5592,9 @@ decGetDigits (Unit * uar, Int len)
 /* ------------------------------------------------------------------ */
 /* this is public so other modules can use it */
 void
-decNumberShow (decNumber * dn)
+decNumberShow (const decNumber * dn)
 {
-  Unit *up;			/* work */
+  const Unit *up;		/* work */
   uInt u, d;			/* .. */
   Int cut;			/* .. */
   char isign = '+';		/* main sign */
@@ -5652,13 +5660,13 @@ decNumberShow (decNumber * dn)
 /*   len  is the length of the array in Units                         */
 /* ------------------------------------------------------------------ */
 static void
-decDumpAr (char name, Unit * ar, Int len)
+decDumpAr (char name, const Unit * ar, Int len)
 {
   Int i;
 #if DECDPUN==4
-  char *spec = "%04d ";
+  const char *spec = "%04d ";
 #else
-  char *spec = "%d ";
+  const char *spec = "%d ";
 #endif
   printf ("  :%c: ", name);
   for (i = len - 1; i >= 0; i--)
@@ -5688,8 +5696,8 @@ decDumpAr (char name, Unit * ar, Int len
 /* The caller is expected to abandon immediately if 1 is returned.    */
 /* ------------------------------------------------------------------ */
 static Flag
-decCheckOperands (decNumber * res, decNumber * lhs,
-		  decNumber * rhs, decContext * set)
+decCheckOperands (decNumber * res, const decNumber * lhs,
+		  const decNumber * rhs, decContext * set)
 {
   Flag bad = 0;
   if (set == NULL)
@@ -5746,9 +5754,9 @@ decCheckOperands (decNumber * res, decNu
 /* operation in some valid context (not necessarily the current one). */
 /* ------------------------------------------------------------------ */
 Flag
-decCheckNumber (decNumber * dn, decContext * set)
+decCheckNumber (const decNumber * dn, decContext * set)
 {
-  Unit *up;			/* work */
+  const Unit *up;		/* work */
   uInt maxuint;			/* .. */
   Int ae, d, digits;		/* .. */
   Int emin, emax;		/* .. */
diff -rup orig/egcc-SVN20060820/libdecnumber/decNumber.h egcc-SVN20060820/libdecnumber/decNumber.h
--- orig/egcc-SVN20060820/libdecnumber/decNumber.h	2006-08-20 22:02:53.276021850 -0400
+++ egcc-SVN20060820/libdecnumber/decNumber.h	2006-08-20 22:02:47.692237813 -0400
@@ -130,43 +130,46 @@ typedef struct
 
   /* Conversions */
 decNumber *decNumberFromString (decNumber *, const char *, decContext *);
-char *decNumberToString (decNumber *, char *);
-char *decNumberToEngString (decNumber *, char *);
+char *decNumberToString (const decNumber *, char *);
+char *decNumberToEngString (const decNumber *, char *);
 
   /* Operators */
-decNumber *decNumberAbs (decNumber *, decNumber *, decContext *);
-decNumber *decNumberAdd (decNumber *, decNumber *, decNumber *, decContext *);
-decNumber *decNumberCompare (decNumber *, decNumber *, decNumber *,
-			     decContext *);
-decNumber *decNumberDivide (decNumber *, decNumber *, decNumber *,
-			    decContext *);
-decNumber *decNumberDivideInteger (decNumber *, decNumber *, decNumber *,
-				   decContext *);
-decNumber *decNumberMax (decNumber *, decNumber *, decNumber *, decContext *);
-decNumber *decNumberMin (decNumber *, decNumber *, decNumber *, decContext *);
-decNumber *decNumberMinus (decNumber *, decNumber *, decContext *);
-decNumber *decNumberMultiply (decNumber *, decNumber *, decNumber *,
-			      decContext *);
-decNumber *decNumberNormalize (decNumber *, decNumber *, decContext *);
-decNumber *decNumberPlus (decNumber *, decNumber *, decContext *);
-decNumber *decNumberPower (decNumber *, decNumber *, decNumber *,
-			   decContext *);
-decNumber *decNumberQuantize (decNumber *, decNumber *, decNumber *,
-			      decContext *);
-decNumber *decNumberRemainder (decNumber *, decNumber *, decNumber *,
-			       decContext *);
-decNumber *decNumberRemainderNear (decNumber *, decNumber *, decNumber *,
-				   decContext *);
-decNumber *decNumberRescale (decNumber *, decNumber *, decNumber *,
-			     decContext *);
-decNumber *decNumberSameQuantum (decNumber *, decNumber *, decNumber *);
-decNumber *decNumberSquareRoot (decNumber *, decNumber *, decContext *);
-decNumber *decNumberSubtract (decNumber *, decNumber *, decNumber *,
-			      decContext *);
-decNumber *decNumberToIntegralValue (decNumber *, decNumber *, decContext *);
+decNumber *decNumberAbs (decNumber *, const decNumber *, decContext *);
+decNumber *decNumberAdd (decNumber *, const decNumber *,
+			 const decNumber *, decContext *);
+decNumber *decNumberCompare (decNumber *, const decNumber *,
+			     const decNumber *, decContext *);
+decNumber *decNumberDivide (decNumber *, const decNumber *,
+			    const decNumber *, decContext *);
+decNumber *decNumberDivideInteger (decNumber *, const decNumber *,
+				   const decNumber *, decContext *);
+decNumber *decNumberMax (decNumber *, const decNumber *,
+			 const decNumber *, decContext *);
+decNumber *decNumberMin (decNumber *, const decNumber *,
+			 const decNumber *, decContext *);
+decNumber *decNumberMinus (decNumber *, const decNumber *, decContext *);
+decNumber *decNumberMultiply (decNumber *, const decNumber *,
+			      const decNumber *, decContext *);
+decNumber *decNumberNormalize (decNumber *, const decNumber *, decContext *);
+decNumber *decNumberPlus (decNumber *, const decNumber *, decContext *);
+decNumber *decNumberPower (decNumber *, const decNumber *,
+			   const decNumber *, decContext *);
+decNumber *decNumberQuantize (decNumber *, const decNumber *,
+			      const decNumber *, decContext *);
+decNumber *decNumberRemainder (decNumber *, const decNumber *,
+			       const decNumber *, decContext *);
+decNumber *decNumberRemainderNear (decNumber *, const decNumber *,
+				   const decNumber *, decContext *);
+decNumber *decNumberRescale (decNumber *, const decNumber *,
+			     const decNumber *, decContext *);
+decNumber *decNumberSameQuantum (decNumber *, const decNumber *, const decNumber *);
+decNumber *decNumberSquareRoot (decNumber *, const decNumber *, decContext *);
+decNumber *decNumberSubtract (decNumber *, const decNumber *,
+			      const decNumber *, decContext *);
+decNumber *decNumberToIntegralValue (decNumber *, const decNumber *, decContext *);
 
   /* Utilities */
-decNumber *decNumberCopy (decNumber *, decNumber *);
+decNumber *decNumberCopy (decNumber *, const decNumber *);
 decNumber *decNumberTrim (decNumber *);
 const char *decNumberVersion (void);
 decNumber *decNumberZero (decNumber *);
diff -rup orig/egcc-SVN20060820/libdecnumber/decUtility.c egcc-SVN20060820/libdecnumber/decUtility.c
--- orig/egcc-SVN20060820/libdecnumber/decUtility.c	2006-01-22 23:25:41.000000000 -0500
+++ egcc-SVN20060820/libdecnumber/decUtility.c	2006-08-20 23:26:47.626073865 -0400
@@ -64,7 +64,7 @@
 /* No error is possible.                                              */
 /* ------------------------------------------------------------------ */
 void
-decDensePackCoeff (decNumber * dn, uByte * bytes, Int len, Int shift)
+decDensePackCoeff (const decNumber * dn, uByte * bytes, Int len, Int shift)
 {
   Int cut;			/* work */
   Int n;			/* output bunch counter */
@@ -72,7 +72,7 @@ decDensePackCoeff (decNumber * dn, uByte
   uInt dpd;			/* densely packed decimal value */
   uInt bin;			/* binary value 0-999 */
   uByte *bout;			/* -> current output byte */
-  Unit *inu = dn->lsu;		/* -> current input unit */
+  const Unit *inu = dn->lsu;	/* -> current input unit */
   Unit uar[DECMAXUNITS];	/* working copy of units, iff shifted */
 #if DECDPUN!=3			/* not fast path */
   Unit in;			/* current input unit */
@@ -83,7 +83,8 @@ decDensePackCoeff (decNumber * dn, uByte
       /* shift the units array to the left by pad digits and copy */
       /* [this code is a special case of decShiftToMost, which could */
       /* be used instead if exposed and the array were copied first] */
-      Unit *target, *source, *first;	/* work */
+      Unit *target, *first;	/* work */
+      const Unit *source;	/* work */
       uInt next = 0;		/* work */
 
       source = dn->lsu + D2U (digits) - 1;	/* where msu comes from */
@@ -211,12 +212,12 @@ decDensePackCoeff (decNumber * dn, uByte
 /* No error is possible [the redundant 888 codes are allowed].        */
 /* ------------------------------------------------------------------ */
 void
-decDenseUnpackCoeff (uByte * bytes, Int len, decNumber * dn,
+decDenseUnpackCoeff (const uByte * bytes, Int len, decNumber * dn,
 		     Int bunches, Int odd)
 {
   uInt dpd = 0;			/* collector for 10 bits */
   Int n;			/* counter */
-  uByte *bin;			/* -> current input byte */
+  const uByte *bin;		/* -> current input byte */
   Unit *uout = dn->lsu;		/* -> current output unit */
   Unit out = 0;			/* accumulator */
   Int cut = 0;			/* power of ten in current unit */
diff -rup orig/egcc-SVN20060820/libdecnumber/decUtility.h egcc-SVN20060820/libdecnumber/decUtility.h
--- orig/egcc-SVN20060820/libdecnumber/decUtility.h	2006-01-22 23:25:41.000000000 -0500
+++ egcc-SVN20060820/libdecnumber/decUtility.h	2006-08-20 22:02:47.695041216 -0400
@@ -24,5 +24,5 @@
 #define decDenseUnpackCoeff __decDenseUnpackCoeff
 #endif
 
-extern void decDensePackCoeff (decNumber *, uByte *, Int, Int);
-extern void decDenseUnpackCoeff (uByte *, Int, decNumber *, Int, Int);
+extern void decDensePackCoeff (const decNumber *, uByte *, Int, Int);
+extern void decDenseUnpackCoeff (const uByte *, Int, decNumber *, Int, Int);
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal128.c egcc-SVN20060820/libdecnumber/decimal128.c
--- orig/egcc-SVN20060820/libdecnumber/decimal128.c	2006-08-20 22:02:53.276977145 -0400
+++ egcc-SVN20060820/libdecnumber/decimal128.c	2006-08-20 22:02:47.696575239 -0400
@@ -38,8 +38,8 @@
 #include "decUtility.h"		/* utility routines */
 
 #if DECTRACE || DECCHECK
-void decimal128Show (decimal128 *);	/* for debug */
-void decNumberShow (decNumber *);	/* .. */
+void decimal128Show (const decimal128 *);	/* for debug */
+void decNumberShow (const decNumber *);	/* .. */
 #endif
 
 /* Useful macro */
@@ -64,7 +64,7 @@ void decNumberShow (decNumber *);	/* .. 
 /* power of ten, or if the exponent on a zero had to be clamped.      */
 /* ------------------------------------------------------------------ */
 decimal128 *
-decimal128FromNumber (decimal128 * d128, decNumber * dn, decContext * set)
+decimal128FromNumber (decimal128 * d128, const decNumber * dn, decContext * set)
 {
   uInt status = 0;		/* status accumulator */
   Int pad = 0;			/* coefficient pad digits */
@@ -184,7 +184,7 @@ decimal128FromNumber (decimal128 * d128,
 /* No error is possible.                                              */
 /* ------------------------------------------------------------------ */
 decNumber *
-decimal128ToNumber (decimal128 * d128, decNumber * dn)
+decimal128ToNumber (const decimal128 * d128, decNumber * dn)
 {
   uInt msd;			/* coefficient MSD */
   decimal128 wk;		/* working copy, if needed */
@@ -263,7 +263,7 @@ decimal128ToNumber (decimal128 * d128, d
 /*  No error is possible, and no status can be set.                   */
 /* ------------------------------------------------------------------ */
 char *
-decimal128ToString (decimal128 * d128, char *string)
+decimal128ToString (const decimal128 * d128, char *string)
 {
   decNumber dn;			/* work */
   decimal128ToNumber (d128, &dn);
@@ -272,7 +272,7 @@ decimal128ToString (decimal128 * d128, c
 }
 
 char *
-decimal128ToEngString (decimal128 * d128, char *string)
+decimal128ToEngString (const decimal128 * d128, char *string)
 {
   decNumber dn;			/* work */
   decimal128ToNumber (d128, &dn);
@@ -321,7 +321,7 @@ decimal128FromString (decimal128 * resul
 /* ------------------------------------------------------------------ */
 /* Also shows sign/cob/expconfields extracted */
 void
-decimal128Show (decimal128 * d128)
+decimal128Show (const decimal128 * d128)
 {
   char buf[DECIMAL128_Bytes * 2 + 1];
   Int i, j;
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal128.h egcc-SVN20060820/libdecnumber/decimal128.h
--- orig/egcc-SVN20060820/libdecnumber/decimal128.h	2006-08-20 22:02:53.277813638 -0400
+++ egcc-SVN20060820/libdecnumber/decimal128.h	2006-08-20 22:02:47.697375332 -0400
@@ -103,11 +103,11 @@ typedef struct
 
   /* String conversions */
 decimal128 *decimal128FromString (decimal128 *, const char *, decContext *);
-char *decimal128ToString (decimal128 *, char *);
-char *decimal128ToEngString (decimal128 *, char *);
+char *decimal128ToString (const decimal128 *, char *);
+char *decimal128ToEngString (const decimal128 *, char *);
 
   /* decNumber conversions */
-decimal128 *decimal128FromNumber (decimal128 *, decNumber *, decContext *);
-decNumber *decimal128ToNumber (decimal128 *, decNumber *);
+decimal128 *decimal128FromNumber (decimal128 *, const decNumber *, decContext *);
+decNumber *decimal128ToNumber (const decimal128 *, decNumber *);
 
 #endif
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal32.c egcc-SVN20060820/libdecnumber/decimal32.c
--- orig/egcc-SVN20060820/libdecnumber/decimal32.c	2006-08-20 22:02:53.278733252 -0400
+++ egcc-SVN20060820/libdecnumber/decimal32.c	2006-08-20 22:02:47.698834634 -0400
@@ -38,8 +38,8 @@
 #include "decUtility.h"		/* utility routines */
 
 #if DECTRACE || DECCHECK
-void decimal32Show (decimal32 *);	/* for debug */
-void decNumberShow (decNumber *);	/* .. */
+void decimal32Show (const decimal32 *);	/* for debug */
+void decNumberShow (const decNumber *);	/* .. */
 #endif
 
 /* Useful macro */
@@ -64,7 +64,7 @@ void decNumberShow (decNumber *);	/* .. 
 /* power of ten, or if the exponent on a zero had to be clamped.      */
 /* ------------------------------------------------------------------ */
 decimal32 *
-decimal32FromNumber (decimal32 * d32, decNumber * dn, decContext * set)
+decimal32FromNumber (decimal32 * d32, const decNumber * dn, decContext * set)
 {
   uInt status = 0;		/* status accumulator */
   Int pad = 0;			/* coefficient pad digits */
@@ -181,7 +181,7 @@ decimal32FromNumber (decimal32 * d32, de
 /* No error is possible.                                              */
 /* ------------------------------------------------------------------ */
 decNumber *
-decimal32ToNumber (decimal32 * d32, decNumber * dn)
+decimal32ToNumber (const decimal32 * d32, decNumber * dn)
 {
   uInt msd;			/* coefficient MSD */
   decimal32 wk;			/* working copy, if needed */
@@ -255,7 +255,7 @@ decimal32ToNumber (decimal32 * d32, decN
 /*  No error is possible, and no status can be set.                   */
 /* ------------------------------------------------------------------ */
 char *
-decimal32ToString (decimal32 * d32, char *string)
+decimal32ToString (const decimal32 * d32, char *string)
 {
   decNumber dn;			/* work */
   decimal32ToNumber (d32, &dn);
@@ -264,7 +264,7 @@ decimal32ToString (decimal32 * d32, char
 }
 
 char *
-decimal32ToEngString (decimal32 * d32, char *string)
+decimal32ToEngString (const decimal32 * d32, char *string)
 {
   decNumber dn;			/* work */
   decimal32ToNumber (d32, &dn);
@@ -312,7 +312,7 @@ decimal32FromString (decimal32 * result,
 /* ------------------------------------------------------------------ */
 /* Also shows sign/cob/expconfields extracted */
 void
-decimal32Show (decimal32 * d32)
+decimal32Show (const decimal32 * d32)
 {
   char buf[DECIMAL32_Bytes * 2 + 1];
   Int i, j;
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal32.h egcc-SVN20060820/libdecnumber/decimal32.h
--- orig/egcc-SVN20060820/libdecnumber/decimal32.h	2006-08-20 22:02:53.279415262 -0400
+++ egcc-SVN20060820/libdecnumber/decimal32.h	2006-08-20 22:02:47.699578806 -0400
@@ -93,11 +93,11 @@ typedef struct
 
 /* String conversions.  */
 decimal32 *decimal32FromString (decimal32 *, const char *, decContext *);
-char *decimal32ToString (decimal32 *, char *);
-char *decimal32ToEngString (decimal32 *, char *);
+char *decimal32ToString (const decimal32 *, char *);
+char *decimal32ToEngString (const decimal32 *, char *);
 
 /* decNumber conversions.  */
-decimal32 *decimal32FromNumber (decimal32 *, decNumber *, decContext *);
-decNumber *decimal32ToNumber (decimal32 *, decNumber *);
+decimal32 *decimal32FromNumber (decimal32 *, const decNumber *, decContext *);
+decNumber *decimal32ToNumber (const decimal32 *, decNumber *);
 
 #endif
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal64.c egcc-SVN20060820/libdecnumber/decimal64.c
--- orig/egcc-SVN20060820/libdecnumber/decimal64.c	2006-08-20 22:02:53.280300316 -0400
+++ egcc-SVN20060820/libdecnumber/decimal64.c	2006-08-20 22:02:47.700965867 -0400
@@ -38,8 +38,8 @@
 #include "decUtility.h"		/* utility routines */
 
 #if DECTRACE || DECCHECK
-void decimal64Show (decimal64 *);	/* for debug */
-void decNumberShow (decNumber *);	/* .. */
+void decimal64Show (const decimal64 *);	/* for debug */
+void decNumberShow (const decNumber *);	/* .. */
 #endif
 
 /* Useful macro */
@@ -64,7 +64,7 @@ void decNumberShow (decNumber *);	/* .. 
 /* power of ten, or if the exponent on a zero had to be clamped.      */
 /* ------------------------------------------------------------------ */
 decimal64 *
-decimal64FromNumber (decimal64 * d64, decNumber * dn, decContext * set)
+decimal64FromNumber (decimal64 * d64, const decNumber * dn, decContext * set)
 {
   uInt status = 0;		/* status accumulator */
   Int pad = 0;			/* coefficient pad digits */
@@ -180,7 +180,7 @@ decimal64FromNumber (decimal64 * d64, de
 /* No error is possible.                                              */
 /* ------------------------------------------------------------------ */
 decNumber *
-decimal64ToNumber (decimal64 * d64, decNumber * dn)
+decimal64ToNumber (const decimal64 * d64, decNumber * dn)
 {
   uInt msd;			/* coefficient MSD */
   decimal64 wk;			/* working copy, if needed */
@@ -254,7 +254,7 @@ decimal64ToNumber (decimal64 * d64, decN
 /*  No error is possible, and no status can be set.                   */
 /* ------------------------------------------------------------------ */
 char *
-decimal64ToString (decimal64 * d64, char *string)
+decimal64ToString (const decimal64 * d64, char *string)
 {
   decNumber dn;			/* work */
   decimal64ToNumber (d64, &dn);
@@ -263,7 +263,7 @@ decimal64ToString (decimal64 * d64, char
 }
 
 char *
-decimal64ToEngString (decimal64 * d64, char *string)
+decimal64ToEngString (const decimal64 * d64, char *string)
 {
   decNumber dn;			/* work */
   decimal64ToNumber (d64, &dn);
@@ -312,7 +312,7 @@ decimal64FromString (decimal64 * result,
 /* ------------------------------------------------------------------ */
 /* Also shows sign/cob/expconfields extracted */
 void
-decimal64Show (decimal64 * d64)
+decimal64Show (const decimal64 * d64)
 {
   char buf[DECIMAL64_Bytes * 2 + 1];
   Int i, j;
diff -rup orig/egcc-SVN20060820/libdecnumber/decimal64.h egcc-SVN20060820/libdecnumber/decimal64.h
--- orig/egcc-SVN20060820/libdecnumber/decimal64.h	2006-08-20 22:02:53.280990806 -0400
+++ egcc-SVN20060820/libdecnumber/decimal64.h	2006-08-20 22:02:47.701703478 -0400
@@ -97,11 +97,11 @@ typedef struct
 
   /* String conversions */
 decimal64 *decimal64FromString (decimal64 *, const char *, decContext *);
-char *decimal64ToString (decimal64 *, char *);
-char *decimal64ToEngString (decimal64 *, char *);
+char *decimal64ToString (const decimal64 *, char *);
+char *decimal64ToEngString (const decimal64 *, char *);
 
   /* decNumber conversions */
-decimal64 *decimal64FromNumber (decimal64 *, decNumber *, decContext *);
-decNumber *decimal64ToNumber (decimal64 *, decNumber *);
+decimal64 *decimal64FromNumber (decimal64 *, const decNumber *, decContext *);
+decNumber *decimal64ToNumber (const decimal64 *, decNumber *);
 
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]