Build failure due to lang/mgl_python.cpp not found
authorDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Wed, 7 Mar 2012 08:20:35 +0000 (10:20 +0200)
committerDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Wed, 7 Mar 2012 08:20:35 +0000 (10:20 +0200)
.pc/.quilt_patches [deleted file]
.pc/.quilt_series [deleted file]
.pc/.version [deleted file]
debian/changelog~ [deleted file]
debian/control~ [deleted file]
debian/patches/series
debian/patches/src-data_png_cpp.patch [deleted file]

diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
deleted file mode 100644 (file)
index 6857a8d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
deleted file mode 100644 (file)
index c206706..0000000
+++ /dev/null
@@ -1 +0,0 @@
-series
diff --git a/.pc/.version b/.pc/.version
deleted file mode 100644 (file)
index 0cfbf08..0000000
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/debian/changelog~ b/debian/changelog~
deleted file mode 100644 (file)
index b35b2ac..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-mathgl (2~rc1-4) experimental; urgency=low
-
-  * Fix symbols FTBFS on armhf.
-  * Make build dependency on libhdf5-dev only.
-  * Make python-mathgl depend on python-numpy-abi9.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Wed, 22 Feb 2012 19:39:00 +0200
-
-mathgl (2~rc1-3) experimental; urgency=low
-
-  * Fix symbols FTBFS, related to libmgl-wnd6, on several arches.
-  * Make libmgl-dev dependent on libmgl-wnd6.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Wed, 4 Jan 2012 20:16:00 +0200
-
-mathgl (2~rc1-2) experimental; urgency=low
-
-  * Correct typo in mathgl description in debian/control (Closes: #644863).
-  * Try to fix symbols FTBFS on several arches.   
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Wed, 4 Jan 2012 15:30:00 +0200
-
-mathgl (2~rc1-1) experimental; urgency=low
-
-  * New experimental upstream release (Closes: #632468).
-  * No documentation debian packages provided.   
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Wed, 28 Sep 2011 11:30:00 +0300
-
-mathgl (1.11.2-6) unstable; urgency=low
-
-  * Fix FTBFS for sparc (Closes: #642654).  
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Mon, 26 Sep 2011 16:23:12 +0300
-
-mathgl (1.11.2-5) unstable; urgency=low
-
-  * Resolve differences for all non-optional symbols, in symbols files for ia64,
-    sparc and sh4 architectures (Closes: #642654).
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Mon, 26 Sep 2011 10:25:00 +0300
-
-mathgl (1.11.2-4) unstable; urgency=low
-
-  * Add python-numpy to Depnds of python-mathgl in debian/control and add
-    dh_numpy in binary-arch in debian/rules (Closes: #641793).
-  * Ammend symbols files for ia64, sparc and sh4 architectures (Closes: #642654).
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sat, 24 Sep 2011 23:16:00 +0300
-
-mathgl (1.11.2-3) unstable; urgency=low
-
-  * Replace libfltk-dev with libfltk1.3-dev | libfltk-dev in debian/control 
-    Build-Depends (Closes: #638834).
-  * Ammend symbols files for s390x architecture (Closes: #639492).
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Wed, 7 Sep 2011 06:04:00 +0300
-
-mathgl (1.11.2-2) unstable; urgency=low
-
-  * Add debian/source/options file in order to avoid the generation of unneeded debian-
-    changes patch, due to the creation of extra file config.log during build.
-  * Ammend symbols files.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Thu, 18 Aug 2011 20:48:00 +0300
-
-mathgl (1.11.2-1) unstable; urgency=low
-
-  * Incorporate changes due to the last two NMU's.
-  * New upstream version.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Tue, 28 Jun 2011 17:01:00 +0200
-
-mathgl (1.11.1.1-2.2) unstable; urgency=low
-
-  * Non-maintainer upload (closes: #610777).
-  * debian/libmgl-qt5.symbols: _ZN10QByteArrayD1Ev is needed on sparc and
-    ia64, so add it as optional.
-  * debian/libmgl-wx5.symbols: three destructors known to be undefined on
-    armel/armhf are also not defined on ia64 or sparc, so mark these as
-    optional also.  Destructors of foreign classes are not part of the
-    library ABI, so it's fine to ignore these.
-
- -- Steve Langasek <vorlon@debian.org>  Sun, 19 Jun 2011 07:57:43 +0000
-
-mathgl (1.11.1.1-2.1) unstable; urgency=low
-
-  * Non-maintainer upload.
-  * Fix library symbols files (closes: #610777):
-    - debian/libmgl-qt5.symbols: drop _ZN10QByteArrayD2Ev, which is not
-      present on *any* architecture anymore.
-    - debian/libmgl-fltk5.symbols: _ZN9Fl_PixmapC2EPKPKc is not present on
-      ia64 or sparc and never has been.
-    - debian/libmgl5.symbols:
-      + _ZN7mglFuncD1Ev is present on all architectures, drop the
-        architecture list (fixing the 'kfeebsd' typo that caused a build
-        failure on kfreebsd-amd64).
-      + _ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEED2Ev,
-        _ZN8u3dLightD2Ev: symbols not seen on *any* archs, drop.
-      + Drop 18 symbols whose exclusion list included all 15 architectures
-        that have been tested.
-      + Other symbols that are template instantiations are now marked as
-        optional symbols instead of tagged with an arch list, since they are
-        not part of the ABI and will come and go based on the compiler
-        version used, *not* just on the architecture.
-      + If there are 8 or more architectures in the arch qualifier, invert
-        it.  In some cases this reveals that certain symbols are actually
-        64-bit specific - so infer that not-yet-tested 32-bit archs follow
-        the pattern.
-    - debian/*.symbols: any symbols marked for armel should also be marked
-      for armhf.
-  * debian/rules: clean the dependency_libs out of .la files at build
-    time, per Policy 10.2.  Closes: #620629.
-
- -- Steve Langasek <vorlon@debian.org>  Sat, 18 Jun 2011 07:33:55 +0000
-
-mathgl (1.11.1.1-3) unreleased; urgency=low
-
-  * Further attempt to fix symbol breakages
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sun, 29 May 2011 19:41:00 +0200
-
-mathgl (1.11.1.1-2) unstable; urgency=low
-
-  * Try to fix libmgl5 related symbols breakage on all arches
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sun, 22 May 2011 20:50:00 +0200
-
-mathgl (1.11.1.1-1) unstable; urgency=low
-
-  * New upstream version
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Tue, 26 Apr 2011 01:15:00 +0200
-
-mathgl (1.11.0.1-9) unreleased; urgency=low
-
-  * Again try to fix build failure due to broken symbols for several architectures
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sat, 2 Apr 2011 02:05:00 +0200
-
-mathgl (1.11.0.1-8) unstable; urgency=low
-
-  * Try to fix build failure due to broken symbols for several architectures
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Thu, 24 Mar 2011 23:56:00 +0200
-
-mathgl (1.11.0.1-7) unstable; urgency=low
-
-  * Create patch for the removal of the texinfo/mgl_ru.info-* files
-  * Update symbols files (Closes: #618235)
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Mon, 14 Mar 2011 00:10:00 +0200
-
-mathgl (1.11.0.1-6) unstable; urgency=low
-
-  * Try to fix build failure due to broken symbols for sparc64
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sat, 5 Mar 2011 21:27:00 +0200
-
-mathgl (1.11.0.1-5) unstable; urgency=low
-
-  * Try to fix build failure due to broken symbols for armel and s390
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Fri, 25 Feb 2011 21:30:00 +0200
-
-mathgl (1.11.0.1-4) unstable; urgency=low
-
-  * Create mixed symbols files for amd64 and i386 with tagged symbols 
-    (Closes: #610777)
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sat, 19 Feb 2011 23:10:00 +0200
-
-mathgl (1.11.0.1-3) unstable; urgency=low
-
-  * Upload in unstable
-  * Change symbols files for pbuilder --distribution unstable (Closes: #610777)
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sat, 12 Feb 2011 22:14:00 +0200
-
-mathgl (1.11.0.1-2) experimental; urgency=low
-
-  * Update symbols files for pbuilder --distribution experimental.
-  * Remove createpngdirectory.patch from series.
-  * Apply patch for FTBFS on i386 (Closes: #607539).
-  * Add Replaces tags for old mathgl-doc package in debian/control.
-  * Various improvements in the debian/rules file.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Mon, 17 Jan 2011 21:43:00 +0200
-
-mathgl (1.11.0.1-1) experimental; urgency=low
-
-  * Correct debian/copyright file.
-  * Create proper patches for the changes in the source tree.
-  * Add new package for Russian documentation.
-  * New upstream release (Closes: #603004).
-  * Correct several spelling mistakes in manpages and in lang/numpy.i
-  * Create symbols files for libraries.
-  * Register documentation to doc-base.
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sun, 12 Dec 2010 19:13:00 +0200
-
-mathgl (1.10.2.1-2) unstable; urgency=low
-
-  * Make .png pictures visible from the html documentation.
-  * Add python support (Closes: #541481).
-
- -- Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>  Sun, 11 Sep 2010 12:37:00 +0200
-       
-mathgl (1.10.2.1-1) unstable; urgency=low
-
-  [ D Eftaxiopoulos ]
-  * Update to Debian Policy 3.9.1
-  * Put myself and D. Haley to the maintainers list.
-  * Comment out parallel-build-png.patch in the debian/patches/series file
-    since it seems to apply to a texinfo/Makefile.am file that is not 
-    included in the source tree.
-  * Append package quilt to the build-depends list for the source in the 
-    debian/control file, in order to fix a lintian error.
-  * Reinstate debian/source/format file with content '3.0 (quilt)'.
-  * Fix Lintian warnings related to manpages.
-
-  [ D Haley ]
-  * New upstream release 1.10.2.1 (Closes: #562743).
-
-  [ Salvatore Bonaccorso ]
-  * New Maintainer (Closes: #564422). Set Maintainer to Debian Science
-    Maintainers <debian-science-maintainers@lists.alioth.debian.org>.
-  * Convert to '3.0 (quilt)' package source format. Drop quilt framework for
-    packaging. 
-  * debian/control: 
-    - Change Vcs-Browser and Vcs-Git to the debian-science git repository.
-    - Change Section for source package to 'science' as per debian-science
-      group policy.
-    - Set DM-Upload-Allowed field to yes.
-  * Add myself to Uploaders.
-
-  [ Sylvestre Ledru ]
-  * Missing dependency against automake added.
-
- -- Sylvestre Ledru <sylvestre@debian.org>  Sun, 15 Aug 2010 21:45:47 +0200
-
-mathgl (1.9-3) unstable; urgency=low
-
-  * QA upload.
-  * Properly orphan the package (see #564422), set maintainer to QA.
-  * Bump Standards-Version to 3.8.4, no changes needed.
-  * Add debian/README.source, pointing to quilt doc.
-  * Bump build-deps on octave from 3.0 to 3.2 (Closes: #574025).
-
- -- Stefano Zacchiroli <zack@debian.org>  Fri, 26 Mar 2010 14:06:08 +0100
-
-mathgl (1.9-2) unstable; urgency=low
-
-  * Fix FTBFS. Closes: #545882.
-  * Update Standards-Version to 3.8.3.
-
- -- Bradley Smith <bradsmith@debian.org>  Wed, 09 Sep 2009 22:44:44 +0100
-
-mathgl (1.9-1) unstable; urgency=low
-
-  * New upstream release. Closes: #535503.
-  * QT -> qt in package descriptions. Closes: #534425.
-
- -- Bradley Smith <bradsmith@debian.org>  Sun, 19 Jul 2009 16:41:41 +0100
-
-mathgl (1.8.1-6) unstable; urgency=low
-
-  * Redo descriptions.
-
- -- Bradley Smith <bradsmith@debian.org>  Tue, 09 Jun 2009 20:26:42 +0100
-
-mathgl (1.8.1-5) unstable; urgency=low
-
-  * Correct info-dir-section in texinfo/mathgl.texi. Closes: #528893.
-
- -- Bradley Smith <bradsmith@debian.org>  Wed, 27 May 2009 17:52:50 +0100
-
-mathgl (1.8.1-4) unstable; urgency=low
-
-  * Correct libltdl-dev Build-Depend. Closes: #526426.
-  * Further improve descriptions.
-
- -- Bradley Smith <bradsmith@debian.org>  Fri, 01 May 2009 12:59:05 +0100
-
-mathgl (1.8.1-3) unstable; urgency=low
-
-  * Tidy up descriptions. Closes: #521830, #521917.
-  * Update Standards-Version to 3.8.1. (No changes).
-  * Fix watch file.
-
- -- Bradley Smith <bradsmith@debian.org>  Sat, 18 Apr 2009 17:42:59 +0100
-
-mathgl (1.8.1-2) unstable; urgency=low
-
-  * Fix parallel builds. Closes: #519738.
-
- -- Bradley Smith <bradsmith@debian.org>  Thu, 19 Mar 2009 19:08:37 +0000
-
-mathgl (1.8.1-1) unstable; urgency=low
-
-  * New upstream release. Closes: #518769.
-
- -- Bradley Smith <bradsmith@debian.org>  Sun, 08 Mar 2009 13:29:33 +0000
-
-mathgl (1.8-1) unstable; urgency=low
-
-  * Initial release. Closes: #510378.
-
- -- Bradley Smith <bradsmith@debian.org>  Thu, 01 Jan 2009 11:27:32 +0000
diff --git a/debian/control~ b/debian/control~
deleted file mode 100644 (file)
index 5164f6c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-Source: mathgl
-Section: science
-Priority: optional
-Maintainer: Debian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
-Uploaders: Dimitrios Eftaxiopoulos <eftaxi12@otenet.gr>, D Haley <mycae@yahoo.com>
-DM-Upload-Allowed: yes
-Build-Depends: debhelper (>= 7.2.3~), libltdl-dev, libgsl0-dev, freeglut3-dev,
- libgl1-mesa-dev | libgl-dev, libpng-dev, libhdf5-dev, zlib1g-dev, swig,
- libjpeg-dev, libtiff-dev, libfltk1.3-dev | libfltk-dev, libqt4-dev, libwxgtk2.8-dev, 
- texinfo, texi2html, texlive, texlive-generic-recommended, octave3.2-headers,
- libgif-dev, autoconf, automake, python, python-dev, python-numpy, python-support,
- libhdf4-dev, chrpath
-Standards-Version: 3.9.2
-Homepage: http://mathgl.sourceforge.net/index.html
-Vcs-Git: git://git.debian.org/debian-science/packages/mathgl.git
-Vcs-Browser: http://git.debian.org/?p=debian-science/packages/mathgl.git
-
-Package: mathgl
-Architecture: any
-Section: libs
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmgl6 (= ${binary:Version})
-Description: library for scientific graphs. (utilities and examples)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package contains MathGL utilities and examples.
-
-Package: libmgl6
-Architecture: any
-Section: libs
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmgl-data
-Description: library for scientific graphs. (main runtime library)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package contains the shared object files.
-
-Package: libmgl-wnd6
-Architecture: any
-Section: libs
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmgl-data
-Description: library for scientific graphs. (windows runtime library)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package contains the window opening related shared object files.
-
-Package: libmgl-data
-Architecture: all
-Section: misc
-Depends: ${misc:Depends}
-Description: library for scientific graphs. (data files)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package contains the MathGL data files.
-
-Package: libmgl-dev
-Architecture: any
-Section: libdevel
-Depends: libmgl6 (= ${binary:Version}), libmgl-wnd6 (= ${binary:Version}), 
- ${misc:Depends}, libgsl0-dev, libgl1-mesa-dev | libgl-dev, libpng-dev
-Description: library for scientific graphs. (development files)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package contains the development files.
-
-Package: python-mathgl
-Architecture: any
-Section: python
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, 
- python-numpy-abi9
-Description: library for scientific graphs. (Python module)
- A free cross-platform library of fast C++ routines for plotting data in up
- to 3 dimensions. It can export plots to bitmaps and vector EPS, SVG, IDTF
- files. There are simple window interfaces based on GLUT, FLTK and/or Qt.
- MathGL can also be used in the console. There are interfaces to a set of
- languages, such as, C, Fortran, Pascal, Forth, Python, Octave.
- .
- This package provides the Python module for mathgl. 
index 8930613120ce2d858651ec43738c209fa0708f59..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-src-data_png_cpp.patch
diff --git a/debian/patches/src-data_png_cpp.patch b/debian/patches/src-data_png_cpp.patch
deleted file mode 100644 (file)
index d5d2a30..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-Include zlib.h header in file src/data_png.cpp 
---- a/src/data_png.cpp
-+++ b/src/data_png.cpp
-@@ -1,178 +1,179 @@
--/***************************************************************************
-- * data_png.cpp is part of Math Graphic Library
-- * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru>            *
-- *                                                                         *
-- *   This program is free software; you can redistribute it and/or modify  *
-- *   it under the terms of the GNU Library General Public License as       *
-- *   published by the Free Software Foundation; either version 3 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 Library General Public     *
-- *   License along with this program; if not, write to the                 *
-- *   Free Software Foundation, Inc.,                                       *
-- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
-- ***************************************************************************/
--#include <stdlib.h>
--#ifndef NO_PNG
--#include <png.h>
--#endif
--#include "mgl/data.h"
--//-----------------------------------------------------------------------------
--long mgl_col_dif(unsigned char *c1,unsigned char *c2,bool sum)
--{
--      long res,d1=abs(long(c1[0])-long(c2[0])),
--              d2=abs(long(c1[1])-long(c2[1])),d3=abs(long(c1[2])-long(c2[2]));
--      if(sum) res = d1+d2+d3;
--      else    res = mgl_max(d1,mgl_max(d2,d3));
--      return res;
--}
--//-----------------------------------------------------------------------------
--unsigned char *mgl_create_scheme(const char *scheme,long &num)
--{
--      unsigned char *c=0,*cc=new unsigned char[3*strlen(scheme)+3];
--      long nc=1,np=0;
--      register long i,j;
--      mglColor col;
--      for(i=0;i<long(strlen(scheme));i++)
--      {
--              col = mglColor(scheme[i]);
--              if(col.Valid())
--              {       cc[3*np]=col.r; cc[3*np+1]=col.g;       cc[3*np+2]=col.b;       np++;   }
--      }
--      if(np<2)        {       delete []cc;    return 0;       }
--      for(i=0;i<np-1;i++)     nc+=mgl_col_dif(cc+3*i,cc+3*i+3,false);
--      c = new unsigned char[3*nc+3];
--      long dd,pos=0;
--      for(i=0;i<np-1;i++)
--      {
--              dd=mgl_col_dif(cc+3*i,cc+3*i+3,false);
--              for(j=0;j<dd;j++)
--              {
--                      c[3*(pos+j)] = cc[3*i]+(cc[3*i+3]-cc[3*i])*j/dd;
--                      c[3*(pos+j)+1] = cc[3*i+1]+(cc[3*i+4]-cc[3*i+1])*j/dd;
--                      c[3*(pos+j)+2] = cc[3*i+2]+(cc[3*i+5]-cc[3*i+2])*j/dd;
--              }
--              pos += dd;
--      }
--      memcpy(c+3*nc-3,cc+3*np-3,3*sizeof(unsigned char));
--      delete []cc;
--      num=nc;
--      return c;
--}
--//-----------------------------------------------------------------------------
-+/***************************************************************************\r
-+ * data_png.cpp is part of Math Graphic Library\r
-+ * Copyright (C) 2007 Alexey Balakin <balakin@appl.sci-nnov.ru>            *\r
-+ *                                                                         *\r
-+ *   This program is free software; you can redistribute it and/or modify  *\r
-+ *   it under the terms of the GNU Library General Public License as       *\r
-+ *   published by the Free Software Foundation; either version 3 of the    *\r
-+ *   License, or (at your option) any later version.                       *\r
-+ *                                                                         *\r
-+ *   This program is distributed in the hope that it will be useful,       *\r
-+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *\r
-+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *\r
-+ *   GNU General Public License for more details.                          *\r
-+ *                                                                         *\r
-+ *   You should have received a copy of the GNU Library General Public     *\r
-+ *   License along with this program; if not, write to the                 *\r
-+ *   Free Software Foundation, Inc.,                                       *\r
-+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *\r
-+ ***************************************************************************/\r
-+#include <stdlib.h>\r
-+#ifndef NO_PNG\r
-+#include <png.h>\r
-+#endif\r
-+#include "mgl/data.h"\r
-+#include <zlib.h>\r
-+//-----------------------------------------------------------------------------\r
-+long mgl_col_dif(unsigned char *c1,unsigned char *c2,bool sum)\r
-+{\r
-+      long res,d1=abs(long(c1[0])-long(c2[0])),\r
-+              d2=abs(long(c1[1])-long(c2[1])),d3=abs(long(c1[2])-long(c2[2]));\r
-+      if(sum) res = d1+d2+d3;\r
-+      else    res = mgl_max(d1,mgl_max(d2,d3));\r
-+      return res;\r
-+}\r
-+//-----------------------------------------------------------------------------\r
-+unsigned char *mgl_create_scheme(const char *scheme,long &num)\r
-+{\r
-+      unsigned char *c=0,*cc=new unsigned char[3*strlen(scheme)+3];\r
-+      long nc=1,np=0;\r
-+      register long i,j;\r
-+      mglColor col;\r
-+      for(i=0;i<long(strlen(scheme));i++)\r
-+      {\r
-+              col = mglColor(scheme[i]);\r
-+              if(col.Valid())\r
-+              {       cc[3*np]=col.r; cc[3*np+1]=col.g;       cc[3*np+2]=col.b;       np++;   }\r
-+      }\r
-+      if(np<2)        {       delete []cc;    return 0;       }\r
-+      for(i=0;i<np-1;i++)     nc+=mgl_col_dif(cc+3*i,cc+3*i+3,false);\r
-+      c = new unsigned char[3*nc+3];\r
-+      long dd,pos=0;\r
-+      for(i=0;i<np-1;i++)\r
-+      {\r
-+              dd=mgl_col_dif(cc+3*i,cc+3*i+3,false);\r
-+              for(j=0;j<dd;j++)\r
-+              {\r
-+                      c[3*(pos+j)] = cc[3*i]+(cc[3*i+3]-cc[3*i])*j/dd;\r
-+                      c[3*(pos+j)+1] = cc[3*i+1]+(cc[3*i+4]-cc[3*i+1])*j/dd;\r
-+                      c[3*(pos+j)+2] = cc[3*i+2]+(cc[3*i+5]-cc[3*i+2])*j/dd;\r
-+              }\r
-+              pos += dd;\r
-+      }\r
-+      memcpy(c+3*nc-3,cc+3*np-3,3*sizeof(unsigned char));\r
-+      delete []cc;\r
-+      num=nc;\r
-+      return c;\r
-+}\r
-+//-----------------------------------------------------------------------------\r
- void mgl_data_import(HMDT d, const char *fname, const char *scheme,float v1,float v2)\r
--{
--      if(v1>=v2)      return;
--      long num=0;
--#ifndef NO_PNG
--      FILE *fp = fopen(fname, "rb");
--      if (!fp)        return;
--      png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
--      if (!png_ptr)   {       fclose(fp);     return; }
--      png_infop info_ptr = png_create_info_struct(png_ptr);
--      if (!info_ptr)
--      {       png_destroy_read_struct(&png_ptr,0,0);  fclose(fp);     return; }
--      png_infop end_info = png_create_info_struct(png_ptr);
--      if (!end_info)
--      {       png_destroy_read_struct(&png_ptr,&info_ptr,0);  fclose(fp);     return; }
--
--      png_init_io(png_ptr, fp);
--      png_read_png(png_ptr, info_ptr,
--              PNG_TRANSFORM_STRIP_ALPHA|PNG_TRANSFORM_PACKING|
--              PNG_TRANSFORM_STRIP_16|PNG_TRANSFORM_EXPAND,0);
--      unsigned char **rows = png_get_rows(png_ptr, info_ptr);
--      unsigned char *c = mgl_create_scheme(scheme,num);
--      if(num>1)
--      {
--              long w=png_get_image_width(png_ptr, info_ptr);
--              long h=png_get_image_height(png_ptr, info_ptr);
--              d->Create(w,h,1);
--              register long i,j,k;
--              long pos=0,val,mval=256;
--              for(i=0;i<d->ny;i++)    for(j=0;j<d->nx;j++)
--              {
--                      for(mval=256,k=0;k<num;k++)
--                      {
--                              val = mgl_col_dif(c+3*k,rows[d->ny-i-1]+3*j,true);
--                              if(val==0)      {       pos=k;  break;  }
--                              if(val<mval)    {       pos=k;  mval=val;       }
--                      }
--                      d->a[j+d->nx*i] = v1 + pos*(v2-v1)/num;
--              }
--      }
--      delete []c;
--      png_destroy_read_struct(&png_ptr, &info_ptr,&end_info);
--      fclose(fp);
--#endif
--}
--//-----------------------------------------------------------------------------
-+{\r
-+      if(v1>=v2)      return;\r
-+      long num=0;\r
-+#ifndef NO_PNG\r
-+      FILE *fp = fopen(fname, "rb");\r
-+      if (!fp)        return;\r
-+      png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);\r
-+      if (!png_ptr)   {       fclose(fp);     return; }\r
-+      png_infop info_ptr = png_create_info_struct(png_ptr);\r
-+      if (!info_ptr)\r
-+      {       png_destroy_read_struct(&png_ptr,0,0);  fclose(fp);     return; }\r
-+      png_infop end_info = png_create_info_struct(png_ptr);\r
-+      if (!end_info)\r
-+      {       png_destroy_read_struct(&png_ptr,&info_ptr,0);  fclose(fp);     return; }\r
-+\r
-+      png_init_io(png_ptr, fp);\r
-+      png_read_png(png_ptr, info_ptr,\r
-+              PNG_TRANSFORM_STRIP_ALPHA|PNG_TRANSFORM_PACKING|\r
-+              PNG_TRANSFORM_STRIP_16|PNG_TRANSFORM_EXPAND,0);\r
-+      unsigned char **rows = png_get_rows(png_ptr, info_ptr);\r
-+      unsigned char *c = mgl_create_scheme(scheme,num);\r
-+      if(num>1)\r
-+      {\r
-+              long w=png_get_image_width(png_ptr, info_ptr);\r
-+              long h=png_get_image_height(png_ptr, info_ptr);\r
-+              d->Create(w,h,1);\r
-+              register long i,j,k;\r
-+              long pos=0,val,mval=256;\r
-+              for(i=0;i<d->ny;i++)    for(j=0;j<d->nx;j++)\r
-+              {\r
-+                      for(mval=256,k=0;k<num;k++)\r
-+                      {\r
-+                              val = mgl_col_dif(c+3*k,rows[d->ny-i-1]+3*j,true);\r
-+                              if(val==0)      {       pos=k;  break;  }\r
-+                              if(val<mval)    {       pos=k;  mval=val;       }\r
-+                      }\r
-+                      d->a[j+d->nx*i] = v1 + pos*(v2-v1)/num;\r
-+              }\r
-+      }\r
-+      delete []c;\r
-+      png_destroy_read_struct(&png_ptr, &info_ptr,&end_info);\r
-+      fclose(fp);\r
-+#endif\r
-+}\r
-+//-----------------------------------------------------------------------------\r
- void mgl_data_export(HCDT dd, const char *fname, const char *scheme,float v1,float v2,long ns)\r
--{
--      register long i,j,k;
--      long nx=dd->GetNx(), ny=dd->GetNy(), nz=dd->GetNz();
--      mreal vv;
--      if(v1>v2)       return;
--      if(ns<0 || ns>=nz)      ns=0;
--      if(v1==v2)
--      {
--              v1 = 1e20;      v2=-1e20;
--              for(i=0;i<nx*ny*nz;i++)
--              {       vv = dd->vthr(i);       if(vv<v1)       v1=vv;  if(vv>v2)       v2=vv;  }
--      }
--      if(v1==v2)      return;
--#ifndef NO_PNG
--      long num=0;
--      unsigned char *c = mgl_create_scheme(scheme,num);
--      if(num<2)       {       delete []c;             return;         }
--
--      unsigned char **p = (unsigned char **)malloc(ny*sizeof(unsigned char *));
--      unsigned char *d = (unsigned char *)malloc(3*nx*ny*sizeof(unsigned char));
--      for(i=0;i<ny;i++)       p[i] = d+3*nx*(ny-1-i);
--      for(i=0;i<ny;i++)       for(j=0;j<nx;j++)
--      {
--              k = long(num*(dd->v(j,i,ns)-v1)/(v2-v1));
--              if(k<0) k=0;    if(k>=num) k=num-1;
--              memcpy(d+3*(j+i*nx),c+3*k,3*sizeof(unsigned char));
--      }
--      delete []c;
--
--      FILE *fp = fopen(fname, "wb");
--      if (!fp)        return;
--      png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
--      if (!png_ptr)   {       fclose(fp);     return; }
--      png_infop info_ptr = png_create_info_struct(png_ptr);
--      if (!info_ptr)
--      {       png_destroy_write_struct(&png_ptr,0);   fclose(fp);     return; }
--      png_init_io(png_ptr, fp);
--      png_set_filter(png_ptr, 0, PNG_ALL_FILTERS);
--      png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
--      png_set_IHDR(png_ptr, info_ptr, nx, ny, 8, PNG_COLOR_TYPE_RGB,
--                      PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
--      png_set_rows(png_ptr, info_ptr, p);
--      png_write_png(png_ptr, info_ptr,  PNG_TRANSFORM_IDENTITY, 0);
--      png_write_end(png_ptr, info_ptr);
--      png_destroy_write_struct(&png_ptr, &info_ptr);
--      fclose(fp);     free(p);        free(d);
--#endif
--}
--//-----------------------------------------------------------------------------
--void mgl_data_export_(uintptr_t *d, const char *fname, const char *scheme,float *v1,float *v2,int *ns,int l,int n)
--{
--      char *s=new char[l+1];  memcpy(s,fname,l);      s[l]=0;
--      char *f=new char[n+1];  memcpy(f,scheme,n);     f[n]=0;
--      mgl_data_export(_DT_,s,f,*v1,*v2,*ns);
--      delete []s;             delete []f;
--}
-+{\r
-+      register long i,j,k;\r
-+      long nx=dd->GetNx(), ny=dd->GetNy(), nz=dd->GetNz();\r
-+      mreal vv;\r
-+      if(v1>v2)       return;\r
-+      if(ns<0 || ns>=nz)      ns=0;\r
-+      if(v1==v2)\r
-+      {\r
-+              v1 = 1e20;      v2=-1e20;\r
-+              for(i=0;i<nx*ny*nz;i++)\r
-+              {       vv = dd->vthr(i);       if(vv<v1)       v1=vv;  if(vv>v2)       v2=vv;  }\r
-+      }\r
-+      if(v1==v2)      return;\r
-+#ifndef NO_PNG\r
-+      long num=0;\r
-+      unsigned char *c = mgl_create_scheme(scheme,num);\r
-+      if(num<2)       {       delete []c;             return;         }\r
-+\r
-+      unsigned char **p = (unsigned char **)malloc(ny*sizeof(unsigned char *));\r
-+      unsigned char *d = (unsigned char *)malloc(3*nx*ny*sizeof(unsigned char));\r
-+      for(i=0;i<ny;i++)       p[i] = d+3*nx*(ny-1-i);\r
-+      for(i=0;i<ny;i++)       for(j=0;j<nx;j++)\r
-+      {\r
-+              k = long(num*(dd->v(j,i,ns)-v1)/(v2-v1));\r
-+              if(k<0) k=0;    if(k>=num) k=num-1;\r
-+              memcpy(d+3*(j+i*nx),c+3*k,3*sizeof(unsigned char));\r
-+      }\r
-+      delete []c;\r
-+\r
-+      FILE *fp = fopen(fname, "wb");\r
-+      if (!fp)        return;\r
-+      png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);\r
-+      if (!png_ptr)   {       fclose(fp);     return; }\r
-+      png_infop info_ptr = png_create_info_struct(png_ptr);\r
-+      if (!info_ptr)\r
-+      {       png_destroy_write_struct(&png_ptr,0);   fclose(fp);     return; }\r
-+      png_init_io(png_ptr, fp);\r
-+      png_set_filter(png_ptr, 0, PNG_ALL_FILTERS);\r
-+      png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);\r
-+      png_set_IHDR(png_ptr, info_ptr, nx, ny, 8, PNG_COLOR_TYPE_RGB,\r
-+                      PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);\r
-+      png_set_rows(png_ptr, info_ptr, p);\r
-+      png_write_png(png_ptr, info_ptr,  PNG_TRANSFORM_IDENTITY, 0);\r
-+      png_write_end(png_ptr, info_ptr);\r
-+      png_destroy_write_struct(&png_ptr, &info_ptr);\r
-+      fclose(fp);     free(p);        free(d);\r
-+#endif\r
-+}\r
-+//-----------------------------------------------------------------------------\r
-+void mgl_data_export_(uintptr_t *d, const char *fname, const char *scheme,float *v1,float *v2,int *ns,int l,int n)\r
-+{\r
-+      char *s=new char[l+1];  memcpy(s,fname,l);      s[l]=0;\r
-+      char *f=new char[n+1];  memcpy(f,scheme,n);     f[n]=0;\r
-+      mgl_data_export(_DT_,s,f,*v1,*v2,*ns);\r
-+      delete []s;             delete []f;\r
-+}\r
- void mgl_data_import_(uintptr_t *d, const char *fname, const char *scheme,float *v1,float *v2,int l,int n)\r
--{
--      char *s=new char[l+1];  memcpy(s,fname,l);      s[l]=0;
--      char *f=new char[n+1];  memcpy(f,scheme,n);     f[n]=0;
--      mgl_data_import(_DT_,s,f,*v1,*v2);
--      delete []s;             delete []f;
--}
--//-----------------------------------------------------------------------------
-+{\r
-+      char *s=new char[l+1];  memcpy(s,fname,l);      s[l]=0;\r
-+      char *f=new char[n+1];  memcpy(f,scheme,n);     f[n]=0;\r
-+      mgl_data_import(_DT_,s,f,*v1,*v2);\r
-+      delete []s;             delete []f;\r
-+}\r
-+//-----------------------------------------------------------------------------\r