summaryrefslogtreecommitdiff
path: root/lib/pile.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pile.c')
-rw-r--r--lib/pile.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/lib/pile.c b/lib/pile.c
index 5b98ef4..a7d8d47 100644
--- a/lib/pile.c
+++ b/lib/pile.c
@@ -73,7 +73,7 @@ void push_pile_poly(polynome poly)
pile[pile_ptr].poly = poly;
pile_ptr++;
} else {
- exception(1, _("push_pile_poly: Stack Overflow"));
+ exception(2, _("push_pile_poly: Stack Overflow"));
}
}
@@ -85,7 +85,7 @@ void push_pile_int(int val)
pile[pile_ptr].val = val;
pile_ptr++;
} else {
- exception(1, _("push_pile_int: Stack Overflow"));
+ exception(2, _("push_pile_int: Stack Overflow"));
}
@@ -98,7 +98,7 @@ void push_pile_string(char *st)
pile[pile_ptr].label = Estrdup(st);
pile_ptr++;
} else {
- exception(1, _("push_pile_string: Stack Overflow"));
+ exception(2, _("push_pile_string: Stack Overflow"));
}
@@ -112,11 +112,38 @@ pile_elem pop_pile(unsigned int count)
pile_ptr -= count;
} else {
sprintf(buf, _("pop_pile: Can't pop %u elements"), count);
- exception(1, buf);
+ exception(2, buf);
}
return pile[pile_ptr];
}
+void flush_pile(void)
+{
+ int i;
+
+ if (pile_ptr) {
+ for (i = 0; i <= pile_ptr - 1; i++) {
+ switch (pile[i].type) {
+ case T_INT:
+ break;
+ case T_STRING:
+ free(pile[i].label);
+ break;
+ case T_POLY:
+ ply_destruct(pile[i].poly);
+ break;
+ }
+ }
+ }
+ pile_ptr=0;
+}
+
+
+
+
+
+
+
char *affichage_level_1(void)
{
char *result = NULL;