Mercurial > hg > octave-lojdl
changeset 1358:dc9c01f66a19
[project @ 1995-09-05 21:10:01 by jwe]
author | jwe |
---|---|
date | Tue, 05 Sep 1995 21:12:04 +0000 |
parents | 749071f48336 |
children | a6994c934a50 |
files | liboctave/idx-vector.cc liboctave/utils.cc src/arith-ops.cc src/dirfns.cc src/dynamic-ld.cc src/file-io.cc src/help.cc src/input.cc src/load-save.cc src/oct-hist.cc src/octave.cc src/pager.cc src/pt-const.cc src/pt-exp-base.cc src/pt-misc.cc src/pt-plot.cc src/sighandlers.cc src/strfns.cc src/symtab.cc src/sysdep.cc src/tc-rep.cc src/user-prefs.cc src/utils.cc src/variables.cc src/xpow.cc |
diffstat | 25 files changed, 423 insertions(+), 345 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -218,9 +218,9 @@ return; } #if 0 -// Checking max index against size won't work right here unless we -// also look at resize on range error, and we have to do that later -// on anyway. + // Checking max index against size won't work right here unless we + // also look at resize on range error, and we have to do that later + // on anyway. else if (max_val >= z_len) {
--- a/liboctave/utils.cc +++ b/liboctave/utils.cc @@ -32,18 +32,16 @@ #include "f77-uscore.h" -/* - * All the STOP statements in the Fortran routines have been replaced - * with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f. - * - * The XSTOPX function calls this function, which will send a SIGINT - * signal to the program that invoked it. - * - * Octave\'s SIGINT signal handler calls jump_to_top_level(), and the - * user will end up at the top level instead of the shell prompt. - * - * Programs that don\'t handle SIGINT will be interrupted. - */ +// All the STOP statements in the Fortran routines have been replaced +// with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f. +// +// The XSTOPX function calls this function, which will send a SIGINT +// signal to the program that invoked it. +// +// Octave's SIGINT signal handler calls jump_to_top_level(), and the +// user will end up at the top level instead of the shell prompt. +// +// Programs that don't handle SIGINT will be interrupted. extern "C" {
--- a/src/arith-ops.cc +++ b/src/arith-ops.cc @@ -59,7 +59,7 @@ while (0) #endif -// But first, some stupid functions that don\'t deserve to be in the +// But first, some stupid functions that don't deserve to be in the // Matrix class... enum
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -310,7 +310,8 @@ else t = strsave (newdir); -// Get rid of trailing `/'. + // Get rid of trailing `/'. + { register int len_t = strlen (t); if (len_t > 1)
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -159,10 +159,10 @@ return (void *) dld_get_func (name); } -// For each library, try to find it in a list of directories, then -// link to it. It would have been nice to use the kpathsea functions -// here too, but calls to them can't be nested as they would need to -// be here... + // For each library, try to find it in a list of directories, then + // link to it. It would have been nice to use the kpathsea + // functions here too, but calls to them can't be nested as they + // would need to be here... char **libs = pathstring_to_vector (lib_list); char **ptr = libs; @@ -183,7 +183,7 @@ return (void *) dld_get_func (name); } -// If we get here, there was a problem. + // If we get here, there was a problem. ostrstream output_buf; octave_list_undefined_symbols (output_buf); @@ -274,9 +274,9 @@ void octave_dld_tc2_unlink_by_symbol (const char *name, int hard) { -// XXX FIXME XXX -- need to determine the name mangling scheme -// automatically, in case it changes, or is different on different -// systems, even if they have g++. + // XXX FIXME XXX -- need to determine the name mangling scheme + // automatically, in case it changes, or is different on different + // systems, even if they have g++. char *mangled_fcn_name = strconcat (name, "__FRC13Octave_objecti");
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -1078,7 +1078,7 @@ fmt_arg_count++; } -// Scan fmt for % escapes and print out the arguments. + // Scan fmt for % escapes and print out the arguments. ostrstream output_buf; @@ -1100,7 +1100,8 @@ continue; } -// We must be looking at a format specifier. Extract it or fail. + // We must be looking at a format specifier. Extract it or + // fail. int status = process_printf_format (ptr, args, output_buf, type); @@ -1229,8 +1230,8 @@ if (*s == '\0') goto invalid_format; -// Even if we don't have a place to store them, attempt to convert -// everything specified by the format string. + // Even if we don't have a place to store them, attempt to convert + // everything specified by the format string. if (fmt_arg_count > (nargout ? nargout : 1)) store_value = 0; @@ -1267,10 +1268,10 @@ { if (string_width < 1) { -// XXX FIXME XXX -- The code below is miscompiled on the Alpha with -// gcc 2.6.0, so that string_width is never incremented, even though -// reading the data works correctly. One fix is to use a fixed-size -// buffer... + // XXX FIXME XXX -- The code below is miscompiled on the + // Alpha with gcc 2.6.0, so that string_width is never + // incremented, even though reading the data works + // correctly. One fix is to use a fixed-size buffer... // string_width = 8192; string_width = 0; @@ -1406,9 +1407,10 @@ if (strcmp (type, "scanf") == 0 || (doing_fscanf && file.number () == 0)) { -// XXX FIXME XXX -- this should probably be possible for more than -// just stdin/stdout pairs, using a list of output streams to flush. -// The list could be created with a function like iostream's tie(). + // XXX FIXME XXX -- this should probably be possible for + // more than just stdin/stdout pairs, using a list of output + // streams to flush. The list could be created with a + // function like iostream's tie(). flush_output_to_pager (); @@ -1454,7 +1456,7 @@ return retval; } -// Scan scanf_fmt for % escapes and assign the arguments. + // Scan scanf_fmt for % escapes and assign the arguments. retval.resize (nargout); @@ -1477,7 +1479,8 @@ continue; } -// We must be looking at a format specifier. Extract it or fail. + // We must be looking at a format specifier. Extract it or + // fail. int status = process_scanf_format (ptr, fmt, type, nargout, fptr, retval); @@ -1623,7 +1626,8 @@ if (! p) return retval; -// Get type and number of bytes per element to read. + // Get type and number of bytes per element to read. + char *prec = "uchar"; if (nargin > 2) { @@ -1636,14 +1640,12 @@ } } -// Get file info. - file_info file = file_list (p); FILE *fptr = file.fptr (); -// Set up matrix to read into. If specified in arguments use that -// number, otherwise read everyting left in file. + // Set up matrix to read into. If specified in arguments use that + // number, otherwise read everyting left in file. double dnr = 0.0; double dnc = 0.0; @@ -1734,7 +1736,8 @@ } else { -// No size parameter, read what's left of the file. + // No size parameter, read what's left of the file. + nc = 1; int n = num_items_remaining (fptr, prec); nr = n / nc; @@ -1744,7 +1747,7 @@ Matrix m (nr, nc, octave_NaN); -// Read data. + // Read data. int count = m.read (fptr, prec); @@ -1810,7 +1813,8 @@ if (! p) return retval; -// Get type and number of bytes per element to read. + // Get type and number of bytes per element to read. + char *prec = "uchar"; if (nargin > 2) { @@ -1875,7 +1879,6 @@ { Octave_object retval; -// Get file info. Pix p = return_valid_file (args(0)); if (! p) @@ -1919,7 +1922,6 @@ { Octave_object retval; -// Get file info. Pix p = return_valid_file (args(0)); if (! p)
--- a/src/help.cc +++ b/src/help.cc @@ -461,7 +461,8 @@ } \ while (0) -// XXX FIXME XXX -- is this distinction needed? + // XXX FIXME XXX -- is this distinction needed? + LIST_SYMBOLS (symbol_def::TEXT_FUNCTION, "text functions (these names are also reserved)"); @@ -471,10 +472,10 @@ LIST_SYMBOLS (symbol_def::BUILTIN_VARIABLE, "builtin variables"); -// Also need to list variables and currently compiled functions from -// the symbol table, if there are any. + // Also need to list variables and currently compiled functions from + // the symbol table, if there are any. -// Also need to search octave_path for script files. + // Also need to search octave_path for script files. char *path_elt = kpse_path_element (user_pref.loadpath); @@ -728,7 +729,8 @@ if (argc > 1) { -// XXX FIXME XXX -- we should really use getopt () + // XXX FIXME XXX -- we should really use getopt () + int quiet = 0; if (argv[1] && strcmp (argv[1], "-q") == 0) { @@ -772,7 +774,8 @@ defn->print_code (output_buf); } -// XXX FIXME XXX -- this code should be shared with Fwhich + // XXX FIXME XXX -- this code should be shared with + // Fwhich. else if (sym_rec->is_text_function ()) output_buf << *argv << " is a builtin text-function\n";
--- a/src/input.cc +++ b/src/input.cc @@ -318,7 +318,8 @@ #define EFFICIENT #ifdef EFFICIENT -// Use the value of PWD because it is much more effecient. + // Use the value of PWD because it is much more + // effecient. temp = user_pref.pwd; @@ -419,7 +420,8 @@ } #if 0 -// I don't really think that this is a good idea. Do you? + // I don't really think that this is a good idea. Do you? + if (! find_variable ("NO_PROMPT_VARS")) { WORD_LIST *expand_string (), *list; @@ -563,7 +565,7 @@ assert (curr_stream); -// Why is this required? + // Why is this required? buf[0] = '\0'; if (fgets (buf, max_size, curr_stream)) @@ -880,10 +882,12 @@ { rl_insert_text (h->line); -// Get rid of any undo list created by the previous insert, so the -// line won't totally be erased when the edits are undone (they will -// be normally, because this is a history line -- cf. readline.c: -// line 380 or so). + // Get rid of any undo list created by the previous + // insert, so the line won't totally be erased when the + // edits are undone (they will be normally, because this + // is a history line -- cf. readline.c: line 380 or + // so). + if (rl_undo_list) { free_undo_list (); @@ -902,10 +906,12 @@ int where; extern int history_stifled, history_length, max_input_history; -// Accept the current line. + // Accept the current line. + rl_newline (); -// Find the current line, and find the next line to use. + // Find the current line, and find the next line to use. + where = where_history (); if (history_stifled && (history_length >= max_input_history)) @@ -920,13 +926,16 @@ void initialize_readline (void) { -// Allow conditional parsing of the ~/.inputrc file + // Allow conditional parsing of the ~/.inputrc file + rl_readline_name = "Octave"; -// Tell the completer that we want to try first. + // Tell the completer that we want to try first. + rl_attempted_completion_function = (CPPFunction *) command_completer; -// Bind operate-and-get-next. + // Bind operate-and-get-next. + rl_add_defun ("operate-and-get-next", (Function *) operate_and_get_next, CTRL ('O')); }
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -907,7 +907,7 @@ install_loaded_variable (int force, char *name, const tree_constant& tc, int global, char *doc) { -// Is there already a symbol by this name? If so, what is it? + // Is there already a symbol by this name? If so, what is it? symbol_record *lsr = curr_sym_tab->lookup (name, 0, 0); @@ -1241,7 +1241,7 @@ read_ascii_data (istream& is, const char *filename, int& global, tree_constant& tc) { -// Read name for this entry or break on EOF. + // Read name for this entry or break on EOF. char *name = extract_keyword (is, "name"); @@ -1263,7 +1263,7 @@ return 0; } -// Look for type keyword + // Look for type keyword. char *tag = extract_keyword (is, "type"); @@ -1359,7 +1359,8 @@ } else if (strncmp (ptr, "range", 5) == 0) { -// # base, limit, range comment added by save(). + // # base, limit, range comment added by save(). + skip_comments (is); Range tmp; is >> tmp; @@ -1460,8 +1461,8 @@ doc = 0; -// We expect to fail here, at the beginning of a record, so not being -// able to read another name should not result in an error. + // We expect to fail here, at the beginning of a record, so not + // being able to read another name should not result in an error. is.read (&name_len, 4); if (! is) @@ -1668,8 +1669,9 @@ { swap = 0; -// We expect to fail here, at the beginning of a record, so not being -// able to read another mopt value should not result in an error. + // We expect to fail here, at the beginning of a record, so not + // being able to read another mopt value should not result in an + // error. is.read (&mopt, 4); if (! is) @@ -1701,7 +1703,7 @@ swap = 1; #endif -// mopt is signed, therefore byte swap may result in negative value. + // mopt is signed, therefore byte swap may result in negative value. if (mopt > 9999 || mopt < 0) swap = 1; @@ -1780,9 +1782,9 @@ read_mat_binary_data (istream& is, const char *filename, tree_constant& tc) { -// These are initialized here instead of closer to where they are -// first used to avoid errors from gcc about goto crossing -// initialization of variable. + // These are initialized here instead of closer to where they are + // first used to avoid errors from gcc about goto crossing + // initialization of variable. Matrix re; floating_point_format flt_fmt = OCTAVE_UNKNOWN_FLT_FMT; @@ -1866,7 +1868,7 @@ else tc = re; -// XXX FIXME XXX -- this needs to change once strings really work. + // XXX FIXME XXX -- this needs to change once strings really work. if (type == 1 && nr == 1) tc = tc.convert_to_str (); @@ -2115,9 +2117,9 @@ int force = 0; -// It isn't necessary to have the default load format stored in a user -// preference variable since we can determine the type of file as we -// are reading. + // It isn't necessary to have the default load format stored in a + // user preference variable since we can determine the type of file + // as we are reading. load_save_format format = LS_UNKNOWN; @@ -2186,9 +2188,10 @@ if (format != LS_UNKNOWN) { -// XXX FIXME XXX -- if we have already seen EOF on a previous call, -// how do we fix up the state of cin so that we can get additional -// input? I'm afraid that we can't fix this using cin only. + // XXX FIXME XXX -- if we have already seen EOF on a + // previous call, how do we fix up the state of cin so that + // we can get additional input? I'm afraid that we can't + // fix this using cin only. retval = do_load (cin, orig_fname, force, format, flt_fmt, list_only, swap, verbose, argv, argc, @@ -2904,8 +2907,8 @@ argc--; argv++; -// Here is where we would get the default save format if it were -// stored in a user preference variable. + // Here is where we would get the default save format if it were + // stored in a user preference variable. int save_builtins = 0; @@ -2970,8 +2973,8 @@ argc--; argv++; -// XXX FIXME XXX -- should things intended for the screen end up in a -// tree_constant (string)? + // XXX FIXME XXX -- should things intended for the screen end up + // in a tree_constant (string)? ostrstream buf;
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -188,8 +188,9 @@ { if (history_lines_this_session < where_history ()) { -// If the filename was supplied, then create it if it doesn't already -// exist. + // If the filename was supplied, then create + // it if it doesn't already exist. + if (file) { struct stat buf; @@ -221,7 +222,10 @@ break; case 'n': // Read `new' history from file. -// Read all of the lines in the file that we haven't already read. + + // Read all of the lines in the file that we haven't + // already read. + using_history (); result = read_history_range (file, history_lines_in_file, -1); using_history (); @@ -341,7 +345,7 @@ line = tmp_line; } -// Finish with newline if none in file. + // Finish with newline if none in file. line[lindex++] = '\n'; line[lindex++] = '\0'; @@ -376,9 +380,9 @@ ; // Count 'em. i--; -// History_get () takes a parameter that should be offset by history_base. + // History_get () takes a parameter that should be offset by history_base. -// Don't free this. + // Don't free this. HIST_ENTRY *histent = history_get (history_base + i); if (! histent) return; @@ -437,22 +441,22 @@ while (hlist[hist_count++]) ; // Find the number of items in the history list. -// The current command line is already part of the history list by the -// time we get to this point. Delete it from the list. + // The current command line is already part of the history list by + // the time we get to this point. Delete it from the list. hist_count -= 2; if (! insert_curr) remove_history (hist_count); hist_count--; -// If no numbers have been specified, the default is to edit the last -// command in the history list. + // If no numbers have been specified, the default is to edit the + // last command in the history list. int hist_end = hist_count; int hist_beg = hist_count; int reverse = 0; -// Process options + // Process options. int usage_error = 0; if (argc == 3) @@ -534,21 +538,21 @@ if (! name) return; -// Call up our favorite editor on the file of commands. + // Call up our favorite editor on the file of commands. ostrstream buf; buf << user_pref.editor << " " << name << ends; char *cmd = buf.str (); -// Ignore interrupts while we are off editing commands. Should we -// maybe avoid using system()? + // Ignore interrupts while we are off editing commands. Should we + // maybe avoid using system()? volatile sig_handler *saved_sigint_handler = signal (SIGINT, SIG_IGN); system (cmd); signal (SIGINT, saved_sigint_handler); -// Write the commands to the history file since parse_and_execute -// disables command line history while it executes. + // Write the commands to the history file since parse_and_execute + // disables command line history while it executes. fstream file (name, ios::in); @@ -556,8 +560,7 @@ int first = 1; while ((line = edit_history_readline (file)) != 0) { - -// Skip blank lines + // Skip blank lines. if (line[0] == '\n') { @@ -576,7 +579,8 @@ file.close (); -// Turn on command echo, so the output from this will make better sense. + // Turn on command echo, so the output from this will make better + // sense. begin_unwind_frame ("do_edit_history"); unwind_protect_int (echo_input); @@ -588,8 +592,8 @@ run_unwind_frame ("do_edit_history"); -// Delete the temporary file. Should probably be done with an -// unwind_protect. + // Delete the temporary file. Should probably be done with an + // unwind_protect. unlink (name); @@ -604,7 +608,8 @@ if (! name) return; -// Turn on command echo, so the output from this will make better sense. + // Turn on command echo, so the output from this will make better + // sense. begin_unwind_frame ("do_run_history"); unwind_protect_int (echo_input); @@ -616,8 +621,8 @@ run_unwind_frame ("do_run_history"); -// Delete the temporary file. Should probably be done with an -// unwind_protect. + // Delete the temporary file. Should probably be done with an + // unwind_protect. unlink (name);
--- a/src/octave.cc +++ b/src/octave.cc @@ -159,7 +159,7 @@ // Nonzero means we printed messages about reading startup files. static int reading_startup_message_printed = 0; -// Nonzero means we don\'t print the usual startup message. +// Nonzero means we don't print the usual startup message. // (--quiet; --silent; -q) static int inhibit_startup_message = 0; @@ -169,7 +169,7 @@ [--info-file file] [--interactive] [--path path] [--silent]\n\ [--verbose] [--version] [--echo-commands] [file]"; -// This is here so that it\'s more likely that the usage message and +// This is here so that it's more likely that the usage message and // the real set of options will agree. static const char *short_opts = "?Vdfhip:qvx"; @@ -263,8 +263,8 @@ putenv (putenv_cmd); -// This may seem odd, but doing it this way means that we don't have -// to modify the kpathsea library... + // This may seem odd, but doing it this way means that we don't have + // to modify the kpathsea library... char *odb = getenv ("OCTAVE_DB_DIR"); @@ -383,13 +383,13 @@ int verbose = (verbose_flag && ! inhibit_startup_message); -// Execute commands from the site-wide configuration file. + // Execute commands from the site-wide configuration file. char *sd = get_site_defaults (); parse_and_execute (sd, 0, verbose); -// Try to execute commands from $HOME/.octaverc and ./.octaverc. + // Try to execute commands from $HOME/.octaverc and ./.octaverc. char *home_rc = 0; if (home_directory) @@ -398,7 +398,7 @@ parse_and_execute (home_rc, 0, verbose); } -// Names alone are not enough. + // Names alone are not enough. struct stat home_rc_statbuf; stat (home_rc, &home_rc_statbuf); @@ -472,8 +472,8 @@ exit (retval); -// This is bogus but should prevent g++ from giving a warning saying -// that this volatile function does return. + // This is bogus but should prevent g++ from giving a warning saying + // that this volatile function does return. panic_impossible (); } @@ -498,9 +498,9 @@ int main (int argc, char **argv) { -// The order of these calls is important, and initialize_globals must -// come before the options are processed because some command line -// options override defaults. + // The order of these calls is important, and initialize_globals + // must come before the options are processed because some command + // line options override defaults. init_user_prefs (); @@ -567,14 +567,14 @@ } #if defined (HAVE_ATEXIT) || (HAVE_ON_EXIT) -// Make sure we clean up when we exit. If we don't have atexit or -// on_exit, we're going to leave some junk files around if we exit -// abnormally. + // Make sure we clean up when we exit. If we don't have atexit or + // on_exit, we're going to leave some junk files around if we exit + // abnormally. atexit (cleanup_tmp_files); #endif -// These can come after command line args since none of them set any -// defaults that might be changed by command line options. + // These can come after command line args since none of them set any + // defaults that might be changed by command line options. install_signal_handlers (); @@ -603,12 +603,13 @@ if (! inhibit_startup_message && reading_startup_message_printed) cout << endl; -// Avoid counting commands executed from startup files. + // Avoid counting commands executed from startup files. + current_command_number = 1; -// If there is an extra argument, see if it names a file to read. -// Additional arguments are taken as command line options for the -// script. + // If there is an extra argument, see if it names a file to read. + // Additional arguments are taken as command line options for the + // script. int remaining_args = argc - optind; if (remaining_args > 0) @@ -641,8 +642,8 @@ switch_to_buffer (create_buffer (get_input_from_stdin ())); } -// Force input to be echoed if not really interactive, but the user -// has forced interactive behavior. + // Force input to be echoed if not really interactive, but the user + // has forced interactive behavior. if (!interactive && forced_interactive) { @@ -653,7 +654,7 @@ if (! (interactive || forced_interactive)) using_readline = 0; -// Allow the user to interrupt us without exiting. + // Allow the user to interrupt us without exiting. volatile sig_handler *saved_sigint_handler = signal (SIGINT, SIG_IGN); @@ -668,7 +669,7 @@ signal (SIGINT, saved_sigint_handler); -// The big loop. + // The big loop. int retval; do @@ -865,9 +866,9 @@ parse_status = yyparse (); -// Important to reset the idea of where input is coming from before -// trying to eval the command we just parsed -- it might contain the -// name of an function file that still needs to be parsed! + // Important to reset the idea of where input is coming from before + // trying to eval the command we just parsed -- it might contain the + // name of an function file that still needs to be parsed! tree_statement_list *command = global_command; @@ -909,7 +910,7 @@ return -1.0; } -// Yes Virginia, we always print here... + // Yes Virginia, we always print here... return eval_string (string, 1, 1, parse_status, nargout); } @@ -990,9 +991,9 @@ int status = cmd.close (); -// The value in status is as returned by waitpid. If the process -// exited normally, extract the actual exit status of the command. -// Otherwise, return 127 as a failure code. + // The value in status is as returned by waitpid. If the + // process exited normally, extract the actual exit status of + // the command. Otherwise, return 127 as a failure code. if ((status & 0xff) == 0) status = (status & 0xff00) >> 8;
--- a/src/pager.cc +++ b/src/pager.cc @@ -122,8 +122,8 @@ void flush_output_to_pager (void) { - // Extract message from buffer, then delete the buffer so that any - // new messages get sent separately. + // Extract message from buffer, then delete the buffer so that any + // new messages get sent separately. *pager_buf << ends; char *message = pager_buf->str ();
--- a/src/pt-const.cc +++ b/src/pt-const.cc @@ -333,7 +333,8 @@ { Octave_object retval; -// Got an empty argument, check if should gripe/return empty values. + // Got an empty argument, check if should gripe/return empty + // values. int flag = user_pref.propagate_empty_matrices; if (flag != 0) @@ -1565,8 +1566,9 @@ } else { + // XXX FIXME XXX -- warn about out of range conversions? + int i = NINT (d); -// Warn about out of range conversions? char s[2]; s[0] = (char) i; s[1] = '\0'; @@ -1615,7 +1617,8 @@ } else { - // Warn about out of range conversions? + // XXX FIXME XXX -- warn about out of + // range conversions? int ival = NINT (d); buf[j] = (char) ival; @@ -1651,8 +1654,10 @@ } else { + // XXX FIXME XXX -- warn about out of range + // conversions? + int ival = NINT (d); -// Warn about out of range conversions? s[i] = (char) ival; } } @@ -1993,11 +1998,13 @@ assert (i >= 0 && (nr <= 1 || nc <= 1)); -// This function never reduces the size of a vector, and all vectors -// have dimensions of at least 0x0. If i is 0, it is either because -// a vector has been indexed with a vector of all zeros (in which case -// the index vector is empty and nothing will happen) or a vector has -// been indexed with 0 (an error which will be caught elsewhere). + // This function never reduces the size of a vector, and all vectors + // have dimensions of at least 0x0. If i is 0, it is either because + // a vector has been indexed with a vector of all zeros (in which + // case the index vector is empty and nothing will happen) or a + // vector has been indexed with 0 (an error which will be caught + // elsewhere). + if (i == 0) return; @@ -2071,7 +2078,7 @@ break; } -// Avoid calling rows() and columns() for things like magic_colon. + // Avoid calling rows() and columns() for things like magic_colon. int nr = 1; int nc = 1; @@ -2154,9 +2161,10 @@ case map_constant: { -// XXX FIXME XXX -- would be nice to print the output in some standard -// order. Maybe all substructures first, maybe alphabetize entries, -// etc. + // XXX FIXME XXX -- would be nice to print the output in some + // standard order. Maybe all substructures first, maybe + // alphabetize entries, etc. + begin_unwind_frame ("TC_REP_print"); unwind_protect_int (structure_indent_level); @@ -2222,9 +2230,9 @@ double re = complex_scalar->real (); double im = complex_scalar->imag (); -// If we have the original text and a pure imaginary, just print the -// original text, because this must be a constant that was parsed as -// part of a function. + // If we have the original text and a pure imaginary, just + // print the original text, because this must be a constant + // that was parsed as part of a function. if (orig_text && re == 0.0 && im > 0.0) os << orig_text; @@ -2618,13 +2626,13 @@ case string_constant: gripe_string_invalid (); -// retval = do_string_index (args); + // retval = do_string_index (args); break; default: -// This isn\'t great, but it\'s easier than implementing a lot of -// other special indexing functions. + // This isn't great, but it's easier than implementing a lot + // of other special indexing functions. force_numeric (); @@ -2708,7 +2716,7 @@ break; } -// Fall through... + // Fall through... case 1: { @@ -2756,9 +2764,9 @@ else break; -// If only one index, cols will not be set, so we set it. -// If single index is [], rows will be zero, and we should set cols to -// zero too. + // If only one index, cols will not be set, so we set it. + // If single index is [], rows will be zero, and we should + // set cols to zero too. if (cols < 0) { @@ -3017,7 +3025,8 @@ } else { -// Yes, we really do want to call this with mi. + // Yes, we really do want to call this with mi. + retval = fortran_style_matrix_index (mi); } } @@ -3076,7 +3085,8 @@ int result_size = iv.length (); -// XXX FIXME XXX -- there is way too much duplicate code here... + // XXX FIXME XXX -- there is way too much duplicate code + // here... if (iv.one_zero_only ()) { @@ -4143,10 +4153,10 @@ if (error_state) return; -// This is easier than actually handling assignments to strings. -// An assignment to a range will normally require a conversion to a -// vector since it will normally destroy the equally-spaced property -// of the range elements. + // This is easier than actually handling assignments to strings. An + // assignment to a range will normally require a conversion to a + // vector since it will normally destroy the equally-spaced property + // of the range elements. if (is_defined () && ! is_numeric_type ()) force_numeric (); @@ -4259,15 +4269,14 @@ type_tag = matrix_constant; } -// If there is an error, the call to do_matrix_assignment should not -// destroy the current value. -// TC_REP::eval(int) will take -// care of converting single element matrices back to scalars. + // If there is an error, the call to do_matrix_assignment should + // not destroy the current value. TC_REP::eval(int) will take + // care of converting single element matrices back to scalars. do_matrix_assignment (rhs, args); -// I don't think there's any other way to revert back to unknown -// constant types, so here it is. + // I don't think there's any other way to revert back to unknown + // constant types, so here it is. if (old_type_tag == unknown_constant && error_state) { @@ -4321,8 +4330,9 @@ int nargin = args.length (); -// The do_matrix_assignment functions can't handle empty matrices, so -// don't let any pass through here. + // The do_matrix_assignment functions can't handle empty matrices, + // so don't let any pass through here. + switch (nargin) { case 1: @@ -4352,9 +4362,10 @@ ::error ("in assignment expression, a matrix index is empty"); ::error ("but the right hand side is not an empty matrix"); } -// XXX FIXME XXX -- to really be correct here, we should probably -// check to see if the assignment conforms, but that seems like more -// work than it's worth right now... + + // XXX FIXME XXX -- to really be correct here, we should + // probably check to see if the assignment conforms, but + // that seems like more work than it's worth right now... } else do_matrix_assignment (rhs, arg_a, arg_b); @@ -4388,19 +4399,22 @@ ::error ("in assignment expression, matrix index is empty but"); ::error ("right hand side is not an empty matrix"); } -// XXX FIXME XXX -- to really be correct here, we should probably -// check to see if the assignment conforms, but that seems like more -// work than it's worth right now... - -// The assignment functions can't handle empty matrices, so don't let -// any pass through here. + + // XXX FIXME XXX -- to really be correct here, we should + // probably check to see if the assignment conforms, but + // that seems like more work than it's worth right now... + + // The assignment functions can't handle empty matrices, so + // don't let any pass through here. + return; } -// We can't handle the case of assigning to a vector first, since even -// then, the two operations are not equivalent. For example, the -// expression V(:) = M is handled differently depending on whether the -// user specified do_fortran_indexing = "true". + // We can't handle the case of assigning to a vector first, + // since even then, the two operations are not equivalent. For + // example, the expression V(:) = M is handled differently + // depending on whether the user specified do_fortran_indexing = + // "true". if (user_pref.do_fortran_indexing) fortran_style_matrix_assignment (rhs, i_arg); @@ -4587,7 +4601,9 @@ break; case magic_colon: -// a(:) = [] is equivalent to a(:,:) = []. + + // a(:) = [] is equivalent to a(:,:) = []. + if (rhs_nr == 0 && rhs_nc == 0) do_matrix_assignment (rhs, magic_colon, magic_colon); else @@ -5198,7 +5214,7 @@ } } -/* MA1 */ +// -*- MA1 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, int i, const tree_constant& j_arg) @@ -5353,7 +5369,7 @@ } } -/* MA2 */ +// -*- MA2 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, idx_vector& iv, const tree_constant& j_arg) @@ -5493,7 +5509,7 @@ } } -/* MA3 */ +// -*- MA3 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, Range& ri, const tree_constant& j_arg) @@ -5638,7 +5654,7 @@ } } -/* MA4 */ +// -*- MA4 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, TC_REP::constant_type i, @@ -5828,7 +5844,7 @@ // colon | 4 | 8 | 12 | 16 | // ---------+---+---+----+----+ -/* 1 */ +// -*- 1 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, int i, int j) { @@ -5836,7 +5852,7 @@ rhs.is_real_type ()); } -/* 2 */ +// -*- 2 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, int i, idx_vector& jv) { @@ -5847,7 +5863,7 @@ rhs_cm.elem (0, j), rhs.is_real_type ()); } -/* 3 */ +// -*- 3 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, int i, Range& rj) { @@ -5865,7 +5881,7 @@ } } -/* 4 */ +// -*- 4 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, int i, TC_REP::constant_type mcj) @@ -5895,7 +5911,7 @@ panic_impossible (); } -/* 5 */ +// -*- 5 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, idx_vector& iv, int j) @@ -5910,7 +5926,7 @@ } } -/* 6 */ +// -*- 6 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, idx_vector& iv, idx_vector& jv) @@ -5929,7 +5945,7 @@ } } -/* 7 */ +// -*- 7 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, idx_vector& iv, Range& rj) @@ -5952,7 +5968,7 @@ } } -/* 8 */ +// -*- 8 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, idx_vector& iv, TC_REP::constant_type mcj) @@ -5981,7 +5997,7 @@ } } -/* 9 */ +// -*- 9 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, Range& ri, int j) { @@ -5999,7 +6015,7 @@ } } -/* 10 */ +// -*- 10 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, Range& ri, idx_vector& jv) @@ -6022,7 +6038,7 @@ } } -/* 11 */ +// -*- 11 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, Range& ri, Range& rj) @@ -6048,7 +6064,7 @@ } } -/* 12 */ +// -*- 12 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, Range& ri, TC_REP::constant_type mcj) @@ -6079,7 +6095,7 @@ } } -/* 13 */ +// -*- 13 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, TC_REP::constant_type mci, int j) @@ -6109,7 +6125,7 @@ panic_impossible (); } -/* 14 */ +// -*- 14 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, TC_REP::constant_type mci, idx_vector& jv) @@ -6138,7 +6154,7 @@ } } -/* 15 */ +// -*- 15 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, TC_REP::constant_type mci, Range& rj) @@ -6171,7 +6187,7 @@ } } -/* 16 */ +// -*- 16 -*- void TC_REP::do_matrix_assignment (const tree_constant& rhs, TC_REP::constant_type mci, @@ -6369,7 +6385,8 @@ int nr = rows (); int nc = columns (); -// If deleting all rows of a column vector, make result 0x0. + // If deleting all rows of a column vector, make result 0x0. + if (nc == 1 && num_to_delete == nr) nc = 0; @@ -6487,7 +6504,8 @@ int nr = rows (); int nc = columns (); -// If deleting all columns of a row vector, make result 0x0. + // If deleting all columns of a row vector, make result 0x0. + if (nr == 1 && num_to_delete == nc) nr = 0; @@ -6551,7 +6569,8 @@ int nr = rows (); int nc = columns (); -// If deleting all columns of a row vector, make result 0x0. + // If deleting all columns of a row vector, make result 0x0. + if (nr == 1 && num_to_delete == nc) nr = 0;
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -83,8 +83,9 @@ tree **args = new tree * [len]; -// args[0] may eventually hold something useful, like the function -// name. + // args[0] may eventually hold something useful, like the function + // name. + tree *tmp_list = list; for (int k = 1; k < len; k++) { @@ -297,15 +298,16 @@ if (error_state) return retval; -// Just count the elements without looking at them. + // Just count the elements without looking at them. int total_len = length (); -// Easier to deal with this later instead of a tree_matrix structure. + // Easier to deal with this later instead of a tree_matrix + // structure. const_matrix_list *list = new const_matrix_list [total_len]; -// Stats we want to keep track of. + // Stats we want to keep track of. int all_strings = 1; @@ -324,9 +326,9 @@ tree_matrix *ptr = this; -// Stuff for the result matrix or string. Declared here so that we -// don't get warnings from gcc about the goto crossing the -// initialization of these values. + // Stuff for the result matrix or string. Declared here so that we + // don't get warnings from gcc about the goto crossing the + // initialization of these values. int put_row = 0; int put_col = 0; @@ -339,7 +341,7 @@ Octave_str_obj string; -// Eliminate empties and gather stats. + // Eliminate empties and gather stats. int found_new_row_in_empties = 0; @@ -407,11 +409,11 @@ ptr = ptr->next; } -// if (all_strings) -// cerr << "all strings\n"; - -// Compute size of result matrix, and check to see that the dimensions -// of all the elements will match up properly. + // if (all_strings) + // cerr << "all strings\n"; + + // Compute size of result matrix, and check to see that the dimensions + // of all the elements will match up properly. for (int i = 0; i < len; i++) { @@ -469,7 +471,7 @@ } } -// Don\'t forget to check to see if the last element will fit. + // Don't forget to check to see if the last element will fit. if (cols_this_row != col_total && ! all_strings) { @@ -477,8 +479,8 @@ goto done; } -// Now, extract the values from the individual elements and insert -// them in the result matrix. + // Now, extract the values from the individual elements and insert + // them in the result matrix. if (all_strings) string.resize (row_total); @@ -1008,7 +1010,8 @@ if (maybe_do_ans_assign && nargout == 1) { -// Don't count the output arguments that we create automatically. + // Don't count the output arguments that we create + // automatically. nargout = 0; @@ -1232,7 +1235,8 @@ if (list) { -// Extract the arguments into a simple vector. Don't pass null args. + // Extract the arguments into a simple vector. Don't pass null + // args. Octave_object args = list->convert_to_const_vector (); @@ -1284,7 +1288,8 @@ if (list) { -// Extract the arguments into a simple vector. Don't pass null args. + // Extract the arguments into a simple vector. Don't pass null + // args. Octave_object args = list->convert_to_const_vector (); @@ -1937,7 +1942,7 @@ } else { -// Extract the arguments into a simple vector. + // Extract the arguments into a simple vector. Octave_object args = index->convert_to_const_vector (); @@ -1975,8 +1980,6 @@ if (l != -1 && c != -1) ::error ("evaluating assignment expression near line %d, column %d", l, c); -// else -// ::error ("evaluating assignment expression"); } } @@ -2067,8 +2070,9 @@ if (i < nargout) { -// XXX FIXME? XXX -- this is apparently the way Matlab works, but -// maybe we should have the option of skipping the assignment instead. + // XXX FIXME? XXX -- this is apparently the way Matlab + // works, but maybe we should have the option of + // skipping the assignment instead. tree_constant *tmp = 0; if (results(i).is_undefined ()) @@ -2278,7 +2282,7 @@ if (op1) op1->print_code (os); -// Stupid syntax. + // Stupid syntax. if (op3) { @@ -2570,12 +2574,14 @@ { if (file_name) { -// We really should stash the whole path to the file we found, when we -// looked it up, to avoid possible race conditions... XXX FIXME XXX -// -// We probably also don't need to get the library directory every -// time, but since this function is only called when the function file -// is parsed, it probably doesn't matter that much. + // We really should stash the whole path to the file we found, + // when we looked it up, to avoid possible race conditions... + // XXX FIXME XXX + // + // We probably also don't need to get the library directory + // every time, but since this function is only called when the + // function file is parsed, it probably doesn't matter that + // much. char *oct_lib = octave_lib_dir (); int len = strlen (oct_lib); @@ -2712,11 +2718,14 @@ if (vr_list) { -// Push new vr_list. + // Push new vr_list. + unwind_protect_ptr (vr_list); vr_list = new tree_va_return_list; -// Clear and delete the new one before restoring the old one. + // Clear and delete the new one before restoring the old + // one. + add_unwind_protect (delete_vr_list, (void *) vr_list); } } @@ -2724,11 +2733,12 @@ if (vr_list) vr_list->clear (); -// Force symbols to be undefined again when this function exits. + // Force symbols to be undefined again when this function exits. add_unwind_protect (clear_symbol_table, (void *) sym_tab); -// Save old and set current symbol table context, for eval_undefined_error(). + // Save old and set current symbol table context, for + // eval_undefined_error(). unwind_protect_ptr (curr_sym_tab); curr_sym_tab = sym_tab; @@ -2736,7 +2746,8 @@ unwind_protect_ptr (curr_function); curr_function = this; -// unwind_protect_ptr (args_passed); + // unwind_protect_ptr (args_passed); + args_passed = args; unwind_protect_int (num_args_passed); @@ -2752,16 +2763,16 @@ goto abort; } -// The following code is in a separate scope to avoid warnings from -// G++ about `goto abort' crossing the initialization of some -// variables. + // The following code is in a separate scope to avoid warnings from + // G++ about `goto abort' crossing the initialization of some + // variables. { bind_nargin_and_nargout (nargin, nargout); -// Evaluate the commands that make up the function. Always turn on -// printing for commands inside functions. Maybe this should be -// toggled by a user-leval variable? + // Evaluate the commands that make up the function. Always turn + // on printing for commands inside functions. Maybe this should + // be toggled by a user-leval variable? int pf = ! user_pref.silent_functions; tree_constant last_computed_value = cmd_list->eval (pf); @@ -2778,7 +2789,7 @@ goto abort; } -// Copy return values out. + // Copy return values out. if (ret_list) {
--- a/src/pt-misc.cc +++ b/src/pt-misc.cc @@ -208,9 +208,9 @@ { int len = length (); -// XXX FIXME XXX -- would be nice to know in advance how largs args -// needs to be even when we have a list containing an all_va_args -// token. + // XXX FIXME XXX -- would be nice to know in advance how largs args + // needs to be even when we have a list containing an all_va_args + // token. Octave_object args; args.resize (len);
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -61,7 +61,7 @@ #include <readline/tilde.h> } -// The number of lines we\'ve plotted so far. +// The number of lines we've plotted so far. static int plot_line_count = 0; // Is this a parametric plot? Makes a difference for 3D plotting. @@ -158,7 +158,8 @@ static int send_to_plot_stream (const char *cmd) { -// From sighandlers.cc: + // From sighandlers.cc: + extern int pipe_handler_error_count; if (! plot_stream.is_open ()) @@ -301,9 +302,9 @@ plot_buf << "\n" << ends; -// Just testing... -// char *message = plot_buf.str (); -// cout << "[*]" << message << "[*]\n"; + // Just testing... + // char *message = plot_buf.str (); + // cout << "[*]" << message << "[*]\n"; if (parametric_plot && ndim == 2) { @@ -845,8 +846,9 @@ char *file = 0; if (data.is_string ()) { -// Should really try to look at data file to determine n_max. Can't -// do much about other arbitrary gnuplot commands though... + // Should really try to look at data file to determine + // n_max. Can't do much about other arbitrary gnuplot + // commands though... int n_max = 0; @@ -862,8 +864,9 @@ free (file); file = 0; -// Opening as a file failed. Let's try passing it along as a plot -// command. + // Opening as a file failed. Let's try passing it + // along as a plot command. + plot_buf << " " << data.string_value (); } @@ -876,7 +879,8 @@ } else { -// Eliminate the need for printing a using clause to plot_buf. + // Eliminate the need for printing a using clause to + // plot_buf. tree_constant tmp_data = extract_plot_data (ndim, data); @@ -1092,8 +1096,9 @@ Octave_object retval; send_to_plot_stream ("clear\n"); -// XXX FIXME XXX -- instead of just clearing these things, it would be -// nice if we could reset things to a user-specified default state. + // XXX FIXME XXX -- instead of just clearing these things, it would + // be nice if we could reset things to a user-specified default + // state. send_to_plot_stream ("set title\n"); send_to_plot_stream ("set xlabel\n"); @@ -1101,8 +1106,8 @@ send_to_plot_stream ("set nogrid\n"); send_to_plot_stream ("set nolabel\n"); -// This makes a simple `replot' not work after a `clearplot' command -// has been issued. + // This makes a simple `replot' not work after a `clearplot' command + // has been issued. plot_line_count = 0;
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -125,8 +125,8 @@ static RETSIGTYPE sigint_handler (int i) { -// Can this ever cause trouble on systems that don't forget signal -// handlers when they are invoked? + // Can this ever cause trouble on systems that don't forget signal + // handlers when they are invoked? signal (SIGINT, sigint_handler); @@ -146,15 +146,16 @@ static RETSIGTYPE sigpipe_handler (int i) { -// Can this ever cause trouble on systems that don't forget signal -// handlers when they are invoked? + // Can this ever cause trouble on systems that don't forget signal + // handlers when they are invoked? signal (SIGPIPE, sigpipe_handler); if (pipe_handler_error_count++ == 0) message (0, "broken pipe"); -// Don\'t loop forever on account of this. + // Don't loop forever on account of this. + if (pipe_handler_error_count > 100) jump_to_top_level ();
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -85,7 +85,7 @@ int nr = str.num_strings (); int nc = str.max_length (); -// XXX FIXME XXX -- should fill with user-specified value. + // XXX FIXME XXX -- should fill with user-specified value. Matrix m (nr, nc, 0);
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -403,7 +403,8 @@ if (sv_fcn && sv_fcn () < 0) { -// Would be nice to be able to avoid this cast. XXX FIXME XXX + // Would be nice to be able to avoid this cast. XXX FIXME XXX + definition->define ((tree_constant *) saved_def); return 0; } @@ -687,7 +688,8 @@ if (sr.is_variable () && sr.is_defined ()) { -// Would be nice to avoid this cast. XXX FIXME XXX + // Would be nice to avoid this cast. XXX FIXME XXX + tree_constant *tmp = (tree_constant *) sr.def (); if (tmp->is_real_scalar ()) const_type = SR_INFO_SCALAR;
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -191,8 +191,8 @@ #else -// This is sort of cheesy, but what can we do, other than blowing it -// off completely, or writing an entire IEEE emulation package? + // This is sort of cheesy, but what can we do, other than blowing it + // off completely, or writing an entire IEEE emulation package? octave_Inf = DBL_MAX; octave_NaN = DBL_MAX; @@ -259,8 +259,8 @@ int matherr (struct exception *x) { -// Possibly print our own message someday. Should probably be -// user-switchable. + // Possibly print our own message someday. Should probably be + // user-switchable. switch (x->type) { @@ -274,7 +274,7 @@ break; } -// But don't print the system message. + // But don't print the system message. return 1; } @@ -286,7 +286,7 @@ { #if defined (__386BSD__) || defined (__FreeBSD__) #if defined (HAVE_FLOATINGPOINT_H) -// Disable trapping on common exceptions. + // Disable trapping on common exceptions. fpsetmask (~(FP_X_OFL|FP_X_INV|FP_X_DZ|FP_X_DNML|FP_X_UFL|FP_X_IMP)); #endif #endif @@ -333,18 +333,18 @@ if (on) { -// Get terminal modes. + // Get terminal modes. tcgetattr (tty_fd, &s); -// Save modes and set certain variables dependent on modes. + // Save modes and set certain variables dependent on modes. save_term = s; // ospeed = s.c_cflag & CBAUD; // erase_char = s.c_cc[VERASE]; // kill_char = s.c_cc[VKILL]; -// Set the modes to the way we want them. + // Set the modes to the way we want them. s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); s.c_oflag |= (OPOST|ONLCR); @@ -362,7 +362,8 @@ } else { -// Restore saved modes. + // Restore saved modes. + s = save_term; } tcsetattr (tty_fd, TCSAFLUSH, &s); @@ -374,18 +375,18 @@ if (on) { -// Get terminal modes. + // Get terminal modes. ioctl (tty_fd, TCGETA, &s); -// Save modes and set certain variables dependent on modes. + // Save modes and set certain variables dependent on modes. save_term = s; // ospeed = s.c_cflag & CBAUD; // erase_char = s.c_cc[VERASE]; // kill_char = s.c_cc[VKILL]; -// Set the modes to the way we want them. + // Set the modes to the way we want them. s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); s.c_oflag |= (OPOST|ONLCR); @@ -403,7 +404,8 @@ } else { -// Restore saved modes. + // Restore saved modes. + s = save_term; } ioctl (tty_fd, TCSETAW, &s); @@ -415,25 +417,26 @@ if (on) { -// Get terminal modes. + // Get terminal modes. ioctl (tty_fd, TIOCGETP, &s); -// Save modes and set certain variables dependent on modes. + // Save modes and set certain variables dependent on modes. save_term = s; // ospeed = s.sg_ospeed; // erase_char = s.sg_erase; // kill_char = s.sg_kill; -// Set the modes to the way we want them. + // Set the modes to the way we want them. s.sg_flags |= CBREAK; s.sg_flags &= ~(ECHO); } else { -// Restore saved modes. + // Restore saved modes. + s = save_term; } ioctl (tty_fd, TIOCSETN, &s); @@ -544,7 +547,7 @@ { Octave_object retval; -// XXX FIXME XXX -- add timeout and default value args? + // XXX FIXME XXX -- add timeout and default value args? if (interactive) {
--- a/src/tc-rep.cc +++ b/src/tc-rep.cc @@ -1208,8 +1208,9 @@ } else { + // XXX FIXME XXX -- warn about out of range conversions? + int i = NINT (d); -// Warn about out of range conversions? char s[2]; s[0] = (char) i; s[1] = '\0'; @@ -1251,8 +1252,10 @@ } else { + // XXX FIXME XXX -- warn about out of range + // conversions? + int ival = NINT (d); -// Warn about out of range conversions? s[i] = (char) ival; } } @@ -1283,8 +1286,10 @@ } else { + // XXX FIXME XXX -- warn about out of range + // conversions? + int ival = NINT (d); -// Warn about out of range conversions? s[i] = (char) ival; } } @@ -1615,11 +1620,13 @@ assert (i >= 0 && (nr <= 1 || nc <= 1)); -// This function never reduces the size of a vector, and all vectors -// have dimensions of at least 0x0. If i is 0, it is either because -// a vector has been indexed with a vector of all zeros (in which case -// the index vector is empty and nothing will happen) or a vector has -// been indexed with 0 (an error which will be caught elsewhere). + // This function never reduces the size of a vector, and all vectors + // have dimensions of at least 0x0. If i is 0, it is either because + // a vector has been indexed with a vector of all zeros (in which + // case the index vector is empty and nothing will happen) or a + // vector has been indexed with 0 (an error which will be caught + // elsewhere). + if (i == 0) return; @@ -1693,7 +1700,7 @@ break; } -// Avoid calling rows() and columns() for things like magic_colon. + // Avoid calling rows() and columns() for things like magic_colon. int nr = 1; int nc = 1; @@ -1776,9 +1783,10 @@ case map_constant: { -// XXX FIXME XXX -- would be nice to print the output in some standard -// order. Maybe all substructures first, maybe alphabetize entries, -// etc. + // XXX FIXME XXX -- would be nice to print the output in some + // standard order. Maybe all substructures first, maybe + // alphabetize entries, etc. + begin_unwind_frame ("TC_REP_print"); unwind_protect_int (structure_indent_level); @@ -1844,9 +1852,9 @@ double re = complex_scalar->real (); double im = complex_scalar->imag (); -// If we have the original text and a pure imaginary, just print the -// original text, because this must be a constant that was parsed as -// part of a function. + // If we have the original text and a pure imaginary, just + // print the original text, because this must be a constant + // that was parsed as part of a function. if (orig_text && re == 0.0 && im > 0.0) os << orig_text;
--- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -34,7 +34,7 @@ #include "variables.h" // The list of user preferences. Values change when global variables -// change, so we don\'t have to do a variable look up every time we +// change, so we don't have to do a variable look up every time we // need to check a preference. user_preferences user_pref; @@ -210,7 +210,7 @@ // Should we allow silent conversion of complex to real when a real -// type is what we\'re really looking for? +// type is what we're really looking for? int ok_to_lose_imaginary_part (void)
--- a/src/utils.cc +++ b/src/utils.cc @@ -402,9 +402,10 @@ if (i == num_max - 1) { -// Reallocate the array. Only copy pointers, not the strings they -// point to, then only delete the original array of pointers, and not -// the strings they point to. + // Reallocate the array. Only copy pointers, not + // the strings they point to, then only delete the + // original array of pointers, and not the strings + // they point to. num_max += 256; char **tmp = new char * [num_max]; @@ -451,9 +452,10 @@ if (i + tmp_num >= num_max - 1) { -// Reallocate the array. Only copy pointers, not the strings they -// point to, then only delete the original array of pointers, and not -// the strings they point to. + // Reallocate the array. Only copy pointers, not + // the strings they point to, then only delete the + // original array of pointers, and not the strings + // they point to. num_max += 1024; char **tmp = new char * [num_max]; @@ -568,7 +570,7 @@ ostrstream& list_in_columns (ostrstream& os, char **list) { -// Compute the maximum name length. + // Compute the maximum name length. int max_name_length = 0; int total_names = 0; @@ -581,23 +583,23 @@ max_name_length = name_length; } -// Allow at least two spaces between names. + // Allow at least two spaces between names. max_name_length += 2; -// Calculate the maximum number of columns that will fit. + // Calculate the maximum number of columns that will fit. int line_length = terminal_columns (); int cols = line_length / max_name_length; if (cols == 0) cols = 1; -// Calculate the number of rows that will be in each column except -// possibly for a short column on the right. + // Calculate the number of rows that will be in each column except + // possibly for a short column on the right. int rows = total_names / cols + (total_names % cols != 0); -// Recalculate columns based on rows. + // Recalculate columns based on rows. cols = total_names / rows + (total_names % rows != 0); @@ -608,7 +610,7 @@ count = row; int pos = 0; -// Print the next row. + // Print the next row. while (1) {
--- a/src/variables.cc +++ b/src/variables.cc @@ -643,7 +643,7 @@ assert (ff); -// Open function file and parse. + // Open function file and parse. int old_reading_fcn_file_state = reading_fcn_file;
--- a/src/xpow.cc +++ b/src/xpow.cc @@ -186,8 +186,10 @@ } else { -// Too much copying? -// XXX FIXME XXX -- we shouldn\'t do this if the exponent is large... + // Too much copying? + // XXX FIXME XXX -- we shouldn't do this if the exponent is + // large... + Matrix atmp; if (btmp < 0) { @@ -362,8 +364,10 @@ } else { -// Too much copying? -// XXX FIXME XXX -- we shouldn\'t do this if the exponent is large... + // Too much copying? + // XXX FIXME XXX -- we shouldn't do this if the exponent is + // large... + ComplexMatrix atmp; if (btmp < 0) { @@ -449,7 +453,8 @@ int nr = b.rows (); int nc = b.columns (); -// For now, assume the worst. + // For now, assume the worst. + if (a < 0.0) { Complex atmp (a);