changeset 6072:4036e6fca790

[project @ 2006-10-24 01:00:12 by jwe]
author jwe
date Tue, 24 Oct 2006 01:00:13 +0000
parents 950d8cb39617
children 934146a33e83
files doc/interpreter/emacs.txi libcruft/ChangeLog libcruft/misc/f77-fcn.h liboctave/Array.cc liboctave/ChangeLog src/ChangeLog src/symtab.cc src/symtab.h src/toplev.cc src/variables.cc src/variables.h
diffstat 11 files changed, 109 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/emacs.txi	Mon Oct 23 19:30:28 2006 +0000
+++ b/doc/interpreter/emacs.txi	Tue Oct 24 01:00:13 2006 +0000
@@ -339,9 +339,9 @@
 
 @cindex TAGS
 @cindex Emacs TAGS files
-@cindex @code{otags}
+@cindex @code{octave-tags}
 You can generate TAGS files for Emacs from Octave @file{.m} files using
-the shell script @code{otags} that is installed alongside your copy of
+the shell script @code{octave-tags} that is installed alongside your copy of
 Octave.
 
 Customization of Octave mode can be performed by modification of the
--- a/libcruft/ChangeLog	Mon Oct 23 19:30:28 2006 +0000
+++ b/libcruft/ChangeLog	Tue Oct 24 01:00:13 2006 +0000
@@ -1,3 +1,10 @@
+2006-10-23  Paul Kienzle  <pkienzle@users.sf.net>
+
+	* misc/f77-fcn.h (F77_CHAR_ARG_DEF, F77_CONST_CHAR_ARG_DEF,
+	F77_CHAR_ARG_LEN_DEF, F77_CHAR_ARG_USE, F77_CHAR_ARG_LEN_USE,
+	F77_CSTRING): New macros to handle passing C character strings to
+	Fortran.
+
 2006-10-17  Michael Goffioul  <michael.goffioul@swing.be>
 
 	* lapack-xtra/xdlamch.f: Begin lines with spaces, not tabs.
--- a/libcruft/misc/f77-fcn.h	Mon Oct 23 19:30:28 2006 +0000
+++ b/libcruft/misc/f77-fcn.h	Tue Oct 24 01:00:13 2006 +0000
@@ -87,6 +87,8 @@
 #if defined (F77_USES_CRAY_CALLING_CONVENTION)
 
 #include <fortran.h>
+
+/* Use these macros to pass character strings from C to Fortran.  */
 #define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x))
 #define F77_CONST_CHAR_ARG(x) \
   octave_make_cray_const_ftn_ch_dsc (x, strlen (x))
@@ -98,6 +100,15 @@
 #define F77_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
 #define F77_CONST_CHAR_ARG_DECL octave_cray_ftn_ch_dsc
 #define F77_CHAR_ARG_LEN_DECL
+
+/* Use these macros to write C-language functions that accept
+   Fortran-style character strings.  */
+#define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
+#define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s
+#define F77_CHAR_ARG_LEN_DEF(len) 
+#define F77_CHAR_ARG_USE(s) s.ptr
+#define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3)
+
 #define F77_RET_T int
 #define F77_RETURN(retval) return retval;
 
@@ -148,6 +159,7 @@
 
 #elif defined (F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION)
 
+/* Use these macros to pass character strings from C to Fortran.  */
 #define F77_CHAR_ARG(x) x, strlen (x)
 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
 #define F77_CHAR_ARG2(x, l) x, l
@@ -157,6 +169,15 @@
 #define F77_CHAR_ARG_DECL char *, int
 #define F77_CONST_CHAR_ARG_DECL const char *, int
 #define F77_CHAR_ARG_LEN_DECL
+
+/* Use these macros to write C-language functions that accept
+   Fortran-style character strings.  */
+#define F77_CHAR_ARG_DEF(s, len) char *s, int len
+#define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len
+#define F77_CHAR_ARG_LEN_DEF(len) 
+#define F77_CHAR_ARG_USE(s) s
+#define F77_CHAR_ARG_LEN_USE(s, len) len
+
 #define F77_RET_T void
 #define F77_RETURN(retval)
 
@@ -164,6 +185,7 @@
 
 /* Assume f2c-compatible calling convention.  */
 
+/* Use these macros to pass character strings from C to Fortran.  */
 #define F77_CHAR_ARG(x) x
 #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x)
 #define F77_CHAR_ARG2(x, l) x
@@ -173,11 +195,33 @@
 #define F77_CHAR_ARG_DECL char *
 #define F77_CONST_CHAR_ARG_DECL const char *
 #define F77_CHAR_ARG_LEN_DECL , long
+
+/* Use these macros to write C-language functions that accept
+   Fortran-style character strings.  */
+#define F77_CHAR_ARG_DEF(s, len) char *s
+#define F77_CONST_CHAR_ARG_DEF(s, len) const char *s
+#define F77_CHAR_ARG_LEN_DEF(len) , long len
+#define F77_CHAR_ARG_USE(s) s
+#define F77_CHAR_ARG_LEN_USE(s, len) len
+
 #define F77_RET_T int
 #define F77_RETURN(retval) return retval;
 
 #endif
 
