Merge branch 'Paul'

This commit is contained in:
Paul Faure 2020-10-01 16:13:13 +02:00
commit 963c513703
2 changed files with 22 additions and 2 deletions

View file

@ -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;
}
}

View file

@ -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