Ver Fonte

feat: 所有日志信息的输出都使用日志系统管理

SongZihuan há 3 anos atrás
pai
commit
6bcf8ee04b

+ 4 - 1
CMakeLists.txt

@@ -54,6 +54,9 @@ else()
     wi_set_install_dir_quiet(NAMES aFunlang)  # 设置安装路径
 endif()
 file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${INSTALL_LOG})  # 安装log输出的目录
+file(TO_NATIVE_PATH ${INSTALL_LOG} _INSTALL_LOG_NATIVE)
+string(REPLACE "\\" "\\\\" INSTALL_LOG_NATIVE ${_INSTALL_LOG_NATIVE})  # 转义
+unset(_INSTALL_LOG_NATIVE)
 
 include(info)
 include(filename)
@@ -73,7 +76,7 @@ set(base_compile_definitions
     aFunMajorVersion=${PROJECT_VERSION_MAJOR}
     aFunMinorVersion=${PROJECT_VERSION_MINOR}
     aFunPatchVersion=${PROJECT_VERSION_PATCH}
-    aFunLogDir="${INSTALL_LOG}")  # 默认的预定义宏
+    aFunLogDir="${INSTALL_LOG_NATIVE}")  # 默认的预定义宏
 
 if (WIN32 OR CYGWIN)
     list(APPEND base_compile_definitions aFunWIN32=1)

+ 1 - 0
include/core/core_init.h

@@ -6,6 +6,7 @@
 #include "tool.h"
 
 #ifdef aFunWIN32
+#pragma warning(disable : 5105)
 #include "Windows.h"
 #endif
 

+ 5 - 5
include/core/parser.h

@@ -9,12 +9,12 @@
 typedef struct af_Parser af_Parser;
 
 /* Parser 创建与释放 */
-AFUN_CORE_EXPORT af_Parser *makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size,
-                      FILE *error);
+AFUN_CORE_EXPORT af_Parser *
+makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size);
 AFUN_CORE_EXPORT void freeParser(af_Parser *parser);
-AFUN_CORE_EXPORT af_Parser *makeParserByString(char *str, bool free_str, FILE *error);
-AFUN_CORE_EXPORT af_Parser *makeParserByFile(FilePath path, FILE *error);
-AFUN_CORE_EXPORT af_Parser *makeParserByStdin(FILE *error);
+AFUN_CORE_EXPORT af_Parser *makeParserByString(char *str, bool free_str);
+AFUN_CORE_EXPORT af_Parser *makeParserByFile(FilePath path);
+AFUN_CORE_EXPORT af_Parser *makeParserByStdin();
 
 /* Parser 相关操作 */
 AFUN_CORE_EXPORT af_Code *parserCode(FilePath file, af_Parser *parser);

+ 6 - 7
include/runtime/aFunlang.h

@@ -11,12 +11,11 @@ AFUN_LANG_EXPORT af_Environment *creatAFunEnviroment(int argc, char **argv);
 AFUN_LANG_EXPORT void destructAFunEnvironment(af_Environment *env);
 
 /* 源文件运行 */
-AFUN_LANG_EXPORT int runCodeFromString(char *code, char *string_name, FILE *error_file, int mode, af_Environment *env);
-AFUN_LANG_EXPORT int runCodeFromFileSource(FilePath file, FILE *error_file, bool save_afb, FilePath save_path, int mode,
-                                           af_Environment *env);
-AFUN_LANG_EXPORT int runCodeFromStdin(char *name, FILE *error_file, af_Environment *env);
+AFUN_LANG_EXPORT int runCodeFromString(char *code, char *string_name, int mode, af_Environment *env);
+AFUN_LANG_EXPORT int runCodeFromFileSource(FilePath file, bool save_afb, FilePath save_path, int mode, af_Environment *env);
+AFUN_LANG_EXPORT int runCodeFromStdin(char *name, af_Environment *env);
 AFUN_LANG_EXPORT int runCodeFromMemory(af_Code *code, int mode, af_Environment *env);