+
+/* Build a C string local variable CS from the Fortran string parameter S
+   declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len).
+   The string will be cleaned up at the end of the current block.  
+   Needs to include <cstring> and <vector>.  */
+
+#define F77_CSTRING(s, len, cs) \
+ OCTAVE_LOCAL_BUFFER (char, F77_CHAR_ARG_USE (s), \
+		      F77_CHAR_ARG_LEN_USE (s, len) + 1); \
+ memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \
+ cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0' 
+
+
 extern F77_RET_T
 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DECL
 			   F77_CHAR_ARG_LEN_DECL) GCC_ATTR_NORETURN;
--- a/liboctave/Array.cc	Mon Oct 23 19:30:28 2006 +0000
+++ b/liboctave/Array.cc	Tue Oct 24 01:00:13 2006 +0000
@@ -2691,6 +2691,27 @@
 			}
 		    }
 		}
+	      else if ((n == 1 || m == 1)
+		       && (rhs_nr == 1 || rhs_nc == 1)
+		       && n * m == rhs_nr * rhs_nc)
+		{
+		  if (n > 0 && m > 0)
+		    {
+		      MAYBE_RESIZE_LHS;
+
+		      octave_idx_type k = 0;
+
+		      for (octave_idx_type j = 0; j < m; j++)
+			{
+			  octave_idx_type jj = idx_j.elem (j);
+			  for (octave_idx_type i = 0; i < n; i++)
+			    {
+			      octave_idx_type ii = idx_i.elem (i);
+			      lhs.elem (ii, jj) = xrhs.elem (k++);
+			    }
+			}
+		    }
+		}
 	      else if (n == rhs_nr && m == rhs_nc)
 		{
 		  if (n > 0 && m > 0)
--- a/liboctave/ChangeLog	Mon Oct 23 19:30:28 2006 +0000
+++ b/liboctave/ChangeLog	Tue Oct 24 01:00:13 2006 +0000
@@ -1,3 +1,7 @@
+2006-10-23  John W. Eaton  <jwe@octave.org>
+
+	* Array.cc (assign2): Don't require vector assignments to be oriented.
+
 2006-10-17  John W. Eaton  <jwe@octave.org>
 
 	* lo-cieee.c: If isnan is not available but _isnan is, then define
--- a/src/ChangeLog	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/ChangeLog	Tue Oct 24 01:00:13 2006 +0000
@@ -1,5 +1,14 @@
 2006-10-23  John W. Eaton  <jwe@octave.org>
 
+	* symtab.cc (symbol_table::clear_mex_functions): New function.
+	* symtab.h: Provide decl.
+	* vriables.cc (clear_mex_functions): New function.
+	* variables.h Provide decl.
+	* toplev.cc: Call clear_mex_functions instead of delete_symbol_tables.
+
+	* variables.cc (delete_symbol_tables): Delete.
+	* variables.h: Delete decl.
+
 	* mex.cc (mex::unmark_array): New function.
 	(mex::persistent): Define with unmark_array.
 	(maybe_unmark_array): New function.
--- a/src/symtab.cc	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/symtab.cc	Tue Oct 24 01:00:13 2006 +0000
@@ -840,6 +840,23 @@
 }
 
 void
+symbol_table::clear_mex_functions (void)
+{
+  for (unsigned int i = 0; i < table_size; i++)
+    {
+      symbol_record *ptr = table[i].next ();
+
+      while (ptr)
+	{
+	  if (ptr->is_mex_function ())
+	    ptr->clear ();
+
+	  ptr = ptr->next ();
+	}
+    }
+}
+
+void
 symbol_table::clear_globals (void)
 {
   for (unsigned int i = 0; i < table_size; i++)
--- a/src/symtab.h	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/symtab.h	Tue Oct 24 01:00:13 2006 +0000
@@ -529,6 +529,7 @@
 
   void clear_variables (void);
   void clear_functions (void);
+  void clear_mex_functions (void);
   void clear_globals (void);
 
   bool clear (const std::string& nm);
--- a/src/toplev.cc	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/toplev.cc	Tue Oct 24 01:00:13 2006 +0000
@@ -620,7 +620,7 @@
       // Do this explicitly so that destructors for mex file objects
       // are called, so that functions registered with mexAtExit are
       // called.
-      delete_symbol_tables ();
+      clear_mex_functions ();
 
       command_editor::restore_terminal_state ();
 
--- a/src/variables.cc	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/variables.cc	Tue Oct 24 01:00:13 2006 +0000
@@ -105,11 +105,9 @@
 }
 
 void
-delete_symbol_tables (void)
+clear_mex_functions (void)
 {
-  delete fbi_sym_tab;
-  delete global_sym_tab;
-  delete top_level_sym_tab;
+  fbi_sym_tab->clear_mex_functions ();
 }
 
 // Attributes of variables and functions.
--- a/src/variables.h	Mon Oct 23 19:30:28 2006 +0000
+++ b/src/variables.h	Tue Oct 24 01:00:13 2006 +0000
@@ -48,7 +48,7 @@
 extern bool at_top_level (void);
 
 extern void initialize_symbol_tables (void);
-extern void delete_symbol_tables (void);
+extern void clear_mex_functions (void);
 
 extern bool is_command_name (const std::string&);