diff --git a/build.bash b/build.bash index 783950d..7b84843 100755 --- a/build.bash +++ b/build.bash @@ -6,6 +6,7 @@ GCC_ARGUMENTS="-std=c11 -Wall" MODULES=( "core" + "json" ) # Arguments: diff --git a/core/exports/librr/runes.h b/core/exports/librr/runes.h index e9d1ce4..460d83c 100644 --- a/core/exports/librr/runes.h +++ b/core/exports/librr/runes.h @@ -4,6 +4,45 @@ #include +typedef enum +{ + RR_ASCII_EXCLAMATION_MARK, + RR_ASCII_DOUBLE_QUOTATION_MARK, + RR_ASCII_HASH_SIGN, + RR_ASCII_DOLLAR_SIGN, + RR_ASCII_PERCENT_SIGN, + RR_ASCII_AMPERSAND, + RR_ASCII_SINGLE_QUOTATION_MARK, + RR_ASCII_OPENING_PARENTHESIS, + RR_ASCII_CLOSING_PARENTHESIS, + RR_ASCII_ASTERISK, + RR_ASCII_PLUS, + RR_ASCII_COMMA, + RR_ASCII_MINUS, + RR_ASCII_POINT, + RR_ASCII_SLASH, + RR_ASCII_COLON, + RR_ASCII_SEMICOLON, + RR_ASCII_SMALLER_THAN, + RR_ASCII_EQUALS_SIGN, + RR_ASCII_BIGGER_THAN, + RR_ASCII_QUESTION_MARK, + RR_ASCII_AT_SIGN, + RR_ASCII_OPENING_SQUARE_BRACKET, + RR_ASCII_BACKSLASH, + RR_ASCII_CLOSING_SQUARE_BRACKET, + RR_ASCII_CIRCUMFLEX, + RR_ASCII_UNDERSCORE, + RR_ASCII_TICK, + RR_ASCII_OPENING_CURLY_BRACE, + RR_ASCII_VERTICAL_BAR, + RR_ASCII_CLOSING_CURLY_BRACE, + RR_ASCII_TILDE, + + RR_ASCII_NOT_A_SIGN + +} rr_ascii_sign_e; + /// @brief Extracts an UTF-8 rune at a given offset in a string and ADDS the length /// of the rune to the number pointed to by 'increase'. /// @param string The string to get the data from. For safety reasons, this should be null-terminated. @@ -49,4 +88,6 @@ bool_t rr_rune_is_digit(rune_t rune); /// @return Whether the rune is of one of the four ASCII sign ranges. bool_t rr_rune_is_ascii_special(rune_t rune); +rr_ascii_sign_e rr_rune_to_ascii_sign(rune_t rune); + #endif // LIBRR_RUNES_H diff --git a/core/src-c/runes.c b/core/src-c/runes.c index aea4930..bfa8fa6 100644 --- a/core/src-c/runes.c +++ b/core/src-c/runes.c @@ -171,3 +171,43 @@ bool_t rr_rune_is_ascii_special(rune_t rune) if(rr_rune_is_in_ascii_special_block_4(rune)) return TRUE; return FALSE; } + +rr_ascii_sign_e rr_rune_to_ascii_sign(rune_t rune) +{ + switch(rune) + { + case '!': return RR_ASCII_EXCLAMATION_MARK; + case '"': return RR_ASCII_DOUBLE_QUOTATION_MARK; + case '#': return RR_ASCII_HASH_SIGN; + case '$': return RR_ASCII_DOLLAR_SIGN; + case '%': return RR_ASCII_PERCENT_SIGN; + case '&': return RR_ASCII_AMPERSAND; + case '\'': return RR_ASCII_SINGLE_QUOTATION_MARK; + case '(': return RR_ASCII_OPENING_PARENTHESIS; + case ')': return RR_ASCII_CLOSING_PARENTHESIS; + case '*': return RR_ASCII_ASTERISK; + case '+': return RR_ASCII_PLUS; + case ',': return RR_ASCII_COMMA; + case '-': return RR_ASCII_MINUS; + case '.': return RR_ASCII_POINT; + case '/': return RR_ASCII_SLASH; + case ':': return RR_ASCII_COLON; + case ';': return RR_ASCII_SEMICOLON; + case '<': return RR_ASCII_SMALLER_THAN; + case '=': return RR_ASCII_EQUALS_SIGN; + case '>': return RR_ASCII_BIGGER_THAN; + case '?': return RR_ASCII_QUESTION_MARK; + case '@': return RR_ASCII_AT_SIGN; + case '[': return RR_ASCII_OPENING_SQUARE_BRACKET; + case '\\': return RR_ASCII_BACKSLASH; + case ']': return RR_ASCII_CLOSING_SQUARE_BRACKET; + case '^': return RR_ASCII_CIRCUMFLEX; + case '_': return RR_ASCII_UNDERSCORE; + case '`': return RR_ASCII_TICK; + case '{': return RR_ASCII_OPENING_CURLY_BRACE; + case '|': return RR_ASCII_VERTICAL_BAR; + case '}': return RR_ASCII_CLOSING_CURLY_BRACE; + case '~': return RR_ASCII_TILDE; + } + return RR_ASCII_NOT_A_SIGN; +} diff --git a/ini/inc/parser.h b/ini/inc/parser.h new file mode 100644 index 0000000..d6ffcd0 --- /dev/null +++ b/ini/inc/parser.h @@ -0,0 +1,62 @@ + +#ifndef RR_INI_PARSER_H +#define RR_INI_PARSER_H + +#include + +typedef struct rr_ini_section rr_ini_section_s; +typedef struct rr_ini_field rr_ini_field_s; + +typedef enum +{ + RR_INI_VALUE_INVALID, + RR_INI_VALUE_REAL, + RR_INI_VALUE_NUMBER, + RR_INI_VALUE_STRING, + RR_INI_VALUE_IPV4, + RR_INI_VALUE_IPV6, + RR_INI_VALUE_ARBITRARY + +} rr_ini_value_e; + +struct rr_ini_section +{ + /// @brief The last part of the name of this section. If this is a subsection, this only is the name + /// of the subsection, not including the name of the section this section is contained in. + char *last_name; + + usz_t num_fields; + rr_ini_field_s *fields; +}; + +struct rr_ini_value +{ + rr_ini_value_e type; + union rr_ini_value_specifics + { + double real; + long number; + char *string; + struct rr_ini_ipv4_value + { + u8_t values[4]; + } ipv4; + struct rr_ini_ipv4_value + { + u8_t values[16]; + } ipv6; + struct rr_ini_arbitrary_value + { + char * + } arbitrary; + } specifics; +}; + +struct rr_ini_field +{ + char *name; +}; + + + +#endif // RR_INI_PARSER diff --git a/ini/src-c/parser.c b/ini/src-c/parser.c new file mode 100644 index 0000000..819fa3c --- /dev/null +++ b/ini/src-c/parser.c @@ -0,0 +1,3 @@ +#include + + diff --git a/ini/src-c/tokenizer.c b/ini/src-c/tokenizer.c new file mode 100644 index 0000000..819fa3c --- /dev/null +++ b/ini/src-c/tokenizer.c @@ -0,0 +1,3 @@ +#include + +