Mercurial > octave
comparison src/symtab.cc @ 1045:cb4eaa324faf
[project @ 1995-01-18 19:48:19 by jwe]
author | jwe |
---|---|
date | Wed, 18 Jan 1995 19:48:19 +0000 |
parents | dfe01093f657 |
children | b6360f2d4fa6 |
comparison
equal
deleted
inserted
replaced
1044:1aa6f2edd975 | 1045:cb4eaa324faf |
---|---|
27 | 27 |
28 #include "symtab.h" | 28 #include "symtab.h" |
29 #include "error.h" | 29 #include "error.h" |
30 #include "variables.h" | 30 #include "variables.h" |
31 #include "utils.h" | 31 #include "utils.h" |
32 #include "user-prefs.h" | |
32 #include "tree-base.h" | 33 #include "tree-base.h" |
33 #include "tree-expr.h" | 34 #include "tree-expr.h" |
34 #include "tree-const.h" | 35 #include "tree-const.h" |
35 | 36 |
36 extern "C" | 37 extern "C" |
619 int | 620 int |
620 symbol_record::read_only_error (void) | 621 symbol_record::read_only_error (void) |
621 { | 622 { |
622 if (is_read_only ()) | 623 if (is_read_only ()) |
623 { | 624 { |
624 char *tag = "symbol"; | |
625 if (is_variable ()) | 625 if (is_variable ()) |
626 tag = "variable"; | 626 { |
627 if (user_pref.read_only_constants) | |
628 { | |
629 if (user_pref.read_only_constants < 0) | |
630 { | |
631 ::warning ("redefinition of constant `%s'", nm); | |
632 return 0; | |
633 } | |
634 else | |
635 ::error ("can't redefine read-only constant `%s'", nm); | |
636 } | |
637 } | |
627 else if (is_function ()) | 638 else if (is_function ()) |
628 tag = "function"; | 639 { |
629 | 640 ::error ("can't redefine read-only function `%s'", nm); |
630 ::error ("can't redefine read-only %s `%s'", tag, nm); | 641 } |
642 else | |
643 { | |
644 ::error ("can't redefine read-only symbol `%s'", nm); | |
645 } | |
631 | 646 |
632 return 1; | 647 return 1; |
633 } | 648 } |
634 else | 649 else |
635 return 0; | 650 return 0; |