From 80fdb0714b75cb240d8b8068d718b915f1904110 Mon Sep 17 00:00:00 2001 From: Pixel <> Date: Thu, 29 Mar 2001 23:40:57 +0000 Subject: First. --- include/Makefile.am | 1 + include/assembler.h | 0 include/global.h | 10 ++++++++++ include/hash.h | 45 ++++++++++++++++++++++++++++++++++++++++++ include/meta.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/numbers.h | 6 ++++++ include/parser.h | 24 +++++++++++++++++++++++ 7 files changed, 142 insertions(+) create mode 100644 include/Makefile.am create mode 100644 include/assembler.h create mode 100644 include/global.h create mode 100644 include/hash.h create mode 100644 include/meta.h create mode 100644 include/numbers.h create mode 100644 include/parser.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..f451c35 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +include_HEADERS = hash.h assembler.h meta.h parser.h numbers.h global.h diff --git a/include/assembler.h b/include/assembler.h new file mode 100644 index 0000000..e69de29 diff --git a/include/global.h b/include/global.h new file mode 100644 index 0000000..21d412d --- /dev/null +++ b/include/global.h @@ -0,0 +1,10 @@ +#ifndef __GLOBAL_H__ +#define __GLOBAL_H__ + +#include + +void exception(int, char *); +char * Estrdup(char *); +void * Emalloc(size_t); + +#endif diff --git a/include/hash.h b/include/hash.h new file mode 100644 index 0000000..3420a51 --- /dev/null +++ b/include/hash.h @@ -0,0 +1,45 @@ +#ifndef __HASH_H__ +#define __HASH_H__ + +#define TAILLECHAINEHACHAGE (26*2+1) + +#ifdef HAVE_CONFIG_H +typedef void * _TypeVariable; +#else +typedef int _TypeVariable; +#endif + +typedef struct { + char *NomVar; + _TypeVariable Variable; +} _Element; + +typedef struct _LstChn { + _Element Elem; + struct _LstChn *Suivant; +} *_ListeChaine; + +typedef _ListeChaine *_TableauVariable; + +/* Initialise une table de hachage */ +int Initialise(_TableauVariable * t); + +/* Crée un élement à insérer 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 */ +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 */ +_TypeVariable NomVarToVar(char *Nom, _TableauVariable t, char *trouve); + +/* Supprime la variable de nom Nom + la fonction renvoit 0 en cas d'erreur */ +char SupprimerDansTab(_TableauVariable * t, char *Nom); + +/* Detruit le tableau */ +void DetruitTab(_TableauVariable * t); + +#endif diff --git a/include/meta.h b/include/meta.h new file mode 100644 index 0000000..7e456a5 --- /dev/null +++ b/include/meta.h @@ -0,0 +1,56 @@ +#ifndef __META_H__ +#define __META_H__ + +#define MAXF 32 +#define MAXP 256 +#define MAXM 64 + +typedef struct phon_t { + char *p1; + char *p2; + struct phon_t *next; +} phon_t; + +typedef struct field_t { + char *name; + char **names; + int *sizes, nbr; + struct field_t *next; +} field_t; + +typedef struct metaexpr_t { + char * name; + int type; + char * string; + /* left = right = NULL => feuille + left = NULL => opérateur unaire + sinon => opérateur binaire + */ + struct metaexpr_t * left, * right; +} metaexpr_t; + +typedef struct pattern_t { + char * name; + metaexpr_t ** expr; + int nbr; + struct pattern_t *next; +} pattern_t; + +typedef struct instruct_t { + char ** names; + char ** strings; + char ** implicits; + char ** istrings; + int * etypes, * itypes, * ivalues, nbexplicit, nbimplicit; + struct instruct_t * next; +} instruct_t; + +extern phon_t *phons; +extern field_t *fields; +extern pattern_t *patterns; +extern instruct_t *instructs; + +void meta_parse_line(char *); +int meta_init(void); +void meta_flush(void); +#endif diff --git a/include/numbers.h b/include/numbers.h new file mode 100644 index 0000000..ad3fc2b --- /dev/null +++ b/include/numbers.h @@ -0,0 +1,6 @@ +#ifndef __NUMBERS_H__ +#define __NUMBERS_H__ + +int char_to_number(char * st, int * valid); + +#endif diff --git a/include/parser.h b/include/parser.h new file mode 100644 index 0000000..30d626c --- /dev/null +++ b/include/parser.h @@ -0,0 +1,24 @@ +#ifndef __PARSER_H__ +#define __PARSER_H__ + +#define PILEOP_MAX 50 +#define PILECALL_MAX 50 + +enum { + OP_NEST, + OP_PLUS, + OP_MOINS, + OP_PLUS_UNARY, + OP_MOINS_UNARY, + OP_DIV, + OP_MUL, + OP_LPAREN, + OP_FUNC_CALL, + OP_DECAL, + OP_DIRECT +}; + +void push_pile(char *); +void act_pile(int); + +#endif \ No newline at end of file -- cgit v1.2.3