From 69164e35f51064b47dc7928a0599e9d66e2cff45 Mon Sep 17 00:00:00 2001 From: bernardt Date: Fri, 17 Dec 2021 18:39:41 +0100 Subject: [PATCH] bon bah je suis triste --- mars_compile.c | 119 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 99 insertions(+), 20 deletions(-) diff --git a/mars_compile.c b/mars_compile.c index 8ec9464..ede34f3 100644 --- a/mars_compile.c +++ b/mars_compile.c @@ -4,7 +4,15 @@ #include"mars_types.h" /* importe les types utilisés dans le programme */ #include"options.h" /* Inclus les options du programme */ +int verif_instru(char* instru, char* arg1, char* arg2){ /* vérifie les instructions */ + + printf("%s %s %s", instru, arg1, arg2); + + +} + int ouvrir_fichier(char* path){ + union mars_instruction toto; FILE* fluxouverture; char instru[4]; char arg1[4], arg2[4]; @@ -12,6 +20,8 @@ int ouvrir_fichier(char* path){ int i; int ligne=0; char buffer[4]; + char verifarg1[1], verifarg2[1]; + int flagverif1, flagverif2; char previnstru[4]; // contient l'instruction ayant été "mal interprétée" à cause d'une instruction mauvaise int errinstru; // flag qui aide le prog à savoir si l'instruction précédente était mauvaise @@ -28,21 +38,16 @@ int ouvrir_fichier(char* path){ if (fluxouverture){ while (!feof(fluxouverture)){ - instru[0]='\0'; - arg1[0]='\0'; - arg2[0]='\0'; - - + instru[0]='\0'; + arg1[0]='\0'; + arg2[0]='\0'; printf("\n"); - /*fread(&instru,sizeof(char),1,fluxouverture); - fread(&arg1,sizeof(char),3,fluxouverture); - fread(&arg2,sizeof(char),3,fluxouverture); - printf("%s %s %s\n", instru, arg1, arg2);*/ - fscanf(fluxouverture, "%s %s %s", instru, arg1, arg2); + + fscanf(fluxouverture, "%4s %4s %4s", instru, arg1, arg2); for (i=0; i