# HG changeset patch # User jwe # Date 811440277 0 # Node ID 2d88758ed94bde6fba1bdf6b03442cedfe0466b8 # Parent afde7233c4dc6a52a74088526c4ade8a31e4fb51 [project @ 1995-09-18 16:04:37 by jwe] diff -r afde7233c4dc -r 2d88758ed94b src/error.cc --- a/src/error.cc Sat Sep 16 02:51:08 1995 +0000 +++ b/src/error.cc Mon Sep 18 16:04:37 1995 +0000 @@ -34,6 +34,7 @@ #include "oct-obj.h" #include "pager.h" #include "tree-const.h" +#include "user-prefs.h" #include "utils.h" // Current error state. @@ -47,6 +48,10 @@ { flush_output_to_pager (); + int to_beep_or_not_to_beep = user_pref.beep_on_error && ! error_state; + + if (to_beep_or_not_to_beep) + cerr << "\a"; if (name) cerr << name << ": "; cerr.vform (fmt, args); @@ -54,6 +59,8 @@ ostrstream output_buf; + if (to_beep_or_not_to_beep) + output_buf << "\a"; if (name) output_buf << name << ": "; output_buf.vform (fmt, args); @@ -75,9 +82,6 @@ { if (error_state != -2) { - if (! error_state) - error_state = 1; - if (! suppress_octave_error_messages) { if (fmt) @@ -87,8 +91,6 @@ int len = strlen (fmt); if (fmt[len - 1] == '\n') { - error_state = -2; - if (len > 1) { char *tmp_fmt = strsave (fmt); @@ -96,6 +98,8 @@ verror (name, tmp_fmt, args); delete [] tmp_fmt; } + + error_state = -2; } else verror (name, fmt, args); @@ -104,6 +108,9 @@ else panic ("error_1: invalid format"); } + + if (! error_state) + error_state = 1; } } diff -r afde7233c4dc -r 2d88758ed94b src/octave.cc --- a/src/octave.cc Sat Sep 16 02:51:08 1995 +0000 +++ b/src/octave.cc Mon Sep 18 16:04:37 1995 +0000 @@ -507,6 +507,7 @@ { bind_builtin_variable ("PS1", ">> "); bind_builtin_variable ("PS2", ""); + bind_builtin_variable ("beep_on_error", "true"); bind_builtin_variable ("default_save_format", "mat-binary"); bind_builtin_variable ("define_all_return_values", "true"); bind_builtin_variable ("do_fortran_indexing", "true"); diff -r afde7233c4dc -r 2d88758ed94b src/user-prefs.cc --- a/src/user-prefs.cc Sat Sep 16 02:51:08 1995 +0000 +++ b/src/user-prefs.cc Mon Sep 18 16:04:37 1995 +0000 @@ -45,6 +45,7 @@ init_user_prefs (void) { user_pref.automatic_replot = 0; + user_pref.beep_on_error = 0; user_pref.define_all_return_values = 0; user_pref.do_fortran_indexing = 0; user_pref.empty_list_elements_ok = 0; @@ -130,6 +131,17 @@ } +// Should we beep obnoxiously before printing error messages? + +int +beep_on_error (void) +{ + user_pref.beep_on_error = check_str_pref ("beep_on_error"); + + return 0; +} + + // Should variables returned from functions have default values if // they are otherwise uninitialized? diff -r afde7233c4dc -r 2d88758ed94b src/user-prefs.h --- a/src/user-prefs.h Sat Sep 16 02:51:08 1995 +0000 +++ b/src/user-prefs.h Mon Sep 18 16:04:37 1995 +0000 @@ -27,6 +27,7 @@ struct user_preferences { int automatic_replot; + int beep_on_error; int define_all_return_values; int do_fortran_indexing; int empty_list_elements_ok; @@ -74,6 +75,7 @@ extern void init_user_prefs (void); extern int automatic_replot (void); +extern int beep_on_error (void); extern int define_all_return_values (void); extern int do_fortran_indexing (void); extern int empty_list_elements_ok (void); diff -r afde7233c4dc -r 2d88758ed94b src/variables.cc --- a/src/variables.cc Sat Sep 16 02:51:08 1995 +0000 +++ b/src/variables.cc Mon Sep 18 16:04:37 1995 +0000 @@ -1609,6 +1609,10 @@ 0, automatic_replot, "if true, auto-insert a replot command when a plot changes"); + DEFVAR ("beep_on_error", SBV_beep_on_error, "false", 0, + beep_on_error, + "if true, beep before printing error messages"); + DEFVAR ("default_return_value", SBV_default_return_value, Matrix (), 0, 0, "the default for value for unitialized variables returned from\n\