# HG changeset patch # User jwe # Date 1161651613 0 # Node ID 4036e6fca790486cdb6a8a41084c655499328d47 # Parent 950d8cb396178e314e04a78b30b3f43a812ee051 [project @ 2006-10-24 01:00:12 by jwe] diff --git a/doc/interpreter/emacs.txi b/doc/interpreter/emacs.txi --- a/doc/interpreter/emacs.txi +++ b/doc/interpreter/emacs.txi @@ -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 diff --git a/libcruft/ChangeLog b/libcruft/ChangeLog --- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,10 @@ +2006-10-23 Paul Kienzle + + * 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 * lapack-xtra/xdlamch.f: Begin lines with spaces, not tabs. diff --git a/libcruft/misc/f77-fcn.h b/libcruft/misc/f77-fcn.h --- a/libcruft/misc/f77-fcn.h +++ b/libcruft/misc/f77-fcn.h @@ -87,6 +87,8 @@ #if defined (F77_USES_CRAY_CALLING_CONVENTION) #include + +/* 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 and . */ + +#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; diff --git a/liboctave/Array.cc b/liboctave/Array.cc --- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -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) diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2006-10-23 John W. Eaton + + * Array.cc (assign2): Don't require vector assignments to be oriented. + 2006-10-17 John W. Eaton * lo-cieee.c: If isnan is not available but _isnan is, then define diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2006-10-23 John W. Eaton + * 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. diff --git a/src/symtab.cc b/src/symtab.cc --- a/src/symtab.cc +++ b/src/symtab.cc @@ -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++) diff --git a/src/symtab.h b/src/symtab.h --- a/src/symtab.h +++ b/src/symtab.h @@ -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); diff --git a/src/toplev.cc b/src/toplev.cc --- a/src/toplev.cc +++ b/src/toplev.cc @@ -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 (); diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -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. diff --git a/src/variables.h b/src/variables.h --- a/src/variables.h +++ b/src/variables.h @@ -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&);