From f6d829b8eca64bd77f40e0c294d77f52f7338a93 Mon Sep 17 00:00:00 2001 From: biouman Date: Fri, 27 Apr 2001 10:37:22 +0000 Subject: *** empty log message *** --- Makefile | 10 ++++++++-- main.c | 8 +++++--- numbers.c | 9 ++++----- pile.c | 2 +- polynom.c | 15 ++++++++------- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index c188edd..718e4b7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ all: polynom -polynom: exceptions.c hash.c interface.c main.c numbers.c pile.c polynom.c scalaires.c - gcc -o polynom exceptions.c hash.c interface.c main.c numbers.c pile.c polynom.c scalaires.c -lm \ No newline at end of file +clean: + rm -f *.o polynom + +CC=gcc +LDFLAGS=-lm +CFLAGS=-Wall -O3 + +polynom: exceptions.o hash.o parse.o main.o numbers.o pile.o polynom.o scalaires.o diff --git a/main.c b/main.c index 8f451e4..5a66e1a 100644 --- a/main.c +++ b/main.c @@ -4,9 +4,10 @@ * */ +#include #include "main.h" #include "hash.h" -#include "interface.h" +#include "parse.h" #include "polynom.h" #include "pile.h" #ifdef HAVE_CONFIG_H @@ -15,10 +16,11 @@ #define _(x) x #endif +_TableauVariable variables; +char mute; + int main(void) { - _TableauVariable variables; - char mute; Initialise(&variables); mute = 'x'; /* nom de la variable utilisee pour la saisie des polynomes, a recuperer en argv eventuellt */ diff --git a/numbers.c b/numbers.c index 9beeb82..831639b 100644 --- a/numbers.c +++ b/numbers.c @@ -72,7 +72,7 @@ int char_to_number(char *st, int *valid) } - +/* TODO: Rajouter la precision dans les valeurs retournees */ double char_to_double(char *st, int *valid) /* cette fonction tente de traduire une chaine en flottant */ { unsigned int dotnum = 0; @@ -93,9 +93,8 @@ double char_to_double(char *st, int *valid) /* cette fonction tente de traduire deci *= 10; } } - result = result / deci; - *valid = 1; - return result; - } + result = result / deci; + *valid = 1; + return result; } diff --git a/pile.c b/pile.c index 294b402..fe305a1 100644 --- a/pile.c +++ b/pile.c @@ -8,7 +8,7 @@ #include "exceptions.h" #include "numbers.h" #include "main.h" -#include "interface.h" +#include "parse.h" #ifdef HAVE_CONFIG_H #include "config.h" #else diff --git a/polynom.c b/polynom.c index 33834ef..26a11c8 100644 --- a/polynom.c +++ b/polynom.c @@ -10,6 +10,8 @@ #include "main.h" #include #include +#include +#include #ifdef HAVE_CONFIG_H #include "config.h" #else @@ -51,7 +53,7 @@ void ply_destruct(polynome poly) polynome ply_copy(polynome poly) { /* recopie */ - polynome result = NULL, temp, t; + polynome result = NULL, temp = NULL, t; while (poly) { t = ply_constr(poly->coef, poly->degre); @@ -72,7 +74,7 @@ polynome ply_copy(polynome poly) polynome ply_addition(polynome poly1, polynome poly2) { /* addition de deux polynomes */ - polynome resultat = NULL, temp, t; + polynome resultat = NULL, temp = NULL, t; rationnel newrat; int degre; @@ -131,7 +133,7 @@ polynome ply_addition(polynome poly1, polynome poly2) polynome ply_soustraction(polynome poly1, polynome poly2) { /* soustraction de deux polynomes */ - polynome resultat = NULL, temp, t; + polynome resultat = NULL, temp = NULL, t; rationnel newrat; int degre; @@ -190,7 +192,7 @@ polynome ply_soustraction(polynome poly1, polynome poly2) polynome ply_multiplication(polynome poly1, polynome poly2) { /* multiplication de deux polynomes */ - polynome temp, t, resultat = NULL; + polynome temp = NULL, t, resultat = NULL; while (poly1) { while (poly2) { @@ -261,8 +263,7 @@ double ply_valuation(polynome poly, double point) char *ply_affichage(polynome poly) { /* routine d'affichage d'un polynome */ - char buf[512], temp[32]; /* FIXME: pas glop comme routine, malloquer tout ca ? */ - char debut = 1; + char buf[BUFSIZ], temp[BUFSIZ]; /* FIXME: pas glop comme routine, malloquer tout ca ? */ while (poly) { if (poly->degre != 0) { @@ -271,6 +272,6 @@ char *ply_affichage(polynome poly) sprintf(temp, "%+f", rat_to_double(poly->coef)); } strcat(buf, temp); /* FIXME: gerer le depassement de buf si po malloc */ - return Estrdup(buf); } + return Estrdup(buf); } -- cgit v1.2.3