summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pile.c7
-rw-r--r--lib/polynom.c2
-rw-r--r--src/Polynom.c7
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;