[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gimp-print-devel
Subject:    Re: [Gimp-print-devel] 5.2.4?
From:       Roger Leigh <rleigh () codelibre ! net>
Date:       2009-05-31 23:46:39
Message-ID: 20090531234639.GA4412 () codelibre ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


On Sat, May 30, 2009 at 07:58:37PM -0400, Robert Krawitz wrote:
>    Date: Sun, 31 May 2009 00:25:19 +0100
>    From: Roger Leigh <rleigh@codelibre.net>
> 
>    On Sat, May 30, 2009 at 01:12:15PM -0400, Robert Krawitz wrote:
>    >    Date: Sat, 30 May 2009 16:16:22 +0100
>    >    From: Roger Leigh <rleigh@codelibre.net>
>    >=20
>    >    On Sat, May 30, 2009 at 10:31:36AM -0400, Robert Krawitz wrote:
>    >    > Roger, can you look at the generated testpatterny.c to see what's
>    >    > coming out?  Or is it not even generating it?
>    >=20
>    >    It's not even generating it, I'm afraid.  From the errors, it doesn't
>    >    appear to like COLOR or NUMBER.
>    >=20
>    > Can you try fiddling with the NUMBER stuff?  I don't think COLOR is
>    > broken.  I don't have Bison 2.4, so I'm not going to be able to look
>    > at it.
> 
>    I've had a try but not come up with anything.  I'm afraid I have no
>    yacc understanding, so I really don't understand the syntax.  I really
>    don't have the time to learn and debug the yacc grammar to fix this.
> 
>    The errors do indicate that both COLOR and NUMBER are not defined:
> 
> Unless someone can reproduce it, there's not much we can do right now.

After checking over the file with a fellow Debian developer who is
familiar with yacc, it turns out that:

- A %type definition is needed for COLOR and NUMBER
- $n.[sd]val is not valid syntax.  $<[sd]val>n is the alternative.
  However, neither form should be needed; $n should be sufficient.

Using this advice, please find the attached patch.  Not being a yacc
expert, I can't be certain of its correctness but it does appear to
work.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

["testpatterny.patch" (text/x-diff)]

Index: src/testpattern/testpatterny.y
===================================================================
RCS file: /cvsroot/gimp-print/print/src/testpattern/testpatterny.y,v
retrieving revision 1.33
diff -u -r1.33 testpatterny.y
--- src/testpattern/testpatterny.y	7 Dec 2008 20:03:08 -0000	1.33
+++ src/testpattern/testpatterny.y	31 May 2009 23:41:14 -0000
@@ -138,6 +138,9 @@
 %token END_JOB
 %token END
 
+%type <sval> COLOR
+%type <dval> NUMBER
+
 %start Thing
 
 %%
@@ -145,7 +148,7 @@
 COLOR: CYAN | L_CYAN | MAGENTA | L_MAGENTA
 	| YELLOW | D_YELLOW | BLACK | L_BLACK
 ;
-NUMBER: tDOUBLE | tINT
+NUMBER: tDOUBLE
 ;
 
 cmykspec: CMYK tINT
@@ -240,47 +243,47 @@
 
 level: LEVEL COLOR NUMBER
 	{
-	  int channel = find_color($2.sval);
+	  int channel = find_color($2);
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>level %s %f\n", $2.sval, $3.dval);
+	    fprintf(stderr, ">>>level %s %f\n", $2, $3);
 	  if (channel >= 0)
-	    global_levels[channel] = $3.dval;
+	    global_levels[channel] = $3;
 	}
 ;
 
 channel_level: LEVEL tINT NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>channel_level %d %f\n", $2, $3.dval);
+	    fprintf(stderr, ">>>channel_level %d %f\n", $2, $3);
 	  if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT)
-	    global_levels[$2] = $3.dval;
+	    global_levels[$2] = $3;
 	}
 ;
 
 gamma: GAMMA COLOR NUMBER
 	{
-	  int channel = find_color($2.sval);
+	  int channel = find_color($2);
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>gamma %s %f\n", $2.sval, $3.dval);
+	    fprintf(stderr, ">>>gamma %s %f\n", $2, $3);
 	  if (channel >= 0)
-	    global_gammas[channel] = $3.dval;
+	    global_gammas[channel] = $3;
 	}
 ;
 
 channel_gamma: GAMMA tINT NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>channel_gamma %d %f\n", $2, $3.dval);
+	    fprintf(stderr, ">>>channel_gamma %d %f\n", $2, $3);
 	  if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT)
-	    global_gammas[$2] = $3.dval;
+	    global_gammas[$2] = $3;
 	}
 ;
 
 global_gamma: GAMMA NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>global_gamma %f\n", $2.dval);
-	  global_gamma = $2.dval;
+	    fprintf(stderr, ">>>global_gamma %f\n", $2);
+	  global_gamma = $2;
 	}
 ;
 steps: STEPS tINT
@@ -293,8 +296,8 @@
 ink_limit: INK_LIMIT NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>ink_limit %f\n", $2.dval);
-	  global_ink_limit = $2.dval;
+	    fprintf(stderr, ">>>ink_limit %f\n", $2);
+	  global_ink_limit = $2;
 	}
 ;
 printer: PRINTER tSTRING
@@ -358,8 +361,8 @@
 parameter_float: PARAMETER_FLOAT tSTRING NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>parameter_float %s %f\n", $2, $3.dval);
