X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FClassGen.java;h=de32d3c251ff77fec35b67590ec37097f6a80446;hp=cd120454ef54690e3b7e0aefeccbd12a42a8d6d3;hb=0087af3d283954bbeeaaa857914ce9e06c39fcc7;hpb=cb0bae954e7dd0067e77c436c78ee19ace52d9e3 diff --git a/src/org/ibex/classgen/ClassGen.java b/src/org/ibex/classgen/ClassGen.java index cd12045..de32d3c 100644 --- a/src/org/ibex/classgen/ClassGen.java +++ b/src/org/ibex/classgen/ClassGen.java @@ -7,6 +7,7 @@ public class ClassGen implements CGConst { private Type.Object thisType; private Type.Object superType; int flags; + private String sourceFile; private Vector interfaces = new Vector(); private Vector fields = new Vector(); @@ -36,6 +37,14 @@ public class ClassGen implements CGConst { return mg; } + public final FieldGen addField(String name, Type type, int flags) { + FieldGen fg = new FieldGen(this,name,type,flags); + fields.addElement(fg); + return fg; + } + + public void setSourceFile(String sourceFile) { this.sourceFile = sourceFile; } + public void dump(String s) throws IOException { dump(new File(s)); } public void dump(File f) throws IOException { if(f.isDirectory()) { @@ -49,6 +58,7 @@ public class ClassGen implements CGConst { } dump(new FileOutputStream(f)); } + public void dump(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(os)); _dump(dos); @@ -59,47 +69,132 @@ public class ClassGen implements CGConst { cp.add(thisType); cp.add(superType); for(int i=0;i