# HG changeset patch # User Soren Hauberg # Date 1243357152 -7200 # Node ID be7d8132c1392a90ce12f11c1ad7182eb0c9f648 # Parent 9eb6e8f2b937a0ecda984b5cec9486809789095b# Parent de255681c85f4b1e1704b429f4e77f6430a0b940 Resolve ChangeLog conflict diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -2,6 +2,10 @@ * help/__makeinfo__.m: Support several @seealso's in one text. +2009-05-26 John W. Eaton + + * plot/colorbar.m: Downcase location argument. + 2009-05-26 Carlo de Falco * pkg/pkg.m: Add "version" field to the structure returned by "pkg diff --git a/scripts/plot/colorbar.m b/scripts/plot/colorbar.m --- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -71,7 +71,7 @@ || strcmpi (arg, "east") || strcmpi (arg, "west") || strcmpi (arg, "northoutside") || strcmpi (arg, "southoutside") || strcmpi (arg, "eastoutside") || strcmpi (arg, "westoutside")) - loc = arg; + loc = tolower (arg); elseif (strcmpi (arg, "off") || strcmpi (arg, "none")) deleting = true; else diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2009-05-26 John W. Eaton + + * load-path.h, load-path.cc (load_path::files, load_path::do_files): + New arg, OMIT_EXTS. + * help.cc (F__list_functions__): Call load_path::files with + omit_exts set to true. + + * symtab.h + (symbol_table::symbol_record::symbol_record_rep::is_variable): + Use "! is_local ()" instead of storage_class != local. + (symbol_table::do_variable_names): Only add variables to the list. + (symbol_table::unmark_forced_variables): New static function + * variables.cc (do_who): Use is_variable instead of is_defined. + Also limit output to variables when using regexp pattern. + * octave.cc (unmark_forced_vars): Delete. + (execute_eval_option_code): Don't add unmark_forced_vars to + unwind_protect stack here. + * toplev.cc (main_loop): Add symbol_table::unmark_forced_variables + to the unwind_protect stack here. + * input.cc (get_debug_input): Likewise. + * parse.y (parse_fcn_file, eval_string): Likewise. + 2009-05-25 Jaroslav Hajek * toplev.h (quit_allowed): New global variable. diff --git a/src/help.cc b/src/help.cc --- a/src/help.cc +++ b/src/help.cc @@ -957,10 +957,17 @@ if (! error_state) { - string_vector fl = load_path::files (dir); + string_vector fl = load_path::files (dir, true); if (! error_state) - retval = Cell (fl); + { + // Return a sorted list with unique entries (in case of + // .m and .oct versions of the same function in a given + // directory, for example). + fl.sort (true); + + retval = Cell (fl); + } } else error ("__list_functions__: input must be a string"); diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -666,6 +666,11 @@ // Save current value of global_command. unwind_protect_ptr (global_command); + // Do this with an unwind-protect cleanup function so that the + // forced variables will be unmarked in the event of an interrupt. + symbol_table::scope_id scope = symbol_table::top_scope (); + unwind_protect::add (symbol_table::unmark_forced_variables, &scope); + // This is the same as yyparse in parse.y. int retval = octave_parse (); @@ -687,6 +692,9 @@ octave_completion_matches_called = false; } + // Unmark forced variables. + unwind_protect::run (); + // Restore previous value of global_command. unwind_protect::run (); diff --git a/src/load-path.cc b/src/load-path.cc --- a/src/load-path.cc +++ b/src/load-path.cc @@ -1337,7 +1337,7 @@ } string_vector -load_path::do_files (const std::string& dir) const +load_path::do_files (const std::string& dir, bool omit_exts) const { string_vector retval; @@ -1346,6 +1346,21 @@ if (i != dir_info_list.end ()) retval = i->fcn_files; + if (omit_exts) + { + octave_idx_type len = retval.length (); + + for (octave_idx_type i = 0; i < len; i++) + { + std::string fname = retval[i]; + + size_t pos = fname.rfind ('.'); + + if (pos != std::string::npos) + retval[i] = fname.substr (0, pos); + } + } + return retval; } diff --git a/src/load-path.h b/src/load-path.h --- a/src/load-path.h +++ b/src/load-path.h @@ -186,9 +186,10 @@ ? instance->do_dir_list () : std::list (); } - static string_vector files (const std::string& dir) + static string_vector files (const std::string& dir, bool omit_exts = false) { - return instance_ok () ? instance->do_files (dir) : string_vector (); + return instance_ok () + ? instance->do_files (dir, omit_exts) : string_vector (); } static string_vector fcn_names (void) @@ -490,7 +491,7 @@ std::list do_dir_list (void) const; - string_vector do_files (const std::string& dir) const; + string_vector do_files (const std::string& dir, bool omit_exts) const; string_vector do_fcn_names (void) const; diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -367,18 +367,6 @@ unwind_protect::run_frame ("execute_startup_files"); } -static void -unmark_forced_vars (void *arg) -{ - // Unmark any symbols that may have been tagged as local variables - // while parsing (for example, by force_local_variable in lex.l). - - symbol_table::scope_id *pscope = static_cast (arg); - - if (pscope) - symbol_table::unmark_forced_variables (*pscope); -} - static int execute_eval_option_code (const std::string& code) { @@ -398,11 +386,6 @@ unwind_protect_bool (interactive); - // Do this with an unwind-protect cleanup function so that the - // forced variables will be unmarked in the event of an interrupt. - symbol_table::scope_id scope = symbol_table::top_scope (); - unwind_protect::add (unmark_forced_vars, &scope); - interactive = false; int parse_status = 0; diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -3258,6 +3258,12 @@ reset_parser (); + // Do this with an unwind-protect cleanup function so that + // the forced variables will be unmarked in the event of an + // interrupt. + symbol_table::scope_id scope = symbol_table::top_scope (); + unwind_protect::add (symbol_table::unmark_forced_variables, &scope); + if (! help_txt.empty ()) help_buf.push (help_txt); @@ -3905,10 +3911,19 @@ unwind_protect_ptr (global_command); + // Do this with an unwind-protect cleanup function so that the + // forced variables will be unmarked in the event of an + // interrupt. + symbol_table::scope_id scope = symbol_table::top_scope (); + unwind_protect::add (symbol_table::unmark_forced_variables, &scope); + parse_status = yyparse (); tree_statement_list *command_list = global_command; + // Unmark forced variables. + unwind_protect::run (); + // Restore previous value of global_command. unwind_protect::run (); diff --git a/src/symtab.h b/src/symtab.h --- a/src/symtab.h +++ b/src/symtab.h @@ -297,7 +297,7 @@ bool is_variable (context_id context) const { - return (storage_class != local || is_defined (context) || is_forced ()); + return (! is_local () || is_defined (context) || is_forced ()); } bool is_local (void) const { return storage_class & local; } @@ -1335,6 +1335,19 @@ } // For unwind_protect. + static void unmark_forced_variables (void *arg) + { + // Unmark any symbols that may have been tagged as local variables + // while parsing (for example, by force_local_variable in lex.l). + + symbol_table::scope_id *p = static_cast (arg); + + if (p) + unmark_forced_variables (*p); +} + + + // For unwind_protect. static void clear_variables (void *) { clear_variables (); } static void clear_functions (void) @@ -2289,7 +2302,10 @@ std::list retval; for (table_const_iterator p = table.begin (); p != table.end (); p++) - retval.push_back (p->first); + { + if (p->second.is_variable ()) + retval.push_back (p->first); + } retval.sort (); diff --git a/src/toplev.cc b/src/toplev.cc --- a/src/toplev.cc +++ b/src/toplev.cc @@ -548,10 +548,18 @@ { try { + unwind_protect::begin_frame ("main_loop"); + reset_error_handler (); reset_parser (); + // Do this with an unwind-protect cleanup function so that + // the forced variables will be unmarked in the event of an + // interrupt. + symbol_table::scope_id scope = symbol_table::top_scope (); + unwind_protect::add (symbol_table::unmark_forced_variables, &scope); + // This is the same as yyparse in parse.y. retval = octave_parse (); @@ -602,6 +610,8 @@ else if (parser_end_of_input) break; } + + unwind_protect::run_frame ("main_loop"); } catch (octave_quit_exception e) { diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -1453,10 +1453,13 @@ for (std::list::const_iterator p = tmp.begin (); p != tmp.end (); p++) { - if (verbose) - symbol_stats.append (*p); - else - symbol_names.push_back (p->name ()); + if (p->is_variable ()) + { + if (verbose) + symbol_stats.append (*p); + else + symbol_names.push_back (p->name ()); + } } } else @@ -1505,7 +1508,7 @@ for (std::list::const_iterator p = tmp.begin (); p != tmp.end (); p++) { - if (p->is_defined ()) + if (p->is_variable ()) { if (verbose) symbol_stats.append (*p);