summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiouman <biouman>2001-05-01 09:48:02 +0000
committerbiouman <biouman>2001-05-01 09:48:02 +0000
commit6b8f02426a4dd9358c7b35d34268db358fd113c3 (patch)
treeb1f2af48fa2c6563ee7f3beef4163a0ff56232ef
parent9636d6739ebf330ef3fcc41ae838068e600c140b (diff)
*** empty log message ***
-rw-r--r--lib/hash.c3
-rw-r--r--lib/pile.c4
-rw-r--r--lib/polynom.c9
-rw-r--r--lib/scalaires.c7
-rw-r--r--po/cat-id-tbl.c3
-rw-r--r--src/Polynom.c1
6 files changed, 17 insertions, 10 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 9ac65bb..4658aed 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -9,6 +9,7 @@
#include <string.h>
#include "hash.h"
#include "exceptions.h"
+#include "polynom.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
@@ -149,7 +150,7 @@ _TypeVariable NomVarToVar(char *Nom, _TableauVariable t, char *trouve)
void AfficheListe(_ListeChaine l)
{
while (l != NULL) {
- fprintf(stderr, "%s\n", l->Elem.NomVar);
+ fprintf(stderr, "%s: %s\n", l->Elem.NomVar, ply_affichage(l->Elem.Variable));
l = l->Suivant;
}
}
diff --git a/lib/pile.c b/lib/pile.c
index 702f22d..5b98ef4 100644
--- a/lib/pile.c
+++ b/lib/pile.c
@@ -150,6 +150,7 @@ void act_pile(int func)
{
pile_elem operande1, operande2;
char buf[50];
+ char valid;
sprintf(buf, _("Calling act_pile(%i)"), func);
pushcontext(buf);
@@ -269,6 +270,9 @@ void act_pile(int func)
operande2 = pop_pile(1);
if ((operande1.type == T_POLY) && (operande2.type == T_STRING)) {
if (operande2.label) {
+ NomVarToVar(operande2.label, variables, &valid);
+ if (valid)
+ SupprimerDansTab(&variables,operande2.label);
InsererVarDansTab(&variables, CreerElement(operande2.label, (void *) operande1.poly));
free(operande2.label);
} else {
diff --git a/lib/polynom.c b/lib/polynom.c
index 9dc2517..a50d0cb 100644
--- a/lib/polynom.c
+++ b/lib/polynom.c
@@ -3,15 +3,14 @@
* Operations sur les polynomes
*
*/
-
-#include "polynom.h"
-#include "scalaires.h"
-#include "exceptions.h"
-#include "main.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include "polynom.h"
+#include "scalaires.h"
+#include "exceptions.h"
+#include "main.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
diff --git a/lib/scalaires.c b/lib/scalaires.c
index 7a97866..a58b627 100644
--- a/lib/scalaires.c
+++ b/lib/scalaires.c
@@ -3,10 +3,9 @@
* Operations sur les scalaires ( rationnels )
*
*/
-
+#include <math.h>
#include "scalaires.h"
#include "exceptions.h"
-#include <math.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
@@ -109,6 +108,8 @@ rationnel rat_multiplication(rationnel rat1, rationnel rat2)
rationnel rat_division(rationnel rat1, rationnel rat2)
{ /* division */
-
+ if (!rat2.num)
+ exception(1,_("division by zero"));
return rat_constr(rat1.num * rat2.denom, rat1.denom * rat2.num);
+
}
diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c
index 705b1ba..3c0c2fd 100644
--- a/po/cat-id-tbl.c
+++ b/po/cat-id-tbl.c
@@ -47,6 +47,7 @@ const struct _msg_ent _msg_tbl[] = {
{"\t-- End Printing Stack\n", 38},
{"ply_affichage: strcat error, not enoug space in buffer", 39},
{"rat_constr: division by zero", 40},
+ {"division by zero", 41},
};
-int _msg_tbl_length = 40;
+int _msg_tbl_length = 41;
diff --git a/src/Polynom.c b/src/Polynom.c
index e6dbfb6..2db428f 100644
--- a/src/Polynom.c
+++ b/src/Polynom.c
@@ -45,6 +45,7 @@ int main(void)
parse_line("soja^3;");
//parse_line("quake4@%*)+vo;i");
//fprintf(stderr, "soja");
+ AfficheTableau(variables);
printf("Resultat: %s\n", affichage_level_1());
return 0;