[ITA] xfig/xfig-lib: An interactive drawing tool (patch)

Angelo Graziosi angelo.graziosi@alice.it
Tue Apr 8 21:26:00 GMT 2008


Dr. Volker Zell ha scritto:
>>>>>> Angelo Graziosi writes:
> 
>>> But why still 3.2.4 version? A new release 3.2.5 with several bug fixes has been released [1].
> 
> The problem is it does not compile due to dependency on
> 
> #include <complex.h> 
> 
> in w_intersect.c (which we don't have) and later on
> 
> w_intersect.c:884: error: syntax error before "ix1c"
> w_intersect.c:885: error: syntax error before "iy1c"
> w_intersect.c:886: error: syntax error before "ix2c"
> w_intersect.c:887: error: syntax error before "iy2c"
> w_intersect.c:891: error: `iy1c' undeclared (first use in this function)
> w_intersect.c:891: error: (Each undeclared identifier is reported only once
> w_intersect.c:891: error: for each function it appears in.)
> w_intersect.c:891: error: `_Complex_I' undeclared (first use in this function)
> w_intersect.c:892: error: `ix1c' undeclared (first use in this function)
> w_intersect.c:894: error: `iy2c' undeclared (first use in this function)
> w_intersect.c:895: error: `ix2c' undeclared (first use in this function)
> 
> Ciao
>   Volker

The patch below should solve the thing.

It avoids the complex computing. If z=(x,y) is a complex number, then
the line 891 of w_intersect.c reads

iy1c = (-X,sqrt(-rx))/(2.0 * W)

which with reals reads

iy1c_x = -X/(2.0 * W)
iy1c_y = sqrt(-rx)/(2.0 * W)

The line 892 (in complexs) reads

ix1c = (K * iy1c) + L

i.e. in real form

ix1c_x = K*iy1c_x+L
ix1c_y = K*iy1c_y+0

and so on.


To be noted :

---  K,X,W,L are all real.

---  (-rx)>0 in sqrt(-rx) (see line 873 and 880)

My buildnow fails when installing:

------------------------------------------
[...]
rman -f HTML < xfig._man \
           > xfig.1-html && mv -f xfig.1-html xfig.1.html
 >>> Installing xfig-3.2.5-1
Copying Fig Object Libraries
+ mkdirhier /tmp.builds/xfig-3.2.5-1/inst/usr/bin
+ mkdirhier /tmp.builds/xfig-3.2.5-1/inst/usr/lib/xfig/Libraries
+ set +x
install -c -s  xfig.exe /tmp.builds/xfig-3.2.5-1/inst/usr/bin/xfig.exe
install: impossibile creare il file normale 
`/tmp.builds/xfig-3.2.5-1/inst/usr/bin/xfig.exe': No such file or directory
/bin/sh: line 0: cd: 
/tmp.builds/xfig-3.2.5-1/inst/usr/lib/xfig/Libraries: No such file or 
directory
make: *** [install] Error 1
make: *** Waiting for unfinished jobs....
make: *** [install.libs] Error 1
*** ERROR: make install DESTDIR failed
 >>> Packaging xfig-3.2.5-1
 >>> Creating binary package(s)
 >>> xfig-3.2.5-1.tar.bz2
tar: etc: impossibile stat: No such file or directory
tar: usr/bin/*.exe: impossibile stat: No such file or directory
tar: usr/share/doc: impossibile stat: No such file or directory
tar: usr/share/man/man1: impossibile stat: No such file or directory
tar: Uscita per errore ritardata dall'errore precedente
*** ERROR: Binary package creation failed
 >>> Removing work directory in 5 seconds...
 >>> Removing work directory NOW.
 >>> Finished.
------------------------------------------

But I am not an expert of cygport... Sorry!


Cheers,
    Angelo.


w_intersect.c.patch
========================================================
diff -urN origsrc/xfig.3.2.5/w_intersect.c src/xfig.3.2.5/w_intersect.c
--- origsrc/xfig.3.2.5/w_intersect.c	2004-09-29 23:46:00.000000000 +0200
+++ src/xfig.3.2.5/w_intersect.c	2008-04-08 21:34:02.484375000 +0200
@@ -25,7 +25,6 @@
  #include "w_intersect.h"
  #include "u_quartic.h"
  #include <math.h>
-#include <complex.h>
  #undef I

  #define ISET_P1 (1 << 0)
@@ -881,29 +880,33 @@
  	      /* due to roundoff errors, the intersection of tangents to 
ellipses and
  	       * circles may be slightly complex.  this code catches such 
near misses.
  	       */
-	      double complex ix1c;
-	      double complex iy1c;
-	      double complex ix2c;
-	      double complex iy2c;
+	      double ix1c_x,ix1c_y;
+	      double iy1c_x,iy1c_y;
+	      double ix2c_x,ix2c_y;
+	      double iy2c_x,iy2c_y;
  	      double x1mag, y1mag;
  	      double x2mag, y2mag;

-	      iy1c = ((-X) + (sqrt(-rx) *  _Complex_I))/(2.0 * W);
-	      ix1c = (K * iy1c) + L;
-	
-	      iy2c = ((-X) - (sqrt(-rx) *  _Complex_I))/(2.0 * W);
-	      ix2c = (K * iy2c) + L;
-
-	      ix1 = creal(ix1c);
-	      iy1 = creal(iy1c);
-	      ix2 = creal(ix2c);
-	      iy2 = creal(iy2c);
+              iy1c_x = (-X)/(2.0 * W);
+	      iy1c_y = sqrt(-rx)/(2.0 * W);
+	      ix1c_x = (K * iy1c_x) + L;
+	      ix1c_y = (K * iy1c_y) + 0;
+
+	      iy2c_x = iy1c_x;
+	      iy2c_y = -iy1c_y;
+	      ix2c_x = (K * iy2c_x) + L;
+	      ix2c_y = (K * iy2c_y) + 0;
+
+	      ix1 = ix1c_x;
+	      iy1 = iy1c_x;
+	      ix2 = ix2c_x;
+	      iy2 = iy2c_x;

-	      x1mag = hypot(ix1, cimag(ix1c));
-	      y1mag = hypot(iy1, cimag(iy1c));
+	      x1mag = hypot(ix1, ix1c_y);
+	      y1mag = hypot(iy1, iy1c_y);

-	      x2mag = hypot(ix2, cimag(ix2c));
-	      y2mag = hypot(iy2, cimag(iy2c));
+	      x2mag = hypot(ix2, ix2c_y);
+	      y2mag = hypot(iy2, iy2c_y);
  	
  	      if ((1.0 > fabs(ix1) - x1mag) &&
  		  (1.0 > fabs(iy1) - y1mag) &&

========================================================




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list