src/javacodegen.c

changeset 36
be60c22cddfe
parent 35
abaf2489c549
child 39
ac35daceb24c
equal deleted inserted replaced
35:abaf2489c549 36:be60c22cddfe
39 "transient", "catch", "extends", "int", "short", "try", "char", "final", 39 "transient", "catch", "extends", "int", "short", "try", "char", "final",
40 "interface", "static", "void", "class", "finally", "long", "strictfp", 40 "interface", "static", "void", "class", "finally", "long", "strictfp",
41 "volatile", "const", "float", "native", "super", "while", NULL 41 "volatile", "const", "float", "native", "super", "while", NULL
42 }; 42 };
43 43
44 int isjtype(char *word, size_t len) { 44 int check_jtype(char *word, size_t len) {
45 return isupper(word[0]); 45 return isupper(word[0]);
46 } 46 }
47 47
48 int isjdirective(char *word) { 48 int check_jdirective(char *word) {
49 return word[0] == '@'; 49 return word[0] == '@';
50 } 50 }
51 51
52 #define memcpy_const(darr,doff,str) memcpy(&(darr[doff]), str, sizeof(str)-1); \ 52 #define memcpy_const(darr,doff,str) memcpy(&(darr[doff]), str, sizeof(str)-1); \
53 dp += sizeof(str)-1 53 dp += sizeof(str)-1
110 dp = writeescapedchar(dest, dp, c); 110 dp = writeescapedchar(dest, dp, c);
111 } else if (!iswordcharacter(c)) { 111 } else if (!iswordcharacter(c)) {
112 /* interpret word int_t */ 112 /* interpret word int_t */
113 if (wp > 0 && wp < WORDBUF_SIZE) { 113 if (wp > 0 && wp < WORDBUF_SIZE) {
114 int closespan = 1; 114 int closespan = 1;
115 if (iskeyword(hltr->word, hltr->keywords)) { 115 if (check_keyword(hltr->word, hltr->keywords)) {
116 memcpy_const(dest, dp, 116 memcpy_const(dest, dp,
117 "<span class=\"c2html-keyword\">"); 117 "<span class=\"c2html-keyword\">");
118 } else if (hltr->istype(hltr->word, wp)) { 118 } else if (hltr->istype(hltr->word, wp)) {
119 memcpy_const(dest, dp, 119 memcpy_const(dest, dp,
120 "<span class=\"c2html-type\">"); 120 "<span class=\"c2html-type\">");
121 } else if (hltr->isdirective(hltr->word)) { 121 } else if (hltr->isdirective(hltr->word)) {
122 memcpy_const(dest, dp, 122 memcpy_const(dest, dp,
123 "<span class=\"c2html-directive\">"); 123 "<span class=\"c2html-directive\">");
124 } else if (iscapsonly(hltr->word, wp)) { 124 } else if (check_capsonly(hltr->word, wp)) {
125 memcpy_const(dest, dp, 125 memcpy_const(dest, dp,
126 "<span class=\"c2html-macroconst\">"); 126 "<span class=\"c2html-macroconst\">");
127 } else { 127 } else {
128 closespan = 0; 128 closespan = 0;
129 } 129 }

mercurial