com.apple.internal.jobjc.generator.model.types.NType.NStruct Java Examples
The following examples show how to use
com.apple.internal.jobjc.generator.model.types.NType.NStruct.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StructClassFile.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #2
Source File: StructClassFile.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #3
Source File: StructClassFile.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #4
Source File: StructClassFile.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #5
Source File: StructClassFile.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #6
Source File: StructClassFile.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #7
Source File: StructClassFile.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.println(); out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? " + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";"); out.println(); out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName()); out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(), (struct.fields.size() > 0 ? ",\n\t\t" : ""), Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){ public String apply(Field a) { return a.type.getJType().getCoderDescriptor().getCoderInstanceName(); }}, struct.fields))); out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n", struct.name, JObjCRuntime.class.getCanonicalName()); out.println("\t};"); out.println(); out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){"); out.println("\t\tsuper(runtime, SIZEOF);"); out.println("\t}"); out.println(); out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {"); out.println("\t\tsuper(runtime, buffer, SIZEOF);"); out.println("\t}"); }
Example #8
Source File: StructClassFile.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #9
Source File: StructOffsetResolver.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void printStructInfos(Framework fw, Width arch, PrintWriter out){ for(Struct st : fw.structs){ NStruct nst = wget(arch, st.type.type32, st.type.type64); out.println("std::cout << \"" + fw.name + " " + st.name + "\" << ':' << sizeof("+st.name+")"); for(NField sf : nst.fields){ out.print("\t<< ' ' << "); out.println(sf.type instanceof NType.NBitfield ? "-1" : "offsetof("+st.name+","+sf.name+")"); } out.println("\t<< std::endl;"); } }
Example #10
Source File: NTypePrinter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected String printStruct(NStruct nt, char open, char close){ StringWriter sw = new StringWriter(); sw.append(open); sw.append(nt.name); if(nt.fields.size() > 0){ sw.append('='); for(NField f : nt.fields){ if(f.name != null && f.name.length() > 0) sw.append("\"" + f.name + "\""); sw.append(print(f.type)); } } sw.append(close); return sw.toString(); }
Example #11
Source File: StructOffsetResolver.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void printStructInfos(Framework fw, Width arch, PrintWriter out){ for(Struct st : fw.structs){ NStruct nst = wget(arch, st.type.type32, st.type.type64); out.println("std::cout << \"" + fw.name + " " + st.name + "\" << ':' << sizeof("+st.name+")"); for(NField sf : nst.fields){ out.print("\t<< ' ' << "); out.println(sf.type instanceof NType.NBitfield ? "-1" : "offsetof("+st.name+","+sf.name+")"); } out.println("\t<< std::endl;"); } }
Example #12
Source File: StructOffsetResolver.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void printStructInfos(Framework fw, Width arch, PrintWriter out){ for(Struct st : fw.structs){ NStruct nst = wget(arch, st.type.type32, st.type.type64); out.println("std::cout << \"" + fw.name + " " + st.name + "\" << ':' << sizeof("+st.name+")"); for(NField sf : nst.fields){ out.print("\t<< ' ' << "); out.println(sf.type instanceof NType.NBitfield ? "-1" : "offsetof("+st.name+","+sf.name+")"); } out.println("\t<< std::endl;"); } }
Example #13
Source File: NTypePrinter.java From hottub with GNU General Public License v2.0 | 5 votes |
protected String printStruct(NStruct nt, char open, char close){ StringWriter sw = new StringWriter(); sw.append(open); sw.append(nt.name); if(nt.fields.size() > 0){ sw.append('='); for(NField f : nt.fields){ if(f.name != null && f.name.length() > 0) sw.append("\"" + f.name + "\""); sw.append(print(f.type)); } } sw.append(close); return sw.toString(); }
Example #14
Source File: NTypePrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected String printStruct(NStruct nt, char open, char close){ StringWriter sw = new StringWriter(); sw.append(open); sw.append(nt.name); if(nt.fields.size() > 0){ sw.append('='); for(NField f : nt.fields){ if(f.name != null && f.name.length() > 0) sw.append("\"" + f.name + "\""); sw.append(print(f.type)); } } sw.append(close); return sw.toString(); }
Example #15
Source File: StructClassFile.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #16
Source File: StructClassFile.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #17
Source File: StructOffsetResolver.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void processLine(String ln, Collection<Framework> fws, Width arch) throws Exception{ System.out.println("\tSOR '" + ln + "'"); if(ln.trim().length() == 0) return; Pattern stinfo = Pattern.compile("^(.*) (.*):(\\d+).*$"); Matcher m = stinfo.matcher(ln); if(!m.matches()) throw new RuntimeException("Failed to parse line from exec: " + ln); String fwname = m.group(1); String stname = m.group(2); int stsize = Integer.parseInt(m.group(3)); Framework fw = findFrameworkByName(fws, fwname); Struct st = fw.getStructByName(stname); NStruct nst = wget(arch, st.type.type32, st.type.type64); nst.sizeof.put(arch, stsize); // System.out.println(st.name + " : " + stsize); Pattern finfo = Pattern.compile(" (-?\\d+)"); Matcher fm = finfo.matcher(ln); int fi = 0; while(fm.find()){ NField sf = nst.fields.get(fi++); sf.offset.put(arch, Integer.parseInt(fm.group(1))); // System.out.println("\t" + sf.name + " : " + off); } TypeCache.inst().pingType(st.type); }
Example #18
Source File: NTypePrinter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected String printStruct(NStruct nt, char open, char close){ StringWriter sw = new StringWriter(); sw.append(open); sw.append(nt.name); if(nt.fields.size() > 0){ sw.append('='); for(NField f : nt.fields){ if(f.name != null && f.name.length() > 0) sw.append("\"" + f.name + "\""); sw.append(print(f.type)); } } sw.append(close); return sw.toString(); }
Example #19
Source File: StructClassFile.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #20
Source File: StructClassFile.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #21
Source File: StructClassFile.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #22
Source File: StructOffsetResolver.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected void processLine(String ln, Collection<Framework> fws, Width arch) throws Exception{ System.out.println("\tSOR '" + ln + "'"); if(ln.trim().length() == 0) return; Pattern stinfo = Pattern.compile("^(.*) (.*):(\\d+).*$"); Matcher m = stinfo.matcher(ln); if(!m.matches()) throw new RuntimeException("Failed to parse line from exec: " + ln); String fwname = m.group(1); String stname = m.group(2); int stsize = Integer.parseInt(m.group(3)); Framework fw = findFrameworkByName(fws, fwname); Struct st = fw.getStructByName(stname); NStruct nst = wget(arch, st.type.type32, st.type.type64); nst.sizeof.put(arch, stsize); // System.out.println(st.name + " : " + stsize); Pattern finfo = Pattern.compile(" (-?\\d+)"); Matcher fm = finfo.matcher(ln); int fi = 0; while(fm.find()){ NField sf = nst.fields.get(fi++); sf.offset.put(arch, Integer.parseInt(fm.group(1))); // System.out.println("\t" + sf.name + " : " + off); } TypeCache.inst().pingType(st.type); }
Example #23
Source File: StructOffsetResolver.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void processLine(String ln, Collection<Framework> fws, Width arch) throws Exception{ System.out.println("\tSOR '" + ln + "'"); if(ln.trim().length() == 0) return; Pattern stinfo = Pattern.compile("^(.*) (.*):(\\d+).*$"); Matcher m = stinfo.matcher(ln); if(!m.matches()) throw new RuntimeException("Failed to parse line from exec: " + ln); String fwname = m.group(1); String stname = m.group(2); int stsize = Integer.parseInt(m.group(3)); Framework fw = findFrameworkByName(fws, fwname); Struct st = fw.getStructByName(stname); NStruct nst = wget(arch, st.type.type32, st.type.type64); nst.sizeof.put(arch, stsize); // System.out.println(st.name + " : " + stsize); Pattern finfo = Pattern.compile(" (-?\\d+)"); Matcher fm = finfo.matcher(ln); int fi = 0; while(fm.find()){ NField sf = nst.fields.get(fi++); sf.offset.put(arch, Integer.parseInt(fm.group(1))); // System.out.println("\t" + sf.name + " : " + off); } TypeCache.inst().pingType(st.type); }
Example #24
Source File: StructOffsetResolver.java From hottub with GNU General Public License v2.0 | 5 votes |
static void printStructInfos(Framework fw, Width arch, PrintWriter out){ for(Struct st : fw.structs){ NStruct nst = wget(arch, st.type.type32, st.type.type64); out.println("std::cout << \"" + fw.name + " " + st.name + "\" << ':' << sizeof("+st.name+")"); for(NField sf : nst.fields){ out.print("\t<< ' ' << "); out.println(sf.type instanceof NType.NBitfield ? "-1" : "offsetof("+st.name+","+sf.name+")"); } out.println("\t<< std::endl;"); } }
Example #25
Source File: NTypePrinter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected String printStruct(NStruct nt, char open, char close){ StringWriter sw = new StringWriter(); sw.append(open); sw.append(nt.name); if(nt.fields.size() > 0){ sw.append('='); for(NField f : nt.fields){ if(f.name != null && f.name.length() > 0) sw.append("\"" + f.name + "\""); sw.append(print(f.type)); } } sw.append(close); return sw.toString(); }
Example #26
Source File: StructClassFile.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void writeBody(final PrintStream out) { for(Struct.Field field : struct.fields){ if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct) writeStructField(field, out); else writeField(field, out); } }
Example #27
Source File: NTypeMerger.java From hottub with GNU General Public License v2.0 | 4 votes |
protected NType accept(NStruct a, NStruct b) { return mergeStructs(a, b); }
Example #28
Source File: Type.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static NType getNSRectType() { List<NField> fields = new ArrayList<NField>(); fields.add(new NField("origin", getNSPointType())); fields.add(new NField("size", getNSSizeType())); return new NStruct("_NSRect", fields); }
Example #29
Source File: Type.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static NType getCGPointType() { List<NField> fields = new ArrayList<NField>(); fields.add(new NField("x", new NPrimitive('d'))); fields.add(new NField("y", new NPrimitive('d'))); return new NStruct("CGPoint", fields); }
Example #30
Source File: Type.java From hottub with GNU General Public License v2.0 | 4 votes |
private static NType getCGSizeType() { List<NField> fields = new ArrayList<NField>(); fields.add(new NField("width", new NPrimitive('d'))); fields.add(new NField("height", new NPrimitive('d'))); return new NStruct("CGSize", fields); }