summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiouman <biouman>2001-05-01 22:50:42 +0000
committerbiouman <biouman>2001-05-01 22:50:42 +0000
commitec32dd3c2506d341fe7106418f0e538f9407fbce (patch)
tree272285e6e0f713bd1c1f7e8c4a2dad4eb93eb26a
parent077892e9b4355a2e34b36bafb4fd701993c3aeaf (diff)
*** empty log message ***
-rw-r--r--include/pile.h7
-rw-r--r--lib/pile.c29
2 files changed, 35 insertions, 1 deletions
diff --git a/include/pile.h b/include/pile.h
index d2e3176..031424f 100644
--- a/include/pile.h
+++ b/include/pile.h
@@ -36,4 +36,11 @@ int is_mute(char *st);
void act_pile(int func);
void affichage_pile(void);
+
+void move_to_resultat_pile(void);
+
+char * pop_resultat(void);
+
+
+
#endif
diff --git a/lib/pile.c b/lib/pile.c
index 10991fc..48bce46 100644
--- a/lib/pile.c
+++ b/lib/pile.c
@@ -18,8 +18,9 @@
pile_elem pile[PILE_MAX];
+pile_elem result_pile[PILE_MAX];
unsigned int pile_ptr = 0;
-
+unsigned int result_pile_ptr = 0;
void push_pile(char *st)
{
int valid1, valid2, valid3;
@@ -138,7 +139,33 @@ void flush_pile(void)
pile_ptr=0;
}
+void move_to_resultat_pile(void)
+{ pile_elem temp;
+
+ temp=pop_pile(1);
+ if (result_pile_ptr!=PILE_MAX) {
+ if (temp.type==T_POLY) {
+ result_pile[result_pile_ptr]=temp;
+ result_pile_ptr++;
+ } else {
+ exception(2, _("move_to_resultat_pile: invalid argument type"));
+ }
+ } else {
+ exception(2, _("move_to_resultat_pile: Stack Overflow"));
+ }
+}
+
+char * pop_resultat(void)
+{ static char result[BUFSIZ];
+ if (result_pile_ptr) {
+ result_pile_ptr--;
+ sprintf(result,"%s",ply_affichage(result_pile[result_pile_ptr].poly));
+ } else {
+ exception(2, _("move_to_resultat_pile: empty stack"));
+ }
+ return result;
+}