# HG changeset patch # User jwe # Date 1163439055 0 # Node ID e60688a1ea0728afd5e099ac301e67545e54d625 # Parent 2eb0723b4fad841897f1508537133b940e08f107 [project @ 2006-11-13 17:30:54 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-11-13 Rafael Laboissiere + + * mkoctfile.in: Add -Wl,... options to ldflags, not pass_on_flags. + 2006-11-11 John W. Eaton * examples/Makefile.in (octave.desktop): diff --git a/liboctave/Array-d.cc b/liboctave/Array-d.cc --- a/liboctave/Array-d.cc +++ b/liboctave/Array-d.cc @@ -38,19 +38,19 @@ #include "Array2.h" -template class Array2; +template class OCTAVE_API Array2; #include "ArrayN.h" #include "ArrayN.cc" -template class ArrayN; +template class OCTAVE_API ArrayN; -template std::ostream& operator << (std::ostream&, const ArrayN&); +template OCTAVE_API std::ostream& operator << (std::ostream&, const ArrayN&); #include "DiagArray2.h" #include "DiagArray2.cc" -template class DiagArray2; +template class OCTAVE_API DiagArray2; /* ;;; Local Variables: *** diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2006-11-13 Michael Goffioul + + * Array-d.cc, dDiagMatrix.h: Sprinkle with OCTAVE_API as needed. + 2006-11-11 John W. Eaton * Makefile.in ($(OPTS_INC), mx-ops.h): diff --git a/liboctave/dDiagMatrix.h b/liboctave/dDiagMatrix.h --- a/liboctave/dDiagMatrix.h +++ b/liboctave/dDiagMatrix.h @@ -72,8 +72,8 @@ DiagMatrix transpose (void) const; - friend DiagMatrix real (const ComplexDiagMatrix& a); - friend DiagMatrix imag (const ComplexDiagMatrix& a); + friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); + friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); // resize is the destructive analog for this one @@ -97,7 +97,7 @@ // i/o - friend std::ostream& operator << (std::ostream& os, const DiagMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a); private: diff --git a/mkoctfile.in b/mkoctfile.in --- a/mkoctfile.in +++ b/mkoctfile.in @@ -146,7 +146,9 @@ -RDIR Add -RDIR to link command. - -W Pass flags though the compiler like -Wl,-rpath=... + -Wl,... Pass flags though the linker like -Wl,-rpath=... + + -W... Pass flags though the compiler like -Wa,OPTION. -c, --compile Compile, but do not link. @@ -218,7 +220,7 @@ -D*) defs="$defs $1" ;; - -[lLR]*) + -[lLR]* | -Wl,*) ldflags="$ldflags $1" ;; -M | --depend) diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2006-11-13 Michael Goffioul + + * ov.cc (check_subsref_elements, Fsubsref, Fsubsasgn): + New functions. + + * ov-re-mat.h, ov-scalar.h, pr-output.h: + Sprinkle with OCTAVE_API as needed. + 2006-11-11 John W. Eaton * Makefile.in (parse.cc): Avoid creating empty files. diff --git a/src/ov-re-mat.h b/src/ov-re-mat.h --- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -50,6 +50,7 @@ // Real matrix values. class +OCTINTERP_API octave_matrix : public octave_base_matrix { public: diff --git a/src/ov-scalar.h b/src/ov-scalar.h --- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -50,6 +50,7 @@ // Real scalar values. class +OCTINTERP_API octave_scalar : public octave_base_scalar { public: diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -1880,6 +1880,139 @@ return retval; } +static void +decode_subscripts (const char* name, const octave_value& arg, + std::string& type_string, + std::list& idx) +{ + Octave_map m = arg.map_value (); + + if (! error_state + && m.length () == 2 && m.contains ("type") && m.contains ("subs")) + { + Cell& type = m.contents ("type"); + Cell& subs = m.contents ("subs"); + + type_string = std::string (type.length(), '\0'); + + for (int k = 0; k < type.length (); k++) + { + std::string item = type(k).string_value (); + + if (! error_state) + { + if (item == "{}") + type_string[k] = '{'; + else if (item == "()") + type_string[k] = '('; + else if (item == ".") + type_string[k] = '.'; + else + { + error("%s: invalid indexing type `%s'", name, item.c_str ()); + return; + } + } + else + { + error ("%s: expecting type(%d) to be a character string", + name, k+1); + return; + } + + octave_value_list idx_item; + + if (subs(k).is_string ()) + idx_item(0) = subs(k); + else if (subs(k).is_cell ()) + { + Cell subs_cell = subs(k).cell_value (); + + for (int n = 0; n < subs_cell.length (); n++) + { + if (subs_cell(n).is_string () + && subs_cell(n).string_value () == ":") + idx_item(n) = octave_value(octave_value::magic_colon_t); + else + idx_item(n) = subs_cell(n); + } + } + else + { + error ("%s: expecting subs(%d) to be a character string or cell array", + name, k+1); + return; + } + + idx.push_back (idx_item); + } + } + else + error ("%s: second argument must be a structure with fields `type' and `subs'", name); +} + +DEFUN (subsref, args, nargout, + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} subsref (@var{val}, @var{idx})\n\ +Perform the subscripted element selection operation according to\n\ +the subscript specified by @var{idx}.\n\ +\n\ +The subscript @var{idx} is expected to be a structure array with\n\ +fields @samp{type} and @samp{subs}. Valid values for @samp{type}\n\ +are @samp{\"()\"}, @samp{\"@{@}\", and @samp{\".\"}.\n\ +The @samp{subs} field may be either @samp{\":\"} or a cell array\n\ +of index values.\n\ +@end deftypefn") +{ + octave_value_list retval; + + if (args.length () == 2) + { + std::string type; + std::list idx; + + decode_subscripts ("subsref", args(1), type, idx); + + if (! error_state) + retval = args(0).subsref (type, idx, nargout); + } + else + print_usage (); + + return retval; +} + +DEFUN (subsasgn, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} subsasgn (@var{val}, @var{idx}, @var{rhs})\n\ +Perform the subscripted assignment operation according to\n\ +the subscript specified by @var{idx}.\n\ +\n\ +The subscript @var{idx} is expected to be a structure array with\n\ +fields @samp{type} and @samp{subs}. Valid values for @samp{type}\n\ +are @samp{\"()\"}, @samp{\"@{@}\", and @samp{\".\"}.\n\ +The @samp{subs} field may be either @samp{\":\"} or a cell array\n\ +of index values.\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 3) + { + std::string type; + std::list idx; + + decode_subscripts ("subsasgn", args(1), type, idx); + + if (! error_state) + retval = args(0).subsasgn (type, idx, args(2)); + } + else + print_usage (); + + return retval; +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/pr-output.h b/src/pr-output.h --- a/src/pr-output.h +++ b/src/pr-output.h @@ -130,7 +130,7 @@ extern bool Vprint_empty_dimensions; // How many levels of structure elements should we print? -extern int Vstruct_levels_to_print; +extern OCTINTERP_API int Vstruct_levels_to_print; #endif