[gs-cvs] rev 7443 - in trunk/gs: doc src

alexcher at ghostscript.com alexcher at ghostscript.com
Mon Dec 4 07:16:23 PST 2006


Author: alexcher
Date: 2006-12-04 07:16:22 -0800 (Mon, 04 Dec 2006)
New Revision: 7443

Modified:
   trunk/gs/doc/pscet_status.txt
   trunk/gs/src/idparam.c
   trunk/gs/src/idparam.h
   trunk/gs/src/zfilterx.c
   trunk/gs/src/zfsample.c
   trunk/gs/src/zfunc.c
   trunk/gs/src/zfunc0.c
   trunk/gs/src/zimage3.c
Log:
Accept packed arrays for the /Size element of the shading dictionary and
everywhere else where dict_int_array_param() is called. CET 31-01-06

DIFFERENCES:
None


Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/doc/pscet_status.txt	2006-12-04 15:16:22 UTC (rev 7443)
@@ -5097,8 +5097,7 @@
 
 31-01-5  DIFF	Test 03 graphic incorrect assign Ray.
 
-31-01-6  DIFF	Missing lots of data probably because shfill is
-                typechecking in gs assign: Igor
+31-01-6  OK  	Fixed - Alex
 
 31-01-7  OK	Minor differences visually reviewed by RJJ
 

Modified: trunk/gs/src/idparam.c
===================================================================
--- trunk/gs/src/idparam.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/idparam.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -166,38 +166,38 @@
 /* Get an integer array from a dictionary. */
 /* See idparam.h for specification. */
 int
-dict_int_array_check_param(const ref * pdict, const char *kstr, uint len,
-			   int *ivec, int under_error, int over_error)
+dict_int_array_check_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint len, int *ivec, int under_error, int over_error)
 {
-    ref *pdval;
-    const ref *pa;
-    int *pi = ivec;
+    ref pa, *pdval;
     uint size;
-    int i;
+    int i, code;
 
     if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0)
 	return 0;
-    if (!r_has_type(pdval, t_array))
+    if (!r_is_array(pdval))
 	return_error(e_typecheck);
     size = r_size(pdval);
     if (size > len)
 	return_error(over_error);
