diff options
author | joerg <joerg@pkgsrc.org> | 2012-05-04 16:16:42 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2012-05-04 16:16:42 +0000 |
commit | 0c715a6bb4314f1430663e06db2a0b33c5538d61 (patch) | |
tree | 4d47ebd438239fcd1ace675e748aa509acab075e /geography | |
parent | ee7c6ca410c0371598afa5ee8e7805a69de7b907 (diff) | |
download | pkgsrc-0c715a6bb4314f1430663e06db2a0b33c5538d61.tar.gz |
Remove use of nested functions. Bump revision.
Diffstat (limited to 'geography')
-rw-r--r-- | geography/xrmap-base/Makefile | 4 | ||||
-rw-r--r-- | geography/xrmap-base/distinfo | 3 | ||||
-rw-r--r-- | geography/xrmap-base/patches/patch-xrmap.c | 196 |
3 files changed, 200 insertions, 3 deletions
diff --git a/geography/xrmap-base/Makefile b/geography/xrmap-base/Makefile index 3eac9d78045..4e57f53c5ab 100644 --- a/geography/xrmap-base/Makefile +++ b/geography/xrmap-base/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.10 2011/11/26 04:39:59 sbd Exp $ +# $NetBSD: Makefile,v 1.11 2012/05/04 16:16:42 joerg Exp $ # DISTNAME= xrmap-2.29 PKGNAME= xrmap-base-2.29 -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= geography MASTER_SITES= ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/ EXTRACT_SUFX= .tar.bz2 diff --git a/geography/xrmap-base/distinfo b/geography/xrmap-base/distinfo index 5aa72f2e7f9..6b91ab7065a 100644 --- a/geography/xrmap-base/distinfo +++ b/geography/xrmap-base/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.4 2006/12/27 13:37:37 joerg Exp $ +$NetBSD: distinfo,v 1.5 2012/05/04 16:16:42 joerg Exp $ SHA1 (xrmap-2.29.tar.bz2) = af2efc47b7ef76840a72a96e67174b0fd5dd8973 RMD160 (xrmap-2.29.tar.bz2) = f8cacc343643a66c8236743c76c80d3c33c44c5c Size (xrmap-2.29.tar.bz2) = 1072241 bytes SHA1 (patch-aa) = 31ae754c428cd96e5c4313b53c26cadefff3e47f SHA1 (patch-ab) = fa0619337c40cef0d3bd63fcadc9f7bcefb473a6 +SHA1 (patch-xrmap.c) = 015e4437f0cd6089a57a5acc16bfdfde7830a8f8 diff --git a/geography/xrmap-base/patches/patch-xrmap.c b/geography/xrmap-base/patches/patch-xrmap.c new file mode 100644 index 00000000000..691b95f0de2 --- /dev/null +++ b/geography/xrmap-base/patches/patch-xrmap.c @@ -0,0 +1,196 @@ +$NetBSD: patch-xrmap.c,v 1.1 2012/05/04 16:16:42 joerg Exp $ + +Don't use nested functions. + +--- xrmap.c.orig 2012-04-27 12:12:57.000000000 +0000 ++++ xrmap.c +@@ -5517,90 +5517,87 @@ void arcinfo_lines(ImageLayout *scene) { + Pixel pix; + double cotan_lat0, conv_lat0; + +-void next_segment(double x, double y) +-{ +- double u, v, w, t; +- int i, j, dx, dy, dxp, dyp, epsx, epsy; +- if (arc_lambert) { +- /* Inverse Lambert projection */ +- u = x * arc_scale; +- v = y * arc_scale - arc_transl; +- w = atan(u/(-v)); +- t = v/cos(w); +- x = arc_lon0 + conv_lat0 * w; +- y = atan(cotan_lat0 + t)/CONV + arc_lat0; +- } +- sp.sph[LONGITUDE] = x; +- sp.sph[LATITUDE] = y; +- +- if (arc_start==1 && fabs(x-arc_x)+fabs(y-arc_y)<0.05) { +- arc_start = 2; +- } +- if (arc_start==3) +- printf("%.6f %.6f\n", x, y); +- pt2 = project(scene, spher2cart(scene, sp)); +- +- split_arc: +- if (new_arc) { +- if (dump_file && num_mod!= -1) { +- i = (++arc_numseg[num_mod]); +- arc_index[num_mod] = (char **) +- realloc(arc_index[num_mod], i * sizeof(char *)); +- nstrokes = 0; +- seg = (char **)&arc_index[num_mod][i-1]; +- *seg = (char *) malloc(10); +- spr4(*seg, nstrokes); +- xi = round2int(3600.0 * x); +- yi = round2int(3600.0 * y); +- spr3(*seg+4, xi); +- spr3(*seg+7, yi); +- } else +- seg = NULL; +- path_start = 1; +- pt1 = pt2; +- new_arc = 0; +- } else { +- draw_segment(scene, pt1, pt2, pix); +- if (path_start) { +- new_arc = 1; +- goto split_arc; +- } +- pt1 = pt2; +- if (seg) { +- dx = xi; +- dy = yi; +- xi = round2int(3600.0 * x); +- yi = round2int(3600.0 * y); +- dx = xi - dx; +- dy = yi - dy; +- if (dx || dy) { +- if (dx<0) { +- epsx = -1; +- dx = -dx; +- } else +- epsx = 1; +- if (dy<0) { +- epsy = -1; +- dy = -dy; +- } else +- epsy = 1; +- dxp = (dx+126)/127; +- dyp = (dy+126)/127; +- if (dxp>dyp) n = dxp; else n = dyp; +- nstrokes += n; +- *seg = (char *)realloc(*seg, 10+2*nstrokes); +- spr4(*seg, nstrokes); +- for (j=0; j<n; j++) { +- dxp = epsx * ((dx*(j+1))/n - (dx*j)/n); +- dyp = epsy * ((dy*(j+1))/n - (dy*j)/n); +- i = 10 + 2 * (nstrokes-n+j); +- (*seg)[i] = (char)(dxp&255); +- (*seg)[i+1] = (char)(dyp&255); +- } +- } +- } +- } +-} ++#define next_segment(ARG1, ARG2, COUNT) do { \ ++ double x = ARG1, y = ARG2, u, v, w, t; \ ++ int i, j, dx, dy, dxp, dyp, epsx, epsy; \ ++ if (arc_lambert) { \ ++ /* Inverse Lambert projection */ \ ++ u = x * arc_scale; \ ++ v = y * arc_scale - arc_transl; \ ++ w = atan(u/(-v)); \ ++ t = v/cos(w); \ ++ x = arc_lon0 + conv_lat0 * w; \ ++ y = atan(cotan_lat0 + t)/CONV + arc_lat0; \ ++ } \ ++ sp.sph[LONGITUDE] = x; \ ++ sp.sph[LATITUDE] = y; \ ++ if (arc_start==1 && fabs(x-arc_x)+fabs(y-arc_y)<0.05) { \ ++ arc_start = 2; \ ++ } \ ++ if (arc_start==3) \ ++ printf("%.6f %.6f\n", x, y); \ ++ pt2 = project(scene, spher2cart(scene, sp)); \ ++ split_arc ## COUNT: \ ++ if (new_arc) { \ ++ if (dump_file && num_mod!= -1) { \ ++ i = (++arc_numseg[num_mod]); \ ++ arc_index[num_mod] = (char **) \ ++ realloc(arc_index[num_mod], i * sizeof(char *)); \ ++ nstrokes = 0; \ ++ seg = (char **)&arc_index[num_mod][i-1]; \ ++ *seg = (char *) malloc(10); \ ++ spr4(*seg, nstrokes); \ ++ xi = round2int(3600.0 * x); \ ++ yi = round2int(3600.0 * y); \ ++ spr3(*seg+4, xi); \ ++ spr3(*seg+7, yi); \ ++ } else \ ++ seg = NULL; \ ++ path_start = 1; \ ++ pt1 = pt2; \ ++ new_arc = 0; \ ++ } else { \ ++ draw_segment(scene, pt1, pt2, pix); \ ++ if (path_start) { \ ++ new_arc = 1; \ ++ goto split_arc ## COUNT; \ ++ } \ ++ pt1 = pt2; \ ++ if (seg) { \ ++ dx = xi; \ ++ dy = yi; \ ++ xi = round2int(3600.0 * x); \ ++ yi = round2int(3600.0 * y); \ ++ dx = xi - dx; \ ++ dy = yi - dy; \ ++ if (dx || dy) { \ ++ if (dx<0) { \ ++ epsx = -1; \ ++ dx = -dx; \ ++ } else \ ++ epsx = 1; \ ++ if (dy<0) { \ ++ epsy = -1; \ ++ dy = -dy; \ ++ } else \ ++ epsy = 1; \ ++ dxp = (dx+126)/127; \ ++ dyp = (dy+126)/127; \ ++ if (dxp>dyp) n = dxp; else n = dyp; \ ++ nstrokes += n; \ ++ *seg = (char *)realloc(*seg, 10+2*nstrokes); \ ++ spr4(*seg, nstrokes); \ ++ for (j=0; j<n; j++) { \ ++ dxp = epsx * ((dx*(j+1))/n - (dx*j)/n); \ ++ dyp = epsy * ((dy*(j+1))/n - (dy*j)/n); \ ++ i = 10 + 2 * (nstrokes-n+j); \ ++ (*seg)[i] = (char)(dxp&255); \ ++ (*seg)[i+1] = (char)(dyp&255); \ ++ } \ ++ } \ ++ } \ ++ } \ ++} while(0) + + if (!arc_file) return; + pix = scene->color[C_FG_TICKS].pix; +@@ -5664,14 +5661,14 @@ void next_segment(double x, double y) + ptr[28] = '\0'; + n = sscanf(ptr, "%lg %lg", &a, &b); + if (n<2) continue; +- next_segment(a, b); ++ next_segment(a, b, 1); + ptr[28] = sep; + p = sscanf(ptr+28, "%lg %lg", &c, &d); +- if (p>=2) next_segment(c, d); ++ if (p>=2) next_segment(c, d, 2); + } else { + n = sscanf(ptr, "%lg %lg", &a, &b); + if (n<2) continue; +- next_segment(a, b); ++ next_segment(a, b, 3); + } + } + gzclose(fd); |