diff -r 7ce5c4b51959 -r fe74bf2d5f27 src/c2html.c
--- a/src/c2html.c Wed Jul 10 13:45:26 2013 +0200
+++ b/src/c2html.c Wed Jul 10 13:54:15 2013 +0200
@@ -37,6 +37,9 @@
#define INPUTBUF_SIZE 2048
#define WORDBUF_SIZE 16
+#define istype(word, len) (word[len-2] == '_' && word[len-1] == 't')
+#define isdirective(word) (word[0] == '#')
+
const char* keywords[] = {
"auto", "break", "case", "char", "const", "continue", "default", "do",
"double", "else", "enum", "extern", "float", "for", "goto", "if", "int",
@@ -151,7 +154,14 @@
return 0;
}
-#define istype(word, len) (word[len-2] == '_' && word[len-1] == 't')
+int iscapsonly(char *word, size_t wp) {
+ for (size_t i = 0 ; i < wp ; i++) {
+ if (!isupper(word[i]) && word[i] != '_') {
+ return 0;
+ }
+ }
+ return 1;
+}
void parseline(char *src, char *dest) {
size_t sp = 0, dp = 0;
@@ -159,49 +169,143 @@
while (isspace(src[sp])) {
dest[dp++] = src[sp++];
}
- char word[WORDBUF_SIZE];
+
+ static char word[WORDBUF_SIZE];
+ static char includefile[FILENAME_MAX];
+
memset(word, 0, WORDBUF_SIZE);
- size_t wp = 0;
- int closespan;
+ size_t wp = 0, ifp = 0;
+ int isstring = 0, iscomment = 0, isinclude = 0, parseinclude = 0;
+ static int iscommentml;
+ int isescaping = 0;
+
+ if (iscommentml) {
+ iscomment = 1;
+ memcpy(&(dest[dp]), "