]> Nishi Git Mirror - dataworks.git/commitdiff
making it work (kinda)
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 05:37:22 +0000 (05:37 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 05:37:22 +0000 (05:37 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@72 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/main.c
Library/dw_database.h
Library/dw_parser.h
Library/parser.c

index e16e813172ae3a233b218a3684e1203a3db57a9c..f00043347df2ca139f4dfa7c3d4ce66807e77537 100644 (file)
 /* --- END LICENSE --- */
 
 #include <dataworks.h>
+
 #include <dw_database.h>
 #include <dw_util.h>
+#include <dw_parser.h>
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -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);
index eaf23b1e9e97d91750cfe0fd2f323560e5b13e60..d77ff097eb20f01e9601e90668235cf7acbcf117 100644 (file)
@@ -44,12 +44,6 @@ extern "C" {
 #include <stdint.h>
 #include <stdio.h>
 
-#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;
index d734e61f5d8cba3e94901cc2d569069b36dede55..8674f8ff00bbf8bf0217000889e78457d301b132 100644 (file)
 extern "C" {
 #endif
 
+#include <stdbool.h>
+
+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
index 98653289b41fdb8203ef1ddff81c2516c4df0344..162c66cebe3a1829b3825974827a25d4e489481e 100644 (file)
 /* OF SUCH DAMAGE.                                                            */
 /* -------------------------------------------------------------------------- */
 /* --- END LICENSE --- */
+
+#include "dw_parser.h"
+
+#include <stddef.h>
+
+struct __dw_token* __dw_parser_parse(const char* str){
+       return NULL;
+}