Merge branch 'Paul'
This commit is contained in:
commit
963c513703
2 changed files with 22 additions and 2 deletions
22
PILE/pile.c
22
PILE/pile.c
|
@ -30,4 +30,24 @@ void Affichage(struct pile *p)
|
|||
aux = aux->suiv;
|
||||
}
|
||||
printf("NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
void init(struct pile ** une_pile) {
|
||||
*une_pile = (struct pile *)malloc(sizeof(struct pile));
|
||||
}
|
||||
|
||||
void push(int e, struct pile * une_pile) {
|
||||
struct cell * aux;
|
||||
if (une_pile->taille == 0) {
|
||||
une_pile->taille = 1;
|
||||
une_pile->deb = (struct cell *)malloc(sizeof(struct cell));
|
||||
une_pile->deb->suiv = NULL;
|
||||
une_pile->deb->val = e;
|
||||
} else {
|
||||
une_pile->taille += 1;
|
||||
aux = une_pile->deb;
|
||||
une_pile->deb = (struct cell *)malloc(sizeof(struct cell));
|
||||
une_pile->deb->val = e;
|
||||
une_pile->deb->suiv = aux;
|
||||
}
|
||||
}
|
||||
|
|
2
makefile
2
makefile
|
@ -15,7 +15,7 @@ forth : forth.o PILE/pile.o LISTE/liste.o LEXER/lexer.o
|
|||
gcc -Wall LEXER/lexer.o LISTE/liste.o PILE/pile.o forth.o -o forth_interpretor
|
||||
|
||||
%.o : %.c
|
||||
gcc -c $< -o $@
|
||||
gcc -Wall -c $< -o $@
|
||||
|
||||
PILE/pile.o : PILE/pile.h
|
||||
LISTE/liste.o : LISTE/liste.h
|
||||
|
|
Loading…
Reference in a new issue