# HG changeset patch # User jwe # Date 1022114536 0 # Node ID eab957395758e030d2a82aa8c968103ce8d978e8 # Parent b050da7f9994cfe05357b19bd3e1b9bd3c5c3d79 [project @ 2002-05-23 00:42:15 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2002-05-22 Mumit Khan + + * DASPK.cc (ddaspk_psol): Return value. + * oct-rl-edit.c: Use /* ... */ to comment. + 2002-05-20 John W. Eaton * DASSL.h (DASSL_options::init): Undo previous change. diff --git a/liboctave/DASPK.cc b/liboctave/DASPK.cc --- a/liboctave/DASPK.cc +++ b/liboctave/DASPK.cc @@ -172,6 +172,7 @@ double *, int*) { abort (); + return 0; } int diff --git a/liboctave/oct-rl-edit.c b/liboctave/oct-rl-edit.c --- a/liboctave/oct-rl-edit.c +++ b/liboctave/oct-rl-edit.c @@ -68,15 +68,15 @@ rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); } -// It would be much simpler if we could just call _rl_clear_screen to -// only clear the screen, but it is not a public function, and on some -// systems, it is not exported from shared library versions of -// readline, so we can't use it. -// -// Instead, temporarily redefine the redisplay function to do nothing. -// -// XXX FIXME XXX -- It would be safer to do this when protected from -// interrupts... +/* It would be much simpler if we could just call _rl_clear_screen to + only clear the screen, but it is not a public function, and on some + systems, it is not exported from shared library versions of + readline, so we can't use it. + + Instead, temporarily redefine the redisplay function to do nothing. + + XXX FIXME XXX -- It would be safer to do this when protected from + interrupts... */ static void no_redisplay (void) diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2002-05-22 Mumit Khan + + * debug.cc: Include cstdlib instead of stdlib.h. Include cstring. + (dbtype): Use strchr instead of index. + * TEMPLATE-INST/Array-tc.cc (Array::resize_fill_value): + Fix template specialization syntax. + 2002-05-17 Mumit Khan * c-file-ptr-stream.h (OCTAVE_STD_FILEBUF): New macro to handle diff --git a/src/TEMPLATE-INST/Array-tc.cc b/src/TEMPLATE-INST/Array-tc.cc --- a/src/TEMPLATE-INST/Array-tc.cc +++ b/src/TEMPLATE-INST/Array-tc.cc @@ -39,6 +39,7 @@ template class Array; +template<> octave_value Array::resize_fill_value (void) { diff --git a/src/debug.cc b/src/debug.cc --- a/src/debug.cc +++ b/src/debug.cc @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include "defun.h" #include "error.h" @@ -58,7 +58,7 @@ if (str.compare ("")) { symbol_record *ptr = curr_sym_tab->lookup (str); - + if (ptr && ptr->is_user_function ()) { octave_value tmp = ptr->def (); @@ -67,7 +67,7 @@ else { symbol_record *ptr = lookup_by_name (str, false); - + if (ptr && ptr->is_user_function ()) { octave_value tmp = ptr->def (); @@ -105,20 +105,20 @@ int result = -1; int nargin = args.length (); - + string_vector argv = args.make_argv ("dbstop"); if (error_state) return retval; if (nargin == 2) - { + { std::string symbol_name = argv[1]; std::string line_number = argv[2]; int line = atoi (line_number.c_str ()); - + octave_user_function *dbg_fcn = get_user_function (symbol_name); if (dbg_fcn) @@ -136,14 +136,14 @@ int line = atoi (line_number.c_str ()); octave_user_function *dbg_fcn = get_user_function (); - + if (dbg_fcn) { tree_statement_list *cmds = dbg_fcn->body (); result = cmds->set_breakpoint (line); } else - error ("unable to find the function requested\n"); + error ("unable to find the function requested\n"); } else error ("one argument when in a function and two when not\n"); @@ -175,13 +175,13 @@ std::string line_number; int line = -1; int nargin = args.length (); - + if (nargin != 1 && nargin != 2) { error ("need one or two arguements\n"); return retval; } - + string_vector argv = args.make_argv ("dbclear"); if (error_state) @@ -191,7 +191,7 @@ { octave_stdout << "2 input arguments\n"; symbol_name = argv[1]; - + octave_stdout << argv[1] << std::endl; line_number = argv[2]; @@ -210,12 +210,12 @@ if (line_number.compare("all") && line_number.compare("ALL")) line = atoi (line_number.c_str ()); - else + else line = -1; octave_stdout << "symbol_name = " << symbol_name << std::endl; octave_user_function *dbg_fcn = get_user_function (symbol_name); - + if (dbg_fcn) { tree_statement_list *cmds = dbg_fcn->body (); @@ -261,7 +261,7 @@ } octave_user_function *dbg_fcn = get_user_function (symbol_name); - + if (dbg_fcn) { tree_statement_list *cmds = dbg_fcn->body (); @@ -271,7 +271,7 @@ RowVector vec (lst.length (), 0.0); for (int i = 0; i < lst.length (); i++) - { + { vec(i) = lst(i).double_value (); if (error_state) @@ -294,7 +294,7 @@ @seealso{dbclear, dbstatus, dbstop}") { octave_value retval; - + octave_user_function *dbg_fcn = curr_function; if (dbg_fcn) @@ -307,7 +307,7 @@ if (dbg_stmt) { - octave_stdout << "line " << dbg_stmt->line () << ", "; + octave_stdout << "line " << dbg_stmt->line () << ", "; octave_stdout << "column " << dbg_stmt->column () << std::endl; } else @@ -320,8 +320,8 @@ } // Copied and modified from the do_type command in help.cc -// Maybe we could share some code? -void +// Maybe we could share some code? +void do_dbtype(std::ostream& os, const std::string& name, int start, int end) { std::string ff = fcn_file_in_path (name); @@ -329,15 +329,15 @@ if (! ff.empty ()) { std::ifstream fs (ff.c_str (), std::ios::in); - + if (fs) - { + { char ch; int line = 1; - + if (line >= start && line <= end) os << line << "\t"; - + while (fs.get (ch)) { if (line >= start && line <= end) @@ -349,11 +349,11 @@ { line++; if (line >= start && line <= end) - os << line << "\t"; + os << line << "\t"; } } } - else + else os << "unable to open `" << ff << "' for reading!\n"; } else @@ -370,10 +370,10 @@ { octave_value retval; octave_user_function *dbg_fcn; - + int nargin = args.length (); string_vector argv = args.make_argv ("dbtype"); - + if (! error_state) { switch (nargin) @@ -382,99 +382,101 @@ dbg_fcn = get_user_function (); if (dbg_fcn) - do_dbtype(octave_stdout,dbg_fcn->function_name (), 0, INT_MAX); + do_dbtype (octave_stdout, dbg_fcn->function_name (), 0, INT_MAX); else - error("must be in a user function to give no arguments to dbtype\n"); + error ("must be in a user function to give no arguments to dbtype\n"); + break; - break; - case 1: // (dbtype func) || (dbtype start:end) + case 1: // (dbtype func) || (dbtype start:end) dbg_fcn = get_user_function (argv[1].c_str ()); if (dbg_fcn) - do_dbtype(octave_stdout,dbg_fcn->function_name (), 0, INT_MAX); + do_dbtype (octave_stdout, dbg_fcn->function_name (), 0, INT_MAX); else { dbg_fcn = get_user_function (""); if (dbg_fcn) { - char *str = (char *)malloc(strlen(argv[1].c_str ()) + 1); + char *str = malloc (strlen (argv[1].c_str ()) + 1); if (str) - memcpy(str, argv[1].c_str (), strlen(argv[1].c_str ()) + 1); - else - error("croaked\n"); - - char *ind = index(str,':'); - + memcpy (str, argv[1].c_str (), + strlen (argv[1].c_str ()) + 1); + else + error ("croaked\n"); + + char *ind = strchr (str, ':'); + if (ind) *ind = '\0'; else { - free(str); - error("if you specify lines it must be like `start:end`"); + free (str); + error ("if you specify lines it must be like `start:end`"); } ind++; - - int start = atoi(str); - int end = atoi(ind); - - free(str); + + int start = atoi (str); + int end = atoi (ind); + + free (str); str = NULL; ind = NULL; - + octave_stdout << "got start and end\n"; - + if (start > end) error("the start line must be less than the end line\n"); - + octave_stdout << "doing dbtype\n"; - do_dbtype(octave_stdout, dbg_fcn->function_name (), start, end); + do_dbtype (octave_stdout, dbg_fcn->function_name (), start, end); octave_stdout << "did dbtype\n"; } } break; - case 2: // (dbtype func start:end) + + case 2: // (dbtype func start:end) dbg_fcn = get_user_function (argv[1].c_str ()); if (dbg_fcn) { - - char *str = (char *)malloc(strlen(argv[2].c_str ()) + 1); + + char *str = malloc (strlen (argv[2].c_str ()) + 1); if (str) - memcpy(str, argv[2].c_str (), strlen(argv[2].c_str ()) + 1); + memcpy (str, argv[2].c_str (), strlen (argv[2].c_str ()) + 1); else - error("not enough memory\n"); + error ("not enough memory\n"); - - char *ind = index(str,':'); + + char *ind = strchr (str, ':'); if (ind) *ind = '\0'; else { - free(str); - error("if you specify lines it must be like `start:end`"); + free (str); + error ("if you specify lines it must be like `start:end`"); } ind++; - int start = atoi(str); - int end = atoi(ind); + int start = atoi (str); + int end = atoi (ind); - free(str); - ind = NULL; - str = NULL; + free (str); + ind = NULL; + str = NULL; if (start > end) - error("the start line must be less than the end line\n"); + error ("the start line must be less than the end line\n"); - do_dbtype(octave_stdout, dbg_fcn->function_name (), start, end); + do_dbtype (octave_stdout, dbg_fcn->function_name (), start, end); } + break; - break; default: - error("unacceptable number of arguments\n"); + error ("unacceptable number of arguments\n"); } }