src/ccodegen.c

changeset 46
534a4ef4143d
parent 45
1f3835182aeb
child 47
c39ecbbca7c0
     1.1 --- a/src/ccodegen.c	Tue Aug 23 15:28:56 2016 +0200
     1.2 +++ b/src/ccodegen.c	Tue Aug 23 15:55:02 2016 +0200
     1.3 @@ -39,18 +39,10 @@
     1.4      "while", NULL
     1.5  };
     1.6  
     1.7 -int check_ctype(char *word, size_t len) {
     1.8 -    return (word[len-2] == '_' && word[len-1] == 't');
     1.9 -}
    1.10 -
    1.11 -int check_cdirective(char *word) {
    1.12 -    return (word[0] == '#');
    1.13 -}
    1.14 -
    1.15  #define memcpy_const(darr,doff,str) memcpy(&(darr[doff]), str, sizeof(str)-1); \
    1.16                                      dp += sizeof(str)-1
    1.17  
    1.18 -void cparseline(char *src, UcxBuffer *destbuf, highlighter_t *hltr) {
    1.19 +void cparseline(char *src, UcxBuffer *destbuf, HighlighterData *hltr) {
    1.20      /* TODO: workaround for using old code with UcxBuffer */
    1.21      char *dest = destbuf->space + destbuf->pos;
    1.22  
    1.23 @@ -146,13 +138,14 @@
    1.24                      /* interpret word int_t */
    1.25                      if (wp > 0 && wp < WORDBUF_SIZE) {
    1.26                          int closespan = 1;
    1.27 -                        if (check_keyword(hltr->word, hltr->keywords)) {
    1.28 +                        if (check_keyword(hltr->word, ckeywords)) {
    1.29                              memcpy_const(dest, dp, 
    1.30                                  "<span class=\"c2html-keyword\">");
    1.31 -                        } else if (hltr->istype(hltr->word, wp)) {
    1.32 +                        } else if (hltr->word[wp-2] == '_'
    1.33 +                                && hltr->word[wp-1] == 't') {
    1.34                              memcpy_const(dest, dp, 
    1.35                                  "<span class=\"c2html-type\">");
    1.36 -                        } else if (hltr->isdirective(hltr->word)) {
    1.37 +                        } else if (hltr->word[0] == '#') {
    1.38                              isinclude = !strncmp(
    1.39                                  "#include", hltr->word, WORDBUF_SIZE);
    1.40                              memcpy_const(dest, dp, 

mercurial