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