From 8d8f43d2a79554917f2145743db590b5ab75d80b Mon Sep 17 00:00:00 2001 From: biouman Date: Sun, 29 Apr 2001 01:41:55 +0000 Subject: *** empty log message *** --- lib/pile.c | 7 ++++--- lib/polynom.c | 2 +- src/Polynom.c | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/pile.c b/lib/pile.c index 3d4bb93..489ba9f 100644 --- a/lib/pile.c +++ b/lib/pile.c @@ -36,6 +36,7 @@ void push_pile(char *st) d_number = char_to_double(st, &valid2); valid3 = is_mute(st); poly = (polynome) NomVarToVar(st, variables, &valid4); + printf("%p\n", poly); if (valid1) { /* il s agit d un entier */ pushcontext("c est un entier"); push_pile_poly(ply_constr(rat_constr(i_number, 1), 0)); @@ -123,14 +124,14 @@ pile_elem pop_pile(unsigned int count) sprintf(buf, _("pop_pile: Can't pop %u elements"), count); exception(1, buf); } + fprintf(stderr,"pile_ptr = %d\n", pile_ptr); return pile[pile_ptr]; } char *affichage_level_1(void) { char *result=NULL; - - if (!pile_ptr) { + if (pile_ptr) { switch (pile[pile_ptr - 1].type) { case T_POLY: result = ply_affichage(pile[pile_ptr - 1].poly); @@ -257,7 +258,7 @@ void act_pile(int func) InsererVarDansTab(&variables, CreerElement(operande2.label, (void *) operande1.poly)); - free(operande2.label); + /* free(operande2.label); */ } else { exception(1, _("act_pile: OP_ASSIGN empty string")); } diff --git a/lib/polynom.c b/lib/polynom.c index 72f02bf..7747ec6 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -257,7 +257,7 @@ double ply_valuation(polynome poly, double point) while (poly) { result += rat_to_double(poly->coef) * pow(point, (double) (poly->degre)); - poly++; + poly=poly->suiv; } return result; } diff --git a/src/Polynom.c b/src/Polynom.c index dd2fc8c..6a46d4a 100644 --- a/src/Polynom.c +++ b/src/Polynom.c @@ -19,6 +19,7 @@ _TableauVariable variables; char *mute; +char valid; int main(void) { @@ -30,7 +31,13 @@ int main(void) mute = Estrdup("x"); /* nom de la variable utilisee pour la saisie des polynomes, a recuperer en argv eventuellt */ parse_line("P=(x^2) + x + 1;"); + //parse_line("P(2);"); + AfficheTableau(variables); + printf("%p\n",(polynome)NomVarToVar("P",variables,&valid)); + printf("-- affichage:%s\n",ply_affichage((polynome)NomVarToVar("P",variables,&valid))); + parse_line("P(2);"); + //fprintf(stderr, "soja"); //printf("%s\n", affichage_level_1()); return 0; -- cgit v1.2.3