-AFUN_LANG_EXPORT int runCodeFromFileByte(FilePath file, FILE *error_file, int mode, af_Environment *env);
-AFUN_LANG_EXPORT int runCodeFromFile(FilePath file, FILE *error_file, bool save_afb, int mode, af_Environment *env);
-AFUN_LANG_EXPORT int buildFile(FilePath out, FilePath in, FILE *error_file);
+AFUN_LANG_EXPORT int runCodeFromFileByte(FilePath file, int mode, af_Environment *env);
+AFUN_LANG_EXPORT int runCodeFromFile(FilePath file, bool save_afb, int mode, af_Environment *env);
+AFUN_LANG_EXPORT int buildFile(FilePath out, FilePath in);
 #endif //AFUN_AFUNLANG_H

+ 0 - 1
src/core/__parser.h

@@ -40,7 +40,6 @@ struct af_Parser {
     struct af_Lexical *lexical;
     struct af_Syntactic *syntactic;
 
-    FILE *error;
     bool is_error;  // Parser遇到错误
 };
 

+ 1 - 1
src/core/core_init.c

@@ -23,7 +23,7 @@ bool aFunCoreInit(char *log_dir, LogFactoryPrintConsole print_console, bool fe,
     char *log = strJoin(log_dir, "aFunlang-", false, false);
     bool re = initLogSystem(log, print_console);
     free(log);
-    if (re != 1)
+    if (re == 0)
         return false;
 
     initLogger(aFunCoreLogger, "aFunlang-core", level);

+ 2 - 6
src/core/lexical.c

@@ -8,16 +8,12 @@
 #include "parserl_warning_error.h"
 
 static void printLexicalError(char *info, af_Parser *parser) {
-    if (parser->error == NULL)
-        return;
-    fprintf(parser->error, "[Lexical-Error] %s\n", info);
+    writeErrorLog(aFunCoreLogger, "[Lexical] %s", info);
     parser->is_error = true;
 }
 
 static void printLexicalWarning(char *info, af_Parser *parser) {
-    if (parser->error == NULL)
-        return;
-    fprintf(parser->error, "[Lexical-Warning] %s\n", info);
+    writeWarningLog(aFunCoreLogger, "[Lexical] %s", info);
 }
 
 static void setLexicalLast(af_LexicalStatus status, af_TokenType token, af_Parser *parser) {

+ 8 - 11
src/core/parser.c

@@ -12,13 +12,11 @@ static void freeLexical(af_Lexical *lex);
 static af_Syntactic *makeSyntactic(void);
 static void freeSyntactic(af_Syntactic *syntactic);
 
-af_Parser *makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size,
-                      FILE *error) {
+af_Parser *makeParser(DLC_SYMBOL(readerFunc) read_func, DLC_SYMBOL(destructReaderFunc) destruct_func, size_t data_size){
     af_Parser *parser = calloc(1, sizeof(af_Parser));
     parser->reader = makeReader(read_func, destruct_func, data_size);
     parser->lexical = makeLexical();
     parser->syntactic = makeSyntactic();
-    parser->error = error;
     return parser;
 }
 
@@ -77,10 +75,10 @@ static void destructFunc(struct readerDataString *data) {
         free(data->str);
 }
 
-af_Parser *makeParserByString(char *str, bool free_str, FILE *error) {
+af_Parser *makeParserByString(char *str, bool free_str){
     DLC_SYMBOL(readerFunc) read_func = MAKE_SYMBOL(readFuncString, readerFunc);
     DLC_SYMBOL(destructReaderFunc) destruct = MAKE_SYMBOL(destructFunc, destructReaderFunc);
-    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString), error);
+    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString));
     ((struct readerDataString *)parser->reader->data)->str = str;
     ((struct readerDataString *)parser->reader->data)->free_str = free_str;
     ((struct readerDataString *)parser->reader->data)->len = strlen(str);
@@ -103,17 +101,16 @@ static void destructFile(struct readerDataFile *data) {
         fclose(data->file);
 }
 
-af_Parser *makeParserByFile(FilePath path, FILE *error) {
+af_Parser *makeParserByFile(FilePath path){
     FILE *file = fopen(path, "rb");
     if (file == NULL) {
-        if (error != NULL)
-            fprintf(error, "File open error: %s\n", strerror(errno));
+        writeErrorLog(aFunCoreLogger, "File open error: %s", strerror(errno));
         return NULL;
     }
 
     DLC_SYMBOL(readerFunc) read_func = MAKE_SYMBOL(readFuncFile, readerFunc);
     DLC_SYMBOL(destructReaderFunc) destruct = MAKE_SYMBOL(destructFile, destructReaderFunc);
-    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString), error);
+    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString));
     ((struct readerDataFile *)parser->reader->data)->file = file;
     initParser(parser);
     FREE_SYMBOL(read_func);
