Mercurial > hg > octave-terminal
changeset 240:a99f28f5e351
[project @ 1993-11-30 20:24:36 by jwe]
line wrap: on
line diff
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h> @@ -86,7 +86,7 @@ } else if (nr > 1 && nc > 1 && do_ftn_idx) { - double *cop_out = m.fortran_vec (); + const double *cop_out = m.data (); len = nr * nc; data = new int [len]; for (int i = 0; i < len; i++) @@ -108,7 +108,7 @@ } else { - error ("invalid matrix used as index"); + ::error ("invalid matrix used as index"); return; } @@ -123,7 +123,7 @@ if (len < 0) { - error ("invalid range used as index"); + ::error ("invalid range used as index"); return; } else if (len == 0) @@ -217,7 +217,7 @@ } else if (min_val < 0) { - error ("%s index %d out of range", rc, min_val+1); + ::error ("%s index %d out of range", rc, min_val+1); initialized = 0; return; } @@ -275,7 +275,7 @@ { if (n < 0 || n >= len) { - error ("idx-vector: index out of range"); + ::error ("idx-vector: index out of range"); return 0; }
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -24,10 +24,6 @@ #if !defined (_idx_vector_h) #define _idx_vector_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class ostream; class Matrix; class Range;
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -13,10 +13,6 @@ srcdir = @srcdir@ VPATH = @srcdir@:@srcdir@/../bsd-math -# Can this be fixed? - -INCFLAGS = -I. -I$(srcdir)/../liboctave -I$(srcdir)/.. -I$(srcdir) -I$(TOPDIR)/liboctave -I$(TOPDIR) - LIBOBJS = @LIBOBJS@ # Cancel default rule for .c from .y and make .cc from .y instead. @@ -87,7 +83,7 @@ sysdep.cc t-builtins.cc tc-assign.cc tc-extras.cc \ tc-index.cc tc-inlines.cc token.cc tree.cc tree-const.cc \ tree-plot.cc unwind-prot.cc user-prefs.cc utils.cc \ - variables.cc xdiv.cc xpow.cc + variables.cc xdiv.cc xpow.cc SLStack.cc DEP_SOURCES_2 = $(patsubst %.l, %.cc, $(SOURCES)) DEP_SOURCES_1 = $(patsubst %.y, %.cc, $(DEP_SOURCES_2)) @@ -106,7 +102,7 @@ pr-output.o procstream.o sighandlers.o symtab.o sysdep.o \ t-builtins.o tc-assign.o tc-extras.o tc-index.o token.o \ tree.o tree-const.o tree-plot.o unwind-prot.o user-prefs.o \ - utils.o variables.o xdiv.o xpow.o \ + utils.o variables.o xdiv.o xpow.o SLStack.o \ @DYNAMIC_LD_OBJ@ OCTAVE_LIBS = ../liboctave.a ../libcruft.a ../libinfo.a \
--- a/src/SLStack.h +++ b/src/SLStack.h @@ -16,12 +16,12 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +#if !defined (_SLStack_h) +#define _SLStack_h 1 -#ifndef _SLStack_h -#ifdef __GNUG__ -//#pragma interface +#if defined (__GNUG__) && defined (USE_EXTERNAL_TEMPLATES) +#pragma interface #endif -#define _SLStack_h 1 #include "SLList.h" #include "Stack.h" @@ -53,83 +53,15 @@ int OK (void); }; -template <class T> -inline SLStack<T>::SLStack (void) : p () { } - -template <class T> -inline SLStack<T>::SLStack (const SLStack<T>& a) : p (a.p) { } - -template <class T> -inline SLStack<T>::~SLStack (void) { } - -template <class T> -inline void -SLStack<T>::push (const T& item) -{ - p.prepend (item); -} - -template <class T> -inline T -SLStack<T>::pop (void) -{ - return p.remove_front (); -} - -template <class T> -inline T& -SLStack<T>::top (void) -{ - return p.front (); -} - -template <class T> -inline void -SLStack<T>::del_top (void) -{ - p.del_front (); -} - -template <class T> -inline void -SLStack<T>::operator = (const SLStack<T>& s) -{ - p = s.p; -} - -template <class T> -inline int -SLStack<T>::empty (void) -{ - return p.empty (); -} - -template <class T> -inline int -SLStack<T>::full (void) -{ - return 0; -} - -template <class T> -inline int -SLStack<T>::length (void) -{ - return p.length (); -} - -template <class T> -inline int -SLStack<T>::OK (void) -{ - return p.OK (); -} - -template <class T> -inline void -SLStack<T>::clear (void) -{ - p.clear (); -} +#if defined (__GNUG__) && ! defined (USE_EXTERNAL_TEMPLATES) +#include "SLStack.cc" +#endif #endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; page-delimiter: "^/\\*" *** +;;; End: *** +*/
--- a/src/Stack.h +++ b/src/Stack.h @@ -18,10 +18,11 @@ #ifndef _Stack_h -#ifdef __GNUG__ -//#pragma interface +#define _Stack_h 1 + +#if defined (__GNUG__) && defined (USE_EXTERNAL_TEMPLATES) +// #pragma interface #endif -#define _Stack_h 1 template <class T> class Stack
--- a/src/arith-ops.cc +++ b/src/arith-ops.cc @@ -22,8 +22,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <ctype.h> @@ -1329,7 +1329,7 @@ break; case tree::el_mul: if (m_add_conform (a, b, 1)) - result = a.product (b); + result = product (a, b); break; case tree::multiply: if (m_mul_conform (a, b, 1)) @@ -1337,11 +1337,11 @@ break; case tree::el_div: if (m_add_conform (a, b, 1)) - result = a.quotient (b); + result = quotient (a, b); break; case tree::el_leftdiv: if (m_add_conform (a, b, 1)) - result = b.quotient (a); + result = quotient (b, a); break; case tree::leftdiv: return xleftdiv (a, b); @@ -1514,7 +1514,7 @@ case tree::el_mul: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.product (b); + complex_result = product (a, b); break; case tree::multiply: result_type = RT_complex; @@ -1524,12 +1524,12 @@ case tree::el_div: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.quotient (b); + complex_result = quotient (a, b); break; case tree::el_leftdiv: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = b.quotient (a); + complex_result = quotient (b, a); break; case tree::leftdiv: return xleftdiv (a, b); @@ -2082,7 +2082,7 @@ case tree::el_mul: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.product (b); + complex_result = product (a, b); break; case tree::multiply: result_type = RT_complex; @@ -2092,12 +2092,12 @@ case tree::el_div: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.quotient (b); + complex_result = quotient (a, b); break; case tree::el_leftdiv: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.quotient (b); + complex_result = quotient (a, b); break; case tree::leftdiv: return xleftdiv (a, b); @@ -2285,7 +2285,7 @@ case tree::el_mul: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.product (b); + complex_result = product (a, b); break; case tree::multiply: result_type = RT_complex; @@ -2295,12 +2295,12 @@ case tree::el_div: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = a.quotient (b); + complex_result = quotient (a, b); break; case tree::el_leftdiv: result_type = RT_complex; if (m_add_conform (a, b, 1)) - complex_result = b.quotient (a); + complex_result = quotient (b, a); break; case tree::leftdiv: return xleftdiv (a, b);
--- a/src/arith-ops.h +++ b/src/arith-ops.h @@ -25,10 +25,6 @@ #if !defined (_arith_ops_h) #define _arith_ops_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include "tree-base.h" class Complex;
--- a/src/balance.cc +++ b/src/balance.cc @@ -23,8 +23,8 @@ // Written by A. S. Hodel <scotte@eng.auburn.edu> -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h" @@ -218,7 +218,7 @@ } } - GEPBALANCE result(aa, bb, bal_job); + GEPBALANCE result (aa, bb, bal_job); if (arg.is_complex_type () || brg.is_complex_type ()) {
--- a/src/builtins.cc +++ b/src/builtins.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h>
--- a/src/builtins.h +++ b/src/builtins.h @@ -24,10 +24,6 @@ #if !defined (_builtins_h) #define _builtins_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class ostrstream; class Complex; struct help_list;
--- a/src/chol.cc +++ b/src/chol.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/colloc.cc +++ b/src/colloc.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "CollocWt.h"
--- a/src/dassl.cc +++ b/src/dassl.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "DAE.h"
--- a/src/det.cc +++ b/src/det.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif extern "C"
--- a/src/dynamic-ld.h +++ b/src/dynamic-ld.h @@ -24,10 +24,6 @@ #if !defined (_dynamic_ld_h) #define _dynamic_ld_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class tree_constant; typedef tree_constant* (*builtin_fcn_ptr) (tree_constant*, int, int);
--- a/src/eig.cc +++ b/src/eig.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/error.cc +++ b/src/error.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <stdio.h> @@ -97,6 +97,7 @@ verror ("panic", fmt, args); va_end (args); abort (); + exit (1); } /*
--- a/src/error.h +++ b/src/error.h @@ -24,10 +24,6 @@ #if !defined (_error_h) #define _error_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #define panic_impossible() \ panic ("impossible state reached in file `%s' at line %d", \ __FILE__, __LINE__)
--- a/src/expm.cc +++ b/src/expm.cc @@ -23,8 +23,8 @@ // Written by A. S. Hodel <scotte@eng.auburn.edu> -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <math.h>
--- a/src/fft.cc +++ b/src/fft.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -23,8 +23,8 @@ // Written by John C. Campbell <jcc@che.utexas.edu>. -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <DLList.h> @@ -50,21 +50,21 @@ // keeps a count of args sent to printf or scanf static int fmt_arg_count = 0; -class File_info +class file_info { public: - File_info (void); - File_info (int num, const char *nm, FILE *t, const char *md); - File_info (const File_info& f); + file_info (void); + file_info (int num, const char *nm, FILE *t, const char *md); + file_info (const file_info& f); - File_info& operator = (const File_info& f); + file_info& operator = (const file_info& f); - ~File_info (void); + ~file_info (void); int number (void) const; - char *name (void) const; + const char *name (void) const; FILE *fptr (void) const; - char *mode (void) const; + const char *mode (void) const; private: int _number; @@ -73,7 +73,7 @@ char *_mode; }; -File_info::File_info (void) +file_info::file_info (void) { _number = -1; _name = (char *) NULL; @@ -81,7 +81,15 @@ _mode = (char *) NULL; } -File_info::File_info (const File_info& f) +file_info::file_info (int n, const char *nm, FILE *t, const char *md) +{ + _number = n; + _name = strsave (nm); + _fptr = t; + _mode = strsave (md); +} + +file_info::file_info (const file_info& f) { _number = f._number; _name = strsave (f._name); @@ -89,65 +97,61 @@ _mode = strsave (f._mode); } -File_info& -File_info::operator = (const File_info& f) +file_info& +file_info::operator = (const file_info& f) { - _number = f._number; - _name = strsave (f._name); - _fptr = f._fptr; - _mode = strsave (f._mode); - + if (this != & f) + { + _number = f._number; + delete [] _name; + _name = strsave (f._name); + _fptr = f._fptr; + delete [] _mode; + _mode = strsave (f._mode); + } return *this; } -File_info::~File_info (void) +file_info::~file_info (void) { delete [] _name; delete [] _mode; } -File_info::File_info (int n, const char *nm, FILE *t, const char *md) -{ - _number = n; - _name = strsave (nm); - _fptr = t; - _mode = strsave (md); -} - int -File_info::number (void) const +file_info::number (void) const { return _number; } -char * -File_info::name (void) const +const char * +file_info::name (void) const { return _name; } FILE * -File_info::fptr (void) const +file_info::fptr (void) const { return _fptr; } -char * -File_info::mode (void) const +const char * +file_info::mode (void) const { return _mode; } // double linked list containing relevant information about open files -static DLList <File_info> file_list; +static DLList <file_info> file_list; void initialize_file_io (void) { - File_info _stdin (0, "stdin", stdin, "r"); - File_info _stdout (1, "stdout", stdout, "w"); - File_info _stderr (2, "stderr", stderr, "w"); + file_info _stdin (0, "stdin", stdin, "r"); + file_info _stdout (1, "stdout", stdout, "w"); + file_info _stderr (2, "stderr", stderr, "w"); file_list.append (_stdin); file_list.append (_stdout); @@ -162,7 +166,7 @@ if (arg.is_string_type ()) { Pix p = file_list.first (); - File_info file; + file_info file; for (int i = 0; i < file_count; i++) { char *file_name = arg.string_value (); @@ -180,7 +184,7 @@ else { Pix p = file_list.first (); - File_info file; + file_info file; for (int i = 0; i < file_count; i++) { file = file_list (p); @@ -205,11 +209,11 @@ FILE *file_ptr = fopen (file_name, mode); if (file_ptr != (FILE *) NULL) { - File_info file (++file_count, file_name, file_ptr, mode); + file_info file (++file_count, file_name, file_ptr, mode); file_list.append (file); Pix p = file_list.first (); - File_info file_from_list; + file_info file_from_list; for (int i = 0; i < file_count; i++) { @@ -221,6 +225,7 @@ } error ("problems automatically opening file for user"); + return (Pix) NULL; } @@ -235,7 +240,7 @@ if (p == (Pix) NULL) return retval; - File_info file = file_list (p); + file_info file = file_list (p); if (file.number () < 3) { @@ -269,7 +274,7 @@ if (p == (Pix) NULL) return retval; - File_info file = file_list (p); + file_info file = file_list (p); if (strcmp (file.mode (), "r") == 0) { @@ -278,6 +283,7 @@ } int success = 0; + if (file.number () == 1) flush_output_to_pager (); else @@ -351,7 +357,7 @@ } char string[length+1]; - File_info file = file_list (p); + file_info file = file_list (p); char *success = fgets (string, length+1, file.fptr ()); if (success == (char *) NULL) @@ -390,7 +396,7 @@ if (p != (Pix) NULL) { - File_info file = file_list (p); + file_info file = file_list (p); retval = new tree_constant[2]; retval[0] = tree_constant ((double) file.number ()); @@ -430,7 +436,7 @@ int number = file_count++; - File_info file (number, name, file_ptr, mode); + file_info file (number, name, file_ptr, mode); file_list.append (file); retval = new tree_constant[2]; @@ -450,7 +456,7 @@ output_buf << "\n number mode name\n\n"; for (int i = 0; i < file_count; i++) { - File_info file = file_list (p); + file_info file = file_list (p); output_buf.form ("%7d%6s %s\n", file.number (), file.mode (), file.name ()); file_list.next (p); @@ -471,7 +477,7 @@ if (p == (Pix) NULL) p = fopen_file_for_user (args[1], "a+"); - File_info file = file_list (p); + file_info file = file_list (p); rewind (file.fptr ()); return retval; @@ -516,7 +522,7 @@ } } - File_info file = file_list (p); + file_info file = file_list (p); int success = fseek (file.fptr (), offset, origin); retval = new tree_constant[2]; @@ -540,7 +546,7 @@ if (p == (Pix) NULL) p = fopen_file_for_user (args[1], "a+"); - File_info file = file_list (p); + file_info file = file_list (p); long offset = ftell (file.fptr ()); retval = new tree_constant[2]; retval[0] = tree_constant ((double) offset); @@ -558,7 +564,7 @@ for (int i = 0; i < file_count; i++) { - File_info file = file_list (p); + file_info file = file_list (p); if (i > 2) // do not close stdin, stdout, stderr! { int success = fclose (file.fptr ()); @@ -775,7 +781,7 @@ tree_constant *retval = NULL_TREE_CONST; fmt_arg_count = 1; char *fmt; - File_info file; + file_info file; if (strcmp (type, "fprintf") == 0) { @@ -1058,7 +1064,7 @@ char *tmp_file = (char *) NULL; int tmp_file_open = 0; FILE *fptr = (FILE *) NULL; - File_info file; + file_info file; fmt_arg_count = 0;
--- a/src/file-io.h +++ b/src/file-io.h @@ -26,10 +26,6 @@ #if !defined (_files_h) #define _files_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <Pix.h> class tree_constant;
--- a/src/fsolve.cc +++ b/src/fsolve.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "NLEqn.h"
--- a/src/fsqp.cc +++ b/src/fsqp.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #ifndef FSQP_MISSING
--- a/src/g-builtins.cc +++ b/src/g-builtins.cc @@ -29,8 +29,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h>
--- a/src/g-builtins.h +++ b/src/g-builtins.h @@ -24,10 +24,6 @@ #if !defined (_g_builtins_h) #define _g_builtins_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include "tree-const.h" struct builtin_general_functions
--- a/src/givens.cc +++ b/src/givens.cc @@ -23,8 +23,8 @@ // Written by A. S. Hodel <scotte@eng.auburn.edu> -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/gripes.cc +++ b/src/gripes.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "gripes.h"
--- a/src/gripes.h +++ b/src/gripes.h @@ -24,10 +24,6 @@ #if !defined (_gripes_h) #define _gripes_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - extern void gripe_string_invalid (void); extern void gripe_range_invalid (void); extern void gripe_nonconformant (void);
--- a/src/help.cc +++ b/src/help.cc @@ -21,11 +21,12 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h> + #include "builtins.h" #include "help.h"
--- a/src/help.h +++ b/src/help.h @@ -24,10 +24,6 @@ #if !defined (_help_h) #define _help_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - typedef struct help_list { char *name;
--- a/src/hess.cc +++ b/src/hess.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/ifft.cc +++ b/src/ifft.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/input.cc +++ b/src/input.cc @@ -23,8 +23,8 @@ // Use the GNU readline library for command line editing and hisory. -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <stdio.h>
--- a/src/input.h +++ b/src/input.h @@ -26,10 +26,6 @@ #if !defined (_input_h) #define _input_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <stdio.h> extern char *octave_gets (void);
--- a/src/inv.cc +++ b/src/inv.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/lex.h +++ b/src/lex.h @@ -93,6 +93,9 @@ // See if a function file has extra garbage after the end statement. extern void check_for_garbage_after_fcn_def (void); +// Return transpose or start a string? +extern int quote_is_transpose; + #endif /*
--- a/src/lex.l +++ b/src/lex.l @@ -30,6 +30,10 @@ %{ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "input.h" #include "token.h" @@ -65,7 +69,7 @@ static int braceflag = 0; // Return transpose or start a string? -static int quote_is_transpose = 0; +int quote_is_transpose = 0; // Nonzero means that we should convert spaces to a comma inside a // matrix definition.
--- a/src/lpsolve.cc +++ b/src/lpsolve.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "LPsolve.h"
--- a/src/lsode.cc +++ b/src/lsode.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "ODE.h"
--- a/src/lu.cc +++ b/src/lu.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <float.h>
--- a/src/mappers.h +++ b/src/mappers.h @@ -24,10 +24,6 @@ #if !defined (_mappers_h) #define _mappers_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class Complex; #include "missing-math.h"
--- a/src/npsol.cc +++ b/src/npsol.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #ifndef NPSOL_MISSING
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -28,8 +28,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h>
--- a/src/oct-hist.h +++ b/src/oct-hist.h @@ -24,10 +24,6 @@ #if !defined (_octave_hist_h) #define _octave_hist_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - extern void initialize_history (void); extern void clean_up_history (void); extern void maybe_save_history (char*);
--- a/src/octave.cc +++ b/src/octave.cc @@ -23,8 +23,8 @@ // Born February 20, 1992. -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h> @@ -44,7 +44,7 @@ #include "getopt.h" -#include "liboctave-error.h" +#include "lo-error.h" #include "sighandlers.h" #include "variables.h"
--- a/src/pager.cc +++ b/src/pager.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h>
--- a/src/pager.h +++ b/src/pager.h @@ -24,10 +24,6 @@ #if !defined (_pager_h) #define _pager_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class ostrstream; extern char *get_pager (void);
--- a/src/parse.y +++ b/src/parse.y @@ -28,6 +28,10 @@ %{ #define YYDEBUG 1 +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "SLStack.h" #include "Matrix.h" @@ -765,6 +769,16 @@ { $$ = $1; } | matrix { $$ = $1; } + | '[' ']' + { + mlnm.pop (); + $$ = new tree_constant (Matrix ()); + } + | '[' ';' ']' + { + mlnm.pop (); + $$ = new tree_constant (Matrix ()); + } | colon_expr { $$ = $1; } | PLUS_PLUS identifier %prec UNARY @@ -919,8 +933,6 @@ tree_function *fcn = new tree_function ($3, curr_sym_tab); $$ = fcn->define_param_list ($1); } - | '(' ')' optsep opt_list fcn_end_or_eof - { $$ = new tree_function ($4, curr_sym_tab); } | optsep opt_list fcn_end_or_eof { $$ = new tree_function ($2, curr_sym_tab); } ; @@ -966,14 +978,21 @@ } ; -param_list : param_list1 ')' +param_list : '(' ')' { + quote_is_transpose = 0; + $$ = (tree_parameter_list *) NULL; + } + | param_list1 ')' + { + quote_is_transpose = 0; tree_parameter_list *tmp = $1->reverse (); tmp->mark_as_formal_parameters (); $$ = tmp; } | param_list1 ',' ELLIPSIS ')' { + quote_is_transpose = 0; tree_parameter_list *tmp = $1->reverse (); tmp->mark_as_formal_parameters (); tmp->mark_varargs (); @@ -1036,17 +1055,7 @@ } ; -matrix : '[' ']' - { - mlnm.pop (); - $$ = new tree_matrix (); - } - | '[' ';' ']' - { - mlnm.pop (); - $$ = new tree_matrix (); - } - | '[' screwed_again rows ']' +matrix : '[' screwed_again rows ']' { mlnm.pop (); maybe_screwed_again--;
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h>
--- a/src/pr-output.h +++ b/src/pr-output.h @@ -24,10 +24,6 @@ #if !defined (_pr_output_h) #define _pr_output_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class ostrstream; class Matrix;
--- a/src/procstream.cc +++ b/src/procstream.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "procstream.h"
--- a/src/procstream.h +++ b/src/procstream.h @@ -24,10 +24,6 @@ #if !defined (_procstream_h) #define _procstream_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <iostream.h> #include <procbuf.h>
--- a/src/pt-base.h +++ b/src/pt-base.h @@ -28,9 +28,6 @@ #include <time.h> #include <assert.h> -// NOTE: don\'t put #pragma interface here because there is no -// corresponding tree-base.cc file that implements this class! - #ifndef NULL_TREE #define NULL_TREE (tree *)NULL #endif
--- a/src/pt-const.cc +++ b/src/pt-const.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <ctype.h> @@ -396,9 +396,9 @@ delete range; type_tag = unknown_constant; if (nel == -1) - error ("number of elements in range exceeds INT_MAX"); + ::error ("number of elements in range exceeds INT_MAX"); else - error ("invalid range"); + ::error ("invalid range"); } else if (nel > 1) type_tag = range_constant; @@ -582,11 +582,11 @@ else { if (i > nr) - error ("row index = %d exceeds max row dimension = %d", i, nr); + ::error ("row index = %d exceeds max row dimension = %d", i, nr); if (j > nc) - error ("column index = %d exceeds max column dimension = %d", - j, nc); + ::error ("column index = %d exceeds max column dimension = %d", + j, nc); } } } @@ -615,21 +615,21 @@ resize (1, i, 0.0); } else - error ("matrix index = %d exceeds max dimension = %d", i, nc); + ::error ("matrix index = %d exceeds max dimension = %d", i, nc); } else if (nr == 1 && i > nc) { if (user_pref.resize_on_range_error) resize (1, i, 0.0); else - error ("matrix index = %d exceeds max dimension = %d", i, nc); + ::error ("matrix index = %d exceeds max dimension = %d", i, nc); } else if (nc == 1 && i > nr) { if (user_pref.resize_on_range_error) resize (i, 1, 0.0); else - error ("matrix index = %d exceeds max dimension = ", i, nc); + ::error ("matrix index = %d exceeds max dimension = ", i, nc); } } @@ -663,14 +663,14 @@ if (flag != 0) { ComplexMatrix m = tmp.complex_matrix_value (); - return real (m (0, 0)); + return ::real (m (0, 0)); } else jump_to_top_level (); } else { - error ("complex matrix used in invalid context"); + ::error ("complex matrix used in invalid context"); jump_to_top_level (); } break; @@ -757,8 +757,8 @@ { if (! force_str_conv && ! user_pref.implicit_str_to_num_ok) { - error ("failed to convert `%s' to a numeric type --", string); - error ("default conversion turned off"); + ::error ("failed to convert `%s' to a numeric type --", string); + ::error ("default conversion turned off"); // Abort! jump_to_top_level (); } @@ -777,6 +777,13 @@ type_tag = scalar_constant; scalar = toascii ((int) string[0]); } + else if (len == 0) + { + type_tag = matrix_constant; + matrix = new Matrix (0, 0); + } + else + panic_impossible (); } break; case range_constant: @@ -856,7 +863,7 @@ warning ("binary operation on empty matrix"); else if (flag == 0) { - error ("invalid binary operation on empty matrix"); + ::error ("invalid binary operation on empty matrix"); return ans; } } @@ -998,7 +1005,7 @@ warning ("unary operation on empty matrix"); else if (flag == 0) { - error ("invalid unary operation on empty matrix"); + ::error ("invalid unary operation on empty matrix"); return ans; } } @@ -1054,7 +1061,7 @@ *complex_matrix = *complex_matrix + 1.0; break; case string_constant: - error ("string++ and ++string not implemented yet, ok?"); + ::error ("string++ and ++string not implemented yet, ok?"); break; case range_constant: range->set_base (range->base () + 1.0); @@ -1076,7 +1083,7 @@ *matrix = *matrix - 1.0; break; case string_constant: - error ("string-- and -- string not implemented yet, ok?"); + ::error ("string-- and -- string not implemented yet, ok?"); break; case range_constant: range->set_base (range->base () - 1.0); @@ -1103,9 +1110,9 @@ switch (type_tag) { case complex_scalar_constant: - if (imag (*complex_scalar) == 0.0) + if (::imag (*complex_scalar) == 0.0) { - double d = real (*complex_scalar); + double d = ::real (*complex_scalar); delete complex_scalar; scalar = d; type_tag = scalar_constant; @@ -1114,7 +1121,7 @@ case complex_matrix_constant: if (! any_element_is_complex (*complex_matrix)) { - Matrix *m = new Matrix (real (*complex_matrix)); + Matrix *m = new Matrix (::real (*complex_matrix)); delete complex_matrix; matrix = m; type_tag = matrix_constant; @@ -1370,7 +1377,7 @@ } break; default: - error ("for now, I can only save real matrices in 3D format"); + ::error ("for now, I can only save real matrices in 3D format"); return 0; break; } @@ -1415,10 +1422,10 @@ else if (strncmp (ptr, "range", 5) == 0) type_tag = load (is, range_constant); else - error ("unknown constant type `%s'", tag); + ::error ("unknown constant type `%s'", tag); } else - error ("failed to extract keyword specifying value type"); + ::error ("failed to extract keyword specifying value type"); } return is_global; @@ -1436,7 +1443,7 @@ if (is) status = scalar_constant; else - error ("failed to load scalar constant"); + ::error ("failed to load scalar constant"); break; case matrix_constant: { @@ -1450,10 +1457,10 @@ if (is) status = matrix_constant; else - error ("failed to load matrix constant"); + ::error ("failed to load matrix constant"); } else - error ("failed to extract number of rows and columns"); + ::error ("failed to extract number of rows and columns"); } break; case complex_scalar_constant: @@ -1461,7 +1468,7 @@ if (is) status = complex_scalar_constant; else - error ("failed to load complex scalar constant"); + ::error ("failed to load complex scalar constant"); break; case complex_matrix_constant: { @@ -1475,10 +1482,10 @@ if (is) status = complex_matrix_constant; else - error ("failed to load complex matrix constant"); + ::error ("failed to load complex matrix constant"); } else - error ("failed to extract number of rows and columns"); + ::error ("failed to extract number of rows and columns"); } break; case string_constant: @@ -1491,10 +1498,10 @@ if (is) status = string_constant; else - error ("failed to load string constant"); + ::error ("failed to load string constant"); } else - error ("failed to extract string length"); + ::error ("failed to extract string length"); } break; case range_constant: @@ -1504,7 +1511,7 @@ if (is) status = range_constant; else - error ("failed to load range constant"); + ::error ("failed to load range constant"); break; default: panic_impossible (); @@ -1527,9 +1534,10 @@ warning ("implicit conversion of complex value to real value"); if (flag != 0) - return real (*complex_scalar); + return ::real (*complex_scalar); - error ("implicit conversion of complex value to real value not allowed"); + ::error ("implicit conversion of complex value to real value"); + ::error ("not allowed"); jump_to_top_level (); } default: @@ -1544,7 +1552,7 @@ switch (type_tag) { case scalar_constant: - return Matrix (scalar); + return Matrix (1, 1, scalar); case matrix_constant: return *matrix; case complex_scalar_constant: @@ -1557,14 +1565,17 @@ if (flag != 0) { if (type_tag == complex_scalar_constant) - return Matrix (real (*complex_scalar)); + return Matrix (1, 1, ::real (*complex_scalar)); else if (type_tag == complex_matrix_constant) - return real (*complex_matrix); + return ::real (*complex_matrix); else panic_impossible (); } else - error ("implicit conversion of complex matrix to real matrix not allowed"); + { + ::error ("implicit conversion of complex matrix to real matrix"); + ::error ("not allowed"); + } jump_to_top_level (); } default: @@ -1595,11 +1606,11 @@ { case scalar_constant: { - return ComplexMatrix (scalar); + return ComplexMatrix (1, 1, Complex (scalar)); } case complex_scalar_constant: { - return ComplexMatrix (*complex_scalar); + return ComplexMatrix (1, 1, *complex_scalar); } case matrix_constant: { @@ -1647,7 +1658,7 @@ retval = complex_matrix->rows (); break; case magic_colon: - error ("invalid use of colon operator"); + ::error ("invalid use of colon operator"); break; case unknown_constant: retval = 0; @@ -1682,7 +1693,7 @@ retval = range->nelem (); break; case magic_colon: - error ("invalid use of colon operator"); + ::error ("invalid use of colon operator"); break; case unknown_constant: retval = 0; @@ -1811,6 +1822,7 @@ // Warn about out of range conversions? char s[2]; s[0] = (char) i; + s[1] = '\0'; retval = tree_constant (s); } break; @@ -1820,7 +1832,7 @@ ColumnVector v = to_vector (); int len = v.length (); if (len == 0) - error ("can only convert vectors and scalars to strings"); + ::error ("can only convert vectors and scalars to strings"); else { char *s = new char [len+1]; @@ -2263,7 +2275,7 @@ } } else - error ("diag: invalid second argument"); + ::error ("diag: invalid second argument"); break; case complex_scalar_constant: @@ -2302,7 +2314,7 @@ } } else - error ("diag: invalid second argument"); + ::error ("diag: invalid second argument"); break; case string_constant:
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -24,10 +24,6 @@ #if !defined (_tree_const_h) #define _tree_const_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <stdlib.h> #include "builtins.h"
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <iostream.h> @@ -425,7 +425,7 @@ tree_constant lower_val = lower->eval (0); if (error_state) { - error ("evaluating lower bound of plot range"); + ::error ("evaluating lower bound of plot range"); return; } else @@ -442,7 +442,7 @@ tree_constant upper_val = upper->eval (0); if (error_state) { - error ("evaluating upper bound of plot range"); + ::error ("evaluating upper bound of plot range"); return; } else @@ -519,7 +519,7 @@ tree_constant tmp = x[i]->eval (0); if (error_state) { - error ("evaluating plot using command"); + ::error ("evaluating plot using command"); return -1; } @@ -536,7 +536,7 @@ if (n > n_max || n < 1) { - error ("using: column %d out of range", n); + ::error ("using: column %d out of range", n); return -1; } else @@ -614,7 +614,7 @@ } else { - error ("evaluating plot style command"); + ::error ("evaluating plot style command"); return -1; } } @@ -629,7 +629,7 @@ } else { - error ("evaluating plot style command"); + ::error ("evaluating plot style command"); return -1; } }
--- a/src/qpsol.cc +++ b/src/qpsol.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #ifndef QPSOL_MISSING
--- a/src/qr.cc +++ b/src/qr.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/quad.cc +++ b/src/quad.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Quad.h"
--- a/src/qzval.cc +++ b/src/qzval.cc @@ -23,8 +23,8 @@ // Written by A. S. Hodel <scotte@eng.auburn.edu> -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <float.h>
--- a/src/rand.cc +++ b/src/rand.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "tree-const.h"
--- a/src/schur.cc +++ b/src/schur.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <signal.h>
--- a/src/sighandlers.h +++ b/src/sighandlers.h @@ -24,10 +24,6 @@ #if !defined (_sighandlers_h) #define _sighandlers_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - // Nonzero means we have already printed a message for this series of // SIGPIPES. We assume that the writer will eventually give up. extern int pipe_handler_error_count;
--- a/src/svd.cc +++ b/src/svd.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/syl.cc +++ b/src/syl.cc @@ -23,8 +23,8 @@ // Written by A. S. Hodel <scotte@eng.auburn.edu> -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "Matrix.h"
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -21,12 +21,12 @@ */ -#ifdef __GNUG__ -#pragma implementation +// Don't even think about moving the tree.h include to symtab.h... + +#ifdef HAVE_CONFIG_H +#include "config.h" #endif -// Don't even think about moving the tree.h include to symtab.h... - #include "symtab.h" #include "error.h" #include "variables.h" @@ -666,7 +666,7 @@ else if (is_function ()) tag = "function"; - error ("can't redefined read-only %s `%s'", tag, nm); + ::error ("can't redefined read-only %s `%s'", tag, nm); return 1; }
--- a/src/symtab.h +++ b/src/symtab.h @@ -24,10 +24,6 @@ #if !defined (_symtab_h) #define _symtab_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <stdlib.h> #include <string.h> #include <iostream.h>
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <stdlib.h>
--- a/src/t-builtins.cc +++ b/src/t-builtins.cc @@ -33,8 +33,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h>
--- a/src/t-builtins.h +++ b/src/t-builtins.h @@ -24,10 +24,6 @@ #if !defined (_t_builtins_h) #define _t_builtins_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include "tree-const.h" struct builtin_text_functions
--- a/src/tc-assign.cc +++ b/src/tc-assign.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "idx-vector.h" @@ -54,7 +54,7 @@ do_matrix_assignment (rhs_tmp, args, nargs); break; case string_constant: - error ("invalid assignment to string type"); + ::error ("invalid assignment to string type"); break; case range_constant: case magic_colon: @@ -88,7 +88,7 @@ } else { - error ("invalid assignment to scalar"); + ::error ("invalid assignment to scalar"); return; } } @@ -106,7 +106,7 @@ } else { - error ("invalid assignment to scalar"); + ::error ("invalid assignment to scalar"); return; } } @@ -148,9 +148,9 @@ } } else if (nargs > 3 || nargs < 2) - error ("invalid index expression for scalar type"); + ::error ("invalid index expression for scalar type"); else - error ("index invalid or out of range for scalar type"); + ::error ("index invalid or out of range for scalar type"); } void @@ -186,30 +186,30 @@ { case 2: if (args == NULL_TREE_CONST) - error ("matrix index is null"); + ::error ("matrix index is null"); else if (args[1].is_undefined ()) - error ("matrix index is undefined"); + ::error ("matrix index is undefined"); else if (args[1].is_empty ()) - error ("matrix index is an empty matrix"); + ::error ("matrix index is an empty matrix"); else do_matrix_assignment (rhs, args[1]); break; case 3: if (args == NULL_TREE_CONST) - error ("matrix indices are null"); + ::error ("matrix indices are null"); else if (args[1].is_undefined ()) - error ("first matrix index is undefined"); + ::error ("first matrix index is undefined"); else if (args[2].is_undefined ()) - error ("second matrix index is undefined"); + ::error ("second matrix index is undefined"); else if (args[1].is_empty ()) - error ("first matrix index is an empty matrix"); + ::error ("first matrix index is an empty matrix"); else if (args[2].is_empty ()) - error ("second matrix index is an empty matrix"); + ::error ("second matrix index is an empty matrix"); else do_matrix_assignment (rhs, args[1], args[2]); break; default: - error ("too many indices for matrix expression"); + ::error ("too many indices for matrix expression"); break; } } @@ -226,7 +226,7 @@ else if (nr <= 1 || nc <= 1) vector_assignment (rhs, i_arg); else - error ("single index only valid for row or column vector"); + ::error ("single index only valid for row or column vector"); } void @@ -265,7 +265,7 @@ if (! indexed_assign_conforms (1, 1, rhs_nr, rhs_nc)) { - error ("for A(int) = X: X must be a scalar"); + ::error ("for A(int) = X: X must be a scalar"); return; } int ii = fortran_row (i, nr) - 1; @@ -293,8 +293,8 @@ if (ii.capacity () != rhs_nr * rhs_nc) { - error ("A(matrix) = X: X and matrix must have the same number"); - error ("of elements"); + ::error ("A(matrix) = X: X and matrix must have the same number"); + ::error ("of elements"); return; } fortran_style_matrix_assignment (rhs, ii); @@ -381,7 +381,7 @@ if (! indexed_assign_conforms (nr, nc, rhs_nr, rhs_nc)) { - error ("A(:) = X: X and A must have the same dimensions"); + ::error ("A(:) = X: X and A must have the same dimensions"); return; } do_matrix_assignment (rhs, magic_colon, magic_colon); @@ -404,7 +404,7 @@ { if (! (ilen == rhs_nr || ilen == rhs_nc)) { - error ("A(%s) = X: X and %s must have the same number of elements", + ::error ("A(%s) = X: X and %s must have the same number of elements", rm, rm); } } @@ -412,16 +412,16 @@ { if (! (rhs_nr == 1 && rhs_nc == ilen)) { - error ("A(%s) = X: where A is a row vector, X must also be a", rm); - error ("row vector with the same number of elements as %s", rm); + ::error ("A(%s) = X: where A is a row vector, X must also be a", rm); + ::error ("row vector with the same number of elements as %s", rm); } } else if (nc == 1) // Preserve current column orientation. { if (! (rhs_nc == 1 && rhs_nr == ilen)) { - error ("A(%s) = X: where A is a column vector, X must also be", rm); - error ("a column vector with the same number of elements as %s", rm); + ::error ("A(%s) = X: where A is a column vector, X must also be", rm); + ::error ("a column vector with the same number of elements as %s", rm); } } else @@ -465,7 +465,7 @@ if (i < 0 || i >= len) { - error ("A(int) = []: index out of range"); + ::error ("A(int) = []: index out of range"); return; } @@ -478,7 +478,7 @@ } else { - error ("for A(int) = X: X must be a scalar"); + ::error ("for A(int) = X: X must be a scalar"); return; } } @@ -495,7 +495,7 @@ if (iv.max () >= len) { - error ("A(matrix) = []: index out of range"); + ::error ("A(matrix) = []: index out of range"); return; } @@ -559,7 +559,7 @@ int l = tree_to_mat_idx (ri.max ()); if (b < 0 || l >= len) { - error ("A(range) = []: index out of range"); + ::error ("A(range) = []: index out of range"); return; } @@ -646,7 +646,7 @@ } else if (nr*nc != rhs_size) { - error ("A(:) = X: X and A must have the same number of elements"); + ::error ("A(:) = X: X and A must have the same number of elements"); return; } @@ -705,7 +705,7 @@ } } else - error ("number of rows and columns must match for indexed assignment"); + ::error ("number of rows and columns must match for indexed assignment"); } void @@ -792,7 +792,7 @@ return; if (! indexed_assign_conforms (1, 1, rhs_nr, rhs_nc)) { - error ("A(int,int) = X, X must be a scalar"); + ::error ("A(int,int) = X, X must be a scalar"); return; } maybe_resize (i, j); @@ -813,8 +813,8 @@ if (! indexed_assign_conforms (1, jv.capacity (), rhs_nr, rhs_nc)) { - error ("A(int,matrix) = X: X must be a row vector with the same"); - error ("number of elements as matrix"); + ::error ("A(int,matrix) = X: X must be a row vector with the same"); + ::error ("number of elements as matrix"); return; } maybe_resize (i, jv.max ()); @@ -832,8 +832,8 @@ Range rj = tmp_j.range_value (); if (! indexed_assign_conforms (1, rj.nelem (), rhs_nr, rhs_nc)) { - error ("A(int,range) = X: X must be a row vector with the same"); - error ("number of elements as range"); + ::error ("A(int,range) = X: X must be a row vector with the same"); + ::error ("number of elements as range"); return; } @@ -888,14 +888,14 @@ { if (i < 0 || i >= nr) { - error ("A(int,:) = []: row index out of range"); + ::error ("A(int,:) = []: row index out of range"); return; } } else { - error ("A(int,:) = X: X must be a row vector with the same"); - error ("number of columns as A"); + ::error ("A(int,:) = X: X must be a row vector with the same"); + ::error ("number of columns as A"); return; } @@ -929,8 +929,8 @@ return; if (! indexed_assign_conforms (iv.capacity (), 1, rhs_nr, rhs_nc)) { - error ("A(matrix,int) = X: X must be a column vector with the"); - error ("same number of elements as matrix"); + ::error ("A(matrix,int) = X: X must be a column vector with the"); + ::error ("same number of elements as matrix"); return; } maybe_resize (iv.max (), j); @@ -952,9 +952,9 @@ if (! indexed_assign_conforms (iv.capacity (), jv.capacity (), rhs_nr, rhs_nc)) { - error ("A(r_mat,c_mat) = X: the number of rows in X must match"); - error ("the number of elements in r_mat and the number of"); - error ("columns in X must match the number of elements in c_mat"); + ::error ("A(r_mat,c_mat) = X: the number of rows in X must match"); + ::error ("the number of elements in r_mat and the number of"); + ::error ("columns in X must match the number of elements in c_mat"); return; } maybe_resize (iv.max (), jv.max ()); @@ -973,9 +973,9 @@ if (! indexed_assign_conforms (iv.capacity (), rj.nelem (), rhs_nr, rhs_nc)) { - error ("A(matrix,range) = X: the number of rows in X must match"); - error ("the number of elements in matrix and the number of"); - error ("columns in X must match the number of elements in range"); + ::error ("A(matrix,range) = X: the number of rows in X must match"); + ::error ("the number of elements in matrix and the number of"); + ::error ("columns in X must match the number of elements in range"); return; } @@ -1018,15 +1018,15 @@ { if (iv.max () >= rows ()) { - error ("A(matrix,:) = []: row index out of range"); + ::error ("A(matrix,:) = []: row index out of range"); return; } } else { - error ("A(matrix,:) = X: the number of rows in X must match the"); - error ("number of elements in matrix, and the number of columns"); - error ("in X must match the number of columns in A"); + ::error ("A(matrix,:) = X: the number of rows in X must match the"); + ::error ("number of elements in matrix, and the number of columns"); + ::error ("in X must match the number of columns in A"); return; } @@ -1060,8 +1060,8 @@ return; if (! indexed_assign_conforms (ri.nelem (), 1, rhs_nr, rhs_nc)) { - error ("A(range,int) = X: X must be a column vector with the"); - error ("same number of elements as range"); + ::error ("A(range,int) = X: X must be a column vector with the"); + ::error ("same number of elements as range"); return; } maybe_resize (tree_to_mat_idx (ri.max ()), j); @@ -1083,9 +1083,9 @@ if (! indexed_assign_conforms (ri.nelem (), jv.capacity (), rhs_nr, rhs_nc)) { - error ("A(range,matrix) = X: the number of rows in X must match"); - error ("the number of elements in range and the number of"); - error ("columns in X must match the number of elements in matrix"); + ::error ("A(range,matrix) = X: the number of rows in X must match"); + ::error ("the number of elements in range and the number of"); + ::error ("columns in X must match the number of elements in matrix"); return; } maybe_resize (tree_to_mat_idx (ri.max ()), jv.max ()); @@ -1104,10 +1104,10 @@ if (! indexed_assign_conforms (ri.nelem (), rj.nelem (), rhs_nr, rhs_nc)) { - error ("A(r_range,c_range) = X: the number of rows in X must"); - error ("match the number of elements in r_range and the number"); - error ("of columns in X must match the number of elements in"); - error ("c_range"); + ::error ("A(r_range,c_range) = X: the number of rows in X must"); + ::error ("match the number of elements in r_range and the number"); + ::error ("of columns in X must match the number of elements in"); + ::error ("c_range"); return; } @@ -1154,15 +1154,15 @@ int l = tree_to_mat_idx (ri.max ()); if (b < 0 || l >= rows ()) { - error ("A(range,:) = []: row index out of range"); + ::error ("A(range,:) = []: row index out of range"); return; } } else { - error ("A(range,:) = X: the number of rows in X must match the"); - error ("number of elements in range, and the number of columns"); - error ("in X must match the number of columns in A"); + ::error ("A(range,:) = X: the number of rows in X must match the"); + ::error ("number of elements in range, and the number of columns"); + ::error ("in X must match the number of columns in A"); return; } @@ -1223,14 +1223,14 @@ { if (j < 0 || j >= nc) { - error ("A(:,int) = []: column index out of range"); + ::error ("A(:,int) = []: column index out of range"); return; } } else { - error ("A(:,int) = X: X must be a column vector with the same"); - error ("number of rows as A"); + ::error ("A(:,int) = X: X must be a column vector with the same"); + ::error ("number of rows as A"); return; } @@ -1262,15 +1262,15 @@ { if (jv.max () >= columns ()) { - error ("A(:,matrix) = []: column index out of range"); + ::error ("A(:,matrix) = []: column index out of range"); return; } } else { - error ("A(:,matrix) = X: the number of rows in X must match the"); - error ("number of rows in A, and the number of columns in X must"); - error ("match the number of elements in matrix"); + ::error ("A(:,matrix) = X: the number of rows in X must match the"); + ::error ("number of rows in A, and the number of columns in X must"); + ::error ("match the number of elements in matrix"); return; } @@ -1314,15 +1314,15 @@ int l = tree_to_mat_idx (rj.max ()); if (b < 0 || l >= columns ()) { - error ("A(:,range) = []: column index out of range"); + ::error ("A(:,range) = []: column index out of range"); return; } } else { - error ("A(:,range) = X: the number of rows in X must match the"); - error ("number of rows in A, and the number of columns in X"); - error ("must match the number of elements in range"); + ::error ("A(:,range) = X: the number of rows in X must match the"); + ::error ("number of rows in A, and the number of columns in X"); + ::error ("must match the number of elements in range"); return; }
--- a/src/tc-extras.cc +++ b/src/tc-extras.cc @@ -22,8 +22,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <strstream.h>
--- a/src/tc-index.cc +++ b/src/tc-index.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include "idx-vector.h" @@ -136,13 +136,13 @@ } break; default: - error ("illegal number of arguments for scalar type"); + ::error ("illegal number of arguments for scalar type"); return tree_constant (); break; } } - error ("index invalid or out of range for scalar type"); + ::error ("index invalid or out of range for scalar type"); return tree_constant (); } @@ -156,24 +156,24 @@ { case 2: if (args == NULL_TREE_CONST) - error ("matrix index is null"); + ::error ("matrix index is null"); else if (args[1].is_undefined ()) - error ("matrix index is a null expression"); + ::error ("matrix index is a null expression"); else retval = do_matrix_index (args[1]); break; case 3: if (args == NULL_TREE_CONST) - error ("matrix indices are null"); + ::error ("matrix indices are null"); else if (args[1].is_undefined ()) - error ("first matrix index is a null expression"); + ::error ("first matrix index is a null expression"); else if (args[2].is_undefined ()) - error ("second matrix index is a null expression"); + ::error ("second matrix index is a null expression"); else retval = do_matrix_index (args[1], args[2]); break; default: - error ("too many indices for matrix expression"); + ::error ("too many indices for matrix expression"); break; } @@ -193,7 +193,7 @@ else if (nr <= 1 || nc <= 1) retval = do_vector_index (i_arg); else - error ("single index only valid for row or column vector"); + ::error ("single index only valid for row or column vector"); return retval; } @@ -276,15 +276,15 @@ if (index_nr >= 1 && index_nc >= 1) { - double *cop_out = (double *) NULL; - Complex *c_cop_out = (Complex *) NULL; + const double *cop_out = (const double *) NULL; + const Complex *c_cop_out = (const Complex *) NULL; int real_type = type_tag == matrix_constant; if (real_type) - cop_out = matrix->fortran_vec (); + cop_out = matrix->data (); else - c_cop_out = complex_matrix->fortran_vec (); + c_cop_out = complex_matrix->data (); - double *cop_out_index = mi.fortran_vec (); + const double *cop_out_index = mi.data (); idx_vector iv (mi, 1, "", len); if (! iv) @@ -337,9 +337,9 @@ else { if (index_nr == 0 || index_nc == 0) - error ("empty matrix invalid as index"); + ::error ("empty matrix invalid as index"); else - error ("invalid matrix index"); + ::error ("invalid matrix index"); return tree_constant (); }
--- a/src/token.cc +++ b/src/token.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <assert.h>
--- a/src/token.h +++ b/src/token.h @@ -24,10 +24,6 @@ #if !defined (_token_h) #define _token_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class symbol_record; class token
--- a/src/tree.h.old +++ b/src/tree.h.old @@ -24,13 +24,6 @@ #if !defined (_tree_h) #define _tree_h 1 -// This seems to leave vt$tree undefined with g++ 2.3.3. -#if 0 -#ifdef __GNUG__ -#pragma interface -#endif -#endif - #include <stdio.h> class ostrstream;
--- a/src/unwind-prot.cc +++ b/src/unwind-prot.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <stddef.h> @@ -35,27 +35,6 @@ #include "error.h" #include "utils.h" -class unwind_elem -{ - public: - unwind_elem (void); - unwind_elem (char *t); - unwind_elem (cleanup_func f, void *p); - unwind_elem (const unwind_elem& el); - ~unwind_elem (void); - - unwind_elem& operator = (const unwind_elem& el); - - char *tag (void); - cleanup_func fptr (void); - void *ptr (void); - - private: - char *_tag; - cleanup_func _fptr; - void *_ptr; -}; - unwind_elem::unwind_elem (void) { _tag = (char *) NULL;
--- a/src/unwind-prot.h +++ b/src/unwind-prot.h @@ -24,10 +24,6 @@ #if !defined (_unwind_prot_h) #define _unwind_prot_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - typedef void (*cleanup_func)(void *ptr); void add_unwind_protect (cleanup_func fptr, void *ptr); @@ -55,6 +51,27 @@ #define unwind_protect_var(i) \ unwind_protect_var_internal ((void *) &(i), (void *) &(i), sizeof (int)) +class unwind_elem +{ + public: + unwind_elem (void); + unwind_elem (char *t); + unwind_elem (cleanup_func f, void *p); + unwind_elem (const unwind_elem& el); + ~unwind_elem (void); + + unwind_elem& operator = (const unwind_elem& el); + + char *tag (void); + cleanup_func fptr (void); + void *ptr (void); + + private: + char *_tag; + cleanup_func _fptr; + void *_ptr; +}; + #endif /*
--- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <string.h>
--- a/src/user-prefs.h +++ b/src/user-prefs.h @@ -24,10 +24,6 @@ #if !defined (_user_prefs_h) #define _user_prefs_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - struct user_preferences { int do_fortran_indexing;
--- a/src/utils.cc +++ b/src/utils.cc @@ -36,8 +36,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h> @@ -349,11 +349,11 @@ if (pathstring != (char *) NULL) { int nelem = 0; - pathstring = strsave (pathstring); - if (*pathstring != '\0') + char *tmp_path = strsave (pathstring); + if (*tmp_path != '\0') { nelem++; - char *ptr = pathstring; + char *ptr = tmp_path; while (*ptr != '\0') { if (*ptr == ':') @@ -362,12 +362,22 @@ } } +// Why do I have to do this? + + char **foo = path; + while (foo && *foo) + { + delete [] *foo; + *foo = (char *) NULL; + foo++; + } + delete [] path; path = new char * [nelem+1]; path[nelem] = (char *) NULL; int i = 0; - char *ptr = pathstring; + char *ptr = tmp_path; while (i < nelem) { char *end = strchr (ptr, ':'); @@ -380,7 +390,7 @@ i++; } - delete [] pathstring; + delete [] tmp_path; } return path; @@ -533,15 +543,17 @@ char * file_in_path (const char *name, const char *suffix) { + char *retval = (char *) NULL; + char *nm = strconcat ("/", name); - char *tmp = nm; if (suffix != (char *) NULL) { + char *tmp = nm; nm = strconcat (tmp, suffix); delete [] tmp; } - if (!the_current_working_directory) + if (! the_current_working_directory) get_working_directory ("file_in_path"); char **path = pathstring_to_vector (user_pref.loadpath); @@ -551,23 +563,24 @@ { while (*ptr != (char *) NULL) { - char *tmp_p = strconcat (*ptr, nm); - char *p = make_absolute (tmp_p, the_current_working_directory); - delete [] tmp_p; + char *tmp = strconcat (*ptr, nm); + char *p = make_absolute (tmp, the_current_working_directory); + delete [] tmp; ifstream in_file (p); if (in_file) { in_file.close (); - delete [] nm; - return p; + retval = p; + goto done; } delete [] p; ptr++; } } + done: delete [] nm; - return (char *) NULL; + return retval; } /* @@ -590,7 +603,7 @@ int l = home_directory ? strlen (home_directory) : 0; if (l > 1 && strncmp (home_directory, name, l) == 0 - && (!name[l] || name[l] == '/')) + && (! name[l] || name[l] == '/')) { strcpy (tdir + 1, name + l); tdir[0] = '~'; @@ -606,7 +619,7 @@ int absolute_pathname (const char *string) { - if (!string || !*string) + if (! string || ! *string) return 0; if (*string == '/') @@ -614,11 +627,11 @@ if (*string++ == '.') { - if ((!*string) || *string == '/') + if ((! *string) || *string == '/') return 1; if (*string++ == '.') - if (!*string || *string == '/') + if (! *string || *string == '/') return 1; } return 0; @@ -644,7 +657,7 @@ { char *p = strrchr (string, '/'); - if (!absolute_pathname (string)) + if (! absolute_pathname (string)) return (string); if (p) @@ -669,7 +682,7 @@ result = (result * 8) + *string++ - '0'; } - if (!digits || result > 0777 || *string) + if (! digits || result > 0777 || *string) result = -1; return result; @@ -786,7 +799,7 @@ } case 'n': - if (!no_line_editing) + if (! no_line_editing) temp = strsave ("\r\n"); else temp = strsave ("\n"); @@ -810,7 +823,7 @@ temp = user_pref.pwd; - if (!temp) + if (! temp) getcwd (t_string, MAXPATHLEN); else strcpy (t_string, temp); @@ -907,7 +920,7 @@ #if 0 /* I don't really think that this is a good idea. Do you? */ - if (!find_variable ("NO_PROMPT_VARS")) + if (! find_variable ("NO_PROMPT_VARS")) { WORD_LIST *expand_string (), *list; char *string_list (); @@ -931,7 +944,7 @@ { register char *p; - if (!*path) + if (! *path) return; p = path + (strlen (path) - 1); @@ -960,12 +973,12 @@ static char current_path[MAXPATHLEN]; register char *cp; - if (!dot_path || *string == '/') + if (! dot_path || *string == '/') return strsave (string); strcpy (current_path, dot_path); - if (!current_path[0]) + if (! current_path[0]) strcpy (current_path, "./"); cp = current_path + (strlen (current_path) - 1); @@ -979,7 +992,7 @@ { if (*string == '.') { - if (!string[1]) + if (! string[1]) return strsave (current_path); if (string[1] == '/') @@ -988,7 +1001,7 @@ continue; } - if (string[1] == '.' && (string[2] == '/' || !string[2])) + if (string[1] == '.' && (string[2] == '/' || ! string[2])) { string += 2; @@ -1019,7 +1032,7 @@ char * get_working_directory (const char *for_whom) { - if (!follow_symbolic_links) + if (! follow_symbolic_links) { if (the_current_working_directory) delete [] the_current_working_directory; @@ -1027,13 +1040,13 @@ the_current_working_directory = (char *)NULL; } - if (!the_current_working_directory) + if (! the_current_working_directory) { char *directory; the_current_working_directory = new char [MAXPATHLEN]; directory = getcwd (the_current_working_directory, MAXPATHLEN); - if (!directory) + if (! directory) { message (for_whom, the_current_working_directory); delete [] the_current_working_directory; @@ -1056,7 +1069,7 @@ if (follow_symbolic_links) { - if (!the_current_working_directory) + if (! the_current_working_directory) get_working_directory ("cd_links"); if (the_current_working_directory)
--- a/src/utils.h +++ b/src/utils.h @@ -24,10 +24,6 @@ #if !defined (_utils_h) #define _utils_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - #include <time.h> class istream;
--- a/src/variables.cc +++ b/src/variables.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h>
--- a/src/variables.h +++ b/src/variables.h @@ -24,10 +24,6 @@ #if !defined (_variables_h) #define _variables_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class istream; class symbol_record; class symbol_table;
--- a/src/xdiv.cc +++ b/src/xdiv.cc @@ -21,8 +21,8 @@ */ -#ifdef __GNUG__ -#pragma implementation +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <assert.h>
--- a/src/xdiv.h +++ b/src/xdiv.h @@ -24,10 +24,6 @@ #if !defined (_xdiv_h) #define _xdiv_h 1 -#ifdef __GNUG__ -#pragma interface -#endif - class Complex; class Matrix; class ComplexMatrix;