#include "config.h"
#include <glib.h>
+#include <string.h>
#include "parse.h"
#include "main.h"
static GString *cbuf = NULL;
int ccode_line = 1;
+GList *include_files = NULL;
+/* 0 no, 1 means yes, 2+ means don't even start looking anymore */
+static int look_for_includes = 0;
+
int line_no = 1;
static void
<*>MOTHERFUCKER { fprintf(stderr,"You are a bad bad person!\n"); REJECT; }
\/\/.*$ { ; /*comment, ignore*/ }
+<C_CODE>^#[ \t]*include[ \t][<"][^\n">]*[>"] {
+ if(look_for_includes==1) {
+ char *p;
+ char *file;
+ char *str = g_strdup(yytext);
+ file = strchr(str,'"');
+ if(!file) file = strchr(str,'<');
+ file++;
+ p = strchr(file,'"');
+ if(!p) p = strchr(file,'>');
+ *p = '\0';
+ include_files = g_list_prepend(include_files,g_strdup(file));
+ g_free(str);
+ }
+ REJECT;
+}
+
<C_CODE>\/\/.*$ { add_to_cbuf(yytext); /*comment, ignore*/ }
<CLASS_CODE>\/\/.*$ { ; /*comment, ignore*/ }
<CLASS_CODE_I>\/\/.*$ { ; /*comment, ignore*/ }
header_c = FALSE;
clear_cbuf();
ccode_line = line_no;
+ if(look_for_includes==0)
+ look_for_includes=1;
}
<C_CODE>^\%\} {
BEGIN(INITIAL);
yylval.cbuf = cbuf;
cbuf = NULL;
+ if(look_for_includes==1)
+ look_for_includes=0;
if(header_c)
return HCODE;
else
<C_CODE>\n { add_to_cbuf(yytext); }
class {
+ look_for_includes = 2;
BEGIN(CLASS_CODE);
return CLASS;
}