changeset 6153:e60688a1ea07

[project @ 2006-11-13 17:30:54 by jwe]
author jwe
date Mon, 13 Nov 2006 17:30:55 +0000
parents 2eb0723b4fad
children 08f0dabf17b9
files ChangeLog liboctave/Array-d.cc liboctave/ChangeLog liboctave/dDiagMatrix.h mkoctfile.in src/ChangeLog src/ov-re-mat.h src/ov-scalar.h src/ov.cc src/pr-output.h
diffstat 10 files changed, 163 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 11 19:07:18 2006 +0000
+++ b/ChangeLog	Mon Nov 13 17:30:55 2006 +0000
@@ -1,3 +1,7 @@
+2006-11-13  Rafael Laboissiere  <rafael@debian.org>
+
+	* mkoctfile.in: Add -Wl,... options to ldflags, not pass_on_flags.
+
 2006-11-11  John W. Eaton  <jwe@octave.org>
 
 	* examples/Makefile.in (octave.desktop):
--- a/liboctave/Array-d.cc	Sat Nov 11 19:07:18 2006 +0000
+++ b/liboctave/Array-d.cc	Mon Nov 13 17:30:55 2006 +0000
@@ -38,19 +38,19 @@
 
 #include "Array2.h"
 
-template class Array2<double>;
+template class OCTAVE_API Array2<double>;
 
 #include "ArrayN.h"
 #include "ArrayN.cc"
 
-template class ArrayN<double>;
+template class OCTAVE_API ArrayN<double>;
 
-template std::ostream& operator << (std::ostream&, const ArrayN<double>&);
+template OCTAVE_API std::ostream& operator << (std::ostream&, const ArrayN<double>&);
 
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class DiagArray2<double>;
+template class OCTAVE_API DiagArray2<double>;
 
 /*
 ;;; Local Variables: ***
--- a/liboctave/ChangeLog	Sat Nov 11 19:07:18 2006 +0000
+++ b/liboctave/ChangeLog	Mon Nov 13 17:30:55 2006 +0000
@@ -1,3 +1,7 @@
+2006-11-13  Michael Goffioul  <michael.goffioul@swing.be>
+
+	* Array-d.cc, dDiagMatrix.h: Sprinkle with OCTAVE_API as needed.
+
 2006-11-11  John W. Eaton  <jwe@octave.org>
 
 	* Makefile.in ($(OPTS_INC), mx-ops.h):
--- a/liboctave/dDiagMatrix.h	Sat Nov 11 19:07:18 2006 +0000
+++ b/liboctave/dDiagMatrix.h	Mon Nov 13 17:30:55 2006 +0000
@@ -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:
 
--- a/mkoctfile.in	Sat Nov 11 19:07:18 2006 +0000
+++ b/mkoctfile.in	Mon Nov 13 17:30:55 2006 +0000
@@ -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)
--- a/src/ChangeLog	Sat Nov 11 19:07:18 2006 +0000
+++ b/src/ChangeLog	Mon Nov 13 17:30:55 2006 +0000
@@ -1,3 +1,11 @@
+2006-11-13  Michael Goffioul  <michael.goffioul@swing.be>
+
+	* 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  <jwe@octave.org>
 
 	* Makefile.in (parse.cc): Avoid creating empty files.
--- a/src/ov-re-mat.h	Sat Nov 11 19:07:18 2006 +0000
+++ b/src/ov-re-mat.h	Mon Nov 13 17:30:55 2006 +0000
@@ -50,6 +50,7 @@
 // Real matrix values.
 
 class
+OCTINTERP_API
 octave_matrix : public octave_base_matrix<NDArray>
 {
 public:
--- a/src/ov-scalar.h	Sat Nov 11 19:07:18 2006 +0000
+++ b/src/ov-scalar.h	Mon Nov 13 17:30:55 2006 +0000
@@ -50,6 +50,7 @@
 // Real scalar values.
 
 class
+OCTINTERP_API
 octave_scalar : public octave_base_scalar<double>
 {
 public:
--- a/src/ov.cc	Sat Nov 11 19:07:18 2006 +0000
+++ b/src/ov.cc	Mon Nov 13 17:30:55 2006 +0000
@@ -1880,6 +1880,139 @@
   return retval;
 }
 
+static void
+decode_subscripts (const char* name, const octave_value& arg,
+		   std::string& type_string,
+		   std::list<octave_value_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<octave_value_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<octave_value_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++ ***
--- a/src/pr-output.h	Sat Nov 11 19:07:18 2006 +0000
+++ b/src/pr-output.h	Mon Nov 13 17:30:55 2006 +0000
@@ -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