ir testing
authorken <ken@mihrtec.com>
Wed, 18 Jan 2017 05:20:32 +0000 (21:20 -0800)
committerken <ken@mihrtec.com>
Wed, 18 Jan 2017 05:20:32 +0000 (21:20 -0800)
src/apc.c
src/parser.y
src/print.h

index 5bd6d73..a066765 100644 (file)
--- a/src/apc.c
+++ b/src/apc.c
@@ -41,6 +41,8 @@ extern //ir.c
 int  ir_linker(void);
 extern //ir.c
 int  ir_condenser(void);
+extern
+void     ir_test(void);
 
 /* Main entry from terminal
    parses the command line and kicks off recursive scanning
@@ -62,7 +64,12 @@ int main
 #define DONE   -1
 #define SCANPATH (cargs['d'] ? cargs['d'] : "./")
 { int   opt;
-
+  if ((sys_pagesize = sysconf(_SC_PAGESIZE)) == 0)
+    sys_pagesize = DEFAULT_PAGESIZE;
+  if (ir_init())
+    { perror("init");
+      exit(EXIT_FAILURE);
+    }
  getopt:
   switch (opt = getopt(argc, argv, OPTS))
   { case 'd' :
@@ -82,16 +89,11 @@ int main
     case DONE:
       break;
   }
-  if ((sys_pagesize = sysconf(_SC_PAGESIZE)) == 0)
-    sys_pagesize = DEFAULT_PAGESIZE;
-  if (ir_init())
-    { perror("init");
-      exit(EXIT_FAILURE);
-    }
   if (scanner_scanpath(SCANPATH))
     { perror("scanner");
       exit(EXIT_FAILURE);
     }
+  ir_test();
   ir_linker();
   ir_condenser();
   exit(EXIT_SUCCESS);
index 9f71a85..881b562 100644 (file)
@@ -39,9 +39,9 @@
 %define api.push-pull push
 %parse-param {yycstate* cs}
 %union {
-  long long  ref;
+  uint32_t   ref;
   int        val;
-  apc_facing  face;
+  apc_facing face;
   uint8_t*   str;
   ir_class   class;
   ir_set     set;
@@ -84,6 +84,7 @@ class:
   NAME CLOPEN   { yyclass_push(cs,ir_class_addchild(yyclass(cs), $1)); }
   progn
   CLCLOSE       { yyclass_pop(cs); }
+| CLCLOSE       { yyclass_pop(cs); }
 ;
 
 statement_list:
index 73df046..6e1c4ba 100644 (file)
 #ifndef DEBUG
 #define DEBUG 0
 #endif
+#define uprintf(...) do {                      \
+  ulc_fprintf(stdout, __VA_ARGS__);            \
+  } while (0)
+#define ufprintf(_STREAM,...) do {             \
+  ulc_fprintf(_STREAM, __VA_ARGS__);           \
+  } while (0)
 #define do_warn(...) do {                      \
   } while (0)
 #define wprintf(...) do {                      \
-    ulc_fprintf(stderr, __VA_ARGS__);          \
+    ufprintf(stderr, __VA_ARGS__);             \
     do_warn(__VA_ARGS__);                      \
   } while (0)
 #define do_error(...) do {                     \
   } while (0)
 #define eprintf(...) do {                      \
-    ulc_fprintf(stderr, __VA_ARGS__);          \
+    ufprintf(stderr, __VA_ARGS__);             \
     do_error(__VA_ARGS_);                      \
   } while (0)
 #define bprintf(_BOOL,...) do {                        \
     if (_BOOL)                                 \
-      ulc_fprintf(stdout, __VA_ARGS__);                \
+      ufprintf(stdout, __VA_ARGS__);           \
   } while (0)
 #define dprintf(...) do {                      \
     bprintf(DEBUG, __VA_ARGS__);               \