[singular] 04/04: Imported Debian patch 4.0.2+ds-1

Jerome Benoit calculus-guest at moszumanska.debian.org
Mon Aug 3 01:02:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

calculus-guest pushed a commit to branch master
in repository singular.

commit de22f3d7903f61041c3a48d2feb8f3c138b3433b
Author: Jerome Benoit <calculus at rezozer.net>
Date:   Mon Aug 3 02:15:44 2015 +0200

    Imported Debian patch 4.0.2+ds-1
---
 debian/changelog                                   |   13 +-
 debian/control                                     |    7 +-
 debian/copyright                                   |    6 +-
 debian/patches/debianization-gather-headers.patch  |    8 +-
 .../patches/debianization-rename-libraries.patch   |   22 +-
 .../debianization-rename-pkgconfig_files.patch     |   14 +-
 debian/patches/debianization-surf.patch            |   35 +
 debian/patches/debianization.patch                 |   12 +-
 debian/patches/series                              |    9 +-
 debian/patches/upstream-CC2help2man.patch          |   90 -
 debian/patches/upstream-autotools-doxygen.patch    |   18 -
 debian/patches/upstream-autotools-help2man.patch   |   10 +-
 .../upstream-autotools-pkgconfig-refine.patch      |   23 -
 .../patches/upstream-contrib-update-normaliz.patch | 3443 --------------------
 debian/patches/upstream-dump4help2man.patch        |   90 -
 ...upstream-fix-autotools-CPPFLAGS_overwrite.patch |   19 -
 debian/patches/upstream-source-typo.patch          |  334 --
 .../upstream-spelling-error-in-source.patch        |   21 +
 18 files changed, 105 insertions(+), 4069 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2b0b57e..7c912bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,13 +1,18 @@
-singular (4.0.2+ds-1) UNRELEASED; urgency=medium
+singular (4.0.2+ds-1) unstable; urgency=medium
 
-  * New upstream version.
+  * New upstream version, integrate most of submitted upstream patches.
   * Upload to unstable.
   * Debianization:
     - debian/patches/debianization-rename-pkgconfig_files.patch, prepend
       singular- to the singular related modules within the metainformation
-      singular pkg-config files.
+      singular pkg-config files;
+    - debian/patches/ patches:
+      - micro upstream fixes;
+      - minor Debian adaptations;
+      - refresh.
+  * Upstream fixes have been pulled for request to the Singular Team.
 
- -- Jerome Benoit <calculus at rezozer.net>  Sun, 02 Aug 2015 15:56:45 +0000
+ -- Jerome Benoit <calculus at rezozer.net>  Mon, 03 Aug 2015 00:12:09 +0000
 
 singular (4.0.1p2+ds-1) experimental; urgency=medium
 
diff --git a/debian/control b/debian/control
index 9dddb0d..af1f5dd 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Build-Depends:
  autotools-dev, autoconf-archive, dh-autoreconf, libtool, help2man,
  libreadline6-dev,
  libgmp-dev, libmpfr-dev, libglpk-dev, libcdd-dev, libflint-dev, libntl-dev,
-# graphviz, 4ti2, normaliz, surf-alggeo,
+ graphviz, 4ti2, normaliz, surf-alggeo,
  python-polybori (>= 0.8.3)
 Build-Depends-Indep:
  doxygen,
@@ -86,7 +86,10 @@ Description: Computer Algebra System for Polynomial Computations -- module packa
 Package: singular-data
 Architecture: all
 Depends: ${misc:Depends}
-Recommends: singular-ui (= ${binary:Version}), graphviz, 4ti2, normaliz, python-polybori (>= 0.8.3)
+Recommends:
+ singular-ui (= ${binary:Version}),
+ graphviz, 4ti2, normaliz, surf-alggeo,
+ python-polybori (>= 0.8.3)
 Suggests: graphicsmagick-imagemagick-compat | imagemagick
 Multi-Arch: foreign
 Description: Computer Algebra System for Polynomial Computations -- shared data
diff --git a/debian/copyright b/debian/copyright
index d322013..9064cac 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,7 +9,7 @@ Comment:
 
 Files: *
 Copyright:
- 1986-2014 Singular Team <singular at mathematik.uni-kl.de>
+ 1986-2015 Singular Team <singular at mathematik.uni-kl.de>
    Wolfram Decker
    Gert-Martin Greuel
    Gerhard Pfister
