Minor compiler warning fixes...
This commit is contained in:
parent
1bcd78a7c7
commit
d05292655c
61
source/hl.h
61
source/hl.h
@ -37,10 +37,51 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
hl_group_t * hl;
|
||||
token_type_t t;
|
||||
regex_t * syntax;
|
||||
token_type_t t;
|
||||
char _pad[4];
|
||||
} token_t;
|
||||
|
||||
extern vector_t token_table;
|
||||
extern display_t * display_table;
|
||||
|
||||
extern hl_group_t * keyword_hl;
|
||||
extern hl_group_t * preprocessor_hl;
|
||||
extern hl_group_t * symbol_hl;
|
||||
|
||||
extern void new_display_mode(display_t * mode);
|
||||
extern int free_token(token_t * token);
|
||||
extern int append_token(token_t * token);
|
||||
|
||||
// TODO: ALIGN PROPERLY...
|
||||
|
||||
extern token_t * new_symbol_token(const char * const c,
|
||||
hl_group_t * const g);
|
||||
extern int new_symbol_tokens(const char * const * symbols,
|
||||
hl_group_t * const g);
|
||||
extern int new_char_tokens(const char * characters,
|
||||
hl_group_t * const g);
|
||||
extern token_t * new_keyword_token(const char * const word,
|
||||
hl_group_t * const g);
|
||||
extern int new_keyword_tokens(const char * const * words,
|
||||
hl_group_t * const g);
|
||||
extern token_t * new_token(const char * const word,
|
||||
const token_type_t t,
|
||||
hl_group_t * const g);
|
||||
|
||||
// TODO: ALIGN PROPERLY...
|
||||
|
||||
extern int token_fits(const token_t * const token,
|
||||
const char * const to,
|
||||
const int string_offset,
|
||||
int * match_offset);
|
||||
|
||||
extern void render_string(const char * const string,
|
||||
const char * const mode);
|
||||
|
||||
extern int hl_init(void);
|
||||
extern int hl_deinit(void);
|
||||
|
||||
// GLOBALS
|
||||
|
||||
vector_t token_table = {
|
||||
@ -96,7 +137,7 @@ int new_symbol_tokens(const char * const * symbols,
|
||||
if(new_symbol_token(*symbols, g)) {
|
||||
++i;
|
||||
} else {
|
||||
assert(!"Kinda failed to new symbol token thing.");
|
||||
assert(!(bool)"Kinda failed to new symbol token thing.");
|
||||
}
|
||||
++symbols;
|
||||
}
|
||||
@ -117,7 +158,7 @@ int new_char_tokens(const char * characters,
|
||||
if(new_symbol_token(is_magic(*s) ? buffer : buffer + 1, g)) {
|
||||
++i;
|
||||
} else {
|
||||
assert(!"Kinda failed to new char token thing.");
|
||||
assert(!(bool)"Kinda failed to new char token thing.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,10 +224,10 @@ token_t * new_token(const char * const word,
|
||||
// ### Highlighting ###
|
||||
// --------------------
|
||||
|
||||
int token_fits(const token_t * const token,
|
||||
const char * const to,
|
||||
const int string_offset,
|
||||
int * match_offset) {
|
||||
int token_fits(const token_t * const token,
|
||||
const char * const to,
|
||||
const int string_offset,
|
||||
int * match_offset) {
|
||||
UNUSED(match_offset);
|
||||
|
||||
//return regex_match(pattern, to, string_offset, match_offset);
|
||||
@ -203,7 +244,7 @@ void render_string(const char * const string,
|
||||
for (; token_index < token_table.element_count; token_index++) {
|
||||
token_t * t = *(token_t**)vector_get(&token_table,
|
||||
token_index);
|
||||
f = token_fits(t, string, s - string, &offset);
|
||||
f = token_fits(t, string, (int) (s - string), &offset);
|
||||
if (f) {
|
||||
break;
|
||||
}
|
||||
@ -240,9 +281,9 @@ void render_string(const char * const string,
|
||||
// -------------------------
|
||||
// ### Library Mangement ###
|
||||
// -------------------------
|
||||
hl_group_t * keyword_hl = NULL;
|
||||
hl_group_t * keyword_hl = NULL;
|
||||
hl_group_t * preprocessor_hl = NULL;
|
||||
hl_group_t * symbol_hl = NULL;
|
||||
hl_group_t * symbol_hl = NULL;
|
||||
|
||||
int hl_init(void) {
|
||||
return 0;
|
||||
|
@ -49,5 +49,7 @@ int main(int argc,
|
||||
//hl_deinit();
|
||||
free(buffer);
|
||||
|
||||
//terminal_hl_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,6 +6,19 @@ typedef struct {
|
||||
char * background_color;
|
||||
} terminal_hl_t;
|
||||
|
||||
extern display_t * cterm;
|
||||
|
||||
extern void cterm_render_callback(const char * const string,
|
||||
const int length,
|
||||
void * const attributes);
|
||||
|
||||
extern int terminal_hl_init(void);
|
||||
|
||||
display_t * cterm = &(display_t) {
|
||||
.key = "cterm",
|
||||
.callback = cterm_render_callback
|
||||
};
|
||||
|
||||
void cterm_render_callback(const char * const string,
|
||||
const int length,
|
||||
void * const attributes) {
|
||||
@ -25,13 +38,7 @@ void cterm_render_callback(const char * const string,
|
||||
fputs(TERMINAL_RESET, stdout);
|
||||
}
|
||||
|
||||
display_t * cterm = &(display_t) {
|
||||
.key = "cterm",
|
||||
.callback = cterm_render_callback
|
||||
};
|
||||
|
||||
|
||||
int terminal_hl_init(void){
|
||||
int terminal_hl_init(void) {
|
||||
hl_init();
|
||||
new_display_mode(cterm);
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user