788 }));
789 pw.println(pref + "long get_" +name+ "() { "+s_log+"return Native.getLong(pData+"+stp.getOffset(tp)+"); }");
790 pw.println(MessageFormat.format(pref + "void set_{0}({1} v) '{' {3} {2}; '}'",
791 new Object[] {name, "long", "Native.putLong(pData + " + stp.getOffset(tp) + ", v)", s_log}));
792 acc_size_32 += elemSize_32;
793 acc_size_64 += elemSize_64;
794 } else {
795 acc_size_32 += elemSize_32;
796 acc_size_64 += elemSize_64;
797 pw.println(pref + tp.getJavaType() + " get_" +name +
798 "() { "+s_log+"return " + tp.getJavaResult(stp.getOffset(tp), null) + "; }");
799 if (type != AtomicType.TYPE_STRUCT) {
800 pw.println(MessageFormat.format(pref + "void set_{0}({1} v) '{' {3} {2}; '}'",
801 new Object[] {name, jt, tp.getJavaConversion("pData+"+stp.getOffset(tp), "v"), s_log}));
802 }
803 }
804 i++;
805 }
806 }
807 if (s_size_32 != null && !s_size_32.equals(Integer.toString(acc_size_32))) {
808 log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 +
809 " is not equal to the accumulated size " +acc_size_32 + " of the fields");
810 } else if (s_size_64 != null && !s_size_64.equals(Integer.toString(acc_size_64))) {
811 log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+
812 " is not equal to the accumulated size " +acc_size_64+" of the fields");
813 }
814 }
815
816 public void writeWrapperSubclass(StructType stp, PrintWriter pw, boolean wide) {
817
818
819 pw.println("class " + stp.getJavaClassName() + "AccessorImpl" + " extends " + stp.getJavaClassName() + "Accessor {");
820 pw.println("/*\nThis class serves as a Wrapper for the following X Struct \nsThe offsets here are calculated based on actual compiler.\n\n" +stp.getDescription() + "\n\n */");
821
822 writeAccessorImpls(stp, pw);
823
824 pw.println("\n\n } \n\n");
825 }
826
827 public void writeWrapper(String outputDir, StructType stp)
828 {
829 if (stp.getNumFields() > 0) {
830
831 try {
832 FileOutputStream fs = new FileOutputStream(outputDir + "/"+stp.getJavaClassName()+".java");
833 PrintWriter pw = new PrintWriter(fs);
834 pw.println("// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !\n" );
1121
1122
1123 public void writeNativeSizer(String file)
1124 {
1125 int type;
1126 int i=0;
1127 int j=0;
1128 BaseType tp;
1129 StructType stp;
1130 Enumeration eo;
1131
1132
1133 try {
1134
1135 FileOutputStream fs = new FileOutputStream(file);
1136 PrintWriter pw = new PrintWriter(fs);
1137
1138 pw.println("/* This file is an automatically generated file, please do not edit this file, modify the XlibParser.java file instead !*/\n" );
1139 pw.println("#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xos.h>\n#include <X11/Xatom.h>\n#include <stdio.h>\n");
1140 pw.println("#include <X11/extensions/Xdbe.h>");
1141 pw.println("#include \"awt_p.h\"");
1142 pw.println("#include \"color.h\"");
1143 pw.println("#include \"colordata.h\"");
1144 pw.println("\ntypedef struct\n");
1145 pw.println("{\n");
1146 pw.println(" unsigned long flags;\n");
1147 pw.println(" unsigned long functions;\n");
1148 pw.println(" unsigned long decorations;\n");
1149 pw.println(" long inputMode;\n");
1150 pw.println(" unsigned long status;\n");
1151 pw.println("} PropMwmHints;\n");
1152
1153 pw.println("\n\nint main(){");
1154 j=0;
1155 for ( eo = symbolTable.elements() ; eo.hasMoreElements() ;) {
1156 tp = (BaseType) eo.nextElement();
1157 if (tp instanceof StructType)
1158 {
1159 stp = (StructType) tp;
1160 if (!stp.getIsInterface()) {
|
788 }));
789 pw.println(pref + "long get_" +name+ "() { "+s_log+"return Native.getLong(pData+"+stp.getOffset(tp)+"); }");
790 pw.println(MessageFormat.format(pref + "void set_{0}({1} v) '{' {3} {2}; '}'",
791 new Object[] {name, "long", "Native.putLong(pData + " + stp.getOffset(tp) + ", v)", s_log}));
792 acc_size_32 += elemSize_32;
793 acc_size_64 += elemSize_64;
794 } else {
795 acc_size_32 += elemSize_32;
796 acc_size_64 += elemSize_64;
797 pw.println(pref + tp.getJavaType() + " get_" +name +
798 "() { "+s_log+"return " + tp.getJavaResult(stp.getOffset(tp), null) + "; }");
799 if (type != AtomicType.TYPE_STRUCT) {
800 pw.println(MessageFormat.format(pref + "void set_{0}({1} v) '{' {3} {2}; '}'",
801 new Object[] {name, jt, tp.getJavaConversion("pData+"+stp.getOffset(tp), "v"), s_log}));
802 }
803 }
804 i++;
805 }
806 }
807 if (s_size_32 != null && !s_size_32.equals(Integer.toString(acc_size_32))) {
808 if (log.isLoggable(Level.FINE)) {
809 log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 +
810 " is not equal to the accumulated size " +acc_size_32 + " of the fields");
811 }
812 } else if (s_size_64 != null && !s_size_64.equals(Integer.toString(acc_size_64))) {
813 if (log.isLoggable(Level.FINE)) {
814 log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+
815 " is not equal to the accumulated size " +acc_size_64+" of the fields");
816 }
817 }
818 }
819
820 public void writeWrapperSubclass(StructType stp, PrintWriter pw, boolean wide) {
821
822
823 pw.println("class " + stp.getJavaClassName() + "AccessorImpl" + " extends " + stp.getJavaClassName() + "Accessor {");
824 pw.println("/*\nThis class serves as a Wrapper for the following X Struct \nsThe offsets here are calculated based on actual compiler.\n\n" +stp.getDescription() + "\n\n */");
825
826 writeAccessorImpls(stp, pw);
827
828 pw.println("\n\n } \n\n");
829 }
830
831 public void writeWrapper(String outputDir, StructType stp)
832 {
833 if (stp.getNumFields() > 0) {
834
835 try {
836 FileOutputStream fs = new FileOutputStream(outputDir + "/"+stp.getJavaClassName()+".java");
837 PrintWriter pw = new PrintWriter(fs);
838 pw.println("// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !\n" );
1125
1126
1127 public void writeNativeSizer(String file)
1128 {
1129 int type;
1130 int i=0;
1131 int j=0;
1132 BaseType tp;
1133 StructType stp;
1134 Enumeration eo;
1135
1136
1137 try {
1138
1139 FileOutputStream fs = new FileOutputStream(file);
1140 PrintWriter pw = new PrintWriter(fs);
1141
1142 pw.println("/* This file is an automatically generated file, please do not edit this file, modify the XlibParser.java file instead !*/\n" );
1143 pw.println("#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xos.h>\n#include <X11/Xatom.h>\n#include <stdio.h>\n");
1144 pw.println("#include <X11/extensions/Xdbe.h>");
1145 pw.println("#include <X11/XKBlib.h>");
1146 pw.println("#include \"awt_p.h\"");
1147 pw.println("#include \"color.h\"");
1148 pw.println("#include \"colordata.h\"");
1149 pw.println("\ntypedef struct\n");
1150 pw.println("{\n");
1151 pw.println(" unsigned long flags;\n");
1152 pw.println(" unsigned long functions;\n");
1153 pw.println(" unsigned long decorations;\n");
1154 pw.println(" long inputMode;\n");
1155 pw.println(" unsigned long status;\n");
1156 pw.println("} PropMwmHints;\n");
1157
1158 pw.println("\n\nint main(){");
1159 j=0;
1160 for ( eo = symbolTable.elements() ; eo.hasMoreElements() ;) {
1161 tp = (BaseType) eo.nextElement();
1162 if (tp instanceof StructType)
1163 {
1164 stp = (StructType) tp;
1165 if (!stp.getIsInterface()) {
|