浏览代码

refactor: 调整文件结构

SongZihuan 3 年之前
父节点
当前提交
4711d4e14d

+ 1 - 1
include/runtime/aFunlang.h

@@ -3,7 +3,7 @@
 #include "aFunlangExport.h"
 #include "aFunCore.h"
 
-#include "aFun_tool.h"
+#include "runtime.h"
 
 AFUN_LANG_EXPORT void aFunInit();
 

+ 5 - 5
include/runtime/aFun_tool.h → include/runtime/runtime.h

@@ -1,5 +1,5 @@
-#ifndef AFUN_AFUN_TOOL_H
-#define AFUN_AFUN_TOOL_H
+#ifndef AFUN_RUNTIME_H
+#define AFUN_RUNTIME_H
 
 typedef struct APIFunc APIFunc;
 struct APIFunc {
@@ -49,8 +49,8 @@ struct TopMsgFunc {
     bool free_func_;  // func_是否需要释放
 };
 
-AFUN_LANG_EXPORT int aFunTool(char *name, af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env);
-AFUN_LANG_EXPORT int aFunToolImport(char *name, af_Object **obj, af_Code **code, af_Environment *env);
+AFUN_LANG_EXPORT int runtimeTool(char *name, af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env);
+AFUN_LANG_EXPORT int runtimeToolImport(char *name, af_Object **obj, af_Code **code, af_Environment *env);
 
 AFUN_LANG_EXPORT af_ObjectAPI *makeAPIFromList(const APIFunc api_list[]);
 AFUN_LANG_EXPORT void makeObjectFromList(const ObjectDefine obj_def[], af_Object *visitor, af_VarSpace *vs, af_Environment *env);
@@ -58,4 +58,4 @@ AFUN_LANG_EXPORT void makeLiteralRegexFromList(const LiteralFunc literal_list[],
 AFUN_LANG_EXPORT void makeTopMsgProcessFromList(const TopMsgFunc top_msg_list[], af_Environment *env);
 AFUN_LANG_EXPORT af_Inherit *makeInheritFromList(const InheritDefine inherit_list[], bool is_reverse);
 
-#endif //AFUN_AFUN_TOOL_H
+#endif //AFUN_RUNTIME_H

+ 2 - 2
src/runtime/CMakeLists.txt

@@ -4,7 +4,7 @@
 
 file(GLOB source_tool
      LIST_DIRECTORIES FALSE
-     ${CMAKE_CURRENT_LIST_DIR}/aFunTool/*/*.c)
+     ${CMAKE_CURRENT_LIST_DIR}/*/*.c)
 
 file(GLOB private_h
      LIST_DIRECTORIES FALSE
@@ -12,7 +12,7 @@ file(GLOB private_h
 
 file(GLOB private_tool_h
      LIST_DIRECTORIES FALSE
-     ${CMAKE_CURRENT_LIST_DIR}/aFunTool/*/*.h)
+     ${CMAKE_CURRENT_LIST_DIR}/*/*.h)
 
 file(GLOB private_h_core
      LIST_DIRECTORIES FALSE

+ 3 - 3
src/runtime/__aFun_tool.h → src/runtime/__runtime.h

@@ -1,7 +1,7 @@
-#ifndef AFUN_AFUN_TOOL_H_
-#define AFUN_AFUN_TOOL_H_
+#ifndef AFUN_RUNTIME_H_
+#define AFUN_RUNTIME_H_
 #include "aFunlang.h"
-#include "aFun_tool.h"
+#include "runtime.h"
 #include "__env.h"
 
 /*

+ 1 - 1
src/runtime/aFunlang.c

@@ -12,7 +12,7 @@ af_Environment *creatAFunEnviroment(void) {
     af_Environment *env = makeEnvironment(grt_count);
     af_Code *code;
 
-    aFunTool("base", &code, NULL, env->core->protect, env);
+    runtimeTool("base", &code, NULL, env->core->protect, env);
 
     if (code != NULL) {
         bool res = iterCode(code, 0, env);

+ 1 - 1
src/runtime/aFunTool/base/__base.h → src/runtime/base/__base.h

@@ -1,6 +1,6 @@
 #ifndef AFUN___BASE_H
 #define AFUN___BASE_H
-#include "__aFun_tool.h"
+#include "__runtime.h"
 #include "__env.h"
 #include "__var.h"
 

+ 1 - 1
src/runtime/aFunTool/base/base.c → src/runtime/base/base.c

@@ -1,7 +1,7 @@
 #include "__base.h"
 
 int aFunTool_base(af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env) {
-    printf("Run aFunTool-Base %p\n", vs);
+    printf("Run runtimeTool-Base %p\n", vs);
     makeLiteralRegexFromList(literal, env);
     makeStrFunc(visitor, vs, env);
     makeQuitFunc(visitor, vs, env);

+ 0 - 0
src/runtime/aFunTool/base/quit.c → src/runtime/base/quit.c


+ 0 - 0
src/runtime/aFunTool/base/str_obj.c → src/runtime/base/str_obj.c


+ 7 - 7
src/runtime/aFun_tool.c → src/runtime/runtime.c

@@ -1,6 +1,6 @@
-#include "__aFun_tool.h"
+#include "__runtime.h"
 #include "__global_obj.h"
-#include "__rt_tool.h"
+#include "runtime_tool.h"
 
 /* 数组为只读的内容 */
 static const ToolFunc global_tool_list[] = {
@@ -9,12 +9,12 @@ static const ToolFunc global_tool_list[] = {
 };
 
 /*
- * 函数名: aFunTool
+ * 函数名: runtimeTool
  * 目标: 调用指定内置包(tool)
  * 返回 (0)   执行正常
  * 返回 (1)  库不存在
  */
-int aFunTool(char *name, af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env) {
+int runtimeTool(char *name, af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env) {
     if (name == NULL || code == NULL || env == NULL || vs == NULL)
         return 1;
     *code = NULL;
@@ -30,14 +30,14 @@ int aFunTool(char *name, af_Code **code, af_Object *visitor, af_VarSpace *vs, af
 }
 
 /*
- * 函数名: aFunTool
+ * 函数名: runtimeToolImport
  * 目标: 生成vs, 调用指定内置包(tool)
  */
-int aFunToolImport(char *name, af_Object **obj, af_Code **code, af_Environment *env) {
+int runtimeToolImport(char *name, af_Object **obj, af_Code **code, af_Environment *env) {
     if (name == NULL || code == NULL || env == NULL || obj == NULL)
         return 1;
     *obj = makeGlobalObject(env);
-    return aFunTool(name, code, *obj, (*obj)->data->var_space, env);
+    return runtimeTool(name, code, *obj, (*obj)->data->var_space, env);
 }
 
 /*

+ 3 - 3
src/runtime/__rt_tool.h → src/runtime/runtime_tool.h

@@ -1,6 +1,6 @@
-#ifndef AFUN___RT_TOOL_H
-#define AFUN___RT_TOOL_H
+#ifndef AFUN_RUNTIME_TOOL_H
+#define AFUN_RUNTIME_TOOL_H
 
 AFUN_LANG_NO_EXPORT int aFunTool_base(af_Code **code, af_Object *visitor, af_VarSpace *vs, af_Environment *env);
 
-#endif //AFUN___RT_TOOL_H
+#endif //AFUN_RUNTIME_TOOL_H