From 447388dbac66c6518a0f4e4cc3e165b680f532e9 Mon Sep 17 00:00:00 2001 From: biouman Date: Sat, 28 Apr 2001 22:08:37 +0000 Subject: *** empty log message *** --- lib/pile.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'lib/pile.c') diff --git a/lib/pile.c b/lib/pile.c index a1cac21..1fb1aff 100644 --- a/lib/pile.c +++ b/lib/pile.c @@ -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)); } -- cgit v1.2.3