[surf-alggeo] 01/01: Imported Debian patch 1.0.6+ds-3: RC 831173 fix + enhancement + refrement
Jerome Benoit
calculus-guest at moszumanska.debian.org
Tue Aug 2 18:12:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
calculus-guest pushed a commit to branch master
in repository surf-alggeo.
commit 99e64f4ebd0a6071c3b026e8d663afb77dbce560
Author: Jerome Benoit <calculus at rezozer.net>
Date: Tue Aug 2 16:31:36 2016 +0100
Imported Debian patch 1.0.6+ds-3: RC 831173 fix + enhancement + refrement
---
debian/adhoc/examples/Makefile | 191 +++
debian/adhoc/examples/benchmark/chmutov_pn_16.pic | 130 ++
debian/changelog | 31 +-
debian/control | 9 +-
debian/patches/series | 9 +-
debian/patches/upstream-CC2help2man.patch | 11 +-
debian/patches/upstream-automatic_extension.patch | 212 +--
.../patches/upstream-autotoolization-update.patch | 2 +-
...pstream-bug-831173-gcc_6-collision-minmax.patch | 161 +++
.../upstream-c_cc-mismatch_correction.patch | 602 +++++++++
debian/patches/upstream-cc-silence.patch | 1367 ++++++++++++++++++++
.../patches/upstream-clip_mode-rationalize.patch | 107 ++
debian/patches/upstream-clip_to_rectangle.patch | 132 --
debian/patches/upstream-fork-ps2pdf-hardden.patch | 101 ++
.../patches/upstream-parallelization-surface.patch | 563 ++++++++
.../patches/upstream-stereo_draw-rationalize.patch | 129 ++
debian/patches/upstream-valgrind-silence.patch | 700 ++++++++++
debian/rules | 4 +-
debian/surf-alggeo-doc.examples | 1 +
debian/surf-alggeo-doc.links | 4 +
20 files changed, 4233 insertions(+), 233 deletions(-)
diff --git a/debian/adhoc/examples/Makefile b/debian/adhoc/examples/Makefile
new file mode 100644
index 0000000..dea02f8
--- /dev/null
+++ b/debian/adhoc/examples/Makefile
@@ -0,0 +1,191 @@
+
+default: all
+
+SURFALGGEO = /usr/bin/surf-alggeo
+
+
+DITHERCANDIDATES = clebsch cyclide
+
+SURFSCRIPTS = $(wildcard *.pic)
+
+COLORSURFSCRIPTS = $(SURFSCRIPTS)
+DITHERSURFSCRIPTS = $(filter $(addsuffix .pic,$(DITHERCANDIDATES)),$(SURFSCRIPTS))
+
+
+PGMPICTURES = $(patsubst %.pic,%.pgm,$(DITHERSURFSCRIPTS))
+PBMPICTURES = $(patsubst %.pic,%.pbm,$(DITHERSURFSCRIPTS))
+BMPPICTURES = $(patsubst %.pic,%.bmp,$(DITHERSURFSCRIPTS))
+TIFFPICTURES = $(patsubst %.pic,%.tiff,$(DITHERSURFSCRIPTS))
+GPDFPICTURES = $(patsubst %.pic,%-grey.pdf,$(DITHERSURFSCRIPTS))
+GEPSPICTURES = $(patsubst %.pic,%-grey.eps,$(DITHERSURFSCRIPTS))
+
+RASPICTURES = $(patsubst %.pic,%.ras,$(COLORSURFSCRIPTS))
+PPMPICTURES = $(patsubst %.pic,%.ppm,$(COLORSURFSCRIPTS))
+JPEGPICTURES = $(patsubst %.pic,%.jpeg,$(COLORSURFSCRIPTS))
+PDFPICTURES = $(patsubst %.pic,%.pdf,$(COLORSURFSCRIPTS))
+EPSPICTURES = $(patsubst %.pic,%.eps,$(COLORSURFSCRIPTS))
+
+
+DITHERCLEANFILES = $(PGMPICTURES) $(PBMPICTURES) $(BMPPICTURES) $(TIFFPICTURES) $(GPDFPICTURES) $(GEPSPICTURES)
+
+COLORCLEANFILES = $(RASPICTURES) $(PPMPICTURES) $(JPEGPICTURES) $(PDFPICTURES) $(EPSPICTURES)
+
+all: build
+
+compose-dither: pgm pbm bmp tiff gpdf geps
+
+compose-color: ras ppm jpeg pdf eps
+
+build: compose-dither compose-color
+
+
+pgm: $(PGMPICTURES)
+
+pbm: $(PBMPICTURES)
+
+bmp: $(BMPPICTURES)
+
+tiff: $(TIFFPICTURES)
+
+gpdf: $(GPDFPICTURES)
+
+geps: $(GEPSPICTURES)
+
+ras: $(RASPICTURES)
+
+ppm: $(PPMPICTURES)
+
+jpeg: $(JPEGPICTURES)
+
+pdf: $(PDFPICTURES)
+
+eps: $(EPSPICTURES)
+
+
+buildclean:
+ $(RM) $(COMPOSEDIR)/*
+ test ! -d $(COMPOSEDIR) || $(RMDIR) $(COMPOSEDIR)
+
+clean: buildclean
+ $(if $(strip $(DITHERCLEANFILES)),$(RM) $(DITHERCLEANFILES),)
+ $(if $(strip $(COLORCLEANFILES)),$(RM) $(COLORCLEANFILES),)
+
+%.pgm : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _pgm_prefix:=$(COMPOSEDIR)/pgm%)
+ printf "dither_file_format=pgm;\n" > $(_pgm_prefix)$(<F)
+ cat $< >> $(_pgm_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=pgm;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_pgm_prefix)$(<F)
+ $(SURFALGGEO) $(_pgm_prefix)$(<F)
+
+%.pbm : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _pbm_prefix:=$(COMPOSEDIR)/pbm%)
+ printf "dither_file_format=pbm;\n" > $(_pbm_prefix)$(<F)
+ cat $< >> $(_pbm_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=pbm;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_pbm_prefix)$(<F)
+ $(SURFALGGEO) $(_pbm_prefix)$(<F)
+
+%.bmp : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _bmp_prefix:=$(COMPOSEDIR)/bmp%)
+ printf "dither_file_format=pbm;\n" > $(_bmp_prefix)$(<F)
+ cat $< >> $(_bmp_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=X11_bitmap;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_bmp_prefix)$(<F)
+ $(SURFALGGEO) $(_bmp_prefix)$(<F)
+
+%.tiff : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _tiff_prefix:=$(COMPOSEDIR)/tiff%)
+ printf "dither_file_format=pbm;\n" > $(_tiff_prefix)$(<F)
+ cat $< >> $(_tiff_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=tiff;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_tiff_prefix)$(<F)
+ $(SURFALGGEO) $(_tiff_prefix)$(<F)
+
+%-grey.pdf : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _gpdf_prefix:=$(COMPOSEDIR)/gpdf%)
+ printf "dither_file_format=pdf;\n" > $(_gpdf_prefix)$(<F)
+ cat $< >> $(_gpdf_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=pdf;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_gpdf_prefix)$(<F)
+ $(SURFALGGEO) $(_gpdf_prefix)$(<F)
+
+%-grey.eps : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _geps_prefix:=$(COMPOSEDIR)/geps%)
+ printf "dither_file_format=encapsulated;\n" > $(_geps_prefix)$(<F)
+ cat $< >> $(_geps_prefix)$(<F)
+ printf "\n\n//\ndither_file_format=encapsulated;\nfilename=\"%s\";\nsave_dithered_image;\n" \
+ $(abspath $@) \
+ >> $(_geps_prefix)$(<F)
+ $(SURFALGGEO) $(_geps_prefix)$(<F)
+
+%.ras : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _ras_prefix:=$(COMPOSEDIR)/ras%)
+ printf "color_file_colormap=Optimized;\ncolor_file_format=sun;\n" > $(_ras_prefix)$(<F)
+ cat $< >> $(_ras_prefix)$(<F)
+ printf "\n\n//\ncolor_file_colormap=Optimized;\ncolor_file_format=sun;\nfilename=\"%s\";\nsave_color_image;\n" \
+ $(abspath $@) \
+ >> $(_ras_prefix)$(<F)
+ $(SURFALGGEO) $(_ras_prefix)$(<F)
+
+%.ppm : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _ppm_prefix:=$(COMPOSEDIR)/ppm%)
+ printf "color_file_colormap=Optimized;\ncolor_file_format=ppm;\n" > $(_ppm_prefix)$(<F)
+ cat $< >> $(_ppm_prefix)$(<F)
+ printf "\n\n//\ncolor_file_colormap=Optimized;\ncolor_file_format=ppm;\nfilename=\"%s\";\nsave_color_image;\n" \
+ $(abspath $@) \
+ >> $(_ppm_prefix)$(<F)
+ $(SURFALGGEO) $(_ppm_prefix)$(<F)
+
+%.jpeg : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _jpeg_prefix:=$(COMPOSEDIR)/jpeg%)
+ printf "color_file_colormap=Optimized;\ncolor_file_format=jpg;\n" > $(_jpeg_prefix)$(<F)
+ cat $< >> $(_jpeg_prefix)$(<F)
+ printf "\n\n//\ncolor_file_colormap=Optimized;\ncolor_file_format=jpg;\nfilename=\"%s\";\nsave_color_image;\n" \
+ $(abspath $@) \
+ >> $(_jpeg_prefix)$(<F)
+ $(SURFALGGEO) $(_jpeg_prefix)$(<F)
+
+%.pdf : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _pdf_prefix:=$(COMPOSEDIR)/pdf%)
+ printf "color_file_colormap=TrueColor;\ncolor_file_format=pdf_color;\n" > $(_pdf_prefix)$(<F)
+ cat $< >> $(_pdf_prefix)$(<F)
+ printf "\n\n//\ncolor_file_colormap=TrueColor;\ncolor_file_format=pdf_color;\nfilename=\"%s\";\nsave_color_image;\n" \
+ $(abspath $@) \
+ >> $(_pdf_prefix)$(<F)
+ $(SURFALGGEO) $(_pdf_prefix)$(<F)
+
+%.eps : %.pic
+ $(MKDIR_P) $(COMPOSEDIR)
+ $(eval _eps_prefix:=$(COMPOSEDIR)/eps%)
+ printf "color_file_colormap=Netscape;\ncolor_file_format=encapsulatedpostscript_color;\n" > $(_eps_prefix)$(<F)
+ cat $< >> $(_eps_prefix)$(<F)
+ printf "\n\n//\ncolor_file_colormap=Netscape;\ncolor_file_format=encapsulatedpostscript_color;\nfilename=\"%s\";\nsave_color_image;\n" \
+ $(abspath $@) \
+ >> $(_eps_prefix)$(<F)
+ $(SURFALGGEO) $(_eps_prefix)$(<F)
+
+
+COMPOSEDIR ?= $(TMPDIR)/mk/$(subst /,%,$(realpath $(firstword $(MAKEFILE_LIST))))%compose
+
+TMPDIR ?= /tmp
+
+MKDIR_P ?= /bin/mkdir -p
+RMDIR ?= /bin/rmdir
+
+#.NOTPARALLEL:
diff --git a/debian/adhoc/examples/benchmark/chmutov_pn_16.pic b/debian/adhoc/examples/benchmark/chmutov_pn_16.pic
new file mode 100644
index 0000000..56e9ee4
--- /dev/null
+++ b/debian/adhoc/examples/benchmark/chmutov_pn_16.pic
@@ -0,0 +1,130 @@
+light1_x =-100.0;
+light1_y =100.0;
+light1_z =100.0;
+light1_vol =50;
+light1_red =255;
+light1_green =255;
+light1_blue =255;
+light2_x =5.773502;
+light2_y =5.773502;
+light2_z =5.773502;
+light2_vol =70;
+light2_red =255;
+light2_green =255;
+light2_blue =255;
+light3_x =0.0;
+light3_y =-100.0;
+light3_z =100.0;
+light3_vol =30;
+light3_red =255;
+light3_green =255;
+light3_blue =255;
+light4_x =0.0;
+light4_y =0.0;
+light4_z =0.0;
+light4_vol =0;
+light4_red =0;
+light4_green =0;
+light4_blue =0;
+light5_x =0.0;
+light5_y =0.0;
+light5_z =0.0;
+light5_vol =0;
+light5_red =0;
+light5_green =0;
+light5_blue =0;
+light6_x =0.0;
+light6_y =0.0;
+light6_z =0.0;
+light6_vol =0;
+light6_red =0;
+light6_green =0;
+light6_blue =0;
+light7_x =0.0;
+light7_y =0.0;
+light7_z =0.0;
+light7_vol =0;
+light7_red =0;
+light7_green =0;
+light7_blue =0;
+light8_x =0.0;
+light8_y =0.0;
+light8_z =0.0;
+light8_vol =0;
+light8_red =0;
+light8_green =0;
+light8_blue =0;
+light9_x =0.0;
+light9_y =0.0;
+light9_z =0.0;
+light9_vol =0;
+light9_red =0;
+light9_green =0;
+light9_blue =0;
+root_finder = d_chain_bisection; epsilon = 0.00000001;
+illumination = ambient_light + diffuse_light + reflected_light + transmitted_light;
+ambient = 40;
+diffuse = 80;
+reflected = 80;
+transmitted = 20;
+smoothness = 50;
+transparence = 0;
+thickness = 10;
+antialiasing = 6;
+background_red=0;
+background_green=0;
+background_blue=0;
+rot_x=0.0; rot_y=0.0; rot_z=0.0;
+scale_x=0.175;//19342359767891684;
+scale_y=0.175;//19342359767891684;
+scale_z=0.175;//19342359767891684;
+double PI = 2*arcsin(1);
+// the parameters:
+double a=0.05;
+a=a;
+
+// the equations (maple): (ChebyshevT(16,x)+ChebyshevT(16,y)+ChebyshevT(16,z)+1-2*a)/lcoeff(simplify(ChebyshevT(16,x)))
+surface = x^16+y^16+z^16-4*x^14-4*y^14-4*z^14+(13/2)*x^12+(13/2)*y^12+(13/2)*z^12-(11/2)*x^10-(11/2)*y^10-(11/2)*z^10+(165/64)*x^8+(165/64)*y^8+(165/64)*z^8-(21/32)*x^6-(21/32)*y^6-(21/32)*z^6+(21/256)*x^4+(21/256)*y^4+(21/256)*z^4-(1/256)*x^2-(1/256)*y^2-(1/256)*z^2-(1/16384)*a+1/8192;
+
+surface_red = 255;
+surface_green = 51;
+surface_blue = 102;
+inside_red = 204;
+inside_green = 204;
+inside_blue = 204;
+transparence = 20;
+
+
+////
+width=809;
+height=width;
+
+// the solitary points (shown as spheres):
+
+// the rotation:
+surface=rotate(surface,0.0,yAxis);
+surface=rotate(surface,0.0,xAxis);
+surface=rotate(surface,0.0,zAxis);
+surface=rotate(surface,0.7478010935627327,yAxis);
+surface=rotate(surface,-1.0747380621005074,xAxis);
+surface=rotate(surface,-0.7667143729550303,zAxis);
+clip = sphere;
+radius = 10.0;
+
+// the rotation:
+draw_surface;
+
+// the curves:
+
+// save the image:
+filename="chmutov_pn_16-"+itostr(width)+"x"+itostr(height)+".xxx";
+color_file_format=ppm;
+save_color_image;
+
+filename="chmutov_pn_16-"+itostr(width)+"x"+itostr(height)+".xxx";
+background=0.125;
+//dithering_method=floyd_steinberg_filter;
+dither_surface;
+resolution=res_1200dpi;
+dither_file_format=pgm;
+save_dithered_image;
diff --git a/debian/changelog b/debian/changelog
index 20f85de..166ffe9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,12 +1,35 @@
+surf-alggeo (1.0.6+ds-3) unstable; urgency=medium
+
+ * FTBFS fix release (Closes: #831173), workaround min/max collision
+ (thanks to Lucas Nussbaum <lucas at debian.org> for reporting the issue).
+ * Debianization:
+ - debian/control
+ - Standards Version, bump to 3.9.8;
+ - Vcs-* headers, secure;
+ - correct;
+ - debian/rules:
+ - dpkg-buildflags, add hardening=+all;
+ - refresh;
+ - debian/patches/:
+ - automatic extension, hardden;
+ - (internal) clip mode, rationalize;
+ - ps2pdf fork, hardden;
+ - warning emitted by gcc, attempt to silence;
+ - memory leaks and other oddities revealed by valgrind, attempt to fix;
+ - drawing parallelization, initiate;
+ - clip to rectangle, wipe out in favor of drawing parallelizaton.
+
+ -- Jerome Benoit <calculus at rezozer.net> Tue, 02 Aug 2016 15:40:00 +0000
+
surf-alggeo (1.0.6+ds-2) unstable; urgency=medium
* Debianization:
- -debian/patches/:
- - autotool chain:
+ - debian/patches/:
+ - autotools chain:
- libjepg find and check, harden;
- GMP find and check, refresh;
- - clip to rectangle, correct important bug;
- - automatic extension, bring to dithered image.
+ - clip to rectangle, correct important bug;
+ - automatic extension, bring to dithered image.
-- Jerome Benoit <calculus at rezozer.net> Thu, 14 May 2015 12:09:42 +0000
diff --git a/debian/control b/debian/control
index c0a0925..b23fc03 100644
--- a/debian/control
+++ b/debian/control
@@ -13,15 +13,14 @@ Build-Depends-Indep:
linuxdoc-tools,
texlive-base-bin, texlive-latex-base,
texlive-latex-recommended, texlive-fonts-recommended
-Standards-Version: 3.9.6
+Standards-Version: 3.9.8
Homepage: http://surf.sourceforge.net/
-Vcs-Git: git://anonscm.debian.org/debian-science/packages/surf-alggeo.git
-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/surf-alggeo.git
+Vcs-Git: https://anonscm.debian.org/git/debian-science/packages/surf-alggeo.git
+Vcs-Browser: https://anonscm.debian.org/cgit/debian-science/packages/surf-alggeo.git
Package: surf-alggeo
-Architecture: all
+Architecture: any
Depends: surf-alggeo-nox, ${misc:Depends}
-Multi-Arch: foreign
Description: visualization of real algebraic geometry
Surf is a script driven tool to visualize some real algebraic geometry:
plane algebraic curves, algebraic surfaces and hyperplane sections of
diff --git a/debian/patches/series b/debian/patches/series
index 3efc0dd..3cddb4c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,12 +1,19 @@
+upstream-bug-831173-gcc_6-collision-minmax.patch
upstream-autotoolization-update.patch
upstream-flex-update.patch
+upstream-c_cc-mismatch_correction.patch
+upstream-cc-silence.patch
+upstream-valgrind-silence.patch
+upstream-clip_mode-rationalize.patch
upstream-nox-options.patch
upstream-option-quiet.patch
upstream-automatic_extension.patch
-upstream-clip_to_rectangle.patch
upstream-CC2help2man.patch
upstream-autotoolization-help2man.patch
upstream-help2man-automatic_extension.patch
+upstream-fork-ps2pdf-hardden.patch
+upstream-stereo_draw-rationalize.patch
+upstream-parallelization-surface.patch
debianization.patch
debianization-documentation.patch
debianization-help2man.patch
diff --git a/debian/patches/upstream-CC2help2man.patch b/debian/patches/upstream-CC2help2man.patch
index 5d7a7b5..d387014 100644
--- a/debian/patches/upstream-CC2help2man.patch
+++ b/debian/patches/upstream-CC2help2man.patch
@@ -17,7 +17,7 @@ Last-Update: 2015-04-10
<< "Usage: " << surf_name
#ifndef NO_GUI
<< " [-n|--no-gui] [FILE]..." << std::endl
-@@ -56,31 +56,32 @@
+@@ -56,26 +56,27 @@
<< " [GTK-OPTIONS] [-x|--exec] [--progress-dialog] [--auto-resize]"
#endif
<< " [FILE]..." << std::endl
@@ -42,13 +42,6 @@ Last-Update: 2015-04-10
+ << " disable automatic extension for graphic files (default)" << std::endl
+ << " --enable-auto-extension" << std::endl
+ << " enable automatic extension for graphic files" << std::endl
- #ifdef NO_GUI
- << std::endl
-- << " --clip-to-rectangle x_min y_min x_max y_max" << std::endl
-- << " clip images to the specified rectangle" << std::endl
-+ << " --clip-to-rectangle x_min y_min x_max y_max" << std::endl
-+ << " clip images to the specified rectangle" << std::endl
- #endif
<< std::endl
- << "-v, --verbose verbose operation, print the executed commands (default)" << std::endl
- << "-q, --quiet, --silent quiet operation, do not print the executed commands" << std::endl
@@ -65,7 +58,7 @@ Last-Update: 2015-04-10
#endif
;
}
-@@ -116,10 +117,10 @@
+@@ -108,10 +109,10 @@
execute = true;
#endif
} else if(strcmp(argv[i], "--copyright") == 0) {
diff --git a/debian/patches/upstream-automatic_extension.patch b/debian/patches/upstream-automatic_extension.patch
index 318da5f..f77000e 100644
--- a/debian/patches/upstream-automatic_extension.patch
+++ b/debian/patches/upstream-automatic_extension.patch
@@ -13,7 +13,7 @@ Description: upstream: automatic extension machinery enhancement
Origin: debian
Forwarded: submitted
Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2015-04-10
+Last-Update: 2015-05-15
--- a/yaccsrc/Script.cc
+++ b/yaccsrc/Script.cc
@@ -26,7 +26,7 @@ Last-Update: 2015-04-10
// #define DEBUG
#include "debug.h"
-@@ -432,6 +434,8 @@
+@@ -469,6 +471,8 @@
void Script::saveColorImage ()
{
@@ -35,14 +35,25 @@ Last-Update: 2015-04-10
if (Thread::shouldStop())
return;
-@@ -442,9 +446,55 @@
+@@ -479,9 +483,59 @@
if (!surface_filename_data) {
Misc::alert ("no filename given.");
+ return ;
- }
-
--// const char *name = surface_filename_data;
++ }
++
++ if ( (color_output_data != color_output_xwd_data)
++ && (color_output_data != color_output_sun_data)
++ && (color_output_data != color_output_ppm_data)
++ && (color_output_data != color_output_jpeg_data)
++ && (color_output_data != color_output_postscript_data)
++ && (color_output_data != color_output_encapsulatedpostscript_data)
++ && (color_output_data != color_output_pdf_data)
++ ) {
++ Misc::alert ("color_file_format out of range. no saving done.");
++ return;
++ }
++
+ char * surface_filename_data_extension=strrchr(surface_filename_data,'.');
+
+ if ((surface_filename_data_extension != NULL) &&
@@ -70,29 +81,22 @@ Last-Update: 2015-04-10
+ ) {
+ auto_extension = true;
+ }
-+ }
-+
+ }
+
+-// const char *name = surface_filename_data;
+ if(auto_extension) {
-+ if (color_output_data == color_output_xwd_data) {
-+ strcat(surface_filename_data, ".xwd");
-+ } else if (color_output_data == color_output_sun_data) {
-+ strcat(surface_filename_data, ".ras");
-+ } else if (color_output_data == color_output_ppm_data) {
-+ strcat(surface_filename_data, ".ppm");
-+ } else if (color_output_data == color_output_jpeg_data) {
-+ strcat(surface_filename_data, ".jpg");
-+ } else if (color_output_data == color_output_postscript_data) {
-+ strcat(surface_filename_data, ".ps");
-+ } else if (color_output_data == color_output_encapsulatedpostscript_data) {
-+ strcat(surface_filename_data, ".eps");
-+ } else if (color_output_data == color_output_pdf_data) {
-+ strcat(surface_filename_data, ".pdf");
-+ }
++ if (color_output_data == color_output_xwd_data) { strcat(surface_filename_data, ".xwd"); }
++ else if (color_output_data == color_output_sun_data) { strcat(surface_filename_data, ".ras"); }
++ else if (color_output_data == color_output_ppm_data) { strcat(surface_filename_data, ".ppm"); }
++ else if (color_output_data == color_output_jpeg_data) { strcat(surface_filename_data, ".jpg"); }
++ else if (color_output_data == color_output_postscript_data) { strcat(surface_filename_data, ".ps"); }
++ else if (color_output_data == color_output_encapsulatedpostscript_data) { strcat(surface_filename_data, ".eps"); }
++ else if (color_output_data == color_output_pdf_data) { strcat(surface_filename_data, ".pdf"); }
+ }
/* Fuck, fuck, fuck...why cant I just have working exceptions with
* every every version of gcc I can think of (especially 2.7.x)...
-@@ -452,22 +502,6 @@
+@@ -489,22 +543,6 @@
* I could have just thrown an exception in FileWriter if the file couldnt
* be opened. But now Ive got to open the file too early...
*/
@@ -115,7 +119,37 @@ Last-Update: 2015-04-10
FileWriter fw (surface_filename_data);
FILE *f = fw.openFile();
-@@ -571,6 +605,8 @@
+@@ -539,14 +577,10 @@
+ buffer->write_as_eps (fw.openFile(),print_color_resolution_array_data[print_color_resolution_data]);
+ } else if (color_output_data == color_output_pdf_data) {
+ buffer->write_as_pdf (fw.openFile(),print_color_resolution_array_data[print_color_resolution_data], fw.getName());
+-
+ }
+ }
+
+
+-
+-
+-
+ void Script::clearScreen()
+ {
+ if (Thread::shouldStop())
+@@ -570,7 +604,7 @@
+ }
+ // main_newcolor_init ( );
+ intensity->NullInit_three( );
+-
++
+ *zbuffer = (float)clip_numeric.clip_back;
+ }
+
+@@ -602,12 +636,13 @@
+ intensity->clearTags();
+
+ *zbuffer = (float)clip_numeric.clip_back;
+-
+ }
+
void Script::saveDitheredImage()
{
@@ -124,7 +158,7 @@ Last-Update: 2015-04-10
if (Thread::shouldStop())
return;
-@@ -578,87 +614,101 @@
+@@ -615,89 +650,97 @@
BEGIN("Script::saveDitheredImage");
Thread::setDoing ("saving dithered image...");
@@ -153,11 +187,22 @@ Last-Update: 2015-04-10
- strcat(surface_filename_data, ".pdf");
- break;
- default :
-- Misc::alert ("dither_file_format out of range. no saving done.");
-- break;
+ if (!surface_filename_data) {
+ Misc::alert ("no filename given.");
+ return ;
++ }
++
++ if ( (print_output_data != print_output_ps_data)
++ && (print_output_data != print_output_eps_data)
++ && (print_output_data != print_output_bitmap_data)
++ && (print_output_data != print_output_tiff_data)
++ && (print_output_data != print_output_pgm_data)
++ && (print_output_data != print_output_pbm_data)
++ && (print_output_data != print_output_pdf_data)
++ ) {
+ Misc::alert ("dither_file_format out of range. no saving done.");
+- break;
++ return;
}
- char *name = surface_filename_data;
@@ -178,13 +223,13 @@ Last-Update: 2015-04-10
+ }
+ else if(options->get_auto_extension()) {
+ if ((surface_filename_data_extension == NULL) ||
-+ (!(((print_output_data == 0) && (strcmp(surface_filename_data_extension, ".ps") == 0))
-+ || ((print_output_data == 1) && (strcmp(surface_filename_data_extension, ".eps") == 0))
-+ || ((print_output_data == 2) && (strcmp(surface_filename_data_extension, ".bmp") == 0))
-+ || ((print_output_data == 3) && (strcmp(surface_filename_data_extension, ".tiff") == 0))
-+ || ((print_output_data == 5) && (strcmp(surface_filename_data_extension, ".pgm") == 0))
-+ || ((print_output_data == 6) && (strcmp(surface_filename_data_extension, ".pbm") == 0))
-+ || ((print_output_data == 7) && (strcmp(surface_filename_data_extension, ".pdf") == 0))
++ (!(((print_output_data == print_output_ps_data) && (strcmp(surface_filename_data_extension, ".ps") == 0))
++ || ((print_output_data == print_output_eps_data) && (strcmp(surface_filename_data_extension, ".eps") == 0))
++ || ((print_output_data == print_output_bitmap_data) && (strcmp(surface_filename_data_extension, ".bmp") == 0))
++ || ((print_output_data == print_output_tiff_data) && (strcmp(surface_filename_data_extension, ".tiff") == 0))
++ || ((print_output_data == print_output_pgm_data) && (strcmp(surface_filename_data_extension, ".pgm") == 0))
++ || ((print_output_data == print_output_pbm_data) && (strcmp(surface_filename_data_extension, ".pbm") == 0))
++ || ((print_output_data == print_output_pdf_data) && (strcmp(surface_filename_data_extension, ".pdf") == 0))
+ ))
+ ) {
+ auto_extension = true;
@@ -192,22 +237,13 @@ Last-Update: 2015-04-10
+ }
+
+ if(auto_extension) {
-+ switch( print_output_data ) {
-+ case 0: strcat(surface_filename_data, ".ps"); break;
-+ case 1: strcat(surface_filename_data, ".eps"); break;
-+ case 2: strcat(surface_filename_data, ".bmp"); break;
-+ case 3: strcat(surface_filename_data, ".tiff"); break;
-+ case 5: strcat(surface_filename_data, ".pgm"); break;
-+ case 6: strcat(surface_filename_data, ".pbm"); break;
-+ case 7: strcat(surface_filename_data, ".pdf"); break;
-+ default: Misc::alert ("dither_file_format out of range, no saving done."); break;
-+ }
-+ }
-+ else {
-+ switch( print_output_data ) {
-+ case 0: case 1: case 2: case 3: case 5: case 6: case 7: break;
-+ default: Misc::alert ("dither_file_format out of range, no saving done."); break;
-+ }
++ if (print_output_data == print_output_ps_data) { strcat(surface_filename_data, ".ps"); }
++ else if (print_output_data == print_output_eps_data) { strcat(surface_filename_data, ".eps"); }
++ else if (print_output_data == print_output_bitmap_data) { strcat(surface_filename_data, ".bmp"); }
++ else if (print_output_data == print_output_tiff_data) { strcat(surface_filename_data, ".tiff"); }
++ else if (print_output_data == print_output_pgm_data) { strcat(surface_filename_data, ".pgm"); }
++ else if (print_output_data == print_output_pbm_data) { strcat(surface_filename_data, ".pbm"); }
++ else if (print_output_data == print_output_pdf_data) { strcat(surface_filename_data, ".pdf"); }
+ }
+
+ FileWriter fw (surface_filename_data);
@@ -220,55 +256,71 @@ Last-Update: 2015-04-10
return;
}
-
+- switch( print_output_data ) {
+- case 0 :
+- psprint (*pixel, fw.openFile(),
+- print_resolution_array_data[print_resolution_data]);
+- break;
+-
+- case 1 :
+- epsprint (*pixel, fw.openFile(),
+- print_resolution_array_data[print_resolution_data] );
+- break;
+-
+- case 2 :
+
+ bit_buffer *pixel = getBitBuffer();
+
- switch( print_output_data ) {
- case 0 :
- psprint (*pixel, fw.openFile(),
- print_resolution_array_data[print_resolution_data]);
- break;
--
- case 1 :
- epsprint (*pixel, fw.openFile(),
- print_resolution_array_data[print_resolution_data] );
- break;
--
- case 2 :
++ if (print_output_data == print_output_ps_data) {
++ psprint (*pixel, fw.openFile(), print_resolution_array_data[print_resolution_data]);
++ }
++ else if (print_output_data == print_output_eps_data) {
++ epsprint (*pixel, fw.openFile(), print_resolution_array_data[print_resolution_data]);
++ }
++ else if (print_output_data == print_output_bitmap_data) {
bitmapprint (*pixel, fw.openFile(), fw.getName());
- break;
+- break;
-
- case 3 :
+- case 3 :
++ }
++ else if (print_output_data == print_output_tiff_data) {
if (fw.isWritingToPipe()) {
Misc::alert ("Tiff images can only be written to a file.");
return;
}
- tiffprint (*pixel, name,
-+ tiffprint (*pixel, surface_filename_data,
- print_resolution_array_data[print_resolution_data]);
- break;
+- print_resolution_array_data[print_resolution_data]);
+- break;
-
- case 5:
+- case 5:
++ tiffprint (*pixel, surface_filename_data, print_resolution_array_data[print_resolution_data]);
++ }
++ else if (print_output_data == print_output_pgm_data) {
pixel->write_as_pgm (fw.openFile());
- break;
+- break;
-
- case 6:
+- case 6:
++ }
++ else if (print_output_data == print_output_pbm_data) {
pixel->write_as_pbm (fw.openFile());
- break;
+- break;
-
- case 7:
- pdfprint (*pixel, fw.openFile(),
-+ case 7:
-+ pdfprint (*pixel, fw.openFile(),
- print_resolution_array_data[print_resolution_data], fw.getName());
- break;
+- print_resolution_array_data[print_resolution_data], fw.getName());
+- break;
-
- default :
+- default :
- Misc::alert ("dither_file_format out of range. no saving done.");
-+ Misc::alert ("dither_file_format out of range, no saving done.");
- break;
- }
+- break;
+- }
++ }
++ else if (print_output_data == print_output_pdf_data) {
++ pdfprint (*pixel, fw.openFile(), print_resolution_array_data[print_resolution_data], fw.getName());
++ }
}
+
+ void Script::ditherSurface()
--- a/src/Options.h
+++ b/src/Options.h
@@ -15,6 +15,7 @@
diff --git a/debian/patches/upstream-autotoolization-update.patch b/debian/patches/upstream-autotoolization-update.patch
index 6cf09ba..476c51a 100644
--- a/debian/patches/upstream-autotoolization-update.patch
+++ b/debian/patches/upstream-autotoolization-update.patch
@@ -637,8 +637,8 @@ Last-Update: 2015-04-27
+ polyarith.cc polyarith.h \
+ polyroot.cc polyroot.h \
+ polyx.cc polyx.h \
-+ simple.cc simple.h \
+ polyyacc.y polylex.l polylexyacc.h degree.h \
++ simple.cc simple.h \
+ lexfunc.cc \
+ SymbolTable.cc SymbolTable.h \
+ Script.cc Script.h \
diff --git a/debian/patches/upstream-bug-831173-gcc_6-collision-minmax.patch b/debian/patches/upstream-bug-831173-gcc_6-collision-minmax.patch
new file mode 100644
index 0000000..6765323
--- /dev/null
+++ b/debian/patches/upstream-bug-831173-gcc_6-collision-minmax.patch
@@ -0,0 +1,161 @@
+Description: upstream -- RC bug fix 831173 -- min/max name collision
+ Capitalize min (resp. max) macro name.
+Origin: Debian
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2016-08-02
+
+--- a/draw/NewClipSphereParallel.cc
++++ b/draw/NewClipSphereParallel.cc
+@@ -49,8 +49,8 @@
+ zmax = cz + h;
+ // fixme
+ // mach ich doch ...
+- zmin = max( zmin,cb /*-10.0*/ /*cb*/);
+- zmax = min( zmax,cf /*10.0*/ /*cf*/ );
++ zmin = MAX( zmin,cb /*-10.0*/ /*cb*/);
++ zmax = MIN( zmax,cf /*10.0*/ /*cf*/ );
+
+ return TRUE;
+ } else {
+--- a/draw/SurfaceCalc.cc
++++ b/draw/SurfaceCalc.cc
+@@ -628,8 +628,8 @@
+ if( ( obj_color == color_gradient_data - 1 &&
+ color_gradient_data ) || color_gradient_data==3 ) {
+ fadecol = ( P.z - cm )/cd + 0.5;
+- fadecol = max( fadecol,0.0 );
+- fadecol = min( fadecol,1.0 );
++ fadecol = MAX( fadecol,0.0 );
++ fadecol = MIN( fadecol,1.0 );
+ } else {
+ fadecol = 1.0;
+ }
+@@ -699,8 +699,8 @@
+
+ if( !display_depth_cue_data ) {
+ fade = 1.3*( P.z - display_depth_value_data )/cd;
+- fade = max( fade,0.0 );
+- fade = min( fade,1.0 );
++ fade = MAX( fade,0.0 );
++ fade = MIN( fade,1.0 );
+
+ I *= fade;
+ }
+@@ -737,7 +737,7 @@
+ return;
+ }
+ else {
+- fade = min( fade,1.0 );
++ fade = MIN( fade,1.0 );
+ }
+ }
+
+@@ -913,7 +913,7 @@
+ if( light_settings[best_i].thickness > 0 ) {
+ if( N.z > 0 ) {
+ double tmp = light_settings[best_i].thickness/(30.0*N.z);
+- transfak = pow( transparence,min( tmp,4.0 ) );
++ transfak = pow( transparence,MIN( tmp,4.0 ) );
+ } else {
+ transfak = pow( transparence,4.0 );
+ }
+@@ -1049,7 +1049,7 @@
+ double tmp;
+ float distf = display_numeric.stereo_z*display_numeric.stereo_eye/
+ position_numeric.spectator_z;
+- int dist = (int)(distf*((float)(min(main_width_data,main_height_data)))/20.0);
++ int dist = (int)(distf*((float)(MIN(main_width_data,main_height_data)))/20.0);
+ int pxdist;
+
+ initVars();
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -414,7 +414,7 @@
+ float distf = display_numeric.stereo_z*display_numeric.stereo_eye/
+ position_numeric.spectator_z;
+ int dist = (int)(distf*((float)
+- (min(main_width_data,main_height_data)))/20.0);
++ (MIN(main_width_data,main_height_data)))/20.0);
+
+ SurfaceCalc sc;
+ sc.setDisplay (getDisplay());
+@@ -851,7 +851,7 @@
+ //float distf = display_numeric.stereo_z*display_numeric.stereo_eye/
+ // position_numeric.spectator_z;
+ //int dist = (int)(distf*((float)
+- // (min(main_width_data,main_height_data)))/20.0);
++ // (MIN(main_width_data,main_height_data)))/20.0);
+ SurfaceCalc sc;
+ sc.setDisplay(Script::getDisplay());
+ Polyxyz p1 (sc.sf_ds.getFormula (curve_surface_nr_data)->pxyz);
+--- a/src/float_buffer.cc
++++ b/src/float_buffer.cc
+@@ -107,8 +107,8 @@
+
+ void float_buffer::Copy( const float_buffer& alt )
+ {
+- int xm = min( width, alt.width );
+- int ym = min( height, alt.height );
++ int xm = MIN( width, alt.width );
++ int ym = MIN( height, alt.height );
+ for( int y = 0; y < ym; y++ )
+ for( int x = 0; x < xm; x++ )
+ b[y*width+x] = alt.Get( x, y );
+@@ -121,7 +121,7 @@
+ void float_buffer::CopyLine( const float_buffer& alt, int src, int dest )
+ {
+ if( dest >= 0 && dest < height ) {
+- int xm = min( width, alt.width );
++ int xm = MIN( width, alt.width );
+ for( int x = 0; x < xm; x++ )
+ b[dest*width+x]=alt.Get(x,src);
+ }
+--- a/src/RgbBuffer.cc
++++ b/src/RgbBuffer.cc
+@@ -257,8 +257,8 @@
+
+ void RgbBuffer::Copy( const RgbBuffer& alt )
+ {
+- int xm = min( width, alt.width );
+- int ym = min( height, alt.height );
++ int xm = MIN( width, alt.width );
++ int ym = MIN( height, alt.height );
+
+ for( int y = 0; y < ym; y++ ) {
+ for( int x = 0; x < xm; x++ ) {
+@@ -278,7 +278,7 @@
+ void RgbBuffer::CopyLine( const RgbBuffer& alt, int src, int dest )
+ {
+ if( dest >= 0 && dest < height ) {
+- int xm = min( width, alt.width );
++ int xm = MIN( width, alt.width );
+
+ for( int x = 0; x < xm; x++ ) {
+ r[dest*width+x] = alt.r[src*width+x];
+--- a/src/def.h
++++ b/src/def.h
+@@ -82,18 +82,18 @@
+ #endif
+
+ #define MIN(a,b) ( ((a)<(b))?(a):(b) )
+-#ifndef min
+-#define min(a,b) ( ((a)<(b))?(a):(b) )
+-#endif
++/* #ifndef min */
++/* #define min(a,b) ( ((a)<(b))?(a):(b) ) */
++/* #endif */
+
+ #ifdef MAX
+ #undef MAX
+ #endif
+
+ #define MAX(a,b) ( ((a)<(b))?(b):(a) )
+-#ifndef max
+-#define max(a,b) ( ((a)<(b))?(b):(a) )
+-#endif
++/* #ifndef max */
++/* #define max(a,b) ( ((a)<(b))?(b):(a) ) */
++/* #endif */
+
+
+ #ifndef TRUE
diff --git a/debian/patches/upstream-c_cc-mismatch_correction.patch b/debian/patches/upstream-c_cc-mismatch_correction.patch
new file mode 100644
index 0000000..768550b
--- /dev/null
+++ b/debian/patches/upstream-c_cc-mismatch_correction.patch
@@ -0,0 +1,602 @@
+Description: upstream -- C/C++ mismatch: correction
+ Correct C/C++ symbol issue introduced by renaming a C source as a C++ source,
+ what created C++ symbols where C symbols were expected.
+Origin: debian
+Forwarded: meant to be submitted to the upstream maintainer team
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-05-30
+
+--- /dev/null
++++ b/yaccsrc/simple.c
+@@ -0,0 +1,243 @@
++/*
++ * surf - visualizing algebraic curves and algebraic surfaces
++ * Copyright (C) 1996-1997 Friedrich-Alexander-Universitaet
++ * Erlangen-Nuernberg
++ * 1997-2000 Johannes Gutenberg-Universitaet Mainz
++ * Authors: Stephan Endrass, Hans Huelf, Ruediger Oertel,
++ * Kai Schneider, Ralf Schmitt, Johannes Beigel
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++
++
++
++
++/* ------------------------------------------------------------------------- */
++/* simple.c */
++/* Author: Stephan Endrass */
++/* Address: endrass at mi.uni-erlangen.de */
++/* Date: 14.8.94 */
++/* ------------------------------------------------------------------------- */
++
++#include <stdio.h>
++#include <math.h>
++#include <stdlib.h>
++
++#include "simple.h"
++#include "mymemory.h"
++
++
++static int **new_int_p( int n );
++static int **renew_int_p( int **i,int n );
++
++double epsilon = 1e-5;
++
++
++/* ------------------------------------------------------------------------- */
++/* Here we store binomeal coefficients */
++/* ------------------------------------------------------------------------- */
++
++typedef struct
++{
++ int created;
++ int **data;
++} binom_struct;
++
++
++/* ------------------------------------------------------------------------- */
++/* compare two double's */
++/* ------------------------------------------------------------------------- */
++
++int double_equal( double s,double t )
++{
++ return fabs( s - t ) < epsilon;
++}
++
++
++/* ------------------------------------------------------------------------- */
++/* binomeal coefficient: */
++/* */
++/* / n \ / n-1 \ / n-1 \ */
++/* | | = | | + | | */
++/* \ k / \ k-1 / \ k / */
++/* */
++/* ------------------------------------------------------------------------- */
++
++static binom_struct b_c =
++{
++ -1,
++ (int**)NULL
++};
++
++static void binom_struct_create_row( int n )
++{
++ if( n == 0 ) {
++ b_c.data[0][0] = 1;
++ } else {
++ int i;
++ int j;
++ int k = n - 1;
++
++ b_c.data[n][0] = 1;
++
++ for( i = 1, j = 0; i < n; i++, j++ ) {
++ b_c.data[n][i] =
++ b_c.data[k][i] + b_c.data[k][j];
++ }
++
++ b_c.data[n][n] = 1;
++ }
++}
++
++static void binom_struct_add( int n )
++{
++ int i;
++
++ b_c.data = renew_int_p( b_c.data,n + 1 );
++
++ for( i = b_c.created +1; i <= n; i++ ) {
++ b_c.data[i] = new int[i + 1];
++ binom_struct_create_row( i );
++ }
++
++ b_c.created = n;
++}
++
++int binom_coeff( int n,int k )
++{
++ if( n >= k && k >= 0 ) {
++ if( n > b_c.created ) {
++ binom_struct_add( n );
++ }
++ return b_c.data[n][k];
++ } else if( k > n && n >= 0 ) {
++ return 0;
++ } else {
++ fprintf( stderr,"can't compute binomeal coefficient of %d and %d\n",n,k );
++ exit( 1 );
++ }
++}
++
++
++/* ------------------------------------------------------------------------- */
++/* multinomial coefficient: see */
++/* Donald E. Knuth: The Art of Computer Programming, Volume 1 / */
++/* Fundamental Algorithms, Addison-Wesley 1973, 2nd edition, p. 64 */
++/* for the recursion formula */
++/* ------------------------------------------------------------------------- */
++
++int multinom_coeff( int n,int *index,int k )
++{
++ int i;
++ int j;
++ int result = 1;
++ int up = index[0];
++ int down = 0;
++
++ for( i = 0, j = 1; j < k; i++, j++ ) {
++ up += index[j];
++ down += index[i];
++
++ result *= binom_coeff( up,down );
++ }
++ return result;
++}
++
++
++
++// static char ascii[26]="abcdefghijklmnopqrstuvwxyz";
++
++int itotexascii( int i,char *s,int l )
++{
++ if( i < 0 || l < 2 || s==(char*)NULL ) {
++ return 0;
++ } else {
++ /* find length of 26-adic number i */
++
++ int foo = i;
++ int length = ( foo==0 ? 1 : 0 );
++
++ while( foo > 0 ) {
++ foo /= 26;
++ length++;
++ }
++
++ /* test if s is long enough */
++
++ if( length >= l ) {
++ return 0;
++ }
++
++ /* terminate with \0 */
++
++ s[length]='\0';
++
++ while( length > 0 ) {
++ length--;
++// s[length]= ascii[i%26];
++ s[length]= 'a'+(i%26);
++ i = i/26;
++ }
++
++ return 1;
++ }
++}
++
++
++
++
++
++static int **new_int_p( int n )
++{
++ if( n > 0 ) {
++ int **i;
++ i = (int**)malloc( n*sizeof(int*) );
++
++ if( i == (int**)NULL ) {
++ (void)fprintf( stderr,"can't allocate %d pointers to int\n",n );
++ exit( 1 );
++ }
++
++ return i;
++ } else {
++ (void)fprintf( stderr,"can't allocate %d pointers to int\n",n );
++ exit( 1 );
++ }
++}
++
++
++static int **renew_int_p( int **i,int n )
++{
++ if( i == (int**)NULL ) {
++ return new_int_p( n );
++ } else if( n > 0 ) {
++ i = (int**)realloc( (void**)i,n*sizeof(int*) );
++
++ if( i == (int**)NULL ) {
++ (void)fprintf( stderr,"can't realloc %d pointers to int\n",n );
++ exit( 1 );
++ }
++
++ return i;
++ } else {
++ (void)fprintf( stderr,"can't realloc %d pointers to int\n",n );
++ exit( 1 );
++ }
++}
++
++/* ------------------------------------------------------------------------- */
++/* end of file: simple.c */
++/* ------------------------------------------------------------------------- */
+--- a/yaccsrc/simple.cc
++++ /dev/null
+@@ -1,243 +0,0 @@
+-/*
+- * surf - visualizing algebraic curves and algebraic surfaces
+- * Copyright (C) 1996-1997 Friedrich-Alexander-Universitaet
+- * Erlangen-Nuernberg
+- * 1997-2000 Johannes Gutenberg-Universitaet Mainz
+- * Authors: Stephan Endrass, Hans Huelf, Ruediger Oertel,
+- * Kai Schneider, Ralf Schmitt, Johannes Beigel
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+- *
+- */
+-
+-
+-
+-
+-/* ------------------------------------------------------------------------- */
+-/* simple.c */
+-/* Author: Stephan Endrass */
+-/* Address: endrass at mi.uni-erlangen.de */
+-/* Date: 14.8.94 */
+-/* ------------------------------------------------------------------------- */
+-
+-#include <stdio.h>
+-#include <math.h>
+-#include <stdlib.h>
+-
+-#include "simple.h"
+-#include "mymemory.h"
+-
+-
+-static int **new_int_p( int n );
+-static int **renew_int_p( int **i,int n );
+-
+-double epsilon = 1e-5;
+-
+-
+-/* ------------------------------------------------------------------------- */
+-/* Here we store binomeal coefficients */
+-/* ------------------------------------------------------------------------- */
+-
+-typedef struct
+-{
+- int created;
+- int **data;
+-} binom_struct;
+-
+-
+-/* ------------------------------------------------------------------------- */
+-/* compare two double's */
+-/* ------------------------------------------------------------------------- */
+-
+-int double_equal( double s,double t )
+-{
+- return fabs( s - t ) < epsilon;
+-}
+-
+-
+-/* ------------------------------------------------------------------------- */
+-/* binomeal coefficient: */
+-/* */
+-/* / n \ / n-1 \ / n-1 \ */
+-/* | | = | | + | | */
+-/* \ k / \ k-1 / \ k / */
+-/* */
+-/* ------------------------------------------------------------------------- */
+-
+-static binom_struct b_c =
+-{
+- -1,
+- (int**)NULL
+-};
+-
+-static void binom_struct_create_row( int n )
+-{
+- if( n == 0 ) {
+- b_c.data[0][0] = 1;
+- } else {
+- int i;
+- int j;
+- int k = n - 1;
+-
+- b_c.data[n][0] = 1;
+-
+- for( i = 1, j = 0; i < n; i++, j++ ) {
+- b_c.data[n][i] =
+- b_c.data[k][i] + b_c.data[k][j];
+- }
+-
+- b_c.data[n][n] = 1;
+- }
+-}
+-
+-static void binom_struct_add( int n )
+-{
+- int i;
+-
+- b_c.data = renew_int_p( b_c.data,n + 1 );
+-
+- for( i = b_c.created +1; i <= n; i++ ) {
+- b_c.data[i] = new int[i + 1];
+- binom_struct_create_row( i );
+- }
+-
+- b_c.created = n;
+-}
+-
+-int binom_coeff( int n,int k )
+-{
+- if( n >= k && k >= 0 ) {
+- if( n > b_c.created ) {
+- binom_struct_add( n );
+- }
+- return b_c.data[n][k];
+- } else if( k > n && n >= 0 ) {
+- return 0;
+- } else {
+- fprintf( stderr,"can't compute binomeal coefficient of %d and %d\n",n,k );
+- exit( 1 );
+- }
+-}
+-
+-
+-/* ------------------------------------------------------------------------- */
+-/* multinomial coefficient: see */
+-/* Donald E. Knuth: The Art of Computer Programming, Volume 1 / */
+-/* Fundamental Algorithms, Addison-Wesley 1973, 2nd edition, p. 64 */
+-/* for the recursion formula */
+-/* ------------------------------------------------------------------------- */
+-
+-int multinom_coeff( int n,int *index,int k )
+-{
+- int i;
+- int j;
+- int result = 1;
+- int up = index[0];
+- int down = 0;
+-
+- for( i = 0, j = 1; j < k; i++, j++ ) {
+- up += index[j];
+- down += index[i];
+-
+- result *= binom_coeff( up,down );
+- }
+- return result;
+-}
+-
+-
+-
+-// static char ascii[26]="abcdefghijklmnopqrstuvwxyz";
+-
+-int itotexascii( int i,char *s,int l )
+-{
+- if( i < 0 || l < 2 || s==(char*)NULL ) {
+- return 0;
+- } else {
+- /* find length of 26-adic number i */
+-
+- int foo = i;
+- int length = ( foo==0 ? 1 : 0 );
+-
+- while( foo > 0 ) {
+- foo /= 26;
+- length++;
+- }
+-
+- /* test if s is long enough */
+-
+- if( length >= l ) {
+- return 0;
+- }
+-
+- /* terminate with \0 */
+-
+- s[length]='\0';
+-
+- while( length > 0 ) {
+- length--;
+-// s[length]= ascii[i%26];
+- s[length]= 'a'+(i%26);
+- i = i/26;
+- }
+-
+- return 1;
+- }
+-}
+-
+-
+-
+-
+-
+-static int **new_int_p( int n )
+-{
+- if( n > 0 ) {
+- int **i;
+- i = (int**)malloc( n*sizeof(int*) );
+-
+- if( i == (int**)NULL ) {
+- (void)fprintf( stderr,"can't allocate %d pointers to int\n",n );
+- exit( 1 );
+- }
+-
+- return i;
+- } else {
+- (void)fprintf( stderr,"can't allocate %d pointers to int\n",n );
+- exit( 1 );
+- }
+-}
+-
+-
+-static int **renew_int_p( int **i,int n )
+-{
+- if( i == (int**)NULL ) {
+- return new_int_p( n );
+- } else if( n > 0 ) {
+- i = (int**)realloc( (void**)i,n*sizeof(int*) );
+-
+- if( i == (int**)NULL ) {
+- (void)fprintf( stderr,"can't realloc %d pointers to int\n",n );
+- exit( 1 );
+- }
+-
+- return i;
+- } else {
+- (void)fprintf( stderr,"can't realloc %d pointers to int\n",n );
+- exit( 1 );
+- }
+-}
+-
+-/* ------------------------------------------------------------------------- */
+-/* end of file: simple.c */
+-/* ------------------------------------------------------------------------- */
+--- a/yaccsrc/simple.h
++++ b/yaccsrc/simple.h
+@@ -35,6 +35,19 @@
+ #ifndef SIMPLE_H
+ #define SIMPLE_H
+
++#undef __BEGIN_DECLS
++#undef __END_DECLS
++#ifdef __cplusplus
++# define __BEGIN_DECLS extern "C" {
++# define __END_DECLS }
++#else
++# define __BEGIN_DECLS /* empty */
++# define __END_DECLS /* empty */
++#endif
++
++__BEGIN_DECLS
++
++
+ extern double epsilon;
+
+
+@@ -55,8 +68,10 @@
+
+ int binom_coeff( int,int );
+ int multinom_coeff( int,int*,int );
+-// int itotexascii( int,char*,int );
++int itotexascii( int,char*,int );
++
+
++__END_DECLS
+
+ #endif // SIMPLE_H
+
+--- a/yaccsrc/Makefile.am
++++ b/yaccsrc/Makefile.am
+@@ -10,7 +10,7 @@
+ polyroot.cc polyroot.h \
+ polyx.cc polyx.h \
+ polyyacc.y polylex.l polylexyacc.h degree.h \
+- simple.cc simple.h \
++ simple.c simple.h \
+ lexfunc.cc \
+ SymbolTable.cc SymbolTable.h \
+ Script.cc Script.h \
+--- a/yaccsrc/polyyacc.y
++++ b/yaccsrc/polyyacc.y
+@@ -45,7 +45,7 @@
+
+ #define POLYYACC_L
+
+-/* #include "simple.h"*/
++#include "simple.h"
+ #include "mymemory.h"
+ #include "monomarith.h"
+ #include "polyarith.h"
+@@ -53,45 +53,6 @@
+ #include "cthread.h"
+
+ extern int surface_run_commands;
+-/* static char ascii[26]="abcdefghijklmnopqrstuvwxyz";*/
+-
+-
+-int itotexascii( int i,char *s,int l )
+-{
+- if( i < 0 || l < 2 || s==(char*)NULL ) {
+- return 0;
+- } else {
+- /* find length of 26-adic number i */
+-
+- int foo = i;
+- int length = ( foo==0 ? 1 : 0 );
+-
+- while( foo > 0 ) {
+- foo /= 26;
+- length++;
+- }
+-
+- /* test if s is long enough */
+-
+- if( length >= l ) {
+- return 0;
+- }
+-
+- /* terminate with \0 */
+-
+- s[length]='\0';
+-
+- while( length > 0 ) {
+- length--;
+-/* s[length]= ascii[i%26]; */
+- s[length]= 'a'+(i%26);
+- i = i/26;
+- }
+-
+- return 1;
+- }
+-}
+-
+
+ %}
+
diff --git a/debian/patches/upstream-cc-silence.patch b/debian/patches/upstream-cc-silence.patch
new file mode 100644
index 0000000..0d9d51c
--- /dev/null
+++ b/debian/patches/upstream-cc-silence.patch
@@ -0,0 +1,1367 @@
+Description: upstream -- C compiler: silence
+ Attempt to silence warning messages as emitted by gcc(1).
+Origin: debian
+Forwarded: meant to be submitted to the upstream maintainer team
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2016-08-02
+
+--- a/src/color.h
++++ b/src/color.h
+@@ -44,17 +44,17 @@
+
+ unsigned char getRedByte() const
+ {
+- return red >= 1.0 ? 255: (int) (red*255);
++ return red >= 1.0 ? (unsigned char)(255): (unsigned char) (red*255.0);
+ }
+
+ unsigned char getGreenByte() const
+ {
+- return green >= 1.0 ? 255: (int) (green*255);
++ return green >= 1.0 ? (unsigned char)(255): (unsigned char) (green*255.0);
+ }
+
+ unsigned char getBlueByte() const
+ {
+- return blue >= 1.0 ? 255: (int) (blue*255);
++ return blue >= 1.0 ? (unsigned char)(255): (unsigned char) (blue*255.0);
+ }
+
+ double getBW( ) const
+--- a/src/bit_buffer.cc
++++ b/src/bit_buffer.cc
+@@ -105,9 +105,9 @@
+ unsigned char &c = b[x / CHAR_BIT + y*bytesPerRow];
+
+ if (value == PIXEL_BLACK)
+- c |= ( (1 << (CHAR_BIT-1)) >> x % CHAR_BIT);
++ c |= (unsigned char) ( (1 << (CHAR_BIT-1)) >> x % CHAR_BIT);
+ else
+- c &= ~( (1 << (CHAR_BIT-1)) >> x % CHAR_BIT);
++ c &= (unsigned char) (~(( (1 << (CHAR_BIT-1)) >> x % CHAR_BIT)));
+ }
+
+ }
+--- a/image-formats/tiffprint.cc
++++ b/image-formats/tiffprint.cc
+@@ -156,7 +156,7 @@
+
+ for( py = 0; py < paper_height; py++ ) {
+ for( px = 0, count = 0; px < paper_width; px += 8, count++ ) {
+- byte = 255-pixel.getByte(px,py);
++ byte = (unsigned char)(255U-(unsigned int)(pixel.getByte(px,py)));
+ scanline[count] = byte;
+ }
+ TIFFWriteScanline( tif,scanline,py,0 );
+--- a/image-formats/xbitmap.cc
++++ b/image-formats/xbitmap.cc
+@@ -41,14 +41,15 @@
+
+ static inline unsigned char rotateByte (unsigned char c)
+ {
+- unsigned char retval=0;
++ unsigned int uint_c=c;
++ unsigned int retval=0;
+ int i;
+ for (i=0; i< CHAR_BIT; i++) {
+- retval <<= 1;
+- retval |= c & 1;
+- c >>= 1;
++ retval <<= 1U;
++ retval |= uint_c & 1U;
++ uint_c >>= 1U;
+ }
+- return retval;
++ return (unsigned char)(retval);
+ }
+ // ----------------------------------------------------------------------------
+ // Produce a X11 bitmap
+--- a/src/RgbBuffer.cc
++++ b/src/RgbBuffer.cc
+@@ -121,7 +121,7 @@
+ {
+ int i;
+ for (i=0; i<width*height; i++) {
+- tag[i] &= ~ (CURVELINEBIT | CURVEBIT);
++ tag[i] = (byte)((unsigned int)(tag[i]) & ( ~ (CURVELINEBIT | CURVEBIT) ));
+ }
+ }
+
+@@ -348,9 +348,9 @@
+ void RgbBuffer::Set( int x, int y, int value0, int value1, int value2)
+ {
+ if( x >= 0 && x < width && y >= 0 && y < height ) {
+- r[ y * width + x ] = (value0>255.0) ? 255 : value0;
+- g[ y * width + x ] = (value1>255.0) ? 255 : value1;
+- b[ y * width + x ] = (value2>255.0) ? 255 : value2;
++ r[ y * width + x ] = (value0>255) ? (byte)(255U) : (byte)(value0);
++ g[ y * width + x ] = (value1>255) ? (byte)(255U) : (byte)(value1);
++ b[ y * width + x ] = (value2>255) ? (byte)(255U) : (byte)(value2);
+ }
+ }
+ // Set one color at pixel number ----------------------------------------
+@@ -413,7 +413,7 @@
+ }
+
+ int n = y*width+x;
+- return (0.299*r[n]+0.587*g[n]+0.114*b[n])/255.0;
++ return (float)((0.299*(double)(r[n])+0.587*(double)(g[n])+0.114*(double)(b[n]))/255.0);
+ // return (float)( ( 0.299 * (float)Get_one(x,y,red )
+ // + 0.587 * (float)Get_one(x,y,green)
+ // + 0.114 * (float)Get_one(x,y,blue ) )/255.0);
+@@ -452,7 +452,7 @@
+ if( x < 0 || x >= width || y < 0 || y >= height)
+ return;
+
+- tag[y*width+x] |= position;
++ tag[y*width+x] = (byte)((unsigned int)(tag[y*width+x]) | (unsigned int)(position));
+ }
+
+ void RgbBuffer::DelTag( int x, int y, int position )
+@@ -460,7 +460,7 @@
+ if( x < 0 || x >= width || y < 0 || y >= height)
+ return;
+
+- tag[y*width+x] &= ~position;
++ tag[y*width+x] = (byte)((unsigned int)(tag[y*width+x]) & ~ (unsigned int)(position));
+ }
+
+ // ----------------------------------------------------------------------------
+@@ -468,10 +468,8 @@
+ // ----------------------------------------------------------------------------
+ void RgbBuffer::SetLayerTwo( int x, int y, int value )
+ {
+- if( x >= 0 && x < width && y >= 0 && y < height ) {
+- value=(value>255) ? 255 :value;
+-
+- curv[ y * width + x ] =value;
++ if( x >= 0 && x < width && y >= 0 && y < height ) {
++ curv[ y * width + x ] = (value > 255) ? (byte)(255U) : (byte)(value);
+ }
+ }
+
+@@ -482,13 +480,13 @@
+ {
+ if( x >= 0 && x < width && y >= 0 && y < height ) {
+ int i = y*width+x;
+-
++
+ if( value > curv[i]) {
+- curv[i] = (value>255) ? 255 : (byte)value;
++ curv[i] = (value>255) ? (byte)(255U) : (byte)value;
+ }
+
+ SetTag(x,y,CURVEBIT);
+- SetTag(0,y,CURVELINEBIT);
++ SetTag(0,y,CURVELINEBIT);
+ }
+ }
+
+@@ -517,9 +515,11 @@
+
+ for( y=0; y<height; y++ ) {
+ for( x=0; x<width; x++ ) {
+- map[i] = RGBToNetscape( ((float)r[i])/255.0,
+- ((float)g[i])/255.0,
+- ((float)b[i])/255.0,x,y );
++ map[i] = (byte)(RGBToNetscape(
++ (float)((double)(r[i])/255.0),
++ (float)((double)(g[i])/255.0),
++ (float)((double)(b[i])/255.0),
++ x,y ));
+ i++;
+ }
+ }
+@@ -575,7 +575,7 @@
+ if (dither)
+ rgb.Dither (x, y, ditherval);
+
+- map[i]=Trees.QuantizeColor( Trees.proot,rgb );
++ map[i]=(byte)(Trees.QuantizeColor( Trees.proot,rgb ));
+
+ i++;
+ }
+@@ -595,22 +595,25 @@
+
+ void RgbBuffer::StereoLeft( void )
+ {
+- for( int i=0; i<n; i++ ) {
+- map[i] =(int)( 0.299*((float)(r[i]))
++ for( int i=0; i<n; i++ ) {
++ map[i] =(byte)(
++ 0.299*((float)(r[i]))
+ +0.587*((float)(g[i]))
+- +0.114*((float)(b[i])));
+- }
++ +0.114*((float)(b[i]))
++ );
++ }
+ }
+
+ void RgbBuffer::StereoRight( float rm,float gm,float bm,int dist,int back )
+ {
+ int x,y,xl,xr,il,i,ir;
+-
+- for( i=0; i<n; i++ ) {
+- curv[i] =(int)( 0.299*((float)(r[i]))
++ for( i=0; i<n; i++ ) {
++ curv[i] =(byte)(
++ 0.299*((float)(r[i]))
+ +0.587*((float)(g[i]))
+- +0.114*((float)(b[i])));
+- }
++ +0.114*((float)(b[i]))
++ );
++ }
+
+ for( y=0; y<height; y++ ) {
+ for( x=0, xl=-dist, xr=dist; x<width; x++, xl++, xr++ ) {
+@@ -618,9 +621,9 @@
+ il = i-dist;
+ ir = i+dist;
+
+- r[i] = ( xr < width ? (int)(rm*((float)( map[ir]))):back );
+- g[i] = ( xl >=0 ? (int)(gm*((float)(curv[il]))):back );
+- b[i] = ( xl >=0 ? (int)(bm*((float)(curv[il]))):back );
++ r[i] = ( xr < width ? (byte)(rm*((float)( map[ir]))):(byte)(back) );
++ g[i] = ( xl >=0 ? (byte)(gm*((float)(curv[il]))):(byte)(back) );
++ b[i] = ( xl >=0 ? (byte)(bm*((float)(curv[il]))):(byte)(back) );
+ }
+ }
+ }
+@@ -718,16 +721,16 @@
+ g_tmp=(int)( (Layer1g*(1-Layer2)) + ( curve_g*Layer2));
+ b_tmp=(int)( (Layer1b*(1-Layer2)) + ( curve_b*Layer2));
+
+- r[num]=Layer1r = (r_tmp >255) ? 255 : r_tmp;
+- g[num]=Layer1g = (g_tmp >255) ? 255 : g_tmp;
+- b[num]=Layer1b = (b_tmp >255) ? 255 : b_tmp;
++ r[num] = (byte) ( Layer1r = (r_tmp >255) ? 255 : r_tmp );
++ g[num] = (byte) ( Layer1g = (g_tmp >255) ? 255 : g_tmp );
++ b[num] = (byte) ( Layer1b = (b_tmp >255) ? 255 : b_tmp );
+
+ DelTag(x,y,CURVEBIT);
+ SetTag(x,y,DATABIT);
+
+- rr = Layer1r/255.0;
+- gg = Layer1g/255.0;
+- bb = Layer1b/255.0;
++ rr = (float)((double)(Layer1r)/255.0);
++ gg = (float)((double)(Layer1g)/255.0);
++ bb = (float)((double)(Layer1b)/255.0);
+ }
+ }
+ }
+--- a/dither/dither_smooth_dot_diffusion.cc
++++ b/dither/dither_smooth_dot_diffusion.cc
+@@ -51,7 +51,7 @@
+ float err;
+
+ for( k = 0; k < 64 && !stop; k++ ) {
+- compare = 0.5/( 64 - k );
++ compare = 0.5f/(float)( 64 - k );
+
+ for( y = (*s_d_d_s[print_barons_data])[k].y;
+ y < main_height_data && !stop;
+@@ -66,11 +66,11 @@
+ err = value;
+ } else {
+ pixel.setPixel(x,y,PIXEL_WHITE );
+- err = value - 1.0;
++ err = value - 1.0f;
+ }
+
+ if( k < 63 ) {
+- err /= 63 - k;
++ err /= (float)(63 - k);
+
+ for( j = 0;
+ j < (*s_d_d_s[print_barons_data])[k].n;
+--- a/src/oct_quan.cc
++++ b/src/oct_quan.cc
+@@ -54,27 +54,29 @@
+
+ void OctColor::Dither( int x,int y, double display_dither_value_data)
+ {
+- float rr=((float)red )/255.0;
+- float gg=((float)green)/255.0;
+- float bb=((float)blue )/255.0;
+-
+- rr *= display_dither_value_data;
+- gg *= display_dither_value_data;
+- bb *= display_dither_value_data;
+-
+- float c = compare_function[1][2]( x,y );
+-
+- if( rr - (int)rr > c ) rr += 1.0;
+- if( gg - (int)gg > c ) gg += 1.0;
+- if( bb - (int)bb > c ) bb += 1.0;
+-
+- rr = ((float)((int)rr))/(display_dither_value_data+1)*255;
+- gg = ((float)((int)gg))/(display_dither_value_data+1)*255;
+- bb = ((float)((int)bb))/(display_dither_value_data+1)*255;
+-
+- red = (byte)rr;
+- green = (byte)gg;
+- blue = (byte)bb;
++ float float_display_dither_value_data=(float)(display_dither_value_data);
++ float rr=((float)red )/255.0f;
++ float gg=((float)green)/255.0f;
++ float bb=((float)blue )/255.0f;
++ float ii=0.0f;
++
++ rr *= float_display_dither_value_data;
++ gg *= float_display_dither_value_data;
++ bb *= float_display_dither_value_data;
++
++ float c = compare_function[1][2]( x, y);
++
++ if( modff(rr,&ii) > c ) rr += 1.0f;
++ if( modff(gg,&ii) > c ) gg += 1.0f;
++ if( modff(bb,&ii) > c ) bb += 1.0f;
++
++ rr = floorf(rr)/(float_display_dither_value_data+1.0f)*255.0f;
++ gg = floorf(gg)/(float_display_dither_value_data+1.0f)*255.0f;
++ bb = floorf(bb)/(float_display_dither_value_data+1.0f)*255.0f;
++
++ red = (byte)(rr);
++ green = (byte)(gg);
++ blue = (byte)(bb);
+ }
+
+ // ------------------------------------------------------------------------
+--- a/src/RGBToNetscape.cc
++++ b/src/RGBToNetscape.cc
+@@ -23,30 +23,27 @@
+ */
+
+
++#include <math.h>
+ #include "RGBToNetscape.h"
+ #include "compfn.h"
+
+ int RGBToNetscape (float r, float g, float b, int x, int y)
+ {
+- if( r>=1.0 )
+- r=0.9999;
+- if( g>=1.0 )
+- g=0.9999;
+- if( b>=1.0 )
+- b=0.9999;
+-
+- r *= 5;
+- g *= 5;
+- b *= 5;
+-
+- float c = compare_function[1][2]( x,y );
+-
+- if( r-(int)r > c )
+- r+=1.0;
+- if( g-(int)g > c )
+- g+=1.0;
+- if( b-(int)b > c )
+- b+=1.0;
++ float ii=0.0f;
++
++ if( r>=1.0f ) r=0.9999f;
++ if( g>=1.0f ) g=0.9999f;
++ if( b>=1.0f ) b=0.9999f;
++
++ r *= 5.0f;
++ g *= 5.0f;
++ b *= 5.0f;
++
++ float c = compare_function[1][2]( x, y);
++
++ if( modff(r,&ii) > c ) r+=1.0f;
++ if( modff(g,&ii) > c ) g+=1.0f;
++ if( modff(b,&ii) > c ) b+=1.0f;
+
+ return ((int)(r))*36 + ((int)(g))*6 + ((int)(b));
+ }
+--- a/draw/SurfaceCalc.cc
++++ b/draw/SurfaceCalc.cc
+@@ -112,12 +112,12 @@
+ double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE];
+ int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM];
+
+- float refine_radius=display_ref_radius_data;
++ double refine_radius=display_ref_radius_data;
+
+ // sk3:get refine px_start & py_start & p_inc & stepwidth with jump, refine_radius
+- p_inc = ( refine_radius*jump )/display_ref_level_data;
+- px_start = px_refine - ((refine_radius/2.0)*jump) + 0.5*p_inc;
+- py_start = py_refine - ((refine_radius/2.0)*jump) + 0.5*p_inc;
++ p_inc = ( refine_radius * (double)(jump) )/ (double)(display_ref_level_data);
++ px_start = px_refine - ((refine_radius*0.5)*(double)(jump)) + 0.5*p_inc;
++ py_start = py_refine - ((refine_radius*0.5)*(double)(jump)) + 0.5*p_inc;
+ stepwidth = fabs( pixel_to_user_x(px_start)-pixel_to_user_x (px_start + p_inc));
+
+ // --------------------------------------------------------------------
+@@ -612,12 +612,12 @@
+ Vector L;
+ Vector H;
+
+- register float fade = 1.0;
+- register float fadecol = 1.0, fadecoln = 0.0;
++ register float fade = 1.0f;
++ register float fadecol = 1.0f, fadecoln = 0.0f;
+
+ register int i;
+
+- float cm = ( cb + cf )/2.0; // midpoint of clipping area
++ float cm = ( cb + cf )*0.5f; // midpoint of clipping area
+ float cd = ( cf - cb ); // diameter of clipping area
+
+ // -----------------------------------------
+@@ -627,13 +627,13 @@
+
+ if( ( obj_color == color_gradient_data - 1 &&
+ color_gradient_data ) || color_gradient_data==3 ) {
+- fadecol = ( P.z - cm )/cd + 0.5;
+- fadecol = MAX( fadecol,0.0 );
+- fadecol = MIN( fadecol,1.0 );
++ fadecol = ( (float)(P.z) - cm )/cd + 0.5f;
++ fadecol = MAX( fadecol,0.0f );
++ fadecol = MIN( fadecol,1.0f );
+ } else {
+- fadecol = 1.0;
++ fadecol = 1.0f;
+ }
+- fadecoln = 1.0 - fadecol;
++ fadecoln = 1.0f - fadecol;
+
+ // ------------------------------
+ // begin with color calculation
+@@ -698,9 +698,9 @@
+ // --------------
+
+ if( !display_depth_cue_data ) {
+- fade = 1.3*( P.z - display_depth_value_data )/cd;
+- fade = MAX( fade,0.0 );
+- fade = MIN( fade,1.0 );
++ fade = 1.3f*(float)( P.z - display_depth_value_data )/cd;
++ fade = MAX( fade,0.0f );
++ fade = MIN( fade,1.0f );
+
+ I *= fade;
+ }
+@@ -727,17 +727,17 @@
+ // --------------
+ // depth cueing
+ // --------------
+- float fade = 1.0;
++ float fade = 1.0f;
+
+ if( !display_depth_cue_data ) {
+- fade = 1.3*( P.z - display_depth_value_data )/( cf - cb );
++ fade = 1.3f*(float)( P.z - display_depth_value_data )/( cf - cb );
+
+- if( fade <= 0.0 ) {
++ if( fade <= 0.0f ) {
+ I.setBlack( );
+ return;
+ }
+ else {
+- fade = MIN( fade,1.0 );
++ fade = MIN( fade,1.0f );
+ }
+ }
+
+@@ -830,8 +830,9 @@
+
+
+
+- register float norm_it = display_max_i_data;
+- double transfak,solidfak;
++ register float norm_it = (float)(display_max_i_data);
++ double transfak;
++ float solidfak;
+
+ transmission = 1.0;
+
+@@ -921,13 +922,13 @@
+ transfak = transparence;
+ }
+
+- solidfak = 1.0 - transfak;
++ solidfak = (float)(1.0 - transfak);
+
+ // reflected, transmitted, smoothness
+- reflected = ( solidfak==0.0 ? 0.0 : sf_ds.surfaces[best_i].reflect );
++ reflected = ( solidfak==0.0f ? 0.0f : sf_ds.surfaces[best_i].reflect );
+ transmitted = ( flag_transmitted ? sf_ds.surfaces[best_i].transmit : 0.0 );
+- smoothness = sf_ds.surfaces[best_i].smooth;
+- part_D = sf_ds.surfaces[best_i].diffuse;
++ smoothness = sf_ds.surfaces[best_i].smooth;
++ part_D = (float)(sf_ds.surfaces[best_i].diffuse);
+
+ // --------------------------------------------
+ // if we are on a curve take curve properties
+@@ -936,31 +937,31 @@
+ if( sf_ds.curve.root_n && ( fabs( root[sf_ds.surf_n][0] - P.z ) < 0.01 ) ) {
+ // the curve os not opaque
+ transfak = 0.0;
+- solidfak = 1.0;
++ solidfak = 1.0f;
+
+- ambient[RED] [SURFS] = ambient[RED] [INSIDE] = part_A*sf_ds.curve.red;
+- ambient[GREEN][SURFS] = ambient[GREEN][INSIDE] = part_A*sf_ds.curve.green;
+- ambient[BLUE] [SURFS] = ambient[BLUE] [INSIDE] = part_A*sf_ds.curve.blue;
+-
+- diffuse[RED] [SURFS] = diffuse[RED] [INSIDE] = part_D*sf_ds.curve.red;
+- diffuse[GREEN][SURFS] = diffuse[GREEN][INSIDE] = part_D*sf_ds.curve.green;
+- diffuse[BLUE] [SURFS] = diffuse[BLUE] [INSIDE] = part_D*sf_ds.curve.blue;
++ ambient[RED] [SURFS] = ambient[RED] [INSIDE] = part_A*(float)(sf_ds.curve.red);
++ ambient[GREEN][SURFS] = ambient[GREEN][INSIDE] = part_A*(float)(sf_ds.curve.green);
++ ambient[BLUE] [SURFS] = ambient[BLUE] [INSIDE] = part_A*(float)(sf_ds.curve.blue);
++
++ diffuse[RED] [SURFS] = diffuse[RED] [INSIDE] = part_D*(float)(sf_ds.curve.red);
++ diffuse[GREEN][SURFS] = diffuse[GREEN][INSIDE] = part_D*(float)(sf_ds.curve.green);
++ diffuse[BLUE] [SURFS] = diffuse[BLUE] [INSIDE] = part_D*(float)(sf_ds.curve.blue);
+ } else {
+- ambient[RED] [SURFS] = sf_ds.surfaces[best_i].red *part_A*solidfak;
+- ambient[GREEN][SURFS] = sf_ds.surfaces[best_i].green *part_A*solidfak;
+- ambient[BLUE] [SURFS] = sf_ds.surfaces[best_i].blue *part_A*solidfak;
+- ambient[RED] [INSIDE] = sf_ds.surfaces[best_i].ins_red *part_A*solidfak;
+- ambient[GREEN][INSIDE] = sf_ds.surfaces[best_i].ins_green*part_A*solidfak;
+- ambient[BLUE] [INSIDE] = sf_ds.surfaces[best_i].ins_blue *part_A*solidfak;
+-
+- diffuse[RED] [SURFS] = sf_ds.surfaces[best_i].red *part_D*solidfak;
+- diffuse[GREEN][SURFS] = sf_ds.surfaces[best_i].green *part_D*solidfak;
+- diffuse[BLUE] [SURFS] = sf_ds.surfaces[best_i].blue *part_D*solidfak;
+- diffuse[RED] [INSIDE] = sf_ds.surfaces[best_i].ins_red *part_D*solidfak;
+- diffuse[GREEN][INSIDE] = sf_ds.surfaces[best_i].ins_green*part_D*solidfak;
+- diffuse[BLUE] [INSIDE] = sf_ds.surfaces[best_i].ins_blue *part_D*solidfak;
++ ambient[RED] [SURFS] = (float)(sf_ds.surfaces[best_i].red) *part_A*solidfak;
++ ambient[GREEN][SURFS] = (float)(sf_ds.surfaces[best_i].green) *part_A*solidfak;
++ ambient[BLUE] [SURFS] = (float)(sf_ds.surfaces[best_i].blue) *part_A*solidfak;
++ ambient[RED] [INSIDE] = (float)(sf_ds.surfaces[best_i].ins_red) *part_A*solidfak;
++ ambient[GREEN][INSIDE] = (float)(sf_ds.surfaces[best_i].ins_green)*part_A*solidfak;
++ ambient[BLUE] [INSIDE] = (float)(sf_ds.surfaces[best_i].ins_blue) *part_A*solidfak;
++
++ diffuse[RED] [SURFS] = (float)(sf_ds.surfaces[best_i].red) *part_D*solidfak;
++ diffuse[GREEN][SURFS] = (float)(sf_ds.surfaces[best_i].green) *part_D*solidfak;
++ diffuse[BLUE] [SURFS] = (float)(sf_ds.surfaces[best_i].blue) *part_D*solidfak;
++ diffuse[RED] [INSIDE] = (float)(sf_ds.surfaces[best_i].ins_red) *part_D*solidfak;
++ diffuse[GREEN][INSIDE] = (float)(sf_ds.surfaces[best_i].ins_green)*part_D*solidfak;
++ diffuse[BLUE] [INSIDE] = (float)(sf_ds.surfaces[best_i].ins_blue) *part_D*solidfak;
+ }
+-
++
+ // ---------------
+ // Get intensity
+ // ---------------
+@@ -1046,11 +1047,10 @@
+ double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM+1][MAX_DEGREE];
+ int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM+1];
+
+- double tmp;
+- float distf = display_numeric.stereo_z*display_numeric.stereo_eye/
+- position_numeric.spectator_z;
++ double tmp;
++ float distf = (float)(display_numeric.stereo_z*display_numeric.stereo_eye/position_numeric.spectator_z);
+ int dist = (int)(distf*((float)(MIN(main_width_data,main_height_data)))/20.0);
+- int pxdist;
++ int pxdist;
+
+ initVars();
+
+@@ -1320,12 +1320,12 @@
+
+ numeric_multi_root = flag_transmitted;
+
+- part_A=((float)light_settings[0].ambient)/100.0;
++ part_A= (float)(((double)(light_settings[0].ambient))/100.0);
+
+ // fade color
+- tocolor[RED] =(((double)color_gradient_end_data[RED] )/255.0)*part_A;
+- tocolor[GREEN] =(((double)color_gradient_end_data[GREEN])/255.0)*part_A;
+- tocolor[BLUE] =(((double)color_gradient_end_data[BLUE] )/255.0)*part_A;
++ tocolor[RED] = (float)(((double)color_gradient_end_data[RED] )/255.0)*part_A;
++ tocolor[GREEN] = (float)(((double)color_gradient_end_data[GREEN])/255.0)*part_A;
++ tocolor[BLUE] = (float)(((double)color_gradient_end_data[BLUE] )/255.0)*part_A;
+
+ // set background color
+ backgr.set( color_background_data[RED] /255.0,
+--- a/draw/SurfaceCalc.h
++++ b/draw/SurfaceCalc.h
+@@ -94,17 +94,17 @@
+ void surface_set_pixel (int x, int y, const colorrgb &color)
+ {
+ if (vdisplay)
+- vdisplay->drawSquare (x-(jump-1)/2, y-(jump-1)/2, jump, color.red, color.green, color.blue);
++ vdisplay->drawSquare (x-(jump-1)/2, y-(jump-1)/2, jump, (float)(color.red), (float)(color.green), (float)(color.blue));
+ };
+ void surface_set_r_pixel (int x, int y, const colorrgb &color)
+ {
+ if (vdisplay)
+- vdisplay->drawRSquare (x-(jump-1)/2, y-(jump-1)/2, jump, color.red, color.green, color.blue);
++ vdisplay->drawRSquare (x-(jump-1)/2, y-(jump-1)/2, jump, (float)(color.red), (float)(color.green), (float)(color.blue));
+ };
+ void surface_set_gb_pixel (int x, int y, const colorrgb &color)
+ {
+ if (vdisplay)
+- vdisplay->drawGBSquare (x-(jump-1)/2, y-(jump-1)/2, jump, color.red, color.green, color.blue);
++ vdisplay->drawGBSquare (x-(jump-1)/2, y-(jump-1)/2, jump, (float)(color.red), (float)(color.green), (float)(color.blue));
+ };
+
+
+--- a/drawfunc/DrawfuncData.cc
++++ b/drawfunc/DrawfuncData.cc
+@@ -443,7 +443,7 @@
+ if( z+TOLERANZ_ZEICHNEN_NEU_LAY2 > zold ) {
+ // sk :aber nur zbuffer setzen wenn neuer Wert echt gr��er ist
+ if( z>zold ) {
+- zbuffer->Set(x,y,z);
++ zbuffer->Set(x,y,(float)(z));
+ }
+ return true;
+ }
+--- a/curve/DrawCurve.cc
++++ b/curve/DrawCurve.cc
+@@ -324,7 +324,7 @@
+ // is strictly bigger
+ // -------------------------------------
+ if( z>zold ) {
+- zbuffer->Set(x,y,z);
++ zbuffer->Set(x,y,(float)(z));
+ }
+ return true;
+ }
+--- a/dither/dither_floyd_steinberg.cc
++++ b/dither/dither_floyd_steinberg.cc
+@@ -36,20 +36,20 @@
+ float err;
+ float weight_7_5;
+ float weight_3_1;
+- float weight_rand_7_5 = 0.0;
+- float weight_rand_3_1 = 0.0;
++ float weight_rand_7_5 = 0.0f;
++ float weight_rand_3_1 = 0.0f;
+
+ bool even = true;
+ int px_m1,px,px_p1,px_a,px_c;
+ int py,py_p1;
+
+ if( print_random_weights_data == 0 ) {
+- weight_rand_7_5 = print_weight_data*5.0;
+- weight_rand_3_1 = print_weight_data*1.0;
++ weight_rand_7_5 = (float)(print_weight_data*5.0);
++ weight_rand_3_1 = (float)(print_weight_data*1.0);
+ }
+
+ for( py = 0, py_p1 = 1;
+- py < intensity.getHeight() && !stop;
++ py < intensity.getHeight() && !stop;
+ py++, py_p1++,
+ even = !even ) {
+ if( print_serpentine_raster_data == 0 && !even ) {
+@@ -72,32 +72,32 @@
+ value = intensity.Get( px, py );
+
+
+- if( value > 0.5 ) {
++ if( value > 0.5f ) {
+ pixel.setPixel (px,py,PIXEL_WHITE );
+- err = value - 1.0;
++ err = value - 1.0f;
+ } else {
+ pixel.setPixel (px,py,PIXEL_BLACK );
+- err = value;
++ err = value;
+ }
+- err /= 16;
++ err /= 16.0f;
+
+ if( print_random_weights_data != 0 ) {
+- intensity.Add( px_p1,py ,err*7 );
+- intensity.Add( px_m1,py_p1,err*3 );
+- intensity.Add( px ,py_p1,err*5 );
+- intensity.Add( px_p1,py_p1,err );
++ intensity.Add( px_p1,py ,err*7.0f );
++ intensity.Add( px_m1,py_p1,err*3.0f );
++ intensity.Add( px ,py_p1,err*5.0f );
++ intensity.Add( px_p1,py_p1,err );
+ } else {
+- weight_7_5 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_7_5;
+- weight_3_1 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_3_1;
+-
++ weight_7_5 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_7_5;
++ weight_3_1 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_3_1;
++
+ intensity.Add( px_p1,py ,
+- err*( 7 + weight_7_5 ) );
++ err*( 7.0f + weight_7_5 ) );
+ intensity.Add( px_m1,py_p1,
+- err*( 3 + weight_3_1 ) );
++ err*( 3.0f + weight_3_1 ) );
+ intensity.Add( px ,py_p1,
+- err*( 5 - weight_7_5 ) );
++ err*( 5.0f - weight_7_5 ) );
+ intensity.Add( px_p1,py_p1,
+- err*( 1 - weight_3_1 ) );
++ err*( 1.0f - weight_3_1 ) );
+ }
+ }
+ }
+--- a/dither/dither_jarvis_judis_ninke.cc
++++ b/dither/dither_jarvis_judis_ninke.cc
+@@ -44,20 +44,20 @@
+ float weight_5;
+ float weight_3;
+ float weight_1;
+- float weight_rand_7 = 0.0;
+- float weight_rand_5 = 0.0;
+- float weight_rand_3 = 0.0;
+- float weight_rand_1 = 0.0;
++ float weight_rand_7 = 0.0f;
++ float weight_rand_5 = 0.0f;
++ float weight_rand_3 = 0.0f;
++ float weight_rand_1 = 0.0f;
+
+ bool even = true;
+ int px_m2,px_m1,px,px_p1,px_p2,px_c,px_a;
+ int py,py_p1,py_p2;
+
+ if( print_random_weights_data == 0 ) {
+- weight_rand_7 = print_weight_data*7.0;
+- weight_rand_5 = print_weight_data*5.0;
+- weight_rand_3 = print_weight_data*3.0;
+- weight_rand_1 = print_weight_data*1.0;
++ weight_rand_7 = (float)(print_weight_data*7.0);
++ weight_rand_5 = (float)(print_weight_data*5.);
++ weight_rand_3 = (float)(print_weight_data*3.0);
++ weight_rand_1 = (float)(print_weight_data*1.0);
+ }
+
+ for( py = 0, py_p1 = 1, py_p2 = 2;
+@@ -89,19 +89,19 @@
+ value = intensity.Get( px, py );
+
+
+- if( value > 0.5 ) {
++ if( value > 0.5f ) {
+ pixel.setPixel(px,py,PIXEL_WHITE );
+- err = value - 1.0;
++ err = value - 1.0f;
+ } else {
+ pixel.setPixel (px,py,PIXEL_BLACK );
+ err = value;
+ }
+
+ if( print_random_weights_data != 0 ) {
+- err1 = err/48;
+- err3 = err1*3;
+- err5 = err1*5;
+- err7 = err1*7;
++ err1 = err/48.0f;
++ err3 = err1*3.0f;
++ err5 = err1*5.0f;
++ err7 = err1*7.0f;
+
+ intensity.Add( px_p1,py ,err7 );
+ intensity.Add( px_p2,py ,err5 );
+@@ -120,25 +120,25 @@
+ } else {
+ err /= 48;
+
+- weight_7 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_7;
+- weight_5 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_5;
+- weight_3 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_3;
+- weight_1 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_1;
+-
+- intensity.Add( px_p1,py , err*( 7 + weight_7 ) );
+- intensity.Add( px_p2,py , err*( 5 + weight_5 ) );
+-
+- intensity.Add( px_m2,py_p1, err*( 3 + weight_3 ) );
+- intensity.Add( px_m1,py_p1, err*( 5 - weight_5 ) );
+- intensity.Add( px ,py_p1, err*( 7 - weight_7 ) );
+- intensity.Add( px_p1,py_p1, err*( 5 + weight_5 ) );
+- intensity.Add( px_p2,py_p1, err*( 3 - weight_3 ) );
+-
+- intensity.Add( px_m2,py_p2, err*( 1 + weight_1 ) );
+- intensity.Add( px_m1,py_p2, err*( 3 + weight_3 ) );
+- intensity.Add( px ,py_p2, err*( 5 - weight_5 ) );
+- intensity.Add( px_p1,py_p2, err*( 3 - weight_3 ) );
+- intensity.Add( px_p2,py_p2, err*( 1 - weight_1 ) );
++ weight_7 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_7;
++ weight_5 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_5;
++ weight_3 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_3;
++ weight_1 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_1;
++
++ intensity.Add( px_p1,py , err*( 7.0f + weight_7 ) );
++ intensity.Add( px_p2,py , err*( 5.0f + weight_5 ) );
++
++ intensity.Add( px_m2,py_p1, err*( 3.0f + weight_3 ) );
++ intensity.Add( px_m1,py_p1, err*( 5.0f - weight_5 ) );
++ intensity.Add( px ,py_p1, err*( 7.0f - weight_7 ) );
++ intensity.Add( px_p1,py_p1, err*( 5.0f + weight_5 ) );
++ intensity.Add( px_p2,py_p1, err*( 3.0f - weight_3 ) );
++
++ intensity.Add( px_m2,py_p2, err*( 1.0f + weight_1 ) );
++ intensity.Add( px_m1,py_p2, err*( 3.0f + weight_3 ) );
++ intensity.Add( px ,py_p2, err*( 5.0f - weight_5 ) );
++ intensity.Add( px_p1,py_p2, err*( 3.0f - weight_3 ) );
++ intensity.Add( px_p2,py_p2, err*( 1.0f - weight_1 ) );
+
+ }
+ }
+--- a/dither/dither_stucki.cc
++++ b/dither/dither_stucki.cc
+@@ -47,20 +47,20 @@
+ float weight_4;
+ float weight_2;
+ float weight_1;
+- float weight_rand_8 = 0.0;
+- float weight_rand_4 = 0.0;
+- float weight_rand_2 = 0.0;
+- float weight_rand_1 = 0.0;
++ float weight_rand_8 = 0.0f;
++ float weight_rand_4 = 0.0f;
++ float weight_rand_2 = 0.0f;
++ float weight_rand_1 = 0.0f;
+
+ bool even = true;
+ int px_m2,px_m1,px,px_p1,px_p2,px_c,px_a;
+ int py,py_p1,py_p2;
+
+ if( print_random_weights_data == 0 ) {
+- weight_rand_8 = print_weight_data*8.0;
+- weight_rand_4 = print_weight_data*4.0;
+- weight_rand_2 = print_weight_data*2.0;
+- weight_rand_1 = print_weight_data*1.0;
++ weight_rand_8 = (float)(print_weight_data*8.0);
++ weight_rand_4 = (float)(print_weight_data*4.0);
++ weight_rand_2 = (float)(print_weight_data*2.0);
++ weight_rand_1 = (float)(print_weight_data*1.0);
+ }
+
+ for( py = 0, py_p1 = 1, py_p2 = 2;
+@@ -92,19 +92,19 @@
+ value = intensity.Get( px, py );
+ // value = float_buffer_x_y_get( intensity,px,py );
+
+- if( value > 0.5 ) {
++ if( value > 0.5f ) {
+ pixel.setPixel(px,py,PIXEL_WHITE );
+- err = value - 1.0;
+- } else {
++ err = value - 1.0f;
++ } else {
+ pixel.setPixel(px,py,PIXEL_BLACK );
+ err = value;
+ }
+
+ if( print_random_weights_data != 0 ) {
+- err1 = err/42;
+- err2 = err1*2;
+- err4 = err1*4;
+- err8 = err1*8;
++ err1 = err/42.0f;
++ err2 = err1*2.0f;
++ err4 = err1*4.0f;
++ err8 = err1*8.0f;
+
+ intensity.Add( px_p1,py ,err8 );
+ intensity.Add( px_p2,py ,err4 );
+@@ -120,29 +120,29 @@
+ intensity.Add( px ,py_p2,err4 );
+ intensity.Add( px_p1,py_p2,err2 );
+ intensity.Add( px_p2,py_p2,err1 );
+- } else {
+- err /= 42;
+-
+- weight_8 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_8;
+- weight_4 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_4;
+- weight_2 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_2;
+- weight_1 = ( rand( )/4294967295.0 - 1.0 )*weight_rand_1;
+-
+- intensity.Add( px_p1,py , err*( 8 + weight_8 ) );
+- intensity.Add( px_p2,py , err*( 4 + weight_4 ) );
+-
+- intensity.Add( px_m2,py_p1, err*( 2 + weight_2 ) );
+- intensity.Add( px_m1,py_p1, err*( 4 - weight_4 ) );
+- intensity.Add( px ,py_p1, err*( 8 - weight_8 ) );
+- intensity.Add( px_p1,py_p1, err*( 4 + weight_4 ) );
+- intensity.Add( px_p2,py_p1, err*( 2 - weight_2 ) );
+-
+- intensity.Add( px_m2,py_p2, err*( 1 + weight_1 ) );
+- intensity.Add( px_m1,py_p2, err*( 2 + weight_2 ) );
+- intensity.Add( px ,py_p2, err*( 4 - weight_4 ) );
+- intensity.Add( px_p1,py_p2, err*( 2 - weight_2 ) );
+- intensity.Add( px_p2,py_p2, err*( 1 - weight_1 ) );
+-
++ } else {
++ err /= 42.0f;
++
++ weight_8 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_8;
++ weight_4 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_4;
++ weight_2 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_2;
++ weight_1 = ( (float)(rand())/4294967295.0f - 1.0f )*weight_rand_1;
++
++ intensity.Add( px_p1,py , err*( 8.0f + weight_8 ) );
++ intensity.Add( px_p2,py , err*( 4.0f + weight_4 ) );
++
++ intensity.Add( px_m2,py_p1, err*( 2.0f + weight_2 ) );
++ intensity.Add( px_m1,py_p1, err*( 4.0f - weight_4 ) );
++ intensity.Add( px ,py_p1, err*( 8.0f - weight_8 ) );
++ intensity.Add( px_p1,py_p1, err*( 4.0f + weight_4 ) );
++ intensity.Add( px_p2,py_p1, err*( 2.0f - weight_2 ) );
++
++ intensity.Add( px_m2,py_p2, err*( 1.0f + weight_1 ) );
++ intensity.Add( px_m1,py_p2, err*( 2.0f + weight_2 ) );
++ intensity.Add( px ,py_p2, err*( 4.0f - weight_4 ) );
++ intensity.Add( px_p1,py_p2, err*( 2.0f - weight_2 ) );
++ intensity.Add( px_p2,py_p2, err*( 1.0f - weight_1 ) );
++
+ }
+ }
+ }
+--- a/dither/dither_dot_diffusion.cc
++++ b/dither/dither_dot_diffusion.cc
+@@ -59,17 +59,17 @@
+ x += 8 ) {
+ value = intensity.Get( x,y );
+
+- if( value < 0.5 ) {
++ if( value < 0.5f ) {
+ pixel.setPixel (x,y,PIXEL_BLACK );
+ err = value;
+- } else {
++ } else {
+ pixel.setPixel (x,y,PIXEL_WHITE );
+- err = value - 1.0;
++ err = value - 1.0f;
+ }
+
+ for( j = 0; j < 8; j++ ) {
+ intensity.Add( x + d_d_n_x[j],y + d_d_n_y[j],
+- err*(*d_d_s[print_barons_data])[k].err[j] );
++ err*(float)((*d_d_s[print_barons_data])[k].err[j]) );
+ }
+ }
+ }
+--- a/dither/copy_rgb_to_float.cc
++++ b/dither/copy_rgb_to_float.cc
+@@ -37,7 +37,7 @@
+ for( j = 0; j < intensity.getWidth(); j++ ) {
+ gray.Set( j,i,( intensity.GetTag( j,i,DATABIT ) ?
+ intensity.Get_Gray_value( j,i ) :
+- print_background_data ) );
++ (float)(print_background_data) ) );
+ }
+ }
+ }
+--- a/src/float_buffer.cc
++++ b/src/float_buffer.cc
+@@ -140,9 +140,9 @@
+ int l1 = (y%height) * width + x;
+ int l2 = ((y+1)%height) * width + x;
+ int l3 = ((y+2)%height) * width + x;
+- return ( fabs(b[l1]) + fabs(b[l1+1]) + fabs(b[l1+2]) +
+- fabs(b[l2]) + fabs(b[l2+1]) + fabs(b[l2+2]) +
+- fabs(b[l3]) + fabs(b[l3+1]) + fabs(b[l3+2]) );
++ return ( fabsf(b[l1]) + fabsf(b[l1+1]) + fabsf(b[l1+2]) +
++ fabsf(b[l2]) + fabsf(b[l2+1]) + fabsf(b[l2+2]) +
++ fabsf(b[l3]) + fabsf(b[l3+1]) + fabsf(b[l3+2]) );
+ }
+
+ // ----------------------------------------------------------------------------
+@@ -152,7 +152,7 @@
+ void float_buffer::CorrectGamma (double gamma)
+ {
+ for( int pos = 0; pos < n; pos++ )
+- b[pos] = pow((double)b[pos], gamma);
++ b[pos] = (float)(pow((double)(b[pos]), gamma));
+ }
+
+ // ----------------------------------------------------------------------------
+@@ -170,16 +170,16 @@
+ int pos = y*width;
+ for( int x = 0; x < width - 2; x++, pos++ ) {
+ // calculate new value from data in temp buffer
+- float err = buffer.GetAbsFieldModuloHeight( x, y ) / 9.0;
+- float result = ( buffer.Get( x+1, (y+1)%3 ) - alpha * err )
+- / ( 1.0 - alpha );
++ float err = buffer.GetAbsFieldModuloHeight( x, y ) / 9.0f;
++ float result = ( buffer.Get( x+1, (y+1)%3 ) - (float)(alpha) * err )
++ / ( 1.0f - (float)(alpha) );
+ // do min and max range clipping
+- if( result < 0.0 )
+- b[pos] = 0.0;
+- else if ( result < 1.0 )
++ if( result < 0.0f )
++ b[pos] = 0.0f;
++ else if ( result < 1.0f )
+ b[pos] = result;
+ else
+- b[pos] = 1.0;
++ b[pos] = 1.0f;
+ }
+ // insert next line at obsolete line in temp buffer
+ if( y < height - 3 )
+@@ -198,12 +198,12 @@
+ for( int pos = 0; pos < n; pos++ ) {
+ value = b[pos];
+
+- if( value < 0.1 ) {
+- b[pos] = 0.0;
+- } else if( value < 0.85 ) {
+- b[pos] = ( value - 0.1 )/0.8;
++ if( value < 0.1f ) {
++ b[pos] = 0.0f;
++ } else if( value < 0.85f ) {
++ b[pos] = ( value - 0.1f )/0.8f;
+ } else {
+- b[pos] = 1.0;
++ b[pos] = 1.0f;
+ }
+ }
+ }
+--- a/src/antialiasing_factor.cc
++++ b/src/antialiasing_factor.cc
+@@ -100,18 +100,18 @@
+ float antialiasing_factor (int x, int y, int size)
+ {
+ switch (size) {
+- case 1: return 1.0;
+- case 2: return antialias_filter_2x2[x][y]/4.0;
+- case 3: return antialias_filter_3x3[x][y]/16.0;
+- case 4: return antialias_filter_4x4[x][y]/36.0;
+- case 5: return antialias_filter_5x5[x][y]/81.0;
+- case 6: return antialias_filter_6x6[x][y]/144.0;
+- case 7: return antialias_filter_7x7[x][y]/264.0;
+- case 8: return antialias_filter_8x8[x][y]/408.0;
++ case 1: return 1.0f;
++ case 2: return (float)(antialias_filter_2x2[x][y])/4.0f;
++ case 3: return (float)(antialias_filter_3x3[x][y])/16.0f;
++ case 4: return (float)(antialias_filter_4x4[x][y])/36.0f;
++ case 5: return (float)(antialias_filter_5x5[x][y])/81.0f;
++ case 6: return (float)(antialias_filter_6x6[x][y])/144.0f;
++ case 7: return (float)(antialias_filter_7x7[x][y])/264.0f;
++ case 8: return (float)(antialias_filter_8x8[x][y])/408.0f;
+
+ default:
+ // FIXME: this should never happen...
+- return 0.0;
++ return 0.0f;
+ break;
+ }
+ }
+--- a/dither/dither_pixel_radius_adjust.cc
++++ b/dither/dither_pixel_radius_adjust.cc
+@@ -40,59 +40,59 @@
+ float b, c, e, h, l;
+ float beta, gamma, delta;
+
+- float d = 2.54/300;
++ float d = 2.54f/300.0f;
+ float r = rel_radius*d;
+- float a = d/M_SQRT2;
++ float a = d*(float)(M_SQRT1_2);
+
+
+- if( rel_radius < 1.0/M_SQRT2 ) {
+- c = sqrt( r*r - d*d/4 );
++ if( rel_radius < 1.0f*(float)(M_SQRT1_2) ) {
++ c = sqrtf( r*r - d*d*0.25f );
+
+- gamma = acos( d/2/r );
++ gamma = acosf( 0.5f*d/r );
+
+- alpha1 = ( r*r*( 3*M_PI - 8*gamma ) + 4*c*d )/4/d/d;
++ alpha1 = 0.25f*( r*r*( 3.0f*(float)(M_PI) - 8.0f*gamma ) + 4.0f*c*d )/(d*d);
+
+- alpha2 = r*r*M_PI/2/d/d;
++ alpha2 = r*r*(float)(M_PI_2)/(d*d);
+
+- alpha3 = r*r*M_PI/4/d/d;
++ alpha3 = 0.25f*r*r*(float)(M_PI)/(d*d);
+ } else {
+- b = sqrt( r*r - a*a );
++ b = sqrtf( r*r - a*a );
+ e = a - b;
+- h = e/M_SQRT2;
+- l = sqrt( r*r - h*h );
++ h = e*(float)(M_SQRT1_2);
++ l = sqrtf( r*r - h*h );
+
+- beta = acos( a/r );
+- delta = acos( l/r );
++ beta = acosf( a/r );
++ delta = acosf( l/r );
+
+- alpha1 = ( r*r*(2*M_PI - 8*beta) +8*a*b )/4/d/d +
+- ( h*h + l*h -r*r*delta )/d/d;
++ alpha1 = 0.25f*( r*r*(2.0f*(float)(M_PI) - 8.0f*beta) +8.0f*a*b )/(d*d) +
++ ( h*h + l*h -r*r*delta )/(d*d);
+
+- alpha2 = ( r*r*(2*M_PI - 8*beta) + 8*a*b )/4/d/d;
++ alpha2 = 0.25f*( r*r*(2.0f*(float)(M_PI) - 8.0f*beta) + 8.0f*a*b )/(d*d);
+
+- alpha3 = r*r*M_PI/4/d/d;
++ alpha3 = 0.25f*r*r*(float)(M_PI)/(d*d);
+ }
+
+- float b1 = 1.0 - alpha1;
+- float b2 = 1.0 - alpha2;
+- float b3 = 1.0 - alpha3;
++ float b1 = 1.0f - alpha1;
++ float b2 = 1.0f - alpha2;
++ float b3 = 1.0f - alpha3;
+
+- float m1 = 1.0/4/( alpha1 - 1.0 );
+- float m2 = 1.0/4/( alpha2 - alpha1 );
+- float m3 = 1.0/4/( alpha3 - alpha2 );
+- float m4 = 1.0/4/( -alpha3 );
++ float m1 = 0.25f/( alpha1 - 1.0f );
++ float m2 = 0.25f/( alpha2 - alpha1 );
++ float m3 = 0.25f/( alpha3 - alpha2 );
++ float m4 = 0.25f/( -alpha3 );
+
+ for( i = 0; i < intensity.getHeight() && !stop; i++ ) {
+ for( int j = 0; j < intensity.getWidth(); j++ ) {
+ float value = intensity.Get( j, i );
+ if( value < b1 )
+- value = m1 * value + 1.0;
++ value = m1 * value + 1.0f;
+ else if( value < b2 )
+- value = m2 * ( value - b1 ) + 0.75;
++ value = m2 * ( value - b1 ) + 0.75f;
+ else if( value < b3 )
+- value = m3 * ( value - b2 ) + 0.5;
++ value = m3 * ( value - b2 ) + 0.5f;
+ else
+- value = m4 * ( value - b3 ) + 0.25;
+- value = 1.0 - value;
++ value = m4 * ( value - b3 ) + 0.25f;
++ value = 1.0f - value;
+ intensity.Set( j, i, value );
+ }
+ }
+--- a/image-formats/xwd.cc
++++ b/image-formats/xwd.cc
+@@ -116,8 +116,8 @@
+ int length;
+ int i;
+ XColor colors[256];
+- int win_name_size;
+- int header_size;
++ size_t win_name_size;
++ size_t header_size;
+ const char *win_name;
+ XWDFileHeader header;
+ unsigned long swaptest = 1;
+@@ -161,11 +161,11 @@
+
+ for( i=0; i<nmap;i++ ) {
+ colors[i].pixel=i;
+- colors[i].red =rmap[i] << 8;
+- colors[i].green=gmap[i] << 8;
+- colors[i].blue =bmap[i] << 8;
+- colors[i].flags=DoRed | DoGreen | DoBlue;
+- colors[i].pad =0;
++ colors[i].red = (unsigned short)(rmap[i] << 8);
++ colors[i].green = (unsigned short)(gmap[i] << 8);
++ colors[i].blue = (unsigned short)(bmap[i] << 8);
++ colors[i].flags = DoRed | DoGreen | DoBlue;
++ colors[i].pad = 0;
+ }
+
+ /* swap if necessary */
+@@ -201,8 +201,8 @@
+ {
+ int length;
+ int i,j,k;
+- int win_name_size;
+- int header_size;
++ size_t win_name_size;
++ size_t header_size;
+ const char *win_name;
+ XWDFileHeader header;
+ int scanline_pad;
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -137,8 +137,8 @@
+ assert(ess->secondPart);
+ ess->parse_result = internalExecuteScript (ess->secondPart, ess->executeUserScriptCommands);
+
+- ess->error_begin = error_begin_char;
+- ess->error_end = char_number;
++ ess->error_begin = (int)(error_begin_char);
++ ess->error_end = (int)(char_number);
+
+ ess->errorString = yyerrorstring;
+
+@@ -268,7 +268,7 @@
+ return 0;
+ }
+
+- unsigned int size = buf.st_size;
++ size_t size = (size_t)(buf.st_size);
+ FILE *f=fopen(name, "r");
+ if (f==0) {
+ ostrstream ostr;
+@@ -411,8 +411,7 @@
+ int back =(int)( 0.299*((float)(color_background_data[RED]))
+ +0.587*((float)(color_background_data[GREEN]))
+ +0.114*((float)(color_background_data[BLUE])));
+- float distf = display_numeric.stereo_z*display_numeric.stereo_eye/
+- position_numeric.spectator_z;
++ float distf = (float)(display_numeric.stereo_z*display_numeric.stereo_eye/position_numeric.spectator_z);
+ int dist = (int)(distf*((float)
+ (MIN(main_width_data,main_height_data)))/20.0);
+
+@@ -421,8 +420,10 @@
+ sc.setPreview (getPreview());
+ sc.surface_calculate(0, 0, main_width_data, main_height_data,*getBuffer());
+
+- intensity->StereoRight( display_numeric.stereo_red,display_numeric.stereo_green,
+- display_numeric.stereo_blue,dist,back );
++ intensity->StereoRight(
++ (float)(display_numeric.stereo_red), (float)(display_numeric.stereo_green), (float)(display_numeric.stereo_blue),
++ dist,back );
++
+ if (GuiThread::haveGUI())
+ getDisplay()->drawRgbBuffer (*intensity);
+ }
+@@ -696,7 +697,7 @@
+ }
+
+
+- dither_pixel_radius_adjust (fbuffer, (float)print_p_radius_data/100.0);
++ dither_pixel_radius_adjust (fbuffer, (float)((double)(print_p_radius_data)/100.0));
+
+ if (print_dither_data == print_dither_floyd_steinberg_data) {
+ dither_floyd_steinberg (fbuffer, *pixel, print_random_weights_data, print_weight_data, print_serpentine_raster_data);
+@@ -820,7 +821,7 @@
+ dc.setGeometry (wingeo);
+ dc.setPolys (p1,p2);
+
+- for (int i=1; i<sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0]); i++) {
++ for (size_t i=1; i<sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0]); i++) {
+ if (sym_cutsurfaces[i].n > 0) {
+ CanvasDataStruct cds;
+ cds.initWith_polyxyz (&sym_cutsurfaces[i]);
+@@ -869,7 +870,7 @@
+ dc.setGeometry (wingeo);
+ dc.setPolys (p1,p2);
+
+- for (int i=1; i<sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0]); i++) {
++ for (size_t i=1; i<sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0]); i++) {
+ if (sym_cutsurfaces[i].n > 0) {
+ CanvasDataStruct cds;
+ cds.initWith_polyxyz (&sym_cutsurfaces[i]);
+--- a/yaccsrc/simple.c
++++ b/yaccsrc/simple.c
+@@ -188,7 +188,7 @@
+ while( length > 0 ) {
+ length--;
+ // s[length]= ascii[i%26];
+- s[length]= 'a'+(i%26);
++ s[length]= (char)('a'+(i%26));
+ i = i/26;
+ }
+
+--- a/curve/mygmp.cc
++++ b/curve/mygmp.cc
+@@ -36,7 +36,7 @@
+
+ ostream & operator << (ostream &os, mpz_t z)
+ {
+- int size = mpz_sizeinbase (z, 10)+4;
++ size_t size = mpz_sizeinbase (z, 10)+4;
+ char *str = new char[size];
+
+ mpz_get_str (str, 10, z);
+--- a/curve/BigInteger.cc
++++ b/curve/BigInteger.cc
+@@ -64,12 +64,11 @@
+
+ void BigInteger::print (ostream &os) const
+ {
+- int size = mpz_sizeinbase (mpz, 10)+4;
++ size_t size = mpz_sizeinbase (mpz, 10)+4;
+ char *str = new char[size];
+-
++
+ mpz_get_str (str, 10, mpz);
+ os << str;
+-
+
+ delete []str;
+ }
+--- a/src/gui_config.h
++++ b/src/gui_config.h
+@@ -127,7 +127,7 @@
+ int thickness;
+ };
+
+-extern light_settings_t light_settings[MAIN_SURFACE_AMOUNT_NUM];
++extern light_settings_t light_settings[MAIN_SURFACE_AMOUNT_NUM+1];
+
+ struct light_data_t {
+ int volume;
+--- a/src/gui_config.cc
++++ b/src/gui_config.cc
+@@ -137,7 +137,7 @@
+ 200, 99, 50,
+ };
+
+-light_settings_t light_settings[MAIN_SURFACE_AMOUNT_NUM];
++light_settings_t light_settings[MAIN_SURFACE_AMOUNT_NUM+1];
+
+ // ----------------------------------------------------------------------------
+
+--- a/mt/cthread.h
++++ b/mt/cthread.h
+@@ -30,7 +30,7 @@
+ extern "C" {
+ #endif
+
+-extern int thread_should_stop();
++extern int thread_should_stop(void);
+ extern void thread_set_doing(const char *str, double val);
+
+ #ifdef __cplusplus
+--- a/yaccsrc/lexfunc.cc
++++ b/yaccsrc/lexfunc.cc
+@@ -74,7 +74,7 @@
+ void set_the_yyinput( char *buffer,long int ch_no,long int ln_no )
+ {
+ main_formula_data_ptr = buffer;
+- main_formula_data_length = strlen( buffer );
++ main_formula_data_length = (int)(strlen( buffer ));
+ main_formula_data_index = 0;
+
+ char_number = ch_no;
+@@ -118,8 +118,8 @@
+ s->surface = FALSE;
+ s->constant= FALSE;
+ s->ptr = NULL;
+- s->label = char_number;
+- s->lineno = line_number;
++ s->label = (int)(char_number);
++ s->lineno = (int)(line_number);
+
+ s->prev = (symtab*)NULL; /* at begin ... */
+ s->next = s_first;
+@@ -410,7 +410,7 @@
+ {
+ sprintf( yyerrorstring,"%.900s at line number %ld at '%.16s'",
+ s, line_number, yytext );
+- error_begin_char = char_number-strlen(yytext);
++ error_begin_char = (int)(char_number-(long int)(strlen(yytext)));
+ }
+
+ /* ------------------------------------------------------------------------- */
+@@ -430,7 +430,7 @@
+ {
+ int c = 0; /* char number */
+ int l = 0; /* line number */
+- int length = strlen( buffer );
++ int length = (int)(strlen( buffer ));
+ int state = STATE_START;
+ int name_length = 0;
+ char name[MAXNAMELENGTH+1];
diff --git a/debian/patches/upstream-clip_mode-rationalize.patch b/debian/patches/upstream-clip_mode-rationalize.patch
new file mode 100644
index 0000000..10bf953
--- /dev/null
+++ b/debian/patches/upstream-clip_mode-rationalize.patch
@@ -0,0 +1,107 @@
+Description: upstream: (internal drawing) clip option
+ Attempt to rationalize (or adapt) the current inconsistency of the
+ (internal) clip mode which appears to be only partially implemented.
+Origin: debian
+Forwarded: meant to be submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-05-15
+
+--- a/drawfunc/Clip.cc
++++ b/drawfunc/Clip.cc
+@@ -46,12 +46,14 @@
+ #include "MappingMatrix.h"
+ #include "Position.h"
+
+-#define SPHERE 0
+-#define CYLH 1
+-#define CYLV 2
+-#define CYLZ 3
+-#define CUBE 4
+-#define NONE 5
++#include "gui_config.h"
++
++#define SPHERE clip_sphere_data
++#define CYLH -1 /* 1 */
++#define CYLV -1 /* 2 */
++#define CYLZ clip_cylinder_data
++#define CUBE clip_cube_data
++#define NONE clip_none_data
+
+ using namespace std;
+ // ----------------------------------------------------------------------------
+@@ -678,55 +680,29 @@
+ double b = wingeo.pixelToUser( 0, xmax );
+ double c = wingeo.pixelToUser( 1, ymin );
+ double d = wingeo.pixelToUser( 1, ymax );
+- if(!psp) { // perspective parallel
+-
+- switch( cm ) { // clipmodus
+-
+- case SPHERE :
+- return (::new ClipSphere(cd,a,b,c,d));
+-
+- case CYLH :
+- return (::new ClipCylH(cd,a,b,c,d));
+-
+- case CYLV :
+- return (::new ClipCylV(cd,a,b,c,d));
+-
+- case CYLZ :
+- return (::new ClipCylZ(cd,a,b,c,d));
+-
+- case CUBE :
+- return (::new ClipCube(cd,a,b,c,d, position));
+-
+- case NONE :
+- return (::new ClipNone(cd,a,b,c,d));
+-
+- default :
++ if(!psp) { // perspective parallel
++ if (cm == SPHERE) return (::new ClipSphere(cd,a,b,c,d));
++#if 0
++ else if (cm == CYLH) return (::new ClipCylH(cd,a,b,c,d));
++ else if (cm == CYLV) return (::new ClipCylV(cd,a,b,c,d));
++#endif
++ else if (cm == CYLZ) return (::new ClipCylZ(cd,a,b,c,d));
++ else if (cm == CUBE) return (::new ClipCube(cd,a,b,c,d, position));
++ else if (cm == NONE) return (::new ClipNone(cd,a,b,c,d));
++ else {
+ cerr << "trying to create unknown clipping mode. using none." << endl;
+ return (::new ClipNone(cd,a,b,c,d));
+ }
+- } else { // perspective central
+-
+- switch( cm ) { // clipmodus
+-
+- case SPHERE :
+- return (::new ClipSphereCentral(cd,a,b,c,d,sz));
+-
+- case CYLH :
+- return (::new ClipCylHCentral(cd,a,b,c,d,sz));
+-
+- case CYLV :
+- return (::new ClipCylVCentral(cd,a,b,c,d,sz));
+-
+- case CYLZ :
+- return (::new ClipCylZCentral(cd,a,b,c,d,sz));
+-
+- case CUBE :
+- return (::new ClipCubeCentral(cd,a,b,c,d,sz, position));
+-
+- case NONE :
+- return (::new ClipCylZCentral(cd,a,b,c,d,sz));
+-
+- default :
++ } else { // perspective central
++ if (cm == SPHERE) return (::new ClipSphereCentral(cd,a,b,c,d,sz));
++#if 0
++ else if (cm == CYLH) return (::new ClipCylHCentral(cd,a,b,c,d,sz));
++ else if (cm == CYLV) return (::new ClipCylVCentral(cd,a,b,c,d,sz));
++#endif
++ else if (cm == CYLZ) return (::new ClipCylZCentral(cd,a,b,c,d,sz));
++ else if (cm == CUBE) return (::new ClipCubeCentral(cd,a,b,c,d,sz, position));
++ else if (cm == NONE) return (::new ClipCylZCentral(cd,a,b,c,d,sz));
++ else {
+ cerr << "trying to create unknown clipping mode. using none." << endl;
+ return (::new ClipNone(cd,a,b,c,d));
+ }
diff --git a/debian/patches/upstream-clip_to_rectangle.patch b/debian/patches/upstream-clip_to_rectangle.patch
deleted file mode 100644
index f1adcfc..0000000
--- a/debian/patches/upstream-clip_to_rectangle.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-Description: upstream: add clip-to-rectangle option
- Quickly implement a clip (to rectangle) machinery for allowing third party
- tiling parallelization. This feature was initially encoded in a modified
- version of surf for surfer (<http://imaginary.org>) by Henning Meyer
- <hmeyer at mathematik.uni-kl.de>, it was revisited on behalf of the Debian
- Science Team and of imaginary.org by Jerome Benoit <calculus at rezozer.net>.
-Origin:
- imaginary.org
- debian
-Forwarded: submitted
-Author:
- Jerome Benoit <calculus at rezozer.net>
- Henning Meyer <hmeyer at mathematik.uni-kl.de>
-Last-Update: 2015-05-14
-
---- a/src/Options.h
-+++ b/src/Options.h
-@@ -16,6 +16,10 @@
- bool get_verbose() const { return !quiet; }
- bool get_quiet() const { return quiet; }
- bool get_auto_extension() const { return auto_extension; }
-+ int get_clip_xmin() const { return clip_xmin; }
-+ int get_clip_ymin() const { return clip_ymin; }
-+ int get_clip_xmax() const { return clip_xmax; }
-+ int get_clip_ymax() const { return clip_ymax; }
-
- private:
- int argc;
-@@ -27,6 +31,8 @@
- bool auto_resize;
- bool quiet;
- bool auto_extension;
-+ int clip_xmin, clip_ymin;
-+ int clip_xmax, clip_ymax;
- };
-
- extern Options* options;
---- a/src/Options.cc
-+++ b/src/Options.cc
-@@ -68,6 +68,11 @@
- << " disable automatic extension for graphic files (default)" << std::endl
- << " --enable-auto-extension" << std::endl
- << " enable automatic extension for graphic files" << std::endl
-+#ifdef NO_GUI
-+ << std::endl
-+ << " --clip-to-rectangle x_min y_min x_max y_max" << std::endl
-+ << " clip images to the specified rectangle" << std::endl
-+#endif
- << std::endl
- << "-v, --verbose verbose operation, print the executed commands (default)" << std::endl
- << "-q, --quiet, --silent quiet operation, do not print the executed commands" << std::endl
-@@ -94,9 +99,12 @@
- progress_dialog(false),
- auto_resize(false),
- quiet(false),
-- auto_extension(false)
-+ auto_extension(false),
-+ clip_xmin(INT_MIN),clip_ymin(INT_MIN),
-+ clip_xmax(INT_MIN),clip_ymax(INT_MIN)
- {
- int i;
-+ int dum;
- for(i = 1; i < argc; ++i) {
- if(argv[i][0] != '-') {
- break;
-@@ -124,6 +132,13 @@
- auto_extension = true;
- } else if(strcmp(argv[i], "--disable-auto-extension") == 0) {
- auto_extension = false;
-+ } else if(strcmp(argv[i], "--clip-to-rectangle") == 0) {
-+ clip_xmin = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
-+ clip_ymin = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
-+ clip_xmax = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
-+ clip_ymax = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
-+ if(clip_xmax < clip_xmin) { dum=clip_xmin; clip_xmin=clip_xmax; clip_xmax=dum; }
-+ if(clip_ymax < clip_ymin) { dum=clip_ymin; clip_ymin=clip_ymax; clip_ymax=dum; }
- } else if(strcmp(argv[i], "--progress-dialog") == 0) {
- #ifdef NO_GUI
- #else
---- a/yaccsrc/Script.cc
-+++ b/yaccsrc/Script.cc
-@@ -375,6 +375,8 @@
-
- void Script::drawSurface()
- {
-+ int xmin, ymin;
-+ int xmax, ymax;
- checkVariables();
- setSize();
- BEGIN("Script::drawSurface");
-@@ -386,6 +388,23 @@
- getDisplay()->setSize (main_width_data, main_height_data);
- }
-
-+ if(options->get_no_gui()) {
-+ int clip_xmin = options->get_clip_xmin();
-+ int clip_ymin = options->get_clip_ymin();
-+ int clip_xmax = options->get_clip_xmax();
-+ int clip_ymax = options->get_clip_ymax();
-+ xmin = ((clip_xmin<0)? 0 : min(clip_xmin, main_width_data));
-+ ymin = ((clip_ymin<0)? 0 : min(clip_ymin, main_height_data));
-+ xmax = ((clip_xmax<0)? main_width_data : min(clip_xmax, main_width_data));
-+ ymax = ((clip_ymax<0)? main_height_data : min(clip_ymax, main_height_data));
-+ }
-+ else {
-+ xmin = 0;
-+ ymin = 0;
-+ xmax = main_width_data;
-+ ymax = main_height_data;
-+ }
-+
- Y_AXIS_LR_ROTATE = 0.0;
- SurfaceCalc sc;
- sc.setDisplay (getDisplay());
-@@ -394,7 +413,7 @@
- getBuffer()->clearTags();
-
- *getZBuffer() = -10.0;
-- sc.surface_calculate(0, 0, main_width_data, main_height_data, *getBuffer());
-+ sc.surface_calculate(xmin, ymin, xmax, ymax, *getBuffer());
-
-
- if( display_numeric.stereo_eye ) {
-@@ -421,7 +440,7 @@
- SurfaceCalc sc;
- sc.setDisplay (getDisplay());
- sc.setPreview (getPreview());
-- sc.surface_calculate(0, 0, main_width_data, main_height_data,*getBuffer());
-+ sc.surface_calculate(xmin, ymin, xmax, ymax,*getBuffer());
-
- intensity->StereoRight( display_numeric.stereo_red,display_numeric.stereo_green,
- display_numeric.stereo_blue,dist,back );
diff --git a/debian/patches/upstream-fork-ps2pdf-hardden.patch b/debian/patches/upstream-fork-ps2pdf-hardden.patch
new file mode 100644
index 0000000..c845e7f
--- /dev/null
+++ b/debian/patches/upstream-fork-ps2pdf-hardden.patch
@@ -0,0 +1,101 @@
+Description: upstream: hardden ps2pdf fork
+Origin: debian
+Forwarded: meant to be submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-05-29
+
+--- a/image-formats/ps.cc
++++ b/image-formats/ps.cc
+@@ -301,54 +301,50 @@
+ return true;
+ }
+
+-bool pdfprint (class bit_buffer &pixel, FILE *psfile, int resolution, const char *fileloc) {
+-
+- printf("DPI: %i\n", resolution);
+- psprint(pixel, psfile, resolution);
+-
+- int status;
+- pid_t pID = fork();
+-
+- if (pID == 0) {
+- execl("/usr/bin/ps2pdf", "/usr/bin/ps2pdf", fileloc, "temp.pdf", (char *) 0);
+- _exit (EXIT_FAILURE);
+- }
+- if (pID > 0)
+- {
+- waitpid(pID, &status, 0);
+- pid_t pID2 = fork();
+- if (pID2 == 0) {
+- execl("/bin/mv", "/bin/mv", "temp.pdf", fileloc, (char *) 0);
+- _exit (EXIT_FAILURE);
++static bool pdfprint_XXX_ps2pdf (const char *fileloc) {
++ char *shellcommand=NULL;
++ bool response=true;
++ if (system(NULL)) {
++ if (!((asprintf(&shellcommand,
++ "/usr/bin/ps2pdf "
++ "%s %s-tmp"
++ " && "
++ "/bin/mv --force %s-tmp %s"
++ " || "
++ "exit 0"
++ "",
++ fileloc,fileloc,fileloc,fileloc)
++ ) < 0)) {
++ if (system(shellcommand)) {
++ ostrstream ostr;
++ ostr << "Error converting file " << fileloc << " (ps2pdf subprocess)";
++ Misc::alert (ostr);
++ response=false;
++ ostr.freeze(false);
++ }
++ free(shellcommand);
+ }
+ }
+- return true;
+-
++ else {
++ ostrstream ostr;
++ ostr << "Error converting file " << fileloc << " (no command processor)";
++ Misc::alert (ostr);
++ response=false;
++ ostr.freeze(false);
++ }
++ return response;
++}
++
++bool pdfprint (class bit_buffer &pixel, FILE *psfile, int resolution, const char *fileloc) {
++ //printf("DPI: %i\n", resolution);
++ psprint(pixel, psfile, resolution);
++ return pdfprint_XXX_ps2pdf (fileloc);
+ }
+
+
+ bool pdfprint_color (class RgbBuffer &pixel, FILE *psfile, int resolution,const char *fileloc) {
+-
+-
+- psprint_color(pixel, psfile, resolution);
+-
+- int status;
+- pid_t pID = fork();
+-
+- if (pID == 0) {
+- execl("/usr/bin/ps2pdf", "/usr/bin/ps2pdf", fileloc, "temp.pdf", (char *) 0);
+- _exit (EXIT_FAILURE);
+- }
+- if (pID > 0)
+- {
+- waitpid(pID, &status, 0);
+- pid_t pID2 = fork();
+- if (pID2 == 0) {
+- execl("/bin/mv", "/bin/mv", "temp.pdf", fileloc, (char *) 0);
+- _exit (EXIT_FAILURE);
+- }
+- }
+- return true;
++ psprint_color(pixel, psfile, resolution);
++ return pdfprint_XXX_ps2pdf (fileloc);
+ }
+ // ============================================================================
+ // End of ps.cc
diff --git a/debian/patches/upstream-parallelization-surface.patch b/debian/patches/upstream-parallelization-surface.patch
new file mode 100644
index 0000000..a6e5ef6
--- /dev/null
+++ b/debian/patches/upstream-parallelization-surface.patch
@@ -0,0 +1,563 @@
+Description: upstream: parallelization: surface
+ Attempt to parallelize surface drawing (surface without cuts for now);
+ implemented on behalf of imaginary.org by Jerome Benoit <calculus at rezozer.net>.
+Origin: imaginary.org
+Forwarded: submitted
+Author:
+ Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2016-08-02
+
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -35,6 +35,13 @@
+ **************************************************************************/
+
+
++#define ENABLE_PARALLELIZATION_SURFACE
++
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++#define ENABLE_PARALLELIZATION_SURFACE_PTHREAD
++#endif
++
++
+ #include <assert.h>
+ #include <stdio.h>
+ #include <errno.h>
+@@ -44,6 +51,10 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE_PTHREAD
++#include <pthread.h>
++#endif
++
+ #include "FileWriter.h"
+ #include "TreePolynom.h"
+ #include "Misc.h"
+@@ -80,6 +91,12 @@
+ // #define DEBUG
+ #include "debug.h"
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++# ifndef SURFALGGEO_ENVIRONMENT_NPROCESSORS
++# define SURFALGGEO_ENVIRONMENT_NPROCESSORS "SURFALGGEO_NPROCESSORS"
++# endif
++#endif
++
+ using namespace std;
+
+ TSDrawingArea *Script::display = 0;
+@@ -104,7 +121,7 @@
+ } else {
+ DMESS("adding new command " << name);
+ }
+-
++
+ symtab_add_surface_name (name, SYM_COMMAND, 1, (void*)func);
+ }
+
+@@ -396,21 +413,204 @@
+ checkVariables();
+
+ BEGIN("Script::setSize");
+- if(buffer->getWidth() != main_width_data ||
+- buffer->getHeight() != main_height_data) {
++ if(buffer->getWidth() != main_width_data || buffer->getHeight() != main_height_data) {
+ buffer->Realloc(main_width_data, main_height_data);
+ if (display) {
+ display->setSize(main_width_data, main_height_data);
+ }
+- buffer->Realloc(main_width_data, main_height_data);
++ //buffer->Realloc(main_width_data, main_height_data);
+ }
+ }
+
+
+ extern double Y_AXIS_LR_ROTATE;
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++static size_t Script_Tile_sys_numberof_processors(void) {
++ char * env_nprocessors=getenv(SURFALGGEO_ENVIRONMENT_NPROCESSORS);
++ size_t numberof_processor=1;
++
++ if (env_nprocessors) {
++ long int long_numberof_processor=strtol(env_nprocessors,NULL,0);
++ if (long_numberof_processor < 0) {
++ long_numberof_processor=-long_numberof_processor;
++ }
++ else {
++ const long int long_max_numberof_processor=4L*sysconf(_SC_NPROCESSORS_CONF);
++ if (long_max_numberof_processor < long_numberof_processor) {
++ long_numberof_processor=long_max_numberof_processor;
++ }
++ }
++ numberof_processor=(long_numberof_processor<2)?1:(size_t)(long_numberof_processor);
++ }
++ else {
++ long int long_numberof_processor=sysconf(_SC_NPROCESSORS_ONLN);
++ double nloadavg[3]={0.0,0.0,0.0};
++
++ if (getloadavg(nloadavg,3) == 3) {
++ double one_over_numberof_processor=1.0/(double)(long_numberof_processor);
++ nloadavg[0] *= one_over_numberof_processor;
++ nloadavg[1] *= one_over_numberof_processor;
++ nloadavg[2] *= one_over_numberof_processor;
++ if (2.5 < (nloadavg[1])) {
++ long_numberof_processor = 1L;
++ }
++ else if ((1.75 < nloadavg[1]) || (2.5 < nloadavg[0])) {
++ long_numberof_processor /= 2L;
++ }
++ }
++ numberof_processor=(long_numberof_processor<2)?1:(size_t)(long_numberof_processor);
++ }
++
++ return numberof_processor;
++}
++
++typedef struct {
++ size_t cardinality;
++ size_t tilingWidth;
++ size_t tilingHeight;
++ int tileWidth;
++ int tileHeight;
++ int areaHorizontalLowerBound;
++ int areaVerticalLowerBound;
++ int areaHorizontalUpperBound;
++ int areaVerticalUpperBound;
++ } Script_Tile_tiling_tuple;
++
++static bool Script_Tile_tiling_compute(size_t cardinality, int xmin, int ymin, int xmax, int ymax, Script_Tile_tiling_tuple *tuple)
++{
++ bool answer = false;
++ if ((tuple) /* && (xmin<xmax) && (ymin<ymax) */) {
++ if (1<cardinality) {
++ const int tile_delta = 67;
++ const int tile_4_3_delta = (4*tile_delta)/3; // 1/3 satisfies (1+epsilon)/2 = (1-epsilon)
++ int tile_cardinal = INT_MAX;
++ int tile_xcardinal = INT_MAX;
++ int tile_ycardinal = INT_MAX;
++ int tile_xdiff = INT_MAX;
++ int tile_ydiff = INT_MAX;
++ int tile_xtile = 0;
++ int tile_ytile = 0;
++ int tile_xmin = INT_MIN;
++ int tile_ymin = INT_MIN;
++ int tile_xmax = INT_MAX;
++ int tile_ymax = INT_MAX;
++ int tile_xstep = SHRT_MAX;
++ int tile_ystep = SHRT_MAX;
++ int xtile, ytile;
++
++ tile_cardinal = (int)(cardinality);
++ tile_xdiff = xmax - xmin;
++ tile_ydiff = ymax - ymin;
++
++ if (tile_4_3_delta < tile_xdiff) {
++ if (tile_4_3_delta < tile_ydiff) { // quadratic tiling
++ tile_xcardinal = (int) ( floor ( sqrt (tile_cardinal) ) );
++ tile_ycardinal = tile_cardinal / tile_xcardinal;
++ // (tile_xcardinal <= tile_ycardinal)
++ if (tile_xdiff <= tile_ydiff) { // square or vertical rectangle
++ tile_xtile = MAX(2, tile_xdiff / tile_delta);
++ tile_ytile = MAX(2, tile_ydiff / tile_delta);
++ if (tile_xcardinal <= tile_xtile)
++ tile_xtile = tile_xcardinal;
++ else {
++ tile_ycardinal = tile_cardinal / tile_xtile;
++ //tile_xcardinal = tile_xtile;
++ }
++ if (tile_ycardinal < tile_ytile)
++ tile_ytile = tile_ycardinal;
++ }
++ else { // (tile_ydiff < tile_xdiff) // horizontal rectangle
++ if (tile_xcardinal < tile_ycardinal) {
++ xtile = tile_ycardinal; tile_ycardinal = tile_xcardinal; tile_xcardinal = xtile;
++ } // (tile_ytile <= tile_xtile)
++ tile_ytile = MAX(2, tile_ydiff / tile_delta);
++ tile_xtile = MAX(2, tile_xdiff / tile_delta);
++ if (tile_ycardinal <= tile_ytile)
++ tile_ytile = tile_ycardinal;
++ else {
++ tile_xcardinal = tile_cardinal / tile_ytile;
++ //tile_ycardinal = tile_ytile;
++ }
++ if (tile_xcardinal < tile_xtile)
++ tile_xtile = tile_xcardinal;
++ }
++ }
++ else { // horizontal linear tiling
++ tile_ytile = 1;
++ tile_xtile = MAX(2, tile_xdiff / tile_delta);
++ if (tile_cardinal < tile_xtile) tile_xtile = tile_cardinal;
++ }
++ }
++ else if (tile_4_3_delta < tile_ydiff) { // vertical linear tiling
++ tile_xtile = 1;
++ tile_ytile = MAX(2, tile_ydiff / tile_delta);
++ if (tile_cardinal < tile_ytile) tile_ytile = tile_cardinal;
++ }
++ else { // scalar tiling
++ tile_ytile = tile_xtile = 1;
++ }
++
++ tile_cardinal = tile_xtile * tile_ytile;
++ tile_xstep = tile_xdiff / tile_xtile;
++ tile_ystep = tile_ydiff / tile_ytile;
++
++ tuple->cardinality = (size_t)(tile_cardinal);
++ tuple->tilingWidth = (size_t)(tile_xtile);
++ tuple->tilingHeight = (size_t)(tile_ytile);
++ tuple->tileWidth = tile_xstep;
++ tuple->tileHeight = tile_ystep;
++ tuple->areaHorizontalLowerBound = xmin;
++ tuple->areaVerticalLowerBound = ymin;
++ tuple->areaHorizontalUpperBound = xmax;
++ tuple->areaVerticalUpperBound = ymax;
++
++ answer = (1<tile_cardinal)?true:false;
++ }
++ else {
++ tuple->cardinality = 1;
++ tuple->tilingWidth = 1;
++ tuple->tilingHeight = 1;
++ tuple->tileWidth = xmax - xmin;
++ tuple->tileHeight = ymax -ymin;
++ tuple->areaHorizontalLowerBound = xmin;
++ tuple->areaVerticalLowerBound = ymin;
++ tuple->areaHorizontalUpperBound = xmax;
++ tuple->areaVerticalUpperBound = ymax;
++ //answer = false;
++ }
++ }
++ return answer;
++}
++
++typedef struct {
++ size_t tdx;
++ SurfaceCalc *sc;
++ int xmin;
++ int ymin;
++ int xmax;
++ int ymax;
++ RgbBuffer *buffer;
++ bool wipedOff;
++ } Script_Tile_tile_tuple;
++
++static void * Script_Tile_tile_tile(void * tuple)
++{
++ Script_Tile_tile_tuple * tile_tuple = (Script_Tile_tile_tuple *)(tuple);
++ SurfaceCalc * sc = tile_tuple->sc;
++ if (tile_tuple->wipedOff) sc->wipeOff(); else tile_tuple->wipedOff = false;
++ (sc->surface_calculate)( tile_tuple->xmin, tile_tuple->ymin, tile_tuple->xmax, tile_tuple->ymax, *(tile_tuple->buffer));
++ pthread_exit(NULL);
++ return NULL;
++}
++
++#endif
++
+ void Script::drawSurface()
+ {
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++ bool flag_multithreading = false;
++#endif
+ int xmin, ymin;
+ int xmax, ymax;
+ checkVariables();
+@@ -437,12 +637,99 @@
+
+ Y_AXIS_LR_ROTATE = 0.0;
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++
++ Script_Tile_tiling_tuple tiling_tuple;
++
++ flag_multithreading = Script_Tile_tiling_compute(Script_Tile_sys_numberof_processors(), xmin, ymin, xmax, ymax, &tiling_tuple);
++
++#ifdef ENABLE_PARALLELIZATION_SURFACE_PTHREAD
++ pthread_t listof_thread[tiling_tuple.cardinality];
++#endif
++ SurfaceCalc *arrayof_sc = new SurfaceCalc [tiling_tuple.cardinality];
++ Script_Tile_tile_tuple listof_tile_tuple[tiling_tuple.cardinality];
++ Script_Tile_tile_tuple * tile_tuple = NULL;
++ size_t tdx = 0;
++
++// #pragma omp parallel shared(arrayof_sc)
++// #pragma omp parallel shared(listof_tile_tuple)
++
++ if (flag_multithreading) {
++
++#define PROCNAME_SURFACECALCULATE(XTile,YTile,TileXmin,TileYmin,TileXmax,TileYmax) \
++ /* fprintf(stderr, \
++ "::::: DEBUG:%s:%s:%d:\t<%2zu/%zu>\t[%2zu/%zu,%2zu/%zu] (%4i,%4i) (%4i,%4i)\n", \
++ __FILE__,__func__,__LINE__, \
++ (tdx + 1), tiling_tuple.cardinality, \
++ XTile, tile_xtile, YTile, tile_ytile, \
++ TileXmin, TileYmin, TileXmax, TileYmax \
++ ); */ \
++ tile_tuple = listof_tile_tuple + tdx; \
++ tile_tuple->tdx = tdx; \
++ tile_tuple->sc = arrayof_sc + tdx; \
++ (tile_tuple->sc)->setDisplay (getDisplay()); \
++ (tile_tuple->sc)->setPreview (getPreview()); \
++ tile_tuple->xmin = TileXmin; tile_tuple->ymin = TileYmin; \
++ tile_tuple->xmax = TileXmax; tile_tuple->ymax = TileYmax; \
++ tile_tuple->buffer = intensity; \
++ tile_tuple->wipedOff = true; \
++ ++tdx;
++
++ { // WIP: might be macrofied
++ const size_t tile_xtile = tiling_tuple.tilingWidth;
++ const size_t tile_ytile = tiling_tuple.tilingHeight;
++ const int tile_xstep = tiling_tuple.tileWidth;
++ const int tile_ystep = tiling_tuple.tileHeight;
++ int tile_xmin = INT_MAX;
++ int tile_ymin = INT_MAX;
++ int tile_xmax = INT_MIN;
++ int tile_ymax = INT_MIN;
++ size_t xtile = 0;
++ size_t ytile = 0;
++ for( ytile=1, tile_ymin=ymin, tile_ymax=tile_ymin+tile_ystep; ytile<tile_ytile; tile_ymin=tile_ymax,tile_ymax+=tile_ystep,++ytile) {
++ for( xtile=1, tile_xmin=xmin, tile_xmax=tile_xmin+tile_xstep; xtile<tile_xtile; tile_xmin=tile_xmax,tile_xmax+=tile_xstep,++xtile) {
++ PROCNAME_SURFACECALCULATE(xtile, ytile, tile_xmin, tile_ymin, tile_xmax, tile_ymax);
++ }
++ PROCNAME_SURFACECALCULATE(xtile, ytile, tile_xmin, tile_ymin, xmax, tile_ymax);
++ }
++ for( xtile=1, tile_xmin=xmin, tile_xmax=tile_xmin+tile_xstep; xtile<tile_xtile; tile_xmin=tile_xmax,tile_xmax+=tile_xstep,++xtile) {
++ PROCNAME_SURFACECALCULATE(xtile, ytile, tile_xmin, tile_ymin, tile_xmax, ymax);
++ }
++ PROCNAME_SURFACECALCULATE(xtile, ytile, tile_xmin, tile_ymin, xmax, ymax);
++ }
++
++#ifdef ENABLE_PARALLELIZATION_SURFACE_PTHREAD
++ for (tdx=0,tile_tuple=listof_tile_tuple;tdx<tiling_tuple.cardinality;++tdx,++tile_tuple) {
++ pthread_create(&listof_thread[tdx],NULL,Script_Tile_tile_tile,(void *)(tile_tuple));
++ }
++ for (tdx=0;tdx<tiling_tuple.cardinality;++tdx) {
++ pthread_join(listof_thread[tdx],NULL);
++ }
++#else
++ for (tdx=0,tile_tuple=listof_tile_tuple;tdx<tiling_tuple.cardinality;++tdx,++tile_tuple) {
++ (tile_tuple->sc->surface_calculate)( tile_tuple->xmin, tile_tuple->ymin, tile_tuple->xmax, tile_tuple->ymax, *intensity);
++ }
++#endif
++
++#undef PROCNAME_SURFACECALCULATE
++ }
++ else {
++ (arrayof_sc->setDisplay)(getDisplay());
++ (arrayof_sc->setPreview)(getPreview());
++ (arrayof_sc->surface_calculate)(xmin, ymin, xmax, ymax, *intensity);
++ }
++
++#else
+ SurfaceCalc sc;
+ sc.setDisplay (getDisplay());
+ sc.setPreview (getPreview());
++#endif
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++#else
+ //sc.wipeOff();
+ sc.surface_calculate(xmin, ymin, xmax, ymax, *intensity);
++#endif
+
+ if( display_numeric.stereo_eye ) {
+
+@@ -450,8 +737,28 @@
+ *getZBuffer3d() = -10.0;
+ intensity->StereoLeft();
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++ if (flag_multithreading) {
++#ifdef ENABLE_PARALLELIZATION_SURFACE_PTHREAD
++ for (tdx=0,tile_tuple=listof_tile_tuple;tdx<tiling_tuple.cardinality;++tdx,++tile_tuple) {
++ pthread_create(&listof_thread[tdx],NULL,Script_Tile_tile_tile,(void *)(tile_tuple));
++ }
++ for (tdx=0;tdx<tiling_tuple.cardinality;++tdx) {
++ pthread_join(listof_thread[tdx],NULL);
++ }
++#else
++ for (tdx=0,tile_tuple=listof_tile_tuple;tdx<tiling_tuple.cardinality;++tdx,++tile_tuple) {
++ (tile_tuple->sc->surface_calculate)( tile_tuple->xmin, tile_tuple->ymin, tile_tuple->xmax, tile_tuple->ymax, *(tile_tuple->buffer));
++ }
++#endif
++ }
++ else {
++ (arrayof_sc->surface_calculate)(xmin, ymin, xmax, ymax, *intensity);
++ }
++#else
+ sc.wipeOff();
+ sc.surface_calculate(xmin, ymin, xmax, ymax, *intensity);
++#endif
+
+ int back =(int)( 0.299*((float)(color_background_data[RED]))
+ +0.587*((float)(color_background_data[GREEN]))
+@@ -469,6 +776,10 @@
+ getDisplay()->drawRgbBuffer (*intensity);
+ }
+
++#ifdef ENABLE_PARALLELIZATION_SURFACE
++ delete[] arrayof_sc;
++#endif
++
+ }
+
+
+--- a/src/cube.h
++++ b/src/cube.h
+@@ -50,7 +50,7 @@
+ double equations[6][4];
+ } cube;
+
+-extern cube clip_cube;
++extern cube GLOBAL_clip_cube;
+
+ void init_cube( cube* );
+
+--- a/src/cube.cc
++++ b/src/cube.cc
+@@ -50,7 +50,7 @@
+ // global data
+ // -------------
+
+-cube clip_cube;
++cube GLOBAL_clip_cube;
+
+ // -----------------------------------
+ // rotate the cube around the x-axis
+--- a/src/SurfaceDataStruct.h
++++ b/src/SurfaceDataStruct.h
+@@ -84,7 +84,6 @@
+ int root_n_all; /* sk Anzahl aller vorhandenen NUS aller Fl�chen*/
+ bool init_all; /* sk wurde �berhaupt eine Fl�che initialisiert*/
+
+-
+ };
+
+ #endif
+--- a/src/SurfaceDataStruct.cc
++++ b/src/SurfaceDataStruct.cc
+@@ -73,7 +73,7 @@
+ // init clipping_cube
+ // --------------------
+
+- init_cube( &clip_cube );
++// init_cube( &GLOBAL_clip_cube );
+
+ surf_n=k;
+ init_all = k > 0;
+--- a/draw/SurfaceCalc.cc
++++ b/draw/SurfaceCalc.cc
+@@ -182,7 +182,8 @@
+ zero_of_polyx( &sf_ds.formulas[i].hpxyz->pZ,
+ zmax,zmin,root[i],
+ root_last_pixel[i],root_last_pixel_n[i],
+- clipper );
++ clipper,
++ flag_numeric_multi_root );
+ sf_ds.root_n_all += sf_ds.surfaces[i].root_n;
+ root_last_pixel_n[i] = sf_ds.surfaces[i].root_n;
+ }
+@@ -442,7 +443,7 @@
+ &sf_ds.formulas[i].hpxyz->pZ,
+ zmax,zmin,root[i],
+ root_last_pixel[i],
+- root_last_pixel_n[i],clipper );
++ root_last_pixel_n[i],clipper,flag_numeric_multi_root );
+ sf_ds.root_n_all+=sf_ds.surfaces[i].root_n;
+ root_last_pixel_n[i] = sf_ds.surfaces[i].root_n;
+ }
+@@ -836,8 +837,7 @@
+ double stepwidth,
+ colorrgb& color_intens )
+ {
+- // FIXME
+- static int inside; // true if normal points into monitor
++ int inside; // true if normal points into monitor
+
+ Vector P; // our point on the surface
+ Vector N; // the surface normal in P
+@@ -1148,7 +1148,7 @@
+ &sf_ds.formulas[i].hpxyz->pZ,
+ zmax,zmin,root[i],
+ root_last_pixel[i],
+- root_last_pixel_n[i],clipper );
++ root_last_pixel_n[i],clipper,flag_numeric_multi_root );
+ sf_ds.root_n_all += sf_ds.surfaces[i].root_n;
+ root_last_pixel_n[i] = sf_ds.surfaces[i].root_n;
+ }
+@@ -1325,14 +1325,14 @@
+ packLights( );
+
+ // ------------------------
+- // illumiation components
++ // illumination components
+ // ------------------------
+ flag_ambient = light_illumination_data & light_illumination_ambient_data;
+ flag_diffuse = light_illumination_data & light_illumination_diffuse_data;
+ flag_reflected = light_illumination_data & light_illumination_reflected_data;
+ flag_transmitted = light_illumination_data & light_illumination_transmitted_data;
+
+- numeric_multi_root = flag_transmitted;
++ flag_numeric_multi_root = flag_transmitted;
+
+ part_A= (float)(((double)(light_settings[0].ambient))/100.0);
+
+--- a/draw/SurfaceCalc.h
++++ b/draw/SurfaceCalc.h
+@@ -137,11 +137,13 @@
+ int flag_reflected;
+ int flag_transmitted;
+
++ int flag_numeric_multi_root;
++
+ float ambient[3][3]; // sk :1'ten 3 definiert RGB, ...
+ float diffuse[3][3]; // 2'ten 3 surfs,inside,balls
+ float tocolor[3]; // sk :Farbe des Farbverlaufs
+
+- double reflected;
++ double reflected;
+ double transmitted;
+ int thickness;
+ double transmission;
+--- a/src/roots.h
++++ b/src/roots.h
+@@ -41,9 +41,8 @@
+ // Function protoytpes
+ // ----------------------------------------------------------------------------
+
+-extern int numeric_multi_root;
+ class polyx;
+-int zero_of_polyx( polyx*,double,double,double*,double*,int,NewClip* );
++int zero_of_polyx( polyx*,double,double,double*,double*,int,NewClip*,int );
+
+ #endif /* ROOTS_H */
+
+--- a/src/roots.cc
++++ b/src/roots.cc
+@@ -47,9 +47,6 @@
+ #include "gui_config.h"
+ #include "NewClip.h"
+
+-// using namespace globals;
+-int numeric_multi_root = 0;
+-
+ // ----------------------------------------------------------------------------
+ // compute roots of f in [zmin,zmax] where g is positive
+ // f: polynomial
+@@ -63,11 +60,12 @@
+ // numeric_root_finder_data: chooses method
+ // ----------------------------------------------------------------------------
+
+-int zero_of_polyx( polyx *f,
++int zero_of_polyx( polyx *f,
+ double zmax,double zmin,
+ double *root,
+ double *root_old,int old_n,
+- NewClip *clipper )
++ NewClip *clipper,
++ int numeric_multi_root)
+ {
+
+
diff --git a/debian/patches/upstream-stereo_draw-rationalize.patch b/debian/patches/upstream-stereo_draw-rationalize.patch
new file mode 100644
index 0000000..1d3156e
--- /dev/null
+++ b/debian/patches/upstream-stereo_draw-rationalize.patch
@@ -0,0 +1,129 @@
+Description: upstream: stereo drawing: rationalize
+ Attempt to rationalize a bit stereo surface drawing; implemented on
+ behalf of imaginary.org by Jerome Benoit <calculus at rezozer.net>.
+Origin: imaginary.org
+Forwarded: submitted
+Author:
+ Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2016-08-02
+
+--- a/draw/SurfaceCalc.h
++++ b/draw/SurfaceCalc.h
+@@ -46,7 +46,6 @@
+ SurfaceCalc();
+ ~SurfaceCalc();
+
+-
+ void setDisplay (TSDrawingArea *display) {vdisplay=display;};
+ void setPreview (const Preview &p)
+ { main_mosaic_choice_data = p;};
+@@ -58,6 +57,7 @@
+ RgbBuffer &intensity,
+ class float_buffer &z_buffer);
+
++ void wipeOff();
+
+ protected:
+ void color_of_single_point (Vector &P, Vector &N, colorrgb &I, int obj_color);
+--- a/draw/SurfaceCalc.cc
++++ b/draw/SurfaceCalc.cc
+@@ -268,6 +268,11 @@
+ sf_ds.init();
+ }
+
++void SurfaceCalc::wipeOff()
++{
++ sf_ds.init();
++}
++
+ SurfaceCalc::~SurfaceCalc()
+ {
+ delete clipper;
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -411,6 +411,8 @@
+
+ void Script::drawSurface()
+ {
++ int xmin, ymin;
++ int xmax, ymax;
+ checkVariables();
+ setSize();
+ BEGIN("Script::drawSurface");
+@@ -422,44 +424,45 @@
+ getDisplay()->setSize (main_width_data, main_height_data);
+ }
+
++ xmin = 0;
++ ymin = 0;
++ xmax = main_width_data;
++ ymax = main_height_data;
++
++ RgbBuffer *intensity = getBuffer();
++
++ intensity->clearTags();
++
++ *getZBuffer() = -10.0;
++
+ Y_AXIS_LR_ROTATE = 0.0;
++
+ SurfaceCalc sc;
+ sc.setDisplay (getDisplay());
+ sc.setPreview (getPreview());
+
+- getBuffer()->clearTags();
+-
+- *getZBuffer() = -10.0;
+- sc.surface_calculate(0, 0, main_width_data, main_height_data, *getBuffer());
+-
++ //sc.wipeOff();
++ sc.surface_calculate(xmin, ymin, xmax, ymax, *intensity);
+
+ if( display_numeric.stereo_eye ) {
+- // -----------------
+- // Draw a 3D image
+- // -----------------
+- RgbBuffer *intensity = getBuffer();
+- *Script::getZBuffer3d() = -10.0;
+
++ Y_AXIS_LR_ROTATE= 2.0*atan( display_numeric.stereo_eye / (2.0*position_numeric.spectator_z) );
++ *getZBuffer3d() = -10.0;
++ intensity->StereoLeft();
+
+- Y_AXIS_LR_ROTATE= 2*atan( display_numeric.stereo_eye/
+- (2*position_numeric.spectator_z) );
+-
+- intensity->StereoLeft( );
++ sc.wipeOff();
++ sc.surface_calculate(xmin, ymin, xmax, ymax, *intensity);
+
+ int back =(int)( 0.299*((float)(color_background_data[RED]))
+ +0.587*((float)(color_background_data[GREEN]))
+ +0.114*((float)(color_background_data[BLUE])));
+ float distf = (float)(display_numeric.stereo_z*display_numeric.stereo_eye/position_numeric.spectator_z);
+- int dist = (int)(distf*((float)
+- (MIN(main_width_data,main_height_data)))/20.0);
+-
+- SurfaceCalc sc;
+- sc.setDisplay (getDisplay());
+- sc.setPreview (getPreview());
+- sc.surface_calculate(0, 0, main_width_data, main_height_data,*getBuffer());
++ int dist = (int)(distf*((float)(MIN(main_width_data,main_height_data)))/20.0);
+
+ intensity->StereoRight(
+- (float)(display_numeric.stereo_red), (float)(display_numeric.stereo_green), (float)(display_numeric.stereo_blue),
++ (float)(display_numeric.stereo_red),
++ (float)(display_numeric.stereo_green),
++ (float)(display_numeric.stereo_blue),
+ dist,back );
+
+ if (GuiThread::haveGUI())
+@@ -952,7 +955,7 @@
+ for (size_t i=1; i<sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0]); i++) {
+ if (sym_cutsurfaces[i].n > 0) {
+ CanvasDataStruct cds;
+- cds.initWith_polyxyz (&sym_cutsurfaces[i]);
++ cds.initWith_polyxyz (&sym_cutsurfaces[i]);
+ Polyxyz p3 (cds.pxyz);
+ dc.setAdditionalPoly (p3);
+ }
diff --git a/debian/patches/upstream-valgrind-silence.patch b/debian/patches/upstream-valgrind-silence.patch
new file mode 100644
index 0000000..7c523bf
--- /dev/null
+++ b/debian/patches/upstream-valgrind-silence.patch
@@ -0,0 +1,700 @@
+Description: upstream -- valgring: silence
+ Attempt to silence error messages as emitted by valgrind(1),
+ mainly memory leaks and use of uninitialised objects.
+Origin: debian
+Forwarded: meant to be submitted to the upstream maintainer team
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-05-26
+
+--- a/yaccsrc/lexfunc.cc
++++ b/yaccsrc/lexfunc.cc
+@@ -232,7 +232,7 @@
+ /* Delete system symbols in symtab */
+ /* ------------------------------------------------------------------------- */
+
+-void symtab_delete_surface_names( void )
++void symtab_delete_surface_names( void )
+ {
+ symtab *s = s_first;
+ symtab *s_next = (symtab*)NULL;
+@@ -240,6 +240,22 @@
+ while( s != (symtab*)NULL ) {
+ if( s->surface ) {
+ s_next = s->next;
++ if (s->name != NULL) {
++ free( s->name );
++ s->name = NULL;
++ }
++ switch (s->type) {
++ case SYM_STRING:
++ if (s->ptr != NULL) {
++ char *str_ptr = *(char**)(s->ptr);
++ if (str_ptr != NULL) {
++ delete_char( str_ptr ); str_ptr = NULL;
++ }
++ s->ptr = NULL;
++ }
++ break;
++ default: break;
++ }
+ symtab_delete_element( s );
+ s = s_next;
+ } else {
+@@ -346,9 +362,13 @@
+ void symtab_delete_total( void )
+ {
+ symtab *s = s_first;
+-
++
+ while( s != (symtab*)NULL ) {
+ symtab *s_next = s->next;
++ if (s->name != NULL) {
++ free( s->name );
++ s->name = NULL;
++ }
+ symtab_delete_element( s );
+ s = s_next;
+ }
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -207,16 +207,16 @@
+ main_formula_pxyz_data[i].n = 0;
+ }
+
+- ostrstream str;
+- str << getDefaultValues() << ends;
++ ostrstream astr;
++ astr << getDefaultValues() << ends;
+
+- internalExecuteScript (str.str());
++ internalExecuteScript (astr.str());
+ // symtab_set_default();
+ error_begin_char = 0;
+ char_number=0;
+ symtab_delete_user_names( );
+-
+ *zbuffer = -10.0;
++ astr.freeze(false);
+ }
+
+ int Script::internalExecuteScript (const char *str, bool runCommands)
+@@ -254,6 +254,35 @@
+ return parse_result;
+ }
+
++void Script::afterScriptExecution()
++{
++ int i;
++ for( i=0; i<int(sizeof(sym_cutsurfaces)/sizeof(sym_cutsurfaces[0])); i++) {
++ if (sym_cutsurfaces[i].n) {
++ delete_coeff_polyxyz( &sym_cutsurfaces[i] );
++ sym_cutsurfaces[i].m = NULL;
++ sym_cutsurfaces[i].deg = DEG_UNSPEC;
++ sym_cutsurfaces[i].n = 0;
++ }
++ }
++ for( i=0; i<MAIN_CLIP_AMOUNT_NUM; i++ ) {
++ if (main_formula_pxyz_data[i].n) {
++ delete_coeff_polyxyz( &main_clip_pxyz_data[i] );
++ main_clip_pxyz_data[i].m = NULL;
++ main_clip_pxyz_data[i].deg = DEG_UNSPEC;
++ main_clip_pxyz_data[i].n = 0;
++ }
++ }
++ for( i=0; i<MAIN_SURFACE_AMOUNT_NUM; i++ ) {
++ if (main_formula_pxyz_data[i].n) {
++ delete_coeff_polyxyz( &main_formula_pxyz_data[i] );
++ main_formula_pxyz_data[i].m = NULL;
++ main_formula_pxyz_data[i].deg = DEG_UNSPEC;
++ main_formula_pxyz_data[i].n = 0;
++ }
++ }
++ draw_func_reinit_parser();
++}
+
+ char *Script::readFile (const char *name)
+ {
+@@ -265,6 +294,7 @@
+ ostrstream ostr;
+ ostr << "Cant stat file " << name << "" << " (" << strerror(errno) << ")" << ends;
+ Misc::alert (ostr);
++ ostr.freeze(false);
+ return 0;
+ }
+
+@@ -274,26 +304,29 @@
+ ostrstream ostr;
+ ostr << "Cant open file " << name << "" << " (" << strerror(errno) << ")";
+ Misc::alert (ostr);
++ ostr.freeze(false);
+ return 0;
+ }
+-
++
+ char *str = new char [size+1];
+ if (fread(str, 1, size, f) != size) {
+ ostrstream ostr;
+ ostr << "Could not read from file " << name << "" << " (" << strerror(errno) << ")";
+ Misc::alert(ostr);
+- delete str;
++ delete []str;
+ fclose(f);
++ ostr.freeze(false);
+ return 0;
+ }
+
+ fclose(f);
+ str[size]=0;
+ if (strlen(str) < size) {
+- delete str;
++ delete []str;
+ ostrstream ostr;
+ ostr << "\"" << name << "\" contains binary data.";
+ Misc::alert(ostr);
++ ostr.freeze(false);
+ return 0;
+ }
+ return str;
+@@ -307,7 +340,8 @@
+ display=0;
+ beforeScriptExecution();
+ internalExecuteScript(str);
+- delete str;
++ afterScriptExecution();
++ delete []str;
+ }
+
+ void Script::init()
+@@ -332,7 +366,9 @@
+ delete bitbuffer;
+ delete zbuffer;
+ delete defaultValues;
++ symtab_delete_surface_names();
+ symtab_delete_total();
++ yy_deinit_global();
+ }
+
+ void Script::addNewCommands()
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -72,7 +72,8 @@
+ start_gtk_main();
+ #endif
+ }
+-
++
+ deinit_all();
++ delete options;
+ return 0;
+ }
+--- a/yaccsrc/polylexyacc.h
++++ b/yaccsrc/polylexyacc.h
+@@ -121,7 +121,7 @@
+ void yyrestart( FILE* );
+ int yyparse( void );
+ void set_the_yyinput( char*,long int,long int );
+-
++int yy_deinit_global( void );
+
+
+ symtab *symtab_add_name ( const char* );
+--- a/yaccsrc/polylex.l
++++ b/yaccsrc/polylex.l
+@@ -344,6 +344,10 @@
+
+ %%
+
++int yy_deinit_global (void) {
++ yylex_destroy();
++ return 0;
++}
+
+ /* ------------------------------------------------------------------------- */
+ /* end of file: polylex.l */
+--- a/draw/SurfaceCalc.cc
++++ b/draw/SurfaceCalc.cc
+@@ -44,6 +44,14 @@
+ #include "float_buffer.h"
+ #include "antialiasing_factor.h"
+
++#ifndef NAN
++#define NAN 0.0/0.0
++#endif
++
++#ifndef INFINITY
++#define INFINTTY 1.0/0.0
++#endif
++
+ // FIXME
+
+ extern double Y_AXIS_LR_ROTATE;
+@@ -108,9 +116,9 @@
+ pixel_color_refine.setBlack();
+
+
+- double root[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE];
+- double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE];
+- int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM];
++ double root[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE] = { { NAN } };
++ double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE] = { { INFINITY } };
++ int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM] = { -1 };
+
+ double refine_radius=display_ref_radius_data;
+
+@@ -262,6 +270,7 @@
+
+ SurfaceCalc::~SurfaceCalc()
+ {
++ delete clipper;
+ }
+
+ inline int SurfaceCalc::needsRefining (const colorrgb &i1, const colorrgb &i2, const colorrgb &i3,
+@@ -341,9 +350,9 @@
+ // ----------------
+ // root variables
+ // ----------------
+- double root[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE];
+- double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE];
+- int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM];
++ double root[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE] = { { NAN } };
++ double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM][MAX_DEGREE] = { { INFINITY } };
++ int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM] = { -1 };
+
+ initVars();
+
+@@ -1043,9 +1052,9 @@
+
+ // --------------------------------------------------------------
+ // Root - Variablen
+- double root[MAIN_SURFACE_AMOUNT_NUM+1][MAX_DEGREE];
+- double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM+1][MAX_DEGREE];
+- int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM+1];
++ double root[MAIN_SURFACE_AMOUNT_NUM+1][MAX_DEGREE] = { { NAN } };
++ double root_last_pixel[MAIN_SURFACE_AMOUNT_NUM+1][MAX_DEGREE] = { { INFINITY } };
++ int root_last_pixel_n[MAIN_SURFACE_AMOUNT_NUM+1] = { -1 };
+
+ double tmp;
+ float distf = (float)(display_numeric.stereo_z*display_numeric.stereo_eye/position_numeric.spectator_z);
+--- a/yaccsrc/simple.c
++++ b/yaccsrc/simple.c
+@@ -82,6 +82,18 @@
+ (int**)NULL
+ };
+
++static void binom_struct_destroy( void )
++{
++ int i;
++ for( i = 0; i <= b_c.created; ++i) {
++ free( b_c.data[i] );
++ b_c.data[i] = NULL;
++ }
++ free( b_c.data );
++ b_c.data = NULL;
++ b_c.created = -1;
++}
++
+ static void binom_struct_create_row( int n )
+ {
+ if( n == 0 ) {
+@@ -106,10 +118,12 @@
+ {
+ int i;
+
++ if(b_c.created < 0) atexit( binom_struct_destroy );
++
+ b_c.data = renew_int_p( b_c.data,n + 1 );
+
+ for( i = b_c.created +1; i <= n; i++ ) {
+- b_c.data[i] = new int[i + 1];
++ b_c.data[i] = (int *)(malloc((size_t)(i+1)*sizeof(int) ));
+ binom_struct_create_row( i );
+ }
+
+@@ -204,7 +218,7 @@
+ {
+ if( n > 0 ) {
+ int **i;
+- i = (int**)malloc( n*sizeof(int*) );
++ i = (int**)malloc((size_t)(n)*sizeof(int*) );
+
+ if( i == (int**)NULL ) {
+ (void)fprintf( stderr,"can't allocate %d pointers to int\n",n );
+@@ -224,7 +238,7 @@
+ if( i == (int**)NULL ) {
+ return new_int_p( n );
+ } else if( n > 0 ) {
+- i = (int**)realloc( (void**)i,n*sizeof(int*) );
++ i = (int**)realloc( (void**)i,(size_t)(n)*sizeof(int*) );
+
+ if( i == (int**)NULL ) {
+ (void)fprintf( stderr,"can't realloc %d pointers to int\n",n );
+--- a/yaccsrc/hornerarith.cc
++++ b/yaccsrc/hornerarith.cc
+@@ -50,22 +50,21 @@
+ delete []pY;
+ delete []pX;
+
+- delete pYpX;
+- delete pYkx;
+- delete pXkz;
++ delete []pYpX;
++ delete []pYkx;
++ delete []pXkz;
+ }
+
+ void hornerpolyxyz::setNull()
+ {
+- pY=0;
++ pY=NULL;
+
+- pYpX=0;
+- pYkx=0;
++ pYpX=NULL;
++ pYkx=NULL;
+ pYn=0;
+-
+- pX=0;
++ pX=NULL;
+
+- pXkz=0;
++ pXkz=NULL;
+ pXn=0;
+ }
+
+--- a/yaccsrc/polyx.cc
++++ b/yaccsrc/polyx.cc
+@@ -44,10 +44,10 @@
+ void polyx::allocCoeff (int size)
+ {
+ n = size;
+- delete a;
++ delete []a;
+ a = new double [size+1];
+
+- int i;
++ int i;
+ for( i = 0; i <= size; i++ ) {
+ a[i] = 0.0;
+ }
+--- a/yaccsrc/polyx.h
++++ b/yaccsrc/polyx.h
+@@ -47,22 +47,21 @@
+ /* ------------------------------------------------------------------------- */
+
+
+-class polyx
++class polyx
+ {
+ private:
+ void operator= (const polyx &);
+ polyx (const polyx &p);
+
+ public:
+- polyx() {n=0; a=0;};
+- ~polyx() {delete a;}
++ polyx() {n=0; a=NULL;};
++ ~polyx() {delete []a;}
+
+ void allocCoeff (int size);
+
+ double horner (double x) const; // evaluate at x with horners method
+ double dx_horner (double x) const; // evaluate derivative at x with horners method
+
+-
+ void fastDerive (polyx &derivative) const;
+
+ public:
+--- a/src/RgbBuffer.cc
++++ b/src/RgbBuffer.cc
+@@ -71,11 +71,10 @@
+ : width(0), height(0),
+ r( NULL ),
+ g( NULL ),
+- b( NULL ),
++ b( NULL ),
+ map( NULL ),
+ curv( NULL),
+-
+- tag ( NULL ),
++ tag ( NULL ),
+ n(0),
+ nmap(0)
+ {
+@@ -87,19 +86,27 @@
+ height(h),
+ r(new byte [w*h] ),
+ g(new byte [w*h] ),
+- b(new byte [w*h] ),
+- map(new byte [w*h] ),
++ b(new byte [w*h] ),
++ map(new byte [w*h] ),
+ curv(new byte[w*h] ),
+-
+- tag(new byte[w*h]),
+- n(w*h),
+- nmap(0)
++ tag(new byte[w*h]),
++ n(w*h),
++ nmap(0)
+
+ {
++ int i;
++
++ for( i=0; i<n; i++ ) {
++ r[i] = g[i] = b[i] = 0;
++ map[i] = 0;
++ curv[i] = 0;
++ tag[i] = 0;
++ }
++
+ }
+
+ // ----------------------------------------------------------------------------
+-// release memory
++// release memory
+ // ----------------------------------------------------------------------------
+ RgbBuffer::~RgbBuffer()
+ {
+@@ -108,7 +115,7 @@
+ delete [] b;
+ delete [] map;
+ delete [] curv;
+- delete [] tag;
++ delete [] tag;
+ }
+
+ void RgbBuffer::clearTags()
+@@ -130,27 +137,36 @@
+ // ----------------------------------------------------------------------------
+ void RgbBuffer::Realloc( int w, int h )
+ {
++ int i;
++
+ n = w * h;
+ width = w;
+ height = h;
+
+-
+ delete [] r;
+ delete [] g;
+ delete [] b;
+-
++
+ delete [] map;
+
+ delete [] curv;
+-
+- delete [] tag;
+-
++
++ delete [] tag;
++
+ r = new byte [n];
+ g = new byte [n];
+ b = new byte [n];
+ map = new byte [n];
+ curv = new byte [n];
+- tag = new byte [n];
++ tag = new byte [n];
++
++ for( i=0; i<n; i++ ) {
++ r[i] = g[i] = b[i] = 0;
++ map[i] = 0;
++ curv[i] = 0;
++ tag[i] = 0;
++ }
++
+ }
+
+ // ----------------------------------------------------------------------------
+@@ -163,7 +179,7 @@
+ r[i] = f;
+ g[i] = f;
+ b[i] = f;
+- curv[i] = f;
++ curv[i] = f;
+ }
+ return *this;
+ }
+@@ -175,9 +191,9 @@
+ value2 = (value2>255) ? 255 : value2;
+ int i;
+ for( i=0; i<n; i++ ) {
+- r[i] = (byte)value0;
+- g[i] = (byte)value1;
+- b[i] = (byte)value2;
++ r[i] = (byte)value0;
++ g[i] = (byte)value1;
++ b[i] = (byte)value2;
+ }
+ }
+
+@@ -188,12 +204,10 @@
+ {
+ int i;
+ for( i=0; i<n; i++ ) {
+- r[i] = 0;
+- g[i] = 0;
+- b[i] = 0;
++ r[i] = g[i] = b[i] = 0;
+ map[i] = 0;
+- curv [i]= 0;
+- tag[i] = 0;
++ curv[i] = 0;
++ tag[i] = 0;
+ }
+ }
+
+@@ -204,21 +218,19 @@
+ {
+ int i;
+ for( i=0; i<n; i++ ) {
+- r[i] = 0;
+- g[i] = 0;
+- b[i] = 0;
+- tag[i]=0;
++ r[i] = g[i] = b[i] = 0;
++ tag[i] = 0;
+ }
+ }
+
+ // ----------------------------------------------------------------------------
+-// set only second layer equal zero
++// set only second layer equal zero
+ // ----------------------------------------------------------------------------
+ void RgbBuffer::NullInit_two()
+ {
+ int i;
+ for( i=0; i<n; i++ ) {
+- curv[i] = 0;
++ curv[i] = 0;
+ }
+ }
+
+@@ -226,27 +238,25 @@
+ {
+ int i;
+ for( i=0; i<n; i++ ) {
+- r[i] = 0;
+- g[i] = 0;
+- b[i] = 0;
++ r[i] = g[i] = b[i] = 0;
+ curv[i] = 0;
+- tag[i] =0;
++ tag[i] = 0;
+ }
+ }
+
+ // ----------------------------------------------------------------------------
+-// copy absolut values of a rgb buffer
++// copy absolut values of a rgb buffer
+ // ----------------------------------------------------------------------------
+ RgbBuffer& RgbBuffer::operator=( const RgbBuffer& a )
+ {
+ int i;
+ for( i=0; i < n; i++ ) {
+- r[i] = (byte)abs( a.r[i] );
+- g[i] = (byte)abs( a.g[i] );
+- b[i] = (byte)abs( a.b[i] );
+- map[i] = (byte)abs( a.map[i] );
+- curv[i] = (byte)abs( a.curv[i] );
+- tag[i] = (byte)abs( a.tag[i]);
++ r[i] = (byte)abs( a.r[i] );
++ g[i] = (byte)abs( a.g[i] );
++ b[i] = (byte)abs( a.b[i] );
++ map[i] = (byte)abs( a.map[i] );
++ curv[i] = (byte)abs( a.curv[i] );
++ tag[i] = (byte)abs( a.tag[i]);
+ }
+ return *this;
+ }
+--- a/drawfunc/DrawfuncData.h
++++ b/drawfunc/DrawfuncData.h
+@@ -30,7 +30,8 @@
+
+ #include <assert.h>
+
+-#include "polyarith.h"
++//#include "polyarith.h"
++#include "MultiVariatePolynom.h"
+ #include "WindowGeometry.h"
+
+
+@@ -65,7 +66,12 @@
+ }
+
+ void setGeometry (const WindowGeometry &wg)
+- { wingeo = wg;};
++ {
++ wingeo = wg;
++ Delta[VARIABLE_X] = wg.getDelta( VARIABLE_X );
++ Delta[VARIABLE_Y] = wg.getDelta( VARIABLE_Y );
++ };
++
+
+
+ // draw curves or cutlines working x/y direction
+--- a/drawfunc/DrawfuncData.cc
++++ b/drawfunc/DrawfuncData.cc
+@@ -70,8 +70,8 @@
+ intensity(rgbbuff),
+ zbuffer(zbuff)
+ {
+- Delta[VARIABLE_X] = GetDelta( VARIABLE_X );// coordinate distances
+- Delta[VARIABLE_Y] = GetDelta( VARIABLE_Y );
++ Delta[VARIABLE_X] = 0.0/0.0; // wingeo not set up // GetDelta( VARIABLE_X ); // coordinate distances
++ Delta[VARIABLE_Y] = 0.0/0.0; // idem // GetDelta( VARIABLE_Y );
+ }
+
+
+--- a/yaccsrc/Script.h
++++ b/yaccsrc/Script.h
+@@ -98,6 +98,7 @@
+ private:
+ static void beforeScriptExecution();
+ static int internalExecuteScript (const char *str, bool runCommands=true);
++ static void afterScriptExecution();
+
+ protected:
+ // Commands....
+--- a/drawfunc/DrawFunc.cc
++++ b/drawfunc/DrawFunc.cc
+@@ -74,6 +74,22 @@
+ addCommand ("cut_with_plane", draw_func_cut);
+ }
+
++void draw_func_reinit_parser( void )
++{
++ if (draw_func_plane_data.n) {
++ delete_coeff_polyxyz( &draw_func_plane_data );
++ draw_func_plane_data.m = NULL;
++ draw_func_plane_data.deg = DEG_UNSPEC;
++ draw_func_plane_data.n = 0;
++ }
++ if (draw_func_function_data.n) {
++ delete_coeff_polyxyz( &draw_func_function_data );
++ draw_func_function_data.m = NULL;
++ draw_func_function_data.deg = DEG_UNSPEC;
++ draw_func_function_data.n = 0;
++ }
++}
++
+ // ----------------------------------------------------------------------------
+ // ---------------- draw a curve ----------------------------------------------
+ // ----------------------------------------------------------------------------
+--- a/drawfunc/DrawFunc.h
++++ b/drawfunc/DrawFunc.h
+@@ -34,11 +34,12 @@
+ #define CURVE_SHUTDOWN 3
+ #define CURVE_ZERO 4
+ #define CURVE_CONST 5
+-#define CURVE_DEG_HIGH 6
++#define CURVE_DEG_HIGH 6
+
+ class Polyxyz;
+
+ void draw_func_init_parser( void );
++void draw_func_reinit_parser( void );
+ void draw_func_draw( void );
+ void draw_func_cut( void );
+
diff --git a/debian/rules b/debian/rules
index 74a9c73..f10503a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,8 @@
#!/usr/bin/make -f
-export DEB_PKG_VERSION = $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p')
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+export DEB_PKG_VERSION = $(shell dpkg-parsechangelog -S Version)
DEB_VIRT_SURFALGGEO_LISTOF_VARIANT = nox ##gtk
diff --git a/debian/surf-alggeo-doc.examples b/debian/surf-alggeo-doc.examples
index 3918a9d..3d3fa88 100644
--- a/debian/surf-alggeo-doc.examples
+++ b/debian/surf-alggeo-doc.examples
@@ -1,2 +1,3 @@
background.pic
examples/*
+debian/adhoc/examples/*
diff --git a/debian/surf-alggeo-doc.links b/debian/surf-alggeo-doc.links
new file mode 100644
index 0000000..8134cb2
--- /dev/null
+++ b/debian/surf-alggeo-doc.links
@@ -0,0 +1,4 @@
+usr/share/doc/surf-alggeo-doc/examples/Makefile usr/share/doc/surf-alggeo-doc/examples/curves/Makefile
+usr/share/doc/surf-alggeo-doc/examples/Makefile usr/share/doc/surf-alggeo-doc/examples/surfaces/Makefile
+usr/share/doc/surf-alggeo-doc/examples/Makefile usr/share/doc/surf-alggeo-doc/examples/useless_but_nice/Makefile
+usr/share/doc/surf-alggeo-doc/examples/Makefile usr/share/doc/surf-alggeo-doc/examples/new/Makefile
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/surf-alggeo.git
More information about the debian-science-commits
mailing list