From: nishi Date: Wed, 22 May 2024 05:37:22 +0000 (+0000) Subject: making it work (kinda) X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=6ebe99e0adb6829b2b7bd8b32b4b53978df5541d;p=dataworks.git making it work (kinda) git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@72 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/Client/main.c b/Client/main.c index e16e813..f000433 100644 --- a/Client/main.c +++ b/Client/main.c @@ -27,8 +27,10 @@ /* --- END LICENSE --- */ #include + #include #include +#include #include #include @@ -176,6 +178,12 @@ int main(int argc, char** argv) { } else { printf("Unknown dot-command.\n"); } + }else if(strlen(buf) > 0){ + struct __dw_token* token = __dw_parser_parse(buf); + if(token != NULL){ + }else{ + printf("Parser returned NULL. Help!\n"); + } } printf("%c ", prompt); fflush(stdout); diff --git a/Library/dw_database.h b/Library/dw_database.h index eaf23b1..d77ff09 100644 --- a/Library/dw_database.h +++ b/Library/dw_database.h @@ -44,12 +44,6 @@ extern "C" { #include #include -#ifdef __WATCOMC__ -#define PACKED _Packed -#else -#define PACKED __attribute__((__packed__)) -#endif - #define __dw_buffer_to_db_v1_indexentry(buf, index) \ memcpy(&index.flag, buf, 1); \ uint64_t be_count; \ @@ -145,11 +139,10 @@ struct dataworks_db { /** * @~english - * @brief indexentry for v1 database. + * @brief `indexentry` for v1 database. * @note See \ref FORMATv1 for more info. * */ -PACKED struct dataworks_db_v1_indexentry { uint8_t flag; uint64_t count; @@ -168,11 +161,10 @@ struct dataworks_db_v1_indexentry { /** * @~english - * @brief infoentry for database. + * @brief `infoentry` for database. * @note See \ref FORMATv1 for more info. * */ -PACKED struct dataworks_db_infoentry { uint16_t version; uint64_t mtime; diff --git a/Library/dw_parser.h b/Library/dw_parser.h index d734e61..8674f8f 100644 --- a/Library/dw_parser.h +++ b/Library/dw_parser.h @@ -40,6 +40,23 @@ extern "C" { #endif +#include + +enum __token { + METHOD = 0, + VALUE +}; + +struct __dw_token { + char* name; + int type; + bool error; + int errnum; + struct __dw_token* token; +}; + +struct __dw_token* __dw_parser_parse(const char* str); + #ifdef __cplusplus } #endif diff --git a/Library/parser.c b/Library/parser.c index 9865328..162c66c 100644 --- a/Library/parser.c +++ b/Library/parser.c @@ -25,3 +25,11 @@ /* OF SUCH DAMAGE. */ /* -------------------------------------------------------------------------- */ /* --- END LICENSE --- */ + +#include "dw_parser.h" + +#include + +struct __dw_token* __dw_parser_parse(const char* str){ + return NULL; +}