converted to C++

Base address of constant table changed, so had to update the "-orig" files.
diff --git a/libacc/acc.c b/libacc/acc.cpp
similarity index 95%
rename from libacc/acc.c
rename to libacc/acc.cpp
index 4aa2b3c..c2c38c4 100644
--- a/libacc/acc.c
+++ b/libacc/acc.cpp
@@ -20,11 +20,14 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
+#include <ctype.h>
+#include <dlfcn.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+class compiler {
 /* vars: value of variables 
    loc : local variable index
    glo : global variable index
@@ -64,12 +67,12 @@
 #define TAG_TOK    ' '
 #define TAG_MACRO  2
 
-pdef(t)
+void pdef(int t)
 {
     *(char *)dstk++ = t;
 }
 
-inp()
+void inp()
 {
     if (dptr) {
         ch = *(char *)dptr++;
@@ -82,13 +85,13 @@
     /*    printf("ch=%c 0x%x\n", ch, ch); */
 }
 
-isid()
+int isid()
 {
     return isalnum(ch) | ch == '_';
 }
 
 /* read a character constant */
-getq()
+void getq()
 {
     if (ch == '\\') {
         inp();
@@ -97,7 +100,7 @@
     }
 }
 
-next()
+void next()
 {
     int l, a;
 
@@ -224,11 +227,11 @@
     fprintf(stderr, "%d: ", ftell((FILE *)file));
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
-    exit(1);
     va_end(ap);
+    exit(1);
 }
 
-void skip(c)
+void skip(int c)
 {
     if (tok != c) {
         error("'%c' expected", c);
@@ -236,7 +239,7 @@
     next();
 }
 
-o(n)
+void o(int n)
 {
     /* cannot use unsigned, so we must do a hack */
     while (n && n != -1) {
@@ -246,7 +249,7 @@
 }
 
 /* output a symbol and patch all calls to it */
-gsym(t)
+void gsym(int t)
 {
     int n;
     while (t) {
@@ -261,7 +264,7 @@
 #define psym oad
 
 /* instruction + address */
-oad(n, t)
+int oad(int n, int t)
 {
     o(n);
     *(int *)ind = t;
@@ -271,24 +274,24 @@
 }
 
 /* load immediate value */
-li(t)
+int li(int t)
 {
     oad(0xb8, t); /* mov $xx, %eax */
 }
 
-gjmp(t)
+int gjmp(int t)
 {
     return psym(0xe9, t);
 }
 
 /* l = 0: je, l == 1: jne */
-gtst(l, t)
+int gtst(int l, int t)
 {
     o(0x0fc085); /* test %eax, %eax, je/jne xxx */
     return psym(0x84 + l, t);
 }
 
-gcmp(t)
+int gcmp(int t)
 {
     o(0xc139); /* cmp %eax,%ecx */
     li(0);
@@ -297,14 +300,14 @@
     o(0xc0);
 }
 
-gmov(l, t)
+int gmov(int l, int t)
 {
     o(l + 0x83);
     oad((t < LOCAL) << 7 | 5, t);
 }
 
 /* l is one if '=' parsing wanted (quick hack) */
-unary(l)
+void unary(int l)
 {
     int n, t, a, c;
 
@@ -375,7 +378,7 @@
             n = *(int *)t;
             /* forward reference: try dlsym */
             if (!n)
-                n = dlsym(0, last_id);
+                n = (int) dlsym(0, (char*) last_id);
             if (tok == '=' & l) {
                 /* assignment */
                 next();
@@ -426,7 +429,7 @@
     }
 }
 
-sum(l)
+void sum(int l)
 {
     int t, n, a;
 
@@ -468,19 +471,20 @@
     }
 }
 
-expr()
+void expr()
 {
     sum(11);
 }
 
 
-test_expr()
+int test_expr()
 {
     expr();
     return gtst(0, 0);
 }
 
-block(l)
+
+void block(int l)
 {
     int a, n, t;
 
@@ -524,7 +528,7 @@
             }
         }
         skip(')');
-        block(&a);
+        block((int) &a);
         gjmp(n - ind - 5); /* jmp */
         gsym(a);
     } else if (tok == '{') {
@@ -550,7 +554,7 @@
 }
 
 /* 'l' is true if local declarations */
-decl(l)
+void decl(int l)
 {
     int a;
 
@@ -599,7 +603,10 @@
     }
 }
 
-main(int n, char** t)
+public:
+compiler(){}
+
+int compile(int n, char** t)
 {
     file = stdin;
     if (n-- > 1) {
@@ -627,3 +634,10 @@
     return (*(int (*)())*(int *)(vars + TOK_MAIN)) (n, t);
 #endif
 }
+
+};
+
+int main(int argc, char** argv) {
+    compiler c;
+    return c.compile(argc, argv);
+}
\ No newline at end of file
diff --git a/libacc/test b/libacc/test
index eb4f383..b4cef93 100755
--- a/libacc/test
+++ b/libacc/test
@@ -1,2 +1,2 @@
 #!/bin/sh
-gcc acc.c -DTEST -ldl -o tests/acc && tests/acc tests/otcc.c tests/otcc.out && diff tests/otcc.out tests/otcc.out-orig
+g++ acc.cpp -DTEST -ldl -o tests/acc && tests/acc tests/otcc.c tests/otcc.out && diff tests/otcc.out tests/otcc.out-orig
diff --git a/libacc/tests/hello.out-orig b/libacc/tests/hello.out-orig
index bb178c0..1fb7bf5 100644
--- a/libacc/tests/hello.out-orig
+++ b/libacc/tests/hello.out-orig
Binary files differ
diff --git a/libacc/tests/otcc.out-orig b/libacc/tests/otcc.out-orig
index ea32bc8..2cb08ff 100644
--- a/libacc/tests/otcc.out-orig
+++ b/libacc/tests/otcc.out-orig
Binary files differ