Mercurial > hg > octave-shane
changeset 2968:e330cb788508
[project @ 1997-05-15 17:40:29 by jwe]
author | jwe |
---|---|
date | Thu, 15 May 1997 17:54:17 +0000 |
parents | 467aae13b70a |
children | 1b47dd00a831 |
files | liboctave/ChangeLog scripts/ChangeLog scripts/specfun/erfinv.m src/DLD-FUNCTIONS/dassl.cc src/DLD-FUNCTIONS/fsolve.cc src/DLD-FUNCTIONS/lsode.cc src/DLD-FUNCTIONS/npsol.cc src/DLD-FUNCTIONS/qpsol.cc src/DLD-FUNCTIONS/quad.cc src/TEMPLATE-INST/SLList-expr.cc src/TEMPLATE-INST/SLList-misc.cc src/TEMPLATE-INST/SLList-tm.cc src/defun-dld.h src/defun-int.h src/defun.h src/mkbuiltins test/octave.test/arith/round-1.m test/octave.test/error/error.exp test/octave.test/switch/switch-1.m |
diffstat | 19 files changed, 95 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +Thu May 15 11:46:42 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * cmd-edit.cc (command_editor::increment_current_command_number): + New static function. + Mon May 12 02:14:13 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * idx-vector.cc (IDX_VEC_REP::is_colon_equiv): Make it work when
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +Mon May 12 02:04:01 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * specfun/erfinv.m: Add missing semicolon. + Wed Apr 2 22:04:03 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * miscellaneous/xor.m: Make type of return value logical.
--- a/scripts/specfun/erfinv.m +++ b/scripts/specfun/erfinv.m @@ -45,7 +45,7 @@ i = find ((x > -1) & (x < 1)); if any (i) - s = sqrt (pi) / 2 + s = sqrt (pi) / 2; z_old = ones (length (i), 1); z_new = zeros (length (i), 1); while (any (any (abs (z_new - z_old) > 2 * eps)))
--- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -35,13 +35,13 @@ #include "gripes.h" #include "help.h" #include "oct-obj.h" -#include "oct-sym.h" +#include "ov-fcn.h" #include "pager.h" #include "utils.h" #include "variables.h" // Global pointer for user defined function required by dassl. -static octave_symbol *dassl_fcn; +static octave_function *dassl_fcn; static DASSL_options dassl_opts; @@ -83,7 +83,7 @@ if (dassl_fcn) { - octave_value_list tmp = dassl_fcn->eval (1, args); + octave_value_list tmp = dassl_fcn->do_index_op (1, args); if (error_state) {
--- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -34,14 +34,14 @@ #include "error.h" #include "gripes.h" #include "help.h" -#include "oct-sym.h" #include "oct-obj.h" +#include "ov-fcn.h" #include "pager.h" #include "utils.h" #include "variables.h" // Global pointer for user defined function required by hybrd1. -static octave_symbol *fsolve_fcn; +static octave_function *fsolve_fcn; static NLEqn_options fsolve_opts; @@ -106,7 +106,7 @@ if (fsolve_fcn) { - octave_value_list tmp = fsolve_fcn->eval (1, args); + octave_value_list tmp = fsolve_fcn->do_index_op (1, args); if (tmp.length () > 0 && tmp(0).is_defined ()) { retval = tmp(0).vector_value ();
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -36,16 +36,16 @@ #include "gripes.h" #include "help.h" #include "oct-obj.h" -#include "oct-sym.h" +#include "ov-fcn.h" #include "pager.h" #include "utils.h" #include "variables.h" // Global pointer for user defined function required by lsode. -static octave_symbol *lsode_fcn; +static octave_function *lsode_fcn; // Global pointer for optional user defined jacobian function used by lsode. -static octave_symbol *lsode_jac; +static octave_function *lsode_jac; static LSODE_options lsode_opts; @@ -67,7 +67,7 @@ if (lsode_fcn) { - octave_value_list tmp = lsode_fcn->eval (1, args); + octave_value_list tmp = lsode_fcn->do_index_op (1, args); if (error_state) { @@ -107,7 +107,7 @@ if (lsode_jac) { - octave_value_list tmp = lsode_jac->eval (1, args); + octave_value_list tmp = lsode_jac->do_index_op (1, args); if (error_state) {
--- a/src/DLD-FUNCTIONS/npsol.cc +++ b/src/DLD-FUNCTIONS/npsol.cc @@ -36,7 +36,7 @@ #include "gripes.h" #include "help.h" #include "oct-obj.h" -#include "oct-sym.h" +#include "ov-fcn.h" #include "pager.h" #include "utils.h" #include "variables.h" @@ -44,8 +44,8 @@ #ifndef NPSOL_MISSING // Global pointers for user defined functions required by npsol. -static octave_symbol *npsol_objective; -static octave_symbol *npsol_constraints; +static octave_function *npsol_objective; +static octave_function *npsol_constraints; static NPSOL_options npsol_opts; @@ -77,7 +77,7 @@ octave_value objective_value; if (npsol_objective) { - octave_value_list tmp = npsol_objective->eval (1, args); + octave_value_list tmp = npsol_objective->do_index_op (1, args); if (error_state) { @@ -146,7 +146,7 @@ if (npsol_constraints) { - octave_value_list tmp = npsol_constraints->eval (1, args); + octave_value_list tmp = npsol_constraints->do_index_op (1, args); if (error_state) {
--- a/src/DLD-FUNCTIONS/qpsol.cc +++ b/src/DLD-FUNCTIONS/qpsol.cc @@ -36,7 +36,6 @@ #include "gripes.h" #include "help.h" #include "oct-obj.h" -#include "oct-sym.h" #include "pager.h" #include "utils.h" #include "variables.h"
--- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -35,9 +35,9 @@ #include "error.h" #include "gripes.h" #include "help.h" -#include "oct-sym.h" #include "pager.h" #include "oct-obj.h" +#include "ov-fcn.h" #include "utils.h" #include "variables.h" @@ -46,7 +46,7 @@ #endif // Global pointer for user defined function required by quadrature functions. -static octave_symbol *quad_fcn; +static octave_function *quad_fcn; static Quad_options quad_opts; @@ -60,7 +60,7 @@ if (quad_fcn) { - octave_value_list tmp = quad_fcn->eval (1, args); + octave_value_list tmp = quad_fcn->do_index_op (1, args); if (error_state) {
--- a/src/TEMPLATE-INST/SLList-expr.cc +++ b/src/TEMPLATE-INST/SLList-expr.cc @@ -31,7 +31,6 @@ #include "ov.h" #include "pt-exp.h" -#include "pt-mvr.h" template class SLNode<tree_expression *>; template class SLList<tree_expression *>;
--- a/src/TEMPLATE-INST/SLList-misc.cc +++ b/src/TEMPLATE-INST/SLList-misc.cc @@ -34,6 +34,9 @@ #include "ov.h" #include "pt-misc.h" +template class SLNode<tree_argument_list *>; +template class SLList<tree_argument_list *>; + template class SLNode<tree_statement *>; template class SLList<tree_statement *>;
--- a/src/TEMPLATE-INST/SLList-tm.cc +++ b/src/TEMPLATE-INST/SLList-tm.cc @@ -32,9 +32,6 @@ #include "ov.h" #include "pt-mat.h" -template class SLNode<tree_matrix_row *>; -template class SLList<tree_matrix_row *>; - template class SLNode<tree_matrix *>; template class SLList<tree_matrix *>;
--- a/src/defun-dld.h +++ b/src/defun-dld.h @@ -33,11 +33,11 @@ // time. // // If Octave is not configured for dynamic linking of builtin -// functions, this is similar to DEFUN, except that it will generate -// an extra static struct and an extra externally visible function. +// functions, this is the same as DEFUN, except that it will generate +// an extra externally visible function. // -// The first DECLARE_FUN is for the struct, the second is for the -// definition of the function. +// The first DECLARE_FUN is for the benefit of the installer function +// and the second is for the definition of the function. #if defined (MAKE_BUILTINS) #if ! (defined (OCTAVE_LITE) && defined (WITH_DYNAMIC_LINKING)) @@ -47,7 +47,7 @@ #else #define DEFUN_DLD(name, args_name, nargout_name, doc) \ DECLARE_FUN (name, args_name, nargout_name); \ - DEFINE_FUN_STRUCT_FUN (name, doc) \ + DEFINE_FUN_INSTALLER_FUN (name, doc) \ DECLARE_FUN (name, args_name, nargout_name) #endif
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -23,7 +23,27 @@ #if !defined (octave_defun_int_h) #define octave_defun_int_h 1 -#include "oct-builtin.h" +#include <string> + +class octave_value; + +// XXX FIXME XXX -- change to use actual pointer types instead of void* +// when things are not changing as rapidly. + +extern void +install_builtin_mapper (void *mf); + +extern void +install_builtin_function (void *f, const string& name, const string& doc, + bool is_text_fcn = false); + +extern void +install_builtin_variable (const string& n, const octave_value& v, + bool iaf, bool p, bool e, void *svf, + const string& h); + +extern void +alias_builtin (const string& alias, const string& name); // MAKE_BUILTINS is defined to extract function names and related // information and create the *.def files that are eventually used to @@ -38,8 +58,7 @@ #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ BEGIN_INSTALL_BUILTIN \ extern DECLARE_FUN (name, args_name, nargout_name); \ - install_builtin_function \ - (new octave_builtin (F ## name, #name, doc), is_text_fcn); \ + install_builtin_function (F ## name, #name, doc, is_text_fcn); \ END_INSTALL_BUILTIN // Generate code for making another name for an existing function. @@ -66,18 +85,33 @@ // Define the structure that will be used to insert this function into // the symbol table. -#define DEFINE_FUN_STRUCT_FUN(name, doc) \ - octave_builtin * \ +#define DEFINE_FUN_INSTALLER_FUN(name, doc) \ + bool \ FS ## name (void) \ { \ - static octave_builtin *s = 0; \ - if (! s) \ - s = new octave_builtin (F ## name, #name, doc); \ - return s; \ + static bool installed = false; \ + if (! installed) \ + install_builtin_function (F ## name, #name, doc); \ + return installed; \ } #define DECLARE_FUN(name, args_name, nargout_name) \ - octave_value_list F ## name (const octave_value_list& args_name, int nargout_name) + octave_value_list \ + F ## name (const octave_value_list& args_name, int nargout_name) + +// How builtin variables are actually installed. + +#define DEFVAR_INTERNAL(name, sname, defn, inst_as_fcn, protect, sv_fcn, doc) \ + install_builtin_variable (name, octave_value (defn), inst_as_fcn, \ + protect, (sv_fcn != 0), sv_fcn, doc) + +// How mapper functions are actually installed. + +#define DEFUN_MAPPER_INTERNAL(name, ch_map, d_d_map, d_c_map, c_c_map, \ + lo, hi, can_ret_cmplx_for_real, doc) \ + install_builtin_mapper \ + (new octave_mapper (ch_map, d_d_map, d_c_map, c_c_map, lo, hi, \ + can_ret_cmplx_for_real, #name)) #endif
--- a/src/defun.h +++ b/src/defun.h @@ -53,7 +53,7 @@ // doc is the simple help text for this variable. #define DEFVAR(name, defn, inst_as_fcn, sv_fcn, doc) \ - DEFVAR_INT (#name, SBV_ ## name, defn, inst_as_fcn, 0, sv_fcn, doc) + DEFVAR_INTERNAL (#name, SBV_ ## name, defn, inst_as_fcn, 0, sv_fcn, doc) // Define a builtin-constant, and a corresponding variable that can be // redefined. This is just the same as DEFVAR, except that it defines @@ -61,23 +61,19 @@ // redefined. #define DEFCONST(name, defn, inst_as_fcn, sv_fcn, doc) \ - DEFVAR_INT (#name, SBV_ ## name, defn, inst_as_fcn, false, sv_fcn, doc); \ - DEFVAR_INT ("__" ## #name ## "__", XSBV_ ## name, defn, false, true, \ - sv_fcn, doc) + DEFVAR_INTERNAL (#name, SBV_ ## name, defn, inst_as_fcn, false, \ + sv_fcn, doc); \ + DEFVAR_INTERNAL ("__" ## #name ## "__", XSBV_ ## name, defn, false, \ + true, sv_fcn, doc) // This one can be used when `name' cannot be used directly (if it is // already defined as a macro). In that case, name is already a // quoted string, and the name of the structure has to be passed too. #define DEFCONSTX(name, sname, defn, inst_as_fcn, sv_fcn, doc) \ - DEFVAR_INT (name, sname, defn, inst_as_fcn, false, sv_fcn, doc); \ - DEFVAR_INT ("__" ## name ## "__", X ## sname, defn, false, true, sv_fcn, doc) - -// How builtin variables are actually installed. - -#define DEFVAR_INT(name, sname, defn, inst_as_fcn, protect, sv_fcn, doc) \ - install_builtin_variable (name, octave_value (defn), inst_as_fcn, \ - protect, (sv_fcn != 0), sv_fcn, doc) + DEFVAR_INTERNAL (name, sname, defn, inst_as_fcn, false, sv_fcn, doc); \ + DEFVAR_INTERNAL ("__" ## name ## "__", X ## sname, defn, false, true, \ + sv_fcn, doc) // Define a builtin function. // @@ -134,9 +130,8 @@ #define DEFUN_MAPPER(name, ch_map, d_d_map, d_c_map, c_c_map, \ lo, hi, can_ret_cmplx_for_real, doc) \ - install_builtin_mapper \ - (new octave_mapper (ch_map, d_d_map, d_c_map, c_c_map, lo, hi, \ - can_ret_cmplx_for_real, #name)) + DEFUN_MAPPER_INTERNAL(name, ch_map, d_d_map, d_c_map, c_c_map, \ + lo, hi, can_ret_cmplx_for_real, doc) // Make alias another name for the existing function name. This macro // must be used in the same file where name is defined, after the
--- a/src/mkbuiltins +++ b/src/mkbuiltins @@ -25,7 +25,7 @@ #include "config.h" #endif -#include "oct-builtin.h" +#include "defun.h" #include "oct-obj.h" #include "variables.h"
--- a/test/octave.test/arith/round-1.m +++ b/test/octave.test/arith/round-1.m @@ -1,2 +1,2 @@ -(round (1) == 1 && round (1.1) = 1 && round (5.5) == 6 +(round (1) == 1 && round (1.1) == 1 && round (5.5) == 6 && round (i) == i && round (2.5+3.5i) == 3+4i && round (-2.6) == -3)
--- a/test/octave.test/error/error.exp +++ b/test/octave.test/error/error.exp @@ -1,5 +1,5 @@ set test error-1 -set prog_output "error: foo\nerror: evaluating index expression near line 1, column 15\nerror: called from `g'\nerror: called from `f'" +set prog_output "error: foo\nerror: called from `g'\nerror: called from `f'" do_test error-1.m set test error-2