[SCM] admesh - a tool for processing triangulated solid meshes branch, master, updated. debian/0.95-14-12-gcff9d65

Anton Gladky gladky.anton at gmail.com
Wed Jul 3 18:12:43 UTC 2013


The following commit has been merged in the master branch:
commit bbe19160a730c0e2e31697ab6f312263a45d5e81
Author: Anton Gladky <gladky.anton at gmail.com>
Date:   Wed Jul 3 18:09:23 2013 +0200

    Imported Upstream version 0.96

diff --git a/ADMESH.DOC b/ADMESH.DOC
index 044a443..3ba7be3 100644
--- a/ADMESH.DOC
+++ b/ADMESH.DOC
@@ -347,10 +347,10 @@ ADMesh Output
 After ADMesh has processed a mesh, it prints out a page of information about
 that mesh.  The output looks like the following:
 
-================= Results produced by ADMesh version 0.95 =================
+================= Results produced by ADMesh version 0.96 =================
 Input file         : sphere.stl
 File type          : Binary STL file
-Header             : Processed by ADMesh version 0.95
+Header             : Processed by ADMesh version 0.96
 ============== Size ==============
 Min X = -1.334557, Max X = 1.370952
 Min Y = -1.377953, Max Y = 1.377230
@@ -384,7 +384,7 @@ File type          : Binary STL file
    file and ASCII STL file.  ADMesh automatically detect the type of input
    file.
 
-Header             : Processed by ADMesh version 0.95
+Header             : Processed by ADMesh version 0.96
    The first 80 characters of the STL file.  The first 80 bytes of a binary
    STL file or the first line of an ASCII STL file can contain some text.
    Usually, the CAD system that has created that file, or the last program
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..8d3101f
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Anthony Martin <amartin at engr.csulb.edu>, the full source code; 1995, 1996
+Andy Doucette <andy at printathing.com>, bug-fixes; 2013
+Anton Gladky <gladk at debian.org>, switch to cmake; 2013
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..64f7b62
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,19 @@
+PROJECT(admesh C)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+INCLUDE(GNUInstallDirs)
+#===========================================================
+IF(NOT(CMAKE_C_FLAGS))
+  SET(CMAKE_BUILD_TYPE Release)
+  SET(CMAKE_C_FLAGS  "-Wall -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2")
+ENDIF (NOT(CMAKE_C_FLAGS))
+#===========================================================
+FIND_LIBRARY(M_LIB m)
+#===========================================================
+ADD_EXECUTABLE(admesh admesh.c connect.c stl_io.c stlinit.c util.c normals.c shared.c)
+TARGET_LINK_LIBRARIES(admesh ${M_LIB})
+INSTALL(TARGETS admesh DESTINATION ${CMAKE_INSTALL_BINDIR})
+#===========================================================
+INSTALL(FILES ADMESH.DOC block.stl DESTINATION ${CMAKE_INSTALL_DOCDIR})
+INSTALL(FILES admesh.1 DESTINATION ${CMAKE_INSTALL_MANDIR})
+#===========================================================
diff --git a/ChangeLog b/ChangeLog
index 31c0969..6988290 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,42 +1,61 @@
 Tue Aug  1 03:25:46 PDT 1995  Anthony Martin <amartin at engr.csulb.edu>
 
         *  Fix it so that big endian systems write a little endian file
-	Also, write null characters after the label in stl_write_binary
+           Also, write null characters after the label in stl_write_binary
 
 Tue Aug  1 03:25:46 PDT 1995  Anthony Martin <amartin at engr.csulb.edu>
 
         *  Change stl_fill_holes so that duplicate facets are not likely
-	to be generated.  Should improve quality of filled holes.
+           to be generated.  Should improve quality of filled holes.
 
 Wed Aug  2 16:56:03 PDT 1995  Anthony Martin <amartin at engr.csulb.edu>
 
-	*  Add support for generating shared vertices
-	*  Move fclose(stl->fp) to stl_open()
+        *  Add support for generating shared vertices
+        *  Move fclose(stl->fp) to stl_open()
 
 Tue Oct 31 13:56:25 PST 1995  Anthony Martin <amartin at engr.csulb.edu>
 
-	*  Don't use area any more to see whether or not the normal should
-	be calculated.  Just go ahead and calculate the normal, and let the
-	code in stl_normalize vector() take care of the case of a normal 
-	with zero area.
-	*  Changes call to stl_check_normal_vector() in stl_add_facet() so
-	that it doesn't check the normal vector after it adds it.  Just
-	caused accounting error for normals fixed.
+        *  Don't use area any more to see whether or not the normal should
+           be calculated.  Just go ahead and calculate the normal, and let the
+           code in stl_normalize vector() take care of the case of a normal 
+           with zero area.
+        *  Changes call to stl_check_normal_vector() in stl_add_facet() so
+           that it doesn't check the normal vector after it adds it.  Just
+           caused accounting error for normals fixed.
 
 Wed Nov  1 08:39:17 PST 1995  Anthony Martin <amartin at engr.csulb.edu>
         *  Initialize normal vector to 0,0,0 when a new facet is added.
 
 Sat Jan 20 23:43:01 PST 1996  Anthony Martin <amartin at engr.csulb.edu>
         *  stlinit.c  Initialize pointers to NULL.  Check whether they have
-	been allocated before free()ing them.  Duh.
-	
+           been allocated before free()ing them.  Duh.
+
 Thu Jan 25 16:02:57 PST 1996 Anthony Martin <amartin at engr.csulb.edu>
         *  shared.c Add   fclose(fp); to stl_write_off().
-	*  stl_io.c Add dxf write capability
-	*  shared.c Add vrml write capability
+        *  stl_io.c Add dxf write capability
+        *  shared.c Add vrml write capability
 
 Fri Jul 26 11:31:50 PDT 1996 Anthony Martin <amartin at engr.csulb.edu>
-	*  Update normals after rotation
-	*  Add code to calculate the volume of the part
+        *  Update normals after rotation
+        *  Add code to calculate the volume of the part
+
+Wed, 03 Jul 2013 16:57:55 +0200 Anton Gladky <gladk at debian.org>
+      Andy Doucette (2):
+            Fix merge-command.
+            Fix translate-command.
+
+      Anton Gladky (11):
+            Add cmake-support.
+            Remove Makefile and configure-files.
+            Remove embedded getopt-files.
+            Install block.stl.
+            Update doc-files.
+            Fix compilation warnings.
+            Add version.h.
+            Close file properly. Import patch from Debian.
+            Set version 0.96
+            Generate and install manpage. Used help2man.
+            Update version number in README and Doc
+
 
 
diff --git a/INSTALL b/INSTALL
index 77190dc..d697e02 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,19 +1,20 @@
-To install ADMesh, you will need a system with a c compiler.
+To install ADMesh, you will need a system with a c compiler and cmake.
 Do the following:
 
-1.  Get the file admesh-0.95.tar.gz
-2.  Extract the archive.  i.e. type something like the following:
-         tar -zxvf admesh-0.95.tar.gz
-	 or if that doesn't work, try the following:
-         cat admesh-0.95.tar.gz | gzip -d | tar xvf -
-    The source files will be extracted into a directory called admesh-0.95
-3.  cd admesh-0.95
-4.  type the following:
-         ./configure
-	 make
+1. Get the file admesh-XXX.tar.gz
+2. Extract the archive.  i.e. type something like the following:
+      tar -zxvf admesh-XXX.tar.gz
+   The source files will be extracted into a directory
+3. Create build directory:
+      mkdir build
+      cd build
+4. Type the following:
+      cmake -DCMAKE_INSTALL_PREFIX=/INSTALL_PATH/FOR/ADMESH ./../ADMESH_SRC_DIR
+      make
+      make install
 
