modified main.c

-added Error-message from Logging API.
-changed exit and moved after yyparse()
-added extern for file name
todo: make file name user input variable.
This commit is contained in:
SirTalksalot75 2024-04-22 12:53:48 +02:00 committed by GitHub
parent 1cfe9485e9
commit 6fca12df39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -4,6 +4,8 @@
#define LOG_LEVEL LOG_LEVEL_DEBUG #define LOG_LEVEL LOG_LEVEL_DEBUG
extern FILE* yyin;
/** /**
* @brief Log a debug message to inform about beginning exit procedures * @brief Log a debug message to inform about beginning exit procedures
* *
@ -38,10 +40,10 @@ int main(void) {
FILE* input = fopen("program.gem", "r"); FILE* input = fopen("program.gem", "r");
if (input == NULL) if (NULL == Input)
{ {
printf("Error opening file!\n"); ERROR("File couldn't be opened!");
return 1; // Error when opening file atexit();
} }
yyin = input; yyin = input;
@ -49,5 +51,7 @@ int main(void) {
fclose(input); fclose(input);
yyparse(); yyparse();
atexit();
return 0; return 0;
} }