Explorar o código

fix: 修改了宽字符常量的定义

原本的定义为:``(wchar_t *)L"宽字符串"``
现在定义为:``L"宽字符串"``

link #8
SongZihuan %!s(int64=4) %!d(string=hai) anos
pai
achega
1f0a7d9c42

+ 1 - 1
VirtulMathCore/include/syntax.h

@@ -1,7 +1,7 @@
 #ifndef VIRTUALMATH_SYNTAX_H
 #define VIRTUALMATH_SYNTAX_H
 
-#define strMatherMacro(n, word) strMather(p, mathers->mathers[n], (wchar_t *)L##word) /*这个宏只能用于getMatherStatus*/
+#define strMatherMacro(n, word) strMather(p, mathers->mathers[n], L##word) /*这个宏只能用于getMatherStatus*/
 #define charMatherMacro(n, word) charMather(p, mathers->mathers[n], word) /*这个宏只能用于getMatherStatus*/
 
 void numberMather(wint_t p, LexMather *mather);

+ 1 - 1
VirtulMathCore/ofunc/src/dict.c

@@ -199,7 +199,7 @@ ResultType dictRepoStrCore(OFFICAL_FUNCTIONSIG, bool is_repo){
     }
 
     setBoolAttrible(true, is_repo ? "repo_again" : "str_again", 0, "dict.repo", ap[0].value, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-    repo = memWidecpy((const wchar_t *) L"{");
+    repo = memWidecpy(L"{");
     for (int i = 0, count = 0; i < MAX_SIZE; i++) {
         for (Var *var = value->data.dict.dict->hashtable[i]; var != NULL; var = var->next, count++) {
             wchar_t *name_tmp;

+ 1 - 1
VirtulMathCore/ofunc/src/io.c

@@ -34,7 +34,7 @@ ResultType vm_input(OFFICAL_FUNCTIONSIG){
     setResultCore(result);
     ArgumentParser ap[] = {{.type=name_value, .name="message", .must=0, .value=NULL},
                            {.must=-1}};
-    wchar_t *str = memWidecpy((wchar_t *) L"\0");
+    wchar_t *str = memWidecpy(L"\0");
     wint_t ch;
     parserArgumentUnion(ap, arg, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     if (!CHECK_RESULT(result))

+ 1 - 1
VirtulMathCore/ofunc/src/object.c

@@ -58,7 +58,7 @@ ResultType objectRepoStrCore(OFFICAL_FUNCTIONSIG, bool is_repo){
             type = L"object";
         len = memWidelen(name) + 30;
         repo = memCalloc(len, sizeof(char ));
-        swprintf(repo, len, (const wchar_t *) L"(%ls: %ls on %p)", type, name, ap[0].value->value);
+        swprintf(repo, len, L"(%ls: %ls on %p)", type, name, ap[0].value->value);
     }
 
     makeStringValue(repo, 0, "object.repo", CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));

+ 4 - 4
VirtulMathCore/src/inter.c

@@ -359,11 +359,11 @@ void printHashTableGC(char *tag, Inter *inter, long *tmp_link) {
 void printToken(Token *tk) {
     if (tk->token_type >= 0) {
         wchar_t *tmp = tk->data.str, *second_tmp = tk->data.second_str;
-        if (eqWide(tmp, (wchar_t *)L"\n"))
-            tmp = (wchar_t *) L"\\n";
-        if (eqWide(second_tmp, (wchar_t *)L"\n"))
+        if (eqWide(tmp,  L"\n"))
+            tmp = L"\\n";
+        if (eqWide(second_tmp, L"\n"))
             second_tmp = (wchar_t *)L"\\n";
-        wprintf((wchar_t *)L"<token str = ('%ls','%ls'), type = %d>", tmp, second_tmp, tk->token_type);
+        printf("<token str = ('%ls','%ls'), type = %d>", tmp, second_tmp, tk->token_type);
     }
     else
         printf("<token statement, type = %d>", tk->token_type);

+ 2 - 2
VirtulMathCore/src/runoperation.c

@@ -437,7 +437,7 @@ ResultType getBaseValue(INTER_FUNCTIONSIG) {
         gc_addTmpLink(&result->value->gc_status);
     }
     else
-        switch (st->u.base_value.type){
+        switch (st->u.base_value.type) {
             case number_str:
                 makeNumberValue(wcstoll(st->u.base_value.str, NULL, 10), st->line, st->code_file, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
                 break;
@@ -483,7 +483,7 @@ ResultType getDict(INTER_FUNCTIONSIG) {
 
     setResultCore(result);
     at = getArgument(st->u.base_dict.dict, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-    if (!CHECK_RESULT(result)){
+    if (!CHECK_RESULT(result)) {
         freeArgument(at, false);
         return result->type;
     }