diff options
Diffstat (limited to 'lib/pile.c')
-rw-r--r-- | lib/pile.c | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -9,6 +9,7 @@ #include "numbers.h" #include "main.h" #include "parser.h" +#include "scalaires.h" #ifdef HAVE_CONFIG_H #include "config.h" #else @@ -27,24 +28,44 @@ void push_pile(char *st) int i_number; double d_number; polynome poly; + char buf[128]; + rationnel rat; - + sprintf(buf,"appel à push_pile(%s)",st); + pushcontext(buf); i_number = char_to_number(st, &valid1); d_number = char_to_double(st, &valid2); valid3 = is_mute(st); poly = (polynome) NomVarToVar(st, variables, &valid4); if (valid1) { /* il s agit d un entier */ + pushcontext("c est un entier"); push_pile_poly(ply_constr(rat_constr(i_number, 1), 0)); + popcontext(); } else if (valid2) { /* il s agit d un flottant */ + pushcontext("c est un flottant"); push_pile_poly(ply_constr(rat_constr_from_double(d_number), 0)); + popcontext(); } else if (valid3) { /* il s agit de x */ - push_pile_poly(ply_constr(rat_constr(1, 1), 0)); + pushcontext("c est X"); + rat=rat_constr(1, 1); + /*pushcontext("rat construit"); + poly=ply_constr(rat, 0); + pushcontext("poly cstr"); + push_pile_poly(poly); + pushcontext("poly push"); + popcontext();*/ } else if (valid4) { /* il s agit d une variable */ + pushcontext("c est une variable"); push_pile_poly(ply_copy(poly)); + popcontext(); } else { /* il s agit d un nom */ + pushcontext("c est un nom"); push_pile_string(Estrdup(st)); + popcontext(); } + popcontext(); + fprintf(stderr, "sortie de push_pile\n"); } @@ -120,10 +141,8 @@ char *affichage_level_1(void) int is_mute(char *st) { /* FIXME: test lowercase / uppercase */ - char buf[2]; - sprintf(buf, "%c", mute); - return strcmp(st, buf); + return !(strcmp(st, mute)); } |