From d6ce6585f1625ada5efcadeccf30517d4a94061d Mon Sep 17 00:00:00 2001 From: Axel O Date: Tue, 6 Dec 2022 21:37:58 +0100 Subject: [PATCH] ne compile pas mais on sait jamais --- forth | Bin 17392 -> 0 bytes main | Bin 17160 -> 0 bytes main.c | 13 +++++++------ pile.c | 32 +++++++++++++++++++++++++------- pile.h | 7 ++++--- 5 files changed, 36 insertions(+), 16 deletions(-) delete mode 100755 forth delete mode 100755 main diff --git a/forth b/forth deleted file mode 100755 index 1a69fffc66f1f140cebe3b027b427bf172f80667..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17392 zcmeHPe{fXSb-pVhkTI+l2ND@vv$jJcOtc6L6dP0TN_z0r5e9^m(As9bXjf>R)vmnS zO(ahtWE2wbENax5I>9qZgQs=lnIx?`jWe{<84D9zq!VZ4jO*eFnJOOKt_n?MVb_Wq zv;EF}=d9j)TGg4ffAo*N!|L4gonQB!d*9u6-@eP|jrKiN9*>ezt$tS#_vk7M39_K+ zey)H7)lRh%f7h$q)l%?FG-k`8G4%qE1}XtqGY#NnObH^ zgesrKlU)r}nRnBdxM4y?UW(@@V-&ysTcT6kKcRLz%FSS-r9ZgaNzbs|S*Bt~EZIHD zc2BaM&>3nFicrZX<%B*vIiGIohm49}|5eIucbM(mw3YRRQVc4G-pWLOlXwT%&hOW5 zl$)NmU?o)I9fTd_<<~7T%pDwWv2l2k^DmUst2QU%M|W)7oQO6i;>qk_Kc&dBxAsws#UqH>mh`t*8aUape%3~1RQbu?Rn7<5uGq7^{n-{?;2j%n| z7QqiMf0r%tME_VPZr{4_xPPa1gm>1nN4R)yhY-T`( z!vmQ}_h-W0y`Ks9MB)iGkV!|g{i;75PiA_EOT?0@FOo>4x>Y2Tio>FNFcR*GCnJgY z6EV^li1h;{$K))X3HL?fN!62%#nj&Rw&s@b*1)z>ZEIk=3b%Fc3rAz=*s=IPCYJ8p z*OEvjW1W$si5MIm>q{lsQP@%~t7y%wD$KBId}yB0U!fkPc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Lptbgany)=jm{tyJy>L(dn$BRc;2ayC%nmhF(cRpY9vhB z$vGUI3MaaSH{NB0y?f&+Z+D`rJDf1~S)jI51n21@AqDyC8Y_+9ULnOhgUL?e4eg7= zg-MNs$+;K39O;S|6m;+s;b@Q)RIWQ}2(OH*7g_J#E)*$~47Urf5$-{e?h8nF$${bx zcd9#~GX!f~GHsZ*gsH)KxC+K1FlMTwCxjQbV+^-gvHSbK#OTQdQy~8P%v7PCcbW1! zO|hjc=ZRj2i`GW0&(GIPJ>XdruZI|0hm2K!hw{&qzOz{q|6efHh>TUApVygsSWr>B z{++--#@dSO&(HNt**~v8?ez~rpU#P~K0p66^-yq;sE(9neO@OWiCf79u|0tWRTkDm(GQ`A1k+5Nv^(;rZJOh?GLCGq%S=qxg{_EOVMZe7Xew(as< zX8Hki7g+Rp{duSoAQH=&rF@z33t-ULW&gZR<#YIa-k$D1O038I_%mSCMAql^?0|ZZ z?ItBlVtuBwplsC_J|$dbQuf0pSdYuJSAa0~&(E#pO5ZL|zN~4X@~^~mEY`mU F@h<>%Tg?Cf diff --git a/main.c b/main.c index 7c3c806..d48877a 100644 --- a/main.c +++ b/main.c @@ -8,12 +8,12 @@ int main(int argc, char * argv[]) { /*struct Pile P; Init_Pile(&P); - Empiler(&P, 4); - Empiler(&P, 5); + Empiler(&P, '4'); + Empiler(&P, '5'); struct Cell * res = Depiler(&P); //Supprimer(&P); Affichage(P.Pil); - printf("%d \n", res->Ent); + Affiche_Nombre(res->Ent);*/ Programme * P; P = lexer(argv[1]); @@ -21,13 +21,14 @@ int main(int argc, char * argv[]) for(int i=0; itaille; i++) { printf("TOKEN : %s \n", P->tokens[i]); - }*/ + } + /*for(int i=0; iProg->taille; i++) { printf("TOKEN : %s \n", E->Prog->tokens[i]); }*/ - Etat * E; + /*Etat * E; E= malloc(sizeof(Etat)); E->Donnee = malloc(sizeof(struct Pile)); Init_Pile(E->Donnee); @@ -35,5 +36,5 @@ int main(int argc, char * argv[]) E->Prog = lexer(argv[1]); - Executer(E); + Executer(E);*/ } \ No newline at end of file diff --git a/pile.c b/pile.c index d9c417b..89f41f4 100644 --- a/pile.c +++ b/pile.c @@ -12,7 +12,7 @@ void Init_Pile(struct Pile *new) //return new; } -struct Nombre Typenum(string C) +struct Nombre Typenum(char * C) { struct Nombre k; //enum Numtype type; @@ -35,14 +35,19 @@ struct Nombre Typenum(string C) k.nombr.ValReel = atof(C); } + return k; + } -void Empiler(struct Pile * P, struct Nombre i) + +void Empiler(struct Pile * P, char * nb) { struct Cell * cel= malloc(sizeof(struct Cell)); + struct Nombre i = Typenum(nb); + if (i.typ == Entier) - cel->Ent.ValEntier = i; + cel->Ent.nombr.ValEntier = i.nombr.ValEntier; else if (i.typ == Reel) - cel->Ent.ValReel = i; + cel->Ent.nombr.ValReel = i.nombr.ValReel; cel->Suiv = P->Pil; P->Pil = cel; P->nbElements +=1; @@ -80,6 +85,19 @@ void Supprimer(struct Pile *P){ } } + +void Affiche_Nombre(struct Nombre nb) +{ + if(nb.typ == Entier) + { + printf("%d \n", nb.nombr.ValEntier); + } + else if(nb.typ == Reel) + { + printf("%f \n", nb.nombr.ValReel); + } +} + void Affichage(struct Cell * C) { if(C == NULL) @@ -88,7 +106,7 @@ void Affichage(struct Cell * C) } else { - printf("%d \n", C->Ent.ValEntier); + Affiche_Nombre(C->Ent); Affichage(C->Suiv); } } @@ -120,7 +138,7 @@ Programme* lexer(char* chaine) { return retour; } -void Executer(Etat * etat){ +/*void Executer(Etat * etat){ //struct Pile P = etat->Donnee; //Programme Program = etat->Prog; struct Cell *C1, *C2; @@ -199,4 +217,4 @@ void Executer(Etat * etat){ } printf("SORTIE : %d \n", etat->Donnee->Pil->Ent.ValEntier); -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/pile.h b/pile.h index bba1853..19b4431 100644 --- a/pile.h +++ b/pile.h @@ -33,14 +33,15 @@ typedef struct Etat{ Programme * Prog; } Etat; -struct Nombre Typenum(string C); +struct Nombre Typenum(char * C); void Init_Pile(struct Pile * new); -void Empiler(struct Pile * P, int i); +void Empiler(struct Pile * P, char * nb); struct Cell * Depiler(struct Pile * P); +void Affiche_Nombre(struct Nombre nb); void Affichage(struct Cell * C); int numberOfDelimiters(char* string); -Programme* lexer(char* chaine); +Programme* lexer(char * chaine); void Executer(Etat * etat);