-That should do it.  You should have an executable file called admesh.  There
-is only the one stand-alone executable and there are no configuration files
-or environment variables to be set.  I don't believe that that the included
-configure script will run under MS-DOS or Windows, so you will need to edit
-the included Makefile.in file by hand to compile it.
+That should do it.  You should have an executable file called admesh in:  
+  /INSTALL_PATH/FOR/ADMESH/bin/admesh
+
+To regenerate manpage for admesh, use help2man tool:
+help2man admessh --name="a program for processing triangulated solid meshes" > admesh.1
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index f764f7a..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-
-SHELL = /bin/sh
-CC = @CC@
-CFLAGS = -I at srcdir@ @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-.SUFFIXES:
-.SUFFIXES: .c .o
-
-OBJ = admesh.o connect.o stl_io.o stlinit.o util.o normals.o shared.o @LIBOBJS@
-
-all: @srcdir@/configure $(OBJ)
-	$(CC) @LDFLAGS@ -o admesh $(OBJ) @LIBS@
-
-clean:
-	rm -f $(OBJ) admesh core admesh.core core.admesh
-	rm -f config.h config.log config.status\
-	      config.cache Makefile
-
diff --git a/README b/README
index 3235d29..99b11e4 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-                     ADMesh version 0.95
+                     ADMesh version 0.96
                     ********************
 
 ADMesh is a program for processing triangulated solid meshes. Currently,
@@ -27,10 +27,10 @@ Features:
 
  ** ADMesh outputs the following statistics after processing:
 
-================= Results produced by ADMesh version 0.95 =================
+================= Results produced by ADMesh version 0.96 =================
 Input file         : sphere.stl
 File type          : Binary STL file
-Header             : Processed by ADMesh version 0.95
+Header             : Processed by ADMesh version 0.96
 ============== Size ==============
 Min X = -1.334557, Max X = 1.370952
 Min Y = -1.377953, Max Y = 1.377230
@@ -95,10 +95,10 @@ of the GNU General Public License (GPL).  It is NOT in the public domain and
 its source code cannot be used in commercial software.  Details of the GPL
 are in the file COPYING that comes with the ADMesh software package.
 
-ADMesh can be obtained via http from:
-  http://www.engr.csulb.edu/~amartin/admesh/admesh-0.95.tar.gz
-or visit my home page at:
-  http://www.engr.csulb.edu/~amartin
+ADMesh can be obtained on Launchpad from:
+  https://launchpad.net/admesh
+or from GitHub:
+  https://github.com/gladk/admesh
 
 Send questions, comments, suggestions, etc. to me at the following address.
 <amartin at engr.csulb.edu>
diff --git a/admesh.1 b/admesh.1
new file mode 100644
index 0000000..e9309e0
--- /dev/null
+++ b/admesh.1
@@ -0,0 +1,107 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.43.3.
+.TH ADMESH "1" "July 2013" "ADMesh - version 0.96" "User Commands"
+.SH NAME
+ADMesh \- a program for processing triangulated solid meshes
+.SH SYNOPSIS
+.B admesh
+[\fIOPTION\fR]... \fIfile\fR
+.SH DESCRIPTION
+ADMesh version 0.96
+Copyright \(co 1995, 1996  Anthony D. Martin
+.TP
+\fB\-\-x\-rotate\fR=\fIangle\fR
+Rotate CCW about x\-axis by angle degrees
+.TP
+\fB\-\-y\-rotate\fR=\fIangle\fR
+Rotate CCW about y\-axis by angle degrees
+.TP
+\fB\-\-z\-rotate\fR=\fIangle\fR
+Rotate CCW about z\-axis by angle degrees
+.TP
+\fB\-\-xy\-mirror\fR
+Mirror about the xy plane
+.TP
+\fB\-\-yz\-mirror\fR
+Mirror about the yz plane
+.TP
+\fB\-\-xz\-mirror\fR
+Mirror about the xz plane
+.TP
+\fB\-\-scale\fR=\fIfactor\fR
+Scale the file by factor (multiply by factor)
+.TP
+\fB\-\-translate\fR=\fIx\fR,y,z
+Translate the file to x, y, and z
+.TP
+\fB\-\-merge\fR=\fIname\fR
+Merge file called name with input file
+.TP
+\fB\-e\fR, \fB\-\-exact\fR
+Only check for perfectly matched edges
+.TP
+\fB\-n\fR, \fB\-\-nearby\fR
+Find and connect nearby facets. Correct bad facets
+.TP
+\fB\-t\fR, \fB\-\-tolerance\fR=\fItol\fR
+Initial tolerance to use for nearby check = tol
+.TP
+\fB\-i\fR, \fB\-\-iterations\fR=\fIi\fR
+Number of iterations for nearby check = i
+.TP
+\fB\-m\fR, \fB\-\-increment\fR=\fIinc\fR
+Amount to increment tolerance after iteration=inc
+.HP
+\fB\-u\fR, \fB\-\-remove\-unconnected\fR Remove facets that have 0 neighbors
+.TP
+\fB\-f\fR, \fB\-\-fill\-holes\fR
+Add facets to fill holes
+.TP
+\fB\-d\fR, \fB\-\-normal\-directions\fR
+Check and fix direction of normals(ie cw, ccw)
+.TP
+\fB\-\-reverse\-all\fR
+Reverse the directions of all facets and normals
+.TP
+\fB\-v\fR, \fB\-\-normal\-values\fR
+Check and fix normal values
+.TP
+\fB\-c\fR, \fB\-\-no\-check\fR
+Don't do any check on input file
+.TP
+\fB\-b\fR, \fB\-\-write\-binary\-stl\fR=\fIname\fR
+Output a binary STL file called name
+.TP
+\fB\-a\fR, \fB\-\-write\-ascii\-stl\fR=\fIname\fR
+Output an ascii STL file called name
+.TP
+\fB\-\-write\-off\fR=\fIname\fR
+Output a Geomview OFF format file called name
+.TP
+\fB\-\-write\-dxf\fR=\fIname\fR
+Output a DXF format file called name
+.TP
+\fB\-\-write\-vrml\fR=\fIname\fR
+Output a VRML format file called name
+.TP
+\fB\-\-help\fR
+Display this help and exit
+.TP
+\fB\-\-version\fR
+Output version information and exit
+.PP
+The functions are executed in the same order as the options shown here.
+So check here to find what happens if, for example, \fB\-\-translate\fR and \fB\-\-merge\fR
+options are specified together.  The order of the options specified on the
+command line is not important.
+.SH "SEE ALSO"
+The full documentation for
+.B ADMesh
+is maintained as a Texinfo manual.  If the
+.B info
+and
+.B ADMesh
+programs are properly installed at your site, the command
+.IP
+.B info ADMesh
+.PP
+should give you access to the complete manual.
diff --git a/admesh.c b/admesh.c
index 2ad1398..1ce2951 100644
--- a/admesh.c
+++ b/admesh.c
@@ -24,11 +24,11 @@
 
 
 #include "stl.h"
+#include "version.h"
 
 static void usage(int status, char *program_name);
 
-void
-main(int argc, char **argv)
+int main(int argc, char **argv)
 {
   stl_file stl_in;
   int      i;
@@ -240,7 +240,7 @@ main(int argc, char **argv)
     }
   if(version_flag)
     {
-      printf("ADMesh - version 0.95\n");
+      printf("ADMesh - version %g\n",VERSION);
       exit(0);
     }
   
@@ -255,9 +255,9 @@ main(int argc, char **argv)
     }
 
   printf("\
-ADMesh version 0.95, Copyright (C) 1995, 1996 Anthony D. Martin\n\
+ADMesh version %g, Copyright (C) 1995, 1996 Anthony D. Martin\n\
 ADMesh comes with NO WARRANTY.  This is free software, and you are welcome to\n\
-redistribute it under certain conditions.  See the file COPYING for details.\n");
+redistribute it under certain conditions.  See the file COPYING for details.\n",VERSION);
 
   
   printf("Opening %s\n", input_file);
