summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fonctions.h8
-rw-r--r--include/hash.h42
-rw-r--r--include/main.h1
-rw-r--r--include/parser.h25
-rw-r--r--include/pile.h16
-rw-r--r--include/polynom.h68
-rw-r--r--include/scalaires.h67
7 files changed, 154 insertions, 73 deletions
diff --git a/include/fonctions.h b/include/fonctions.h
index ee3e11d..55dab4a 100644
--- a/include/fonctions.h
+++ b/include/fonctions.h
@@ -13,15 +13,15 @@ void integ(polynome p1, polynome p2, polynome p3);
void printvars(polynome p1, polynome p2, polynome p3);
void ans(polynome p1, polynome p2, polynome p3);
-
+
void help(polynome p1, polynome p2, polynome p3);
void setdisplay(polynome p1, polynome p2, polynome p3);
void reinit(polynome p1, polynome p2, polynome p3);
-
+
void exit_call(polynome p1, polynome p2, polynome p3);
void setsmartprint(polynome p1, polynome p2, polynome p3);
-
-#endif \ No newline at end of file
+
+#endif
diff --git a/include/hash.h b/include/hash.h
index 701b241..0197bbb 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -6,40 +6,52 @@
typedef void *_TypeVariable;
typedef struct {
- char *NomVar;
- _TypeVariable Variable;
+ char *NomVar;
+ _TypeVariable Variable;
} _Element;
typedef struct _LstChn {
- _Element Elem;
- struct _LstChn *Suivant;
+ _Element Elem;
+ struct _LstChn *Suivant;
} *_ListeChaine;
typedef _ListeChaine *_TableauVariable;
-/* Initialise une table de hachage */
+/*
+ * Initialise une table de hachage
+ */
int Initialise(_TableauVariable * t);
-/* Crée un élement à insérer dans la table de hachage */
+/*
+ * Cree un element a inserer dans la table de hachage
+ */
_Element CreerElement(char *Nom, _TypeVariable Var);
-/* Insert un element(Nom de la variable,variable) dans une table de hachage
- la fonction renvoit 0 en cas d'erreur */
+/*
+ * Insert un element(Nom de la variable,variable) dans une table de hachage la fonction renvoit 0
+ * en cas d'erreur
+ */
char InsererVarDansTab(_TableauVariable * t, _Element e);
-/* Renvoie la variable de la table de hachage qui porte le nom Nom
- si la variable n'existe pas trouve est égal à 0 */
+/*
+ * Renvoie la variable de la table de hachage qui porte le nom Nom si la variable n'existe pas
+ * trouve est egal a 0
+ */
_TypeVariable NomVarToVar(char *Nom, _TableauVariable t, char *trouve);
-/* Supprime la variable de nom Nom
- la fonction renvoit 0 en cas d'erreur */
+/*
+ * Supprime la variable de nom Nom la fonction renvoit 0 en cas d'erreur
+ */
char SupprimerDansTab(_TableauVariable * t, char *Nom);
-/* Detruit le tableau */
+/*
+ * Detruit le tableau
+ */
void DetruitTab(_TableauVariable * t);
-/* Affiche le tableau */
+/*
+ * Affiche le tableau
+ */
void AfficheTableau(_TableauVariable t);
-
#endif
diff --git a/include/main.h b/include/main.h
index f8f8e6c..c9b7602 100644
--- a/include/main.h
+++ b/include/main.h
@@ -5,5 +5,4 @@
extern _TableauVariable variables;
extern char *mute;
-
#endif
diff --git a/include/parser.h b/include/parser.h
index 1e7c0fd..f94bd34 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -5,21 +5,20 @@
#define PILECALL_MAX 50
enum {
- OP_NEST,
- OP_PLUS,
- OP_MOINS,
- OP_EXP,
- OP_PLUS_UNARY,
- OP_MOINS_UNARY,
- OP_DIV,
- OP_MOD,
- OP_MUL,
- OP_ASSIGN,
- OP_LPAREN,
- OP_FUNC_CALL
+ OP_NEST,
+ OP_PLUS,
+ OP_MOINS,
+ OP_EXP,
+ OP_PLUS_UNARY,
+ OP_MOINS_UNARY,
+ OP_DIV,
+ OP_MOD,
+ OP_MUL,
+ OP_ASSIGN,
+ OP_LPAREN,
+ OP_FUNC_CALL
};
-
void parse_line(char *);
#endif
diff --git a/include/pile.h b/include/pile.h
index 4f6aeab..086d185 100644
--- a/include/pile.h
+++ b/include/pile.h
@@ -5,16 +5,16 @@
#define PILE_MAX 100
typedef enum type_elem {
- T_POLY,
- T_STRING,
- T_INT
+ T_POLY,
+ T_STRING,
+ T_INT
} type_elem;
typedef struct pile_elem {
- type_elem type;
- polynome poly;
- char *label;
- int val;
+ type_elem type;
+ polynome poly;
+ char *label;
+ int val;
} pile_elem;
void push_pile(char *st);
@@ -39,7 +39,7 @@ void affichage_pile(void);
void move_to_resultat_pile(void);
-char * pop_resultat(void);
+char *pop_resultat(void);
polynome return_last(int *valid);
diff --git a/include/polynom.h b/include/polynom.h
index 2078d0b..8d223bb 100644
--- a/include/polynom.h
+++ b/include/polynom.h
@@ -5,35 +5,73 @@
extern int smartprint;
typedef struct monome {
- rationnel coef;
- unsigned int degre;
- struct monome *suiv;
+ rationnel coef;
+ unsigned int degre;
+ struct monome *suiv;
} monome;
typedef monome *polynome;
-polynome ply_constr(rationnel coef, int degre); /* constructeur monome */
+polynome ply_constr(rationnel coef, int degre); /*
-polynome ply_vide(void); /* cree un polynome */
+ * constructeur monome
+ */
-void ply_destruct(polynome poly); /* destructeur */
+polynome ply_vide(void); /*
-polynome ply_copy(polynome poly); /* recopie */
+ * cree un polynome
+ */
-polynome ply_addition(polynome poly1, polynome poly2); /* addition de deux polynomes */
+void ply_destruct(polynome poly); /*
-polynome ply_soustraction(polynome poly1, polynome poly2); /* soustraction de deux polynomes */
+ * destructeur
+ */
-polynome ply_multiplication(polynome poly1, polynome poly2); /* multiplication de deux polynomes */
+polynome ply_copy(polynome poly); /*
-polynome ply_division(polynome poly1, polynome poly2); /* division de deux polynomes */
+ * recopie
+ */
-polynome ply_modulo(polynome poly1, polynome poly2); /* reste de la division de deux polynomes */
+polynome ply_addition(polynome poly1, polynome poly2); /*
-polynome ply_exposant(polynome poly, unsigned int exp); /* exponentiation d'un polynome */
+ * addition de deux polynomes
+ */
-rationnel ply_valuation(polynome poly, rationnel point); /* valuation d'un polynome en un point */
+polynome ply_soustraction(polynome poly1, polynome poly2); /*
-char *ply_affichage(polynome poly); /* routine d'affichage d'un polynome */
+ * soustraction de deux polynomes
+ */
+
+polynome ply_multiplication(polynome poly1, polynome poly2); /*
+
+ * multiplication de deux
+ * polynomes
+ */
+
+polynome ply_division(polynome poly1, polynome poly2); /*
+
+ * division de deux polynomes
+ */
+
+polynome ply_modulo(polynome poly1, polynome poly2); /*
+
+ * reste de la division de deux polynomes
+ */
+
+polynome ply_exposant(polynome poly, unsigned int exp); /*
+
+ * exponentiation d'un polynome
+ */
+
+rationnel ply_valuation(polynome poly, rationnel point); /*
+
+ * valuation d'un polynome en un
+ * point
+ */
+
+char *ply_affichage(polynome poly); /*
+
+ * routine d'affichage d'un polynome
+ */
#endif
diff --git a/include/scalaires.h b/include/scalaires.h
index 5fc7dd2..7ab1951 100644
--- a/include/scalaires.h
+++ b/include/scalaires.h
@@ -2,30 +2,63 @@
#define __SCALAIRES_H__
typedef struct {
- long long num;
- unsigned long long denom;
+ long long num;
+ unsigned long long denom;
} rationnel;
typedef enum typedisplay {
- HEX,
- DEC,
- OCT,
- FLT
+ HEX,
+ DEC,
+ OCT,
+ FLT
} typedisplay;
extern typedisplay display;
-rationnel rat_constr_zero(void); /* renvoie 0 */
-rationnel rat_constr(unsigned long long num, unsigned long long denom); /* cree une fraction */
-rationnel rat_constr_from_double(double flt); /* cree une fraction a partir d un double */
-void rat_destruct(rationnel rat); /* destructeur */
-double rat_to_double(rationnel rat); /* obtention du double correspondant a un rationnel */
-rationnel rat_addition(rationnel rat1, rationnel rat2); /* addition */
-rationnel rat_soustraction(rationnel rat1, rationnel rat2); /* soustraction */
-rationnel rat_moinsunaire(rationnel rat1); /* moins unaire */
-rationnel rat_multiplication(rationnel rat1, rationnel rat2); /* multiplication */
-rationnel rat_division(rationnel rat, rationnel rat2); /* division */
-rationnel rat_pow(rationnel rat, unsigned int p); /* puissance */
+rationnel rat_constr_zero(void); /*
+
+ * renvoie 0
+ */
+rationnel rat_constr(unsigned long long num, unsigned long long denom); /*
+
+ * cree une fraction
+ */
+rationnel rat_constr_from_double(double flt); /*
+
+ * cree une fraction a partir d un double
+ */
+void rat_destruct(rationnel rat); /*
+
+ * destructeur
+ */
+double rat_to_double(rationnel rat); /*
+
+ * obtention du double correspondant a un rationnel
+ */
+rationnel rat_addition(rationnel rat1, rationnel rat2); /*
+
+ * addition
+ */
+rationnel rat_soustraction(rationnel rat1, rationnel rat2); /*
+
+ * soustraction
+ */
+rationnel rat_moinsunaire(rationnel rat1); /*
+
+ * moins unaire
+ */
+rationnel rat_multiplication(rationnel rat1, rationnel rat2); /*
+
+ * multiplication
+ */
+rationnel rat_division(rationnel rat, rationnel rat2); /*
+
+ * division
+ */
+rationnel rat_pow(rationnel rat, unsigned int p); /*
+
+ * puissance
+ */
char *rat_to_string(rationnel rat, int first);
#endif