src/ccodegen.c

changeset 31
50ae611a785c
parent 29
ec6e97454e64
child 35
abaf2489c549
equal deleted inserted replaced
30:0bfd4d6f086a 31:50ae611a785c
49 49
50 #define memcpy_const(darr,doff,str) memcpy(&(darr[doff]), str, sizeof(str)-1); \ 50 #define memcpy_const(darr,doff,str) memcpy(&(darr[doff]), str, sizeof(str)-1); \
51 dp += sizeof(str)-1 51 dp += sizeof(str)-1
52 52
53 void cparseline(char *src, char *dest, highlighter_t *hltr) { 53 void cparseline(char *src, char *dest, highlighter_t *hltr) {
54 size_t sp = 0, dp = 0;
55 /* indent */
56 while (isspace(src[sp])) {
57 dest[dp++] = src[sp++];
58 }
59 54
60 memset(hltr->word, 0, WORDBUF_SIZE); 55 memset(hltr->word, 0, WORDBUF_SIZE);
61 size_t wp = 0, ifp = 0; 56 size_t wp = 0, ifp = 0, sp = 0, dp = 0;
62 int isstring = 0, iscomment = 0, isinclude = 0, parseinclude = 0; 57 int isstring = 0, iscomment = 0, isinclude = 0, parseinclude = 0;
63 char quote = '\0'; 58 char quote = '\0';
64 int isescaping = 0; 59 int isescaping = 0;
65 60
61 /* continue a multi line comment highlighting */
66 if (hltr->iscommentml) { 62 if (hltr->iscommentml) {
67 iscomment = 1; 63 iscomment = 1;
68 memcpy_const(dest, dp, "<span class=\"c2html-comment\">"); 64 memcpy_const(dest, dp, "<span class=\"c2html-comment\">");
69 } 65 }
70 66

mercurial