@@ -307,6 +307,7 @@ redistribute it under certain conditions.  See the file COPYING for details.\n")
   if(merge_flag)
     {
       printf("Merging %s with %s\n", input_file, merge_name);
+      //Open the file and add the contents to stl_in:
       stl_open_merge(&stl_in, merge_name);
     }
   
@@ -433,7 +434,9 @@ All facets connected.  No further nearby check necessary.\n");
   if(write_dxf_flag)
     {
       printf("Writing DXF file %s\n", dxf_name);
-      stl_write_dxf(&stl_in, dxf_name, "Created by ADMesh version 0.95");
+      char *tmp_msg = NULL;
+      sprintf(tmp_msg,"Created by ADMesh version %g",VERSION);
+      stl_write_dxf(&stl_in, dxf_name, tmp_msg);
     }
 
   if(write_vrml_flag)
@@ -445,15 +448,19 @@ All facets connected.  No further nearby check necessary.\n");
   if(write_ascii_stl_flag)
     {
       printf("Writing ascii file %s\n", ascii_name);
-      stl_write_ascii(&stl_in, ascii_name, 
-		      "Processed by ADMesh version 0.95");
+
+      char *tmp_msg = NULL;
+      sprintf(tmp_msg,"Processed by ADMesh version %g",VERSION);
+      stl_write_ascii(&stl_in, ascii_name, tmp_msg);
     }
   
   if(write_binary_stl_flag)
     {
       printf("Writing binary file %s\n", binary_name);
-      stl_write_binary(&stl_in, binary_name,
-		       "Processed by ADMesh version 0.95");
+      
+      char *tmp_msg = NULL;
+      sprintf(tmp_msg,"Processed by ADMesh version %g",VERSION);
+      stl_write_binary(&stl_in, binary_name, tmp_msg);
     }
   
   if(exact_flag)