-    pa = pdval->value.const_refs;
-    for (i = 0; i < size; i++, pa++, pi++) {
-	/* See dict_int_param above for why we allow reals here. */
-	switch (r_type(pa)) {
+    for (i = 0; i < size; i++) {
+	code = array_get(mem, pdval, i, &pa);
+        if (code < 0)
+            return code;
+        /* See dict_int_param above for why we allow reals here. */
+	switch (r_type(&pa)) {
 	    case t_integer:
-		if (pa->value.intval != (int)pa->value.intval)
+		if (pa.value.intval != (int)pa.value.intval)
 		    return_error(e_rangecheck);
-		*pi = (int)pa->value.intval;
+		ivec[i] = (int)pa.value.intval;
 		break;
 	    case t_real:
-		if (pa->value.realval < min_int ||
-		    pa->value.realval > max_int ||
-		    pa->value.realval != (int)pa->value.realval
+		if (pa.value.realval < min_int ||
+		    pa.value.realval > max_int ||
+		    pa.value.realval != (int)pa.value.realval
 		    )
 		    return_error(e_rangecheck);
-		*pi = (int)pa->value.realval;
+		ivec[i] = (int)pa.value.realval;
 		break;
 	    default:
 		return_error(e_typecheck);
@@ -207,17 +207,17 @@
 	    gs_note_error(under_error));
 }
 int
-dict_int_array_param(const ref * pdict, const char *kstr,
-		     uint maxlen, int *ivec)
+dict_int_array_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint maxlen, int *ivec)
 {
-    return dict_int_array_check_param(pdict, kstr, maxlen, ivec,
+    return dict_int_array_check_param(mem, pdict, kstr, maxlen, ivec,
 				      0, e_limitcheck);
 }
 int
-dict_ints_param(const ref * pdict, const char *kstr,
-		uint len, int *ivec)
+dict_ints_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint len, int *ivec)
 {
-    return dict_int_array_check_param(pdict, kstr, len, ivec,
+    return dict_int_array_check_param(mem, pdict, kstr, len, ivec,
 				      e_rangecheck, e_rangecheck);
 }
 

Modified: trunk/gs/src/idparam.h
===================================================================
--- trunk/gs/src/idparam.h	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/idparam.h	2006-12-04 15:16:22 UTC (rev 7443)
@@ -65,13 +65,12 @@
  *	  Equivalent to _xxx_check_param(..., rangecheck, rangecheck).
  * All can return other error codes (e.g., typecheck).
  */
-int dict_int_array_check_param(const ref * pdict, const char *kstr,
-			       uint len, int *ivec,
-			       int under_error, int over_error);
-int dict_int_array_param(const ref * pdict, const char *kstr,
-			 uint maxlen, int *ivec);
-int dict_ints_param(const ref * pdict, const char *kstr,
-		    uint len, int *ivec);
+int dict_int_array_check_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint len, int *ivec, int under_error, int over_error);
+int dict_int_array_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint maxlen, int *ivec);
+int dict_ints_param(const gs_memory_t *mem, const ref * pdict,
+   const char *kstr, uint len, int *ivec);
 /*
  * For _float_array_param, if the parameter is missing and defaultvec is
  * not NULL, copy (max)len elements from defaultvec to fvec and return

Modified: trunk/gs/src/zfilterx.c
===================================================================
--- trunk/gs/src/zfilterx.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/zfilterx.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -57,7 +57,7 @@
 				256, &pbhcs->EncodeZeroRuns)) < 0 ||
     /* Note: the code returned from the following call */
     /* is actually the number of elements in the array. */
-	(code = dict_int_array_param(op, "Tables", countof(data),
+	(code = dict_int_array_param(imemory, op, "Tables", countof(data),
 				     data)) <= 0
 	)
 	return (code < 0 ? code : gs_note_error(e_rangecheck));

Modified: trunk/gs/src/zfsample.c
===================================================================
--- trunk/gs/src/zfsample.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/zfsample.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -313,7 +313,7 @@
 	    goto fail;
 	}
 	params->Size = ptr;
-	code = dict_ints_param(pdict, "Size", params->m, ptr);
+	code = dict_ints_param(mem, pdict, "Size", params->m, ptr);
         if (code < 0)
 	    goto fail;
         if (code == 0) {

Modified: trunk/gs/src/zfunc.c
===================================================================
--- trunk/gs/src/zfunc.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/zfunc.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -208,7 +208,8 @@
 fn_build_sub_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
 		      int depth, gs_memory_t *mem)
 {
-    int code, type, i;
+    int code, type;
+    uint i;
     gs_function_params_t params;
 
     if (depth > MAX_SUB_FUNCTION_DEPTH)
@@ -226,8 +227,10 @@
     params.Domain = 0;
     params.Range = 0;
     code = fn_build_float_array(op, "Domain", true, true, &params.Domain, mem);
-    if (code < 0)
+    if (code < 0) {
+        gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain"); 
 	goto fail;
+    }
     params.m = code >> 1;
     code = fn_build_float_array(op, "Range", false, true, &params.Range, mem);
     if (code < 0)

Modified: trunk/gs/src/zfunc0.c
===================================================================
--- trunk/gs/src/zfunc0.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/zfunc0.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -79,7 +79,7 @@
 	    goto fail;
 	}
 	params.Size = ptr;
-	code = dict_ints_param(op, "Size", params.m, ptr);
+	code = dict_ints_param(mem, op, "Size", params.m, ptr);
 	if (code != params.m)
 	    goto fail;
     }

Modified: trunk/gs/src/zimage3.c
===================================================================
--- trunk/gs/src/zimage3.c	2006-12-03 16:02:51 UTC (rev 7442)
+++ trunk/gs/src/zimage3.c	2006-12-04 15:16:22 UTC (rev 7443)
@@ -98,8 +98,8 @@
 			      12, false);
     if (code < 0)
 	return code;
-    code = dict_int_array_check_param(op, "MaskColor", num_components * 2,
-				      colors, 0, e_rangecheck);
+    code = dict_int_array_check_param(imemory, op, "MaskColor",
+       num_components * 2, colors, 0, e_rangecheck);
     /* Clamp the color values to the unsigned range. */
     if (code == num_components) {
 	image.MaskColor_is_range = false;



More information about the gs-cvs mailing list