Basic syntax system, right now only C and hardcode in eco!
[eco.git] / syntax.h
blobba7f1f59fe1f85778db171b02d7c46ba1cd96f7d
1 /*
2 * Copyright (C) 2010 Diego Hernan Borghetti.
3 */
5 #ifndef _ECO_SYNTAX_H
6 #define _ECO_SYNTAX_H
8 typedef struct _E_Syntax_Word {
9 struct _E_Syntax_Word *next;
10 struct _E_Syntax_Word *prev;
12 /* the character's for this word (or only one). */
13 char *word;
15 /* number of characters. */
16 int nch;
18 /* color to apply, foreground and background. */
19 char fgcol;
20 char bgcol;
21 } E_Syntax_Word;
23 typedef struct _E_Syntax_Char {
24 struct _E_Syntax_Char *next;
25 struct _E_Syntax_Char *prev;
27 /* the character. */
28 char ch;
30 /* color to apply, foreground and background. */
31 char fgcol;
32 char bgcol;
33 } E_Syntax_Char;
35 typedef struct _E_Syntax {
36 struct _E_Syntax *next;
37 struct _E_Syntax *prev;
39 /* language name. */
40 char *name;
42 /* Function to check the file type.
43 * The argument is the file extension or NULL!
44 * return zero on success or different that zero otherwise.
46 int (*check_type)(char *);
48 /* the dictionary of word's. */
49 E_List dirs;
51 /* and only character, for second round. */
52 E_List chars;
53 } E_Syntax;
55 E_Syntax *e_syntax_search(char *ext);
56 void e_syntax_add(E_Syntax *sy);
57 void e_syntax_rem(E_Syntax *sy);
58 E_Syntax *e_syntax_new(void);
59 void e_syntax_free(E_Syntax *sy);
60 void e_syntax_word_add(E_Syntax *sy, char *word, char fg, char bg);
61 void e_syntax_char_add(E_Syntax *sy, char ch, char fg, char bg);
62 void e_syntax_apply(E_Syntax *sy, E_ScreenLine *ln, int ncol);
64 #endif /* _ECO_SYNTAX_H */