diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/interface.c | 2 | ||||
-rw-r--r-- | lib/parser.c | 3 | ||||
-rw-r--r-- | lib/pile.c | 13 |
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/interface.c b/lib/interface.c index e3fbe7a..f459215 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -94,7 +94,9 @@ void ifloop(void) { break; case 10: /* Entrée */ printf("\n"); + clearterm(); parse_line(buffer); + initterm(); position = 0; buffer[0] = 0; printf("\n"); diff --git a/lib/parser.c b/lib/parser.c index 6a2ab34..529516b 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -232,6 +232,7 @@ void parse_line(char *line) exception(1, _("Parse error: too much left parenthesis")); act_pile(get_func(op)); } + got_unary = 128; move_to_resultat_pile(); break; case ')': @@ -273,7 +274,7 @@ void parse_line(char *line) } popcontext(); if (global_error) { - got_unary = 0; + got_unary = 128; while (pileop_pos) { pop_op(); } @@ -411,17 +411,18 @@ void act_pile(int func) break; case T_POLY: if (operande2.poly) { - if (operande1.poly->degre == 0) { - - + if (operande1.val != 1) { + exception(1, _("act_pile: OP_FUNC_CALL need only one argument for a polynom evaluation")); + } + if (operande[0].poly->degre == 0) { push_pile_poly(ply_constr (rat_constr_from_double (ply_valuation - (operande2.poly, rat_to_double(operande1.poly->coef))), + (operande2.poly, rat_to_double(operande[0].poly->coef))), 0)); - if (operande1.poly) - ply_destruct(operande1.poly); + if (operande[0].poly) + ply_destruct(operande[0].poly); ply_destruct(operande2.poly); } else { exception(1, _("act_pile: OP_FUNC_CALL incorrect value for 2nd arg")); |