-	  stp_set_float_parameter(global_vars, $2, $3.dval);
+	    fprintf(stderr, ">>>parameter_float %s %f\n", $2, $3);
+	  stp_set_float_parameter(global_vars, $2, $3);
 	  free($2);
 	}
 ;
@@ -383,36 +386,36 @@
 density: DENSITY NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>density %f\n", $2.dval);
-	  global_density = $2.dval;
+	    fprintf(stderr, ">>>density %f\n", $2);
+	  global_density = $2;
 	}
 ;
 top: TOP NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>top %f\n", $2.dval);
-	  global_xtop = $2.dval;
+	    fprintf(stderr, ">>>top %f\n", $2);
+	  global_xtop = $2;
 	}
 ;
 left: LEFT NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
- 	    fprintf(stderr, ">>>left %f\n", $2.dval);
-	  global_xleft = $2.dval;
+ 	    fprintf(stderr, ">>>left %f\n", $2);
+	  global_xleft = $2;
 	}
 ;
 hsize: HSIZE NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>hsize %f\n", $2.dval);
-	  global_hsize = $2.dval;
+	    fprintf(stderr, ">>>hsize %f\n", $2);
+	  global_hsize = $2;
 	}
 ;
 vsize: VSIZE NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>vsize %f\n", $2.dval);
-	  global_vsize = $2.dval;
+	    fprintf(stderr, ">>>vsize %f\n", $2);
+	  global_vsize = $2;
 	}
 ;
 blackline: BLACKLINE tINT
@@ -434,13 +437,13 @@
 color_block1: NUMBER NUMBER NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", $1.dval, $2.dval, $3.dval,
+	    fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", $1, $2, $3,
 		    current_index);
 	  if (current_index < STP_CHANNEL_LIMIT)
 	    {
-	      current_testpattern->d.pattern.mins[current_index] = $1.dval;
-	      current_testpattern->d.pattern.vals[current_index] = $2.dval;
-	      current_testpattern->d.pattern.gammas[current_index] = $3.dval;
+	      current_testpattern->d.pattern.mins[current_index] = $1;
+	      current_testpattern->d.pattern.vals[current_index] = $2;
+	      current_testpattern->d.pattern.gammas[current_index] = $3;
 	      current_index++;
 	    }
 	}
@@ -457,14 +460,14 @@
 
 color_block2a: COLOR NUMBER NUMBER NUMBER
 	{
-	  int channel = find_color($1.sval);
+	  int channel = find_color($1);
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>color_block2a %s %f %f %f\n", $1.sval, $2.dval, $3.dval, $4.dval);
+	    fprintf(stderr, ">>>color_block2a %s %f %f %f\n", $1, $2, $3, $4);
 	  if (channel >= 0 && channel < STP_CHANNEL_LIMIT)
 	    {
-	      current_testpattern->d.pattern.mins[channel] = $2.dval;
-	      current_testpattern->d.pattern.vals[channel] = $3.dval;
-	      current_testpattern->d.pattern.gammas[channel] = $4.dval;
+	      current_testpattern->d.pattern.mins[channel] = $2;
+	      current_testpattern->d.pattern.vals[channel] = $3;
+	      current_testpattern->d.pattern.gammas[channel] = $4;
 	    }
 	}
 ;
@@ -472,12 +475,12 @@
 color_block2b: CHANNEL tINT NUMBER NUMBER NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>color_block2b %d %f %f %f\n", $2, $3.dval, $4.dval, $5.dval);
+	    fprintf(stderr, ">>>color_block2b %d %f %f %f\n", $2, $3, $4, $5);
 	  if ($2 >= 0 && $2 < STP_CHANNEL_LIMIT)
 	    {
-	      current_testpattern->d.pattern.mins[$2] = $3.dval;
-	      current_testpattern->d.pattern.vals[$2] = $4.dval;
-	      current_testpattern->d.pattern.gammas[$2] = $5.dval;
+	      current_testpattern->d.pattern.mins[$2] = $3;
+	      current_testpattern->d.pattern.vals[$2] = $4;
+	      current_testpattern->d.pattern.gammas[$2] = $5;
 	    }
 	}
 ;
@@ -497,13 +500,13 @@
 patvars: NUMBER NUMBER NUMBER NUMBER NUMBER
 	{
 	  if (getenv("STP_TESTPATTERN_DEBUG"))
-	    fprintf(stderr, ">>>patvars %f %f %f %f %f\n", $1.dval, $2.dval, $3.dval, $4.dval, $5.dval);
+	    fprintf(stderr, ">>>patvars %f %f %f %f %f\n", $1, $2, $3, $4, $5);
 	  current_testpattern->type = E_PATTERN;
-	  current_testpattern->d.pattern.lower = $1.dval;
-	  current_testpattern->d.pattern.upper = $2.dval;
-	  current_testpattern->d.pattern.levels[1] = $3.dval;
-	  current_testpattern->d.pattern.levels[2] = $4.dval;
-	  current_testpattern->d.pattern.levels[3] = $5.dval;
+	  current_testpattern->d.pattern.lower = $1;
+	  current_testpattern->d.pattern.upper = $2;
+	  current_testpattern->d.pattern.levels[1] = $3;
+	  current_testpattern->d.pattern.levels[2] = $4;
+	  current_testpattern->d.pattern.levels[3] = $5;
 	  current_testpattern = get_next_testpattern();
 	  current_index = 0;
 	}

["signature.asc" (application/pgp-signature)]

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 

_______________________________________________
Gimp-print-devel mailing list
Gimp-print-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gimp-print-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic