summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiouman <biouman>2001-04-30 01:39:32 +0000
committerbiouman <biouman>2001-04-30 01:39:32 +0000
commit9636d6739ebf330ef3fcc41ae838068e600c140b (patch)
treed7cc62a3ed7ffed7387e5f6485ab3b2a3f4b0e08
parent96ce5e4e35c13d86f0154b23eb256c2acbcbd705 (diff)
*** empty log message ***
-rw-r--r--include/pile.h2
-rw-r--r--lib/exceptions.c4
-rw-r--r--lib/numbers.c6
-rw-r--r--lib/parser.c387
-rw-r--r--lib/pile.c44
-rw-r--r--lib/polynom.c48
-rw-r--r--lib/scalaires.c8
-rw-r--r--src/Polynom.c3
8 files changed, 251 insertions, 251 deletions
diff --git a/include/pile.h b/include/pile.h
index bcb15b6..6130357 100644
--- a/include/pile.h
+++ b/include/pile.h
@@ -33,5 +33,5 @@ int is_mute(char *st);
void act_pile(int func);
-void affichage_pile(void);
+void affichage_pile(void);
#endif
diff --git a/lib/exceptions.c b/lib/exceptions.c
index cd8bf81..0fc363e 100644
--- a/lib/exceptions.c
+++ b/lib/exceptions.c
@@ -51,8 +51,8 @@ void pushcontext(char *c)
exception(1, _("Too much error contexts during pushcontext()."));
}
contexts[clevel++] = Estrdup(c);
-#ifdef DEBUG
- fprintf(stderr,"%s\n",c);
+#ifdef DEBUG
+ fprintf(stderr, "%s\n", c);
#endif
}
diff --git a/lib/numbers.c b/lib/numbers.c
index 52af66d..7d0c64a 100644
--- a/lib/numbers.c
+++ b/lib/numbers.c
@@ -72,10 +72,10 @@ int char_to_number(char *st, int *valid)
}
-rationnel char_to_rat(char *st, int *valid) /* cette fonction tente de traduire une chaine en flottant */
-{
+rationnel char_to_rat(char *st, int *valid)
+{ /* cette fonction tente de traduire une chaine en flottant */
int dotnum = 0, deci = 1, temp = 0;
-
+
while (*st) {
if (*st == '.') {
dotnum++;
diff --git a/lib/parser.c b/lib/parser.c
index ef1502e..60e3dca 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -18,8 +18,8 @@
typedef unsigned char op_t;
typedef struct operator_t {
- op_t op;
- int pri, func;
+ op_t op;
+ int pri, func;
} operator_t;
static op_t pile_operators[PILEOP_MAX];
@@ -30,19 +30,19 @@ static int pileop_pos = 0, pilecall_pos = 0;
/* La liste des opérateurs reconnus par le parser */
static operator_t operators[] = {
- {',', 0, OP_NEST},
- {'+', 2, OP_PLUS},
- {'-', 2, OP_MOINS},
- {'*', 3, OP_MUL},
- {'/', 3, OP_DIV},
- {'%', 3, OP_MOD},
- {'^', 4, OP_EXP},
- {'+' + 128, 5, OP_PLUS_UNARY},
- {'-' + 128, 5, OP_MOINS_UNARY},
- {'=', 1, OP_ASSIGN},
- {'(', 6, OP_FUNC_CALL},
- {'(' + 128, 6, OP_LPAREN},
- {255, -1, -1}
+ {',', 0, OP_NEST},
+ {'+', 2, OP_PLUS},
+ {'-', 2, OP_MOINS},
+ {'*', 3, OP_MUL},
+ {'/', 3, OP_DIV},
+ {'%', 3, OP_MOD},
+ {'^', 4, OP_EXP},
+ {'+' + 128, 5, OP_PLUS_UNARY},
+ {'-' + 128, 5, OP_MOINS_UNARY},
+ {'=', 1, OP_ASSIGN},
+ {'(', 6, OP_FUNC_CALL},
+ {'(' + 128, 6, OP_LPAREN},
+ {255, -1, -1}
};
@@ -52,244 +52,243 @@ static operator_t operators[] = {
static operator_t get_op(op_t op)
{
- int i;
+ int i;
- for (i = 0; operators[i].op != 255; i++) {
- if (operators[i].op == op)
- return operators[i];
- }
+ for (i = 0; operators[i].op != 255; i++) {
+ if (operators[i].op == op)
+ return operators[i];
+ }
- return operators[i];
+ return operators[i];
}
/* Fonctions internes de lectures sur la structure */
static int get_pri(op_t op)
{
- return get_op(op).pri;
+ return get_op(op).pri;
}
static int get_func(op_t op)
{
- return get_op(op).func;
+ return get_op(op).func;
}
/* Focntions internes d'empilement / dépilement */
static op_t get_last_op(void)
{
- if (pileop_pos)
- return pile_operators[pileop_pos - 1];
- else
- return -1;
+ if (pileop_pos)
+ return pile_operators[pileop_pos - 1];
+ else
+ return -1;
}
static op_t pop_op(void)
{
- if (pileop_pos)
- return pile_operators[--pileop_pos];
- return -1;
+ if (pileop_pos)
+ return pile_operators[--pileop_pos];
+ return -1;
}
static void push_op(op_t op)
{
- if (pileop_pos != PILEOP_MAX)
- pile_operators[pileop_pos++] = op;
- else
- exception(-1, _("Too many nested operators in expression.\n"));
+ if (pileop_pos != PILEOP_MAX)
+ pile_operators[pileop_pos++] = op;
+ else
+ exception(-1, _("Too many nested operators in expression.\n"));
}
static int pop_call(void)
{
- if (pilecall_pos)
- return pile_nestedcall[--pilecall_pos];
- return -1;
+ if (pilecall_pos)
+ return pile_nestedcall[--pilecall_pos];
+ return -1;
}
static void increment_call(void)
{
- if (pilecall_pos) {
- if (pile_nestedcall[pilecall_pos - 1] != -1)
- pile_nestedcall[pilecall_pos - 1]++;
- }
+ if (pilecall_pos) {
+ if (pile_nestedcall[pilecall_pos - 1] != -1)
+ pile_nestedcall[pilecall_pos - 1]++;
+ }
}
static int get_last_call(void)
{
- if (pilecall_pos)
- return pile_nestedcall[pilecall_pos - 1];
- return -1;
+ if (pilecall_pos)
+ return pile_nestedcall[pilecall_pos - 1];
+ return -1;
}
static void push_call(int call)
{
- if (pilecall_pos != PILECALL_MAX)
- pile_nestedcall[pilecall_pos++] = call;
- else
- exception(-1, _("Too many nested functions calls in expression.\n"));
+ if (pilecall_pos != PILECALL_MAX)
+ pile_nestedcall[pilecall_pos++] = call;
+ else
+ exception(-1, _("Too many nested functions calls in expression.\n"));
}
/* Cette fonction lit un "mot" sur la chaine line et renvoit le nouveau pointeur */
static char *getword(char *line, char *p)
{
- char o = 0, *d = line, instring = 0, gotbslash = 0;
-
- do {
- if (instring) {
- o = *(p++) = *line;
- if (!gotbslash) {
- switch (instring) {
- case 1:
- if (*line == '\'') {
- instring = 0;
- }
- break;
- case 2:
- if (*line == '"') {
- instring = 0;
- }
- break;
- }
- if (*line == '\\')
- gotbslash = 1;
- } else {
- gotbslash = 0;
- }
- } else {
- if (*(line) == '\'') {
- o = *(p++) = *line;
- instring = 1;
- } else if (*(line) == '"') {
- o = *(p++) = *line;
- instring = 2;
- } else {
- if (*(line) != ' ' && *(line) != '\t') {
- o = *(p++) = *line;
- } else if (d != line) {
- *p = '\0';
- return line;
+ char o = 0, *d = line, instring = 0, gotbslash = 0;
+
+ do {
+ if (instring) {
+ o = *(p++) = *line;
+ if (!gotbslash) {
+ switch (instring) {
+ case 1:
+ if (*line == '\'') {
+ instring = 0;
+ }
+ break;
+ case 2:
+ if (*line == '"') {
+ instring = 0;
+ }
+ break;
+ }
+ if (*line == '\\')
+ gotbslash = 1;
+ } else {
+ gotbslash = 0;
+ }
+ } else {
+ if (*(line) == '\'') {
+ o = *(p++) = *line;
+ instring = 1;
+ } else if (*(line) == '"') {
+ o = *(p++) = *line;
+ instring = 2;
+ } else {
+ if (*(line) != ' ' && *(line) != '\t') {
+ o = *(p++) = *line;
+ } else if (d != line) {
+ *p = '\0';
+ return line;
+ }
+ }
}
- }
+ line++;
}
- line++;
- }
- while (((*line) && (*line != ')') && (*line != ']')
- && (*line != ';') && (get_func(*line) == -1)
- && (get_func(o) == -1)) || (instring));
- *p = '\0';
- return line;
+ while (((*line) && (*line != ')') && (*line != ']')
+ && (*line != ';') && (get_func(*line) == -1)
+ && (get_func(o) == -1)) || (instring));
+ *p = '\0';
+ return line;
}
/* Cette fonction va parcourir une chaine afin d'appeler les fonction push_pile() et act_pile() */
void parse_line(char *line)
{
- char buffer[BUFSIZ], imm[BUFSIZ], *d = line;
- op_t op;
- static int got_unary = 128, nbrargs;
-
- sprintf(buffer, "Read line '%s'", line);
- pushcontext(buffer);
-
- while (*line) {
- line = getword(line, buffer);
- sprintf(imm, "Analysing word '%s' at position %i", buffer, line - d);
- pushcontext(imm);
- if (get_func(buffer[0]) != -1) {
- /* Le mot lu est un operateur, on agit sur la pile */
- buffer[0] += got_unary;
- if (got_unary) {
- }
- if (get_pri(buffer[0]) == -1) {
- if (got_unary) {
- exception(-1, _("Invalid unary operator"));
- } else {
- exception(-1, _("Invalid binary operator"));
+ char buffer[BUFSIZ], imm[BUFSIZ], *d = line;
+ op_t op;
+ static int got_unary = 128, nbrargs;
+
+ sprintf(buffer, "Read line '%s'", line);
+ pushcontext(buffer);
+
+ while (*line) {
+ line = getword(line, buffer);
+ sprintf(imm, "Analysing word '%s' at position %i", buffer, line - d);
+ pushcontext(imm);
+ if (get_func(buffer[0]) != -1) {
+ /* Le mot lu est un operateur, on agit sur la pile */
+ buffer[0] += got_unary;
+ if (got_unary) {
+ }
+ if (get_pri(buffer[0]) == -1) {
+ if (got_unary) {
+ exception(-1, _("Invalid unary operator"));
+ } else {
+ exception(-1, _("Invalid binary operator"));
+ }
+ }
+ while (get_pri(get_last_op()) >= get_pri(buffer[0])
+ && (((get_last_op() & 127) != '(')
+ && ((get_last_op() & 127) != '['))) {
+ act_pile(get_func(pop_op()));
+ got_unary = 0;
+ }
+ if (buffer[0] == '(') {
+ push_call(0);
+ }
+ if (buffer[0] == ',') {
+ increment_call();
+ } else
+ push_op(buffer[0]);
+ got_unary = 128;
+ } else if ((buffer[0] == ';') || (buffer[0] == ')')
+ || (buffer[0] == ']')) {
+ /* Le mot lut est un opérateur spécial, on vide la pile */
+ switch (buffer[0]) {
+ case ';':
+ /* Equivalent a fin de ligne */
+ while (pileop_pos) {
+ op = pop_op();
+ if (op == '(')
+ exception(-1, _("Parse error: too much left parenthesis"));
+ act_pile(get_func(op));
+ }
+ popcontext();
+ popcontext();
+ return;
+ case ')':
+ /* Fin de parenthese (Appel de fonction ou expression mathématique) */
+ while (1) {
+ if (!pileop_pos)
+ exception(-1, _("Parse error: too much right parenthesis"));
+ op = pop_op();
+ if (((op & 127) == '('))
+ break;
+ if (((op & 127) == '['))
+ exception(-1, _("Parse error: enclosure mismatch"));
+ act_pile(get_func(op));
+ }
+ if (op == '(') {
+ nbrargs = pop_call();
+ push_pile_int(nbrargs);
+ act_pile(get_func(op));
+ }
+ got_unary = 0;
+ break;
+ case ']':
+ /* Fin d'opérateur de décalage */
+ while (1) {
+ if (!pileop_pos)
+ exception(-1, _("Parse error: too much right parenthesis"));
+ op = pop_op();
+ if (((op & 127) == '['))
+ break;
+ if (((op & 127) == '('))
+ exception(-1, _("Parse error: enclosure mismatch"));
+ act_pile(get_func(op));
+ }
+ act_pile(get_func(op));
+ got_unary = 0;
+ break;
+ }
+ } else if (((buffer[0] >= 'A') && (buffer[0] <= 'Z'))
+ || ((buffer[0] >= 'a') && (buffer[0] <= 'z'))
+ || ((buffer[0] >= '0') && (buffer[0] <= '9'))
+ || (buffer[0] == '_') || (buffer[0] == '"')
+ || (buffer[0] == '\'') || (buffer[0] == '.')
+ || (buffer[0] == '#') || (buffer[0] == '?')) {
+ /* Dans tous les autres cas, on a reçu un symbole, on le pose sur la pile */
+ push_pile(buffer);
+ got_unary = 0;
+ if (!get_last_call())
+ increment_call();
+ } else if (buffer[0]) {
+ exception(-1, _("Invalid character"));
}
- }
- while (get_pri(get_last_op()) >= get_pri(buffer[0])
- && (((get_last_op() & 127) != '(')
- && ((get_last_op() & 127) != '['))) {
- act_pile(get_func(pop_op()));
- got_unary = 0;
- }
- if (buffer[0] == '(') {
- push_call(0);
- }
- if (buffer[0] == ',') {
- increment_call();
- } else
- push_op(buffer[0]);
- got_unary = 128;
- } else if ((buffer[0] == ';') || (buffer[0] == ')')
- || (buffer[0] == ']')) {
- /* Le mot lut est un opérateur spécial, on vide la pile */
- switch (buffer[0]) {
- case ';':
- /* Equivalent a fin de ligne */
- while (pileop_pos) {
- op = pop_op();
- if (op == '(')
- exception(-1, _("Parse error: too much left parenthesis"));
- act_pile(get_func(op));
- }
- popcontext();
popcontext();
- return;
- case ')':
- /* Fin de parenthese (Appel de fonction ou expression mathématique) */
- while (1) {
- if (!pileop_pos)
- exception(-1, _("Parse error: too much right parenthesis"));
- op = pop_op();
- if (((op & 127) == '('))
- break;
- if (((op & 127) == '['))
- exception(-1, _("Parse error: enclosure mismatch"));
- act_pile(get_func(op));
- }
- if (op == '(') {
- nbrargs = pop_call();
- push_pile_int(nbrargs);
- act_pile(get_func(op));
- }
- got_unary = 0;
- break;
- case ']':
- /* Fin d'opérateur de décalage */
- while (1) {
- if (!pileop_pos)
- exception(-1, _("Parse error: too much right parenthesis"));
- op = pop_op();
- if (((op & 127) == '['))
- break;
- if (((op & 127) == '('))
- exception(-1, _("Parse error: enclosure mismatch"));
- act_pile(get_func(op));
- }
- act_pile(get_func(op));
- got_unary = 0;
- break;
- }
- } else if (((buffer[0] >= 'A') && (buffer[0] <= 'Z'))
- || ((buffer[0] >= 'a') && (buffer[0] <= 'z'))
- || ((buffer[0] >= '0') && (buffer[0] <= '9'))
- || (buffer[0] == '_') || (buffer[0] == '"')
- || (buffer[0] == '\'') || (buffer[0] == '.')
- || (buffer[0] == '#') || (buffer[0] == '?')) {
- /* Dans tous les autres cas, on a reçu un symbole, on le pose sur la pile */
- push_pile(buffer);
- got_unary = 0;
- if (!get_last_call())
- increment_call();
- } else if (buffer[0]) {
- exception(-1, _("Invalid character"));
}
- popcontext();
- }
- popcontext();
+ popcontext();
}
-
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"));
-}
+}
diff --git a/lib/polynom.c b/lib/polynom.c
index eaa690d..9dc2517 100644
--- a/lib/polynom.c
+++ b/lib/polynom.c
@@ -194,13 +194,11 @@ polynome ply_multiplication(polynome poly1, polynome poly2)
{ /* multiplication de deux polynomes */
polynome temp = NULL, t, resultat = NULL, r, tempresult = NULL, poly2init;
- poly2init=poly2;
+ poly2init = poly2;
while (poly1) {
- poly2=poly2init;
+ poly2 = poly2init;
while (poly2) {
- t =
- ply_constr(rat_multiplication(poly1->coef, poly2->coef),
- poly1->degre + poly2->degre);
+ t = ply_constr(rat_multiplication(poly1->coef, poly2->coef), poly1->degre + poly2->degre);
if (t) {
if (tempresult) {
temp->suiv = t;
@@ -213,11 +211,11 @@ polynome ply_multiplication(polynome poly1, polynome poly2)
poly2 = poly2->suiv;
}
poly1 = poly1->suiv;
- r=ply_addition(tempresult,resultat);
+ r = ply_addition(tempresult, resultat);
ply_destruct(resultat);
- resultat=r;
+ resultat = r;
ply_destruct(tempresult);
- tempresult=NULL;
+ tempresult = NULL;
}
return resultat;
@@ -225,8 +223,8 @@ polynome ply_multiplication(polynome poly1, polynome poly2)
polynome ply_division(polynome poly1, polynome poly2)
{ /* division de deux polynomes */
- polynome result=NULL;
-
+ polynome result = NULL;
+
return result;
@@ -235,7 +233,7 @@ polynome ply_division(polynome poly1, polynome poly2)
polynome ply_modulo(polynome poly1, polynome poly2)
{ /* reste de la division de deux polynomes */
- polynome result=NULL;
+ polynome result = NULL;
return result;
}
@@ -264,35 +262,35 @@ double ply_valuation(polynome poly, double point)
double result = 0;
while (poly) {
- result += rat_to_double(poly->coef) * pow(point, (poly->degre));
- poly=poly->suiv;
+ result += rat_to_double(poly->coef) * pow(point, (poly->degre));
+ poly = poly->suiv;
}
return result;
}
char *ply_affichage(polynome poly)
{ /* routine d'affichage d'un polynome */
- char buf[BUFSIZ] = {0}, temp[BUFSIZ];
- int count=0;
-
+ char buf[BUFSIZ] = { 0 }, temp[BUFSIZ];
+ int count = 0;
+
while (poly) {
if (poly->degre != 0) {
- if (poly->coef.denom==1)
+ if (poly->coef.denom == 1)
sprintf(temp, "%+d*%s^%u ", poly->coef.num, mute, poly->degre);
- else
+ else
sprintf(temp, "%+d/%d*%s^%u ", poly->coef.num, poly->coef.denom, mute, poly->degre);
} else {
- if (poly->coef.denom==1)
+ if (poly->coef.denom == 1)
sprintf(temp, "%+d ", poly->coef.num);
- else
- sprintf(temp, "%+d/%d ", poly->coef.num , poly->coef.denom);
+ else
+ sprintf(temp, "%+d/%d ", poly->coef.num, poly->coef.denom);
}
- count+=strlen(temp);
- if (count<BUFSIZ)
+ count += strlen(temp);
+ if (count < BUFSIZ)
strcat(buf, temp);
else
- exception(1,_("ply_affichage: strcat error, not enoug space in buffer"));
- poly=poly->suiv;
+ exception(1, _("ply_affichage: strcat error, not enoug space in buffer"));
+ poly = poly->suiv;
}
return Estrdup(buf);
}
diff --git a/lib/scalaires.c b/lib/scalaires.c
index 14b3db2..7a97866 100644
--- a/lib/scalaires.c
+++ b/lib/scalaires.c
@@ -43,19 +43,19 @@ rationnel rat_constr(int num, int denom)
sgnnum = -1;
num = -num;
}
-
+
if (denom < 0) {
sgndenom = -1;
denom = -denom;
}
if (!num) {
- temp.num=0;
- temp.denom=1;
+ temp.num = 0;
+ temp.denom = 1;
} else if (denom) {
temp.num = sgnnum * sgndenom * num / pgcd(num, denom);
temp.denom = denom / pgcd(num, denom);
} else {
- exception(1,_("rat_constr: division by zero"));
+ exception(1, _("rat_constr: division by zero"));
}
return temp;
diff --git a/src/Polynom.c b/src/Polynom.c
index d96d1a4..e6dbfb6 100644
--- a/src/Polynom.c
+++ b/src/Polynom.c
@@ -30,7 +30,7 @@ int main(void)
Initialise(&variables);
mute = "x";
/* nom de la variable utilisee pour la saisie des polynomes, a recuperer en argv eventuellt
- ATTENTION: elle est case sensitive*/
+ ATTENTION: elle est case sensitive */
parse_line("P=-4.5+2*x+3*x^2;");
//parse_line("P(2);");
//AfficheTableau(variables);
@@ -43,6 +43,7 @@ int main(void)
parse_line("soja=P-Q+2;");
parse_line("soja;");
parse_line("soja^3;");
+ //parse_line("quake4@%*)+vo;i");
//fprintf(stderr, "soja");
printf("Resultat: %s\n", affichage_level_1());
return 0;