fixed scanner prototype
[henge/apc.git] / src / apc.c
index a4ae543..1a6f918 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 "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);
+int lexer_init(void);
+extern
+int scanner_init(void);
+extern
+int scanner();
+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);
 
@@ -74,11 +88,18 @@ int main
       printf(USAGE_LONG);
       exit(EXIT_SUCCESS);
   }
-  if (lexer_init())
-    { perror("lexer");
+  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);
 }