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:
parent
1cfe9485e9
commit
6fca12df39
10
src/main.c
10
src/main.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue