comparison src/DLD-FUNCTIONS/convhulln.cc @ 14346:9b23169e2712

maint: periodic merge of stable to default
author John W. Eaton <jwe@octave.org>
date Wed, 08 Feb 2012 16:46:58 -0500
parents 7a7ce92cff56 3e4350f09a55
children 60e5cf354d80
comparison
equal deleted inserted replaced
14344:4687ecec0586 14346:9b23169e2712
38 #include "Cell.h" 38 #include "Cell.h"
39 #include "defun-dld.h" 39 #include "defun-dld.h"
40 #include "error.h" 40 #include "error.h"
41 #include "oct-obj.h" 41 #include "oct-obj.h"
42 #include "parse.h" 42 #include "parse.h"
43 #include "unwind-prot.h"
43 44
44 #if defined (HAVE_QHULL) 45 #if defined (HAVE_QHULL)
45 # include "oct-qhull.h" 46 # include "oct-qhull.h"
46 # if defined (NEED_QHULL_VERSION) 47 # if defined (NEED_QHULL_VERSION)
47 char qh_version[] = "convhulln.oct 2007-07-24"; 48 char qh_version[] = "convhulln.oct 2007-07-24";
48 # endif 49 # endif
49 #endif 50 #endif
51
52 static void
53 close_fcn (FILE *f)
54 {
55 gnulib::fclose (f);
56 }
50 57
51 DEFUN_DLD (convhulln, args, nargout, 58 DEFUN_DLD (convhulln, args, nargout,
52 "-*- texinfo -*-\n\ 59 "-*- texinfo -*-\n\
53 @deftypefn {Loadable Function} {@var{h} =} convhulln (@var{pts})\n\ 60 @deftypefn {Loadable Function} {@var{h} =} convhulln (@var{pts})\n\
54 @deftypefnx {Loadable Function} {@var{h} =} convhulln (@var{pts}, @var{options})\n\ 61 @deftypefnx {Loadable Function} {@var{h} =} convhulln (@var{pts}, @var{options})\n\
126 } 133 }
127 } 134 }
128 135
129 boolT ismalloc = false; 136 boolT ismalloc = false;
130 137
138 unwind_protect frame;
139
131 // Replace the outfile pointer with stdout for debugging information. 140 // Replace the outfile pointer with stdout for debugging information.
132 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) 141 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
133 FILE *outfile = gnulib::fopen ("NUL", "w"); 142 FILE *outfile = gnulib::fopen ("NUL", "w");
134 #else 143 #else
135 FILE *outfile = gnulib::fopen ("/dev/null", "w"); 144 FILE *outfile = gnulib::fopen ("/dev/null", "w");
136 #endif 145 #endif
137 FILE *errfile = stderr; 146 FILE *errfile = stderr;
138 147
139 if (! outfile) 148 if (outfile)
149 frame.add_fcn (close_fcn, outfile);
150 else
140 { 151 {
141 error ("convhulln: Unable to create temporary file for output."); 152 error ("convhulln: unable to create temporary file for output");
142 return retval; 153 return retval;
143 } 154 }
144 155
145 // qh_new_qhull command and points arguments are not const... 156 // qh_new_qhull command and points arguments are not const...
146 157