wip
[henge/apc.git] / src / apc.c
index 2307ccc..3b5774f 100644 (file)
--- a/src/apc.c
+++ b/src/apc.c
 #include <string.h> //strndupa
 /* Posix */
 #include <stdlib.h> //exit
-#include <unistd.h> //getopt
+#include <unistd.h> //getopt, sysconf
 /* Internal */
-#include <apc/parser.tab.h> //bison
+#include "parser.tab.h" //bison
 
+#define DEFAULT_PAGESIZE 4096
 const char* cargs['Z'] = {0};
+const long  sys_pagesize;
 
 int main(int, char*[]);
 
 extern //bison
 int yyparse(void);
 extern //lexer.c
-int  lexer_init(void);
+int lexer_init(void);
+extern //ir.c
+int ir_init(void);
 
 extern //apc/parser.tab.c
 YYSTYPE yylval;
@@ -74,8 +78,10 @@ int main
       printf(USAGE_LONG);
       exit(EXIT_SUCCESS);
   }
-  if (lexer_init())
-    { perror("lexer");
+  if ((sys_pagesize = sysconf(_SC_PAGESIZE)) == 0)
+    sys_pagesize = DEFAULT_PAGESIZE;
+  if (lexer_init() || ir_init())
+    { perror("init");
       exit(EXIT_FAILURE);
     }
   yyparse();