#ifndef ARC_STD_PARSER_CHEMICAL_H_ #define ARC_STD_PARSER_CHEMICAL_H_ #ifdef __cplusplus extern "C" { #endif #include #include "arc/std/parser.h" /* * TODO: note here in header that this uses parser * TODO: note here in header that group being used is persistant * TODO: add allowance for any symbol in string? -> | | -> OPEN_CURLY_BRACE CLOSE_CURLY_BRACE -> EQUAL value SEMICOLON -> -> -> | | -> OPEN_CURLY_BRACE CLOSE_CURLY_BRACE -> | COMMA -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | UNDERSCORE -> | LAMBDA -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | UNDERSCORE | NUMBER -> QUOTE QUOTE -> | | LAMBDA -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | NUMBER | WHITESPACE | UNDERSCORE | OPEN_CURLY_BRACE | CLOSE_CURLY_BRACE | OPEN_PAREN | CLOSE_PAREN | BANG | HASH | DOLLER | PERCENT | AMPERSAND | SINGLE_QUOTE | ASTERISK | PLUS | COMMA | MINUS | PERIOD | SHASH | COLON | SEMICOLON | QUESTION_MARK | AT | OPEN_BRACKET | CLOSE_BRACKET | CARET | GRAVE | VERTICAL_LINE | TILDE -> LESS_THAN | EQUAL | GREATER_THAN -> BACKSLASH BACKSLASH | BACKSLASH QUOTE BACKSLASH ALPHA_UPPER_CHAR | BACKSLASH ALPHA_LOWER_CHAR -> NUMBER | NUMBER LAMBDA -> SPACE | TAB | NEWLINE | LAMBDA */ /** * @brief a function to read a key from string to a ARC_ConfigTypeTemplate * * @param config ARC_Config to store data to * @param string ARC_String of data that is being read in * @param value value that is read in * * @note use ARC_Config_StoreValue(ARC_Config *config, ARC_String *name, void *value); to store a value to the config * if there is an error, set arc_errno * * @return 0 if value not a reference, 1 if value is a reference */ //typedef uint8_t (* ARC_ConfigKeyRead)(ARC_Config* config, ARC_String *string, void **value); /** * @brief a function to delete a value from a key in ARC_Config * * @param config ARC_Config that can be used to check for references in data * @param value pointer of data to be deleted * * @note this function can be NULL if memory does not need to be cleaned for this type * if there is an error, set arc_errno */ //typedef void (* ARC_ConfigKeyDelete)(ARC_Config* config, ARC_String *string, void *value); /** * @brief TODO: write this */ typedef struct ARC_Chemical ARC_Chemical; /** * @brief */ typedef void (* ARC_ChemicalType_CopyFn)(void **type, ARC_ParserTagToken *parsedData, ARC_Chemical *chemical); /** * @brief */ typedef void (* ARC_ChemicalType_DestroyFn)(void *type); /** * @brief */ typedef struct ARC_ChemicalType { ARC_ChemicalType_CopyFn copyFn; ARC_ChemicalType_DestroyFn destroyFn; } ARC_ChemicalType; /** * @brief TODO: write this */ void ARC_Chemical_Create(ARC_Chemical **chemical); /** * @brief TODO: write this */ void ARC_Chemical_Destroy(ARC_Chemical *chemical); /** * @brief TODO: write this */ void ARC_Chemical_RegisterType(ARC_Chemical *chemical, ARC_String *typeName, ARC_ChemicalType type); /** * @brief TODO: write this */ void ARC_Chemical_RegisterTypeWithCStr(ARC_Chemical *chemical, const char *typeNameCStr, ARC_ChemicalType type); /** * @brief sets current group in config * * @note ARC_Chemical_Get will use this set group * * @param[in] chemical ARC_Config we are setting current group in * @param[in] groupname name of group that will be set */ void ARC_Chemical_SetGroup(ARC_Chemical *chemical, ARC_String *groupName); /** * @brief get a value from a given keyname * * @note name may be prefaced with :: to specify group * * @param[in] chemical ARC_Chemical to get value from * @param[in] element name of a variable that has been read in * * @return the stored element on success, or NULL on failure */ void *ARC_Chemical_Get(ARC_Chemical *chemical, ARC_String *element); /** * @brief TODO: write this */ void ARC_Chemical_LoadFromString(ARC_String *path); /** * @brief TODO: write this */ void ARC_Chemical_LoadFromFile(ARC_String *path); /** * @brief TODO: write this */ void ARC_Chemical_UnloadFromString(ARC_String *data); /** * @brief TODO: write this */ void ARC_Chemical_UnloadFromFile(ARC_String *data); #ifdef __cplusplus } #endif #endif //ARC_STD_PARSER_CHEMICAL_H_