@@ -476,9 +483,9 @@ usage(int status, char *program_name)
   else
     {
       printf("\n\
-ADMesh version 0.95\n\
+ADMesh version %g\n\
 Copyright (C) 1995, 1996  Anthony D. Martin\n\
-Usage: %s [OPTION]... file\n", program_name);
+Usage: %s [OPTION]... file\n", VERSION, program_name);
       printf("\n\
      --x-rotate=angle     Rotate CCW about x-axis by angle degrees\n\
      --y-rotate=angle     Rotate CCW about y-axis by angle degrees\n\
diff --git a/configure b/configure
deleted file mode 100755
index cd6de72..0000000
--- a/configure
+++ /dev/null
@@ -1,752 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.4 
-# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Initialize some other variables.
-subdirs=
-
-ac_prev=
-for ac_option
-do
-
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval "$ac_prev=\$ac_option"
-    ac_prev=
-    continue
-  fi
-
-  case "$ac_option" in
-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) ac_optarg= ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case "$ac_option" in
-
-  -build | --build | --buil | --bui | --bu | --b)
-    ac_prev=build ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
-    build="$ac_optarg" ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file="$ac_optarg" ;;
-
-  -disable-* | --disable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    eval "enable_${ac_feature}=no" ;;
-
-  -enable-* | --enable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_${ac_feature}='$ac_optarg'" ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix="$ac_optarg" ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he)
-    # Omit some internal or obsolete options to make the list less imposing.
-    # This message is too long to be a string in the A/UX 3.1 sh.
-    cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
-  --cache-file=FILE       cache test results in FILE
-  --help                  print this message
-  --no-create             do not create output files
-  --quiet, --silent       do not print \`checking...' messages
-  --version               print the version of autoconf that created configure
-Directory and file names:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
-                          [same as prefix]
-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-  --program-prefix=PREFIX prepend PREFIX to installed program names
-  --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
-Host type:
-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-  --host=HOST             configure for HOST [guessed]
-  --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
---enable and --with options recognized:$ac_help
-EOF
-    exit 0 ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host="$ac_optarg" ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix="$ac_optarg" ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix="$ac_optarg" ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix="$ac_optarg" ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name="$ac_optarg" ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site="$ac_optarg" ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir="$ac_optarg" ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target="$ac_optarg" ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.4"
-    exit 0 ;;
-
-  -with-* | --with-*)
-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_${ac_package}='$ac_optarg'" ;;
-
-  -without-* | --without-*)
-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval "with_${ac_package}=no" ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes="$ac_optarg" ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries="$ac_optarg" ;;
-
-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
-    ;;
-
-  *) 
-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-      echo "configure: warning: $ac_option: invalid host type" 1>&2
-    fi
-    if test "x$nonopt" != xNONE; then
-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-    fi
-    nonopt="$ac_option"
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
-  exec 6>/dev/null
-else
-  exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
-  case "$ac_arg" in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
-  esac
-done
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=stl.h
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
-  srcdir=$ac_confdir
-  if test ! -r $srcdir/$ac_unique_file; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
-  else
-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
-  fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
-fi
-for ac_site_file in $CONFIG_SITE; do
-  if test -r "$ac_site_file"; then
-    echo "loading site script $ac_site_file"
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  echo "loading cache $cache_file"
-  . $cache_file
-else
-  echo "creating cache $cache_file"
-  > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-  # Stardent Vistra SVR4 grep lacks -e, says ghazi at caip.rutgers.edu.
-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-    ac_n= ac_c='
-' ac_t='	'
-  else
-    ac_n=-n ac_c= ac_t=
-  fi
-else
-  ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
-#endif
-EOF
-if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
-  ac_cv_prog_gcc=yes
-else
-  ac_cv_prog_gcc=no
-fi
-fi
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
-  if test "${CFLAGS+set}" != set; then
-    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-  ac_cv_prog_gcc_g=yes
-else
-  ac_cv_prog_gcc_g=no
-fi
-rm -f conftest*
-
-fi
-    echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
-    if test $ac_cv_prog_gcc_g = yes; then
-      CFLAGS="-g -O"
-    else
-      CFLAGS="-O"
-    fi
-  fi
-else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-
-if test x$GCC = xyes; then
-        CFLAGS2="-O2 -Wall -Wno-implicit"
-else
-        CFLAGS2="-O"
-fi
-
-echo $ac_n "checking for -lm""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_m'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lm  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 490 "configure"
-#include "confdefs.h"
-
-int main() { return 0; }
-int t() {
-main()
-; return 0; }
-EOF
-if eval $ac_link; then
-  rm -rf conftest*
-  eval "ac_cv_lib_m=yes"
-else
-  rm -rf conftest*
-  eval "ac_cv_lib_m=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'m`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo m | tr '[a-z]' '[A-Z]'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lm $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-
-
-echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 530 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char getopt_long(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-char getopt_long(); 
-
-int main() { return 0; }
-int t() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
-choke me
-#else
-getopt_long();
-#endif
-
-; return 0; }
-EOF
-if eval $ac_link; then
-  rm -rf conftest*
-  eval "ac_cv_func_getopt_long=yes"
-else
-  rm -rf conftest*
-  eval "ac_cv_func_getopt_long=no"
-fi
-rm -f conftest*
-
-fi
-if eval "test \"`echo '$ac_cv_func_'getopt_long`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  :
-else
-  echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS getopt.o getopt1.o"
-fi
-
-
-
-CFLAGS="$CFLAGS $CFLAGS2"
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
-  >> confcache
-if cmp -s $cache_file confcache; then
-  :
-else
-  if test -w $cache_file; then
-    echo "updating cache $cache_file"
-    cat confcache > $cache_file
-  else
-    echo "not updating unwritable cache $cache_file"
-  fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
-s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
-  case "\$ac_option" in
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.4"
-    exit 0 ;;
-  -help | --help | --hel | --he | --h)
-    echo "\$ac_cs_usage"; exit 0 ;;
-  *) echo "\$ac_cs_usage"; exit 1 ;;
-  esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-
-# Protect against being on the right side of a sed subst in config.status. 
-sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
- s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
-$ac_vpsub
-$extrasub
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@CC@%$CC%g
-s%@LIBOBJS@%$LIBOBJS%g
-
-CEOF
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
-  esac
-
-  # Adjust relative srcdir, etc. for subdirectories.
-
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-    test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dir_suffix= ac_dots=
-  fi
-
-  case "$ac_given_srcdir" in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
-  *) # Relative path.
-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-  esac
-
-  echo creating "$ac_file"
-  rm -f "$ac_file"
-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-  case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
-  *) ac_comsub= ;;
-  esac
-  sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
-fi; done
-rm -f conftest.subs
-
-
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/configure.in b/configure.in
deleted file mode 100644
index d31ce28..0000000
--- a/configure.in
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(stl.h)
-
-dnl Checks for programs.
-AC_PROG_CC
-
-dnl Some cc's allow prototypes, etc.  Should check them individually
-if test x$GCC = xyes; then
-        CFLAGS2="-O2 -Wall -Wno-implicit"
-else
-        CFLAGS2="-O"
-fi
-
-dnl Checks for libraries.
-dnl Replace `main' with a function in -lm:
-AC_CHECK_LIB(m, main)
-
-dnl Checks for header files.
-dnl AC_HEADER_STDC
-
-dnl Checks for library functions.
-dnl AC_FUNC_MEMCMP
-
-AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"])
-AC_SUBST(LIBOBJS)dnl
-
-
-CFLAGS="$CFLAGS $CFLAGS2"
-
-AC_OUTPUT(Makefile)
diff --git a/connect.c b/connect.c
index 671ee79..9690c51 100644
--- a/connect.c
+++ b/connect.c
@@ -82,6 +82,7 @@ stl_check_facets_exact(stl_file *stl)
     {
       facet = stl->facet_start[i];
 
+      //If any two of the three vertices are found to be exactally the same, call them degenerate and remove the facet.
       if(   !memcmp(&facet.vertex[0], &facet.vertex[1], 
 		    sizeof(stl_vertex))
 	 || !memcmp(&facet.vertex[1], &facet.vertex[2], 
diff --git a/getopt.c b/getopt.c
deleted file mode 100644
index b539dc2..0000000
--- a/getopt.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/* Getopt for GNU.
-   NOTE: getopt is now part of the C library, so if you don't know what
-   "Keep this file name-space clean" means, talk to roland at gnu.ai.mit.edu
-   before changing it!
-
-   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
-   	Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
-

-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
-   Ditto for AIX 3.2 and <stdlib.h>.  */
-#ifndef _NO_PROTO
-#define _NO_PROTO
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if !defined (__STDC__) || !__STDC__
-/* This is a separate conditional since some stdc systems
-   reject `defined (const)'.  */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef	__GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
-   contain conflicting prototypes for getopt.  */
-#include <stdlib.h>
-#endif	/* GNU C library.  */
-
-/* This is for other GNU distributions with internationalized messages.
-   The GNU C Library itself does not yet support such messages.  */
-#if HAVE_LIBINTL_H
-# include <libintl.h>
-#else
-# define gettext(msgid) (msgid)
-#endif
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
-   but it behaves differently for the user, since it allows the user
-   to intersperse the options with the other arguments.
-
-   As `getopt' works, it permutes the elements of ARGV so that,
-   when it is done, all the options precede everything else.  Thus
-   all application programs are extended to handle flexible argument order.
-
-   Setting the environment variable POSIXLY_CORRECT disables permutation.
-   Then the behavior is completely standard.
-
-   GNU application programs can use a third alternative mode in which
-   they can distinguish the relative order of options and other arguments.  */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-char *optarg = NULL;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
-
-   On entry to `getopt', zero means this is the first call; initialize.
-
-   When `getopt' returns EOF, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, `optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-/* XXX 1003.2 says this must be 1 before any call.  */
-int optind = 0;
-
-/* The next char to be scanned in the option-element
-   in which the last option character we returned was found.
-   This allows us to pick up the scan where we left off.
-
-   If this is zero, or a null string, it means resume the scan
-   by advancing to the next ARGV-element.  */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
-   for unrecognized options.  */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
-   This must be initialized on some systems to avoid linking in the
-   system's own getopt implementation.  */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
-   If the caller did not specify anything,
-   the default is REQUIRE_ORDER if the environment variable
-   POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
-   REQUIRE_ORDER means don't recognize them as options;
-   stop option processing when the first non-option is seen.
-   This is what Unix does.
-   This mode of operation is selected by either setting the environment
-   variable POSIXLY_CORRECT, or using `+' as the first character
-   of the list of option characters.
-
-   PERMUTE is the default.  We permute the contents of ARGV as we scan,
-   so that eventually all the non-options are at the end.  This allows options
-   to be given in any order, even with programs that were not written to
-   expect this.
-
-   RETURN_IN_ORDER is an option available to programs that were written
-   to expect options and other ARGV-elements in any order and that care about
-   the ordering of the two.  We describe each non-option ARGV-element
-   as if it were the argument of an option with character code 1.
-   Using `-' as the first character of the list of option characters
-   selects this mode of operation.
-
-   The special argument `--' forces an end of option-scanning regardless
-   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-   `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
-
-static enum
-{
-  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable.  */
-static char *posixly_correct;
-

-#ifdef	__GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
-   because there are many ways it can cause trouble.
-   On some systems, it contains special magic macros that don't work
-   in GCC.  */
-#include <string.h>
-#define	my_index	strchr
-#else
-
-/* Avoid depending on library functions or files
-   whose names are inconsistent.  */
-
-char *getenv ();
-
-static char *
-my_index (str, chr)
-     const char *str;
-     int chr;
-{
-  while (*str)
-    {
-      if (*str == chr)
-	return (char *) str;
-      str++;
-    }
-  return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
-   If not using GCC, it is ok not to declare it.  */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
-   That was relevant to code that was here before.  */
-#if !defined (__STDC__) || !__STDC__
-/* gcc with -traditional declares the built-in strlen to return int,
-   and has done so at least since version 2.4.5. -- rms.  */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-

-/* Handle permutation of arguments.  */
-
-/* Describe the part of ARGV that contains non-options that have
-   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
-   `last_nonopt' is the index after the last of them.  */
-
-static int first_nonopt;
-static int last_nonopt;
-
-/* Exchange two adjacent subsequences of ARGV.
-   One subsequence is elements [first_nonopt,last_nonopt)
-   which contains all the non-options that have been skipped so far.
-   The other is elements [last_nonopt,optind), which contains all
-   the options processed since those non-options were skipped.
-
-   `first_nonopt' and `last_nonopt' are relocated so that they describe
-   the new indices of the non-options in ARGV after they are moved.  */
-
-static void
-exchange (argv)
-     char **argv;
-{
-  int bottom = first_nonopt;
-  int middle = last_nonopt;
-  int top = optind;
-  char *tem;
-
-  /* Exchange the shorter segment with the far end of the longer segment.
-     That puts the shorter segment into the right place.
-     It leaves the longer segment in the right place overall,
-     but it consists of two parts that need to be swapped next.  */
-
-  while (top > middle && middle > bottom)
-    {
-      if (top - middle > middle - bottom)
-	{
-	  /* Bottom segment is the short one.  */
-	  int len = middle - bottom;
-	  register int i;
-
-	  /* Swap it with the top part of the top segment.  */
-	  for (i = 0; i < len; i++)
-	    {
-	      tem = argv[bottom + i];
-	      argv[bottom + i] = argv[top - (middle - bottom) + i];
-	      argv[top - (middle - bottom) + i] = tem;
-	    }
-	  /* Exclude the moved bottom segment from further swapping.  */
-	  top -= len;
-	}
-      else
-	{
-	  /* Top segment is the short one.  */
-	  int len = top - middle;
-	  register int i;
-
-	  /* Swap it with the bottom part of the bottom segment.  */
-	  for (i = 0; i < len; i++)
-	    {
-	      tem = argv[bottom + i];
-	      argv[bottom + i] = argv[middle + i];
-	      argv[middle + i] = tem;
-	    }
-	  /* Exclude the moved top segment from further swapping.  */
-	  bottom += len;
-	}
-    }
-
-  /* Update records for the slots the non-options now occupy.  */
-
-  first_nonopt += (optind - last_nonopt);
-  last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made.  */
-
-static const char *
-_getopt_initialize (optstring)
-     const char *optstring;
-{
-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
-     is the program name); the sequence of previously skipped
-     non-option ARGV-elements is empty.  */
-
-  first_nonopt = last_nonopt = optind = 1;
-
-  nextchar = NULL;
-
-  posixly_correct = getenv ("POSIXLY_CORRECT");
-
-  /* Determine how to handle the ordering of options and nonoptions.  */
-
-  if (optstring[0] == '-')
-    {
-      ordering = RETURN_IN_ORDER;
-      ++optstring;
-    }
-  else if (optstring[0] == '+')
-    {
-      ordering = REQUIRE_ORDER;
-      ++optstring;
-    }
-  else if (posixly_correct != NULL)
-    ordering = REQUIRE_ORDER;
-  else
-    ordering = PERMUTE;
-
-  return optstring;
-}
-

-/* Scan elements of ARGV (whose length is ARGC) for option characters
-   given in OPTSTRING.
-
-   If an element of ARGV starts with '-', and is not exactly "-" or "--",
-   then it is an option element.  The characters of this element
-   (aside from the initial '-') are option characters.  If `getopt'
-   is called repeatedly, it returns successively each of the option characters
-   from each of the option elements.
-
-   If `getopt' finds another option character, it returns that character,
-   updating `optind' and `nextchar' so that the next call to `getopt' can
-   resume the scan with the following option character or ARGV-element.
-
-   If there are no more option characters, `getopt' returns `EOF'.
-   Then `optind' is the index in ARGV of the first ARGV-element
-   that is not an option.  (The ARGV-elements have been permuted
-   so that those that are not options now come last.)
-
-   OPTSTRING is a string containing the legitimate option characters.
-   If an option character is seen that is not listed in OPTSTRING,
-   return '?' after printing an error message.  If you set `opterr' to
-   zero, the error message is suppressed but we still return '?'.
-
-   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
-   so the following text in the same ARGV-element, or the text of the following
-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
-   wants an optional arg; if there is text in the current ARGV-element,
-   it is returned in `optarg', otherwise `optarg' is set to zero.
-
-   If OPTSTRING starts with `-' or `+', it requests different methods of
-   handling the non-option ARGV-elements.
-   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
-   Long-named options begin with `--' instead of `-'.
-   Their names may be abbreviated as long as the abbreviation is unique
-   or is an exact match for some defined option.  If they have an
-   argument, it follows the option name in the same ARGV-element, separated
-   from the option name by a `=', or else the in next ARGV-element.
-   When `getopt' finds a long-named option, it returns 0 if that option's
-   `flag' field is nonzero, the value of the option's `val' field
-   if the `flag' field is zero.
-
-   The elements of ARGV aren't really const, because we permute them.
-   But we pretend they're const in the prototype to be compatible
-   with other systems.
-
-   LONGOPTS is a vector of `struct option' terminated by an
-   element containing a name which is zero.
-
-   LONGIND returns the index in LONGOPT of the long-named option found.
-   It is only valid when a long-named option has been found by the most
-   recent call.
-
-   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
-   long-named options.  */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-     const struct option *longopts;
-     int *longind;
-     int long_only;
-{
-  optarg = NULL;
-
-  if (optind == 0)
-    {
-      optstring = _getopt_initialize (optstring);
-      optind = 1;		/* Don't scan ARGV[0], the program name.  */
-    }
-
-  if (nextchar == NULL || *nextchar == '\0')
-    {
-      /* Advance to the next ARGV-element.  */
-
-      if (ordering == PERMUTE)
-	{
-	  /* If we have just processed some options following some non-options,
-	     exchange them so that the options come first.  */
-
-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
-	    exchange ((char **) argv);
-	  else if (last_nonopt != optind)
-	    first_nonopt = optind;
-
-	  /* Skip any additional non-options
-	     and extend the range of non-options previously skipped.  */
-
-	  while (optind < argc
-		 && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
-	    optind++;
-	  last_nonopt = optind;
-	}
-
-      /* The special ARGV-element `--' means premature end of options.
-	 Skip it like a null option,
-	 then exchange with previous non-options as if it were an option,
-	 then skip everything else like a non-option.  */
-
-      if (optind != argc && !strcmp (argv[optind], "--"))
-	{
-	  optind++;
-
-	  if (first_nonopt != last_nonopt && last_nonopt != optind)
-	    exchange ((char **) argv);
-	  else if (first_nonopt == last_nonopt)
-	    first_nonopt = optind;
-	  last_nonopt = argc;
-
-	  optind = argc;
-	}
-
-      /* If we have done all the ARGV-elements, stop the scan
-	 and back over any non-options that we skipped and permuted.  */
-
-      if (optind == argc)
-	{
-	  /* Set the next-arg-index to point at the non-options
-	     that we previously skipped, so the caller will digest them.  */
-	  if (first_nonopt != last_nonopt)
-	    optind = first_nonopt;
-	  return EOF;
-	}
-
-      /* If we have come to a non-option and did not permute it,
-	 either stop the scan or describe it to the caller and pass it by.  */
-
-      if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
-	{
-	  if (ordering == REQUIRE_ORDER)
-	    return EOF;
-	  optarg = argv[optind++];
-	  return 1;
-	}
-
-      /* We have found another option-ARGV-element.
-	 Skip the initial punctuation.  */
-
-      nextchar = (argv[optind] + 1
-		  + (longopts != NULL && argv[optind][1] == '-'));
-    }
-
-  /* Decode the current option-ARGV-element.  */
-
-  /* Check whether the ARGV-element is a long option.
-
-     If long_only and the ARGV-element has the form "-f", where f is
-     a valid short option, don't consider it an abbreviated form of
-     a long option that starts with f.  Otherwise there would be no
-     way to give the -f short option.
-
-     On the other hand, if there's a long option "fubar" and
-     the ARGV-element is "-fu", do consider that an abbreviation of
-     the long option, just like "--fu", and not "-f" with arg "u".
-
-     This distinction seems to be the most useful approach.  */
-
-  if (longopts != NULL
-      && (argv[optind][1] == '-'
-	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
-    {
-      char *nameend;
-      const struct option *p;
-      const struct option *pfound = NULL;
-      int exact = 0;
-      int ambig = 0;
-      int indfound = 0;  	       /* Initialize to prevent warning */
-      int option_index;
-
-      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
-	/* Do nothing.  */ ;
-
-      /* Test all long options for either exact match
-	 or abbreviated matches.  */
-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
-	if (!strncmp (p->name, nextchar, nameend - nextchar))
-	  {
-	    if (nameend - nextchar == strlen (p->name))
-	      {
-		/* Exact match found.  */
-		pfound = p;
-		indfound = option_index;
-		exact = 1;
-		break;
-	      }
-	    else if (pfound == NULL)
-	      {
-		/* First nonexact match found.  */
-		pfound = p;
-		indfound = option_index;
-	      }
-	    else
-	      /* Second or later nonexact match found.  */
-	      ambig = 1;
-	  }
-
-      if (ambig && !exact)
-	{
-	  if (opterr)
-	    fprintf (stderr, gettext ("%s: option `%s' is ambiguous\n"),
-		     argv[0], argv[optind]);
-	  nextchar += strlen (nextchar);
-	  optind++;
-	  return '?';
-	}
-
-      if (pfound != NULL)
-	{
-	  option_index = indfound;
-	  optind++;
-	  if (*nameend)
-	    {
-	      /* Don't test has_arg with >, because some C compilers don't
-		 allow it to be used on enums.  */
-	      if (pfound->has_arg)
-		optarg = nameend + 1;
-	      else
-		{
-		  if (opterr)
-		   if (argv[optind - 1][1] == '-')
-		    /* --option */
-		    fprintf (stderr,
-		     gettext ("%s: option `--%s' doesn't allow an argument\n"),
-		     argv[0], pfound->name);
-		   else
-		    /* +option or -option */
-		    fprintf (stderr,
-		     gettext ("%s: option `%c%s' doesn't allow an argument\n"),
-		     argv[0], argv[optind - 1][0], pfound->name);
-
-		  nextchar += strlen (nextchar);
-		  return '?';
-		}
-	    }
-	  else if (pfound->has_arg == 1)
-	    {
-	      if (optind < argc)
-		optarg = argv[optind++];
-	      else
-		{
-		  if (opterr)
-		    fprintf (stderr,
-			   gettext ("%s: option `%s' requires an argument\n"),
-			   argv[0], argv[optind - 1]);
-		  nextchar += strlen (nextchar);
-		  return optstring[0] == ':' ? ':' : '?';
-		}
-	    }
-	  nextchar += strlen (nextchar);
-	  if (longind != NULL)
-	    *longind = option_index;
-	  if (pfound->flag)
-	    {
-	      *(pfound->flag) = pfound->val;
-	      return 0;
-	    }
-	  return pfound->val;
-	}
-
-      /* Can't find it as a long option.  If this is not getopt_long_only,
-	 or the option starts with '--' or is not a valid short
-	 option, then it's an error.
-	 Otherwise interpret it as a short option.  */
-      if (!long_only || argv[optind][1] == '-'
-	  || my_index (optstring, *nextchar) == NULL)
-	{
-	  if (opterr)
-	    {
-	      if (argv[optind][1] == '-')
-		/* --option */
-		fprintf (stderr, gettext ("%s: unrecognized option `--%s'\n"),
-			 argv[0], nextchar);
-	      else
-		/* +option or -option */
-		fprintf (stderr, gettext ("%s: unrecognized option `%c%s'\n"),
-			 argv[0], argv[optind][0], nextchar);
-	    }
-	  nextchar = (char *) "";
-	  optind++;
-	  return '?';
-	}
-    }
-
-  /* Look at and handle the next short option-character.  */
-
-  {
-    char c = *nextchar++;
-    char *temp = my_index (optstring, c);
-
-    /* Increment `optind' when we start to process its last character.  */
-    if (*nextchar == '\0')
-      ++optind;
-
-    if (temp == NULL || c == ':')
-      {
-	if (opterr)
-	  {
-	    if (posixly_correct)
-	      /* 1003.2 specifies the format of this message.  */
-	      fprintf (stderr, gettext ("%s: illegal option -- %c\n"),
-		       argv[0], c);
-	    else
-	      fprintf (stderr, gettext ("%s: invalid option -- %c\n"),
-		       argv[0], c);
-	  }
-	optopt = c;
-	return '?';
-      }
-    if (temp[1] == ':')
-      {
-	if (temp[2] == ':')
-	  {
-	    /* This is an option that accepts an argument optionally.  */
-	    if (*nextchar != '\0')
-	      {
-		optarg = nextchar;
-		optind++;
-	      }
-	    else
-	      optarg = NULL;
-	    nextchar = NULL;
-	  }
-	else
-	  {
-	    /* This is an option that requires an argument.  */
-	    if (*nextchar != '\0')
-	      {
-		optarg = nextchar;
-		/* If we end this ARGV-element by taking the rest as an arg,
-		   we must advance to the next element now.  */
-		optind++;
-	      }
-	    else if (optind == argc)
-	      {
-		if (opterr)
-		  {
-		    /* 1003.2 specifies the format of this message.  */
-		    fprintf (stderr,
-			   gettext ("%s: option requires an argument -- %c\n"),
-			   argv[0], c);
-		  }
-		optopt = c;
-		if (optstring[0] == ':')
-		  c = ':';
-		else
-		  c = '?';
-	      }
-	    else
-	      /* We already incremented `optind' once;
-		 increment it again when taking next ARGV-elt as argument.  */
-	      optarg = argv[optind++];
-	    nextchar = NULL;
-	  }
-      }
-    return c;
-  }
-}
-
-int
-getopt (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-{
-  return _getopt_internal (argc, argv, optstring,
-			   (const struct option *) 0,
-			   (int *) 0,
-			   0);
-}
-
-#endif	/* _LIBC or not __GNU_LIBRARY__.  */
-

-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
-   the above definition of `getopt'.  */
-
-int
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-
-      c = getopt (argc, argv, "abc:d:0123456789");
-      if (c == EOF)
-	break;
-
-      switch (c)
-	{
-	case '0':
-	case '1':
-	case '2':
-	case '3':
-	case '4':
-	case '5':
-	case '6':
-	case '7':
-	case '8':
-	case '9':
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
-	    printf ("digits occur in two different argv-elements.\n");
-	  digit_optind = this_option_optind;
-	  printf ("option %c\n", c);
-	  break;
-
-	case 'a':
-	  printf ("option a\n");
-	  break;
-
-	case 'b':
-	  printf ("option b\n");
-	  break;
-
-	case 'c':
-	  printf ("option c with value `%s'\n", optarg);
-	  break;
-
-	case '?':
-	  break;
-
-	default:
-	  printf ("?? getopt returned character code 0%o ??\n", c);
-	}
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-	printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */
diff --git a/getopt.h b/getopt.h
deleted file mode 100644
index 4ac33b7..0000000
--- a/getopt.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Declarations for getopt.
-   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
-
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
-   the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
-   each non-option ARGV-element is returned here.  */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
-   This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
-
-   On entry to `getopt', zero means this is the first call; initialize.
-
-   When `getopt' returns EOF, this is the index of the first of the
-   non-option elements that the caller should itself scan.
-
-   Otherwise, `optind' communicates from one call to the next
-   how much of ARGV has been scanned so far.  */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
-   for unrecognized options.  */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized.  */
-
-extern int optopt;
-
-/* Describe the long-named options requested by the application.
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
-   of `struct option' terminated by an element containing a name which is
-   zero.
-
-   The field `has_arg' is:
-   no_argument		(or 0) if the option does not take an argument,
-   required_argument	(or 1) if the option requires an argument,
-   optional_argument 	(or 2) if the option takes an optional argument.
-
-   If the field `flag' is not NULL, it points to a variable that is set
-   to the value given in the field `val' when the option is found, but
-   left unchanged if the option is not found.
-
-   To have a long-named option do something other than set an `int' to
-   a compiled-in constant, such as set a value from `optarg', set the
-   option's `flag' field to zero and its `val' field to a nonzero
-   value (the equivalent single-letter option character, if there is
-   one).  For long options that have a zero `flag' field, `getopt'
-   returns the contents of the `val' field.  */
-
-struct option
-{
-#if defined (__STDC__) && __STDC__
-  const char *name;
-#else
-  char *name;
-#endif
-  /* has_arg can't be an enum because some compilers complain about
-     type mismatches in all the code that assumes it is an int.  */
-  int has_arg;
-  int *flag;
-  int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'.  */
-
-#define	no_argument		0
-#define required_argument	1
-#define optional_argument	2
-
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
-   differences in the consts, in stdlib.h.  To avoid compilation
-   errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
-		        const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
-			     const char *shortopts,
-		             const struct option *longopts, int *longind);
-
-/* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int argc, char *const *argv,
-			     const char *shortopts,
-		             const struct option *longopts, int *longind,
-			     int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* __STDC__ */
-
-#ifdef	__cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
diff --git a/getopt1.c b/getopt1.c
deleted file mode 100644
index 4580211..0000000
--- a/getopt1.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
-	Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
-

-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined (__STDC__) || !__STDC__
-/* This is a separate conditional since some stdc systems
-   reject `defined (const)'.  */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#else
-char *getenv ();
-#endif
-
-#ifndef	NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
-{
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
-   If an option that starts with '-' (not '--') doesn't match a long option,
-   but does match a short option, it is parsed as a short option
-   instead.  */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
-{
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif	/* _LIBC or not __GNU_LIBRARY__.  */
-

-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
-     int argc;
-     char **argv;
-{
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-      int option_index = 0;
-      static struct option long_options[] =
-      {
-	{"add", 1, 0, 0},
-	{"append", 0, 0, 0},
-	{"delete", 1, 0, 0},
-	{"verbose", 0, 0, 0},
-	{"create", 0, 0, 0},
-	{"file", 1, 0, 0},
-	{0, 0, 0, 0}
-      };
-
-      c = getopt_long (argc, argv, "abc:d:0123456789",
-		       long_options, &option_index);
-      if (c == EOF)
-	break;
-
-      switch (c)
-	{
-	case 0:
-	  printf ("option %s", long_options[option_index].name);
-	  if (optarg)
-	    printf (" with arg %s", optarg);
-	  printf ("\n");
-	  break;
-
-	case '0':
-	case '1':
-	case '2':
-	case '3':
-	case '4':
-	case '5':
-	case '6':
-	case '7':
-	case '8':
-	case '9':
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
-	    printf ("digits occur in two different argv-elements.\n");
-	  digit_optind = this_option_optind;
-	  printf ("option %c\n", c);
-	  break;
-
-	case 'a':
-	  printf ("option a\n");
-	  break;
-
-	case 'b':
-	  printf ("option b\n");
-	  break;
-
-	case 'c':
-	  printf ("option c with value `%s'\n", optarg);
-	  break;
-
-	case 'd':
-	  printf ("option d with value `%s'\n", optarg);
-	  break;
-
-	case '?':
-	  break;
-
-	default:
-	  printf ("?? getopt returned character code 0%o ??\n", c);
-	}
-    }
-
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-	printf ("%s ", argv[optind++]);
-      printf ("\n");
-    }
-
-  exit (0);
-}
-
-#endif /* TEST */
diff --git a/normals.c b/normals.c
index 903f70d..97018aa 100644
--- a/normals.c
+++ b/normals.c
@@ -119,11 +119,14 @@ stl_fix_normal_directions(stl_file *stl)
   norm_sw = calloc(stl->stats.number_of_facets, sizeof(char));
   if(norm_sw == NULL) perror("stl_fix_normal_directions");
   
-
   facet_num = 0;
+  //If normal vector is not within tolerance and backwards:
+  //Arbitrarily starts at face 0.  If this one is wrong, we're screwed.  Thankfully, the chances
+  // of it being wrong randomly are low if most of the triangles are right:
   if(stl_check_normal_vector(stl, 0, 0) == 2)
     stl_reverse_facet(stl, 0);
      
+  //Say that we've fixed this facet:
   norm_sw[facet_num] = 1;
   /*  edge_num = 0;
       vnot = stl->neighbors_start[0].which_vertex_not[0];
@@ -133,19 +136,24 @@ stl_fix_normal_directions(stl_file *stl)
   for(;;)
     {
       /* Add neighbors_to_list. */
+      //Add unconnected neighbors to the list:a
       for(j = 0; j < 3; j++)
 	{
 	  /* Reverse the neighboring facets if necessary. */
 	  if(stl->neighbors_start[facet_num].which_vertex_not[j] > 2)
 	    {
+        // If the facet has a neighbor that is -1, it means that edge isn't shared by another
+        // facet.
 	      if(stl->neighbors_start[facet_num].neighbor[j] != -1)
 		{
 		  stl_reverse_facet
 		    (stl, stl->neighbors_start[facet_num].neighbor[j]);
 		}
 	    }
+    //If this edge of the facet is connected:
 	  if(stl->neighbors_start[facet_num].neighbor[j] != -1)
 	    {
+        //If we haven't fixed this facet yet, add it to the list:
 	      if(norm_sw[stl->neighbors_start[facet_num].neighbor[j]] != 1)
 		{
 		  /* Add node to beginning of list. */
@@ -170,14 +178,14 @@ stl_fix_normal_directions(stl_file *stl)
 	  head->next = head->next->next;
 	  free(temp);
 	}
-      else
+      else  //if we ran out of facets to fix:
 	{
 	  /* All of the facets in this part have been fixed. */
 	  stl->stats.number_of_parts += 1;
 	  /* There are (checked-checked_before) facets */
 	  /* in part stl->stats.number_of_parts */
 	  checked_before = checked;
-	  if(checked == stl->stats.number_of_facets)
+	  if(checked >= stl->stats.number_of_facets)
 	    {
 	      /* All of the facets have been checked.  Bail out. */
 	      break;
diff --git a/shared.c b/shared.c
index e1fe575..d1c3c6e 100644
--- a/shared.c
+++ b/shared.c
@@ -19,6 +19,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "stl.h"
 
diff --git a/stl_io.c b/stl_io.c
index ed4506a..ce51e32 100644
--- a/stl_io.c
+++ b/stl_io.c
@@ -19,7 +19,9 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include "stl.h"
+#include "version.h"
 
 #if !defined(SEEK_SET)
 #define SEEK_SET 0
@@ -52,7 +54,7 @@ void
 stl_stats_out(stl_file *stl, FILE *file, char *input_file)
 {
   fprintf(file, "\n\
-================= Results produced by ADMesh version 0.95 ================\n");
+================= Results produced by ADMesh version %g ================\n",VERSION);
   fprintf(file, "\
 Input file         : %s\n", input_file);
   if(stl->stats.type == binary)
@@ -132,9 +134,9 @@ stl_write_ascii(stl_file *stl, char *file, char *label)
   if(fp == NULL)
     {
       error_msg = 
-	malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
+      malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */
       sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing",
-	      file);
+      file);
       perror(error_msg);
       free(error_msg);
       exit(1);
@@ -197,6 +199,7 @@ stl_print_neighbors(stl_file *stl, char *file)
 	      stl->neighbors_start[i].neighbor[2],
 	      (int)stl->neighbors_start[i].which_vertex_not[2]);
     }
+    fclose(fp);
 }
 
 static void
diff --git a/stlinit.c b/stlinit.c
index 3d90f7b..bcea18a 100644
--- a/stlinit.c
+++ b/stlinit.c
@@ -121,7 +121,7 @@ stl_initialize(stl_file *stl, char *file)
   
   /* Check for binary or ASCII file */
   fseek(stl->fp, HEADER_SIZE, SEEK_SET);
-  fread(chtest, sizeof(chtest), 1, stl->fp);
+  size_t retSize = fread(chtest, sizeof(chtest), 1, stl->fp);
   stl->stats.type = ascii;
   for(i = 0; i < sizeof(chtest); i++)
     {
@@ -147,9 +147,12 @@ stl_initialize(stl_file *stl, char *file)
       num_facets = (file_size - HEADER_SIZE) / SIZEOF_STL_FACET;
 
       /* Read the header */
-      fread(stl->stats.header, LABEL_SIZE, 1, stl->fp);
-      stl->stats.header[80] = '\0';
-
+      retSize = fread(stl->stats.header, LABEL_SIZE, 1, stl->fp);
+      
+      if (retSize>79) {
+        stl->stats.header[80] = '\0';
+      }
+      
       /* Read the int following the header.  This should contain # of facets */
       header_num_facets = stl_get_little_int(stl->fp);
       if(num_facets != header_num_facets)
@@ -204,15 +207,50 @@ stl_allocate(stl_file *stl)
   if(stl->facet_start == NULL) perror("stl_initialize");
 }
 
+//This function reads file_to_merge and ADDs the contents of the file to the 
+// already loaded and filled stl.
 void
-stl_open_merge(stl_file *stl, char *file)
+stl_open_merge(stl_file *stl, char *file_to_merge)
 {
-  int first_facet;
+  int num_facets_so_far;
   
-  first_facet = stl->stats.number_of_facets;
-  stl_initialize(stl, file);
+  //Record how many facets we have so far from the first file.  We will start putting
+  //facets in the next position.  Since we're 0-indexed, it'l be the same position.
+  num_facets_so_far = stl->stats.number_of_facets;
+  
+  //Record the file type we started with:
+  stl_type origStlType=stl->stats.type;
+  //Record the file pointer too:
+  FILE *origFp=stl->fp;
+  
+  //Create an stl_file structure for the file to merge:
+  stl_file stl_to_merge;  
+  
+  //Initialize the sturucture with zero stats, header info and sizes:
+  stl_initialize(&stl_to_merge, file_to_merge);
+  
+  //Copy what we need to into stl so that we can read the file_to_merge directly into it
+  //using stl_read:  Save the rest of the valuable info:
+  stl->stats.type=stl_to_merge.stats.type;
+  stl->fp=stl_to_merge.fp;
+  
+  //Add the number of facets we already have in stl with what we we found in stl_to_merge but 
+  //haven't read yet.
+  stl->stats.number_of_facets=num_facets_so_far+stl_to_merge.stats.number_of_facets;
+  
+  //Allocate enough room for stl->stats.number_of_facets facets and neighbors:
   stl_reallocate(stl);
-  stl_read(stl, first_facet, 0);
+  
+  //Read the file to merge directly into stl, adding it to what we have already.
+  // Start at num_facets_so_far, the index to the first unused facet.  Also say
+  // that this isn't our first time so we should augment stats like min and max 
+  //instead of erasing them.
+  stl_read(stl, num_facets_so_far, 0);
+  
+  //Restore the stl information we overwrote (for stl_read) so that it still accurately
+  // reflects the subject part:
+  stl->stats.type=origStlType;
+  stl->fp=origFp;
 }
 
 static void
@@ -231,6 +269,9 @@ stl_reallocate(stl_file *stl)
   if(stl->facet_start == NULL) perror("stl_initialize");
 }
 
+//Reads the contents of the file pointed to by stl->fp into the stl structure,
+//starting at facet first_facet.  The second argument says if it's our first
+// time running this for the stl and therefore we should reset our max and min stats.
 static void
 stl_read(stl_file *stl, int first_facet, int first)
 {
@@ -241,7 +282,6 @@ stl_read(stl_file *stl, int first_facet, int first)
   float diff_z;
   float max_diff;
 
-  
   if(stl->stats.type == binary)
     {
       fseek(stl->fp, HEADER_SIZE, SEEK_SET);
@@ -275,19 +315,19 @@ stl_read(stl_file *stl, int first_facet, int first)
 	}
       else
 	/* Read a single facet from an ASCII .STL file */
-	{
-      	  fscanf(stl->fp, "%*s %*s %f %f %f\n", &facet.normal.x,
-		 &facet.normal.y, &facet.normal.z);
-	  fscanf(stl->fp, "%*s %*s");
-	  fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[0].x,
-		 &facet.vertex[0].y,  &facet.vertex[0].z);
-	  fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[1].x,
-		 &facet.vertex[1].y,  &facet.vertex[1].z);
-	  fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[2].x,
-		 &facet.vertex[2].y,  &facet.vertex[2].z);
-	  fscanf(stl->fp, "%*s");
-	  fscanf(stl->fp, "%*s");
-	}
+  {
+    size_t retSize = fscanf(stl->fp, "%*s %*s %f %f %f\n", 
+      &facet.normal.x, &facet.normal.y, &facet.normal.z);
+    retSize = fscanf(stl->fp, "%*s %*s");
+    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[0].x,
+      &facet.vertex[0].y,  &facet.vertex[0].z);
+    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[1].x,
+      &facet.vertex[1].y,  &facet.vertex[1].z);
+    retSize = fscanf(stl->fp, "%*s %f %f %f\n", &facet.vertex[2].x,
+      &facet.vertex[2].y,  &facet.vertex[2].z);
+    retSize = fscanf(stl->fp, "%*s");
+    retSize = fscanf(stl->fp, "%*s");
+  }
       /* Write the facet into memory. */
       stl->facet_start[i] = facet;
       
diff --git a/util.c b/util.c
index 6f1b8da..f252e1a 100644
--- a/util.c
+++ b/util.c
@@ -77,6 +77,7 @@ stl_verify_neighbors(stl_file *stl)
     }
 }
 