@@ -21,7 +21,7 @@ Comment:
 
 Files: factory/*
 Copyright:
- 1991-2014
+ 1991-2015
    Gert-Martin Greuel
    Rudiger Stobbe
    Jens Schmidt
@@ -62,7 +62,7 @@ Files:
  emacs/*
  Singular/*
 Copyright:
- 1986-2014
+ 1986-2015
    Gert-Martin Greuel
    Gerhard Pfister
    Hans Schoeneman
diff --git a/debian/patches/debianization-gather-headers.patch b/debian/patches/debianization-gather-headers.patch
index a473500..7414157 100644
--- a/debian/patches/debianization-gather-headers.patch
+++ b/debian/patches/debianization-gather-headers.patch
@@ -85,7 +85,7 @@ Last-Update: 2014-12-28
  
 --- a/Singular/Makefile.am
 +++ b/Singular/Makefile.am
-@@ -127,7 +127,7 @@
+@@ -129,7 +129,7 @@
  libsingular_Singular_la_LDFLAGS    =${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} -release ${PACKAGE_VERSION} ${PTHREAD_LDFLAGS}
  libsingular_Singular_la_LIBADD     =${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} ${BUILTIN_FLAGS} ${top_builddir}/kernel/libkernel.la ${PTHREAD_LIBS}
  
@@ -118,9 +118,9 @@ Last-Update: 2014-12-28
    shortfl.h mpr_complex.h mpr_global.h numstats.h \
 --- a/libpolys/misc/Makefile.am
 +++ b/libpolys/misc/Makefile.am
-@@ -11,7 +11,7 @@
+@@ -9,7 +9,7 @@
  
- libmisc_la_SOURCES   = int64vec.cc options.c sirandom.c
+ libmisc_la_SOURCES   = int64vec.cc options.c sirandom.c intvec.cc
  
 -libmisc_la_includedir = $(includedir)/singular/misc
 +libmisc_la_includedir = $(includedir)/singular/singular/misc
@@ -270,7 +270,7 @@ Last-Update: 2014-12-28
  Name: @PACKAGE@
  Description: The Singular polynomial/coefficient arithmetic and related supporting functionality
 @@ -11,7 +12,7 @@
- Requires: @PKG_REQUIRE@ factory
+ Requires: @PKG_REQUIRE@
  Conflicts:
  
 -Cflags: -I${includedir} -I${includedir}/singular @SINGULAR_CFLAGS@ @FLINT_CFLAGS@ @NTL_CFLAGS@ @GMP_CFLAGS@
diff --git a/debian/patches/debianization-rename-libraries.patch b/debian/patches/debianization-rename-libraries.patch
index b0aa011..fd859f9 100644
--- a/debian/patches/debianization-rename-libraries.patch
+++ b/debian/patches/debianization-rename-libraries.patch
@@ -67,7 +67,7 @@ Last-Update: 2014-12-28
  pkgconfig_DATA = omalloc.pc
 --- a/Singular/Makefile.am
 +++ b/Singular/Makefile.am
-@@ -13,10 +13,10 @@
+@@ -15,10 +15,10 @@
  
  ########################### libSingular* #########################
  
@@ -81,7 +81,7 @@ Last-Update: 2014-12-28
  
  SOURCES = \
     links/asciiLink.cc\
-@@ -69,7 +69,7 @@
+@@ -71,7 +71,7 @@
  
  #   links/slInit_Dynamic.cc
  
@@ -90,7 +90,7 @@ Last-Update: 2014-12-28
  
  SingularHEADERS = \
     attrib.h \
-@@ -122,13 +122,13 @@
+@@ -124,13 +124,13 @@
  # -DMAKE_DISTRIBUTION
  
  # plural_cmd.inc
@@ -109,7 +109,7 @@ Last-Update: 2014-12-28
  
  #########################################################
  # handle all the generated *.inc
-@@ -176,13 +176,13 @@
+@@ -175,13 +175,13 @@
  
  Singular_SOURCES = tesths.cc mmalloc.cc fegetopt.c fegetopt.h utils.cc  utils.h
  
@@ -125,7 +125,7 @@ Last-Update: 2014-12-28
  
  Singulard_LDFLAGS = -shared ${AM_LDFLAGS} ${BUILTIN_FLAGS}
  
-@@ -193,8 +193,8 @@
+@@ -192,8 +192,8 @@
  ESingular_CPPFLAGS = ${AM_CPPFLAGS} -DESINGULAR -DPROTO
  # ESingular_LDFLAGS = ${AM_LDFLAGS}
  ESingular_LDADD =  ${top_builddir}/libpolys/reporter/libreporter.la \
@@ -136,7 +136,7 @@ Last-Update: 2014-12-28
  
  
  ESingular_SOURCES = emacs.cc fegetopt.c fegetopt.h feOptES.inc feOpt.cc
-@@ -203,8 +203,8 @@
+@@ -202,8 +202,8 @@
  TSingular_CPPFLAGS = ${AM_CPPFLAGS} -DTSINGULAR -DPROTO
  # TSingular_LDFLAGS = ${AM_LDFLAGS}
  TSingular_LDADD = ${top_builddir}/libpolys/reporter/libreporter.la \
@@ -147,7 +147,7 @@ Last-Update: 2014-12-28
  
  TSingular_SOURCES = emacs.cc fegetopt.c fegetopt.h feOptTS.inc feOpt.cc
  # utils.cc utils.h
-@@ -215,7 +215,7 @@
+@@ -214,7 +214,7 @@
  
  libparse_SOURCES = libparse.cc fegetopt.c fegetopt.h utils.cc  utils.h
  
@@ -156,7 +156,7 @@ Last-Update: 2014-12-28
  libparse_LDFLAGS = ${AM_LDFLAGS}
  
  %.1: %
-@@ -254,7 +254,7 @@
+@@ -253,7 +253,7 @@
  check_PROGRAMS=$(TESTS)
  
  test_SOURCES = test.cc
@@ -164,7 +164,7 @@ Last-Update: 2014-12-28
 +test_LDADD = libsingular-Singular.la
  
  #########################################################
- ### plural_cmd.inc
+ # These files are built first
 --- a/xalloc/Makefile.am
 +++ b/xalloc/Makefile.am
 @@ -1,8 +1,8 @@
@@ -407,8 +407,8 @@ Last-Update: 2014-12-28
  
 --- a/Singular/dyn_modules/gfanlib/Makefile.am
 +++ b/Singular/dyn_modules/gfanlib/Makefile.am
-@@ -26,7 +26,7 @@
- gfanlib_la_LDFLAGS  = ${P_PROCS_MODULE_LDFLAGS}
+@@ -33,7 +33,7 @@
+ CXXFLAGS+= $(FEXCEPTIONSFRTTI_CXXFLAGS)
  
  if HAVE_GFANLIB
 - gfanlib_la_LIBADD   = ${abs_top_builddir}/gfanlib/libgfan.la ${CDDGMPLDFLAGS}
diff --git a/debian/patches/debianization-rename-pkgconfig_files.patch b/debian/patches/debianization-rename-pkgconfig_files.patch
index 1702800..247a6da 100644
--- a/debian/patches/debianization-rename-pkgconfig_files.patch
+++ b/debian/patches/debianization-rename-pkgconfig_files.patch
@@ -5,7 +5,7 @@ Description: debianization - rename pkpconfig (pc) files
 Origin: debian
 Forwarded: not-needed
 Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2015-03-15
+Last-Update: 2015-08-02
 
 --- a/Singular.pc.in
 +++ b/Singular.pc.in
@@ -20,7 +20,7 @@ Last-Update: 2015-03-15
  Cflags: -I${multiarchincludedir}/singular -I${multiarchincludedir}/singular/singular -I${includedir}/singular -I${includedir}/singular/singular @SINGULAR_CFLAGS@
 --- a/libpolys/libpolys.pc.in
 +++ b/libpolys/libpolys.pc.in
-@@ -4,12 +4,12 @@
+@@ -4,7 +4,7 @@
  includedir=@includedir@
  multiarchincludedir=@includedir@/@DEB_HOST_MULTIARCH@
  
@@ -29,12 +29,6 @@ Last-Update: 2015-03-15
  Description: The Singular polynomial/coefficient arithmetic and related supporting functionality
  Version: @PACKAGE_VERSION@
  URL: https://github.com/Singular/Sources/tree/spielwiese/@PACKAGE@
- 
--Requires: @PKG_REQUIRE@ factory
-+Requires: @PKG_REQUIRE@ singular-factory
- Conflicts:
- 
- Cflags: -I${multiarchincludedir}/singular -I${multiarchincludedir}/singular/singular -I${includedir}/singular -I${includedir}/singular/singular @SINGULAR_CFLAGS@ @FLINT_CFLAGS@ @NTL_CFLAGS@ @GMP_CFLAGS@
 --- a/resources/resources.pc.in
 +++ b/resources/resources.pc.in
 @@ -4,7 +4,7 @@
@@ -99,7 +93,7 @@ Last-Update: 2015-03-15
  AC_OUTPUT
 --- a/factory/configure.ac
 +++ b/factory/configure.ac
-@@ -145,7 +145,7 @@
+@@ -136,7 +136,7 @@
    AC_MSG_CHECKING([  RESOURCES_LIBS?..])
    AC_MSG_RESULT(${RESOURCES_LIBS:-unset})
  
@@ -108,7 +102,7 @@ Last-Update: 2015-03-15
    AC_SUBST(PKG_REQUIRE)
  else
    AC_MSG_RESULT(no)
-@@ -400,6 +400,6 @@
+@@ -405,6 +405,6 @@
  
  
  
diff --git a/debian/patches/debianization-surf.patch b/debian/patches/debianization-surf.patch
new file mode 100644
index 0000000..a7ef2a0
--- /dev/null
+++ b/debian/patches/debianization-surf.patch
@@ -0,0 +1,35 @@
+Description: debianization: surf[-alggeo]
+ Address the Debian specific naming scheme set up for the surf[-alggeo]
+ software package in the surf-allgeo Debian package.
+Origin: debian
+Forwarded: not-needed
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-08-03
+
+--- a/Singular/singularsurf
++++ b/Singular/singularsurf
+@@ -1,11 +1,14 @@
+ #!/bin/sh
+-echo "width=400;" >$1.pic
+-echo "height=400;" >>$1.pic
+-cat $1 >>$1.pic
+-echo "color_file_format = jpg;">>$1.pic
+-echo "filename = \"/tmp/surf.jpg\";">>$1.pic
+-echo "save_color_image;">>$1.pic
+-surf $1.pic
+-/bin/rm $1.pic
+-display /tmp/surf.jpg
+-/bin/rm /tmp/surf.jpg
++[ -f ${1} ] || exit 1
++SINGULARSURFALLGEOPIC=$(mktemp --tmpdir singular-surf-alggeo-XXXXXXX.pic)
++SINGULARSURFALLGEOJPG=${SINGULARSURFALLGEOPIC%.pic}.jpg
++echo "width=400;" > ${SINGULARSURFALLGEOPIC}
++echo "height=400;" >> ${SINGULARSURFALLGEOPIC}
++cat ${1} >> ${SINGULARSURFALLGEOPIC}
++echo "color_file_format = jpg;" >> ${SINGULARSURFALLGEOPIC}
++echo "filename = \"${SINGULARSURFALLGEOJPG}\";" >> ${SINGULARSURFALLGEOPIC}
++echo "save_color_image;" >> ${SINGULARSURFALLGEOPIC}
++surf-alggeo --quiet ${SINGULARSURFALLGEOPIC}
++display ${SINGULARSURFALLGEOJPG}
++rm -f ${SINGULARSURFALLGEOPIC} ${SINGULARSURFALLGEOJPG}
++## eos
diff --git a/debian/patches/debianization.patch b/debian/patches/debianization.patch
index 9884371..0fafc0f 100644
--- a/debian/patches/debianization.patch
+++ b/debian/patches/debianization.patch
@@ -183,16 +183,16 @@ Last-Update: 2014-12-28
  # Add pre'prefixed config
 --- a/Singular/Makefile.am
 +++ b/Singular/Makefile.am
-@@ -4,6 +4,8 @@
+@@ -6,6 +6,8 @@
  
- AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/kernel -I${top_builddir}/kernel -I${top_srcdir}/libpolys -I${top_builddir}/libpolys $(FACTORY_INCLUDES)  $(GMP_CFLAGS) $(NTL_CFLAGS) $(FLINT_CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"'
+ all-local: feOpt.inc feOptTS.inc feOptES.inc iparith.inc all.lib gftables MOD ${abs_builddir}/LIB Singular ESingular TSingular
  
 +AM_CPPFLAGS += -DDEB_PKG_VERSION=\"$(DEB_PKG_VERSION)\"
 +
  SUBDIRS = dyn_modules
  
  ########################### Possible builtin modules... #########################
-@@ -176,7 +178,7 @@
+@@ -175,7 +177,7 @@
  
  Singular_LDADD = libSingular.la ${BUILTIN_FLAGS}
  
@@ -201,7 +201,7 @@ Last-Update: 2014-12-28
  
  Singulard_SOURCES = tesths.cc mmalloc.cc fegetopt.c fegetopt.h utils.cc  utils.h
  
-@@ -189,7 +191,7 @@
+@@ -188,7 +190,7 @@
  
  #### ESingular
  ESingular_CPPFLAGS = ${AM_CPPFLAGS} -DESINGULAR -DPROTO
@@ -210,7 +210,7 @@ Last-Update: 2014-12-28
  ESingular_LDADD =  ${top_builddir}/libpolys/reporter/libreporter.la \
  ${top_builddir}/libpolys/misc/libmisc.la ${top_builddir}/omalloc/libomalloc.la \
  ${top_builddir}/resources/libresources.la
-@@ -199,7 +201,7 @@
+@@ -198,7 +200,7 @@
  
  #### same for TSingular
  TSingular_CPPFLAGS = ${AM_CPPFLAGS} -DTSINGULAR -DPROTO
@@ -219,7 +219,7 @@ Last-Update: 2014-12-28
  TSingular_LDADD = ${top_builddir}/libpolys/reporter/libreporter.la \
  ${top_builddir}/libpolys/misc/libmisc.la ${top_builddir}/omalloc/libomalloc.la \
  ${top_builddir}/resources/libresources.la
-@@ -214,7 +216,7 @@
+@@ -213,7 +215,7 @@
  libparse_SOURCES = libparse.cc fegetopt.c fegetopt.h utils.cc  utils.h
  
  libparse_LDADD = ${top_builddir}/omalloc/libomalloc.la
diff --git a/debian/patches/series b/debian/patches/series
index b20b5a9..65ba7fa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,10 +1,4 @@
-upstream-contrib-update-normaliz.patch
-upstream-source-typo.patch
-upstream-fix-autotools-CPPFLAGS_overwrite.patch
-upstream-autotools-pkgconfig-refine.patch
-upstream-autotools-doxygen.patch
-upstream-CC2help2man.patch
-upstream-dump4help2man.patch
+upstream-spelling-error-in-source.patch
 upstream-autotools-help2man.patch
 upstream-autotools-help2man-extra.patch
 debianization.patch
@@ -14,3 +8,4 @@ debianization-gather-headers.patch
 debianization-rename-pkgconfig_files.patch
 debianization-documentation.patch
 debianization-4ti2.patch
+debianization-surf.patch
diff --git a/debian/patches/upstream-CC2help2man.patch b/debian/patches/upstream-CC2help2man.patch
deleted file mode 100644
index 30bf578..0000000
--- a/debian/patches/upstream-CC2help2man.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-Description: format usages and helps
- Attempt to format and harmonize the help message of Singular front-end
- programs wrt UN*X customs in view to employ help2man to generate manpages;
- meant to be submitted to the upstream maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/695
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-23
-
---- a/Singular/feOpt.cc
-+++ b/Singular/feOpt.cc
-@@ -237,11 +237,11 @@
- 
-       case FE_OPT_VERSION:
-         {
--	char *s=versionString();
-+        char *s=versionString();
-         printf("%s",s);
--	omFree(s);
-+        omFree(s);
-         return NULL;
--	}
-+        }
- 
-       case FE_OPT_ECHO:
-         si_echo = (int) ((long)(feOptSpec[FE_OPT_ECHO].value));
-@@ -347,11 +347,13 @@
- {
-   int i = 0;
-   char tmp[20];
--#ifdef ESINGULAR
--  printf("ESingular: A Program that starts-up Singular within emacs, for\n");
-+#if defined(ESINGULAR)
-+  printf("ESingular starts up Singular within emacs;\n");
-+#elif defined(TSINGULAR)
-+  printf("TSingular starts up Singular within a terminal window;\n");
- #endif
--  printf("Singular version %s -- a CAS for polynomial computations. Usage:\n", VERSION);
--  printf("   %s [options] [file1 [file2 ...]]\n", name);
-+  printf("Singular is a Computer Algebra System (CAS) for Polynomial Computations.\n");
-+  printf("Usage: %s [options] [file1 [file2 ...]]\n", name);
-   printf("Options:\n");
- 
-   while (feOptSpec[i].name != 0)
-@@ -369,17 +371,17 @@
-         else
-           sprintf(tmp, "%s=%s", feOptSpec[i].name, feOptSpec[i].arg_name);
- 
--        printf(" %c%c --%-19s %s\n",
--               (feOptSpec[i].val != 0 ? '-' : ' '),
--               (feOptSpec[i].val != 0 ? feOptSpec[i].val : ' '),
-+        printf(" %c%c --%-20s %s\n",
-+               (feOptSpec[i].val != LONG_OPTION_RETURN ? '-' : ' '),
-+               (feOptSpec[i].val != LONG_OPTION_RETURN ? feOptSpec[i].val : ' '),
-                tmp,
-                feOptSpec[i].help);
-       }
-       else
-       {
--        printf(" %c%c --%-19s %s\n",
--               (feOptSpec[i].val != 0 ? '-' : ' '),
--               (feOptSpec[i].val != 0 ? feOptSpec[i].val : ' '),
-+        printf(" %c%c --%-20s %s\n",
-+               (feOptSpec[i].val != LONG_OPTION_RETURN ? '-' : ' '),
-+               (feOptSpec[i].val != LONG_OPTION_RETURN ? feOptSpec[i].val : ' '),
-                feOptSpec[i].name,
-                feOptSpec[i].help);
-       }
---- a/Singular/emacs.cc
-+++ b/Singular/emacs.cc
-@@ -134,14 +134,14 @@
- 
-           feOptHelp(feArgv0);
-           exit(0);
--
--        case '?':
--        case ':':
--        case '\0':
-+          break;
-+      case '?':
-+      case ':':
-+      case '\0':
-           mainUsage();
-           exit(1);
- 
--        case  LONG_OPTION_RETURN:
-+      case  LONG_OPTION_RETURN:
-         {
-           switch(option_index)
-           {
diff --git a/debian/patches/upstream-autotools-doxygen.patch b/debian/patches/upstream-autotools-doxygen.patch
deleted file mode 100644
index eecd27f..0000000
--- a/debian/patches/upstream-autotools-doxygen.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Description: autotools: dox[ygen]
- Mainly hardden the generated dox/Makefile clean target;
- meant to be submitted to the upstream maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/693
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-21
-
---- a/dox/Makefile.am
-+++ b/dox/Makefile.am
-@@ -35,6 +35,7 @@
- ## html: doxyfile.stamp
- 
- clean-local:
-+	rm -f html_dox.log tags
- 	rm -rf html
- endif
- 
diff --git a/debian/patches/upstream-autotools-help2man.patch b/debian/patches/upstream-autotools-help2man.patch
index 34fa1a6..c14d8d5 100644
--- a/debian/patches/upstream-autotools-help2man.patch
+++ b/debian/patches/upstream-autotools-help2man.patch
@@ -5,7 +5,7 @@ Description: autotools: help2man
 Origin: debian
 Forwarded: https://github.com/Singular/Sources/pull/695
 Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-23
+Last-Update: 2015-08-02
 
 --- a/configure.ac
 +++ b/configure.ac
@@ -29,7 +29,7 @@ Last-Update: 2014-12-23
  
 --- a/Singular/Makefile.am
 +++ b/Singular/Makefile.am
-@@ -155,6 +155,20 @@
+@@ -157,6 +157,20 @@
  
  bin_PROGRAMS = Singular ESingular TSingular $(optional_Singular_programs)
  
@@ -47,10 +47,10 @@ Last-Update: 2014-12-23
 +ESingular_DESCRIPTION = "Computer Algebra System for Polynomial Computations -- command-line interface within emacs"
 +TSingular_DESCRIPTION = "Computer Algebra System for Polynomial Computations -- command-line interface within a new terminal"
 +
- # the following dependency leads to Singular relinking upon a library update!
- Singular ESingular TSingular $(optional_Singular_programs): ${abs_builddir}/LIB
+ Singular_SOURCES = tesths.cc mmalloc.cc fegetopt.c fegetopt.h utils.cc  utils.h
  
-@@ -202,6 +216,15 @@
+ Singular_LDADD = libSingular.la ${BUILTIN_FLAGS}
+@@ -201,6 +215,15 @@
  libparse_LDADD = ${top_builddir}/omalloc/libomalloc.la
  libparse_LDFLAGS = -static ${AM_LDFLAGS}
  
diff --git a/debian/patches/upstream-autotools-pkgconfig-refine.patch b/debian/patches/upstream-autotools-pkgconfig-refine.patch
deleted file mode 100644
index 48034d4..0000000
--- a/debian/patches/upstream-autotools-pkgconfig-refine.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Description: autotools: pkgconfig: refine
- Attempt to refine the generated pkgconfig configuration file;
- meant to be submitted to the upstream maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/691
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-28
-
---- a/libpolys/libpolys.pc.in
-+++ b/libpolys/libpolys.pc.in
-@@ -8,10 +8,10 @@
- Version: @PACKAGE_VERSION@
- URL: https://github.com/Singular/Sources/tree/spielwiese/@PACKAGE@
- 
--Requires: @PKG_REQUIRE@
-+Requires: @PKG_REQUIRE@ factory
- Conflicts:
- 
- Cflags: -I${includedir} -I${includedir}/singular @SINGULAR_CFLAGS@ @FLINT_CFLAGS@ @NTL_CFLAGS@ @GMP_CFLAGS@
--Libs: -L${libdir} -lpolys -lfactory @FLINT_LIBS@ @NTL_LIBS@ @GMP_LIBS@ @USEPPROCSDYNAMICLD@
-+Libs: -L${libdir} -lpolys @FLINT_LIBS@ @NTL_LIBS@ @GMP_LIBS@ @USEPPROCSDYNAMICLD@
- Libs.private:
- 
diff --git a/debian/patches/upstream-contrib-update-normaliz.patch b/debian/patches/upstream-contrib-update-normaliz.patch
deleted file mode 100644
index cc0e90b..0000000
--- a/debian/patches/upstream-contrib-update-normaliz.patch
+++ /dev/null
@@ -1,3443 +0,0 @@
-Description: contribution update: normaliz
- Update the Singular lib[rary] as provided by the latest normaliz release,
- http://www.home.uni-osnabrueck.de/wbruns/normaliz/;
- the Singular library was extracted by hand.
- This patch is meant to be submitted to the upstream maintainer.
-Origin: debian
-Forwarded: not-needed
-Applied-Upstream:
- pulled to Singular github by the `normaliz' upstream maintainer (after contact).
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2015-01-07
-
---- a/Singular/LIB/normaliz.lib
-+++ b/Singular/LIB/normaliz.lib
-@@ -1,1684 +1,1744 @@
--//// Singular library normaliz.lib
--
--version="version normaliz.lib 4.0.0.0 Jun_2013 "; // $Id: 834af90f9535c61eaa27f93a6aaa915ac1b155b2 $
--category="Commutative Algebra";
--info="
--LIBRARY: normaliz.lib  Provides an interface for the use of Normaliz 2.7
--         within SINGULAR.
--AUTHORS:  Winfried Bruns, Winfried.Bruns at Uni-Osnabrueck.de
--          Christof Soeger, Christof.Soeger at Uni-Osnabrueck.de
--
--OVERVIEW:
--The library normaliz.lib provides an interface for the use of Normaliz 2.7
--within SINGULAR. The exchange of data is via files.
--In addition to the top level
--functions that aim at objects of type ideal or ring, several other auxiliary
--functions allow the user to apply Normaliz to data of type intmat. Therefore
--SINGULAR can be used as a comfortable environment for the work with Normaliz.
--@* Please see the @code{Normaliz2.7Documentation.pdf} (included in the Normaliz
--distribution) for a more extensive documentation of Normaliz.
-- at code{nmz_sing.pdf} describes this library version 2.2, but most points are
--still valid.
--
--@*Singular and Normaliz exchange data via files. These files are automatically
--created and erased behind the scenes. As long as one wants to use only the
--ring-theoretic functions there is no need for file management.
--
--@*Note that the numerical invariants computed by Normaliz can be
--accessed in this \"automatic file mode\".
--
--@*However, if Singular is used as a frontend for Normaliz or the user
--wants to inspect data not automatically returned to Singular, then
--an explicit filename and a path can be specified for the exchange of
--data. Moreover, the library provides functions for access to these files.
--Deletion of the files is left to the user.
--
--@* Use of this library requires the program Normaliz to be installed.
--You can download it from
-- at uref{http://www.mathematik.uni-osnabrueck.de/normaliz/}. Please make sure
--that the executables are in the search path or use setNmzExecPath
--(@ref{setNmzExecPath}).
--
--KEYWORDS: integral closure; normalization
--
--PROCEDURES:
-- intclToricRing(ideal I)      computes the integral closure of the toric ring
--                              generated by the leading monomials of the
--                              elements of I in the basering
-- normalToricRing(ideal I)     computes the normalization of the toric ring
--                              generated by the leading monomials of the
--                              elements of I
-- normalToricRingFromBinomials(ideal I)  computes the normalization of the
--                              polynomial ring modulo the unique minimal prime
--                              ideal of the binomial ideal I
-- ehrhartRing(ideal I)         computes the monomials representing the lattice
--                              points of the polytop generated leading monomials
--                              of the elements of I
-- intclMonIdeal(ideal I)       the exponent vectors of the leading monomials of
--                              the elements of I are considered as generators of
--                              a monomial ideal whose Rees algebra is computed
--
-- torusInvariants(intmat T)    computes the ring of invariants of a torus action
-- finiteDiagInvariants(intmat C)  computes the ring of invariants of a finite
--                                 abelian group acting diagonally on a polynomial
--                                 ring
-- diagInvariants(intmat C)     computes the ring of invariants of a
--                              diagonalizable group
-- intersectionValRings(intmat V)   computes the intersection of the polynomial
--                                  ring with the valuation rings of monomial
--                                  valuations
-- intersectionValRingIdeals(intmat V)       computes ideals of monomial valuations
--
-- showNuminvs()                prints the numerical invariants
-- exportNuminvs()              exports the numerical invariants
--
-- setNmzOption(string s, int onoff) sets the option s to onoff
-- showNmzOptions()             prints the enabled options to the standard output
--
-- normaliz(intmat sgr,int nmz_mode) applies Normaliz
-- setNmzExecPath(string nmz_exec_path_name) sets the path to the Normaliz
--                                           executable
--
-- writeNmzData(intmat sgr, int n_mode) creates an input file for Normaliz
-- readNmzData(string nmz_suffix) reads the Normaliz output file with the
--                                specified suffix
--
-- setNmzFilename(string nmz_filename_name) sets the filename for the exchange
--                                          of data
-- setNmzDataPath(string nmz_data_path_name) sets the directory for the exchange
--                                           of data
-- writeNmzPaths()              writes the path names into two files
-- startNmz()                   retrieves the path names written by writeNmzPaths
-- rmNmzFiles()                 removes the files created for and by Normaliz
--
-- mons2intmat(ideal I)         returns the intmat whose rows represent the
--                              leading exponents of the elements of I
-- intmat2mons(intmat expo_vecs) returns the ideal generated by the monomials
--                               which have the rows of expo_vecs as
--                               exponent vector
-- binomials2intmat(ideal I)    returns the intmat whose rows represent the
--                              exponents of the elements of the binomial ideal I
--";
--
--
--// helpers
--
--static proc desInt(string intname, int value)
--// define, export and set an integer
--{
--    int exists;
--    if(defined(`intname`)){exists=1;}
--    if(!exists)
--    {
--        int `intname`=value;export(`intname`);
--    }
--    `intname`=value;
--}
--
--static proc desString(string stringname, string value)
--// define, export and set a string
--{
--    int exists;
--    if(defined(`stringname`)){exists=1;}
--    if(!exists)
--    {
--        string `stringname`=value;export(`stringname`);
--    }
--    `stringname`=value;
--}
--
--static proc queryInt(string intname)
--// if intname is defined, return(intname), else return(0)
--{
--    int exists,value;
--    if(defined(`intname`)){exists=1;}
--    if(!exists)
--    {
--        return(0);
--    }
--    return(`intname`);
--}
--
--static proc queryString(string stringname)
--// if stringname is defined, return(stringname), else return("")
--{
--    int exists;
--    string value;
--    if(defined(`stringname`)){exists=1;}
--    if(!exists)
--    {
--        return("");
--    }
--    return(`stringname`);
--}
--
--static proc fileExists(string f)
--{
--    return(status (f,"exists")=="yes");
--}
--
--static proc appendSlash(string s)
--// if nonempty and / is not the terminating char
--{
--    if(size(s)>0)
--    {
--        if(s[size(s)]!="/")
--        {
--            s=s+"/";
--            return(s);
--        }
--    }
--    return(s);
--}
--
--// filenames and paths
--
--proc setNmzExecPath(string nmz_exec_path_name)
--"USAGE:   setNmzExecPath(string s);   @code{s} path to the Normaliz executable
--CREATE:   @code{Normaliz::nmz_exec_path} to save the given path @code{s}
--NOTE:     It is not necessary to use this function if the Normaliz executable
--          is in the search path of the system.
--SEE ALSO: setNmzOption
--EXAMPLE:  example setNmzExecPath; shows an example"
--{
--    desString("nmz_exec_path",nmz_exec_path_name);
--    nmz_exec_path=appendSlash(nmz_exec_path);
--}
--example
--{ "EXAMPLE:";echo = 2;
--  setNmzExecPath("../Normaliz/");
--}
--
--proc setNmzFilename(string nmz_filename_name)
--"USAGE:   setNmzFilename(string s);
--CREATE:   @code{Normaliz::nmz_filename} to save the given filename @code{s}
--NOTE:     The function sets the filename for the exchange of data. Unless a
--          path is set by setNmzDataPath, files will be created in the current
--          directory.
--          @* If a non-empty filename is set, the files created for and by
--             Normaliz are kept. This is mandatory for the data access functions
--             (see @ref{writeNmzData} and @ref{readNmzData}).
--          @* Resetting the filename by setNmzFilename(\"\") forces the library
--             to return to deletion of temporary files, but the files created
--             while the filename had been set will not be erased.
--SEE ALSO: writeNmzData, readNmzData, setNmzDataPath, rmNmzFiles
--EXAMPLE:  example setNmzFilename; shows an example"
--{
--    desString("nmz_filename",nmz_filename_name);
--    if(nmz_filename_name!="")
--    {
--        desInt("nmz_files_keep_switch",1);
--    }
--    else
--    {
--        desInt("nmz_files_keep_switch",0);
--    }
--}
--example
--{ "EXAMPLE:";echo = 2;
--  setNmzDataPath("examples/");
--  setNmzFilename("example1");
--  //now the files for the exchange with Normaliz are examples/example1.SUFFIX
--}
--
--proc setNmzDataPath(string nmz_data_path_name)
--"USAGE:   setNmzDataPath(string s);
--CREATE:   @code{Normaliz::nmz_data_path} to save the given path @code{s}
--NOTE:     The function sets the path for the exchange of data. By default the
--          files will be created in the current directory.
--          @* It seems that Singular cannot use filenames starting with @code{~}
--             or @code{$HOME} in its input/output functions.
--          @* You must also avoid path names starting with @code{/} if you work
--             under Cygwin, since Singular and Normaliz interpret them in
--             different ways.
--SEE ALSO: writeNmzData, readNmzData, rmNmzFiles, setNmzFilename
--EXAMPLE:  example setNmzDataPath; shows an example"
--{
--    desString("nmz_data_path",nmz_data_path_name);
--    nmz_data_path=appendSlash(nmz_data_path);
--}example
--{ "EXAMPLE:";echo = 2;
--  setNmzDataPath("examples/");
--  setNmzFilename("example1");
--  //now the files for the exchange with Normalize are examples/example1.SUFFIX
--}
--
--proc writeNmzPaths();
--"USAGE:   writeNmzPaths();
--CREATE:   the file nmz_sing_exec.path where the path to the Normaliz executable
--          is saved
--          @* the file nmz_sing_data.path where the directory for the exchange
--          of data is saved
--NOTE:     Both files are saved in the current directory. If one of the names
--          has not been defined, the corresponding file is created, but
--          contains nothing.
--SEE ALSO: setNmzDataPath, setNmzExecPath, startNmz
--EXAMPLE:  example writeNmzPaths; shows an example
--"{
--    link outf=":w nmz_sing_exec.path";
--    write(outf, queryString("nmz_exec_path"));
--    close(outf);
--
--    outf=":w nmz_sing_data.path";
--    write(outf, queryString("nmz_data_path"));
--    close(outf);
--}
--example
--{ "EXAMPLE:";echo = 2;
--  setNmzExecPath("../Normaliz/");
--  writeNmzPaths();
--  int dummy=system("sh","cat nmz_sing_exec.path");
--  dummy=system("sh","cat nmz_sing_data.path");
--}
--
--proc startNmz()
--"USAGE:   startNmz();
--PURPOSE:  This function reads the files written by @code{writeNmzPaths()},
--          retrieves the path names, and types them on the standard output
--          (as far as they have been set). Thus, once the path names have been
--          stored, a Normaliz session can simply be opened by this function.
--SEE ALSO: setNmzDataPath, setNmzExecPath, writeNmzPaths
--EXAMPLE:  example startNmz; shows an example
--"
--{
--    link inf=":r nmz_sing_exec.path";
--    string s=read(inf);
--    int i,p;
--    p=findWord("/",s,1);
--    if(p!=-1)
--    {
--        for(i=size(s);i>=1;i--)
--        {
--            if(s[i]=="/")
--            {
--                s=s[1..i];
--                break;
--            }
--        }
--        desString("nmz_exec_path",s);
--        "nmz_exec_path is",nmz_exec_path;
--    }
--    else
--    {
--        "nmz_exec_path not set";
--    }
--
--    inf=":r nmz_sing_data.path";
--    s=read(inf);
--    p=findWord("/",s,1);
--    if(p!=-1)
--    {
--        for(i=size(s);i>=1;i--)
--        {
--            if(s[i]=="/")
--            {
--                s=s[1..i];
--                break;
--            }
--        }
--        desString("nmz_data_path",s);
--        "nmz_data_path is",nmz_data_path;
--    }
--    else
--    {
--        "nmz_data_path not set";
--    }
--}
--example
--{ "EXAMPLE:"; echo=2;
--  startNmz();
--}
--
--static proc getNmzFile()
--{
--    if(queryInt("nmz_files_keep_switch"))
--    {
--        return(queryString("nmz_data_path")+queryString("nmz_filename"));
--    }
--    else
--    {
--        return(queryString("nmz_filename"));
--    }
--}
--
--static proc makeTempNmzDataPath()
--{
--    string testdir, testdir1;
--    int i,dummy;
--
--    testdir1="/tmp/nmz_sing_"+string(system("pid"));
--    testdir=testdir1;
--    while(fileExists(testdir))
--    {
--        i++;
--        testdir=testdir1+string(i);
--    }
--    dummy=system("sh","mkdir "+ testdir);
--    desString("nmz_filename",testdir+"/nmz"); //files are nmz+suffix in testdir
--}
--
--static proc eraseTempNmzDataPath();
--{
--    int dummy;
--
--    string tmpdir=getNmzFile();
--    tmpdir=tmpdir[1..size(tmpdir)-4]; // remove "/nmz"
--    dummy=system("sh","rm -r "+tmpdir);
--    setNmzFilename("");
--}
--
--static proc setNmzExec()
--{
--    return(queryString("nmz_exec_path")+"normaliz");
--}
--
--proc rmNmzFiles()
--"USAGE:  rmNmzFiles();
--PURPOSE: This function removes the files created for and by Normaliz, using
--         the last filename specified.
--         It needs an explicit filename set (see @ref{setNmzFilename}).
--SEE ALSO: writeNmzData, readNmzData, setNmzFilename, setNmzDataPath
--EXAMPLE:  example rmNmzFiles; shows an example
--"{
--
--    if(!queryInt("nmz_files_keep_switch"))
--    {
--        ERROR("rmNmzFiles: no filename specified");
--    }
--
--    list suffixes="in","gen","out","cst","typ","egn","esp","inv","tri","ht1",
--                  "ext";
--    int i,dummy;
--    string f;
--
--    for(i=1;i<=size(suffixes);i++)
--    {
--        f=getNmzFile()+"."+suffixes[i];
--        if (fileExists(f)) { dummy=system("sh","rm "+f+ "&> /dev/null"); }
--    }
--}
--example
--{ "EXAMPLE:"; echo=2;
--  setNmzFilename("VeryInteresting");
--  rmNmzFiles();
--}
--
--
--
--// parsing normaliz output
--
--static proc digit(string s)
--{
--    if(s==" ") // skip blanks quickly
--    {
--        return(0);
--    }
--
--    if((s[1]>="0" && s[1]<="9")||s[1]=="-")
--    {
--        return(1);
--    }
--    return(0);
--}
--
--static proc nextWord(string s, int p)
--{
--    int j,sw,ew;
--
--    for(;p<=size(s);p++) // must start with a letter
--    {
--
--        if((s[p]>="a" && s[p]<="z")||
--             (s[p]>="A" && s[p]<="Z"))
--        {
--            sw=p; break;
--        }
--    }
--    if(p>size(s))
--    {
--        return(-1,-1); // no word found
--    }
--
--    for(;p<=size(s);p++) // now numerals and -_ allowed
--    {
--        if(!((s[p]>="a" && s[p]<="z")||
--             (s[p]>="A" && s[p]<="Z")||
--             (s[p]>="0" && s[p]<="9")||
--              s[p]=="_"||s[p]=="-"))
--        {
--            break;
--        }
--    }
--    return(sw,p);
--}
--
--static proc getInt(string s, int p)
--{
--    string nst;
--    int i,j,en,sn;
--
--    for(;p<=size(s);p++)
--    {
--
--        if(digit(s[p]))
--        {
--            sn=p; break;
--        }
--    }
--    if(not(sn))
--    {
--        return(0,-1); // -1 indicates: no number found
--    }
--    p++;
--    for(;p<=size(s);p++)
--    {
--        if(!digit(s[p]))
--        {
--            en=p-1; break;
--        }
--    }
--    if(p>size(s))
--    {
--        en=size(s);
--    }
--    nst="i="+s[sn,en-sn+1];
--    execute(nst);
--    return(i,p);
--}
--
--
--static proc getRational(string s, int p)
--{
--    string nst;
--    int i,j,en,sn;
--
--    for(;p<=size(s);p++)
--    {
--        if(digit(s[p]))
--        {
--            sn=p; break;
--        }
--    }
--    if(not(sn))
--    {
--        return(0,-1); // -1 indicates: no number found
--    }
--    p++;
--    int slash_at;
--    for(;p<=size(s);p++)
--    {
--        if(s[p]=="/")
--        {
--            slash_at=p;
--            p++;
--            continue;
--        }
--        if(!digit(s[p]))
--        {
--            en=p-1; break;
--        }
--    }
--    if(p>size(s))
--    {
--        en=size(s);
--    }
--    if(slash_at)
--    {
--        nst="i="+s[sn,slash_at-sn];
--        execute(nst);
--        nst="j="+s[slash_at+1,en-slash_at];
--        execute(nst);
--        return(i,p,j);
--    }
--    nst="i="+s[sn,en-sn+1];
--    execute(nst);
--    return(i,p);
--}
--
--
--static proc findWord(string s, string t, int p)
--{
--    for(;p<=size(t)-size(s)+1;p++)
--    {
--        if(t[p]==s[1])
--        {
--            if(t[p,size(s)]==s)
--            {
--                 return(p+size(s));
--            }
--        }
--    }
--    return(-1);
--}
--
--
--static proc skipEqualsign(string s,int p)
--{
--    for(;p<=size(s);p++)
--    {
--        if(s[p]=="=")
--        {
--            break;
--        }
--    }
--    return(p+1);
--}
--
--
--// input and output to/from normaliz
--
--//list must have pairs of intmat, nmz_mode
--static proc doWriteNmzData(list #)
--{
--    string s;
--    int i,j;
--    link outf=":w "+ getNmzFile() +".in";  // also sets the filename
--
--    intmat sgr;
--    int num_rows, num_cols, n_mode;
--
--    for (int k=1; k+1<=size(#); k=k+2) {
--    //get data from the parameter list
--      sgr   = #[k];
--      num_rows = nrows(sgr);
--      num_cols = ncols(sgr);
--                n_mode   = #[k+1];
--
--      write(outf,num_rows);
--      write(outf,num_cols);
--
--      for(i=1;i<=nrows(sgr);i++)
--      {
--        s="";
--        for(j=1;j<=num_cols;j++)
--        {
--           s=s+string(sgr[i,j])+" ";
--        }
--        write(outf,s);
--      }
--      write(outf,n_mode);
--      write(outf,"");
--    }
--    close(outf);
--}
--
--
--proc writeNmzData(intmat sgr, int n_mode, list #)
--"USAGE:   writeNmzData(intmat M, int mode);
--          writeNmzData(intmat M, int mode, intmat M2, int mode2, ...);
--CREATE:   Creates an input file for Normaliz from the matrix M. The second
--          parameter sets the mode. How the matrix is interpreted depends on the
--          mode. See the Normaliz documentation for more information.
--
--                         It is also possible to give more than one pair of matrix and mode. In
--                         this case all matrices and modes are written. This can be used to
--                         combine modes 4,5,6.
--NOTE:     Needs an explicit filename set. The filename is created from the
--          current filename.
--   @*     Note that all functions in normaliz.lib write and read their data
--          automatically to and from the hard disk so that writeNmzData will
--          hardly ever be used explicitly.
--SEE ALSO: readNmzData, rmNmzFiles, setNmzFilename, setNmzDataPath
--EXAMPLE:  example writeNmzData; shows an example"
--{
--    if(queryString("nmz_filename")=="")
--    {
--        ERROR("writeNmzData: no filename specified");
--    }
--    doWriteNmzData(list(sgr, n_mode) + #);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  setNmzFilename("VeryInteresting");
--  intmat sgr[3][3]=1,2,3,4,5,6,7,8,10;
--  writeNmzData(sgr,1);
--  int dummy=system("sh","cat VeryInteresting.in");
--
--  intmat Hyperplanes[2][3] = 2,-1,0, // 2x-y >= 0
--                             1, 1,0; //  x+y >= 0
--  intmat Equation[1][3] = 0,1,-1;    // y = z
--  intmat Congruence[1][4] = 1,0,0,3;  // x = 0 (3)
--  writeNmzData(Hyperplanes,4,Equation,5,Congruence,6);
--  dummy=system("sh","cat VeryInteresting.in");
--}
--
--
--proc readNmzData(string nmz_suffix)
--"USAGE:  readNmzData(string suffix);
--RETURN:  Reads an output file of Normaliz containing an integer matrix and
--         returns it as an intmat. For example, this function is useful if one
--         wants to inspect the support hyperplanes. The filename is created
--         from the current  filename and the suffix given to the function.
--NOTE:    Needs an explicit filename set by setNmzFilename.
--   @*    Note that all functions in normaliz.lib write and read their data
--         automatically so that readNmzData will usually not be used explicitly.
--   @*    This function reads only the first matrix in a file!
--SEE ALSO: writeNmzData, rmNmzFiles, setNmzFilename, setNmzDataPath
--EXAMPLE:  example readNmzData; shows an example"
--{
--    if(queryString("nmz_filename")=="")
--    {
--        ERROR("readNmzData: no filename specified");
--    }
--
--    string s;
--    int n_rows,n_cols;            //number of rows/columns
--    int p;                     //position
--    int i,j;
--    int returnvalue;
--
--    string filename = getNmzFile() + "."+ nmz_suffix;
--    link in_f=":r "+ filename;
--    s=read(in_f);
--    close(in_f);
--
--    p=1;
--    (n_rows,p)=getInt(s,p);
--    (n_cols,p)=getInt(s,p);
--    if (n_rows <= 0 || n_cols <= 0) {
--             intmat empty;
--             return(empty);
--    }
--         intmat nmz_gen[n_rows][n_cols];
--    for(i=1;i<=n_rows;i++)
--    {
--        for(j=1;j<=n_cols;j++)
--        {
--            (nmz_gen[i,j],p) = getInt(s,p);
--        }
--    }
--    return(nmz_gen);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  setNmzFilename("VeryInteresting");
--  intmat sgr[3][3]=1,2,3,4,5,6,7,8,10;
--  intmat sgrnormal=normaliz(sgr,0);
--  readNmzData("cst");
--  readNmzData("typ");
--}
--
--
--// running normaliz (with options)
--
--// component 1 is name of option
--// 2 is default value
--// 3 is command line option to be passed to Normaliz
--// 4 indictes whether file "gen" is generated
--// value 2 of 4 indicates "no influence"
--
--static proc defNmzOptions()
--{
--    if(!defined(nmz_options)) // can be defined only once
--    {
--        list nmz_options=
--        list("supp",0,"-s",0),
--        list("triang",0,"-v",0),
--        list("volume",0,"-V",0),
--        list("hvect",0,"-p",0),
--        list("hvect_l",0,"-P",0),
--        list("height1",0,"-1",0),
--        list("normal",0,"-n",1),
--        list("normal_l",0,"-N",1),
--        list("hilb",0,"-h",1),
--        list("hilb_l",0,"-H",1),
--        list("dual",0,"-d",1),
--        list("control",0,"-c",2),
--        list("allf",0,"-a",2),
--        list("errorcheck",0,"-e",2),
--        list("bigint",0,"-B",2),
--        list("threads",0,"-x=",2);
--        export(nmz_options);
--    }
--}
--
--proc setNmzOption(string s, int onoff)
--"USAGE:   setNmzOption(string s, int onoff);
--PURPOSE:  If @code{onoff=1} the option @code{s} is activated, and
--          if @code{onoff=0} it is deactivated.
--The Normaliz options are accessible via the following names:
--@* @code{-s:  supp}
--@* @code{-v:  triang}
--@* @code{-V:  volume}
--@* @code{-p:  hvect}
--@* @code{-P:  hvect_l}
--@* @code{-1:  height1}
--@* @code{-n:  normal}
--@* @code{-N:  normal_l}
--@* @code{-h:  hilb}
--@* @code{-H:  hilb_l}
--@* @code{-d:  dual}
--@* @code{-a:  allf}
--@* @code{-c:  control}
--@* @code{-e:  errorcheck}
--@* @code{-B:  bigint} Use GMP for arbitrary precision integers
--@* @code{-x=N:  threads} In this case the int parameter is used to set the
--                         number of threads N, 0 means no explicit limiting.
--
--SEE ALSO: showNmzOptions
--EXAMPLE:  example setNmzOption; shows an example
--"
--{
--    defNmzOptions();
--    for(int i=1;i<=size(nmz_options);i++)
--    {
--        if(s==nmz_options[i][1])
--        {
--            nmz_options[i][2]=onoff;
--            return(1);
--        }
--    }
--    "Invalid option ", s;
--    return(0);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  setNmzOption("hilb",1);
--  showNmzOptions();
--}
--
--static proc collectNmzOptions()
--{
--    defNmzOptions();
--    string run_options=" -f ";
--    desInt("GenGen",1); // indicates whether "gen" is generated
--    for(int i=1;i<=size(nmz_options);i++)
--    {
--        if(nmz_options[i][2])
--        {
--            run_options=run_options+nmz_options[i][3];
--                                if (nmz_options[i][1]=="threads") {
--                                        run_options=run_options+string(nmz_options[i][2]);
--                                }
--                                run_options=run_options+" ";
--            if(nmz_options[i][4]!=2)
--            {
--                GenGen=nmz_options[i][4];
--            }
--        }
--    }
--    return(run_options+" ");
--}
--
--proc showNmzOptions()
--"USAGE:   showNmzOptions();
--RETURN:   Returns the string of activated options.
--NOTE:     This string is used as parameter when calling Normaliz.
--SEE ALSO: setNmzOption
--EXAMPLE:  example showNmzOption; shows an example
--"
--{
--    return(collectNmzOptions());
--}
--example
--{ "EXAMPLE:"; echo=2;
--  setNmzOption("hilb",1);
--  showNmzOptions();
--}
--
--
--static proc runNormaliz(intmat sgr,def nmz_mode, list #)
--{
--    if(!queryInt("nmz_files_keep_switch"))
--    {
--        makeTempNmzDataPath();
--    }
--
--    doWriteNmzData(list(sgr, nmz_mode) + #);
--
--    if(queryInt("nmz_files_keep_switch"))
--    {
--       int dummy=system("sh",setNmzExec()+ collectNmzOptions() + getNmzFile());
--    }
--    else
--    {
--        string gotodir="/tmp";
--        string fname=getNmzFile();
--        fname=fname[6..size(fname)];
--        string exec="cd "+gotodir+" ; ";
--        exec=exec+setNmzExec()+ collectNmzOptions()+" ";
--        exec=exec+fname+" ;";
--        int dummy=system("sh",exec);
--    }
--
--    if(!GenGen) // return input matrix if "gen" has not been generated
--    {
--        if(!queryInt("nmz_files_keep_switch"))
--        {
--            eraseTempNmzDataPath();
--        }
--        return(sgr);
--    }
--    intmat Gen=readNmzData("gen");
--
--    if(!defined(Num_Invs))
--    {
--        list Num_Invs;
--        export Num_Invs;
--    }
--    Num_Invs=getNuminvs();
--
--    if(!queryInt("nmz_files_keep_switch"))
--    {
--        eraseTempNmzDataPath();
--    }
--
--    return(Gen);
--
--}
--
--proc normaliz(intmat sgr,int nmz_mode, list #)
--"USAGE:   normaliz(intmat sgr,int nmz_mode);
--          normaliz(intmat sgr, int nmz_mode, intmat sgr2, int nmz_mode2, ...);
--RETURN:   The function applies Normaliz to the parameter sgr in the mode set
--          by nmz_mode. The function returns the intmat defined by the file
--          with suffix gen.
--
--          It is also possible to give more than one pair of matrix and mode. In
--                         this case all matrices and modes are used. This can be used to
--                         combine modes 4,5,6.
--NOTE:     You will find procedures for many applications of Normaliz in this
--          library, so the explicit call of this procedure may not be necessary.
--SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal,
--          torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings,
--                         intersectionValRingIdeals
--EXAMPLE:  example normaliz; shows an example
--"
--{
--    return(runNormaliz(sgr,nmz_mode,#));
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z),dp;
--  intmat M[3][2]=3,1,
--                 3,2,
--                 1,3;
--  normaliz(M,1);
--
--  intmat Hyperplanes[2][3] = 2,-1,0, // 2x-y >= 0
--                             1, 1,0; //  x+y >= 0
--  intmat Equation[1][3] = 0,1,-1;    // y = z
--  intmat Congruence[1][4] = 1,0,0,3;  // x = 0 (3)
--  normaliz(Hyperplanes,4,Equation,5,Congruence,6);
--}
--
--
--// retrieving normaliz numerical invariants
--
--static proc getNuminvs()
--{
--    string s;
--    list num_invs;
--    int p,sw,v_length,i,dummy_int;
--    intvec dummy_vec;
--    string type_inv,name_inv,dummy_bool;
--
--    link in_f=":r "+ getNmzFile() + "."+"inv";
--    s=read(in_f);
--
--    p=1;
--    while(p<size(s))
--    {
--        (sw,p)=nextWord(s,p);
--        if(sw==-1)
--        {
--            break;
--        }
--        type_inv=s[sw..p-1];
--        if(type_inv=="vector")
--        {
--            (v_length,p)=getInt(s,p);
--            (sw,p)=nextWord(s,p);
--            name_inv=s[sw..p-1];
--            if(name_inv=="h-vector")
--            {
--                name_inv="h_vector";
--            }
--            if(name_inv!="hilbert_polynomial")
--            {
--                for(i=1;i<=v_length;i++)
--                {
--                    if(i==1)
--                    {
--                        (dummy_int,p)=getInt(s,p);
--                        dummy_vec=dummy_int;
--                    }
--                    else
--                    {
--                        (dummy_int,p)=getInt(s,p);
--                        dummy_vec=dummy_vec,dummy_int;
--                    }
--                }
--                num_invs=num_invs+list(list(name_inv,dummy_vec,"intvec"));
--            }
--            else
--            {
--                p=skipEqualsign(s,p);
--            }
--        }
--        if(type_inv=="integer")
--        {
--            (sw,p)=nextWord(s,p);
--            name_inv=s[sw..p-1];
--            (dummy_int,p)=getInt(s,p);
--            num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
--        }
--        if(type_inv=="boolean")
--        {
--            (sw,p)=nextWord(s,p);
--            name_inv=s[sw..p-1];
--            p=skipEqualsign(s,p);
--            (sw,p)=nextWord(s,p);
--            dummy_bool=s[sw..p-1];
--            dummy_int=0;
--            if(dummy_bool=="true")
--            {
--                dummy_int=1;
--            }
--            num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
--        }
--    }
--    return(num_invs);
--}
--
--proc showNuminvs()
--"USAGE:   showNuminvs();
--PURPOSE:  prints the numerical invariants
--SEE ALSO: exportNuminvs
--EXAMPLE:  example showNuminvs(); shows an example
--"
--{
--    list dummy;
--    int i;
--    for(i=1;i<=size(Num_Invs);i++)
--    {
--        dummy=Num_Invs[i];
--        dummy[1],":", dummy[2];
--    }
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z,t),dp;
--  ideal I=x^2,y^2,z^3;
--  list l=intclMonIdeal(I);
--  showNuminvs();
--}
--
--
--proc exportNuminvs()
--"USAGE:   exportNuminvs();
--CREATE:   Creates top-level variables which contain the numerical invariants.
--          Depending on the options of normaliz different invariants are
--          calculated. Use showNuminvs (@ref{showNuminvs}) to see which
--          invariants are available.
--SEE ALSO: showNuminvs
--EXAMPLE:  example exportNuminvs; shows an example
--"
--{
--    list dummy;
--    int i;
--    string s;
--    for(i=1;i<=size(Num_Invs);i++)
--    {
--        dummy=Num_Invs[i];
--        s=dummy[3]+" nmz_" + dummy[1] + "=dummy[2]; exportto(Top," + "nmz_" + dummy[1] + ");";
--        execute(s);
--    }
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z,t),dp;
--  ideal I=x^2,y^2,z^3;
--  list l=intclMonIdeal(I);
--  exportNuminvs();
--  // now the following variables are set:
--  nmz_hilbert_basis_elements;
--  nmz_number_extreme_rays;
--  nmz_rank;
--  nmz_index;
--  nmz_number_support_hyperplanes;
--  nmz_homogeneous;
--  nmz_primary;
--  nmz_ideal_multiplicity;
--}
--
--
--// intmats to/from monomials
--
--proc mons2intmat(ideal I)
--"USAGE:   mons2intmat(ideal I);
--RETURN:   Returns the intmat whose rows represent the leading exponents of the
--          (non-zero) elements of I. The length of each row is nvars(basering).
--SEE ALSO: intmat2mons
--EXAMPLE:  example mons2intmat; shows an example"
--{
--    int i,j,k;
--    intmat expo_vecs[size(I)][nvars(basering)];
--    intvec expo_v;
--
--    k=0;
--    for(i=1;i<=ncols(I);i++)
--    {
--        if(I[i]!=0)
--        {
--            k++;
--            expo_v=leadexp(I[i]);
--            for(j=1;j<=nvars(basering);j++)
--            {
--                expo_vecs[k,j]=expo_v[j];
--            }
--        }
--    }
--    return(expo_vecs);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z),dp;
--  ideal I=x2,y2,x2yz3;
--  mons2intmat(I);
--}
--
--proc intmat2mons(intmat expo_vecs)
--"USAGE:   intmat2mons(intmat M);
--RETURN:   an ideal generated by the monomials which correspond to the exponent
--          vectors given by the rows of @code{M}
--NOTE:     The number of variables in the basering @code{nvars(basering)} has to
--          be at least the number of columns @code{ncols(M)}, otherwise the
--          function exits with an error.
--          is thrown (see @ref{ERROR}).
--SEE ALSO: mons2intmat
--EXAMPLE:  example intmat2mons; shows an example
--"
--{
--    int i,j;
--    poly m;
--    ideal mons;
--
--    if(nvars(basering)<ncols(expo_vecs))
--    {
--        ERROR("intmat2mons: not enough variables in ring");
--    }
--
--    for(i=1;i<=nrows(expo_vecs);i++)
--    {
--        m=1;
--        for(j=1;j<=ncols(expo_vecs);j++)
--        {
--            m=m*var(j)^expo_vecs[i,j];
--        }
--        mons=mons,m;
--    }
--     mons=simplify(mons,2);    // get rid of starting 0
--     return(mons);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z),dp;
--  intmat expo_vecs[3][3] =
--  2,0,0,
--  0,2,0,
--  2,1,3;
--  intmat2mons(expo_vecs);
--}
--
--static proc intmat2monsSel(intmat expo_vecs, int d)
--{
--    int i,j;
--    poly m;
--    ideal mons;
--
--    if(nvars(basering)<ncols(expo_vecs)-1)
--    {
--        ERROR("intmat2monsSel: not enough variables in ring");
--    }
--
--    for(i=1;i<=nrows(expo_vecs);i++)
--    {
--        if(expo_vecs[i,ncols(expo_vecs)]==d)
--        {
--
--            m=1;
--            for(j=1;j<=ncols(expo_vecs)-1;j++)
--            {
--                m=m*var(j)^expo_vecs[i,j];
--            }
--            mons=mons,m;
--        }
--    }
--     mons=simplify(mons,2);    // get rid of starting 0
--     return(mons);
--}
--
--
--proc binomials2intmat(ideal I)
--"USAGE:   binomials2intmat(ideal I);
--RETURN:   Returns the intmat whose rows represent the exponents of the
--          (non-zero) elements of I which have to be binomials.
--                         The length of each row is nvars(basering).
--SEE ALSO: mons2intmat, intmat2mons
--EXAMPLE:  example binomials2intmat; shows an example"
--{
--  int i,j,k;
--  intmat expo_vecs[size(I)][nvars(basering)];
--  intvec expo_v;
--
--  k=0;
--  poly f;
--
--  for(i=1; i<=ncols(I); i++)
--  {
--    if( I[i] != 0 )
--    {
--      k++;
--      f = I[i];
--      if (leadcoef(f) != 1) {f = -f};  //works in all characteristics
--      if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1)
--      {
--        ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i]));
--      }
--      expo_v = leadexp(f)-leadexp(f[2]);
--      for(j=1;j<=nvars(basering);j++)
--      {
--        expo_vecs[k,j]=expo_v[j];
--      }
--    }
--  }
--  return(expo_vecs);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring S = 37,(u,v,w,x,y,z),dp;
--  ideal I = u2v-xyz, ux2-vyz, uvw-y2z;
--  binomials2intmat(I);
--}
--
--
--// integral closure of rings and ideals
--
--static proc runIntclToricRing(ideal I, int nmz_mode)
--{
--    intmat expo_vecs=mons2intmat(I);
--
--    string dummy=collectNmzOptions(); // only to set GenGen
--
--    return( intmat2mons( runNormaliz(expo_vecs,nmz_mode) ) );
--}
--
--proc intclToricRing(ideal I)
--"USAGE:   intclToricRing(ideal I);
--RETURN:   The toric ring S is the subalgebra of the basering generated by the
--          leading monomials of the elements of I. The function computes the
--          integral closure T of S in the basering and returns an ideal listing
--          the algebra generators of T over the coefficient field.
--@*        The function returns the input ideal I if one of the options
--          @code{supp}, @code{triang}, or @code{hvect} has been activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
--NOTE:     A mathematical remark: the toric ring depends on the list of
--          monomials given, and not only on the ideal they generate!
--SEE ALSO:  normalToricRing, ehrhartRing, intclMonIdeal
--EXAMPLE:   example intclToricRing; shows an example
--"
--{
--    return(runIntclToricRing(I,0));
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=37,(x,y,t),dp;
--  ideal I=x3,x2y,y3;
--  intclToricRing(I);
--}
--
--proc normalToricRing(ideal I)
--"USAGE:   normalToricRing(ideal I);
--RETURN:   The toric ring S is the subalgebra of the basering generated by the
--          leading monomials of the elements of I. The function computes the
--          normalisation T of S and returns an ideal listing the algebra
--          generators of T over the coefficient field.
--@*        The function returns the input ideal I if one of the options
--          @code{supp}, @code{triang}, or @code{hvect} has been activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
--NOTE:     A mathematical remark: the toric ring depends on the list of
--          monomials given, and not only on the ideal they generate!
--SEE ALSO: intclToricRing, ehrhartRing, intclMonIdeal, normalToricRingFromBinomials
--EXAMPLE:  example normalToricRing; shows an example
--"
--{
--    return(runIntclToricRing(I,1));
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring  R = 37,(x,y,t),dp;
--  ideal I = x3,x2y,y3;
--  normalToricRing(I);
--}
--
--
--proc normalToricRingFromBinomials(ideal I)
--"USAGE:   normalToricRingFromBinomials(ideal I);
--RETURN:
-- at tex
--The ideal $I$ is generated by binomials of type $X^a-X^b$ (multiindex notation)
--in the surrounding polynomial ring $K[X]=K[X_1,...,X_n]$. The binomials
--represent a congruence on the monoid ${Z}^n$ with residue monoid $M$.
--Let $N$ be the image of $M$ in gp($M$)/torsion. Then $N$ is universal in the
--sense that every homomorphism from $M$ to an affine monoid factors through $N$.
--If $I$ is a prime ideal, then $K[N]= K[X]/I$. In general, $K[N]=K[X]/P$ where
--$P$ is the unique minimal prime ideal of $I$ generated by binomials of type
--$X^a-X^b$.
--
--The function computes the normalization of $K[N]$ and returns a newly created
--polynomial ring of the same Krull dimension, whose variables are
--$x(1),...,x(n-r)$, where $r$ is the rank of the matrix with rows $a-b$.
--(In general there is no canonical choice for such an embedding.)
--Inside this polynomial ring there is an ideal $I$ which lists the algebra
--generators of the normalization of $K[N]$.
-- at end tex
--@*        The function returns the input ideal I if one of the options
--          @code{supp}, @code{triang}, or @code{hvect} has been activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular.
--SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal
--EXAMPLE:  example normalToricRing; shows an example
--"
--{
--        intmat expo_vecs = binomials2intmat(I);
--        string dummy=collectNmzOptions(); // only to set GenGen
--        intmat result = runNormaliz(expo_vecs,10);
--
--        list baseringlist = ringlist(basering);
--        ring S = (baseringlist[1]),(x(1..ncols(result))),dp;
--        ideal I = intmat2mons(result);
--        export(I);
--        return (S);
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R = 37,(u,v,w,x,y,z),dp;
--  ideal I = u2v-xyz, ux2-wyz, uvw-y2z;
--  def S = normalToricRingFromBinomials(I);
--  setring S;
--  I;
--}
--
--static proc runIntclMonIdeal(ideal I, int nmz_mode)
--{
--    intmat expo_vecs=mons2intmat(I);
--    int i,last_comp;
--
--    // we test if there is room for the Rees algebra
--
--    for(i=1;i<=nrows(expo_vecs);i++)
--    {
--        if(expo_vecs[i,ncols(expo_vecs)]!=0)
--        {
--            last_comp=1;  break; // no
--        }
--    }
--
--    string dummy=collectNmzOptions(); // only to set GenGen
--
--    //adjust size of input matrix
--         if (!last_comp) { // remove last component
--             intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1] = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)];
--                  expo_vecs = tmp;
--         }
--    intmat nmz_data=runNormaliz(expo_vecs,nmz_mode);
--
--    if(last_comp)
--    {
--        ideal I1=intmat2monsSel(nmz_data,1);
--        return(list(I1));
--    }
--    else
--    {
--        ideal I1=intmat2monsSel(nmz_data,1);
--        ideal I2=intmat2mons(nmz_data);
--        return(list(I1,I2));
--    }
--}
--
--proc ehrhartRing(ideal I)
--"USAGE:    ehrhartRing(ideal I);
--RETURN:    The exponent vectors of the leading monomials of the elements of I
--           are considered as vertices of a lattice polytope P.
--           The Ehrhart ring of a (lattice) polytope P is the monoid algebra
--           defined by the monoid of lattice points in the cone over the
--           polytope P; see Bruns and Gubeladze, Polytopes, Rings, and K-theory,
--           Springer 2009, pp. 228, 229.
--           The function returns a list of ideals:
--@*         (i) If the last ring variable is not used by the monomials, it is
--               treated as the auxiliary variable of the Ehrhart ring. The
--               function returns two ideals, the first containing the monomials
--               representing the lattice points of the polytope, the second
--               containing the algebra generators of the Ehrhart ring over the
--                    coefficient field.
--@*         (ii) If the last ring variable is used by the monomials, the list
--                returned contains only one ideal, namely the monomials
--                representing the lattice points of the polytope.
--@*
--@*        The function returns the a list containing the input ideal I if one
--          of the options @code{supp}, @code{triang}, or @code{hvect} has been
--                         activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular.
--NOTE:      A mathematical remark: the Ehrhart ring depends on the list of
--           monomials given, and not only on the ideal they generate!
--SEE ALSO: intclToricRing, normalToricRing, intclMonIdeal
--EXAMPLE:  example ehrhartRing; shows an example
--"
--{
--    return(runIntclMonIdeal(I,2));
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=37,(x,y,t),dp;
--  ideal J=x3,x2y,y3,xy2t7;
--  ehrhartRing(J);
--}
--
--proc intclMonIdeal(ideal I)
--"USAGE:   intclMonIdeal(ideal I);
--RETURN:   The exponent vectors of the leading monomials of the elements of I
--          are considered as generators of a monomial ideal for which the
--          normalization of its Rees algebra is computed. For a Definiton of the
--          Rees algebra (or Rees ring) see Bruns and Herzog, Cohen-Macaulay
--          rings, Cambridge University Press 1998, p. 182.
--          The function returns a list of ideals:
--@* (i) If the last ring variable is not used by the monomials, it is treated
--       as the auxiliary variable of the Rees algebra. The function returns two
--       ideals, the first containing the monomials generating the integral
--       closure of the monomial ideal, the second containing the algebra
--         generators of the normalization of the Rees algebra.
--@* (ii) If the last ring variable is used by the monomials, the list returned
--        contains only one ideal, namely the monomials generating the integral
--        closure of the ideal.
--@*        The function returns the a list containing the input ideal I if one
--          of the options @code{supp}, @code{triang}, or @code{hvect} has been
--                         activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
--SEE ALSO: intclToricRing, normalToricRing, ehrhartRing
--EXAMPLE:  example intclMonIdeal; shows an example
--"
--{
--    return(runIntclMonIdeal(I,3));
--}
--example
--{ "EXAMPLE"; echo=2;
--    ring R=0,(x,y,z,t),dp;
--    ideal I=x^2,y^2,z^3;
--    list l=intclMonIdeal(I);
--    l[1]; // integral closure of I
--    l[2];  // monomials generating the integral closure of the Rees algebra
--}
--
--// torus invariants and valuation rings and ideals
--
--proc torusInvariants(intmat E)
--"USAGE:   torusInvariants(intmat A);
--RETURN:
--Returns an ideal representing the list of monomials generating the ring of
--invariants as an algebra over the coefficient field.
-- at tex
--$R^T$.
-- at end tex
--@*The function returns the ideal given by the input matrix A if one of
--the options @code{supp}, @code{triang}, or @code{hvect} has been
--activated.
--However, in this case some numerical invariants are computed, and
--some other data may be contained in files that you can read into
--Singular.
--BACKGROUND:
-- at tex
-- Let $T = (K^*)^r$ be the $r$-dimensional torus acting on the polynomial ring
-- $R = K[X_1 ,\ldots,X_n]$ diagonally. Such an action can be described as
-- follows: there are integers $a_{i,j}$, $i=1,\ldots,r$, $j=1,\ldots,n$, such
-- that $(\lambda_1,\ldots,\lambda_r)\in T$ acts by the substitution
--$$ X_j \mapsto \lambda_1^{a_{1,j}} \cdots \lambda_r^{a_{r,j}}X_j,
--   \quad j=1,\ldots,n.$$
--In order to compute the ring of invariants $R^T$ one must specify the matrix
--$A=(a_{i,j})$.
-- at end tex
--SEE ALSO: diagInvariants, finiteDiagInvariants, intersectionValRings,
--          intersectionValRingIdeals
--EXAMPLE:  example torusInvariants; shows an example
--"
--{
--    if(nvars(basering)!=ncols(E))
--    {
--        ERROR("torusInvariants: wrong number of columns in matrix");
--    }
--
--    string dummy=collectNmzOptions();  // only to set GenGen
--
--    return( intmat2mons( runNormaliz(E,5) ) );
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z,w),dp;
--  intmat E[2][4] = -1,-1,2,0, 1,1,-2,-1;
--  torusInvariants(E);
--}
--
--proc finiteDiagInvariants(intmat C)
--"USAGE:   finiteDiagInvariants(intmat U);
--RETURN:
-- at tex
--This function computes the ring of invariants of a finite abelian group $G$
--acting diagonally on the surrounding polynomial ring $K[X_1,...,X_n]$. The
--group is the direct product of cyclic groups generated by finitely many
--elements $g_1,...,g_w$. The element $g_i$ acts on the indeterminate $X_j$ by
--$g_i(X_j)=\lambda_i^{u_{ij}}X_j$ where $\lambda_i$ is a primitive root of
--unity of order equal to $ord(g_i)$. The ring of invariants is generated by all
--monomials satisfying the system
--$u_{i1}a_1+\ldots+u_{in} a_n \equiv 0$ mod ord$(g_i)$, $i=1,\ldots,w$.
--The input to the function is the $w\times(n+1)$ matrix $U$ with rows
--$u_{i1}\ldots u_{in}$ ord$(gi)$, $i=1,\ldots,w$. The output is a monomial ideal
--listing the algebra generators of the subalgebra of invariants
--{$R^G=\{f\in R : g_i f = f$ for all $i=1,\ldots,w\}$}.
-- at end tex
--@*The function returns the ideal given by the input matrix C if one of
--the options @code{supp}, @code{triang}, or @code{hvect} has been
--activated.
--However, in this case some numerical invariants are computed, and
--some other data may be contained in files that you can read into
--Singular.
--NOTE:
--SEE ALSO: torusInvariants, diagInvariants, intersectionValRings,
--          intersectionValRingIdeals,showNuminvs,exportNuminvs
--EXAMPLE:  example finiteDiagInvariants; shows an example
--"
--{
--    if(nvars(basering)!=ncols(C)-1)
--    {
--        ERROR("finiteDiagInvariants: wrong number of columns in matrix");
--    }
--
--    string dummy=collectNmzOptions();  // only to set GenGen
--
--    return( intmat2mons( runNormaliz(C,6) ) );
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R = 0,(x,y,z,w),dp;
--  intmat C[2][5] = 1,1,1,1,5, 1,0,2,0,7;
--  finiteDiagInvariants(C);
--}
--
--proc diagInvariants(intmat E, intmat C)
--"USAGE:   diagInvariants(intmat A, intmat U);
--RETURN:
-- at tex
--This function computes the ring of invariants of a diagonalizable group
--$D = T\times G$ where $T$ is a torus and $G$ is a finite abelian group, both
--acting diagonally on the polynomial ring $K[X_1,\ldots,X_n]$. The group
--actions are specified by the input matrices A and U. The first matrix specifies
--the torus action, the second the action of the finite group. See
--torusInvariants and finiteDiagInvariants for more detail. The output is a
--monomial ideal listing the algebra generators of the subalgebra of invariants.
-- at end tex
--@*The function returns the ideal given by the input matrix A if one of
--the options @code{supp}, @code{triang}, or @code{hvect} has been
--activated.
--However, in this case some numerical invariants are computed, and
--some other data may be contained in files that you can read into
--Singular.
--SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals,showNuminvs,exportNuminvs
--EXAMPLE:  example diagInvariants; shows an example
--"
--{
--    if(nvars(basering)!=ncols(E) || nvars(basering)!=ncols(C)-1)
--    {
--        ERROR("diagInvariants: wrong number of columns in matrix");
--    }
--
--    string dummy=collectNmzOptions();  // only to set GenGen
--
--    return( intmat2mons( runNormaliz(E,5,C,6) ) );
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z,w),dp;
--  intmat E[2][4] = -1,-1,2,0, 1,1,-2,-1;
--  intmat C[2][5] = 1,1,1,1,5, 1,0,2,0,7;
--  diagInvariants(E,C);
--}
--
--proc intersectionValRings(intmat V)
--"USAGE:   intersectionValRings(intmat V);
--RETURN:   The function returns a monomial ideal, to be considered as the list
--          of monomials generating @math{S} as an algebra over the coefficient
--          field.
--BACKGROUND:
-- at tex
--A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
--the values $v(X_j)$ of the indeterminates. This function computes the
--subalgebra $S = \{ f \in R : v_i ( f ) \geq 0,\ i = 1,\ldots,r\}$ for several
--such valuations $v_i$, $i=1,\ldots,r$. It needs the matrix $V = (v_i(X_j))$ as
--its input.
-- at end tex
--@*The function returns the ideal given by the input matrix V if one of
--the options @code{supp}, @code{triang}, or @code{hvect} has been
--activated.
--However, in this case some numerical invariants are computed, and
--some other data may be contained in files that you can read into
--Singular.
--SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals,showNuminvs,exportNuminvs
--EXAMPLE:  example intersectionValRings; shows an example
--"
--{
--
--    if(nvars(basering)!=ncols(V))
--    {
--        ERROR("intersectionValRings: wrong number of columns in matrix");
--    }
--
--    intmat V1[nrows(V)+ncols(V)][ncols(V)];
--    int i,j;
--
--    for(i=1;i<=ncols(V);i++)
--    {
--        V1[i,i]=1;
--    }
--    for(i=1;i<=nrows(V);i++)
--    {
--        for(j=1;j<=ncols(V);j++)
--        {
--            V1[i+ncols(V),j]=V[i,j];
--        }
--    }
--
--
--    string dummy=collectNmzOptions();  // only to set GenGen
--
--/*    if(!GenGen) // return V
--    {
--        runNormaliz(V1,4);
--        return(V);
--    }
--*/
--    return(intmat2mons(runNormaliz(V1,4)));
--}
--example
--{ "EXAMPLE:"; echo=2;
--  ring R=0,(x,y,z,w),dp;
--  intmat V0[2][4]=0,1,2,3, -1,1,2,1;
--  intersectionValRings(V0);
--}
--
--proc intersectionValRingIdeals(intmat V)
--"USAGE:   intersectionValRingIdeals(intmat V);
--RETURN:   The function returns two ideals, both to be considered as lists of
--          monomials which generate an algebra over the coefficient field. The
--          first is the system of monomial generators of @math{S}, the second
--          the system of generators of @math{M}.
--@*        The function returns a list consisting of the ideal given by the
--          input matrix T if one of the options @code{supp}, @code{triang}, or
--          @code{hvect} has been activated.
--          However, in this case some numerical invariants are computed, and
--          some other data may be contained in files that you can read into
--          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
--BACKGROUND:
-- at tex
--A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
--the values $v(X_j)$ of the indeterminates. This function computes the
--subalgebra $S = \{ f \in R : v_i ( f ) \geq 0,\ i = 1,\ldots,r\}$ for several
--such valuations $v_i$, $i=1,\ldots,r$. It needs the matrix $V = (v_i(X_j))$ as
--its input.
--
--This function simultaneously determines the $S$-submodule
--$M = \{ f \in R : v_i(f) \geq w_i ,\ i = 1,\ldots,r\}$ for integers
--$w_1,\ldots\,w_r$. (If $w_i \geq 0$ for all $i$, $M$ is an ideal of $S$.)
--The numbers $w_i$ form the $(n+1)$th column of the input matrix.
-- at end tex
--NOTE:   The function also gives an error message if the matrix V has the
--        wrong number of columns.
--SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings
--EXAMPLE:  example intersectionValRingIdeals; shows an example
--"
--{
--    if(nvars(basering)!=ncols(V)-1)
--    {
--        ERROR("intersectionValRingIdeals: wrong number of columns in matrix");
--    }
--
--    intmat V1[nrows(V)+ncols(V)][ncols(V)];
--    int i,j;
--
--    for(i=1;i<=ncols(V);i++)
--    {
--        V1[i,i]=1;
--    }
--    for(i=1;i<=nrows(V);i++)
--    {
--        for(j=1;j<=ncols(V);j++)
--        {
--            V1[i+ncols(V),j]=V[i,j];
--        }
--    }
--    for(i=1;i<=nrows(V);i++)
--    {
--        V1[i+ncols(V),ncols(V)]=-V1[i+ncols(V),ncols(V)];
--    }
--
--    string dummy=collectNmzOptions();  // only to set GenGen
--
--    intmat nmz_data=runNormaliz(V1,4);
--
--    ideal I1=intmat2monsSel(nmz_data,0);
--    ideal I2=intmat2monsSel(nmz_data,1);
--    return(list(I1,I2));
--}
--example
--{ "EXAMPLE:"; echo=2;
-- ring R=0,(x,y,z,w),dp;
-- intmat V[2][5]=0,1,2,3,4, -1,1,2,1,3;
-- intersectionValRingIdeals(V);
--}
-+// Singular library normaliz.lib
-+
-+version="$Id$"
-+category="Commutative algebra"
-+info="
-+LIBRARY: normaliz.lib  Provides an interface for the use of Normaliz 2.8 or 2.9
-+         within SINGULAR.
-+AUTHORS: Winfried Bruns, Winfried.Bruns at Uni-Osnabrueck.de
-+         Christof Soeger, Christof.Soeger at Uni-Osnabrueck.de
-+
-+OVERVIEW:
-+ at texinfo
-+The library normaliz.lib provides an interface for the use of Normaliz 2.8 or
-+2.9 within SINGULAR. The exchange of data is via files.
-+In addition to the top level
-+functions that aim at objects of type ideal or ring, several other auxiliary
-+functions allow the user to apply Normaliz to data of type intmat. Therefore
-+SINGULAR can be used as a comfortable environment for the work with Normaliz.
-+@* Please see the @code{Normaliz2.9Documentation.pdf} (included in the Normaliz
-+distribution) for a more extensive documentation of Normaliz.
-+
-+@* Normaliz allows the use of a grading. In the Singular functions that access
-+Normaliz the parameter grading is an intvec that assigns a (not necessarily
-+positive) degree to every variable of the ambient polynomial ring.
-+But it must give positive degrees to the generators given to function.
-+
-+@*
-+@*Singular and Normaliz exchange data via files. These files are automatically
-+created and erased behind the scenes. As long as one wants to use only the
-+ring-theoretic functions there is no need for file management.
-+@*
-+@*Note that the numerical invariants computed by Normaliz can be
-+accessed in this \"automatic file mode\".
-+@*
-+@*However, if Singular is used as a frontend for Normaliz or the user
-+wants to inspect data not automatically returned to Singular, then
-+an explicit filename and a path can be specified for the exchange of
-+data. Moreover, the library provides functions for access to these files.
-+Deletion of the files is left to the user.
-+@*
-+@* Use of this library requires the program Normaliz to be installed.
-+You can download it from
-+ at uref{http://www.mathematik.uni-osnabrueck.de/normaliz/}. Please make sure
-+that the executables are in the search path or use setNmzExecPath
-+(@ref{setNmzExecPath}).
-+ at end texinfo
-+
-+
-+KEYWORDS: integral closure; normalization; toric ring
-+
-+PROCEDURES:
-+ intclToricRing(ideal I)      computes the integral closure of the toric ring
-+                              generated by the leading monomials of the
-+                              elements of I in the basering
-+ normalToricRing(ideal I)     computes the normalization of the toric ring
-+                              generated by the leading monomials of the
-+                              elements of I
-+ normalToricRingFromBinomials(ideal I)  computes the normalization of the
-+                              polynomial ring modulo the unique minimal binomial
-+                              prime ideal of the binomial ideal I
-+ ehrhartRing(ideal I)         considers the exponent vectors of the elements of I
-+                              as points of a lattice polytope and computes the
-+                              integral cloure of the polytopal algebra
-+ intclMonIdeal(ideal I)       Computes the integral closure of the Rees algebra
-+                              of the ideal generated by the leading monomials of
-+                              the elements of I
-+ torusInvariants(intmat T)    computes the ring of invariants of a torus action
-+ finiteDiagInvariants(intmat C)  computes the ring of invariants of a finite
-+                                 abelian group acting diagonally on a polynomial
-+                                 ring
-+ diagInvariants(intmat C)     computes the ring of invariants of a
-+                              diagonalizable group
-+ intersectionValRings(intmat V)   computes the intersection of the polynomial
-+                                  ring with the valuation rings of monomial
-+                                  valuations
-+ intersectionValRingIdeals(intmat V)       computes ideals of monomial valuations
-+
-+ showNuminvs()                prints the numerical invariants found by Normaliz
-+ exportNuminvs()              exports the numerical invariants found by Normaliz
-+
-+ setNmzOption(string s, int onoff) sets the option s to onoff
-+ showNmzOptions()             prints the enabled options to the standard output
-+
-+ normaliz(intmat sgr,int nmz_mode) applies Normaliz
-+ setNmzExecPath(string nmz_exec_path_name) sets the path to the Normaliz
-+                                           executable
-+
-+ writeNmzData(intmat sgr, int n_mode) creates an input file for Normaliz
-+ readNmzData(string nmz_suffix) reads the Normaliz output file with the
-+                                specified suffix
-+
-+ setNmzFilename(string nmz_filename_name) sets the filename for the exchange
-+                                          of data
-+ setNmzDataPath(string nmz_data_path_name) sets the directory for the exchange
-+                                           of data
-+ writeNmzPaths()              writes the path names into two files
-+ startNmz()                   retrieves the path names written by writeNmzPaths
-+ rmNmzFiles()                 removes the files created for and by Normaliz
-+
-+ mons2intmat(ideal I)         returns the intmat whose rows represent the
-+                              leading exponents of the elements of I
-+ intmat2mons(intmat expo_vecs) returns the ideal generated by the monomials
-+                               which have the rows of expo_vecs as
-+                               exponent vector
-+ binomials2intmat(ideal I)    returns the intmat whose rows represent the
-+                              exponents of the elements of the binomial ideal I
-+";
-+
-+
-+// helpers
-+
-+static proc desInt(string intname, int value)
-+// define, export and set an integer
-+{
-+    int exists;
-+    if(defined(`intname`)){exists=1;}
-+    if(!exists)
-+    {
-+        int `intname`=value;export(`intname`);
-+    }
-+    `intname`=value;
-+}
-+
-+static proc desString(string stringname, string value)
-+// define, export and set a string
-+{
-+    int exists;
-+    if(defined(`stringname`)){exists=1;}
-+    if(!exists)
-+    {
-+        string `stringname`=value;export(`stringname`);
-+    }
-+    `stringname`=value;
-+}
-+
-+static proc queryInt(string intname)
-+// if intname is defined, return(intname), else return(0)
-+{
-+    int exists,value;
-+    if(defined(`intname`)){exists=1;}
-+    if(!exists)
-+    {
-+        return(0);
-+    }
-+    return(`intname`);
-+}
-+
-+static proc queryString(string stringname)
-+// if stringname is defined, return(stringname), else return("")
-+{
-+    int exists;
-+    string value;
-+    if(defined(`stringname`)){exists=1;}
-+    if(!exists)
-+    {
-+        return("");
-+    }
-+    return(`stringname`);
-+}
-+
-+static proc fileExists(string f)
-+{
-+    return(status (f,"exists")=="yes");
-+}
-+
-+static proc appendSlash(string s)
-+// if nonempty and / is not the terminating char
-+{
-+    if(size(s)>0)
-+    {
-+        if(s[size(s)]!="/")
-+        {
-+            s=s+"/";
-+            return(s);
-+        }
-+    }
-+    return(s);
-+}
-+
-+// filenames and paths
-+
-+proc setNmzExecPath(string nmz_exec_path_name)
-+"USAGE:   setNmzExecPath(string s);   @code{s} path to the Normaliz executable
-+CREATE:   @code{Normaliz::nmz_exec_path} to save the given path @code{s}
-+NOTE:     It is not necessary to use this function if the Normaliz executable
-+          is in the search path of the system.
-+SEE ALSO: setNmzOption
-+EXAMPLE:  example setNmzExecPath; shows an example"
-+{
-+    desString("nmz_exec_path",nmz_exec_path_name);
-+    nmz_exec_path=appendSlash(nmz_exec_path);
-+}
-+example
-+{ "EXAMPLE:";echo = 2;
-+  setNmzExecPath("../Normaliz/");
-+}
-+
-+proc setNmzFilename(string nmz_filename_name)
-+"USAGE:   setNmzFilename(string s);
-+CREATE:   @code{Normaliz::nmz_filename} to save the given filename @code{s}
-+NOTE:     The function sets the filename for the exchange of data. Unless a
-+          path is set by setNmzDataPath, files will be created in the current
-+          directory.
-+          @* If a non-empty filename is set, the files created for and by
-+             Normaliz are kept. This is mandatory for the data access functions
-+             (see @ref{writeNmzData} and @ref{readNmzData}).
-+          @* Resetting the filename by setNmzFilename(\"\") forces the library
-+             to return to deletion of temporary files, but the files created
-+             while the filename had been set will not be erased.
-+SEE ALSO: writeNmzData, readNmzData, setNmzDataPath, rmNmzFiles
-+EXAMPLE:  example setNmzFilename; shows an example"
-+{
-+    desString("nmz_filename",nmz_filename_name);
-+    if(nmz_filename_name!="")
-+    {
-+        desInt("nmz_files_keep_switch",1);
-+    }
-+    else
-+    {
-+        desInt("nmz_files_keep_switch",0);
-+    }
-+}
-+example
-+{ "EXAMPLE:";echo = 2;
-+  setNmzDataPath("examples/");
-+  setNmzFilename("example1");
-+  //now the files for the exchange with Normaliz are examples/example1.SUFFIX
-+}
-+
-+proc setNmzDataPath(string nmz_data_path_name)
-+"USAGE:   setNmzDataPath(string s);
-+CREATE:   @code{Normaliz::nmz_data_path} to save the given path @code{s}
-+NOTE:     The function sets the path for the exchange of data. By default the
-+          files will be created in the current directory.
-+          @* It seems that Singular cannot use filenames starting with @code{~}
-+             or @code{$HOME} in its input/output functions.
-+          @* You must also avoid path names starting with @code{/} if you work
-+             under Cygwin, since Singular and Normaliz interpret them in
-+             different ways.
-+SEE ALSO: writeNmzData, readNmzData, rmNmzFiles, setNmzFilename
-+EXAMPLE:  example setNmzDataPath; shows an example"
-+{
-+    desString("nmz_data_path",nmz_data_path_name);
-+    nmz_data_path=appendSlash(nmz_data_path);
-+}
-+example
-+{ "EXAMPLE:";echo = 2;
-+  setNmzDataPath("examples/");
-+  setNmzFilename("example1");
-+  //now the files for the exchange with Normalize are examples/example1.SUFFIX
-+}
-+
-+proc writeNmzPaths();
-+"USAGE:   writeNmzPaths();
-+CREATE:   the file nmz_sing_exec.path where the path to the Normaliz executable
-+          is saved
-+          @* the file nmz_sing_data.path where the directory for the exchange
-+          of data is saved
-+NOTE:     Both files are saved in the current directory. If one of the names
-+          has not been defined, the corresponding file is created, but
-+          contains nothing.
-+SEE ALSO: setNmzDataPath, setNmzExecPath, startNmz
-+EXAMPLE:  example writeNmzPaths; shows an example
-+"{
-+    link outf=":w nmz_sing_exec.path";
-+    write(outf, queryString("nmz_exec_path"));
-+    close(outf);
-+
-+    outf=":w nmz_sing_data.path";
-+    write(outf, queryString("nmz_data_path"));
-+    close(outf);
-+}
-+example
-+{ "EXAMPLE:";echo = 2;
-+  setNmzExecPath("../Normaliz/");
-+  writeNmzPaths();
-+  int dummy=system("sh","cat nmz_sing_exec.path");
-+  dummy=system("sh","cat nmz_sing_data.path");
-+}
-+
-+proc startNmz()
-+"USAGE:   startNmz();
-+PURPOSE:  This function reads the files written by @code{writeNmzPaths()},
-+          retrieves the path names, and types them on the standard output
-+          (as far as they have been set). Thus, once the path names have been
-+          stored, a Normaliz session can simply be opened by this function.
-+SEE ALSO: setNmzDataPath, setNmzExecPath, writeNmzPaths
-+EXAMPLE:  example startNmz; shows an example
-+"
-+{
-+    link inf=":r nmz_sing_exec.path";
-+    string s=read(inf);
-+    int i,p;
-+    p=findWord("/",s,1);
-+    if(p!=-1)
-+    {
-+        for(i=size(s);i>=1;i--)
-+        {
-+            if(s[i]=="/")
-+            {
-+                s=s[1..i];
-+                break;
-+            }
-+        }
-+        desString("nmz_exec_path",s);
-+        "nmz_exec_path is",nmz_exec_path;
-+    }
-+    else
-+    {
-+        "nmz_exec_path not set";
-+    }
-+
-+    inf=":r nmz_sing_data.path";
-+    s=read(inf);
-+    p=findWord("/",s,1);
-+    if(p!=-1)
-+    {
-+        for(i=size(s);i>=1;i--)
-+        {
-+            if(s[i]=="/")
-+            {
-+                s=s[1..i];
-+                break;
-+            }
-+        }
-+        desString("nmz_data_path",s);
-+        "nmz_data_path is",nmz_data_path;
-+    }
-+    else
-+    {
-+        "nmz_data_path not set";
-+    }
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  startNmz();
-+}
-+
-+static proc getNmzFile()
-+{
-+    if(queryInt("nmz_files_keep_switch"))
-+    {
-+        return(queryString("nmz_data_path")+queryString("nmz_filename"));
-+    }
-+    else
-+    {
-+        return(queryString("nmz_filename"));
-+    }
-+}
-+
-+static proc makeTempNmzDataPath()
-+{
-+    string testdir, testdir1;
-+    int i,dummy;
-+
-+    testdir1="/tmp/nmz_sing_"+string(system("pid"));
-+    testdir=testdir1;
-+    while(fileExists(testdir))
-+    {
-+        i++;
-+        testdir=testdir1+string(i);
-+    }
-+    dummy=system("sh","mkdir "+ testdir);
-+    desString("nmz_filename",testdir+"/nmz"); //files are nmz+suffix in testdir
-+}
-+
-+static proc eraseTempNmzDataPath();
-+{
-+    int dummy;
-+
-+    string tmpdir=getNmzFile();
-+    tmpdir=tmpdir[1..size(tmpdir)-4]; // remove "/nmz"
-+    dummy=system("sh","rm -r "+tmpdir);
-+    setNmzFilename("");
-+}
-+
-+static proc setNmzExec()
-+{
-+    return(queryString("nmz_exec_path")+"normaliz");
-+}
-+
-+proc rmNmzFiles()
-+"USAGE:  rmNmzFiles();
-+PURPOSE: This function removes the files created for and by Normaliz, using
-+         the last filename specified.
-+         It needs an explicit filename set (see @ref{setNmzFilename}).
-+SEE ALSO: writeNmzData, readNmzData, setNmzFilename, setNmzDataPath
-+EXAMPLE:  example rmNmzFiles; shows an example
-+"{
-+
-+    if(!queryInt("nmz_files_keep_switch"))
-+    {
-+        ERROR("rmNmzFiles: no filename specified");
-+    }
-+
-+    list suffixes="in","gen","out","cst","typ","egn","esp","inv","tri","ht1",
-+                  "ext";
-+    int i,dummy;
-+    string f;
-+
-+    for(i=1;i<=size(suffixes);i++)
-+    {
-+        f=getNmzFile()+"."+suffixes[i];
-+        if (fileExists(f)) {
-+              dummy=system("sh","rm "+f+ "&> /dev/null");
-+        }
-+    }
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  setNmzFilename("VeryInteresting");
-+  rmNmzFiles();
-+}
-+
-+
-+
-+// parsing normaliz output
-+
-+static proc digit(string s)
-+{
-+    if(s==" ") // skip blanks quickly
-+    {
-+        return(0);
-+    }
-+
-+    if((s[1]>="0" && s[1]<="9")||s[1]=="-")
-+    {
-+        return(1);
-+    }
-+    return(0);
-+}
-+
-+static proc nextWord(string s, int p)
-+{
-+    int j,sw,ew;
-+
-+    for(;p<=size(s);p++) // must start with a letter
-+    {
-+
-+        if((s[p]>="a" && s[p]<="z")||
-+             (s[p]>="A" && s[p]<="Z"))
-+        {
-+            sw=p; break;
-+        }
-+    }
-+    if(p>size(s))
-+    {
-+        return(-1,-1); // no word found
-+    }
-+
-+    for(;p<=size(s);p++) // now numerals and -_ allowed
-+    {
-+        if(!((s[p]>="a" && s[p]<="z")||
-+             (s[p]>="A" && s[p]<="Z")||
-+             (s[p]>="0" && s[p]<="9")||
-+              s[p]=="_"||s[p]=="-"))
-+        {
-+            break;
-+        }
-+    }
-+    return(sw,p);
-+}
-+
-+static proc getInt(string s, int p)
-+{
-+    string nst;
-+    int i,j,en,sn;
-+
-+    for(;p<=size(s);p++)
-+    {
-+
-+        if(digit(s[p]))
-+        {
-+            sn=p; break;
-+        }
-+    }
-+    if(not(sn))
-+    {
-+        return(0,-1); // -1 indicates: no number found
-+    }
-+    p++;
-+    for(;p<=size(s);p++)
-+    {
-+        if(!digit(s[p]))
-+        {
-+            en=p-1; break;
-+        }
-+    }
-+    if(p>size(s))
-+    {
-+        en=size(s);
-+    }
-+    nst="i="+s[sn,en-sn+1];
-+    execute(nst);
-+    return(i,p);
-+}
-+
-+
-+static proc getRational(string s, int p)
-+{
-+    string nst;
-+    int i,j,en,sn;
-+
-+    for(;p<=size(s);p++)
-+    {
-+        if(digit(s[p]))
-+        {
-+            sn=p; break;
-+        }
-+    }
-+    if(not(sn))
-+    {
-+        return(0,-1); // -1 indicates: no number found
-+    }
-+    p++;
-+    int slash_at;
-+    for(;p<=size(s);p++)
-+    {
-+        if(s[p]=="/")
-+        {
-+            slash_at=p;
-+            p++;
-+            continue;
-+        }
-+        if(!digit(s[p]))
-+        {
-+            en=p-1; break;
-+        }
-+    }
-+    if(p>size(s))
-+    {
-+        en=size(s);
-+    }
-+    if(slash_at)
-+    {
-+        nst="i="+s[sn,slash_at-sn];
-+        execute(nst);
-+        nst="j="+s[slash_at+1,en-slash_at];
-+        execute(nst);
-+        return(i,p,j);
-+    }
-+    nst="i="+s[sn,en-sn+1];
-+    execute(nst);
-+    return(i,p);
-+}
-+
-+
-+static proc findWord(string s, string t, int p)
-+{
-+    for(;p<=size(t)-size(s)+1;p++)
-+    {
-+        if(t[p]==s[1])
-+        {
-+            if(t[p,size(s)]==s)
-+            {
-+                 return(p+size(s));
-+            }
-+        }
-+    }
-+    return(-1);
-+}
-+
-+
-+static proc skipEqualsign(string s,int p)
-+{
-+    for(;p<=size(s);p++)
-+    {
-+        if(s[p]=="=")
-+        {
-+            break;
-+        }
-+    }
-+    return(p+1);
-+}
-+
-+
-+// input and output to/from normaliz
-+
-+//list must have pairs of intmat, nmz_mode
-+static proc doWriteNmzData(list #)
-+{
-+    string s;
-+    int i,j;
-+    link outf=":w "+ getNmzFile() +".in";  // also sets the filename
-+
-+    intmat sgr;
-+    int num_rows, num_cols, n_mode;
-+
-+    for (int k=1; k+1<=size(#); k=k+2) {
-+      //get data from the parameter list
-+      n_mode   = #[k+1];
-+      if (n_mode != -1) { //skip -1 mode
-+        sgr   = #[k];
-+        num_rows = nrows(sgr);
-+        num_cols = ncols(sgr);
-+
-+        write(outf,num_rows);
-+        write(outf,num_cols);
-+
-+        for(i=1;i<=nrows(sgr);i++)
-+        {
-+          s="";
-+          for(j=1;j<=num_cols;j++)
-+          {
-+             s=s+string(sgr[i,j])+" ";
-+          }
-+          write(outf,s);
-+        }
-+        if (n_mode == 20) {
-+          write(outf,"grading");
-+        } else {
-+          write(outf,n_mode);
-+        }
-+        write(outf,"");
-+      }
-+    }
-+    close(outf);
-+}
-+
-+
-+static proc prepareGrading(list #)
-+{
-+    if (size(#)==0) {
-+        return(0,-1); // mode -1 specifies discard the matrix
-+    }
-+    if (size(#)>1) {
-+        print(#);
-+        ERROR("To many parameters!");
-+    }
-+    intmat g = intmat(#[1],1,size(#[1]));
-+    return (g,20);
-+}
-+
-+
-+proc writeNmzData(intmat sgr, int n_mode, list #)
-+"USAGE:   writeNmzData(intmat M, int mode);
-+          writeNmzData(intmat M, int mode, intmat M2, int mode2, ...);
-+CREATE:   Creates an input file for Normaliz from the matrix M. The second
-+          parameter sets the mode. How the matrix is interpreted depends on the
-+          mode. See the Normaliz documentation for more information.
-+
-+          It is also possible to give more than one pair of matrix and mode. In
-+          this case all matrices and modes are written. This can be used to
-+          combine modes 4,5,6.
-+          Use mode=20 to specify a grading.
-+NOTE:     Needs an explicit filename set. The filename is created from the
-+          current filename.
-+   @*     Note that all functions in normaliz.lib write and read their data
-+          automatically to and from the hard disk so that writeNmzData will
-+          hardly ever be used explicitly.
-+SEE ALSO: readNmzData, rmNmzFiles, setNmzFilename, setNmzDataPath
-+EXAMPLE:  example writeNmzData; shows an example"
-+{
-+    if(queryString("nmz_filename")=="")
-+    {
-+        ERROR("writeNmzData: no filename specified");
-+    }
-+    doWriteNmzData(list(sgr, n_mode) + #);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  setNmzFilename("VeryInteresting");
-+  intmat sgr[3][3]=1,2,3,4,5,6,7,8,10;
-+  writeNmzData(sgr,1);
-+  int dummy=system("sh","cat VeryInteresting.in");
-+
-+  intmat Hyperplanes[2][3] = 2,-1,0, // 2x-y >= 0
-+                             1, 1,0; //  x+y >= 0
-+  intmat Equation[1][3] = 0,1,-1;    // y = z
-+  intmat Congruence[1][4] = 1,0,0,3;  // x = 0 (3)
-+  writeNmzData(Hyperplanes,4,Equation,5,Congruence,6);
-+  dummy=system("sh","cat VeryInteresting.in");
-+}
-+
-+
-+proc readNmzData(string nmz_suffix)
-+"USAGE:  readNmzData(string suffix);
-+RETURN:  Reads an output file of Normaliz containing an integer matrix and
-+         returns it as an intmat. For example, this function is useful if one
-+         wants to inspect the support hyperplanes. The filename is created
-+         from the current  filename and the suffix given to the function.
-+NOTE:    Needs an explicit filename set by setNmzFilename.
-+   @*    Note that all functions in normaliz.lib write and read their data
-+         automatically so that readNmzData will usually not be used explicitly.
-+   @*    This function reads only the first matrix in a file!
-+SEE ALSO: writeNmzData, rmNmzFiles, setNmzFilename, setNmzDataPath
-+EXAMPLE:  example readNmzData; shows an example"
-+{
-+    if(queryString("nmz_filename")=="")
-+    {
-+        ERROR("readNmzData: no filename specified");
-+    }
-+
-+    string s;
-+    int n_rows,n_cols;            //number of rows/columns
-+    int p;                     //position
-+    int i,j;
-+    int returnvalue;
-+
-+    string filename = getNmzFile() + "."+ nmz_suffix;
-+    link in_f=":r "+ filename;
-+    s=read(in_f);
-+    close(in_f);
-+
-+    p=1;
-+    (n_rows,p)=getInt(s,p);
-+    (n_cols,p)=getInt(s,p);
-+    if (n_rows <= 0 || n_cols <= 0) {
-+         intmat empty;
-+         return(empty);
-+    }
-+    intmat nmz_gen[n_rows][n_cols];
-+    for(i=1;i<=n_rows;i++)
-+    {
-+        for(j=1;j<=n_cols;j++)
-+        {
-+            (nmz_gen[i,j],p) = getInt(s,p);
-+        }
-+    }
-+    return(nmz_gen);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  setNmzFilename("VeryInteresting");
-+  intmat sgr[3][3]=1,2,3,4,5,6,7,8,10;
-+  intmat sgrnormal=normaliz(sgr,0);
-+  readNmzData("cst");
-+}
-+
-+
-+// running normaliz (with options)
-+
-+// component 1 is name of option
-+// 2 is default value
-+// 3 is command line option to be passed to Normaliz
-+// 4 indictes whether file "gen" is generated
-+// value 2 of 4 indicates "no influence"
-+
-+static proc defNmzOptions()
-+{
-+    if(!defined(nmz_options)) // can be defined only once
-+    {
-+        list nmz_options=
-+        list("supp",0,"-s",0),
-+        list("triang",0,"-tT",0),
-+        list("volume",0,"-v",0),
-+        list("hvect",0,"-p",0),
-+        list("height1",0,"-1",0),
-+        list("normal",0,"-n",1),
-+        list("normal_l",0,"-N",1),
-+        list("hilb",0,"-h",1),
-+        list("dual",0,"-d",1),
-+        list("control",0,"-c",2),
-+        list("allf",0,"-a",2),
-+        list("errorcheck",0,"-e",2),
-+        list("bigint",0,"-B",2),
-+        list("threads",0,"-x=",2);
-+        export(nmz_options);
-+    }
-+}
-+
-+proc setNmzOption(string s, int onoff)
-+"USAGE:   setNmzOption(string s, int onoff);
-+PURPOSE:  If @code{onoff=1} the option @code{s} is activated, and
-+          if @code{onoff=0} it is deactivated.
-+The Normaliz options are accessible via the following names:
-+@* @code{-s:  supp}
-+@* @code{-t:  triang}
-+@* @code{-v:  volume}
-+@* @code{-p:  hvect}
-+@* @code{-1:  height1}
-+@* @code{-n:  normal}
-+@* @code{-N:  normal_l}
-+@* @code{-h:  hilb}
-+@* @code{-d:  dual}
-+@* @code{-a:  allf}
-+@* @code{-c:  control}
-+@* @code{-e:  errorcheck}
-+@* @code{-B:  bigint} Use GMP for arbitrary precision integers
-+@* @code{-x=N:  threads} In this case the int parameter is used to set the
-+                         number of threads N, 0 means no explicit limiting.
-+
-+SEE ALSO: showNmzOptions
-+EXAMPLE:  example setNmzOption; shows an example
-+"
-+{
-+    defNmzOptions();
-+    for(int i=1;i<=size(nmz_options);i++)
-+    {
-+        if(s==nmz_options[i][1])
-+        {
-+            nmz_options[i][2]=onoff;
-+            return(1);
-+        }
-+    }
-+    "Invalid option ", s;
-+    return(0);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  setNmzOption("hilb",1);
-+  showNmzOptions();
-+}
-+
-+static proc collectNmzOptions()
-+{
-+    defNmzOptions();
-+    string run_options=" -f ";
-+    desInt("GenGen",1); // indicates whether "gen" is generated
-+    for(int i=1;i<=size(nmz_options);i++)
-+    {
-+        if(nmz_options[i][2])
-+        {
-+            run_options=run_options+nmz_options[i][3];
-+                if (nmz_options[i][1]=="threads") {
-+                    run_options=run_options+string(nmz_options[i][2]);
-+                }
-+                run_options=run_options+" ";
-+            if(nmz_options[i][4]!=2)
-+            {
-+                GenGen=nmz_options[i][4];
-+            }
-+        }
-+    }
-+    return(run_options+" ");
-+}
-+
-+proc showNmzOptions()
-+"USAGE:   showNmzOptions();
-+RETURN:   Returns the string of activated options.
-+NOTE:     This string is used as parameter when calling Normaliz.
-+SEE ALSO: setNmzOption
-+EXAMPLE:  example showNmzOption; shows an example
-+"
-+{
-+    return(collectNmzOptions());
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  setNmzOption("hilb",1);
-+  showNmzOptions();
-+}
-+
-+
-+static proc runNormaliz(intmat sgr, int nmz_mode, list #)
-+{
-+    if(!queryInt("nmz_files_keep_switch"))
-+    {
-+        makeTempNmzDataPath();
-+    }
-+
-+    doWriteNmzData(list(sgr, nmz_mode) + #);
-+
-+    if(queryInt("nmz_files_keep_switch"))
-+    {
-+       int dummy=system("sh",setNmzExec()+ collectNmzOptions() + getNmzFile());
-+    }
-+    else
-+    {
-+        string gotodir="/tmp";
-+        string fname=getNmzFile();
-+        fname=fname[6..size(fname)];
-+        string exec="cd "+gotodir+" ; ";
-+        exec=exec+setNmzExec()+ collectNmzOptions()+" ";
-+        exec=exec+fname+" ;";
-+        int dummy=system("sh",exec);
-+    }
-+
-+    if(!GenGen) // return input matrix if "gen" has not been generated
-+    {
-+        if(!queryInt("nmz_files_keep_switch"))
-+        {
-+            eraseTempNmzDataPath();
-+        }
-+        return(sgr);
-+    }
-+    intmat Gen=readNmzData("gen");
-+
-+    if(!defined(Num_Invs))
-+    {
-+        list Num_Invs;
-+        export Num_Invs;
-+    }
-+    Num_Invs=getNuminvs();
-+
-+    if(!queryInt("nmz_files_keep_switch"))
-+    {
-+        eraseTempNmzDataPath();
-+    }
-+
-+    return(Gen);
-+
-+}
-+
-+proc normaliz(intmat sgr,int nmz_mode, list #)
-+"USAGE:   normaliz(intmat sgr,int nmz_mode);
-+          normaliz(intmat sgr, int nmz_mode, intmat sgr2, int nmz_mode2, ...);
-+RETURN:   The function applies Normaliz to the parameter sgr in the mode set
-+          by nmz_mode. The function returns the intmat defined by the file
-+          with suffix gen.
-+
-+          It is also possible to give more than one pair of matrix and mode. In
-+          this case all matrices and modes are used. This can be used to
-+          combine modes 4,5,6.
-+          Use nmz_mode=20 to specify a grading.
-+NOTE:     You will find procedures for many applications of Normaliz in this
-+          library, so the explicit call of this procedure may not be necessary.
-+SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal,
-+          torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings,
-+             intersectionValRingIdeals
-+EXAMPLE:  example normaliz; shows an example
-+"
-+{
-+    return(runNormaliz(sgr,nmz_mode,#));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z),dp;
-+  intmat M[3][2]=3,1,
-+                 3,2,
-+                 1,3;
-+  normaliz(M,1);
-+
-+  intmat Hyperplanes[2][3] = 2,-1,0, // 2x-y >= 0
-+                             1, 1,0; //  x+y >= 0
-+  intmat Equation[1][3] = 0,1,-1;    // y = z
-+  intmat Congruence[1][4] = 1,0,0,3;  // x = 0 (3)
-+  normaliz(Hyperplanes,4,Equation,5,Congruence,6);
-+}
-+
-+
-+// retrieving normaliz numerical invariants
-+
-+static proc getNuminvs()
-+{
-+    string s;
-+    list num_invs;
-+    int p,sw,v_length,i,dummy_int;
-+    intvec dummy_vec;
-+    string type_inv,name_inv,dummy_bool;
-+
-+    link in_f=":r "+ getNmzFile() + "."+"inv";
-+    s=read(in_f);
-+
-+    p=1;
-+    while(p<size(s))
-+    {
-+        (sw,p)=nextWord(s,p);
-+        if(sw==-1)
-+        {
-+            break;
-+        }
-+        type_inv=s[sw..p-1];
-+        if(type_inv=="vector")
-+        {
-+            (v_length,p)=getInt(s,p);
-+            (sw,p)=nextWord(s,p);
-+            name_inv=s[sw..p-1];
-+            if(name_inv=="h-vector")
-+            {
-+                name_inv="h_vector";
-+            }
-+            if(name_inv!="hilbert_polynomial"
-+              && name_inv!="hilbert_quasipolynomial")
-+            {
-+                for(i=1;i<=v_length;i++)
-+                {
-+                    if(i==1)
-+                    {
-+                        (dummy_int,p)=getInt(s,p);
-+                        dummy_vec=dummy_int;
-+                    }
-+                    else
-+                    {
-+                        (dummy_int,p)=getInt(s,p);
-+                        dummy_vec=dummy_vec,dummy_int;
-+                    }
-+                }
-+                num_invs=num_invs+list(list(name_inv,dummy_vec,"intvec"));
-+            }
-+            else
-+            {
-+                p=skipEqualsign(s,p);
-+            }
-+        }
-+        if(type_inv=="integer")
-+        {
-+            (sw,p)=nextWord(s,p);
-+            name_inv=s[sw..p-1];
-+            if (name_inv!="hilbert_quasipolynomial_denom") {
-+              (dummy_int,p)=getInt(s,p);
-+              num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
-+            }
-+        }
-+        if(type_inv=="boolean")
-+        {
-+            (sw,p)=nextWord(s,p);
-+            name_inv=s[sw..p-1];
-+            p=skipEqualsign(s,p);
-+            (sw,p)=nextWord(s,p);
-+            dummy_bool=s[sw..p-1];
-+            dummy_int=0;
-+            if(dummy_bool=="true")
-+            {
-+                dummy_int=1;
-+            }
-+            num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
-+        }
-+    }
-+    return(num_invs);
-+}
-+
-+proc showNuminvs()
-+"USAGE:   showNuminvs();
-+PURPOSE:  prints the numerical invariants
-+SEE ALSO: exportNuminvs
-+EXAMPLE:  example showNuminvs(); shows an example
-+"
-+{
-+    list dummy;
-+    int i;
-+    for(i=1;i<=size(Num_Invs);i++)
-+    {
-+        dummy=Num_Invs[i];
-+        dummy[1],":", dummy[2];
-+    }
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z,t),dp;
-+  ideal I=x3,x2y,y3;
-+  list l=intclMonIdeal(I);
-+  showNuminvs();
-+}
-+
-+
-+proc exportNuminvs()
-+"USAGE:   exportNuminvs();
-+CREATE:   Creates top-level variables which contain the numerical invariants.
-+          Depending on the options of normaliz different invariants are
-+          calculated. Use showNuminvs (@ref{showNuminvs}) to see which
-+          invariants are available.
-+SEE ALSO: showNuminvs
-+EXAMPLE:  example exportNuminvs; shows an example
-+"
-+{
-+    list dummy;
-+    int i;
-+    string s;
-+    for(i=1;i<=size(Num_Invs);i++)
-+    {
-+        dummy=Num_Invs[i];
-+        s=dummy[3]+" nmz_" + dummy[1] + "=dummy[2]; exportto(Top," + "nmz_" + dummy[1] + ");";
-+        execute(s);
-+    }
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z,t),dp;
-+  ideal I=x3,x2y,y3;
-+  list l=intclMonIdeal(I);
-+  exportNuminvs();
-+  // now the following variables are set:
-+  nmz_hilbert_basis_elements;
-+  nmz_number_extreme_rays;
-+  nmz_rank;
-+  nmz_index;
-+  nmz_number_support_hyperplanes;
-+  nmz_size_triangulation;
-+  nmz_sum_dets;
-+  nmz_graded;
-+  nmz_degree_1_elements;
-+  nmz_grading;
-+  nmz_grading_denom;
-+  nmz_multiplicity;
-+  nmz_multiplicity_denom;
-+  nmz_hilbert_series_num;
-+  nmz_hilbert_series_denom;
-+  nmz_primary;
-+}
-+
-+
-+// intmats to/from monomials
-+
-+proc mons2intmat(ideal I)
-+"USAGE:   mons2intmat(ideal I);
-+RETURN:   Returns the intmat whose rows represent the leading exponents of the
-+          (non-zero) elements of I. The length of each row is nvars(basering).
-+SEE ALSO: intmat2mons
-+EXAMPLE:  example mons2intmat; shows an example"
-+{
-+    int i,j,k;
-+    intmat expo_vecs[size(I)][nvars(basering)];
-+    intvec expo_v;
-+
-+    k=0;
-+    for(i=1;i<=ncols(I);i++)
-+    {
-+        if(I[i]!=0)
-+        {
-+            k++;
-+            expo_v=leadexp(I[i]);
-+            for(j=1;j<=nvars(basering);j++)
-+            {
-+                expo_vecs[k,j]=expo_v[j];
-+            }
-+        }
-+    }
-+    return(expo_vecs);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z),dp;
-+  ideal I=x2,y2,x2yz3;
-+  mons2intmat(I);
-+}
-+
-+proc intmat2mons(intmat expo_vecs)
-+"USAGE:   intmat2mons(intmat M);
-+RETURN:   an ideal generated by the monomials which correspond to the exponent
-+          vectors given by the rows of @code{M}
-+NOTE:     The number of variables in the basering @code{nvars(basering)} has to
-+          be at least the number of columns @code{ncols(M)}, otherwise the
-+          function exits with an error.
-+          is thrown (see @ref{ERROR}).
-+SEE ALSO: mons2intmat
-+EXAMPLE:  example intmat2mons; shows an example
-+"
-+{
-+    int i,j;
-+    poly m;
-+    ideal mons;
-+
-+    if(nvars(basering)<ncols(expo_vecs))
-+    {
-+        ERROR("intmat2mons: not enough variables in ring");
-+    }
-+
-+    for(i=1;i<=nrows(expo_vecs);i++)
-+    {
-+        m=1;
-+        for(j=1;j<=ncols(expo_vecs);j++)
-+        {
-+            m=m*var(j)^expo_vecs[i,j];
-+        }
-+        mons=mons,m;
-+    }
-+     mons=simplify(mons,2);    // get rid of starting 0
-+     return(mons);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z),dp;
-+  intmat expo_vecs[3][3] =
-+  2,0,0,
-+  0,2,0,
-+  2,1,3;
-+  intmat2mons(expo_vecs);
-+}
-+
-+static proc intmat2monsSel(intmat expo_vecs, int d)
-+{
-+    int i,j;
-+    poly m;
-+    ideal mons;
-+
-+    if(nvars(basering)<ncols(expo_vecs)-1)
-+    {
-+        ERROR("intmat2monsSel: not enough variables in ring");
-+    }
-+
-+    for(i=1;i<=nrows(expo_vecs);i++)
-+    {
-+        if(expo_vecs[i,ncols(expo_vecs)]==d)
-+        {
-+
-+            m=1;
-+            for(j=1;j<=ncols(expo_vecs)-1;j++)
-+            {
-+                m=m*var(j)^expo_vecs[i,j];
-+            }
-+            mons=mons,m;
-+        }
-+    }
-+     mons=simplify(mons,2);    // get rid of starting 0
-+     return(mons);
-+}
-+
-+
-+proc binomials2intmat(ideal I)
-+"USAGE:   binomials2intmat(ideal I);
-+RETURN:   Returns the intmat whose rows represent the exponents of the
-+          (non-zero) elements of I which have to be binomials.
-+          The length of each row is nvars(basering).
-+SEE ALSO: mons2intmat, intmat2mons
-+EXAMPLE:  example binomials2intmat; shows an example"
-+{
-+    int i,j,k;
-+    intmat expo_vecs[size(I)][nvars(basering)];
-+    intvec expo_v;
-+
-+    k=0;
-+    poly f;
-+
-+    for(i=1; i<=ncols(I); i++)     {
-+        if( I[i] != 0 ) {
-+            k++;
-+            f = I[i];
-+            if (leadcoef(f) != 1) {f = -f};  //works in all characteristics
-+            if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1) {
-+                ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i]));
-+            }
-+
-+            expo_v = leadexp(f)-leadexp(f[2]);
-+            for(j=1;j<=nvars(basering);j++) {
-+                expo_vecs[k,j]=expo_v[j];
-+            }
-+        }
-+    }
-+    return(expo_vecs);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring S = 37,(u,v,w,x,y,z),dp;
-+  ideal I = u2v-xyz, ux2-vyz, uvw-y2z;
-+  binomials2intmat(I);
-+}
-+
-+
-+// integral closure of rings and ideals
-+
-+static proc runIntclToricRing(ideal I, int nmz_mode, list #)
-+{
-+    intmat expo_vecs=mons2intmat(I);
-+
-+    string dummy=collectNmzOptions(); // only to set GenGen
-+    return( intmat2mons( runNormaliz(expo_vecs,nmz_mode, prepareGrading(#)) ) );
-+}
-+
-+proc intclToricRing(ideal I, list #)
-+"USAGE:   intclToricRing(ideal I);
-+          intclToricRing(ideal I, intvec grading);
-+RETURN:   The toric ring S is the subalgebra of the basering generated by
-+          the leading monomials of the elements of I (considered as a list
-+          of polynomials). The function computes the integral
-+          closure T of S in the basering and returns an ideal listing
-+          the algebra generators of T over the coefficient field.
-+@*        The function returns the input ideal I if one of the options
-+          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
-+          has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+NOTE:     A mathematical remark: the toric ring depends on the list of
-+          monomials given, and not only on the ideal they generate!
-+SEE ALSO:  normalToricRing, ehrhartRing, intclMonIdeal
-+EXAMPLE:   example intclToricRing; shows an example
-+"
-+{
-+    return(runIntclToricRing(I,0,#));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=37,(x,y,t),dp;
-+  ideal I=x3,x2y,y3;
-+  intclToricRing(I);
-+  showNuminvs();
-+  //now the same example with another grading
-+  intvec grading = 2,3,1;
-+  intclToricRing(I,grading);
-+  showNuminvs();
-+
-+}
-+
-+proc normalToricRing(ideal I, list #)
-+"USAGE:   normalToricRing(ideal I);
-+          normalToricRing(ideal I, intvec grading);
-+RETURN:   The toric ring S is the subalgebra of the basering generated by the
-+          leading monomials of the elements of I (considered as a list of
-+          polynomials). The function computes the
-+          normalisation T of S and returns an ideal listing the algebra
-+          generators of T over the coefficient field.
-+@*        The function returns the input ideal I if one of the options
-+          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
-+          has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+NOTE:     A mathematical remark: the toric ring depends on the list of
-+          monomials given, and not only on the ideal they generate!
-+SEE ALSO: intclToricRing, ehrhartRing, intclMonIdeal, normalToricRingFromBinomials
-+EXAMPLE:  example normalToricRing; shows an example
-+"
-+{
-+    return(runIntclToricRing(I,1,#));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring  R = 37,(x,y,t),dp;
-+  ideal I = x3,x2y,y3;
-+  normalToricRing(I);
-+}
-+
-+
-+proc normalToricRingFromBinomials(ideal I, list #)
-+"USAGE:   normalToricRingFromBinomials(ideal I);
-+          normalToricRingFromBinomials(ideal I, intvec grading);
-+RETURN:   @texinfo
-+ at tex
-+The ideal $I$ is generated by binomials of type $X^a-X^b$ (multiindex notation)
-+in the surrounding polynomial ring $K[X]=K[X_1,...,X_n]$. The binomials
-+represent a congruence on the monoid ${Z}^n$ with residue monoid $M$.
-+Let $N$ be the image of $M$ in gp($M$)/torsion. Then $N$ is universal in the
-+sense that every homomorphism from $M$ to an affine monoid factors through $N$.
-+If $I$ is a prime ideal, then $K[N]= K[X]/I$. In general, $K[N]=K[X]/P$ where
-+$P$ is the unique minimal prime ideal of $I$ generated by binomials of type
-+$X^a-X^b$.
-+
-+The function computes the normalization of $K[N]$ and returns a newly created
-+polynomial ring of the same Krull dimension, whose variables are
-+$x(1),...,x(n-r)$, where $r$ is the rank of the matrix with rows $a-b$.
-+(In general there is no canonical choice for such an embedding.)
-+Inside this polynomial ring there is an ideal $I$ which lists the algebra
-+generators of the normalization of $K[N]$.
-+ at end tex
-+ at end texinfo
-+@*        The function returns the input ideal I if one of the options
-+          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
-+          has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal
-+EXAMPLE:  example normalToricRing; shows an example
-+"
-+{
-+    intmat expo_vecs = binomials2intmat(I);
-+    string dummy=collectNmzOptions(); // only to set GenGen
-+    intmat result = runNormaliz(expo_vecs,10,prepareGrading(#));
-+
-+    list baseringlist = ringlist(basering);
-+    ring S = (baseringlist[1]),(x(1..ncols(result))),dp;
-+    ideal I = intmat2mons(result);
-+    export(I);
-+    return (S);
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R = 37,(u,v,w,x,y,z),dp;
-+  ideal I = u2v-xyz, ux2-wyz, uvw-y2z;
-+  def S = normalToricRingFromBinomials(I);
-+  setring S;
-+  I;
-+}
-+
-+static proc runIntclMonIdeal(ideal I, int nmz_mode, list #)
-+{
-+    intmat expo_vecs=mons2intmat(I);
-+    int i,last_comp;
-+
-+    // we test if there is room for the Rees algebra
-+
-+    for(i=1;i<=nrows(expo_vecs);i++)
-+    {
-+        if(expo_vecs[i,ncols(expo_vecs)]!=0)
-+        {
-+            last_comp=1;  break; // no
-+        }
-+    }
-+
-+    string dummy=collectNmzOptions(); // only to set GenGen
-+
-+    //adjust size of input matrix
-+    if (!last_comp) { // remove last component
-+        intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1]
-+               = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)];
-+        expo_vecs = tmp;
-+    }
-+    intmat nmz_data=runNormaliz(expo_vecs,nmz_mode,prepareGrading(#));
-+
-+    if(last_comp)
-+    {
-+        ideal I1=intmat2monsSel(nmz_data,1);
-+        return(list(I1));
-+    }
-+    else
-+    {
-+        ideal I1=intmat2monsSel(nmz_data,1);
-+        ideal I2=intmat2mons(nmz_data);
-+        return(list(I1,I2));
-+    }
-+}
-+
-+proc ehrhartRing(ideal I)
-+"USAGE:    ehrhartRing(ideal I);
-+RETURN:    The exponent vectors of the leading monomials of the elements of I
-+           are considered as points of a lattice polytope P.
-+           The Ehrhart ring of a (lattice) polytope P is the monoid algebra
-+           defined by the monoid of lattice points in the cone over the
-+           polytope P; see Bruns and Gubeladze, Polytopes, Rings, and K-theory,
-+           Springer 2009, pp. 228, 229.
-+           The function returns a list of ideals:
-+@*         (i) If the last ring variable is not used by the monomials, it is
-+               treated as the auxiliary variable of the Ehrhart ring. The
-+               function returns two ideals, the first containing the monomials
-+               representing all the lattice points of the polytope, the second
-+               containing the algebra generators of the Ehrhart ring over the
-+               coefficient field.
-+@*         (ii) If the last ring variable is used by the monomials, the list
-+                returned contains only one ideal, namely the monomials
-+                representing the lattice points of the polytope.
-+@*
-+@*        The function returns the a list containing the input ideal I if one
-+          of the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+NOTE:      A mathematical remark: the Ehrhart ring depends on the list of
-+           monomials given, and not only on the ideal they generate!
-+SEE ALSO: intclToricRing, normalToricRing, intclMonIdeal
-+EXAMPLE:  example ehrhartRing; shows an example
-+"
-+{
-+    return(runIntclMonIdeal(I,2));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=37,(x,y,t),dp;
-+  ideal J=x3,x2y,y3,xy2t7;
-+  ehrhartRing(J);
-+}
-+
-+proc intclMonIdeal(ideal I, list #)
-+"USAGE:   intclMonIdeal(ideal I);
-+          intclMonIdeal(ideal I, intvec grading);
-+RETURN:   The exponent vectors of the leading monomials of the elements of I
-+          are considered as generators of a monomial ideal for which the
-+          normalization of its Rees algebra is computed. For a Definiton of the
-+          Rees algebra (or Rees ring) see Bruns and Herzog, Cohen-Macaulay
-+          rings, Cambridge University Press 1998, p. 182.
-+          The function returns a list of ideals:
-+@* (i) If the last ring variable is not used by the monomials, it is treated
-+       as the auxiliary variable of the Rees algebra. The function returns two
-+       ideals, the first containing the monomials generating the integral
-+       closure of the monomial ideal, the second containing the algebra
-+         generators of the normalization of the Rees algebra.
-+@* (ii) If the last ring variable is used by the monomials, the list returned
-+        contains only one ideal, namely the monomials generating the integral
-+        closure of the ideal.
-+@*        The function returns the a list containing the input ideal I if one
-+          of the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+SEE ALSO: intclToricRing, normalToricRing, ehrhartRing
-+EXAMPLE:  example intclMonIdeal; shows an example
-+"
-+{
-+    return(runIntclMonIdeal(I,3,#));
-+}
-+example
-+{ "EXAMPLE"; echo=2;
-+    ring R=0,(x,y,z,t),dp;
-+    ideal I=x^2,y^2,z^3;
-+    list l=intclMonIdeal(I);
-+    l[1]; // integral closure of I
-+    l[2];  // monomials generating the integral closure of the Rees algebra
-+}
-+
-+// torus invariants and valuation rings and ideals
-+
-+proc torusInvariants(intmat E, list #)
-+"USAGE:   torusInvariants(intmat A);
-+          torusInvariants(intmat A, intvec grading);
-+RETURN:   @texinfo
-+Returns an ideal representing the list of monomials generating the ring of
-+invariants as an algebra over the coefficient field.
-+ at tex
-+$R^T$.
-+ at end tex
-+@*        The function returns the ideal given by the input matrix A if one of
-+          the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+ at end texinfo
-+BACKGROUND: @texinfo
-+ at tex
-+ Let $T = (K^*)^r$ be the $r$-dimensional torus acting on the polynomial ring
-+ $R = K[X_1 ,\ldots,X_n]$ diagonally. Such an action can be described as
-+ follows: there are integers $a_{i,j}$, $i=1,\ldots,r$, $j=1,\ldots,n$, such
-+ that $(\lambda_1,\ldots,\lambda_r)\in T$ acts by the substitution
-+$$ X_j \mapsto \lambda_1^{a_{1,j}} \cdots \lambda_r^{a_{r,j}}X_j,
-+   \quad j=1,\ldots,n.$$
-+In order to compute the ring of invariants $R^T$ one must specify the matrix
-+$A=(a_{i,j})$.
-+ at end tex
-+ at end texinfo
-+SEE ALSO: diagInvariants, finiteDiagInvariants, intersectionValRings,
-+          intersectionValRingIdeals
-+EXAMPLE:  example torusInvariants; shows an example
-+"
-+{
-+    if(nvars(basering)!=ncols(E))
-+    {
-+        ERROR("torusInvariants: wrong number of columns in matrix");
-+    }
-+
-+    string dummy=collectNmzOptions();  // only to set GenGen
-+
-+    return( intmat2mons( runNormaliz(E,5,prepareGrading(#)) ) );
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z,w),dp;
-+  intmat E[2][4] = -1,-1,2,0, 1,1,-2,-1;
-+  torusInvariants(E);
-+}
-+
-+proc finiteDiagInvariants(intmat C, list #)
-+"USAGE:   finiteDiagInvariants(intmat U);
-+          finiteDiagInvariants(intmat U, intvec grading);
-+RETURN:   @texinfo
-+ at tex
-+This function computes the ring of invariants of a finite abelian group $G$
-+acting diagonally on the surrounding polynomial ring $K[X_1,...,X_n]$. The
-+group is the direct product of cyclic groups generated by finitely many
-+elements $g_1,...,g_w$. The element $g_i$ acts on the indeterminate $X_j$ by
-+$g_i(X_j)=\lambda_i^{u_{ij}}X_j$ where $\lambda_i$ is a primitive root of
-+unity of order equal to $ord(g_i)$. The ring of invariants is generated by all
-+monomials satisfying the system
-+$u_{i1}a_1+\ldots+u_{in} a_n \equiv 0$ mod ord$(g_i)$, $i=1,\ldots,w$.
-+The input to the function is the $w\times(n+1)$ matrix $U$ with rows
-+$u_{i1}\ldots u_{in}$ ord$(gi)$, $i=1,\ldots,w$. The output is a monomial ideal
-+listing the algebra generators of the subalgebra of invariants
-+{$R^G=\{f\in R : g_i f = f$ for all $i=1,\ldots,w\}$}.
-+ at end tex
-+ at end texinfo
-+@*        The function returns the ideal given by the input matrix C if one of
-+          the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+NOTE:
-+SEE ALSO: torusInvariants, diagInvariants, intersectionValRings,
-+          intersectionValRingIdeals
-+EXAMPLE:  example finiteDiagInvariants; shows an example
-+"
-+{
-+    if(nvars(basering)!=ncols(C)-1)
-+    {
-+        ERROR("finiteDiagInvariants: wrong number of columns in matrix");
-+    }
-+
-+    string dummy=collectNmzOptions();  // only to set GenGen
-+
-+    return( intmat2mons( runNormaliz(C,6,prepareGrading(#)) ) );
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R = 0,(x,y,z,w),dp;
-+  intmat C[2][5] = 1,1,1,1,5, 1,0,2,0,7;
-+  finiteDiagInvariants(C);
-+}
-+
-+proc diagInvariants(intmat E, intmat C, list #)
-+"USAGE:   diagInvariants(intmat A, intmat U);
-+          diagInvariants(intmat A, intmat U, intvec grading);
-+RETURN:   @texinfo
-+ at tex
-+This function computes the ring of invariants of a diagonalizable group
-+$D = T\times G$ where $T$ is a torus and $G$ is a finite abelian group, both
-+acting diagonally on the polynomial ring $K[X_1,\ldots,X_n]$. The group
-+actions are specified by the input matrices A and U. The first matrix specifies
-+the torus action, the second the action of the finite group. See
-+torusInvariants and finiteDiagInvariants for more detail. The output is a
-+monomial ideal listing the algebra generators of the subalgebra of invariants.
-+ at end tex
-+ at end texinfo
-+@*        The function returns the ideal given by the input matrix A if one of
-+          the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals
-+EXAMPLE:  example diagInvariants; shows an example
-+"
-+{
-+    if(nvars(basering)!=ncols(E) || nvars(basering)!=ncols(C)-1)
-+    {
-+        ERROR("diagInvariants: wrong number of columns in matrix");
-+    }
-+
-+    string dummy=collectNmzOptions();  // only to set GenGen
-+
-+    return( intmat2mons( runNormaliz(E,5,C,6,prepareGrading(#)) ) );
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z,w),dp;
-+  intmat E[2][4] = -1,-1,2,0, 1,1,-2,-1;
-+  intmat C[2][5] = 1,1,1,1,5, 1,0,2,0,7;
-+  diagInvariants(E,C);
-+}
-+
-+proc intersectionValRings(intmat V, list #)
-+"USAGE:   intersectionValRings(intmat V, intvec grading);
-+RETURN:   The function returns a monomial ideal, to be considered as the list
-+          of monomials generating @math{S} as an algebra over the coefficient
-+          field.
-+BACKGROUND: @texinfo
-+ at tex
-+A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
-+the values $v(X_j)$ of the indeterminates. This function computes the
-+subalgebra $S = \{ f \in R : v_i ( f ) \geq 0,\ i = 1,\ldots,r\}$ for several
-+such valuations $v_i$, $i=1,\ldots,r$. It needs the matrix $V = (v_i(X_j))$ as
-+its input.
-+ at end tex
-+ at end texinfo
-+@*        The function returns the ideal given by the input matrix V if one of
-+          the options @code{supp}, @code{triang}, @code{volume}, or
-+          @code{hseries} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals
-+EXAMPLE:  example intersectionValRings; shows an example
-+"
-+{
-+
-+    if(nvars(basering)!=ncols(V))
-+    {
-+        ERROR("intersectionValRings: wrong number of columns in matrix");
-+    }
-+
-+    intmat V1[nrows(V)+ncols(V)][ncols(V)];
-+    int i,j;
-+
-+    for(i=1;i<=ncols(V);i++)
-+    {
-+        V1[i,i]=1;
-+    }
-+    for(i=1;i<=nrows(V);i++)
-+    {
-+        for(j=1;j<=ncols(V);j++)
-+        {
-+            V1[i+ncols(V),j]=V[i,j];
-+        }
-+    }
-+
-+
-+    string dummy=collectNmzOptions();  // only to set GenGen
-+
-+/*    if(!GenGen) // return V
-+    {
-+        runNormaliz(V1,4,prepareGrading(#));
-+        return(V);
-+    }
-+*/
-+    return(intmat2mons(runNormaliz(V1,4,prepareGrading(#))));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+  ring R=0,(x,y,z,w),dp;
-+  intmat V0[2][4]=0,1,2,3, -1,1,2,1;
-+  intersectionValRings(V0);
-+}
-+
-+proc intersectionValRingIdeals(intmat V, list #)
-+"USAGE:   intersectionValRingIdeals(intmat V);
-+          intersectionValRingIdeals(intmat V, intvec grading);
-+RETURN:   The function returns two ideals, both to be considered as lists of
-+          monomials. The
-+          first is the system of monomial generators of @math{S}, the second
-+          the system of generators of @math{M}.
-+@*        The function returns a list consisting of the ideal given by the
-+          input matrix T if one of the options @code{supp}, @code{triang}, or
-+          @code{hvect} has been activated.
-+          However, in this case some numerical invariants are computed, and
-+          some other data may be contained in files that you can read into
-+          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
-+BACKGROUND: @texinfo
-+ at tex
-+A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
-+the values $v(X_j)$ of the indeterminates. This function computes the
-+subalgebra $S = \{ f \in R : v_i ( f ) \geq 0,\ i = 1,\ldots,r\}$ for several
-+such valuations $v_i$, $i=1,\ldots,r$. It needs the matrix $V = (v_i(X_j))$ as
-+its input.
-+
-+This function simultaneously determines the $S$-submodule
-+$M = \{ f \in R : v_i(f) \geq w_i ,\ i = 1,\ldots,r\}$ for integers
-+$w_1,\ldots\,w_r$. (If $w_i \geq 0$ for all $i$, $M$ is an ideal of $S$.)
-+The numbers $w_i$ form the $(n+1)$th column of the input matrix.
-+ at end tex
-+ at end texinfo
-+NOTE:   The function also gives an error message if the matrix V has the
-+        wrong number of columns.
-+SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings
-+EXAMPLE:  example intersectionValRingIdeals; shows an example
-+"
-+{
-+    if(nvars(basering)!=ncols(V)-1)
-+    {
-+        ERROR("intersectionValRingIdeals: wrong number of columns in matrix");
-+    }
-+
-+    intmat V1[nrows(V)+ncols(V)][ncols(V)];
-+    int i,j;
-+
-+    for(i=1;i<=ncols(V);i++)
-+    {
-+        V1[i,i]=1;
-+    }
-+    for(i=1;i<=nrows(V);i++)
-+    {
-+        for(j=1;j<=ncols(V);j++)
-+        {
-+            V1[i+ncols(V),j]=V[i,j];
-+        }
-+    }
-+    for(i=1;i<=nrows(V);i++)
-+    {
-+        V1[i+ncols(V),ncols(V)]=-V1[i+ncols(V),ncols(V)];
-+    }
-+
-+    string dummy=collectNmzOptions();  // only to set GenGen
-+
-+    intmat nmz_data=runNormaliz(V1,4,prepareGrading(#));
-+
-+    ideal I1=intmat2monsSel(nmz_data,0);
-+    ideal I2=intmat2monsSel(nmz_data,1);
-+    return(list(I1,I2));
-+}
-+example
-+{ "EXAMPLE:"; echo=2;
-+ ring R=0,(x,y,z,w),dp;
-+ intmat V[2][5]=0,1,2,3,4, -1,1,2,1,3;
-+ intersectionValRingIdeals(V);
-+}
diff --git a/debian/patches/upstream-dump4help2man.patch b/debian/patches/upstream-dump4help2man.patch
deleted file mode 100644
index 4b42585..0000000
--- a/debian/patches/upstream-dump4help2man.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-Description: version tuple dump option
- Add a --dump-versiontuple long hidden option (that literaly dump
- Singular version) to Singular front-end programs in view to employ
- help2man to generate manpages; meant to be submitted to the upstream
- maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/695
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-23
-
---- a/Singular/feOptTab.h
-+++ b/Singular/feOptTab.h
-@@ -149,7 +149,10 @@
-    "LINK",     "Use LINK for connections",                             feOptString,    0,   0},
- 
-   {"ticks-per-sec",     required_argument,  LONG_OPTION_RETURN,
--   "TICKS",     "Sets unit of timer to TICKS per second",               feOptInt,    (void*)1,      0},
-+   "TICKS",    "Sets unit of timer to TICKS per second",               feOptInt,    (void*)1,      0},
-+
-+  {"dump-versiontuple",       no_argument,  LONG_OPTION_RETURN,
-+   0,          "//Display the version-tuple and exit",  feOptUntyped,    0,      0},
- 
- // terminator -- do NOT remove
-   { 0, 0, 0, 0, 0, feOptInt, 0, 0}
---- a/Singular/feOpt.cc
-+++ b/Singular/feOpt.cc
-@@ -302,6 +302,12 @@
-         return NULL;
-       }
- 
-+      case FE_OPT_DUMP_VERSIONTUPLE:
-+      {
-+        feOptDumpVersionTuple();
-+        return NULL;
-+      }
-+
-       default:
-         return NULL;
-   }
-@@ -394,6 +400,9 @@
-   printf("Singular manual (available as on-line info or html manual).\n");
- }
- 
--
-+void feOptDumpVersionTuple(void)
-+{
-+  printf("%s\n",VERSION);
-+}
- 
- #endif // GENERATE_OPTION_INDEX
---- a/Singular/feOpt.h
-+++ b/Singular/feOpt.h
-@@ -33,6 +33,7 @@
- 
- 
- void feOptHelp(const char* name);
-+void feOptDumpVersionTuple(void);
- 
- #ifdef __cplusplus
- 
---- a/Singular/tesths.cc
-+++ b/Singular/tesths.cc
-@@ -115,6 +115,13 @@
-       exit(1);
-     }
-     if (optc == 'h') exit(0);
-+    switch(option_index)
-+    {
-+      case FE_OPT_DUMP_VERSIONTUPLE:
-+        exit(0);
-+        break;
-+      default: ;
-+    }
-   }
- 
-   /* say hello */
---- a/Singular/emacs.cc
-+++ b/Singular/emacs.cc
-@@ -170,6 +170,11 @@
-                 no_emacs_call = 1;
-                 break;
- 
-+              case FE_OPT_DUMP_VERSIONTUPLE:
-+                feOptDumpVersionTuple();
-+                exit(0);
-+                break;
-+
-               default:
-                 goto NEXT;
-           }
diff --git a/debian/patches/upstream-fix-autotools-CPPFLAGS_overwrite.patch b/debian/patches/upstream-fix-autotools-CPPFLAGS_overwrite.patch
deleted file mode 100644
index 2e472fe..0000000
--- a/debian/patches/upstream-fix-autotools-CPPFLAGS_overwrite.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Description: autotools: fix CPPFLAGS overwrite
- Fix CPPFLAGS overwrite issue observed in omalloc package.
- This patch is meant to be submitted to the upstream maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/694
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2015-01-02
-
---- a/omalloc/configure.ac
-+++ b/omalloc/configure.ac
-@@ -98,7 +98,7 @@
- dnl  ac_cflags_set=no
- dnl fi
- 
--CPPFLAGS="-I.. -I."
-+CPPFLAGS="-I.. -I. $CPPFLAGS"
- AC_PROG_MAKE_SET
- AC_PROG_CC
- AC_PROG_CPP
diff --git a/debian/patches/upstream-source-typo.patch b/debian/patches/upstream-source-typo.patch
deleted file mode 100644
index 5425cd2..0000000
--- a/debian/patches/upstream-source-typo.patch
+++ /dev/null
@@ -1,334 +0,0 @@
-Description: source typo
- Correct spelling error as reported by lintian in some binraries;
- meant to silence lintian and eventually to be submitted to the
- upstream maintainer.
-Origin: debian
-Forwarded: https://github.com/Singular/Sources/pull/692
-Author: Jerome Benoit <calculus at rezozer.net>
-Last-Update: 2014-12-20
-
-Comment: spelling-error-in-binary
-
---- a/Singular/fevoices.cc
-+++ b/Singular/fevoices.cc
-@@ -87,7 +87,7 @@
- }
- 
- /*2
--* init a new voice similiar to the current
-+* init a new voice similar to the current
- */
- void Voice::Next()
- {
---- a/Singular/ipassign.cc
-+++ b/Singular/ipassign.cc
-@@ -1688,7 +1688,7 @@
-       }
-       if(like_lists)
-       {
--        if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similiar\n");
-+        if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
-         if (like_lists==1)
-         {
-           // check blackbox/newtype type:
-@@ -1724,7 +1724,7 @@
- #endif
-       return (bb==NULL) || bb->blackbox_Assign(l,r);
-     }
--    // end of handling elems of list and similiar
-+    // end of handling elems of list and similar
-     rl=r->listLength();
-     if (rl==1)
-     {
---- a/libpolys/polys/templates/p_Procs_Impl.h
-+++ b/libpolys/polys/templates/p_Procs_Impl.h
-@@ -30,8 +30,8 @@
-  the p_*_Templates.cc and header files which provide the respective
-  macros.
- 
-- At run-time, a fast proc is set/choosen if found/generated, else
-- a general proc is set/choosen.
-+ At run-time, a fast proc is set/chosen if found/generated, else
-+ a general proc is set/chosen.
-  *******************************************************************/
- 
- // Define HAVE_FAST_P_PROCS to:
-@@ -395,7 +395,7 @@
- /***************************************************************
-  *
-  * Filters which are applied to field/length/ord, before a proc is
-- * choosen
-+ * chosen
-  *
-  *******************************************************************/
- #ifdef p_Procs_Static
---- a/Singular/LIB/normal.lib
-+++ b/Singular/LIB/normal.lib
-@@ -185,7 +185,7 @@
-   {
-     if ( typeof(#[i]) == "string" )
-     {
--//--------------------------- choosen methods -----------------------
-+//--------------------------- chosen methods -----------------------
-       if ( (#[i]=="isprim") or (#[i]=="isPrim") )
-       {decomp = 0;}
- 
-@@ -5722,7 +5722,7 @@
-      }
-    }
- 
--   //--------------------------- choosen methods -----------------------
-+   //--------------------------- chosen methods -----------------------
-    // "withGens": computes algebra generators for each irreducible component
-    // ### the extra code for withGens should be incorporated in the general case
- 
---- a/Singular/LIB/grobcov.lib
-+++ b/Singular/LIB/grobcov.lib
-@@ -2890,7 +2890,7 @@
- // Output: S=(w_1,..,w_j)
- //    where the w_l=(n_l1,..,n_ls) are intvec of length size(L), where
- //    n_lt fixes which element of (v_t1,..,v_tk_t) is to be
--//    choosen to form the tth (Q,P) for the lth element of the sheaf
-+//    chosen to form the tth (Q,P) for the lth element of the sheaf
- //    representing the I-regular function.
- // The selection is done to obtian the minimal number of elements
- //    of the sheaf that specializes to non-null everywhere.
---- a/kernel/GBEngine/kstd1.cc
-+++ b/kernel/GBEngine/kstd1.cc
-@@ -2896,7 +2896,7 @@
-         message(strat->P.pFDeg(),
-                 &olddeg,&reduc,strat, red_result);
- 
--      /* reduction of the element choosen from L */
-+      /* reduction of the element chosen from L */
-       red_result = strat->red(&strat->P,strat);
-     }
- 
---- a/kernel/GBEngine/kstd2.cc
-+++ b/kernel/GBEngine/kstd2.cc
-@@ -1472,7 +1472,7 @@
-         message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
-                 &olddeg,&reduc,strat, red_result);
- 
--      /* reduction of the element choosen from L */
-+      /* reduction of the element chosen from L */
-       red_result = strat->red(&strat->P,strat);
-       if (errorreported)  break;
-     }
-@@ -1835,7 +1835,7 @@
-     /* picks the last element from the lazyset L */
-     strat->P = strat->L[strat->Ll];
-     strat->Ll--;
--    /* reduction of the element choosen from L */
-+    /* reduction of the element chosen from L */
- 
-     if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
-       //#if 1
-@@ -2676,7 +2676,7 @@
-       Print("Poly before red: ");
-       pWrite(strat->P.p);
- #endif
--      /* complete reduction of the element choosen from L */
-+      /* complete reduction of the element chosen from L */
-       red_result = strat->red2(&strat->P,strat);
-       if (errorreported)  break;
-     }
-@@ -3011,7 +3011,7 @@
-         message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
-                 &olddeg,&reduc,strat, red_result);
- 
--      /* reduction of the element choosen from L */
-+      /* reduction of the element chosen from L */
-       red_result = strat->red(&strat->P,strat);
-     }
- 
---- a/kernel/GBEngine/kstdfac.cc
-+++ b/kernel/GBEngine/kstdfac.cc
-@@ -588,7 +588,7 @@
-       if (TEST_OPT_PROT)
-         message(currRing->pFDeg(strat->P.p,currRing),&olddeg,&reduc,strat, red_result);
-     }
--    /* reduction of the element choosen from L */
-+    /* reduction of the element chosen from L */
-     kTest_TS(strat);
-     red_result = strat->red(&strat->P,strat);
-     if (strat->P.p != NULL)
---- a/kernel/GBEngine/sca.cc
-+++ b/kernel/GBEngine/sca.cc
-@@ -614,7 +614,7 @@
-       message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
-               &olddeg,&reduc,strat, red_result);
- 
--    // reduction of the element choosen from L
-+    // reduction of the element chosen from L
-     red_result = strat->red(&strat->P,strat);
- 
- 
-@@ -742,7 +742,7 @@
- 
-         h.PrepareRed(strat->use_buckets);
- 
--        // reduction of the element choosen from L(?)
-+        // reduction of the element chosen from L(?)
-         red_result = strat->red(&h,strat);
- 
-         // reduction to non-zero new poly
---- a/kernel/numeric/mpr_base.cc
-+++ b/kernel/numeric/mpr_base.cc
-@@ -1457,7 +1457,7 @@
-       if ( epos == 0 )
-       {
-         // this can happen, if the shift vektor or the lift funktions
--        // are not generically choosen.
-+        // are not generically chosen.
-         Werror("resMatrixSparse::createMatrix: Found exponent not in E, id %d, set [%d, %d]!",
-                i,(*E)[i]->rc.set,(*E)[i]->rc.pnt);
-         return i;
-@@ -2703,7 +2703,7 @@
-     resMat= new resMatrixDense( gls );
-     break;
-   default:
--    WerrorS("uResultant::uResultant: Unknown resultant matrix type choosen!");
-+    WerrorS("uResultant::uResultant: Unknown chosen resultant matrix type!");
-   }
- }
- 
-@@ -2734,7 +2734,7 @@
-     }
-     break;
-   default:
--    WerrorS("uResultant::extendIdeal: Unknown resultant matrix type choosen!");
-+    WerrorS("uResultant::extendIdeal: Unknown chosen resultant matrix type!");
-   }
- 
-   return( newGls );
---- a/Singular/fglm.cc
-+++ b/Singular/fglm.cc
-@@ -171,7 +171,7 @@
-     for ( k= npar-1; (k >= 0) && (state == FglmOk); k-- )
-         if ( pperm[k] >= 0 )
-         {
--            WerrorS( "paramater names do not agree" );
-+            WerrorS( "parameter names do not agree" );
-             state= FglmIncompatibleRings;
-         }
-     if (pperm != NULL) // OB: ????
---- a/kernel/numeric/mpr_inout.cc
-+++ b/kernel/numeric/mpr_inout.cc
-@@ -62,7 +62,7 @@
-   switch (state)
-   {
-   case mprWrongRType:
--    WerrorS("Unknown resultant matrix type choosen!");
-+    WerrorS("Unknown chosen resultant matrix type!");
-     break;
-   case mprHasOne:
-     Werror("One element of the ideal %s is constant!",name);
---- a/kernel/groebner_walk/walkProc.cc
-+++ b/kernel/groebner_walk/walkProc.cc
-@@ -117,7 +117,7 @@
-     for ( k= npar-1; (k >= 0) && (state == WalkOk); k-- )
-         if ( pperm[k] >= 0 )
-         {
--            WerrorS( "paramater names do not agree" );
-+            WerrorS( "parameter names do not agree" );
-             state= WalkIncompatibleRings;
-         }
- 
---- a/libpolys/coeffs/longrat.cc
-+++ b/libpolys/coeffs/longrat.cc
-@@ -3102,7 +3102,7 @@
- BOOLEAN nlCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
- {
-   /* test, if r is an instance of nInitCoeffs(n,parameter) */
--  /* if paramater is not needed */
-+  /* if parameter is not needed */
-   if (n==r->type)
-   {
-     if ((p==NULL)&&(r->cfDiv==nlDiv)) return TRUE;
---- a/libpolys/coeffs/numbers.cc
-+++ b/libpolys/coeffs/numbers.cc
-@@ -276,7 +276,7 @@
- static BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *)
- {
-   /* test, if r is an instance of nInitCoeffs(n,parameter) */
--  /* if paramater is not needed */
-+  /* if parameter is not needed */
-   return (n==r->type);
- }
- 
---- a/kernel/fast_mult.cc
-+++ b/kernel/fast_mult.cc
-@@ -591,7 +591,7 @@
-   if (n<=1)
-     Werror("not implemented for so small n, recursion fails");//should be length(f)
-    if (pLength(f)<=1)
--    Werror("not implemented for so small lenght of f, recursion fails");
-+    Werror("not implemented for so small length of f, recursion fails");
-   //  number null_number=n_Init(0,r);
-   number* facult=(number*) omAlloc((n+1)*sizeof(number));
-   facult[0]=n_Init(1,r->cf);
---- a/libpolys/coeffs/Enumerator.h
-+++ b/libpolys/coeffs/Enumerator.h
-@@ -57,7 +57,7 @@
-     virtual bool IsValid() const = 0;
- 
-   private:
--    /// disable copy constructor and assigment operator
-+    /// disable copy constructor and assignment operator
-     IBaseEnumerator(const IBaseEnumerator&);
-     void operator=(const IBaseEnumerator&);
- 
-@@ -168,7 +168,7 @@
- 
- /** @class AIterator
-  *
-- * An abstract iterator with virtualized assigment operator and
-+ * An abstract iterator with virtualized assignment operator and
-  * constructors.
-  *
-  * Abstract API for iterators that should work with STL and BOOST.
---- a/IntegerProgramming/binomial.cc
-+++ b/IntegerProgramming/binomial.cc
-@@ -300,7 +300,7 @@
-     if(_number_of_variables<=0)
-     {
-       cerr<<"\nWARNING: binomial& binomial::operator=(const binomial&):\n"
--        "assigment from corrupt binomial"<<endl;
-+        "assignment from corrupt binomial"<<endl;
-       exponent_vector=NULL;
-       return (*this);
-     }
---- a/IntegerProgramming/binomial.h
-+++ b/IntegerProgramming/binomial.h
-@@ -114,7 +114,7 @@
- 
- 
- 
--// assigment and access operators
-+// assignment and access operators
- 
-   binomial& operator=(const binomial&);
-   // assignment operator with memory control
---- a/IntegerProgramming/list.cc
-+++ b/IntegerProgramming/list.cc
-@@ -962,7 +962,7 @@
- 
- 
- 
--////////////////////////// assigment ///////////////////////////////////////
-+////////////////////////// assignment ///////////////////////////////////////
- 
- 
- 
---- a/Singular/LIB/surf.lib
-+++ b/Singular/LIB/surf.lib
-@@ -176,7 +176,7 @@
-   {
-     surf_call = "singularsurf ";
-     surf_call = surf_call + l + " >/dev/null 2>&1";
--    "Close window to exit from `singularurf`.";
-+    "Close window to exit from `singularsurf`.";
- 
-     i = system("sh", surf_call);
-     if (i != 0)
diff --git a/debian/patches/upstream-spelling-error-in-source.patch b/debian/patches/upstream-spelling-error-in-source.patch
new file mode 100644
index 0000000..6fc871c
--- /dev/null
+++ b/debian/patches/upstream-spelling-error-in-source.patch
@@ -0,0 +1,21 @@
+Description: source typo
+ Correct spelling error as reported by lintian in some binraries;
+ meant to silence lintian and eventually to be submitted to the
+ upstream maintainer.
+Origin: debian
+Forwarded: https://github.com/Singular/Sources/pull/723
+Comment: spelling-error-in-binary
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-08-03
+
+--- a/Singular/feOptTab.h
++++ b/Singular/feOptTab.h
+@@ -105,7 +105,7 @@
+ 
+ 
+   {"allow-net",         no_argument,        LONG_OPTION_RETURN,
+-   0,          "Allow to fetch (html) help pages from the net",                feOptBool,    0,      0},
++   0,          "Allow one to fetch (html) help pages from the net",                feOptBool,    0,      0},
+ 
+   {"browser",           required_argument,  LONG_OPTION_RETURN,
+    "BROWSER",  "Display help in BROWSER (see help.cnf)",       feOptString, 0,   0},

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/singular.git



More information about the debian-science-commits mailing list