]> Nishi Git Mirror - dataworks.git/commitdiff
return bool
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 5 Jun 2024 05:12:05 +0000 (05:12 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 5 Jun 2024 05:12:05 +0000 (05:12 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@155 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Library/dw_parser.h
Library/exec.c
Library/parser.c

index 2476faef7702a95b155500bc86dd801776183899..aa1c21ba74b76415efa6200593bf4787c1323925 100644 (file)
@@ -48,7 +48,7 @@ struct Node* __dw_parser_parse(const char* str, bool top);
 struct Node* __dw_duplicate_node(struct Node* node);
 void __dw_free_node(struct Node* node);
 void __dw_free_node2(struct Node* node, bool top);
-void __dw_print_node(struct Node* node, bool top);
+bool __dw_print_node(struct Node* node, bool top);
 
 #ifdef __cplusplus
 }
index 30d88a24732c92c0c14ddc29c153ddfbabcbad8a..67127d50c2a68c908d10b5f111d8d7f13522ef16 100644 (file)
@@ -191,13 +191,13 @@ struct dataworks_db_result* dataworks_database_execute_code(struct dataworks_db*
                r->errnum = DW_ERR_PARSER_FAIL;
        } else {
                if(dolog) {
-                       __dw_print_node(node, true);
-                       printf("\n");
+                       bool pr = __dw_print_node(node, true);
+                       if(pr) printf("\n");
                }
                struct Node* ret = parser_process(db, node, dolog);
                if(ret->errnum == DW_ERR_SUCCESS) {
-                       __dw_print_node(ret, true);
-                       printf("\n");
+                       bool pr = __dw_print_node(ret, true);
+                       if(pr) printf("\n");
                } else {
                        r->error = true;
                        r->errnum = ret->errnum;
index 10ba29f348f9a2e7e5e9f6266120cce655224abe..70bdbfa6f34242e093bcda323d8558c0b62729ec 100644 (file)
@@ -98,13 +98,15 @@ void __dw_free_node2(struct Node* node, bool top) {
        if(!top) free(node);
 }
 
-void __dw_print_node(struct Node* node, bool top) {
+bool __dw_print_node(struct Node* node, bool top) {
        if(node->type == 'N') {
                printf("%f", node->number);
                fflush(stdout);
+               return true;
        } else if(node->string != NULL) {
                printf("\"%s\"", node->string);
                fflush(stdout);
+               return true;
        } else if(node->ident != NULL) {
                printf("%s(", node->ident);
                fflush(stdout);
@@ -120,5 +122,7 @@ void __dw_print_node(struct Node* node, bool top) {
                }
                printf(")");
                fflush(stdout);
+               return true;
        }
+       return false;
 }