#include <string.h> //strndupa
/* Posix */
#include <stdlib.h> //exit
-#include <unistd.h> //getopt
+#include <unistd.h> //getopt, sysconf
/* Internal */
#include "parser.tab.h" //bison
+#define DEFAULT_PAGESIZE 4096
const char* cargs['Z'] = {0};
+const long sys_pagesize;
+yypstate* apc_pstate;
+yycstate* apc_cstate;
int main(int, char*[]);
+
extern //bison
int yyparse(void);
extern //lexer.c
int lexer_init(void);
+extern
+int scanner_init(void);
+extern
+int scanner(yypstate*, yycstate*);
extern //ir.c
int ir_init(void);
extern //apc/parser.tab.c
YYSTYPE yylval;
+extern
+yycstate* yycstate_new(void);
+
extern //lexer.c
int lexer(void);
printf(USAGE_LONG);
exit(EXIT_SUCCESS);
}
- if (lexer_init() || ir_init())
+ if ((sys_pagesize = sysconf(_SC_PAGESIZE)) == 0)
+ sys_pagesize = DEFAULT_PAGESIZE;
+
+ apc_pstate = yypstate_new();
+ apc_cstate = yycstate_new();
+
+ if (scanner_init() || ir_init())
{ perror("init");
exit(EXIT_FAILURE);
}
- yyparse();
+ scanner();
+
exit(EXIT_SUCCESS);
}