From 9636d6739ebf330ef3fcc41ae838068e600c140b Mon Sep 17 00:00:00 2001 From: biouman Date: Mon, 30 Apr 2001 01:39:32 +0000 Subject: *** empty log message *** --- lib/pile.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'lib/pile.c') diff --git a/lib/pile.c b/lib/pile.c index 40ecf76..702f22d 100644 --- a/lib/pile.c +++ b/lib/pile.c @@ -23,13 +23,13 @@ unsigned int pile_ptr = 0; void push_pile(char *st) { int valid1, valid2, valid3; - char valid4=0; + char valid4 = 0; int i_number; rationnel r_number; polynome poly; char buf[128]; - - sprintf(buf,_("Calling push_pile(%s)"),st); + + sprintf(buf, _("Calling push_pile(%s)"), st); pushcontext(buf); i_number = char_to_number(st, &valid1); r_number = char_to_rat(st, &valid2); @@ -108,7 +108,7 @@ pile_elem pop_pile(unsigned int count) { char buf[50]; - if (((int)(pile_ptr) - (int)count) >= 0) { + if (((int) (pile_ptr) - (int) count) >= 0) { pile_ptr -= count; } else { sprintf(buf, _("pop_pile: Can't pop %u elements"), count); @@ -119,7 +119,8 @@ pile_elem pop_pile(unsigned int count) char *affichage_level_1(void) { - char *result=NULL; + char *result = NULL; + if (pile_ptr) { switch (pile[pile_ptr - 1].type) { case T_POLY: @@ -130,6 +131,7 @@ char *affichage_level_1(void) break; case T_INT: result = (char *) Emalloc(11 * sizeof(char)); + sprintf(result, "%10d", pile[pile_ptr - 1].val); break; } @@ -245,8 +247,7 @@ void act_pile(int func) if (operande1.poly) { if ((operande1.poly->coef.denom == 1) && (operande1.poly->coef.num >= 0)) { - push_pile_poly(ply_exposant - (operande2.poly, operande1.poly->coef.num)); + push_pile_poly(ply_exposant(operande2.poly, operande1.poly->coef.num)); if (operande2.poly) ply_destruct(operande2.poly); ply_destruct(operande1.poly); @@ -268,10 +269,8 @@ void act_pile(int func) operande2 = pop_pile(1); if ((operande1.type == T_POLY) && (operande2.type == T_STRING)) { if (operande2.label) { - InsererVarDansTab(&variables, - CreerElement(operande2.label, - (void *) operande1.poly)); - free(operande2.label); + InsererVarDansTab(&variables, CreerElement(operande2.label, (void *) operande1.poly)); + free(operande2.label); } else { exception(1, _("act_pile: OP_ASSIGN empty string")); } @@ -290,8 +289,7 @@ void act_pile(int func) #endif operande1 = pop_pile(1); if (operande1.type == T_POLY) { - push_pile_poly(ply_soustraction - (ply_constr(rat_constr_zero(), 0), operande1.poly)); + push_pile_poly(ply_soustraction(ply_constr(rat_constr_zero(), 0), operande1.poly)); if (operande1.poly) ply_destruct(operande1.poly); } else { @@ -309,17 +307,19 @@ void act_pile(int func) if ((operande1.type == T_POLY) && (operande2.type == T_POLY)) { if (operande2.poly) { if (operande1.poly->degre == 0) { - - push_pile_poly(ply_constr(rat_constr_from_double(ply_valuation(operande2.poly,rat_to_double(operande1.poly->coef))), 0)); + + push_pile_poly(ply_constr + (rat_constr_from_double + (ply_valuation + (operande2.poly, rat_to_double(operande1.poly->coef))), + 0)); if (operande1.poly) ply_destruct(operande1.poly); ply_destruct(operande2.poly); } else { - exception(1, - _ - ("act_pile: OP_FUNC_CALL invalid arguments")); + exception(1, _("act_pile: OP_FUNC_CALL invalid arguments")); } } else { exception(1, _("act_pile: OP_FUNC_CALL invalid arguments")); @@ -338,11 +338,13 @@ void act_pile(int func) } -void affichage_pile(void) { +void affichage_pile(void) +{ int i; + printf(_("\t-- Printing Stack\n")); if (pile_ptr) { - for (i=0;i<=pile_ptr-1;i++) { + for (i = 0; i <= pile_ptr - 1; i++) { switch (pile[i].type) { case T_INT: printf("\t\t%d:I: %d\n", i, pile[i].val); @@ -357,4 +359,4 @@ void affichage_pile(void) { } } printf(_("\t-- End Printing Stack\n")); -} +} -- cgit v1.2.3