@@ -147,13 +144,13 @@ static void destructStdin(struct readerDataFile *data) {
     // 什么都不用做
 }
 
-af_Parser *makeParserByStdin(FILE *error) {
+af_Parser *makeParserByStdin(){
     if (ferror(stdin))
         clearerr(stdin);
 
     DLC_SYMBOL(readerFunc) read_func = MAKE_SYMBOL(readFuncStdin, readerFunc);
     DLC_SYMBOL(destructReaderFunc) destruct = MAKE_SYMBOL(destructStdin, destructReaderFunc);
-    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString), error);
+    af_Parser *parser = makeParser(read_func, destruct, sizeof(struct readerDataString));
     initParser(parser);
     FREE_SYMBOL(read_func);
     FREE_SYMBOL(destruct);

+ 2 - 6
src/core/syntactic.c

@@ -5,16 +5,12 @@
 #include "parserl_warning_error.h"
 
 static void printSyntacticError(char *info, af_Parser *parser) {
-    if (parser->error == NULL)
-        return;
-    fprintf(parser->error, "[Syntactic-Error] %s\n", info);
+    writeErrorLog(aFunCoreLogger, "[Syntactic] %s", info);
     parser->is_error = true;
 }
 
 static void printSyntacticWarning(char *info, af_Parser *parser) {
-    if (parser->error == NULL)
-        return;
-    fprintf(parser->error, "[Syntactic-Warning] %s\n", info);
+    writeWarningLog(aFunCoreLogger, "[Syntactic] %s", info);
 }
 
 static bool getToken(af_Parser *parser) {

+ 3 - 3
src/main.c

@@ -61,7 +61,7 @@ int main(int argc, char **argv) {
         return EXIT_FAILURE;
 
     char *log = strJoin(base_name, SEP aFunLogDir SEP, false, false);
-    bool re = aFunInit(log, log_pc_w, &main_buf, log_debug);
+    bool re = aFunInit(log, log_pc_all, &main_buf, log_debug);
     free(log);
 
     if (!re) {
@@ -165,7 +165,7 @@ static int mainRun(ff_FFlags *ff) {
     }
 
     af_Environment *env = creatAFunEnviroment(argc - 1, argv + 1);
-    exit_code = runCodeFromFile(argv[0], stderr, true, 0, env);
+    exit_code = runCodeFromFile(argv[0], true, 0, env);
     destructAFunEnvironment(env);
     return exit_code;
 }
@@ -251,7 +251,7 @@ static int mainCL(ff_FFlags *ff) {
     if (command_line && isCoreExit(env) != 1) {
         printWelcomeInfo();
         do
-            exit_code = runCodeFromStdin("stdin", stderr, env);
+            exit_code = runCodeFromStdin("stdin", env);
         while (isCoreExit(env) != 1);
     }
 

+ 1 - 1
src/main_build.c

@@ -18,7 +18,7 @@ int buildFileOutput(FilePath out, FilePath in, bool force) {
     }
 
     writeErrorLog(aFunlangLogger, "File (%s) will be build. (%s)", in, out);
-    return buildFile(out, in, stderr);
+    return buildFile(out, in);
 }
 
 int buildFileToPath(FilePath path, FilePath in, bool force) {

+ 4 - 4
src/main_run.c

@@ -65,16 +65,16 @@ int runCodeFromRunList(RunList *run_list, RunList **bak, bool save_afb, af_Envir
         int mode = run_list->import ? 1 : 0;
         switch (run_list->type) {
             case rl_string:
-                exit_code = runCodeFromString(run_list->string, "command-line-eval", stderr, mode, env);
+                exit_code = runCodeFromString(run_list->string, "command-line-eval", mode, env);
                 break;
             case rl_file:
-                exit_code = runCodeFromFile(run_list->file, stderr, save_afb, mode, env);
+                exit_code = runCodeFromFile(run_list->file, save_afb, mode, env);
                 break;
             case rl_file_b:
-                exit_code = runCodeFromFileByte(run_list->file, stderr, mode, env);
+                exit_code = runCodeFromFileByte(run_list->file, mode, env);
                 break;
             case rl_file_s:
-                exit_code = runCodeFromFileSource(run_list->file, stderr, save_afb, NULL, mode, env);
+                exit_code = runCodeFromFileSource(run_list->file, save_afb, NULL, mode, env);
                 break;
             default:
                 break;

+ 26 - 42
src/runtime/aFunlang.c

@@ -2,7 +2,7 @@
 #include "__aFunlang.h"
 #include "__env.h"
 
-static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_path, FILE *error_file, af_Environment *env);
+static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_path, af_Environment *env);
 static bool aFunInit_mark = false;
 
 bool aFunInit(char *log_dir, LogFactoryPrintConsole print_console, jmp_buf *buf, LogLevel level) {
@@ -51,7 +51,7 @@ void destructAFunEnvironment(af_Environment *env) {
     freeEnvironment(env);
 }
 
-static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_path, FILE *error_file, af_Environment *env){
+static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_path, af_Environment *env){
     if (parser == NULL)
         return -1;
 
@@ -64,7 +64,7 @@ static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_pa
     if (save_path != NULL) {
         int res = writeByteCode(bt_code, save_path);
         if (res != 1)
-            fprintf(error_file, "Save aFun Bytecode file error [%s] [save at %s].\n", writeByteCodeError[res], save_path);
+            writeErrorLog(aFunCoreLogger, "Save aFun Bytecode file error [%s] [save at %s].", writeByteCodeError[res], save_path);
     }
 
     bool res = iterCode(bt_code, mode, env);
@@ -79,33 +79,28 @@ static int runCode_(FilePath name, af_Parser *parser, int mode, FilePath save_pa
  * 函数名: runCodeFromString
  * 目标: 运行字符串中的程序 (源码形式)
  */
-int runCodeFromString(char *code, char *string_name, FILE *error_file, int mode, af_Environment *env){
+int runCodeFromString(char *code, char *string_name, int mode, af_Environment *env){
     if (env == NULL || code == NULL || !aFunInit_mark)
         return -1;
 
     if (string_name == NULL)
         string_name = "string-code.aun";
 
-    if (error_file == NULL)
-        error_file = stderr;
-    af_Parser *parser = makeParserByString(code, false, error_file);
-    return runCode_(string_name, parser, mode, NULL, error_file, env);
+    af_Parser *parser = makeParserByString(code, false);
+    return runCode_(string_name, parser, mode, NULL, env);
 }
 
 /*
  * 函数名: runCodeFromFileSource
  * 目标: 运行文件中的程序 (源码形式)
  */
-int runCodeFromFileSource(FilePath file, FILE *error_file, bool save_afb, FilePath save_path, int mode, af_Environment *env){
+int runCodeFromFileSource(FilePath file, bool save_afb, FilePath save_path, int mode, af_Environment *env){
     if (env == NULL || file == NULL || !aFunInit_mark)
         return -1;
 
-    if (error_file == NULL)
-        error_file = stderr;
-
     char *sufix = getFileSurfix(file);
     if (sufix == NULL || !EQ_STR(".aun", sufix)) {
-        fprintf(error_file, "Is not .aun file[%s].\n", (sufix == NULL ? "" : sufix));
+        writeErrorLog(aFunCoreLogger, "Is not .aun file[%s].", (sufix == NULL ? "" : sufix));
         return -2;
     }
 
@@ -118,8 +113,8 @@ int runCodeFromFileSource(FilePath file, FILE *error_file, bool save_afb, FilePa
     } else if (!save_afb)
         save_path = NULL;
 
-    af_Parser *parser = makeParserByFile(file, error_file);
-    int exit_code = runCode_(file, parser, mode, save_path, error_file, env);
+    af_Parser *parser = makeParserByFile(file);
+    int exit_code = runCode_(file, parser, mode, save_path, env);
     if (free_save_path)
         free(save_path);
     return exit_code;
@@ -129,17 +124,15 @@ int runCodeFromFileSource(FilePath file, FILE *error_file, bool save_afb, FilePa
  * 函数名: runCodeFromStdin
  * 目标: 运行stdin的程序 (源码形式)
  */
-int runCodeFromStdin(char *name, FILE *error_file, af_Environment *env) {
+int runCodeFromStdin(char *name, af_Environment *env){
     if (env == NULL || feof(stdin) || ferror(stdin) || !aFunInit_mark)
         return -1;
 
     if (name == NULL)
         name = "sys-stdin.aun";
 
-    if (error_file == NULL)
-        error_file = stderr;
-    af_Parser *parser = makeParserByStdin(error_file);
-    return runCode_(name, parser, 0, NULL, error_file, env);
+    af_Parser *parser = makeParserByStdin();
+    return runCode_(name, parser, 0, NULL, env);
 }
 
 /*
@@ -160,23 +153,20 @@ int runCodeFromMemory(af_Code *code, int mode, af_Environment *env){
  * 函数名: runCodeFromFileByte
  * 目标: 运行文件中的程序 (字节码形式)
  */
-int runCodeFromFileByte(FilePath file, FILE *error_file, int mode, af_Environment *env){
+int runCodeFromFileByte(FilePath file, int mode, af_Environment *env){
     if (env == NULL || file == NULL || !aFunInit_mark)
         return -1;
 
-    if (error_file == NULL)
-        error_file = stderr;
-
     char *sufix = getFileSurfix(file);
     if (sufix == NULL || !EQ_STR(".aub", sufix)) {
-        fprintf(error_file, "Is not .aub file[%s].\n", (sufix == NULL ? "" : sufix));
+        writeErrorLog(aFunCoreLogger, "Is not .aub file[%s].", (sufix == NULL ? "" : sufix));
         return -2;
     }
 
     af_Code *code = NULL;
     int res = readByteCode(&code, file);
     if(res != 1) {
-        fprintf(error_file, "Load bytecode file error [%s] [Load at %s].\n", readByteCodeError[res], file);
+        writeErrorLog(aFunCoreLogger, "Load bytecode file error [%s] [Load at %s].", readByteCodeError[res], file);
         return -2;
     }
 
@@ -189,16 +179,13 @@ int runCodeFromFileByte(FilePath file, FILE *error_file, int mode, af_Environmen
  * 函数名: runCodeFromFileByte
  * 目标: 运行文件中的程序 (字节码/源码形式)
  */
-int runCodeFromFile(FilePath file, FILE *error_file, bool save_afb, int mode, af_Environment *env){
+int runCodeFromFile(FilePath file, bool save_afb, int mode, af_Environment *env){
     if (env == NULL || file == NULL || !aFunInit_mark)
         return -1;
 
-    if (error_file == NULL)
-        error_file = stderr;
-
     char *sufix = getFileSurfix(file);
     if (sufix != NULL && !EQ_STR(".aun", sufix) && !EQ_STR(".aub", sufix)) {  // 不是源文件, 字节码文件或无后缀文件
-        fprintf(error_file, "Is not .aun/.aub file[%s].\n", sufix);
+        writeErrorLog(aFunCoreLogger, "Is not .aun/.aub file[%s].", sufix);
         return -2;
     }
 
@@ -210,7 +197,7 @@ int runCodeFromFile(FilePath file, FILE *error_file, bool save_afb, int mode, af
     time_t time_2 = getFileMTime(path_2);
 
     if (time_1 == 0 && time_2 == 0) {
-        fprintf(error_file, "File not exists [%s].\n", file);
+        writeErrorLog(aFunCoreLogger, "File not exists [%s].", file);
         free(path_1);
         free(path_2);
         return -3;
@@ -218,12 +205,12 @@ int runCodeFromFile(FilePath file, FILE *error_file, bool save_afb, int mode, af
 
     int exit_code;
     if (time_2 >= time_1) {
-        exit_code = runCodeFromFileByte(path_2, error_file, mode, env);
+        exit_code = runCodeFromFileByte(path_2, mode, env);
         if (exit_code != 0)
             goto RUN_SOURCE_CODE;
     } else {
 RUN_SOURCE_CODE:
-        exit_code = runCodeFromFileSource(path_1, error_file, save_afb, path_2, mode, env);
+        exit_code = runCodeFromFileSource(path_1, save_afb, path_2, mode, env);
     }
 
     free(path_1);
@@ -235,26 +222,23 @@ RUN_SOURCE_CODE:
  * 函数名: buildFile
  * 目标: 生成字节码文件
  */
-int buildFile(FilePath out, FilePath in, FILE *error_file) {
+int buildFile(FilePath out, FilePath in){
     if (out == NULL || in == NULL || !aFunInit_mark)
         return -1;
 
-    if (error_file == NULL)
-        error_file = stderr;
-
     char *suffix_in = getFileSurfix(in);
     char *suffix_out = getFileSurfix(out);
     if (suffix_in == NULL || !EQ_STR(".aun", suffix_in)) {  // 不是源文件
-        fprintf(error_file, "Input file is not .aun file[%s].\n", (suffix_in == NULL ? "" : suffix_in));
+        writeErrorLog(aFunCoreLogger, "Input file is not .aun file[%s].", (suffix_in == NULL ? "" : suffix_in));
         return -2;
     }
 
     if (suffix_out == NULL || !EQ_STR(".aub", suffix_out)) {  // 不是字节码文件
-        fprintf(error_file, "Output file is not .aub file[%s].\n", (suffix_out == NULL ? "" : suffix_out));
+        writeErrorLog(aFunCoreLogger, "Output file is not .aub file[%s].", (suffix_out == NULL ? "" : suffix_out));
         return -2;
     }
 
-    af_Parser *parser = makeParserByFile(in, error_file);
+    af_Parser *parser = makeParserByFile(in);
     af_Code *code = parserCode(in, parser);
     freeParser(parser);
     if (code == NULL)
@@ -264,7 +248,7 @@ int buildFile(FilePath out, FilePath in, FILE *error_file) {
     freeAllCode(code);
 
     if (res != 1) {
-        fprintf(error_file, "Build error [%s] [Build %s].\n", writeByteCodeError[res], in);
+        writeErrorLog(aFunCoreLogger, "Build error [%s] [Build %s].", writeByteCodeError[res], in);
         return -3;
     }
 

+ 2 - 2
src/tool/log.c

@@ -165,10 +165,10 @@ static int writeLog_(Logger *logger, LogLevel level, char *file, int line, char
     switch (log_factory.print_console) {
         case log_pc_all:
             if (level < log_warning) {
-                fprintf(stdout, FORMAT, LogLevelNameLong[level], logger->id, tid, ti, t, file, line, func, tmp);
+                fprintf(stdout, FORMAT_SHORT, LogLevelNameLong[level], logger->id, tmp);
                 fflush(stdout);
             } else if (log_factory.print_console) {
-                fprintf(stderr, FORMAT, LogLevelNameLong[level], logger->id, tid, ti, t, file, line, func, tmp);
+                fprintf(stderr, FORMAT_SHORT, LogLevelNameLong[level], logger->id, tmp);
                 fflush(stderr);
             }
             break;

+ 1 - 1
test/src/lexical.c

@@ -19,7 +19,7 @@ char *str = "Hello_var\n"
             ";= var-300\n";
 
 int main() {
-    af_Parser *parser = makeParserByString(str, false, stderr);
+    af_Parser *parser = makeParserByString(str, false);
     af_TokenType tt;
     char *text = NULL;
 

+ 1 - 1
test/src/run_code.c

@@ -1155,7 +1155,7 @@ int main(int argc, char **argv) {
 
     {
         printf("TAG S: STRING\n");
-        int exit_code = runCodeFromString("object\ndata\n{func}\nglobal\n", "Tags-string.aun", NULL, 1, env);
+        int exit_code = runCodeFromString("object\ndata\n{func}\nglobal\n", "Tags-string.aun", 1, env);
         printf("exit code = %d\n\n", exit_code);
     }
 

+ 2 - 2
test/src/syntactic.c

@@ -20,7 +20,7 @@ int main() {
 }
 
 void test1(void) {
-    af_Parser *parser = makeParserByString(str, false, stderr);
+    af_Parser *parser = makeParserByString(str, false);
     af_Code *code = parserCode("test1.aun", parser);
     freeParser(parser);
     freeAllCode(code);
@@ -40,7 +40,7 @@ void test2(void) {
     }
     fclose(file);
 
-    af_Parser *parser = makeParserByFile(path, stderr);
+    af_Parser *parser = makeParserByFile(path);
     af_Code *code = parserCode("test2.aun", parser);
     printCode(code);
     freeParser(parser);