Mercurial > hg > octave-avbm
changeset 1037:d383ec996ee1
[project @ 1995-01-17 03:20:16 by jwe]
author | jwe |
---|---|
date | Tue, 17 Jan 1995 03:20:23 +0000 |
parents | 4e4a92dcd94e |
children | 11b23f645060 |
files | src/tc-rep-ass.cc src/user-prefs.cc src/user-prefs.h src/variables.cc |
diffstat | 4 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tc-rep-ass.cc +++ b/src/tc-rep-ass.cc @@ -353,12 +353,11 @@ int i = NINT (tmp_i.double_value ()); int idx = i - 1; - if (index_check (idx, "") < 0) - return; - if (rhs_nr == 0 && rhs_nc == 0) { - if (idx < nr * nc) + int len = nr * nc; + + if (idx < len && len > 0) { convert_to_row_or_column_vector (); @@ -372,9 +371,17 @@ else panic_impossible (); } + else if (idx < 0) + { + error ("invalid index = %d", idx+1); + } + return; } + if (index_check (idx, "") < 0) + return; + if (nr <= 1 || nc <= 1) { maybe_resize (idx);
--- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -66,6 +66,7 @@ user_pref.warn_assign_as_truth_value = 0; user_pref.warn_comma_in_global_decl = 0; user_pref.warn_divide_by_zero = 0; + user_pref.warn_function_name_clash = 0; user_pref.default_save_format = 0; user_pref.editor = 0; @@ -451,6 +452,18 @@ return 0; } +// Generate warning if declared function name disagrees with the name +// of the file in which it is defined. + +int +warn_function_name_clash (void) +{ + user_pref.warn_function_name_clash = + check_str_pref ("warn_function_name_clash"); + + return 0; +} + int set_output_max_field_width (void) {
--- a/src/user-prefs.h +++ b/src/user-prefs.h @@ -50,6 +50,7 @@ int warn_assign_as_truth_value; int warn_comma_in_global_decl; int warn_divide_by_zero; + int warn_function_name_clash; char *default_save_format; char *editor; @@ -88,6 +89,7 @@ extern int warn_assign_as_truth_value (void); extern int warn_comma_in_global_decl (void); extern int warn_divide_by_zero (void); +extern int warn_function_name_clash (void); extern int set_output_max_field_width (void); extern int set_output_precision (void);
--- a/src/variables.cc +++ b/src/variables.cc @@ -1621,6 +1621,10 @@ DEFVAR ("warn_divide_by_zero", SBV_warn_divide_by_zero, "true", 0, 0, 1, warn_divide_by_zero, "on IEEE machines, allow divide by zero errors to be suppressed"); + + DEFVAR ("warn_function_name_clash", SBV_warn_function_name_clash, + "true", 0, 0, 1, warn_function_name_clash, + "produce warning if function name conflicts with file name"); } // Deleting names from the symbol tables.