From octave-sources-request at bevo dot che dot wisc dot edu Wed Apr 7 12:54:49 1999 Subject: Compiling Octave with egcs-1.1.2 From: Ariel Tankus To: octave-sources at bevo dot che dot wisc dot edu Date: Wed, 7 Apr 1999 19:54:37 +0200 --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Currently, octave-2.1.14 does not compile with egcs-1.1.2 (aka egcs-2.91.66) due to a single small problem. The problem is that the octave_value class has both a private member called `count' and a method with identical name (trivially returning that variable). The module where a problem arises is symtab.cc, line 56 (error message: sth like: cannot access private member `count'). I find it a good practice to distinct the names of the member variable and the function, regardless of the compiler version. I attach to this e-mail two patches, to the files ov.{cc,h}. The changes are minor. Applying the patches would make octave-2.1.14 compile with egcs-1.1.2. -- Ariel. --- Ariel Tankus Department of Computer Science Tel-Aviv University. --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ov.cc.patch" # This is a patch for /tmp/octave-2.1.14/src/ov.cc to update it to octave-2.1.14/src/ov.cc. # It was generated by makepatch 1.93 (2.0BETA) on Wed Apr 7 16:31:53 1999. # # To apply this patch, chdir to source directory /tmp/octave-2.1.14/src/ov.cc and enter # # patch -p1 -N < exit # End of preamble. # Patch input follows. __DATA__ Index: octave-2.1.14/src/ov.cc ####### => *** /tmp/octave-2.1.14/src/ov.cc Fri Nov 20 19:35:26 1998 --- octave-2.1.14/src/ov.cc Wed Apr 7 11:00:34 1999 *************** *** 325,440 **** octave_value::octave_value (void) : rep (new octave_base_value ()) { ! rep->count = 1; } octave_value::octave_value (double d) : rep (new octave_scalar (d)) { ! rep->count = 1; } octave_value::octave_value (const Matrix& m) : rep (new octave_matrix (m)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const DiagMatrix& d) : rep (new octave_matrix (d)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const RowVector& v, int pcv) : rep (new octave_matrix (v, pcv)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const ColumnVector& v, int pcv) : rep (new octave_matrix (v, pcv)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const Complex& C) : rep (new octave_complex (C)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexMatrix& m) : rep (new octave_complex_matrix (m)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexDiagMatrix& d) : rep (new octave_complex_matrix (d)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexRowVector& v, int pcv) : rep (new octave_complex_matrix (v, pcv)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexColumnVector& v, int pcv) : rep (new octave_complex_matrix (v, pcv)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (bool b) : rep (new octave_bool (b)) { ! rep->count = 1; } octave_value::octave_value (const boolMatrix& bm) : rep (new octave_bool_matrix (bm)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (char c) : rep (new octave_char_matrix_str (c)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const char *s) : rep (new octave_char_matrix_str (s)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const string& s) : rep (new octave_char_matrix_str (s)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const string_vector& s) : rep (new octave_char_matrix_str (s)) { ! rep->count = 1; maybe_mutate (); } --- 325,440 ---- octave_value::octave_value (void) : rep (new octave_base_value ()) { ! rep->ref_count = 1; } octave_value::octave_value (double d) : rep (new octave_scalar (d)) { ! rep->ref_count = 1; } octave_value::octave_value (const Matrix& m) : rep (new octave_matrix (m)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const DiagMatrix& d) : rep (new octave_matrix (d)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const RowVector& v, int pcv) : rep (new octave_matrix (v, pcv)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const ColumnVector& v, int pcv) : rep (new octave_matrix (v, pcv)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const Complex& C) : rep (new octave_complex (C)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexMatrix& m) : rep (new octave_complex_matrix (m)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexDiagMatrix& d) : rep (new octave_complex_matrix (d)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexRowVector& v, int pcv) : rep (new octave_complex_matrix (v, pcv)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const ComplexColumnVector& v, int pcv) : rep (new octave_complex_matrix (v, pcv)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (bool b) : rep (new octave_bool (b)) { ! rep->ref_count = 1; } octave_value::octave_value (const boolMatrix& bm) : rep (new octave_bool_matrix (bm)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (char c) : rep (new octave_char_matrix_str (c)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const char *s) : rep (new octave_char_matrix_str (s)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const string& s) : rep (new octave_char_matrix_str (s)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const string_vector& s) : rep (new octave_char_matrix_str (s)) { ! rep->ref_count = 1; maybe_mutate (); } *************** *** 446,519 **** else rep = new octave_char_matrix (chm); ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (double base, double limit, double inc) : rep (new octave_range (base, limit, inc)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const Range& r) : rep (new octave_range (r)) { ! rep->count = 1; maybe_mutate (); } octave_value::octave_value (const Octave_map& m) : rep (new octave_struct (m)) { ! rep->count = 1; } octave_value::octave_value (octave_stream *s, int n) : rep (new octave_file (s, n)) { ! rep->count = 1; } octave_value::octave_value (octave_function *f) : rep (f) { ! rep->count = 1; } octave_value::octave_value (const octave_value_list& l) : rep (new octave_list (l)) { ! rep->count = 1; } octave_value::octave_value (octave_value::magic_colon) : rep (new octave_magic_colon ()) { ! rep->count = 1; } octave_value::octave_value (octave_value::all_va_args) : rep (new octave_all_va_args ()) { ! rep->count = 1; } octave_value::octave_value (octave_value *new_rep) : rep (new_rep) { ! rep->count = 1; } octave_value::~octave_value (void) { #if defined (MDEBUG) cerr << "~octave_value: rep: " << rep ! << " rep->count: " << rep->count << "\n"; #endif ! if (rep && --rep->count == 0) { delete rep; rep = 0; --- 446,519 ---- else rep = new octave_char_matrix (chm); ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (double base, double limit, double inc) : rep (new octave_range (base, limit, inc)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const Range& r) : rep (new octave_range (r)) { ! rep->ref_count = 1; maybe_mutate (); } octave_value::octave_value (const Octave_map& m) : rep (new octave_struct (m)) { ! rep->ref_count = 1; } octave_value::octave_value (octave_stream *s, int n) : rep (new octave_file (s, n)) { ! rep->ref_count = 1; } octave_value::octave_value (octave_function *f) : rep (f) { ! rep->ref_count = 1; } octave_value::octave_value (const octave_value_list& l) : rep (new octave_list (l)) { ! rep->ref_count = 1; } octave_value::octave_value (octave_value::magic_colon) : rep (new octave_magic_colon ()) { ! rep->ref_count = 1; } octave_value::octave_value (octave_value::all_va_args) : rep (new octave_all_va_args ()) { ! rep->ref_count = 1; } octave_value::octave_value (octave_value *new_rep) : rep (new_rep) { ! rep->ref_count = 1; } octave_value::~octave_value (void) { #if defined (MDEBUG) cerr << "~octave_value: rep: " << rep ! << " rep->ref_count: " << rep->ref_count << "\n"; #endif ! if (rep && --rep->ref_count == 0) { delete rep; rep = 0; *************** *** 533,543 **** if (tmp && tmp != rep) { ! if (--rep->count == 0) delete rep; rep = tmp; ! rep->count = 1; } } --- 533,543 ---- if (tmp && tmp != rep) { ! if (--rep->ref_count == 0) delete rep; rep = tmp; ! rep->ref_count = 1; } } *************** *** 879,898 **** { octave_value *old_rep = rep; rep = tmp; ! rep->count = 1; assignment_ok = try_assignment (op, idx, rhs); if (! assignment_ok && old_rep) { ! if (--rep->count == 0) delete rep; rep = old_rep; old_rep = 0; } ! if (old_rep && --old_rep->count == 0) delete old_rep; } else --- 879,898 ---- { octave_value *old_rep = rep; rep = tmp; ! rep->ref_count = 1; assignment_ok = try_assignment (op, idx, rhs); if (! assignment_ok && old_rep) { ! if (--rep->ref_count == 0) delete rep; rep = old_rep; old_rep = 0; } ! if (old_rep && --old_rep->ref_count == 0) delete old_rep; } else *************** *** 944,950 **** if (tmp) { rep = tmp; ! rep->count = 1; } else { --- 944,950 ---- if (tmp) { rep = tmp; ! rep->ref_count = 1; } else { *************** *** 963,976 **** if (! assignment_ok && old_rep) { ! if (--rep->count == 0) delete rep; rep = old_rep; old_rep = 0; } ! if (old_rep && --old_rep->count == 0) delete old_rep; } --- 963,976 ---- if (! assignment_ok && old_rep) { ! if (--rep->ref_count == 0) delete rep; rep = old_rep; old_rep = 0; } ! if (old_rep && --old_rep->ref_count == 0) delete old_rep; } *************** *** 1192,1198 **** { octave_value *old_rep = rep; rep = tmp; ! rep->count = 1; t = type_id (); --- 1192,1198 ---- { octave_value *old_rep = rep; rep = tmp; ! rep->ref_count = 1; t = type_id (); *************** *** 1202,1215 **** { f (*rep); ! if (old_rep && --old_rep->count == 0) delete old_rep; } else { if (old_rep) { ! if (--rep->count == 0) delete rep; rep = old_rep; --- 1202,1215 ---- { f (*rep); ! if (old_rep && --old_rep->ref_count == 0) delete old_rep; } else { if (old_rep) { ! if (--rep->ref_count == 0) delete rep; rep = old_rep; End of Patch. --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ov.h.patch" # This is a patch for /tmp/octave-2.1.14/src/ov.h to update it to octave-2.1.14/src/ov.h. # It was generated by makepatch 1.93 (2.0BETA) on Wed Apr 7 16:31:31 1999. # # To apply this patch, chdir to source directory /tmp/octave-2.1.14/src/ov.h and enter # # patch -p1 -N < exit # End of preamble. # Patch input follows. __DATA__ Index: octave-2.1.14/src/ov.h ####### => *** /tmp/octave-2.1.14/src/ov.h Fri Mar 26 20:13:03 1999 --- octave-2.1.14/src/ov.h Wed Apr 7 11:01:07 1999 *************** *** 184,193 **** octave_value (const octave_value& a) { rep = a.rep; ! rep->count++; } ! // Delete the representation of this constant if the count drops to // zero. virtual ~octave_value (void); --- 184,193 ---- octave_value (const octave_value& a) { rep = a.rep; ! rep->ref_count++; } ! // Delete the representation of this constant if the ref_count drops to // zero. virtual ~octave_value (void); *************** *** 198,208 **** void make_unique (void) { ! if (rep->count > 1) { ! --rep->count; rep = rep->clone (); ! rep->count = 1; } } --- 198,208 ---- void make_unique (void) { ! if (rep->ref_count > 1) { ! --rep->ref_count; rep = rep->clone (); ! rep->ref_count = 1; } } *************** *** 212,228 **** { if (rep != a.rep) { ! if (--rep->count == 0) delete rep; rep = a.rep; ! rep->count++; } return *this; } ! int count (void) { return rep->count; } virtual type_conv_fcn numeric_conversion_function (void) const { return rep->numeric_conversion_function (); } --- 212,228 ---- { if (rep != a.rep) { ! if (--rep->ref_count == 0) delete rep; rep = a.rep; ! rep->ref_count++; } return *this; } ! int count (void) { return rep->ref_count; } virtual type_conv_fcn numeric_conversion_function (void) const { return rep->numeric_conversion_function (); } *************** *** 504,510 **** union { octave_value *rep; // The real representation. ! int count; // A reference count. }; bool convert_and_assign (assign_op, const octave_value_list& idx, --- 504,510 ---- union { octave_value *rep; // The real representation. ! int ref_count; // A reference count. }; bool convert_and_assign (assign_op, const octave_value_list& idx, End of Patch. --envbJBWh7q8WU6mo--