[llvm-commits] CVS: llvm-test/MultiSource/Applications/hbd/class.cpp d1-pushc.cpp d2-pushl.cpp d3-popl.cpp d4-array.cpp d5-stack.cpp d6-arith.cpp d7-cntrl.cpp d8-ret.cpp d9-swtch.cpp da-field.cpp db-meth.cpp dc-misc.cpp err.cpp exp.cpp hbd.cpp id.cpp op.cpp sig.cpp version.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri May 13 11:10:57 PDT 2005
Changes in directory llvm-test/MultiSource/Applications/hbd:
class.cpp updated: 1.2 -> 1.3
d1-pushc.cpp updated: 1.1 -> 1.2
d2-pushl.cpp updated: 1.1 -> 1.2
d3-popl.cpp updated: 1.1 -> 1.2
d4-array.cpp updated: 1.1 -> 1.2
d5-stack.cpp updated: 1.1 -> 1.2
d6-arith.cpp updated: 1.1 -> 1.2
d7-cntrl.cpp updated: 1.1 -> 1.2
d8-ret.cpp updated: 1.1 -> 1.2
d9-swtch.cpp updated: 1.1 -> 1.2
da-field.cpp updated: 1.1 -> 1.2
db-meth.cpp updated: 1.1 -> 1.2
dc-misc.cpp updated: 1.1 -> 1.2
err.cpp updated: 1.1 -> 1.2
exp.cpp updated: 1.1 -> 1.2
hbd.cpp updated: 1.1 -> 1.2
id.cpp updated: 1.1 -> 1.2
op.cpp updated: 1.1 -> 1.2
sig.cpp updated: 1.1 -> 1.2
version.cpp updated: 1.1 -> 1.2
---
Log message:
remove ^M's
---
Diffs of the changes: (+1381 -1380)
class.cpp | 1
d1-pushc.cpp | 160 ++++++++++-----------
d2-pushl.cpp | 120 ++++++++--------
d3-popl.cpp | 232 +++++++++++++++----------------
d4-array.cpp | 136 +++++++++---------
d5-stack.cpp | 78 +++++-----
d6-arith.cpp | 198 +++++++++++++-------------
d7-cntrl.cpp | 168 +++++++++++-----------
d8-ret.cpp | 70 ++++-----
d9-swtch.cpp | 86 +++++------
da-field.cpp | 224 +++++++++++++++---------------
db-meth.cpp | 234 +++++++++++++++----------------
dc-misc.cpp | 64 ++++----
err.cpp | 64 ++++----
exp.cpp | 434 +++++++++++++++++++++++++++++------------------------------
hbd.cpp | 42 ++---
id.cpp | 54 +++----
op.cpp | 60 ++++----
sig.cpp | 290 +++++++++++++++++++--------------------
version.cpp | 46 +++---
20 files changed, 1381 insertions(+), 1380 deletions(-)
Index: llvm-test/MultiSource/Applications/hbd/class.cpp
diff -u llvm-test/MultiSource/Applications/hbd/class.cpp:1.2 llvm-test/MultiSource/Applications/hbd/class.cpp:1.3
--- llvm-test/MultiSource/Applications/hbd/class.cpp:1.2 Fri May 13 13:07:50 2005
+++ llvm-test/MultiSource/Applications/hbd/class.cpp Fri May 13 13:10:43 2005
@@ -29,6 +29,7 @@
functoinsert = 0;
outfile = stdout; infile = stdin;
progname = *argv++;
+ options = (CL_Options)0;
if (strcmp(progname + strlen(progname) - 3, "hbt") == 0) {
for (; (--argc) && (**argv == '-'); argv++) {
options = (CL_Options)0;
Index: llvm-test/MultiSource/Applications/hbd/d1-pushc.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d1-pushc.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d1-pushc.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d1-pushc.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d1-pushc.cpp Fri May 13 13:10:43 2005
@@ -1,80 +1,80 @@
-/* d1-pushc.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-#include "consts.h"
-
-int pushimm(Classfile *c) /* push immediate value e.g. bipush 34 */
-{
- int pcval = currpc - 1;
- int val = JDNEXT8S();
- if (ch == 0x11) { val<<=8; val+=JDNEXT8U(); }
- char *temp_str = new char[32];
- sprintf(temp_str, "%i", val);
- *stkptr++ = new Exp(pcval, temp_str, INT, IM); /* id->linfo = val */
- return 0;
-}
-
-int pushconst(Classfile *c) /* push value from cp e.g. ldc1 #3 */
-{
- int pcval = currpc - 1;
- int val = JDNEXT8U();
- if (ch != 0x12) { val<<=8; val+=JDNEXT8U(); }
- Type idtype;
- char tmpstr[1024];
- cp_info *cpi = c->cp[val];
- switch (cpi->tag) {
- case CONSTANT_Integer:
- sprintf(tmpstr, "0x%lX", cpi->i);
- idtype = INT;
-// id->linfo = cpi->i;
- break;
- case CONSTANT_Long:
- if (cpi->i)
- sprintf(tmpstr, "0x%lX%08lXL", cpi->i, (cpi + 1)->i);
- else
- sprintf(tmpstr, "0x%lXL", (cpi + 1)->i);
- idtype = LONG;
-// id->linfo = (cpi + 1)->i;
-// id->llinfo[2] = cpi->i;
- break;
- case CONSTANT_Float:
- sprintf(tmpstr, "%.25Gf", cpi->f);
- idtype = FLOAT;
-// id->dinfo = cpi->f;
- break;
- case CONSTANT_Double:
- sprintf(tmpstr, "%.25Gd", *(double *)&cpi->i);
- idtype = DOUBLE;
-// id->dinfo = *(double*)&cpi->i;
- break;
- case CONSTANT_String:
- sprintf(tmpstr, "\"%s\"", c->cp[cpi->i]->chp);
- idtype = OBJECT; /* java.lang.String */
-// id->dinfo = (int)c->cp[cpi->i]->chp;
- break;
- default:
- fprintf(stderr, "Unkown tag %d on constant\n", cpi->tag);
- return -1;
- }
- char *idname = new char[strlen(tmpstr) + 1];
- strcpy(idname, tmpstr);
- *stkptr++ = new Exp(pcval, idname, idtype, CP, val);
- return 0;
-}
-
-int pushimp(Classfile *c) /* push implied immediate value e.g. iconst_m1 */
-{
- *stkptr++ = new Exp(currpc - 1, ch - 1);
- return 0;
-}
-
+/* d1-pushc.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+#include "consts.h"
+
+int pushimm(Classfile *c) /* push immediate value e.g. bipush 34 */
+{
+ int pcval = currpc - 1;
+ int val = JDNEXT8S();
+ if (ch == 0x11) { val<<=8; val+=JDNEXT8U(); }
+ char *temp_str = new char[32];
+ sprintf(temp_str, "%i", val);
+ *stkptr++ = new Exp(pcval, temp_str, INT, IM); /* id->linfo = val */
+ return 0;
+}
+
+int pushconst(Classfile *c) /* push value from cp e.g. ldc1 #3 */
+{
+ int pcval = currpc - 1;
+ int val = JDNEXT8U();
+ if (ch != 0x12) { val<<=8; val+=JDNEXT8U(); }
+ Type idtype;
+ char tmpstr[1024];
+ cp_info *cpi = c->cp[val];
+ switch (cpi->tag) {
+ case CONSTANT_Integer:
+ sprintf(tmpstr, "0x%lX", cpi->i);
+ idtype = INT;
+// id->linfo = cpi->i;
+ break;
+ case CONSTANT_Long:
+ if (cpi->i)
+ sprintf(tmpstr, "0x%lX%08lXL", cpi->i, (cpi + 1)->i);
+ else
+ sprintf(tmpstr, "0x%lXL", (cpi + 1)->i);
+ idtype = LONG;
+// id->linfo = (cpi + 1)->i;
+// id->llinfo[2] = cpi->i;
+ break;
+ case CONSTANT_Float:
+ sprintf(tmpstr, "%.25Gf", cpi->f);
+ idtype = FLOAT;
+// id->dinfo = cpi->f;
+ break;
+ case CONSTANT_Double:
+ sprintf(tmpstr, "%.25Gd", *(double *)&cpi->i);
+ idtype = DOUBLE;
+// id->dinfo = *(double*)&cpi->i;
+ break;
+ case CONSTANT_String:
+ sprintf(tmpstr, "\"%s\"", c->cp[cpi->i]->chp);
+ idtype = OBJECT; /* java.lang.String */
+// id->dinfo = (int)c->cp[cpi->i]->chp;
+ break;
+ default:
+ fprintf(stderr, "Unkown tag %d on constant\n", cpi->tag);
+ return -1;
+ }
+ char *idname = new char[strlen(tmpstr) + 1];
+ strcpy(idname, tmpstr);
+ *stkptr++ = new Exp(pcval, idname, idtype, CP, val);
+ return 0;
+}
+
+int pushimp(Classfile *c) /* push implied immediate value e.g. iconst_m1 */
+{
+ *stkptr++ = new Exp(currpc - 1, ch - 1);
+ return 0;
+}
+
Index: llvm-test/MultiSource/Applications/hbd/d2-pushl.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d2-pushl.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d2-pushl.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d2-pushl.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d2-pushl.cpp Fri May 13 13:10:43 2005
@@ -1,60 +1,60 @@
-/* d2-pushl.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "general.h"
-#include "exp.h"
-#include "decomp.h"
-#include "method.h"
-
-int pushlocal(Classfile *c) /* push value from local (or params) */
-{
- int pcval = currpc - 1;
- int val;
- Type idtype = VOID;
- if (ch < 0x1A) {
- val = JDNEXT8S();
- switch (ch) {
- case 0x15: idtype = INT; break;
- case 0x16: idtype = LONG; break;
- case 0x17: idtype = FLOAT; break;
- case 0x18: idtype = DOUBLE; break;
- case 0x19: idtype = OBJECT; break;
- }
- } else if (ch < 0x1E) {
- val = ch - 0x1A;
- idtype = INT;
- } else if (ch < 0x22) {
- val = ch - 0x1E;
- idtype = LONG;
- } else if (ch < 0x26) {
- val = ch - 0x22;
- idtype = FLOAT;
- } else if (ch < 0x2A) {
- val = ch - 0x26;
- idtype = DOUBLE;
- } else /* if (ch < 0x2E) */ {
- val = ch - 0x2A;
- idtype = OBJECT;
- }
- char *tmpstr = miptr->local_names[val], *idname;
- if (tmpstr) {
- idname = new char[strlen(tmpstr) + 1];
- strcpy(idname, tmpstr);
- } else {
- fprintf(stderr, "Error in code: local used before defined.\n");
- return 1;
- }
- Exp *e = new Exp(pcval, idname, idtype, LO, val);
-// if((lastaction == 16)&&(!strcmp((*(donestkptr-1))->exp1->e->id->name,id->name))) {
-// *stkptr++ = *(--donestkptr);
- *stkptr++ = e;
-// } else {
-// *stkptr++ = e;
-// }
- return 0;
-}
+/* d2-pushl.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "general.h"
+#include "exp.h"
+#include "decomp.h"
+#include "method.h"
+
+int pushlocal(Classfile *c) /* push value from local (or params) */
+{
+ int pcval = currpc - 1;
+ int val;
+ Type idtype = VOID;
+ if (ch < 0x1A) {
+ val = JDNEXT8S();
+ switch (ch) {
+ case 0x15: idtype = INT; break;
+ case 0x16: idtype = LONG; break;
+ case 0x17: idtype = FLOAT; break;
+ case 0x18: idtype = DOUBLE; break;
+ case 0x19: idtype = OBJECT; break;
+ }
+ } else if (ch < 0x1E) {
+ val = ch - 0x1A;
+ idtype = INT;
+ } else if (ch < 0x22) {
+ val = ch - 0x1E;
+ idtype = LONG;
+ } else if (ch < 0x26) {
+ val = ch - 0x22;
+ idtype = FLOAT;
+ } else if (ch < 0x2A) {
+ val = ch - 0x26;
+ idtype = DOUBLE;
+ } else /* if (ch < 0x2E) */ {
+ val = ch - 0x2A;
+ idtype = OBJECT;
+ }
+ char *tmpstr = miptr->local_names[val], *idname;
+ if (tmpstr) {
+ idname = new char[strlen(tmpstr) + 1];
+ strcpy(idname, tmpstr);
+ } else {
+ fprintf(stderr, "Error in code: local used before defined.\n");
+ return 1;
+ }
+ Exp *e = new Exp(pcval, idname, idtype, LO, val);
+// if((lastaction == 16)&&(!strcmp((*(donestkptr-1))->exp1->e->id->name,id->name))) {
+// *stkptr++ = *(--donestkptr);
+ *stkptr++ = e;
+// } else {
+// *stkptr++ = e;
+// }
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d3-popl.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d3-popl.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d3-popl.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d3-popl.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d3-popl.cpp Fri May 13 13:10:43 2005
@@ -1,116 +1,116 @@
-/* d3-popl.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdlib.h>
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int storelocal(Classfile *c) /* pop value to local (including params) */
-{
- unsigned pcval = currpc - 1;
- int val;
- Type idtype = VOID;
- if (ch < 0x3B) {
- switch (ch) {
- case 0x36: idtype = INT; break;
- case 0x37: idtype = LONG; break;
- case 0x38: idtype = FLOAT; break;
- case 0x39: idtype = DOUBLE; break;
- case 0x3A: idtype = OBJECT; break;
- }
- val = JDNEXT8S();
- } else if (ch < 0x3F) {
- val = ch - 0x3B;
- idtype = INT;
- } else if (ch < 0x43) {
- val = ch - 0x3F;
- idtype = LONG;
- } else if (ch < 0x47) {
- val = ch - 0x43;
- idtype = FLOAT;
- } else if (ch < 0x4B) {
- val = ch - 0x47;
- idtype = DOUBLE;
- } else {
- val = ch - 0x4B;
- idtype = OBJECT;
- }
-// if (val) {
- char *tmpstr = miptr->local_names[val], *idname;
- if (tmpstr) {
- idname = new char[strlen(tmpstr) + 1];
- strcpy(idname, tmpstr);
- idtype = miptr->local_types[val];
- } else {
- idname = miptr->local_names[val] = new char[7];
- sprintf(idname, "var%d", val);
- if ((miptr->local_types[val] == VOID)||(miptr->local_types[val] == UNKNOWN)) {
- if (idtype != INT)
- miptr->local_types[val] = idtype;
- else
- miptr->local_types[val] = UNKNOWN;
- }
- }
- Exp *e1 = new Exp(pcval, idname, idtype, LO, val);
- Exp *e2 = *(--stkptr);
- Exp *e = new Exp(pcval, min(pcval, e2->minpc), BINARY, idtype, ASSIGN, e1, e2);
- if (!tmpstr) miptr->local_firstuses[val] = e->minpc;
- if ((e2->e->type == INT) && (e1->e->type == BOOLEAN))
- if ((e2->e == std_exps + 2)||(e2->e == std_exps + 3)) /* 0 or 1 */
- e2->e += 13; /* false or true */
- else
- /* CMPEQ */;
- *donestkptr++ = e;
- return 0;
-}
-
-int iinclocal(Classfile *c) /* increment local by value */
-{
- int pcval = currpc - 1;
- int val;
- val = JDNEXT8S();
- char *id1name;
- char *tmpstr = miptr->local_names[val];
- if (tmpstr) {
-// id1name = new char[strlen(tmpstr) + 1];
-// strcpy(id1name, tmpstr);
- id1name = tmpstr;
- } else {
- printf("Local int used before defined.\n");
- return 1;
- }
- if (miptr->local_types[val] == UNKNOWN) miptr->local_types[val] = INT;
-// if (miptr->local_types[val] == UNKNOWN) miptr->local_types[val] = INT;
-// if (miptr->local_types[val] == VOID) miptr->local_types[val] = INT;
- if ((miptr->local_types[val] != INT)&&(miptr->local_types[val] != SHORT)) {
- printf("Incrementation of local var%d of type %d i.e. %s.\n", val, miptr->local_types[val], type2str[miptr->local_types[val]]);
- return 1;
- }
- int incnum = JDNEXT8S();
-// id2->linfo = incnum;
- Exp *e;
- if ((incnum!=1)&&(incnum!=-1)) {
- Exp *e1 = new Exp(pcval, id1name, INT, LO, val);
- char *id2name = new char[5]; sprintf(id2name, "%ld", labs(incnum));
- Exp *e2 = new Exp(pcval, id2name, INT, IM);
- e = new Exp(pcval, BINARY, INT, (incnum<0)?SUBASSIGN:ADDASSIGN, e1, e2);
- } else {
- Exp *e1 = new Exp(pcval, id1name, INT, LO, val);
- e = new Exp(pcval, PREUNARY, INT, (incnum<0)?DEC:INC, e1);
- }
-
- if ((lastaction == 4)&&(!strcmp((*(stkptr-1))->e->id->name,id1name))) {
- e->e->et = POSTUNARY; e->minpc = min(e->minpc, (*(stkptr-1))->minpc);
- *(stkptr-1) = e;
- } else {
- *donestkptr++ = e;
- }
- return 0;
-}
+/* d3-popl.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdlib.h>
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int storelocal(Classfile *c) /* pop value to local (including params) */
+{
+ unsigned pcval = currpc - 1;
+ int val;
+ Type idtype = VOID;
+ if (ch < 0x3B) {
+ switch (ch) {
+ case 0x36: idtype = INT; break;
+ case 0x37: idtype = LONG; break;
+ case 0x38: idtype = FLOAT; break;
+ case 0x39: idtype = DOUBLE; break;
+ case 0x3A: idtype = OBJECT; break;
+ }
+ val = JDNEXT8S();
+ } else if (ch < 0x3F) {
+ val = ch - 0x3B;
+ idtype = INT;
+ } else if (ch < 0x43) {
+ val = ch - 0x3F;
+ idtype = LONG;
+ } else if (ch < 0x47) {
+ val = ch - 0x43;
+ idtype = FLOAT;
+ } else if (ch < 0x4B) {
+ val = ch - 0x47;
+ idtype = DOUBLE;
+ } else {
+ val = ch - 0x4B;
+ idtype = OBJECT;
+ }
+// if (val) {
+ char *tmpstr = miptr->local_names[val], *idname;
+ if (tmpstr) {
+ idname = new char[strlen(tmpstr) + 1];
+ strcpy(idname, tmpstr);
+ idtype = miptr->local_types[val];
+ } else {
+ idname = miptr->local_names[val] = new char[7];
+ sprintf(idname, "var%d", val);
+ if ((miptr->local_types[val] == VOID)||(miptr->local_types[val] == UNKNOWN)) {
+ if (idtype != INT)
+ miptr->local_types[val] = idtype;
+ else
+ miptr->local_types[val] = UNKNOWN;
+ }
+ }
+ Exp *e1 = new Exp(pcval, idname, idtype, LO, val);
+ Exp *e2 = *(--stkptr);
+ Exp *e = new Exp(pcval, min(pcval, e2->minpc), BINARY, idtype, ASSIGN, e1, e2);
+ if (!tmpstr) miptr->local_firstuses[val] = e->minpc;
+ if ((e2->e->type == INT) && (e1->e->type == BOOLEAN))
+ if ((e2->e == std_exps + 2)||(e2->e == std_exps + 3)) /* 0 or 1 */
+ e2->e += 13; /* false or true */
+ else
+ /* CMPEQ */;
+ *donestkptr++ = e;
+ return 0;
+}
+
+int iinclocal(Classfile *c) /* increment local by value */
+{
+ int pcval = currpc - 1;
+ int val;
+ val = JDNEXT8S();
+ char *id1name;
+ char *tmpstr = miptr->local_names[val];
+ if (tmpstr) {
+// id1name = new char[strlen(tmpstr) + 1];
+// strcpy(id1name, tmpstr);
+ id1name = tmpstr;
+ } else {
+ printf("Local int used before defined.\n");
+ return 1;
+ }
+ if (miptr->local_types[val] == UNKNOWN) miptr->local_types[val] = INT;
+// if (miptr->local_types[val] == UNKNOWN) miptr->local_types[val] = INT;
+// if (miptr->local_types[val] == VOID) miptr->local_types[val] = INT;
+ if ((miptr->local_types[val] != INT)&&(miptr->local_types[val] != SHORT)) {
+ printf("Incrementation of local var%d of type %d i.e. %s.\n", val, miptr->local_types[val], type2str[miptr->local_types[val]]);
+ return 1;
+ }
+ int incnum = JDNEXT8S();
+// id2->linfo = incnum;
+ Exp *e;
+ if ((incnum!=1)&&(incnum!=-1)) {
+ Exp *e1 = new Exp(pcval, id1name, INT, LO, val);
+ char *id2name = new char[5]; sprintf(id2name, "%ld", labs(incnum));
+ Exp *e2 = new Exp(pcval, id2name, INT, IM);
+ e = new Exp(pcval, BINARY, INT, (incnum<0)?SUBASSIGN:ADDASSIGN, e1, e2);
+ } else {
+ Exp *e1 = new Exp(pcval, id1name, INT, LO, val);
+ e = new Exp(pcval, PREUNARY, INT, (incnum<0)?DEC:INC, e1);
+ }
+
+ if ((lastaction == 4)&&(!strcmp((*(stkptr-1))->e->id->name,id1name))) {
+ e->e->et = POSTUNARY; e->minpc = min(e->minpc, (*(stkptr-1))->minpc);
+ *(stkptr-1) = e;
+ } else {
+ *donestkptr++ = e;
+ }
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d4-array.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d4-array.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d4-array.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d4-array.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d4-array.cpp Fri May 13 13:10:44 2005
@@ -1,68 +1,68 @@
-/* d4-array.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int anewarray(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- int val = JDNEXT16U();
- char *class_name = c->cp(val)->chp;
- Exp *e1 = new Exp(pcval, class_name, VOID, NO);
- Exp *e2 = new Exp(pcval, ARRAYACCESS, VOID, ID, e1, *(stkptr-1));
- *(stkptr-1) = new Exp(pcval, min(pcval, e2->exp2->minpc), PREUNARY, ARRAY, NEW, e2);
- return 0;
-}
-
-int multianewarray(Classfile *c)
-{
- printf("Multi");
- unsigned pcval = currpc - 1;
- /*int val = */JDNEXT16U();
-// char *class_name; // = c->constant_pool[c->constant_pool[val].i].cp;
-// for (val = JDNEXT8U(); val--;) {
-// --stkptr;
-// } stkptr++;
- Exp *e1 = *(stkptr-1);
- *(stkptr-1) = new Exp(pcval, min(pcval, e1->minpc), PREUNARY, ARRAY, NEW, e1);
- return 0;
-}
-
-int doarraylength(Classfile *c) /* 190 == 0xBE */
-{
- unsigned pcval = currpc - 1;
- Exp *e1 = *(stkptr-1);
- Exp *e2 = new Exp(pcval, "length", VOID, NO);
- *(stkptr-1) = new Exp(pcval, min(pcval, e1->minpc), BINARY, INT, DOT, e1, e2);
- return 0;
-}
-
-int doarrayget(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- Exp *e2 = *(--stkptr);
- Exp *e1 = *(stkptr-1);
- *(stkptr-1) = new Exp(pcval, min(min(pcval, e1->minpc), e2->minpc), ARRAYACCESS,
- (Type)(ch - (0x2E - INT)), ID, e1, e2);
- return 0;
-}
-
-int doarrayput(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- Exp *e4 = *(--stkptr);
- Exp *e3 = *(--stkptr);
- Exp *e2 = *(--stkptr);
- unsigned minpcval = min(min(pcval, e2->minpc), e3->minpc);
- Exp *e1 = new Exp(pcval, minpcval, ARRAYACCESS, OBJECT, ID, e2, e3);
- *donestkptr++ = new Exp(pcval, minpcval, BINARY, OBJECT, ASSIGN, e1, e4);
- return 0;
-}
+/* d4-array.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int anewarray(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ int val = JDNEXT16U();
+ char *class_name = c->cp(val)->chp;
+ Exp *e1 = new Exp(pcval, class_name, VOID, NO);
+ Exp *e2 = new Exp(pcval, ARRAYACCESS, VOID, ID, e1, *(stkptr-1));
+ *(stkptr-1) = new Exp(pcval, min(pcval, e2->exp2->minpc), PREUNARY, ARRAY, NEW, e2);
+ return 0;
+}
+
+int multianewarray(Classfile *c)
+{
+ printf("Multi");
+ unsigned pcval = currpc - 1;
+ /*int val = */JDNEXT16U();
+// char *class_name; // = c->constant_pool[c->constant_pool[val].i].cp;
+// for (val = JDNEXT8U(); val--;) {
+// --stkptr;
+// } stkptr++;
+ Exp *e1 = *(stkptr-1);
+ *(stkptr-1) = new Exp(pcval, min(pcval, e1->minpc), PREUNARY, ARRAY, NEW, e1);
+ return 0;
+}
+
+int doarraylength(Classfile *c) /* 190 == 0xBE */
+{
+ unsigned pcval = currpc - 1;
+ Exp *e1 = *(stkptr-1);
+ Exp *e2 = new Exp(pcval, "length", VOID, NO);
+ *(stkptr-1) = new Exp(pcval, min(pcval, e1->minpc), BINARY, INT, DOT, e1, e2);
+ return 0;
+}
+
+int doarrayget(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ Exp *e2 = *(--stkptr);
+ Exp *e1 = *(stkptr-1);
+ *(stkptr-1) = new Exp(pcval, min(min(pcval, e1->minpc), e2->minpc), ARRAYACCESS,
+ (Type)(ch - (0x2E - INT)), ID, e1, e2);
+ return 0;
+}
+
+int doarrayput(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ Exp *e4 = *(--stkptr);
+ Exp *e3 = *(--stkptr);
+ Exp *e2 = *(--stkptr);
+ unsigned minpcval = min(min(pcval, e2->minpc), e3->minpc);
+ Exp *e1 = new Exp(pcval, minpcval, ARRAYACCESS, OBJECT, ID, e2, e3);
+ *donestkptr++ = new Exp(pcval, minpcval, BINARY, OBJECT, ASSIGN, e1, e4);
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d5-stack.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d5-stack.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d5-stack.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d5-stack.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d5-stack.cpp Fri May 13 13:10:44 2005
@@ -1,39 +1,39 @@
-/* d5-stack.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int dopop(Classfile *c)
-{
- if (stkptr != stack) *donestkptr++ = *(--stkptr);
- return 0;
-}
-
-
-int dodup(Classfile *c)
-{
- if ((*(stkptr-1))->e->op != NEW) {
- *stkptr = *(stkptr-1);
- (*stkptr)->numrefs++;
- stkptr++;
- }
- return 0;
-}
-
-int dodup_x1(Classfile *c)
-{
- *stkptr = *(stkptr-1);
- *(stkptr-1) = *(stkptr-2);
- *(stkptr-2) = *stkptr;
- (*stkptr)->numrefs++;
- stkptr++;
- return 0;
-}
+/* d5-stack.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int dopop(Classfile *c)
+{
+ if (stkptr != stack) *donestkptr++ = *(--stkptr);
+ return 0;
+}
+
+
+int dodup(Classfile *c)
+{
+ if ((*(stkptr-1))->e->op != NEW) {
+ *stkptr = *(stkptr-1);
+ (*stkptr)->numrefs++;
+ stkptr++;
+ }
+ return 0;
+}
+
+int dodup_x1(Classfile *c)
+{
+ *stkptr = *(stkptr-1);
+ *(stkptr-1) = *(stkptr-2);
+ *(stkptr-2) = *stkptr;
+ (*stkptr)->numrefs++;
+ stkptr++;
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d6-arith.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d6-arith.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d6-arith.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d6-arith.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d6-arith.cpp Fri May 13 13:10:44 2005
@@ -1,99 +1,99 @@
-/* d6-arith.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-extern int cond_pcend;
-extern Exp *cond_e;
-extern Exp *cond_e2;
-extern Exp **cond_donestkptr;
-extern Exp **cond_stkptr;
-
-int pushbinop(Classfile *c) /* push binary operation, popping operands e.g. lxor */
-{
- unsigned pcval = currpc - 1;
- Exp *e2 = *(--stkptr);
- Exp *e1 = *(stkptr-1);
- *(stkptr-1) = new Exp(pcval, min(min(e1->minpc, e2->minpc), pcval), BINARY,
- e1->e->type,
- (Op)((ch < 0x74)?
- ((ch - 0x60) >> 2) : (0x07 + ((ch - 0x78) >> 1))),
- e1, e2);
- return 0;
-}
-
-int pushunop(Classfile *c) /* push unary operation, popping operand e.g. lneg */
-{
- unsigned pcval = currpc - 1, branch_pc;
- char *tmpstr, *buff;
- Exp *e1 = *(stkptr-1);
- Op eop = CAST;
- Type etype = VOID;
- int val;
- switch (ch) {
- case 0x74: case 0x75: case 0x76: case 0x77: eop = NEG; etype = e1->e->type; break;
- case 0x88: case 0x8B: case 0x8E: etype = INT; break;
- case 0x85: case 0x8C: case 0x8F: etype = LONG; break;
- case 0x86: case 0x89: case 0x90: etype = FLOAT; break;
- case 0x87: case 0x8A: case 0x8D: etype = DOUBLE; break;
- case 0x91: etype = BYTE; break;
- case 0x92: etype = CHAR; break;
- case 0x93: etype = SHORT; break;
- case 0xBF:
- --stkptr;
- *donestkptr++ = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, VOID, THROW, e1);
- return 0;
- case 0xBB:
- val = JDNEXT16U();
- tmpstr = c->cp(val)->chp;
- buff = new char[strlen(tmpstr) + 1]; strcpy(buff, tmpstr);
- e1 = new Exp(pcval, buff, VOID, CP, val);
- *(stkptr++) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, OBJECT, NEW, e1);
-// if ((ch = JDNEXT8()) == 0x59)
-// return actiontable[actions[ch = JDNEXT8()]]();
-// else
-// return actiontable[actions[ch]]();
- case 0xBA: eop = NEW; break;
- case 0xA7: /* GOTO really shouldn't be here! */
- if (stkptr!=stack) {
-// if (stkptr!=(stack+1)) { fprintf(stderr, "Error in conditional operator!\n"); return 1; }
- if (cond_pcend != -1) { fprintf(stderr, "Can't handle recursive conditional operators!\n"); return 1; }
- cond_pcend = pcval + JDNEXT16S();
- cond_stkptr = stkptr;
- cond_e2 = *(--stkptr);
- --donestkptr;
- if ((*donestkptr)->e->et == BRANCH) {
- if ((*donestkptr)->branch_pc != currpc) {
- fprintf(stderr, "Error in conditional operator!\n"); return 1;
- }
- cond_e = *donestkptr;
- } else {
- fprintf(stderr, "Use of comma operator in conditionals not yet supported.\n");
- return 1;
- }
- cond_donestkptr = donestkptr;
- return 0;
- }
- branch_pc = pcval + JDNEXT16S();
- tmpstr = new char[100];
- sprintf(tmpstr,"label%i", branch_pc);
- buff = new char[strlen(tmpstr) + 1]; strcpy(buff, tmpstr);
- delete tmpstr;
- e1 = new Exp(pcval, buff, VOID/*label*/, IM);
- *donestkptr++ = new Exp(pcval, PREUNARY, VOID, GOTO, e1, branch_pc);
- return 0;
- default:
- fprintf(stderr, "Error in pushing unary operation\n");
- exit(-1);
- }
- *(stkptr-1) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, etype, eop, e1);
- return 0;
-}
+/* d6-arith.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+extern int cond_pcend;
+extern Exp *cond_e;
+extern Exp *cond_e2;
+extern Exp **cond_donestkptr;
+extern Exp **cond_stkptr;
+
+int pushbinop(Classfile *c) /* push binary operation, popping operands e.g. lxor */
+{
+ unsigned pcval = currpc - 1;
+ Exp *e2 = *(--stkptr);
+ Exp *e1 = *(stkptr-1);
+ *(stkptr-1) = new Exp(pcval, min(min(e1->minpc, e2->minpc), pcval), BINARY,
+ e1->e->type,
+ (Op)((ch < 0x74)?
+ ((ch - 0x60) >> 2) : (0x07 + ((ch - 0x78) >> 1))),
+ e1, e2);
+ return 0;
+}
+
+int pushunop(Classfile *c) /* push unary operation, popping operand e.g. lneg */
+{
+ unsigned pcval = currpc - 1, branch_pc;
+ char *tmpstr, *buff;
+ Exp *e1 = *(stkptr-1);
+ Op eop = CAST;
+ Type etype = VOID;
+ int val;
+ switch (ch) {
+ case 0x74: case 0x75: case 0x76: case 0x77: eop = NEG; etype = e1->e->type; break;
+ case 0x88: case 0x8B: case 0x8E: etype = INT; break;
+ case 0x85: case 0x8C: case 0x8F: etype = LONG; break;
+ case 0x86: case 0x89: case 0x90: etype = FLOAT; break;
+ case 0x87: case 0x8A: case 0x8D: etype = DOUBLE; break;
+ case 0x91: etype = BYTE; break;
+ case 0x92: etype = CHAR; break;
+ case 0x93: etype = SHORT; break;
+ case 0xBF:
+ --stkptr;
+ *donestkptr++ = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, VOID, THROW, e1);
+ return 0;
+ case 0xBB:
+ val = JDNEXT16U();
+ tmpstr = c->cp(val)->chp;
+ buff = new char[strlen(tmpstr) + 1]; strcpy(buff, tmpstr);
+ e1 = new Exp(pcval, buff, VOID, CP, val);
+ *(stkptr++) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, OBJECT, NEW, e1);
+// if ((ch = JDNEXT8()) == 0x59)
+// return actiontable[actions[ch = JDNEXT8()]]();
+// else
+// return actiontable[actions[ch]]();
+ case 0xBA: eop = NEW; break;
+ case 0xA7: /* GOTO really shouldn't be here! */
+ if (stkptr!=stack) {
+// if (stkptr!=(stack+1)) { fprintf(stderr, "Error in conditional operator!\n"); return 1; }
+ if (cond_pcend != -1) { fprintf(stderr, "Can't handle recursive conditional operators!\n"); return 1; }
+ cond_pcend = pcval + JDNEXT16S();
+ cond_stkptr = stkptr;
+ cond_e2 = *(--stkptr);
+ --donestkptr;
+ if ((*donestkptr)->e->et == BRANCH) {
+ if ((*donestkptr)->branch_pc != currpc) {
+ fprintf(stderr, "Error in conditional operator!\n"); return 1;
+ }
+ cond_e = *donestkptr;
+ } else {
+ fprintf(stderr, "Use of comma operator in conditionals not yet supported.\n");
+ return 1;
+ }
+ cond_donestkptr = donestkptr;
+ return 0;
+ }
+ branch_pc = pcval + JDNEXT16S();
+ tmpstr = new char[100];
+ sprintf(tmpstr,"label%i", branch_pc);
+ buff = new char[strlen(tmpstr) + 1]; strcpy(buff, tmpstr);
+ delete tmpstr;
+ e1 = new Exp(pcval, buff, VOID/*label*/, IM);
+ *donestkptr++ = new Exp(pcval, PREUNARY, VOID, GOTO, e1, branch_pc);
+ return 0;
+ default:
+ fprintf(stderr, "Error in pushing unary operation\n");
+ exit(-1);
+ }
+ *(stkptr-1) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, etype, eop, e1);
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d7-cntrl.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d7-cntrl.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d7-cntrl.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d7-cntrl.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d7-cntrl.cpp Fri May 13 13:10:44 2005
@@ -1,84 +1,84 @@
-/* d7-cntrl.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int cond_pcend;
-Exp *cond_e;
-Exp *cond_e2;
-Exp **cond_donestkptr;
-Exp **cond_stkptr;
-
-int doif1(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- Exp *e = *(--stkptr), *e1, *e2;
- switch (e->e->type) {
- case CMPTYPE:
- if (e->e->op != CMP) { fprintf(stderr, "doif1 error\n"); return 1; }
- e->e->op = (Op)(EQUAL + ch - 0x99); e->e->type = BOOLEAN;
- break;
- case BOOLEAN:
- if (ch == 0x99) // ifeq (ie if false)
- if (notexp(&e)) { fprintf(stderr, "doif1 error\n"); return 1; }
- break;
- case INT:
- e1 = *stkptr; e2 = new Exp(pcval, I0EXP);
- e = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, (Op)(EQUAL + ch - 0x99), e1, e2);
- break;
- case OBJECT:
- e1 = *stkptr; e2 = new Exp(pcval, NULLEXP);
- e = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, (Op)(EQUAL + ch - 0xC6), e1, e2);
- break;
- default:
- break;
- }
- *donestkptr++ = new Exp(pcval, e->minpc, IFEXP, e, pcval + JDNEXT16S());
- return 0;
-}
-
-int doif2(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- Exp *e2 = *(--stkptr);
- Exp *e1 = *(--stkptr);
- Exp *e = new Exp(pcval, min(e1->minpc, e2->minpc), BINARY, BOOLEAN,
- (Op)(EQUAL + ((ch - 0x9F) % 6)), e1, e2);
- *donestkptr++ = new Exp(pcval, e->minpc, /*std_exp*/IFEXP, e,
- /*branch_pc*/pcval + JDNEXT16S());
- return 0;
-}
-
-int docmp(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- Exp *e2 = *(--stkptr);
- Exp *e1 = *(stkptr-1);
- *(stkptr-1) = new Exp(pcval, min(e1->minpc, e2->minpc), BINARY, CMPTYPE, CMP, e1, e2);
- return 0;
-}
-
-int finishconditional(Classfile *c) {
- if ((stkptr != cond_stkptr) || (donestkptr != cond_donestkptr))
- { fprintf(stderr, "Error cond\n"); return 1; }
- cond_e->e++;
- if ((cond_e->exp1->e->op > LESSOREQUAL) || (cond_e->exp1->e->op < EQUAL)) {
- if (cond_e->exp1->e->type != BOOLEAN) { fprintf(stderr, "Can't not a non-boolean\n"); return 1; }
- Exp *e1 = cond_e->exp1;
- cond_e->exp1 = new Exp(currpc, e1->minpc, PREUNARY, BOOLEAN, NOT_BOOL, e1);
- } else {
- *((int*)(&cond_e->exp1->e->op)) ^= 1;
- }
- cond_e->exp2 = cond_e2; cond_e->exp3 = *(stkptr-1);
- *(stkptr-1) = cond_e;
- cond_pcend = -1;
- return 0;
-}
+/* d7-cntrl.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int cond_pcend;
+Exp *cond_e;
+Exp *cond_e2;
+Exp **cond_donestkptr;
+Exp **cond_stkptr;
+
+int doif1(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ Exp *e = *(--stkptr), *e1, *e2;
+ switch (e->e->type) {
+ case CMPTYPE:
+ if (e->e->op != CMP) { fprintf(stderr, "doif1 error\n"); return 1; }
+ e->e->op = (Op)(EQUAL + ch - 0x99); e->e->type = BOOLEAN;
+ break;
+ case BOOLEAN:
+ if (ch == 0x99) // ifeq (ie if false)
+ if (notexp(&e)) { fprintf(stderr, "doif1 error\n"); return 1; }
+ break;
+ case INT:
+ e1 = *stkptr; e2 = new Exp(pcval, I0EXP);
+ e = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, (Op)(EQUAL + ch - 0x99), e1, e2);
+ break;
+ case OBJECT:
+ e1 = *stkptr; e2 = new Exp(pcval, NULLEXP);
+ e = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, (Op)(EQUAL + ch - 0xC6), e1, e2);
+ break;
+ default:
+ break;
+ }
+ *donestkptr++ = new Exp(pcval, e->minpc, IFEXP, e, pcval + JDNEXT16S());
+ return 0;
+}
+
+int doif2(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ Exp *e2 = *(--stkptr);
+ Exp *e1 = *(--stkptr);
+ Exp *e = new Exp(pcval, min(e1->minpc, e2->minpc), BINARY, BOOLEAN,
+ (Op)(EQUAL + ((ch - 0x9F) % 6)), e1, e2);
+ *donestkptr++ = new Exp(pcval, e->minpc, /*std_exp*/IFEXP, e,
+ /*branch_pc*/pcval + JDNEXT16S());
+ return 0;
+}
+
+int docmp(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ Exp *e2 = *(--stkptr);
+ Exp *e1 = *(stkptr-1);
+ *(stkptr-1) = new Exp(pcval, min(e1->minpc, e2->minpc), BINARY, CMPTYPE, CMP, e1, e2);
+ return 0;
+}
+
+int finishconditional(Classfile *c) {
+ if ((stkptr != cond_stkptr) || (donestkptr != cond_donestkptr))
+ { fprintf(stderr, "Error cond\n"); return 1; }
+ cond_e->e++;
+ if ((cond_e->exp1->e->op > LESSOREQUAL) || (cond_e->exp1->e->op < EQUAL)) {
+ if (cond_e->exp1->e->type != BOOLEAN) { fprintf(stderr, "Can't not a non-boolean\n"); return 1; }
+ Exp *e1 = cond_e->exp1;
+ cond_e->exp1 = new Exp(currpc, e1->minpc, PREUNARY, BOOLEAN, NOT_BOOL, e1);
+ } else {
+ *((int*)(&cond_e->exp1->e->op)) ^= 1;
+ }
+ cond_e->exp2 = cond_e2; cond_e->exp3 = *(stkptr-1);
+ *(stkptr-1) = cond_e;
+ cond_pcend = -1;
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/d8-ret.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d8-ret.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d8-ret.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d8-ret.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d8-ret.cpp Fri May 13 13:10:44 2005
@@ -1,35 +1,35 @@
-/* d8-ret.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int doreturn(Classfile *c) /* push return op, popping operand e.g. ireturn LO3 */
-{
- unsigned pcval = currpc - 1;
- if (ch == 0xB1) {
- if (bufflength > 0) {
- Exp *e1 = new Exp(pcval, "/* void */", VOID, IM);
- *donestkptr++ = new Exp(pcval, PREUNARY, VOID, RETURN, e1);
- }
- } else {
- Exp *e1 = *(stkptr-1);
- if ((e1->e->type == INT) && (miptr->ret_type == BOOLEAN)) {
- if ((e1->e == std_exps + 2)||(e1->e == std_exps + 3))
- e1->e += 13; /* convert 0 or 1 to false or true */
- else
- /* CMPEQ */;
- }
- --stkptr;
- *donestkptr++ = new Exp(pcval, min(pcval, e1->minpc), PREUNARY, VOID, RETURN, e1);
- }
- return 0;
-}
-
+/* d8-ret.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int doreturn(Classfile *c) /* push return op, popping operand e.g. ireturn LO3 */
+{
+ unsigned pcval = currpc - 1;
+ if (ch == 0xB1) {
+ if (bufflength > 0) {
+ Exp *e1 = new Exp(pcval, "/* void */", VOID, IM);
+ *donestkptr++ = new Exp(pcval, PREUNARY, VOID, RETURN, e1);
+ }
+ } else {
+ Exp *e1 = *(stkptr-1);
+ if ((e1->e->type == INT) && (miptr->ret_type == BOOLEAN)) {
+ if ((e1->e == std_exps + 2)||(e1->e == std_exps + 3))
+ e1->e += 13; /* convert 0 or 1 to false or true */
+ else
+ /* CMPEQ */;
+ }
+ --stkptr;
+ *donestkptr++ = new Exp(pcval, min(pcval, e1->minpc), PREUNARY, VOID, RETURN, e1);
+ }
+ return 0;
+}
+
Index: llvm-test/MultiSource/Applications/hbd/d9-swtch.cpp
diff -u llvm-test/MultiSource/Applications/hbd/d9-swtch.cpp:1.1 llvm-test/MultiSource/Applications/hbd/d9-swtch.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/d9-swtch.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/d9-swtch.cpp Fri May 13 13:10:44 2005
@@ -1,43 +1,43 @@
-/* d9-swtch.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int dotableswitch(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- while(currpc%4) JDNEXT8U();
- Exp *e1 = *(--stkptr);
- unsigned defaultpc = JDNEXT32S();
- unsigned low = JDNEXT32S(), high = JDNEXT32S(), numcases = high - low + 1;
- Case *tcase = new Case[numcases];
- *donestkptr++ = new Exp(pcval, e1->minpc, SWITCH, VOID, ID, e1, defaultpc, numcases, tcase);
- for (unsigned m = low; m <= high;) {
- tcase->caseval = m++;
- (tcase++)->branch_pc = JDNEXT32S();
- }
- return 0;
-}
-
-int doluswitch(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- while(currpc%4) JDNEXT8U();
- Exp *e1 = *(--stkptr);
- unsigned defaultpc = JDNEXT32U(), numcases = JDNEXT32U();
- Case *tcase = new Case[numcases];
- *donestkptr++ = new Exp(pcval, e1->minpc, SWITCH, VOID, ID, e1, defaultpc, numcases, tcase);
- for (unsigned m = numcases; m--;) {
- tcase->caseval = JDNEXT32U();
- (tcase++)->branch_pc = JDNEXT32U();
- }
- return 0;
-}
+/* d9-swtch.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int dotableswitch(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ while(currpc%4) JDNEXT8U();
+ Exp *e1 = *(--stkptr);
+ unsigned defaultpc = JDNEXT32S();
+ unsigned low = JDNEXT32S(), high = JDNEXT32S(), numcases = high - low + 1;
+ Case *tcase = new Case[numcases];
+ *donestkptr++ = new Exp(pcval, e1->minpc, SWITCH, VOID, ID, e1, defaultpc, numcases, tcase);
+ for (unsigned m = low; m <= high;) {
+ tcase->caseval = m++;
+ (tcase++)->branch_pc = JDNEXT32S();
+ }
+ return 0;
+}
+
+int doluswitch(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ while(currpc%4) JDNEXT8U();
+ Exp *e1 = *(--stkptr);
+ unsigned defaultpc = JDNEXT32U(), numcases = JDNEXT32U();
+ Case *tcase = new Case[numcases];
+ *donestkptr++ = new Exp(pcval, e1->minpc, SWITCH, VOID, ID, e1, defaultpc, numcases, tcase);
+ for (unsigned m = numcases; m--;) {
+ tcase->caseval = JDNEXT32U();
+ (tcase++)->branch_pc = JDNEXT32U();
+ }
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/da-field.cpp
diff -u llvm-test/MultiSource/Applications/hbd/da-field.cpp:1.1 llvm-test/MultiSource/Applications/hbd/da-field.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/da-field.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/da-field.cpp Fri May 13 13:10:44 2005
@@ -1,112 +1,112 @@
-/* da-field.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-#include "field.h"
-
-int doget(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- int val = JDNEXT16S();
- Ref *mr = (Ref*)c->cp[val]->p;
- NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
- char *tmpstr = c->cp[nt->name_index]->chp;
- Exp *e = new Exp(pcval, tmpstr, sig2type(c->cp[nt->signature_index]->chp), CP, val);
- if (ch == 0xB2) { /* getstatic */
- Exp *e1;
- tmpstr = c->cp(mr->class_index)->chp;
-// int tmpint = strlen(c->package_name);
- if (strcmp(tmpstr, c->this_class_name)) {
- Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
- e1 = new Exp(pcval, BINARY, e->e->type, DOT, e2, e);
- e->e->type = VOID;
- } else {
- e1 = e;
- }
- *stkptr++ = e1;
- return 0;
- } else { /* getfield */
- if (((*(stkptr-1))->e->et == IDENT) && !strcmp((*(stkptr-1))->e->id->name,"this")) {
- /* this.bar == bar */
- e->minpc = min(pcval, (*(stkptr-1))->minpc);
- *(stkptr-1) = e; return 0;
- } else {
- /* foo.bar */
- *(stkptr-1) = new Exp(pcval, min(pcval, (*(stkptr-1))->minpc), BINARY,
- e->e->type, DOT, *(stkptr-1), e);
- e->e->type = VOID;
- return 0;
- }
- }
-}
-
-int doput(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- int val = JDNEXT16S();
- Ref *mr = (Ref*)c->cp[val]->p;
- NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
- char *tmpstr = c->cp[nt->name_index]->chp;
- Exp *e = new Exp(pcval, tmpstr, sig2type(c->cp[nt->signature_index]->chp), NO);
- if (ch == 0xB3) { /* putstatic */
- Exp *e1;
- tmpstr = c->cp(mr->class_index)->chp;
- if (strcmp(tmpstr, c->this_class_name)) {
- Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
- e1 = new Exp(pcval, BINARY, e->e->type, DOT, e2, e);
- e->e->type = VOID;
- } else {
- e1 = e;
- }
- Exp *e3 = *(--stkptr);
- if ((e3->e->type == INT) && (e1->e->type == BOOLEAN)) {
- if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
- e3->e += 13;
- else
- /* CMPEQ */;
- }
- *donestkptr++ = new Exp(pcval, min(pcval, e3->minpc), BINARY,
- e1->e->type, ASSIGN, e1, e3);
- return 0;
- } else { /* putfield */
- Exp *e3 = *(stkptr-2);
- if ((e3->e->et == IDENT) && !strcmp(e3->e->id->name,"this")) {
- /* this.bar == bar */
- e3 = *(--stkptr);
- if ((e3->e->type == INT) && (e->e->type == BOOLEAN)) {
- if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
- e3->e += 13;
- else
- /* CMPEQ */;
- }
- stkptr--;
- *donestkptr++ = new Exp(pcval, min(min(pcval, (*stkptr)->minpc),
- (*stkptr)->minpc),
- BINARY, e->e->type, ASSIGN, e, e3);
- return 0;
- } else {
- /* foo.bar */
- Exp *e1 = new Exp(pcval, min((*(stkptr-1))->minpc, pcval), BINARY,
- e->e->type, DOT, e3, e);
- e->e->type = VOID;
- e3 = *(--stkptr);
- if ((e3->e->type == INT) && (e1->e->type == BOOLEAN)) {
- if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
- e3->e += 13;
- else
- /* CMPEQ */;
- }
- *donestkptr++ = new Exp(pcval, min(e3->minpc, e1->minpc), BINARY,
- e1->e->type, ASSIGN, e1, e3);
- return 0;
- }
- }
-}
+/* da-field.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+#include "field.h"
+
+int doget(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ int val = JDNEXT16S();
+ Ref *mr = (Ref*)c->cp[val]->p;
+ NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
+ char *tmpstr = c->cp[nt->name_index]->chp;
+ Exp *e = new Exp(pcval, tmpstr, sig2type(c->cp[nt->signature_index]->chp), CP, val);
+ if (ch == 0xB2) { /* getstatic */
+ Exp *e1;
+ tmpstr = c->cp(mr->class_index)->chp;
+// int tmpint = strlen(c->package_name);
+ if (strcmp(tmpstr, c->this_class_name)) {
+ Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
+ e1 = new Exp(pcval, BINARY, e->e->type, DOT, e2, e);
+ e->e->type = VOID;
+ } else {
+ e1 = e;
+ }
+ *stkptr++ = e1;
+ return 0;
+ } else { /* getfield */
+ if (((*(stkptr-1))->e->et == IDENT) && !strcmp((*(stkptr-1))->e->id->name,"this")) {
+ /* this.bar == bar */
+ e->minpc = min(pcval, (*(stkptr-1))->minpc);
+ *(stkptr-1) = e; return 0;
+ } else {
+ /* foo.bar */
+ *(stkptr-1) = new Exp(pcval, min(pcval, (*(stkptr-1))->minpc), BINARY,
+ e->e->type, DOT, *(stkptr-1), e);
+ e->e->type = VOID;
+ return 0;
+ }
+ }
+}
+
+int doput(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ int val = JDNEXT16S();
+ Ref *mr = (Ref*)c->cp[val]->p;
+ NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
+ char *tmpstr = c->cp[nt->name_index]->chp;
+ Exp *e = new Exp(pcval, tmpstr, sig2type(c->cp[nt->signature_index]->chp), NO);
+ if (ch == 0xB3) { /* putstatic */
+ Exp *e1;
+ tmpstr = c->cp(mr->class_index)->chp;
+ if (strcmp(tmpstr, c->this_class_name)) {
+ Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
+ e1 = new Exp(pcval, BINARY, e->e->type, DOT, e2, e);
+ e->e->type = VOID;
+ } else {
+ e1 = e;
+ }
+ Exp *e3 = *(--stkptr);
+ if ((e3->e->type == INT) && (e1->e->type == BOOLEAN)) {
+ if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
+ e3->e += 13;
+ else
+ /* CMPEQ */;
+ }
+ *donestkptr++ = new Exp(pcval, min(pcval, e3->minpc), BINARY,
+ e1->e->type, ASSIGN, e1, e3);
+ return 0;
+ } else { /* putfield */
+ Exp *e3 = *(stkptr-2);
+ if ((e3->e->et == IDENT) && !strcmp(e3->e->id->name,"this")) {
+ /* this.bar == bar */
+ e3 = *(--stkptr);
+ if ((e3->e->type == INT) && (e->e->type == BOOLEAN)) {
+ if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
+ e3->e += 13;
+ else
+ /* CMPEQ */;
+ }
+ stkptr--;
+ *donestkptr++ = new Exp(pcval, min(min(pcval, (*stkptr)->minpc),
+ (*stkptr)->minpc),
+ BINARY, e->e->type, ASSIGN, e, e3);
+ return 0;
+ } else {
+ /* foo.bar */
+ Exp *e1 = new Exp(pcval, min((*(stkptr-1))->minpc, pcval), BINARY,
+ e->e->type, DOT, e3, e);
+ e->e->type = VOID;
+ e3 = *(--stkptr);
+ if ((e3->e->type == INT) && (e1->e->type == BOOLEAN)) {
+ if ((e3->e == std_exps + 2)||(e3->e == std_exps + 3))
+ e3->e += 13;
+ else
+ /* CMPEQ */;
+ }
+ *donestkptr++ = new Exp(pcval, min(e3->minpc, e1->minpc), BINARY,
+ e1->e->type, ASSIGN, e1, e3);
+ return 0;
+ }
+ }
+}
Index: llvm-test/MultiSource/Applications/hbd/db-meth.cpp
diff -u llvm-test/MultiSource/Applications/hbd/db-meth.cpp:1.1 llvm-test/MultiSource/Applications/hbd/db-meth.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/db-meth.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/db-meth.cpp Fri May 13 13:10:44 2005
@@ -1,117 +1,117 @@
-/* db-meth.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int invokefunc(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- unsigned minpcval = pcval;
- int i;
- Type exptypes[256];
- int val = JDNEXT16S();
- Ref *mr = (Ref*)c->cp[val]->p;
- NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
- char *classname = c->cp(mr->class_index)->chp;
- char *tmpstr = c->cp[nt->signature_index]->chp;
- char *name = c->cp[nt->name_index]->chp;
- Exp **el = new Exp*[strlen(tmpstr)-2];
- Exp *e1 = new Exp(pcval, name, VOID, NO);
- unsigned numexps = 0;
- while (*(++tmpstr) != ')') {
- exptypes[numexps++] = sig2type(tmpstr);
- if (*tmpstr == '[') tmpstr++;
- if (*tmpstr == 'L') while (*(++tmpstr) != ';') /* do nothing */;
- }
- Type etype = sig2type(tmpstr + 1);
- Exp **elp = el;
- for (i = numexps; i--;) {
- if (((*(--stkptr))->e->type == INT) && (exptypes[i] == BOOLEAN)) {
- if (((*stkptr)->e == std_exps + 2)||((*stkptr)->e == std_exps + 3))
- (*stkptr)->e += 13;
- else
- /* CMPEQ */;
- }
- *elp++ = *stkptr;
- minpcval = min(minpcval, (*stkptr)->minpc);
- }
- if (ch == 0xB9) { /* invokeinterface */
- if (numexps != (unsigned)(JDNEXT8U() - 1)) {
- fprintf(stderr,"Error in interface method invocation - nargs doesn't match.\n");
- return 1;
- }
- JDNEXT8U(); /* reserved byte */
- }
- if (ch != 0xB8) { /* invokevirtual OR invokenonvirtual OR invokeinterface */
- if (((*(stkptr-1))->e->et == IDENT) && !strcmp((*(stkptr-1))->e->id->name,"this")) {
- /* this.bar(...) == bar(...) */
- if (strcmp(classname,c->this_class_name)) { /* super.bar(...) */
- if (!strcmp(name,"<init>")) { /* super() */
- e1->e->id->name = "super";
- minpcval = min(minpcval, (*(stkptr-1))->minpc);
- Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
- if (etype == VOID) {
- --stkptr; *donestkptr++ = e;
- } else *(stkptr-1) = e;
- return 0;
- }
- minpcval = min(minpcval, (*(stkptr-1))->minpc);
- Exp *e2 = new Exp(pcval, "super", VOID, NO);
- Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, e2, e1);
- Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
- if (etype == VOID) {
- --stkptr; *donestkptr++ = e;
- } else *(stkptr-1) = e;
- return 0;
- } else {
- if (!strcmp(name,"<init>")) {
- minpcval = min(minpcval, (*(stkptr-1))->minpc);
- e1->e->id->name = "this";
- }
- Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
- if (e->e->type == VOID) {
- --stkptr; *donestkptr++ = e;
- } else *(stkptr-1) = e;
- return 0;
- }
- } else {
- /* foo.bar(...) */
- Exp *e;
- if (!strcmp(name,"<init>")) {
- /* killexp(e1)? */
- minpcval = min(minpcval, (*(stkptr-1))->minpc);
- e = new Exp(pcval, minpcval, FUNCTIONCALL, OBJECT, ID, *(stkptr-1), numexps, el);
- } else {
- minpcval = min(minpcval, (*(stkptr-1))->minpc);
- Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, *(stkptr-1), e1);
- e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
- }
- if ((e->exp1->e->op != NEW) && (etype == VOID)) {
- --stkptr; *donestkptr++ = e;
- } else *(stkptr-1) = e;
- return 0;
- }
- } else { /* invokestatic */
- Exp *e;
- tmpstr = c->cp(mr->class_index)->chp;
- if (strcmp(tmpstr, c->this_class_name)) {
- Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
- Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, e2, e1);
- e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
- } else
- e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
- if (etype == VOID)
- *donestkptr++ = e;
- else
- *stkptr++ = e;
- return 0;
- }
-}
+/* db-meth.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int invokefunc(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ unsigned minpcval = pcval;
+ int i;
+ Type exptypes[256];
+ int val = JDNEXT16S();
+ Ref *mr = (Ref*)c->cp[val]->p;
+ NameAndType *nt = (NameAndType*)c->cp[mr->name_and_type]->p;
+ char *classname = c->cp(mr->class_index)->chp;
+ char *tmpstr = c->cp[nt->signature_index]->chp;
+ char *name = c->cp[nt->name_index]->chp;
+ Exp **el = new Exp*[strlen(tmpstr)-2];
+ Exp *e1 = new Exp(pcval, name, VOID, NO);
+ unsigned numexps = 0;
+ while (*(++tmpstr) != ')') {
+ exptypes[numexps++] = sig2type(tmpstr);
+ if (*tmpstr == '[') tmpstr++;
+ if (*tmpstr == 'L') while (*(++tmpstr) != ';') /* do nothing */;
+ }
+ Type etype = sig2type(tmpstr + 1);
+ Exp **elp = el;
+ for (i = numexps; i--;) {
+ if (((*(--stkptr))->e->type == INT) && (exptypes[i] == BOOLEAN)) {
+ if (((*stkptr)->e == std_exps + 2)||((*stkptr)->e == std_exps + 3))
+ (*stkptr)->e += 13;
+ else
+ /* CMPEQ */;
+ }
+ *elp++ = *stkptr;
+ minpcval = min(minpcval, (*stkptr)->minpc);
+ }
+ if (ch == 0xB9) { /* invokeinterface */
+ if (numexps != (unsigned)(JDNEXT8U() - 1)) {
+ fprintf(stderr,"Error in interface method invocation - nargs doesn't match.\n");
+ return 1;
+ }
+ JDNEXT8U(); /* reserved byte */
+ }
+ if (ch != 0xB8) { /* invokevirtual OR invokenonvirtual OR invokeinterface */
+ if (((*(stkptr-1))->e->et == IDENT) && !strcmp((*(stkptr-1))->e->id->name,"this")) {
+ /* this.bar(...) == bar(...) */
+ if (strcmp(classname,c->this_class_name)) { /* super.bar(...) */
+ if (!strcmp(name,"<init>")) { /* super() */
+ e1->e->id->name = "super";
+ minpcval = min(minpcval, (*(stkptr-1))->minpc);
+ Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
+ if (etype == VOID) {
+ --stkptr; *donestkptr++ = e;
+ } else *(stkptr-1) = e;
+ return 0;
+ }
+ minpcval = min(minpcval, (*(stkptr-1))->minpc);
+ Exp *e2 = new Exp(pcval, "super", VOID, NO);
+ Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, e2, e1);
+ Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
+ if (etype == VOID) {
+ --stkptr; *donestkptr++ = e;
+ } else *(stkptr-1) = e;
+ return 0;
+ } else {
+ if (!strcmp(name,"<init>")) {
+ minpcval = min(minpcval, (*(stkptr-1))->minpc);
+ e1->e->id->name = "this";
+ }
+ Exp *e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
+ if (e->e->type == VOID) {
+ --stkptr; *donestkptr++ = e;
+ } else *(stkptr-1) = e;
+ return 0;
+ }
+ } else {
+ /* foo.bar(...) */
+ Exp *e;
+ if (!strcmp(name,"<init>")) {
+ /* killexp(e1)? */
+ minpcval = min(minpcval, (*(stkptr-1))->minpc);
+ e = new Exp(pcval, minpcval, FUNCTIONCALL, OBJECT, ID, *(stkptr-1), numexps, el);
+ } else {
+ minpcval = min(minpcval, (*(stkptr-1))->minpc);
+ Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, *(stkptr-1), e1);
+ e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
+ }
+ if ((e->exp1->e->op != NEW) && (etype == VOID)) {
+ --stkptr; *donestkptr++ = e;
+ } else *(stkptr-1) = e;
+ return 0;
+ }
+ } else { /* invokestatic */
+ Exp *e;
+ tmpstr = c->cp(mr->class_index)->chp;
+ if (strcmp(tmpstr, c->this_class_name)) {
+ Exp *e2 = new Exp(pcval, tmpstr, VOID, NO);
+ Exp *e3 = new Exp(pcval, minpcval, BINARY, FUNC, DOT, e2, e1);
+ e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e3, numexps, el);
+ } else
+ e = new Exp(pcval, minpcval, FUNCTIONCALL, etype, ID, e1, numexps, el);
+ if (etype == VOID)
+ *donestkptr++ = e;
+ else
+ *stkptr++ = e;
+ return 0;
+ }
+}
Index: llvm-test/MultiSource/Applications/hbd/dc-misc.cpp
diff -u llvm-test/MultiSource/Applications/hbd/dc-misc.cpp:1.1 llvm-test/MultiSource/Applications/hbd/dc-misc.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/dc-misc.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/dc-misc.cpp Fri May 13 13:10:44 2005
@@ -1,32 +1,32 @@
-/* dc-misc.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "exp.h"
-#include "class.h"
-#include "decomp.h"
-#include "cp.h"
-
-int docheckcast(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- unsigned val = JDNEXT16U();
- Exp *e1 = *(stkptr-1);
- Exp *e2 = new Exp(pcval, c->cp(val)->chp, OBJECT, CP, val);
- *(stkptr-1) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, OBJECT, CAST, e1, e2);
- return 0;
-}
-
-int doinstanceof(Classfile *c)
-{
- unsigned pcval = currpc - 1;
- unsigned val = JDNEXT16U();
- Exp *e1 = *(stkptr-1);
- Exp *e2 = new Exp(pcval, c->cp(val)->chp, OBJECT, CP, val);
- *(stkptr-1) = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, INSTANCEOF, e1, e2);
- return 0;
-}
+/* dc-misc.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "exp.h"
+#include "class.h"
+#include "decomp.h"
+#include "cp.h"
+
+int docheckcast(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ unsigned val = JDNEXT16U();
+ Exp *e1 = *(stkptr-1);
+ Exp *e2 = new Exp(pcval, c->cp(val)->chp, OBJECT, CP, val);
+ *(stkptr-1) = new Exp(pcval, min(e1->minpc, pcval), PREUNARY, OBJECT, CAST, e1, e2);
+ return 0;
+}
+
+int doinstanceof(Classfile *c)
+{
+ unsigned pcval = currpc - 1;
+ unsigned val = JDNEXT16U();
+ Exp *e1 = *(stkptr-1);
+ Exp *e2 = new Exp(pcval, c->cp(val)->chp, OBJECT, CP, val);
+ *(stkptr-1) = new Exp(pcval, e1->minpc, BINARY, BOOLEAN, INSTANCEOF, e1, e2);
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/err.cpp
diff -u llvm-test/MultiSource/Applications/hbd/err.cpp:1.1 llvm-test/MultiSource/Applications/hbd/err.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/err.cpp:1.1 Fri Feb 27 12:06:48 2004
+++ llvm-test/MultiSource/Applications/hbd/err.cpp Fri May 13 13:10:44 2005
@@ -1,32 +1,32 @@
-/* err.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "general.h"
-#include "options.h"
-
-char *errmsgs[] = {
- "Unknown error.",
- "Out of memory error.",
- DEBUG_ON? "Usage: %s [-O] [-D] InFile.class [OutFile.java]\n"
- :"Usage: %s [-O] InFile.class [OutFile.java]\n",
- DEBUG_ON? "Usage: %s [-D] -Ifuncname InFile.class\n"
- :"Usage: %s -Ifuncname InFile.class\n",
- "Not a class.",
- "Unsupported Class Version.",
- "3"
-};
-void fatalerror(int msgid,...)
-{
- va_list ap;
- va_start(ap, msgid);
- vfprintf(stderr, errmsgs[msgid], ap);
- va_end(ap);
- exit(msgid);
-}
+/* err.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "general.h"
+#include "options.h"
+
+char *errmsgs[] = {
+ "Unknown error.",
+ "Out of memory error.",
+ DEBUG_ON? "Usage: %s [-O] [-D] InFile.class [OutFile.java]\n"
+ :"Usage: %s [-O] InFile.class [OutFile.java]\n",
+ DEBUG_ON? "Usage: %s [-D] -Ifuncname InFile.class\n"
+ :"Usage: %s -Ifuncname InFile.class\n",
+ "Not a class.",
+ "Unsupported Class Version.",
+ "3"
+};
+void fatalerror(int msgid,...)
+{
+ va_list ap;
+ va_start(ap, msgid);
+ vfprintf(stderr, errmsgs[msgid], ap);
+ va_end(ap);
+ exit(msgid);
+}
Index: llvm-test/MultiSource/Applications/hbd/exp.cpp
diff -u llvm-test/MultiSource/Applications/hbd/exp.cpp:1.1 llvm-test/MultiSource/Applications/hbd/exp.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/exp.cpp:1.1 Fri Feb 27 12:06:49 2004
+++ llvm-test/MultiSource/Applications/hbd/exp.cpp Fri May 13 13:10:44 2005
@@ -1,217 +1,217 @@
-/* exp.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "exp.h"
-
-Exp_ std_exps[] = {
- Exp_(&idnull), Exp_(&idneg1), Exp_(&id0i), Exp_(&id1i), Exp_(&id2i), Exp_(&id3i),
- Exp_(&id4i), Exp_(&id5i), Exp_(&id0L), Exp_(&id1L), Exp_(&id0f), Exp_(&id1f),
- Exp_(&id2f), Exp_(&id0d), Exp_(&id1d), Exp_(&idfalse), Exp_(&idtrue),
- Exp_(1, BRANCH, VOID, ID, 0), Exp_(1, TERNARY, BOOLEAN, COND, 0)
-};
-
-void killexp(Exp *e) {
- if (!(--e->numrefs)) {
- if (!e->e->isstd) {
- if (e->e->et == IDENT) {
-// delete e->e->id->name;
-// delete e->e->id;
- }
-// delete e->e;
- }
-// delete e;
- }
-}
-
-int notexp(Exp **e_ptr) {
- Exp *e = *e_ptr;
- switch (e->e->op) {
- case NOT_BOOL:
- *e_ptr = e->exp1;
- killexp(e);
- break;
- case OR_BOOL:
- e->e->op = AND_BOOL;
- notexp(&(e->exp1));
- notexp(&(e->exp2));
- break;
- case AND_BOOL:
- e->e->op = OR_BOOL;
- notexp(&(e->exp1));
- notexp(&(e->exp2));
- break;
- case OR: case AND:
- notexp(&(e->exp1));
- notexp(&(e->exp2));
- case EQUAL: case NOTEQUAL: case LESS: case GREATEROREQUAL:
- case GREATER: case LESSOREQUAL:
- *((int*)(&e->e->op)) ^= 1;
- break;
- default:
- if (e->e->type != BOOLEAN) {
- fprintf(stderr, "Can't not a non-boolean\n");
- return 1;
- }
- *e_ptr = new Exp(e->pc, e->minpc, PREUNARY, BOOLEAN, NOT_BOOL, e);
- }
- return 0;
-}
-
-/*
-Exp::Exp(int pcval, char *idname, Type idtype) {
- numrefs = 1;
- minpc = pc = pcval;
- e = new Exp_;
- e->isstd = 0;
- e->et = IDENT;
- e->op = ID;
- e->type = idtype;
- e->id = new Id;
- e->id->name = idname;
-}
-*/
-
-char *Exp::toString(unsigned nextpc) {
- char *e1, *e2, *e3, *o, *o2, *s, *t1;
- int sizestr, i;
- switch (e->et) {
- case IDENT:
- s = new char[strlen(e->id->name) + 1];
- strcpy(s, e->id->name);
- return s;
- case PREUNARY:
- exp1->numrefs += numrefs-1;
- e1 = exp1->toString(0);
- if (e->op == CAST) {
- if (e->type == OBJECT) {
- exp2->numrefs += numrefs-1;
- e2 = exp2->toString(0);
- killexp(exp2);
- o = new char[strlen(e2) + 3];
- sprintf(o, "(%s)", e2);
- delete e2;
- } else {
- o = new char[strlen(type2str[e->type]) + 3];
- sprintf(o, "(%s)", type2str[e->type]);
- }
- } else {
- o = strdup(op2str[e->op]);
- }
- s = new char[5 + strlen(o) + strlen(e1)];
- if (op_prec[exp1->e->op] < (op_prec[e->op] + 0))
- sprintf(s, "%s(%s)", o, e1);
- else
- sprintf(s, "%s%s", o, e1);
- killexp(exp1); delete e1; delete o;
- return s;
- case POSTUNARY:
- exp1->numrefs += numrefs-1;
- e1 = exp1->toString(0); o = op2str[e->op];
- s = new char[5 + strlen(o) + strlen(e1)];
- sprintf(s, (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)%s":"%s%s", e1, o);
- killexp(exp1); delete e1;
- return s;
- case BINARY:
- exp1->numrefs += numrefs-1;
- exp2->numrefs += numrefs-1;
- e1 = exp1->toString(0); e2 = exp2->toString(0);
- o = op2str[e->op];
- t1 = new char[9 + strlen(o)];
- sprintf(t1, "%s%s%s",
- (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
- o, (op_prec[exp2->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s");
- s = new char[strlen(t1) + strlen(e1) + strlen(e2) - 3];
- sprintf(s, t1, e1, e2); delete t1;
- killexp(exp1); killexp(exp2); delete e1; delete e2;
- return s;
- case TERNARY:
- exp1->numrefs += numrefs-1; exp2->numrefs += numrefs-1; exp3->numrefs += numrefs-1;
- e1 = exp1->toString(0); e2 = exp2->toString(0); e3 = exp3->toString(0);
- o = op2str[e->op]; o2 = op2str[e->op + 1];
- t1 = new char[19];
- sprintf(t1, "%s%s%s%s%s",
- (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
- o, (op_prec[exp2->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
- o2, (op_prec[exp3->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s");
- s = new char[strlen(t1) + strlen(e1) + strlen(e2) + strlen(e3) - 5];
- sprintf(s, t1, e1, e2, e3); delete t1;
- killexp(exp1); killexp(exp2); killexp(exp3);
- delete e1; delete e2; delete e3;
- return s;
- case FUNCTIONCALL:
- t1 = new char[256];
- exp1->numrefs += numrefs-1;
- e1 = exp1->toString(0); sizestr = strlen(e1) + 3;
- sprintf(t1, "%s(", e1);
- killexp(exp1); delete e1;
- i = numexps;
- if (i) {
- while (--i) {
- explist[i]->numrefs += numrefs-1;
- e1 = explist[i]->toString(0); strcat(t1, e1); sizestr += strlen(e1) + 2;
- killexp(explist[i]); delete e1; strcat(t1, ", ");
- }
- explist[0]->numrefs += numrefs-1;
- e1 = explist[0]->toString(0); strcat(t1, e1); sizestr += strlen(e1);
- killexp(explist[0]); delete e1;
- }
- strcat(t1,")");
- s = new char[sizestr];
- strcpy(s, t1);
- delete t1;
- return s;
- case ARRAYACCESS:
- exp1->numrefs += numrefs-1; exp2->numrefs += numrefs-1;
- e1 = exp1->toString(0); e2 = exp2->toString(0);
- s = new char[strlen(e1) + strlen(e2) + 3];
- sprintf(s, "%s[%s]", e1, e2);
- killexp(exp1); killexp(exp2); delete e1; delete e2;
- return s;
- case BRANCH:
-// if ((unsigned)e->op > minpc) {
-// {
-// intlist *i = indents_end, *j;
-// if ((!i) || (i->node >= branch_pc)) {
-// indents_end = new intlist;
-// indents_end->node = branch_pc;
-// indents_end->next = i;
-// } else {
-// while ((i->next) && (i->next->node < branch_pc)) i = i->next;
-// j = i->next; i = i->next = new intlist; i->next = j;
-// i->node = branch_pc;
-// }
-// indentlevel++;
- notexp(&exp1);
- exp1->numrefs += numrefs-1;
- e1 = exp1->toString(0);
- s = new char[strlen(e1) + 8];
- sprintf(s, "if (%s) {", e1);
-// } else {
-// exp1->numrefs += numrefs-1;
-// e1 = exp1->toString(0);
-// s = new char[strlen(e1) + 21];
-// sprintf(s, "if (%s) goto label%d", e1, branch_pc);
-// }
- killexp(exp1); delete e1;
- return s;
- case SWITCH:
- exp1->numrefs += numrefs-1;
- e1 = exp1->toString(0);
- s = new char[strlen(e1) + 29];
- sprintf(s, "switch (%s) default: label%d", e1, default_pc);
- killexp(exp1); delete e1;
- return s;
- default:
- fprintf(stderr, "Error converting expressions to strings. %d\n", e->et);
- exit(-1);
- return 0;
- }
-}
+/* exp.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "exp.h"
+
+Exp_ std_exps[] = {
+ Exp_(&idnull), Exp_(&idneg1), Exp_(&id0i), Exp_(&id1i), Exp_(&id2i), Exp_(&id3i),
+ Exp_(&id4i), Exp_(&id5i), Exp_(&id0L), Exp_(&id1L), Exp_(&id0f), Exp_(&id1f),
+ Exp_(&id2f), Exp_(&id0d), Exp_(&id1d), Exp_(&idfalse), Exp_(&idtrue),
+ Exp_(1, BRANCH, VOID, ID, 0), Exp_(1, TERNARY, BOOLEAN, COND, 0)
+};
+
+void killexp(Exp *e) {
+ if (!(--e->numrefs)) {
+ if (!e->e->isstd) {
+ if (e->e->et == IDENT) {
+// delete e->e->id->name;
+// delete e->e->id;
+ }
+// delete e->e;
+ }
+// delete e;
+ }
+}
+
+int notexp(Exp **e_ptr) {
+ Exp *e = *e_ptr;
+ switch (e->e->op) {
+ case NOT_BOOL:
+ *e_ptr = e->exp1;
+ killexp(e);
+ break;
+ case OR_BOOL:
+ e->e->op = AND_BOOL;
+ notexp(&(e->exp1));
+ notexp(&(e->exp2));
+ break;
+ case AND_BOOL:
+ e->e->op = OR_BOOL;
+ notexp(&(e->exp1));
+ notexp(&(e->exp2));
+ break;
+ case OR: case AND:
+ notexp(&(e->exp1));
+ notexp(&(e->exp2));
+ case EQUAL: case NOTEQUAL: case LESS: case GREATEROREQUAL:
+ case GREATER: case LESSOREQUAL:
+ *((int*)(&e->e->op)) ^= 1;
+ break;
+ default:
+ if (e->e->type != BOOLEAN) {
+ fprintf(stderr, "Can't not a non-boolean\n");
+ return 1;
+ }
+ *e_ptr = new Exp(e->pc, e->minpc, PREUNARY, BOOLEAN, NOT_BOOL, e);
+ }
+ return 0;
+}
+
+/*
+Exp::Exp(int pcval, char *idname, Type idtype) {
+ numrefs = 1;
+ minpc = pc = pcval;
+ e = new Exp_;
+ e->isstd = 0;
+ e->et = IDENT;
+ e->op = ID;
+ e->type = idtype;
+ e->id = new Id;
+ e->id->name = idname;
+}
+*/
+
+char *Exp::toString(unsigned nextpc) {
+ char *e1, *e2, *e3, *o, *o2, *s, *t1;
+ int sizestr, i;
+ switch (e->et) {
+ case IDENT:
+ s = new char[strlen(e->id->name) + 1];
+ strcpy(s, e->id->name);
+ return s;
+ case PREUNARY:
+ exp1->numrefs += numrefs-1;
+ e1 = exp1->toString(0);
+ if (e->op == CAST) {
+ if (e->type == OBJECT) {
+ exp2->numrefs += numrefs-1;
+ e2 = exp2->toString(0);
+ killexp(exp2);
+ o = new char[strlen(e2) + 3];
+ sprintf(o, "(%s)", e2);
+ delete e2;
+ } else {
+ o = new char[strlen(type2str[e->type]) + 3];
+ sprintf(o, "(%s)", type2str[e->type]);
+ }
+ } else {
+ o = strdup(op2str[e->op]);
+ }
+ s = new char[5 + strlen(o) + strlen(e1)];
+ if (op_prec[exp1->e->op] < (op_prec[e->op] + 0))
+ sprintf(s, "%s(%s)", o, e1);
+ else
+ sprintf(s, "%s%s", o, e1);
+ killexp(exp1); delete e1; delete o;
+ return s;
+ case POSTUNARY:
+ exp1->numrefs += numrefs-1;
+ e1 = exp1->toString(0); o = op2str[e->op];
+ s = new char[5 + strlen(o) + strlen(e1)];
+ sprintf(s, (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)%s":"%s%s", e1, o);
+ killexp(exp1); delete e1;
+ return s;
+ case BINARY:
+ exp1->numrefs += numrefs-1;
+ exp2->numrefs += numrefs-1;
+ e1 = exp1->toString(0); e2 = exp2->toString(0);
+ o = op2str[e->op];
+ t1 = new char[9 + strlen(o)];
+ sprintf(t1, "%s%s%s",
+ (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
+ o, (op_prec[exp2->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s");
+ s = new char[strlen(t1) + strlen(e1) + strlen(e2) - 3];
+ sprintf(s, t1, e1, e2); delete t1;
+ killexp(exp1); killexp(exp2); delete e1; delete e2;
+ return s;
+ case TERNARY:
+ exp1->numrefs += numrefs-1; exp2->numrefs += numrefs-1; exp3->numrefs += numrefs-1;
+ e1 = exp1->toString(0); e2 = exp2->toString(0); e3 = exp3->toString(0);
+ o = op2str[e->op]; o2 = op2str[e->op + 1];
+ t1 = new char[19];
+ sprintf(t1, "%s%s%s%s%s",
+ (op_prec[exp1->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
+ o, (op_prec[exp2->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s",
+ o2, (op_prec[exp3->e->op] < (op_prec[e->op] + 0))?"(%s)":"%s");
+ s = new char[strlen(t1) + strlen(e1) + strlen(e2) + strlen(e3) - 5];
+ sprintf(s, t1, e1, e2, e3); delete t1;
+ killexp(exp1); killexp(exp2); killexp(exp3);
+ delete e1; delete e2; delete e3;
+ return s;
+ case FUNCTIONCALL:
+ t1 = new char[256];
+ exp1->numrefs += numrefs-1;
+ e1 = exp1->toString(0); sizestr = strlen(e1) + 3;
+ sprintf(t1, "%s(", e1);
+ killexp(exp1); delete e1;
+ i = numexps;
+ if (i) {
+ while (--i) {
+ explist[i]->numrefs += numrefs-1;
+ e1 = explist[i]->toString(0); strcat(t1, e1); sizestr += strlen(e1) + 2;
+ killexp(explist[i]); delete e1; strcat(t1, ", ");
+ }
+ explist[0]->numrefs += numrefs-1;
+ e1 = explist[0]->toString(0); strcat(t1, e1); sizestr += strlen(e1);
+ killexp(explist[0]); delete e1;
+ }
+ strcat(t1,")");
+ s = new char[sizestr];
+ strcpy(s, t1);
+ delete t1;
+ return s;
+ case ARRAYACCESS:
+ exp1->numrefs += numrefs-1; exp2->numrefs += numrefs-1;
+ e1 = exp1->toString(0); e2 = exp2->toString(0);
+ s = new char[strlen(e1) + strlen(e2) + 3];
+ sprintf(s, "%s[%s]", e1, e2);
+ killexp(exp1); killexp(exp2); delete e1; delete e2;
+ return s;
+ case BRANCH:
+// if ((unsigned)e->op > minpc) {
+// {
+// intlist *i = indents_end, *j;
+// if ((!i) || (i->node >= branch_pc)) {
+// indents_end = new intlist;
+// indents_end->node = branch_pc;
+// indents_end->next = i;
+// } else {
+// while ((i->next) && (i->next->node < branch_pc)) i = i->next;
+// j = i->next; i = i->next = new intlist; i->next = j;
+// i->node = branch_pc;
+// }
+// indentlevel++;
+ notexp(&exp1);
+ exp1->numrefs += numrefs-1;
+ e1 = exp1->toString(0);
+ s = new char[strlen(e1) + 8];
+ sprintf(s, "if (%s) {", e1);
+// } else {
+// exp1->numrefs += numrefs-1;
+// e1 = exp1->toString(0);
+// s = new char[strlen(e1) + 21];
+// sprintf(s, "if (%s) goto label%d", e1, branch_pc);
+// }
+ killexp(exp1); delete e1;
+ return s;
+ case SWITCH:
+ exp1->numrefs += numrefs-1;
+ e1 = exp1->toString(0);
+ s = new char[strlen(e1) + 29];
+ sprintf(s, "switch (%s) default: label%d", e1, default_pc);
+ killexp(exp1); delete e1;
+ return s;
+ default:
+ fprintf(stderr, "Error converting expressions to strings. %d\n", e->et);
+ exit(-1);
+ return 0;
+ }
+}
Index: llvm-test/MultiSource/Applications/hbd/hbd.cpp
diff -u llvm-test/MultiSource/Applications/hbd/hbd.cpp:1.1 llvm-test/MultiSource/Applications/hbd/hbd.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/hbd.cpp:1.1 Fri Feb 27 12:06:49 2004
+++ llvm-test/MultiSource/Applications/hbd/hbd.cpp Fri May 13 13:10:44 2005
@@ -1,21 +1,21 @@
-/* hbd.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include "class.h"
-
-int debugon = 0;
-
-int main(int argc, char **argv)
-{
- fprintf(stderr, "HomeBrew Decompiler. Copyright (c) 1994-2003 Pete Ryland.\n");
- Classfile c(argc, argv);
- c.read();
- c.print();
- return 0;
-}
+/* hbd.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include "class.h"
+
+int debugon = 0;
+
+int main(int argc, char **argv)
+{
+ fprintf(stderr, "HomeBrew Decompiler. Copyright (c) 1994-2003 Pete Ryland.\n");
+ Classfile c(argc, argv);
+ c.read();
+ c.print();
+ return 0;
+}
Index: llvm-test/MultiSource/Applications/hbd/id.cpp
diff -u llvm-test/MultiSource/Applications/hbd/id.cpp:1.1 llvm-test/MultiSource/Applications/hbd/id.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/id.cpp:1.1 Fri Feb 27 12:06:49 2004
+++ llvm-test/MultiSource/Applications/hbd/id.cpp Fri May 13 13:10:44 2005
@@ -1,27 +1,27 @@
-/* id.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include "id.h"
-
-Id idnull = {"null", OBJECT, IM, 0},
- idneg1 = {"-1", INT, IM, 0},
- id0i = {"0", INT, IM, 0},
- id1i = {"1", INT, IM, 0},
- id2i = {"2", INT, IM, 0},
- id3i = {"3", INT, IM, 0},
- id4i = {"4", INT, IM, 0},
- id5i = {"5", INT, IM, 0},
- id0L = {"0L", LONG, IM, 0},
- id1L = {"1L", LONG, IM, 0},
- id0f = {"0.0f", FLOAT, IM, 0},
- id1f = {"1.0f", FLOAT, IM, 0},
- id2f = {"2.0f", FLOAT, IM, 0},
- id0d = {"0.0d", DOUBLE, IM, 0},
- id1d = {"1.0d", DOUBLE, IM, 0},
- idfalse = {"false", BOOLEAN, IM, 0},
- idtrue = {"true", BOOLEAN, IM, 0};
+/* id.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include "id.h"
+
+Id idnull = {"null", OBJECT, IM, 0},
+ idneg1 = {"-1", INT, IM, 0},
+ id0i = {"0", INT, IM, 0},
+ id1i = {"1", INT, IM, 0},
+ id2i = {"2", INT, IM, 0},
+ id3i = {"3", INT, IM, 0},
+ id4i = {"4", INT, IM, 0},
+ id5i = {"5", INT, IM, 0},
+ id0L = {"0L", LONG, IM, 0},
+ id1L = {"1L", LONG, IM, 0},
+ id0f = {"0.0f", FLOAT, IM, 0},
+ id1f = {"1.0f", FLOAT, IM, 0},
+ id2f = {"2.0f", FLOAT, IM, 0},
+ id0d = {"0.0d", DOUBLE, IM, 0},
+ id1d = {"1.0d", DOUBLE, IM, 0},
+ idfalse = {"false", BOOLEAN, IM, 0},
+ idtrue = {"true", BOOLEAN, IM, 0};
Index: llvm-test/MultiSource/Applications/hbd/op.cpp
diff -u llvm-test/MultiSource/Applications/hbd/op.cpp:1.1 llvm-test/MultiSource/Applications/hbd/op.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/op.cpp:1.1 Fri Feb 27 12:06:49 2004
+++ llvm-test/MultiSource/Applications/hbd/op.cpp Fri May 13 13:10:44 2005
@@ -1,30 +1,30 @@
-/* op.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-char *op2str[] = {
- " + ", " - ", " * ", " / ", " %% ", ".", " = ", " << ",
- " >> ", " >>> ", " & ", " | ", " ^ ", "~", "-", "(cast)",
- "return ", "throw ", "new ", "goto ", " += ", " -= ", "++", "--",
- " ? ", " : ", " error ", " cmp ", " == ", " != ", " < ", " >= ",
- " > ", " <= ", "!", " && ", " || ", " instanceof ", ", ",
- ""
-};
-int op_prec[] = {
- 27, 27, 29, 29, 29, 39, 2, 26,
- 26, 26, 19, 17, 18, 32, 32, 39,
- 38, 38, 38, 38, 2, 2, 32, 32,
- 14, 14, 39, 20, 20, 20, 22, 22,
- 22, 22, 32, 16, 15, 32, 1,
- 39
-};
-int op_assoc[] = {
- 0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,
- 0,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,
- 0
-};
+/* op.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+char *op2str[] = {
+ " + ", " - ", " * ", " / ", " %% ", ".", " = ", " << ",
+ " >> ", " >>> ", " & ", " | ", " ^ ", "~", "-", "(cast)",
+ "return ", "throw ", "new ", "goto ", " += ", " -= ", "++", "--",
+ " ? ", " : ", " error ", " cmp ", " == ", " != ", " < ", " >= ",
+ " > ", " <= ", "!", " && ", " || ", " instanceof ", ", ",
+ ""
+};
+int op_prec[] = {
+ 27, 27, 29, 29, 29, 39, 2, 26,
+ 26, 26, 19, 17, 18, 32, 32, 39,
+ 38, 38, 38, 38, 2, 2, 32, 32,
+ 14, 14, 39, 20, 20, 20, 22, 22,
+ 22, 22, 32, 16, 15, 32, 1,
+ 39
+};
+int op_assoc[] = {
+ 0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,
+ 0,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,
+ 0
+};
Index: llvm-test/MultiSource/Applications/hbd/sig.cpp
diff -u llvm-test/MultiSource/Applications/hbd/sig.cpp:1.1 llvm-test/MultiSource/Applications/hbd/sig.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/sig.cpp:1.1 Fri Feb 27 12:06:49 2004
+++ llvm-test/MultiSource/Applications/hbd/sig.cpp Fri May 13 13:10:44 2005
@@ -1,145 +1,145 @@
-/* sig.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include "general.h"
-#include "class.h"
-#include "method.h"
-#include "sig.h"
-#include "err.h"
-
-char *type2str[] = {
- "void", "byte", "char", "short", "int", "long", "float", "double", "object"
-};
-
-Type sig2type(char* sig)
-{
- switch (*sig) {
- case SIGNATURE_BYTE: return BYTE;
- case SIGNATURE_CHAR: return CHAR;
- case SIGNATURE_DOUBLE: return DOUBLE;
- case SIGNATURE_FLOAT: return FLOAT;
- case SIGNATURE_INT: return INT;
- case SIGNATURE_LONG: return LONG;
- case SIGNATURE_CLASS: return OBJECT;
- case SIGNATURE_SHORT: return SHORT;
- case SIGNATURE_BOOLEAN: return BOOLEAN;
- case SIGNATURE_ARRAY: return OBJECT;
- case SIGNATURE_FUNC: return FUNC;
- case SIGNATURE_VOID: return VOID;
- default:
- fprintf(stderr, "Error converting signature to a type.\n");
- exit(1);
- }
- return VOID;
-}
-
-int printsigname(Classfile *c, FILE* outfile, char *&sig, char *name, void *mip)
-{
- method_info_ptr mi = (method_info_ptr)mip;
- int i;
- char *t, *t2;
- switch(*sig++) {
- case SIGNATURE_BYTE: fprintf(outfile, "byte %s", name); return 0;
- case SIGNATURE_CHAR: fprintf(outfile, "char %s", name); return 0;
- case SIGNATURE_DOUBLE: fprintf(outfile, "double %s", name); return 0;
- case SIGNATURE_FLOAT: fprintf(outfile, "float %s", name); return 0;
- case SIGNATURE_INT: fprintf(outfile, "int %s", name); return 0;
- case SIGNATURE_LONG: fprintf(outfile, "long %s", name); return 0;
- case SIGNATURE_CLASS:
- t = sig;
- while (*sig++ != ';') ;
- if ((t2 = new char[sig - t]) == 0) memerr();
- strncpy(t2, t, sig - t - 1);
- t2[sig - t - 1] = '\0';
- t = t2;
- if (!strncmp(t, "java/lang/", 10)) t += 10;
- else while ((t2 = strchr(t2, '/')) != 0) *t2 = '.';
- i = c->package_name?strlen(c->package_name):0;
- if (c->package_name && !strncmp(t, c->package_name, i)) t += i + 1;
- fprintf(outfile, "%s %s", t, name);
- return 0;
- case SIGNATURE_SHORT: fprintf(outfile, "short %s", name); return 0;
- case SIGNATURE_BOOLEAN: fprintf(outfile, "boolean %s", name); return 0;
- case SIGNATURE_ARRAY:
- i = 0;
- while ((*sig >= '0') && (*sig <= '9')) i = (i * 10) + *sig++ - '0';
- printsigname(c, outfile, sig, name, mi);
- if (i) fprintf(outfile, "[%d]", i); else fprintf(outfile, "[]");
- return 0;
- case SIGNATURE_FUNC:
- if (!mi) {
- fprintf(stderr, "Non-function with function sig!\n");
- return 0;
- }
- t = sig;
- while (*sig++ != SIGNATURE_ENDFUNC) /* skip for now */;
- if (!strcmp(name, "<clinit>")) {
-// fprintf(outfile, "\b");
- return 0;
- }
- if ((mi->ret_sig = new char[strlen(sig) + 1]) == 0) memerr();
- strcpy(mi->ret_sig, sig);
- mi->ret_type = sig2type(mi->ret_sig);
- if (strcmp(name, "<init>"))
- printsigname(c, outfile, sig, name, mi); /* return type and name */
- else
- fprintf(outfile, "%s", c->this_class_name);
- fprintf(outfile, "(");
- mi->max_locals++;
- if (!mi->local_variable_table_length) {
- if (((mi->local_names = new char_ptr[mi->max_locals]) == 0) ||
- ((mi->local_sigs = new char_ptr[mi->max_locals]) == 0) ||
- ((mi->local_types = new Type[mi->max_locals]) == 0) ||
- ((mi->local_firstuses = new unsigned[mi->max_locals]) == 0)) memerr();
- for (int it = mi->max_locals; it--; ) {
- mi->local_firstuses[it] = 0;
- mi->local_names[it] = mi->local_sigs[it] = 0;
- mi->local_types[it] = VOID;
- }
- if ((mi->access_flags & ACC_STATIC) == 0) {
- mi->local_names[0] = "this";
- mi->local_sigs[0] = "L";
- mi->local_types[0] = OBJECT;
- mi->local_firstuses[0] = 0;
- }
- }
- i = ((mi->access_flags & ACC_STATIC) == 0) ? 1 : 0;
- while (*t != SIGNATURE_ENDFUNC) {
- if (mi->local_variable_table_length) {
- if (strcmp(t,mi->local_sigs[i])) {
- fprintf(stderr, "Function Parameter type mismatch\n");
- return 1;
- }
- printsigname(c, outfile, t,mi->local_names[i],mi);
- } else {
- if ((mi->local_names[i] = new char[6]) == 0) memerr();
- sprintf(mi->local_names[i], "var%d", i);
- char *t2 = t;
- printsigname(c, outfile, t,mi->local_names[i],mi);
- if ((mi->local_sigs[i] = new char[t - t2 + 1]) == 0) memerr();
- strncpy(mi->local_sigs[i], t2, t-t2);
- mi->local_sigs[i][t-t2] = '\0';
- mi->local_types[i] = sig2type(mi->local_sigs[i]);
- mi->local_firstuses[i] = 0;
- }
- if ((*(t-1) == 'D') || (*(t-1) == 'J')) i++;
- i++;
- if (*t != SIGNATURE_ENDFUNC) fprintf(outfile, ", ");
- }
- fprintf(outfile, ")");
- return 0;
- case SIGNATURE_VOID: fprintf(outfile, "void %s", name); return 0;
-// case 0: fprintf(outfile, "%s", name); return 0;
- default:
- fprintf(stderr, "Error reading type signature!\n");
- return 1;
- }
-}
-
+/* sig.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include "general.h"
+#include "class.h"
+#include "method.h"
+#include "sig.h"
+#include "err.h"
+
+char *type2str[] = {
+ "void", "byte", "char", "short", "int", "long", "float", "double", "object"
+};
+
+Type sig2type(char* sig)
+{
+ switch (*sig) {
+ case SIGNATURE_BYTE: return BYTE;
+ case SIGNATURE_CHAR: return CHAR;
+ case SIGNATURE_DOUBLE: return DOUBLE;
+ case SIGNATURE_FLOAT: return FLOAT;
+ case SIGNATURE_INT: return INT;
+ case SIGNATURE_LONG: return LONG;
+ case SIGNATURE_CLASS: return OBJECT;
+ case SIGNATURE_SHORT: return SHORT;
+ case SIGNATURE_BOOLEAN: return BOOLEAN;
+ case SIGNATURE_ARRAY: return OBJECT;
+ case SIGNATURE_FUNC: return FUNC;
+ case SIGNATURE_VOID: return VOID;
+ default:
+ fprintf(stderr, "Error converting signature to a type.\n");
+ exit(1);
+ }
+ return VOID;
+}
+
+int printsigname(Classfile *c, FILE* outfile, char *&sig, char *name, void *mip)
+{
+ method_info_ptr mi = (method_info_ptr)mip;
+ int i;
+ char *t, *t2;
+ switch(*sig++) {
+ case SIGNATURE_BYTE: fprintf(outfile, "byte %s", name); return 0;
+ case SIGNATURE_CHAR: fprintf(outfile, "char %s", name); return 0;
+ case SIGNATURE_DOUBLE: fprintf(outfile, "double %s", name); return 0;
+ case SIGNATURE_FLOAT: fprintf(outfile, "float %s", name); return 0;
+ case SIGNATURE_INT: fprintf(outfile, "int %s", name); return 0;
+ case SIGNATURE_LONG: fprintf(outfile, "long %s", name); return 0;
+ case SIGNATURE_CLASS:
+ t = sig;
+ while (*sig++ != ';') ;
+ if ((t2 = new char[sig - t]) == 0) memerr();
+ strncpy(t2, t, sig - t - 1);
+ t2[sig - t - 1] = '\0';
+ t = t2;
+ if (!strncmp(t, "java/lang/", 10)) t += 10;
+ else while ((t2 = strchr(t2, '/')) != 0) *t2 = '.';
+ i = c->package_name?strlen(c->package_name):0;
+ if (c->package_name && !strncmp(t, c->package_name, i)) t += i + 1;
+ fprintf(outfile, "%s %s", t, name);
+ return 0;
+ case SIGNATURE_SHORT: fprintf(outfile, "short %s", name); return 0;
+ case SIGNATURE_BOOLEAN: fprintf(outfile, "boolean %s", name); return 0;
+ case SIGNATURE_ARRAY:
+ i = 0;
+ while ((*sig >= '0') && (*sig <= '9')) i = (i * 10) + *sig++ - '0';
+ printsigname(c, outfile, sig, name, mi);
+ if (i) fprintf(outfile, "[%d]", i); else fprintf(outfile, "[]");
+ return 0;
+ case SIGNATURE_FUNC:
+ if (!mi) {
+ fprintf(stderr, "Non-function with function sig!\n");
+ return 0;
+ }
+ t = sig;
+ while (*sig++ != SIGNATURE_ENDFUNC) /* skip for now */;
+ if (!strcmp(name, "<clinit>")) {
+// fprintf(outfile, "\b");
+ return 0;
+ }
+ if ((mi->ret_sig = new char[strlen(sig) + 1]) == 0) memerr();
+ strcpy(mi->ret_sig, sig);
+ mi->ret_type = sig2type(mi->ret_sig);
+ if (strcmp(name, "<init>"))
+ printsigname(c, outfile, sig, name, mi); /* return type and name */
+ else
+ fprintf(outfile, "%s", c->this_class_name);
+ fprintf(outfile, "(");
+ mi->max_locals++;
+ if (!mi->local_variable_table_length) {
+ if (((mi->local_names = new char_ptr[mi->max_locals]) == 0) ||
+ ((mi->local_sigs = new char_ptr[mi->max_locals]) == 0) ||
+ ((mi->local_types = new Type[mi->max_locals]) == 0) ||
+ ((mi->local_firstuses = new unsigned[mi->max_locals]) == 0)) memerr();
+ for (int it = mi->max_locals; it--; ) {
+ mi->local_firstuses[it] = 0;
+ mi->local_names[it] = mi->local_sigs[it] = 0;
+ mi->local_types[it] = VOID;
+ }
+ if ((mi->access_flags & ACC_STATIC) == 0) {
+ mi->local_names[0] = "this";
+ mi->local_sigs[0] = "L";
+ mi->local_types[0] = OBJECT;
+ mi->local_firstuses[0] = 0;
+ }
+ }
+ i = ((mi->access_flags & ACC_STATIC) == 0) ? 1 : 0;
+ while (*t != SIGNATURE_ENDFUNC) {
+ if (mi->local_variable_table_length) {
+ if (strcmp(t,mi->local_sigs[i])) {
+ fprintf(stderr, "Function Parameter type mismatch\n");
+ return 1;
+ }
+ printsigname(c, outfile, t,mi->local_names[i],mi);
+ } else {
+ if ((mi->local_names[i] = new char[6]) == 0) memerr();
+ sprintf(mi->local_names[i], "var%d", i);
+ char *t2 = t;
+ printsigname(c, outfile, t,mi->local_names[i],mi);
+ if ((mi->local_sigs[i] = new char[t - t2 + 1]) == 0) memerr();
+ strncpy(mi->local_sigs[i], t2, t-t2);
+ mi->local_sigs[i][t-t2] = '\0';
+ mi->local_types[i] = sig2type(mi->local_sigs[i]);
+ mi->local_firstuses[i] = 0;
+ }
+ if ((*(t-1) == 'D') || (*(t-1) == 'J')) i++;
+ i++;
+ if (*t != SIGNATURE_ENDFUNC) fprintf(outfile, ", ");
+ }
+ fprintf(outfile, ")");
+ return 0;
+ case SIGNATURE_VOID: fprintf(outfile, "void %s", name); return 0;
+// case 0: fprintf(outfile, "%s", name); return 0;
+ default:
+ fprintf(stderr, "Error reading type signature!\n");
+ return 1;
+ }
+}
+
Index: llvm-test/MultiSource/Applications/hbd/version.cpp
diff -u llvm-test/MultiSource/Applications/hbd/version.cpp:1.1 llvm-test/MultiSource/Applications/hbd/version.cpp:1.2
--- llvm-test/MultiSource/Applications/hbd/version.cpp:1.1 Fri Feb 27 12:06:50 2004
+++ llvm-test/MultiSource/Applications/hbd/version.cpp Fri May 13 13:10:44 2005
@@ -1,23 +1,23 @@
-/* version.cpp */
-/*
- Java Decompiler
- Copyright (c) 1994-2003, Pete Ryland.
- Distributed under the GNU GPL Version 2.
- This package is available from http://pdr.cx/hbd/
-*/
-
-#include <stdio.h>
-#include "general.h"
-#include "version.h"
-#include "file.h"
-#include "err.h"
-#include "class.h"
-
-void ClassVersion::read(Classfile *c) {
- minor_version = get16(c->infile, &c->infile_pos);
- if ((major_version = get16(c->infile, &c->infile_pos)) != 45)
- fatalerror(BAD_VERSION_ERR);
- else if (minor_version != 3) {
- fprintf(stderr, "Warning: Class Version 45.%d. (Program designed for ver 45.3)\n", minor_version);
- }
-}
+/* version.cpp */
+/*
+ Java Decompiler
+ Copyright (c) 1994-2003, Pete Ryland.
+ Distributed under the GNU GPL Version 2.
+ This package is available from http://pdr.cx/hbd/
+*/
+
+#include <stdio.h>
+#include "general.h"
+#include "version.h"
+#include "file.h"
+#include "err.h"
+#include "class.h"
+
+void ClassVersion::read(Classfile *c) {
+ minor_version = get16(c->infile, &c->infile_pos);
+ if ((major_version = get16(c->infile, &c->infile_pos)) != 45)
+ fatalerror(BAD_VERSION_ERR);
+ else if (minor_version != 3) {
+ fprintf(stderr, "Warning: Class Version 45.%d. (Program designed for ver 45.3)\n", minor_version);
+ }
+}
More information about the llvm-commits
mailing list