Mercurial > hg > octave-jordi
changeset 3531:97cf542676e1
[project @ 2000-02-02 11:30:40 by jwe]
author | jwe |
---|---|
date | Wed, 02 Feb 2000 11:33:32 +0000 |
parents | 7a23cbae0393 |
children | 4abbfb1ca636 |
files | src/DLD-FUNCTIONS/qz.cc src/Map.cc src/Stack.cc src/dirfns.cc src/error.cc src/file-io.cc src/load-save.cc src/oct-fstrm.cc src/oct-procbuf.cc src/oct-stream.cc src/octave.cc src/ov.cc src/pager.cc src/parse.y src/pt-plot.cc src/sighandlers.cc src/syscalls.cc src/sysdep.cc src/toplev.cc |
diffstat | 19 files changed, 157 insertions(+), 142 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/qz.cc +++ b/src/DLD-FUNCTIONS/qz.cc @@ -151,7 +151,7 @@ retval = (fabs (p) < 1 ? 1 : -1); #ifdef DEBUG - cout << "qz: fin: retval=" << retval << endl; + std::cout << "qz: fin: retval=" << retval << endl; #endif return retval; @@ -240,7 +240,7 @@ int nargin = args.length (); #ifdef DEBUG - cout << "qz: nargin = " << nargin << ", nargout = " << nargout << endl; + std::cout << "qz: nargin = " << nargin << ", nargout = " << nargout << endl; #endif if (nargin < 2 || nargin > 3 || nargout > 7) @@ -255,7 +255,7 @@ } #ifdef DEBUG - cout << "qz: determine ordering option" << endl; + std::cout << "qz: determine ordering option" << endl; #endif // Determine ordering option @@ -287,7 +287,7 @@ F77_FCN (xdlamch, XDLAMCH) ("S", safmin, 1L); #ifdef DEBUG_EIG - cout << "qz: initial value of safmin=" << setiosflags (ios::scientific) + std::cout << "qz: initial value of safmin=" << setiosflags (ios::scientific) << safmin << endl; #endif @@ -296,27 +296,27 @@ if (safmin == 0) { #ifdef DEBUG_EIG - cout << "qz: DANGER WILL ROBINSON: safmin is 0!" << endl; + std::cout << "qz: DANGER WILL ROBINSON: safmin is 0!" << endl; #endif F77_FCN (xdlamch, XDLAMCH) ("E", safmin, 1L); #ifdef DEBUG_EIG - cout << "qz: safmin set to " << setiosflags (ios::scientific) + std::cout << "qz: safmin set to " << setiosflags (ios::scientific) << safmin << endl; #endif } } #ifdef DEBUG - cout << "qz: check argument 1" << endl; + std::cout << "qz: check argument 1" << endl; #endif // Argument 1: check if it's o.k. dimensioned int nn = args(0).rows (); #ifdef DEBUG - cout << "argument 1 dimensions: (" << nn << "," << args(0).columns () << ")" + std::cout << "argument 1 dimensions: (" << nn << "," << args(0).columns () << ")" << endl; #endif @@ -351,7 +351,7 @@ return retval; #ifdef DEBUG - cout << "qz: check argument 2" << endl; + std::cout << "qz: check argument 2" << endl; #endif // Extract argument 2 (bb, or cbb if complex) @@ -412,7 +412,7 @@ { #ifdef DEBUG if (compq == 'V') - cout << "qz: performing balancing; QQ=" << endl << QQ << endl; + std::cout << "qz: performing balancing; QQ=" << endl << QQ << endl; #endif F77_XFCN (dggbal, DGGBAL, @@ -440,7 +440,7 @@ #ifdef DEBUG if (compq == 'V') - cout << "qz: balancing done; QQ=" << endl << QQ << endl; + std::cout << "qz: balancing done; QQ=" << endl << QQ << endl; #endif if (f77_exception_encountered) @@ -460,7 +460,7 @@ #ifdef DEBUG if (compz == 'V') - cout << "qz: balancing done; ZZ=" << endl << ZZ << endl; + std::cout << "qz: balancing done; ZZ=" << endl << ZZ << endl; #endif if (f77_exception_encountered) @@ -494,41 +494,41 @@ else // real matrices case { #ifdef DEBUG - cout << "qz: peforming qr decomposition of bb" << endl; + std::cout << "qz: peforming qr decomposition of bb" << endl; #endif // compute the QR factorization of bb QR bqr (bb); #ifdef DEBUG - cout << "qz: qr (bb) done; now peforming qz decomposition" << endl; + std::cout << "qz: qr (bb) done; now peforming qz decomposition" << endl; #endif bb = bqr.R (); #ifdef DEBUG - cout << "qz: extracted bb" << endl; + std::cout << "qz: extracted bb" << endl; #endif aa = (bqr.Q ()).transpose ()*aa; #ifdef DEBUG - cout << "qz: updated aa " << endl; - cout << "bqr.Q () = " << endl << bqr.Q () << endl; + std::cout << "qz: updated aa " << endl; + std::cout << "bqr.Q () = " << endl << bqr.Q () << endl; if (compq == 'V') - cout << "QQ =" << QQ << endl; + std::cout << "QQ =" << QQ << endl; #endif if (compq == 'V') QQ = QQ*bqr.Q (); #ifdef DEBUG - cout << "qz: precursors done..." << endl; + std::cout << "qz: precursors done..." << endl; #endif #ifdef DEBUG - cout << "qz: compq = " << compq << ", compz = " << compz << endl; + std::cout << "qz: compq = " << compq << ", compz = " << compz << endl; #endif // reduce to generalized hessenberg form @@ -574,7 +574,7 @@ else { #ifdef DEBUG_SORT - cout << "qz: ordering eigenvalues: ord_job = " << ord_job[0] << endl; + std::cout << "qz: ordering eigenvalues: ord_job = " << ord_job[0] << endl; #endif // declared static to avoid vfork/long jump compiler complaints @@ -616,23 +616,23 @@ double eps = DBL_EPSILON*inf_norm*nn; #ifdef DEBUG_SORT - cout << "qz: calling dsubsp: aa=" << endl; - octave_print_internal (cout, aa, 0); - cout << endl << "bb=" << endl; - octave_print_internal (cout, bb, 0); + std::cout << "qz: calling dsubsp: aa=" << endl; + octave_print_internal (std::cout, aa, 0); + std::cout << endl << "bb=" << endl; + octave_print_internal (std::cout, bb, 0); if (compz == 'V') { - cout << endl << "ZZ=" << endl; - octave_print_internal (cout, ZZ, 0); + std::cout << endl << "ZZ=" << endl; + octave_print_internal (std::cout, ZZ, 0); } - cout << endl; - cout << "alphar = " << endl; - octave_print_internal (cout, (Matrix) alphar, 0); - cout << endl << "alphai = " << endl; - octave_print_internal (cout, (Matrix) alphai, 0); - cout << endl << "beta = " << endl; - octave_print_internal (cout, (Matrix) betar, 0); - cout << endl; + std::cout << endl; + std::cout << "alphar = " << endl; + octave_print_internal (std::cout, (Matrix) alphar, 0); + std::cout << endl << "alphai = " << endl; + octave_print_internal (std::cout, (Matrix) alphai, 0); + std::cout << endl << "beta = " << endl; + octave_print_internal (std::cout, (Matrix) betar, 0); + std::cout << endl; #endif F77_XFCN (dsubsp, DSUBSP, @@ -640,16 +640,16 @@ ZZ.fortran_vec(), sort_test, eps, ndim, fail, ind)); #ifdef DEBUG - cout << "qz: back from dsubsp: aa=" << endl; - octave_print_internal (cout, aa, 0); - cout << endl << "bb=" << endl; - octave_print_internal (cout, bb, 0); + std::cout << "qz: back from dsubsp: aa=" << endl; + octave_print_internal (std::cout, aa, 0); + std::cout << endl << "bb=" << endl; + octave_print_internal (std::cout, bb, 0); if (compz == 'V') { - cout << endl << "ZZ=" << endl; - octave_print_internal (cout, ZZ, 0); + std::cout << endl << "ZZ=" << endl; + octave_print_internal (std::cout, ZZ, 0); } - cout << endl; + std::cout << endl; #endif // manually update alphar, alphai, betar @@ -659,7 +659,7 @@ while (jj < nn) { #ifdef DEBUG_EIG - cout << "computing gen eig #" << jj << endl; + std::cout << "computing gen eig #" << jj << endl; #endif static int zcnt; // number of zeros in this block @@ -673,10 +673,10 @@ if (zcnt == 1) // real zero { #ifdef DEBUG_EIG - cout << " single gen eig:" << endl; - cout << " alphar(" << jj << ") = " << aa(jj,jj) << endl; - cout << " betar( " << jj << ") = " << bb(jj,jj) << endl; - cout << " alphai(" << jj << ") = 0" << endl; + std::cout << " single gen eig:" << endl; + std::cout << " alphar(" << jj << ") = " << aa(jj,jj) << endl; + std::cout << " betar( " << jj << ") = " << bb(jj,jj) << endl; + std::cout << " alphai(" << jj << ") = 0" << endl; #endif alphar(jj) = aa(jj,jj); @@ -687,17 +687,17 @@ { // complex conjugate pair #ifdef DEBUG_EIG - cout << "qz: calling dlag2:" << endl; - cout << "safmin=" + std::cout << "qz: calling dlag2:" << endl; + std::cout << "safmin=" << setiosflags (ios::scientific) << safmin << endl; for (int idr = jj; idr <= jj+1; idr++) { for (int idc = jj; idc <= jj+1; idc++) { - cout << "aa(" << idr << "," << idc << ")=" + std::cout << "aa(" << idr << "," << idc << ")=" << aa(idr,idc) << endl; - cout << "bb(" << idr << "," << idc << ")=" + std::cout << "bb(" << idr << "," << idc << ")=" << bb(idr,idc) << endl; } } @@ -709,7 +709,7 @@ scale1, scale2, wr1, wr2, wi)); #ifdef DEBUG_EIG - cout << "dlag2 returns: scale1=" << scale1 + std::cout << "dlag2 returns: scale1=" << scale1 << "\tscale2=" << scale2 << endl << "\twr1=" << wr1 << "\twr2=" << wr2 << "\twi=" << wi << endl; @@ -738,25 +738,25 @@ } #ifdef DEBUG_SORT - cout << "qz: back from dsubsp: aa=" << endl; - octave_print_internal (cout, aa, 0); - cout << endl << "bb=" << endl; - octave_print_internal (cout, bb, 0); + std::cout << "qz: back from dsubsp: aa=" << endl; + octave_print_internal (std::cout, aa, 0); + std::cout << endl << "bb=" << endl; + octave_print_internal (std::cout, bb, 0); if (compz == 'V') { - cout << endl << "ZZ=" << endl; - octave_print_internal (cout, ZZ, 0); + std::cout << endl << "ZZ=" << endl; + octave_print_internal (std::cout, ZZ, 0); } - cout << endl << "qz: ndim=" << ndim << endl + std::cout << endl << "qz: ndim=" << ndim << endl << "fail=" << fail << endl; - cout << "alphar = " << endl; - octave_print_internal (cout, (Matrix) alphar, 0); - cout << endl << "alphai = " << endl; - octave_print_internal (cout, (Matrix) alphai, 0); - cout << endl << "beta = " << endl; - octave_print_internal (cout, (Matrix) betar, 0); - cout << endl; + std::cout << "alphar = " << endl; + octave_print_internal (std::cout, (Matrix) alphar, 0); + std::cout << endl << "alphai = " << endl; + octave_print_internal (std::cout, (Matrix) alphai, 0); + std::cout << endl << "beta = " << endl; + octave_print_internal (std::cout, (Matrix) betar, 0); + std::cout << endl; #endif } } @@ -774,7 +774,7 @@ else { #ifdef DEBUG - cout << "qz: computing generalized eigenvalues" << endl; + std::cout << "qz: computing generalized eigenvalues" << endl; #endif // return finite generalized eigenvalues @@ -809,7 +809,7 @@ else { #ifdef DEBUG - cout << "qz: computing generalized eigenvectors" << endl; + std::cout << "qz: computing generalized eigenvectors" << endl; #endif VL = QQ; @@ -889,9 +889,9 @@ if (nargin == 3) { #ifdef DEBUG - cout << "qz: sort: retval(3) = gev = " << endl; - octave_print_internal (cout, gev); - cout << endl; + std::cout << "qz: sort: retval(3) = gev = " << endl; + octave_print_internal (std::cout, gev); + std::cout << endl; #endif retval(3) = gev; } @@ -906,11 +906,11 @@ case 2: #ifdef DEBUG - cout << "qz: retval (1) = bb = " << endl; - octave_print_internal (cout, bb, 0); - cout << endl << "qz: retval(0) = aa = " <<endl; - octave_print_internal (cout, aa, 0); - cout << endl; + std::cout << "qz: retval (1) = bb = " << endl; + octave_print_internal (std::cout, bb, 0); + std::cout << endl << "qz: retval(0) = aa = " <<endl; + octave_print_internal (std::cout, aa, 0); + std::cout << endl; #endif retval(1) = bb; retval(0) = aa; @@ -919,7 +919,7 @@ case 1: case 0: #ifdef DEBUG - cout << "qz: retval(0) = gev = " << gev << endl; + std::cout << "qz: retval(0) = gev = " << gev << endl; #endif retval(0) = gev; break; @@ -930,7 +930,7 @@ } #ifdef DEBUG - cout << "qz: exiting (at long last)" << endl; + std::cout << "qz: exiting (at long last)" << endl; #endif return retval;
--- a/src/Map.cc +++ b/src/Map.cc @@ -104,7 +104,7 @@ void Map<C>::error (const std::string& msg) const { - cerr << "Map: " << msg << "\n"; + std::cerr << "Map: " << msg << "\n"; } // CHMap class.
--- a/src/Stack.cc +++ b/src/Stack.cc @@ -36,7 +36,7 @@ void Stack<T>::error (const char *msg) { - cerr << msg; + std::cerr << msg; } /*
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -73,7 +73,11 @@ if (cd_ok) do_external_plotter_cd (newdir); else - error ("%s: %s", newdir.c_str (), strerror (errno)); + { + using namespace std; + + error ("%s: %s", newdir.c_str (), strerror (errno)); + } return cd_ok; }
--- a/src/error.cc +++ b/src/error.cc @@ -69,14 +69,14 @@ if (name) { octave_diary << name << ": "; - cerr << name << ": "; + std::cerr << name << ": "; } octave_diary.vform (fmt, args); - cerr.vform (fmt, args); + std::cerr.vform (fmt, args); octave_diary << endl; - cerr << endl; + std::cerr << endl; } static void @@ -128,7 +128,7 @@ else { octave_diary << msg; - cerr << msg; + std::cerr << msg; } delete [] msg;
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -73,15 +73,15 @@ void initialize_file_io (void) { - octave_stream stdin_stream = octave_istream::create (&cin, "stdin"); + octave_stream stdin_stream = octave_istream::create (&std::cin, "stdin"); - // This uses octave_stdout (see pager.h), not cout so that Octave's + // This uses octave_stdout (see pager.h), not std::cout so that Octave's // standard output stream will pass through the pager. octave_stream stdout_stream = octave_ostream::create (&octave_stdout, "stdout"); - octave_stream stderr_stream = octave_ostream::create (&cerr, "stderr"); + octave_stream stderr_stream = octave_ostream::create (&std::cerr, "stderr"); stdin_file = octave_stream_list::insert (stdin_stream); stdout_file = octave_stream_list::insert (stdout_stream);
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1803,11 +1803,11 @@ if (format != LS_UNKNOWN) { // XXX FIXME XXX -- if we have already seen EOF on a - // previous call, how do we fix up the state of cin so that - // we can get additional input? I'm afraid that we can't - // fix this using cin only. - - retval = do_load (cin, orig_fname, force, format, flt_fmt, + // previous call, how do we fix up the state of std::cin so + // that we can get additional input? I'm afraid that we + // can't fix this using std::cin only. + + retval = do_load (std::cin, orig_fname, force, format, flt_fmt, list_only, swap, verbose, argv, i, argc, nargout); }
--- a/src/oct-fstrm.cc +++ b/src/oct-fstrm.cc @@ -48,7 +48,11 @@ fs.open (nm.c_str (), md, 0666); if (! fs) - error (strerror (errno)); + { + using namespace std; + + error (strerror (errno)); + } } // Position a stream at OFFSET relative to ORIGIN.
--- a/src/oct-procbuf.cc +++ b/src/oct-procbuf.cc @@ -162,11 +162,15 @@ if (status < 0 || ::close (fd ()) < 0) return -1; - do - { - wait_pid = ::waitpid (proc_pid, &wstatus, 0); - } - while (wait_pid == -1 && errno == EINTR); + { + using namespace std; + + do + { + wait_pid = ::waitpid (proc_pid, &wstatus, 0); + } + while (wait_pid == -1 && errno == EINTR); + } if (wait_pid == -1) return -1;
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -494,20 +494,22 @@ { scanf_format_elt *elt = list(i); - cerr << "width: " << elt->width << "\n" - << "discard: " << elt->discard << "\n" - << "type: "; + std::cerr + << "width: " << elt->width << "\n" + << "discard: " << elt->discard << "\n" + << "type: "; if (elt->type == scanf_format_elt::literal_conversion) - cerr << "literal text\n"; + std::cerr << "literal text\n"; else if (elt->type == scanf_format_elt::whitespace_conversion) - cerr << "whitespace\n"; + std::cerr << "whitespace\n"; else - cerr << elt->type << "\n"; - - cerr << "modifier: " << elt->modifier << "\n" - << "char_class: `" << undo_string_escapes (elt->char_class) << "'\n" - << "text: `" << undo_string_escapes (elt->text) << "'\n\n"; + std::cerr << elt->type << "\n"; + + std::cerr + << "modifier: " << elt->modifier << "\n" + << "char_class: `" << undo_string_escapes (elt->char_class) << "'\n" + << "text: `" << undo_string_escapes (elt->text) << "'\n\n"; } } @@ -816,10 +818,10 @@ { printf_format_elt *elt = list(i); - cerr << elt->args<< "\t" - << elt->type << "\t" - << elt->modifier << "\t" - << undo_string_escapes (elt->text) << "\n"; + std::cerr << elt->args<< "\t" + << elt->type << "\t" + << elt->modifier << "\t" + << undo_string_escapes (elt->text) << "\n"; } } @@ -2990,7 +2992,8 @@ { int retval = -1; - // Can't remove stdin (cin), stdout (cout), or stderr (cerr). + // Can't remove stdin (std::cin), stdout (std::cout), or stderr + // (std::cerr). if (fid > 2 && fid < curr_len) { @@ -3152,7 +3155,8 @@ { std::string nm = fid.string_value (); - // stdin (cin), stdout (cout), and stderr (cerr) are unnamed. + // stdin (std::cin), stdout (std::cout), and stderr (std::cerr) + // are unnamed. for (int i = 3; i < curr_len; i++) {
--- a/src/octave.cc +++ b/src/octave.cc @@ -264,7 +264,7 @@ static void verbose_usage (void) { - cout << OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\ + std::cout << OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\ \n\ Usage: octave [options]\n\ \n\ @@ -303,14 +303,14 @@ static void usage (void) { - cerr << "usage: " << usage_string << "\n"; + std::cerr << "usage: " << usage_string << "\n"; exit (1); } static void print_version_and_exit (void) { - cout << OCTAVE_NAME_AND_VERSION << "\n"; + std::cout << OCTAVE_NAME_AND_VERSION << "\n"; exit (0); } @@ -489,7 +489,7 @@ initialize_command_input (); if (! inhibit_startup_message) - cout << OCTAVE_STARTUP_MESSAGE "\n" << endl; + std::cout << OCTAVE_STARTUP_MESSAGE "\n" << endl; if (traditional) maximum_braindamage (); @@ -499,7 +499,7 @@ command_history::read (false); if (! inhibit_startup_message && reading_startup_message_printed) - cout << endl; + std::cout << endl; // Avoid counting commands executed from startup files.
--- a/src/ov.cc +++ b/src/ov.cc @@ -517,8 +517,8 @@ octave_value::~octave_value (void) { #if defined (MDEBUG) - cerr << "~octave_value: rep: " << rep - << " rep->count: " << rep->count << "\n"; + std::cerr << "~octave_value: rep: " << rep + << " rep->count: " << rep->count << "\n"; #endif if (rep && --rep->count == 0)
--- a/src/pager.cc +++ b/src/pager.cc @@ -108,7 +108,7 @@ // Avoid warning() or error(), since that will put us back in // the pager, which would be bad news. - cerr << "warning: connection to external pager (pid = " + std::cerr << "warning: connection to external pager (pid = " << pid << ") lost --\n" << "warning: attempting to finish pending computations...\n"; } @@ -122,8 +122,8 @@ { if (bypass_pager) { - cout.write (msg, len); - cout.flush (); + std::cout.write (msg, len); + std::cout.flush (); } else { @@ -178,8 +178,8 @@ } else { - cout.write (msg, len); - cout.flush (); + std::cout.write (msg, len); + std::cout.flush (); } } }
--- a/src/parse.y +++ b/src/parse.y @@ -2734,15 +2734,15 @@ if (verbose) { - cout << "reading commands from " << s << " ... "; + std::cout << "reading commands from " << s << " ... "; reading_startup_message_printed = true; - cout.flush (); + std::cout.flush (); } parse_and_execute (f); if (verbose) - cout << "done." << endl; + std::cout << "done." << endl; } else if (warn_for) error ("%s: unable to open file `%s'", warn_for, s.c_str ());
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -313,7 +313,7 @@ // Just testing... // char *message = plot_buf.str (); - // cout << "[*]" << message << "[*]\n"; + // std::cout << "[*]" << message << "[*]\n"; if (parametric_plot && ndim == 2) {
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -123,7 +123,7 @@ octave_set_signal_handler (SIGABRT, SIG_DFL); #endif - cerr << "error: attempted clean up apparently failed -- aborting...\n"; + std::cerr << "error: attempted clean up apparently failed -- aborting...\n"; abort (); } @@ -131,7 +131,7 @@ { been_there_done_that = true; - cerr << "error: " << sig_name << " -- stopping myself...\n"; + std::cerr << "error: " << sig_name << " -- stopping myself...\n"; save_user_variables (); @@ -151,7 +151,7 @@ static void octave_new_handler (void) { - cerr << "error: memory exhausted -- trying to return to prompt\n"; + std::cerr << "error: memory exhausted -- trying to return to prompt\n"; if (can_interrupt) { @@ -256,7 +256,7 @@ MAYBE_REINSTALL_SIGHANDLER (SIGFPE, sigfpe_handler); - cerr << "error: floating point exception -- trying to return to prompt\n"; + std::cerr << "error: floating point exception -- trying to return to prompt\n"; if (can_interrupt) { @@ -318,7 +318,7 @@ MAYBE_REINSTALL_SIGHANDLER (SIGPIPE, sigpipe_handler); if (pipe_handler_error_count++ == 0) - cerr << "warning: broken pipe\n"; + std::cerr << "warning: broken pipe\n"; // Don't loop forever on account of this.
--- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -29,7 +29,6 @@ #include <config.h> #endif -#include <cerrno> #include <cstdio> #include <cstring>
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -313,7 +313,7 @@ { int c; raw_mode (1); - c = cin.get (); + c = std::cin.get (); raw_mode (0); return c; }
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -99,7 +99,7 @@ { raw_mode (0); - cout << "\n"; + std::cout << "\n"; octave_restore_signal_mask (); } @@ -536,7 +536,7 @@ flush_octave_stdout (); if (!quitting_gracefully && (interactive || forced_interactive)) - cout << "\n"; + std::cout << "\n"; } } @@ -690,7 +690,7 @@ } if (debug_new_delete) - cout << "__builtin_new: " << p << endl; + std::cout << "__builtin_new: " << p << endl; return p; } @@ -699,7 +699,7 @@ __builtin_delete (void *ptr) { if (debug_new_delete) - cout << "__builtin_delete: " << ptr << endl; + std::cout << "__builtin_delete: " << ptr << endl; if (ptr) free (ptr);