From 4b721332d570f53719894af922c22b7cba146b18 Mon Sep 17 00:00:00 2001 From: Soikk Date: Sat, 13 Aug 2022 18:49:30 +0200 Subject: Added primitive repl, delete functions for database and remove tag from file function. --- include/parser.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'include/parser.h') diff --git a/include/parser.h b/include/parser.h index 2e46967..6b68b48 100644 --- a/include/parser.h +++ b/include/parser.h @@ -4,14 +4,34 @@ #include "db.h" -typedef enum { +#define NKEYWORDS 16 +#define EXIT_CODE 1 + +typedef enum{ + COMMAND_EXIT, COMMAND_DEBUG, + COMMAND_CREATE, COMMAND_DELETE, COMMAND_OPEN, COMMAND_SAVE, COMMAND_CLOSE, + COMMAND_ADDF, COMMAND_ADDT, COMMAND_DELETEF, COMMAND_DELETET, + COMMAND_TAG, COMMAND_REMOVE, + COMMAND_SHOW, COMMAND_SHOWT, COMMAND_SHOWF, +} COMMANDS; + +typedef enum{ META_COMMAND_SUCCESS, META_COMMAND_FAIL, } metaCommandStatus; +typedef struct{ + uint64_t argc; + char **argv; +} argList; + + +argList *newArgList(void); + +argList *splitInput(inputBuffer *in); int handleMetaCommand(inputBuffer *in); -int handleInput(inputBuffer *in); +int handleInput(argList *args, database **db); -#endif \ No newline at end of file +#endif -- cgit v1.2.3