# HG changeset patch # User jwe # Date 858056134 0 # Node ID 68e6d0c93fc8de97cf188a2fa13223929ee96fa5 # Parent eedc2f3f61f79961185372dc9dd1f637b6eb02b7 [project @ 1997-03-11 04:52:44 by jwe] diff -r eedc2f3f61f7 -r 68e6d0c93fc8 src/parse.y --- a/src/parse.y Tue Mar 11 04:48:53 1997 +0000 +++ b/src/parse.y Tue Mar 11 04:55:34 1997 +0000 @@ -106,10 +106,11 @@ // the file. // Generic error messages. -static void yyerror (char *s); +static void yyerror (const char *s); // Error mesages for mismatched end tokens. -static void end_error (char *type, token::end_tok_type ettype, int l, int c); +static void end_error + (const char *type, token::end_tok_type ettype, int l, int c); // Check to see that end tokens are properly matched. static int check_end (token *tok, token::end_tok_type expected); @@ -1218,7 +1219,7 @@ // Generic error messages. static void -yyerror (char *s) +yyerror (const char *s) { int err_col = current_input_column - 1; @@ -1267,9 +1268,10 @@ // Error mesages for mismatched end tokens. static void -end_error (char *type, token::end_tok_type ettype, int l, int c) +end_error (const char *type, token::end_tok_type ettype, int l, int c) { - static char *fmt = "`%s' command matched by `%s' near line %d column %d"; + static const char *fmt + = "`%s' command matched by `%s' near line %d column %d"; switch (ettype) { @@ -1694,11 +1696,11 @@ break; case EXPR_AND: - t = tree_binary_expression::and; + t = tree_binary_expression::el_and; break; case EXPR_OR: - t = tree_binary_expression::or; + t = tree_binary_expression::el_or; break; default: @@ -1726,11 +1728,11 @@ switch (op) { case EXPR_AND_AND: - t = tree_boolean_expression::and; + t = tree_boolean_expression::bool_and; break; case EXPR_OR_OR: - t = tree_boolean_expression::or; + t = tree_boolean_expression::bool_or; break; default: @@ -1821,7 +1823,7 @@ break; case EXPR_NOT: - t = tree_unary_expression::not; + t = tree_unary_expression::unot; break; case '-': diff -r eedc2f3f61f7 -r 68e6d0c93fc8 src/pt-exp-base.h --- a/src/pt-exp-base.h Tue Mar 11 04:48:53 1997 +0000 +++ b/src/pt-exp-base.h Tue Mar 11 04:55:34 1997 +0000 @@ -47,7 +47,7 @@ simple_assignment, multi_assignment, colon, - index, + index }; tree_expression (int l = -1, int c = -1, type et = unknown) @@ -89,7 +89,7 @@ virtual octave_value eval (bool print) = 0; - virtual char *oper (void) const { return ""; } + virtual const char *oper (void) const { return ""; } virtual string original_text (void) const; diff -r eedc2f3f61f7 -r 68e6d0c93fc8 src/pt-exp.cc --- a/src/pt-exp.cc Tue Mar 11 04:48:53 1997 +0000 +++ b/src/pt-exp.cc Tue Mar 11 04:55:34 1997 +0000 @@ -102,10 +102,10 @@ return retval; } -char * +const char * tree_prefix_expression::oper (void) const { - static char *op; + static const char *op; switch (etype) { case increment: @@ -127,12 +127,8 @@ tree_prefix_expression::eval_error (void) { if (error_state > 0) - { - char *op = oper (); - - ::error ("evaluating prefix operator `%s' near line %d, column %d", - op, line (), column ()); - } + ::error ("evaluating prefix operator `%s' near line %d, column %d", + oper (), line (), column ()); } void @@ -185,10 +181,10 @@ return retval; } -char * +const char * tree_postfix_expression::oper (void) const { - static char *op; + static const char *op; switch (etype) { case increment: @@ -210,12 +206,8 @@ tree_postfix_expression::eval_error (void) { if (error_state > 0) - { - char *op = oper (); - - ::error ("evaluating postfix operator `%s' near line %d, column %d", - op, line (), column ()); - } + ::error ("evaluating postfix operator `%s' near line %d, column %d", + oper (), line (), column ()); } void @@ -244,7 +236,7 @@ { switch (etype) { - case not: + case unot: retval = u.not (); break; @@ -276,13 +268,13 @@ return retval; } -char * +const char * tree_unary_expression::oper (void) const { - static char *op; + static const char *op; switch (etype) { - case not: + case unot: op = "!"; break; @@ -309,12 +301,8 @@ tree_unary_expression::eval_error (void) { if (error_state > 0) - { - char *op = oper (); - - ::error ("evaluating unary operator `%s' near line %d, column %d", - op, line (), column ()); - } + ::error ("evaluating unary operator `%s' near line %d, column %d", + oper (), line (), column ()); } void @@ -415,11 +403,11 @@ op = octave_value::ne; break; - case and: + case el_and: op = octave_value::el_and; break; - case or: + case el_or: op = octave_value::el_or; break; @@ -448,10 +436,10 @@ return retval; } -char * +const char * tree_binary_expression::oper (void) const { - static char *op; + static const char *op; switch (etype) { case add: @@ -518,11 +506,11 @@ op = "!="; break; - case and: + case el_and: op = "&"; break; - case or: + case el_or: op = "|"; break; @@ -537,12 +525,8 @@ tree_binary_expression::eval_error (void) { if (error_state > 0) - { - char *op = oper (); - - ::error ("evaluating binary operator `%s' near line %d, column %d", - op, line (), column ()); - } + ::error ("evaluating binary operator `%s' near line %d, column %d", + oper (), line (), column ()); } void @@ -579,7 +563,7 @@ { if (a_true) { - if (etype == or) + if (etype == bool_or) { result = true; goto done; @@ -587,7 +571,7 @@ } else { - if (etype == and) + if (etype == bool_and) goto done; } @@ -621,17 +605,17 @@ return retval; } -char * +const char * tree_boolean_expression::oper (void) const { - static char *op; + static const char *op; switch (etype) { - case and: + case bool_and: op = "&&"; break; - case or: + case bool_or: op = "||"; break; diff -r eedc2f3f61f7 -r 68e6d0c93fc8 src/pt-exp.h --- a/src/pt-exp.h Tue Mar 11 04:48:53 1997 +0000 +++ b/src/pt-exp.h Tue Mar 11 04:55:34 1997 +0000 @@ -68,7 +68,7 @@ bool is_prefix_expression (void) const { return true; } - char *oper (void) const; + const char *oper (void) const; tree_identifier *ident (void) { return id; } @@ -110,7 +110,7 @@ void eval_error (void); - char *oper (void) const; + const char *oper (void) const; tree_identifier *ident (void) { return id; } @@ -135,7 +135,6 @@ enum type { unknown, - not, unot, uminus, hermitian, @@ -156,9 +155,9 @@ void eval_error (void); - char *oper (void) const; + const char *oper (void) const; - bool is_prefix_op (void) { return (etype == not || etype == uminus); } + bool is_prefix_op (void) { return (etype == unot || etype == uminus); } tree_expression *operand (void) { return op; } @@ -199,8 +198,8 @@ cmp_ge, cmp_gt, cmp_ne, - and, - or + el_and, + el_or }; tree_binary_expression (int l = -1, int c = -1, type t = unknown) @@ -220,7 +219,7 @@ void eval_error (void); - char *oper (void) const; + const char *oper (void) const; tree_expression *lhs (void) { return op_lhs; } tree_expression *rhs (void) { return op_rhs; } @@ -249,8 +248,8 @@ enum type { unknown, - and, - or + bool_and, + bool_or }; tree_boolean_expression (int l = -1, int c = -1, type t) @@ -264,7 +263,7 @@ octave_value eval (bool print); - char *oper (void) const; + const char *oper (void) const; private: diff -r eedc2f3f61f7 -r 68e6d0c93fc8 src/pt-mvr.cc --- a/src/pt-mvr.cc Tue Mar 11 04:48:53 1997 +0000 +++ b/src/pt-mvr.cc Tue Mar 11 04:55:34 1997 +0000 @@ -224,7 +224,7 @@ { int l = line (); int c = column (); - char *fmt; + const char *fmt; if (l != -1 && c != -1) { if (list)