From: nishi Date: Wed, 5 Jun 2024 05:12:05 +0000 (+0000) Subject: return bool X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=55b95abcff4430a054aa32cf4254ff739a9dfd52;p=dataworks.git return bool git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@155 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/Library/dw_parser.h b/Library/dw_parser.h index 2476fae..aa1c21b 100644 --- a/Library/dw_parser.h +++ b/Library/dw_parser.h @@ -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 } diff --git a/Library/exec.c b/Library/exec.c index 30d88a2..67127d5 100644 --- a/Library/exec.c +++ b/Library/exec.c @@ -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; diff --git a/Library/parser.c b/Library/parser.c index 10ba29f..70bdbfa 100644 --- a/Library/parser.c +++ b/Library/parser.c @@ -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; }