# HG changeset patch # User jwe # Date 790312823 0 # Node ID d383ec996ee1fb3567cd8ca728e96702735f6d52 # Parent 4e4a92dcd94e4fbab17e168163964db75b905825 [project @ 1995-01-17 03:20:16 by jwe] diff -r 4e4a92dcd94e -r d383ec996ee1 src/tc-rep-ass.cc --- a/src/tc-rep-ass.cc Mon Jan 16 19:17:57 1995 +0000 +++ b/src/tc-rep-ass.cc Tue Jan 17 03:20:23 1995 +0000 @@ -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); diff -r 4e4a92dcd94e -r d383ec996ee1 src/user-prefs.cc --- a/src/user-prefs.cc Mon Jan 16 19:17:57 1995 +0000 +++ b/src/user-prefs.cc Tue Jan 17 03:20:23 1995 +0000 @@ -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) { diff -r 4e4a92dcd94e -r d383ec996ee1 src/user-prefs.h --- a/src/user-prefs.h Mon Jan 16 19:17:57 1995 +0000 +++ b/src/user-prefs.h Tue Jan 17 03:20:23 1995 +0000 @@ -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); diff -r 4e4a92dcd94e -r d383ec996ee1 src/variables.cc --- a/src/variables.cc Mon Jan 16 19:17:57 1995 +0000 +++ b/src/variables.cc Tue Jan 17 03:20:23 1995 +0000 @@ -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.