summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiouman <biouman>2001-05-02 01:47:56 +0000
committerbiouman <biouman>2001-05-02 01:47:56 +0000
commit3bc7ebe940f0b3affb3e8160ba60a18f27707e90 (patch)
tree81b7e47620205965d28bdce269c6543e0aa5fe55
parentfba43d28682567fc21512b1a87ad045723cf06e9 (diff)
*** empty log message ***
-rw-r--r--lib/pile.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/lib/pile.c b/lib/pile.c
index 8242b71..e5abca9 100644
--- a/lib/pile.c
+++ b/lib/pile.c
@@ -233,8 +233,10 @@ int is_mute(char *st)
void act_pile(int func)
{
pile_elem operande1, operande2;
+ pile_elem operande[3];
char buf[50];
char valid;
+ int i, err=0;
sprintf(buf, _("Calling act_pile(%i)"), func);
pushcontext(buf);
@@ -389,11 +391,25 @@ void act_pile(int func)
#ifdef DEBUG
printf("----- OP_FUNC_CALL\n");
#endif
+ for (i=0;i<3;i++)
+ operande[i].polyn=NULL;
operande1 = pop_pile(1);
- if ((operande1.type == T_INT) && (operande1.val == 1)) {
- operande1 = pop_pile(1);
- operande2 = pop_pile(1);
- if ((operande1.type == T_POLY) && (operande2.type == T_POLY)) {
+ if (operande1.type == T_INT) {
+ for(i=0;i<operande1.val;i++) {
+ operande[i] = pop_pile(1);
+ if (operande[i].type != T_POLY)
+ err=1;
+ }
+ if (err==1) {
+ exception(1,_("act_pile: OP_FUNC_CALL incorrect argument type"));
+ return;
+ }
+ operande2=pop_pile(1); /* on recupere le polynome a evaluer ou le nom de la fonction a executer */
+ switch (operande2.type) {
+ case T_INT:
+ exception(2,_("act_pile: OP_FUNC_CALL invalid operand type"));
+ break;
+ case T_POLY:
if (operande2.poly) {
if (operande1.poly->degre == 0) {
@@ -413,9 +429,12 @@ void act_pile(int func)
} else {
exception(1, _("act_pile: OP_FUNC_CALL arg2 is an empty polynom"));
}
- } else {
- exception(1, _("act_pile: OP_FUNC_CALL invalid arguments"));
- }
+ break;
+ case T_STRING:
+ appel_fonction(operande2.label,operande1.val,operande[0].polyn, operande[1].polyn, operande[2].polyn);
+ break;
+ }
+
} else {
exception(1, _("act_pile: OP_FUNC_CALL incorrect argument number"));
}