Browse Source

feat: 提取src函数 简化VirtualMathCore核心

SongZihuan 4 năm trước cách đây
mục cha
commit
79e2e744dc

+ 2 - 1
CMakeLists.txt

@@ -5,10 +5,11 @@ SET(CMAKE_C_STANDARD 11)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/VirtulMathCore/include)
 
+AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src SRC_LIST)
 AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/argument ARGUMENT_LIST)
 
 MESSAGE("project dir is ${PROJECT_SOURCE_DIR}")
 
 ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/VirtulMathCore)
-ADD_EXECUTABLE(VirtualMath main.c ${ARGUMENT_LIST})
+ADD_EXECUTABLE(VirtualMath main.c ${SRC_LIST} ${ARGUMENT_LIST})
 TARGET_LINK_LIBRARIES(VirtualMath VirtualMathCore)

+ 1 - 0
VirtulMathCore/include/run.h

@@ -78,4 +78,5 @@ ResultType listDel(Statement *name, INTER_FUNCTIONSIG_NOT_ST);
 ResultType varDel(Statement *name, bool check_aut, INTER_FUNCTIONSIG_NOT_ST);
 ResultType pointDel(Statement *name, INTER_FUNCTIONSIG_NOT_ST);
 ResultType downDel(Statement *name, INTER_FUNCTIONSIG_NOT_ST);
+bool is_quitExc(LinkValue *value, Inter *inter);
 #endif //VIRTUALMATH_RUN_H

+ 2 - 0
VirtulMathCore/include/virtualmath.h

@@ -9,6 +9,8 @@
 #include "gc.h"
 #include "value.h"
 #include "parameter.h"
+#include "statement.h"
+#include "grammar.h"
 #include "inter.h"
 #include "run.h"
 

+ 0 - 4
VirtulMathCore/src/__run.c

@@ -349,10 +349,6 @@ bool is_iterStop(LinkValue *value, Inter *inter) {
     return value->value == inter->data.iterstop_exc || checkAttribution(value->value, inter->data.iterstop_exc);
 }
 
-bool is_quitExc(LinkValue *value, Inter *inter) {
-    return value->value == inter->data.quit_exc || checkAttribution(value->value, inter->data.quit_exc);
-}
-
 bool checkAut(enum ValueAuthority value, enum ValueAuthority base, fline line, char *file, char *name, bool pri_auto, INTER_FUNCTIONSIG_NOT_ST) {
     if ((value == public_aut || (!pri_auto && value == auto_aut)) && (base != public_aut && base != auto_aut)) {
         if (name == NULL)

+ 0 - 1
VirtulMathCore/src/include/__run.h

@@ -33,6 +33,5 @@ ResultType getIter(LinkValue *value, int status, fline line, char *file, INTER_F
 bool checkBool(LinkValue *value, fline line, char *file, INTER_FUNCTIONSIG_NOT_ST);
 char *getRepoStr(LinkValue *value, bool is_repot, fline line, char *file, INTER_FUNCTIONSIG_NOT_ST);
 bool is_iterStop(LinkValue *value, Inter *inter);
-bool is_quitExc(LinkValue *value, Inter *inter);
 bool checkAut(enum ValueAuthority value, enum ValueAuthority base, fline line, char *file, char *name, bool pri_auto, INTER_FUNCTIONSIG_NOT_ST);
 #endif //VIRTUALMATH___RUN_H

+ 4 - 0
VirtulMathCore/src/run.c

@@ -319,3 +319,7 @@ Statement *checkLabel(Statement *base, char *label){
             return base;
     return NULL;
 }
+
+bool is_quitExc(LinkValue *value, Inter *inter) {
+    return value->value == inter->data.quit_exc || checkAttribution(value->value, inter->data.quit_exc);
+}

+ 1 - 1
VirtulMathCore/src/virtualmath.c → src/virtualmath.c

@@ -1,4 +1,4 @@
-#include "__run.h"
+#include "hellovm.h"
 
 void runCodeFile(Inter *inter, char *file[]) {
     Statement *pst = NULL;