+//Translates the stl by x,y,z, from wherever it is currently:
 void
 stl_translate(stl_file *stl, float x, float y, float z)
 {
@@ -87,17 +88,17 @@ stl_translate(stl_file *stl, float x, float y, float z)
     {
       for(j = 0; j < 3; j++)
 	{
-	  stl->facet_start[i].vertex[j].x -= (stl->stats.min.x - x);
-	  stl->facet_start[i].vertex[j].y -= (stl->stats.min.y - y);
-	  stl->facet_start[i].vertex[j].z -= (stl->stats.min.z - z);
+	  stl->facet_start[i].vertex[j].x += x;
+	  stl->facet_start[i].vertex[j].y += y;
+	  stl->facet_start[i].vertex[j].z += z;
 	}
     }
-  stl->stats.max.x -= (stl->stats.min.x - x);
-  stl->stats.max.y -= (stl->stats.min.y - y);
-  stl->stats.max.z -= (stl->stats.min.z - z);
-  stl->stats.min.x = x;
-  stl->stats.min.y = y;
-  stl->stats.min.z = z;
+  stl->stats.max.x += x;
+  stl->stats.max.y += y;
+  stl->stats.max.z += z;
+  stl->stats.min.x += x;
+  stl->stats.min.y += y;
+  stl->stats.min.z += z;
 }
 
 void
diff --git a/version.h b/version.h
new file mode 100644
index 0000000..1d6f865
--- /dev/null
+++ b/version.h
@@ -0,0 +1 @@
+#define VERSION 0.96

-- 
admesh - a tool for processing triangulated solid meshes



More information about the debian-science-commits mailing list