com.apple.internal.jobjc.generator.model.Framework Java Examples
The following examples show how to use
com.apple.internal.jobjc.generator.model.Framework.
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: StructOffsetResolver.java From hottub with GNU General Public License v2.0 | 6 votes |
protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Framework fw : fws){ for(final Width width : Width.values()){ System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name); String nativeSrc = generateFileForFramework(fw, width); String executable = compileObjC(nativeSrc, width); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, width); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } } }
Example #2
Source File: StructOffsetResolverBigBang.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #3
Source File: StructOffsetResolverBigBang.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #4
Source File: RootJObjCClass.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void writeBeginning(final PrintStream out) { out.print(new JLField("private static", JOBJC_CLASSNAME, "instance")); out.print(new JLField("private final", JObjCRuntime.class.getName(), "runtime")); JLMethod getInstR = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance", "final JObjCRuntime runtime"); getInstR.body.add("if(runtime == null) throw new NullPointerException(\"runtime\");"); getInstR.body.add("if(instance == null) instance = new JObjC(runtime);"); getInstR.body.add("return instance;"); out.print(getInstR); JLMethod getInst = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance"); getInst.body.add("return getInstance(JObjCRuntime.getInstance());"); out.print(getInst); JLCtor ctor = new JLCtor("private", JOBJC_CLASSNAME, "final JObjCRuntime runtime"); ctor.body.add("this.runtime = runtime;"); for (final Framework f : frameworks) ctor.body.add("runtime.registerPackage(\"" + f.pkg + "\");"); out.print(ctor); }
Example #5
Source File: StructOffsetResolverBigBang.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #6
Source File: StructOffsetResolver.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Framework fw : fws){ for(final Width width : Width.values()){ System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name); String nativeSrc = generateFileForFramework(fw, width); String executable = compileObjC(nativeSrc, width); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, width); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } } }
Example #7
Source File: StructOffsetResolverBigBang.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #8
Source File: StructOffsetResolver.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Framework fw : fws){ for(final Width width : Width.values()){ System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name); String nativeSrc = generateFileForFramework(fw, width); String executable = compileObjC(nativeSrc, width); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, width); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } } }
Example #9
Source File: StructOffsetResolverBigBang.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #10
Source File: StructOffsetResolverBigBang.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #11
Source File: StructOffsetResolver.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Framework fw : fws){ for(final Width width : Width.values()){ System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name); String nativeSrc = generateFileForFramework(fw, width); String executable = compileObjC(nativeSrc, width); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, width); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } } }
Example #12
Source File: StructOffsetResolverBigBang.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Width arch : Width.values()){ System.out.println("SORBB -- Getting Struct offsets @" + arch.toString()); String nativeSrc = generateFileForFrameworks(fws, arch); String executable = compileObjC(nativeSrc, arch); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, arch); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } }
Example #13
Source File: StructOffsetResolver.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected void _resolve(final Collection<Framework> fws) throws Exception{ for(final Framework fw : fws){ for(final Width width : Width.values()){ System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name); String nativeSrc = generateFileForFramework(fw, width); String executable = compileObjC(nativeSrc, width); execute(executable, new Map1<String,Object>(){ public Object apply(String ln) { try { processLine(ln, fws, width); return null; } catch (Exception e) { throw new RuntimeException(e); } } }); } } }
Example #14
Source File: StructOffsetResolver.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Generates Objective-C file and returns absolute path name. */ private String generateFileForFramework(Framework fw, Width arch) throws Exception{ File tempfile = File.createTempFile("JObjC-SOR-" + fw.name + "-" + arch + "-", ".mm"); PrintWriter out = new PrintWriter(new FileWriter(tempfile)); out.println("#include<iostream>"); printHeaderLines(fw, arch, out); out.println(""); out.println("int main(int argc, char** argv){"); printStructInfos(fw, arch, out); out.println("\treturn 0;"); out.println("}"); out.close(); return tempfile.getAbsolutePath(); }
Example #15
Source File: StructOffsetResolver.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected Framework findFrameworkByName(Collection<Framework> fws, String name){ if(cachedFw != null && cachedFw.name.equals(name)) return cachedFw; cachedFw = null; for(Framework fw : fws) if(fw.name.equals(name)){ cachedFw = fw; break; } return cachedFw; }
Example #16
Source File: StructOffsetResolver.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected Framework findFrameworkByName(Collection<Framework> fws, String name){ if(cachedFw != null && cachedFw.name.equals(name)) return cachedFw; cachedFw = null; for(Framework fw : fws) if(fw.name.equals(name)){ cachedFw = fw; break; } return cachedFw; }
Example #17
Source File: StructOffsetResolver.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected Framework findFrameworkByName(Collection<Framework> fws, String name){ if(cachedFw != null && cachedFw.name.equals(name)) return cachedFw; cachedFw = null; for(Framework fw : fws) if(fw.name.equals(name)){ cachedFw = fw; break; } return cachedFw; }
Example #18
Source File: StructOffsetResolver.java From openjdk-jdk8u 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 #19
Source File: StructOffsetResolver.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Generates Objective-C file and returns absolute path name. */ private String generateFileForFramework(Framework fw, Width arch) throws Exception{ File tempfile = File.createTempFile("JObjC-SOR-" + fw.name + "-" + arch + "-", ".mm"); PrintWriter out = new PrintWriter(new FileWriter(tempfile)); out.println("#include<iostream>"); printHeaderLines(fw, arch, out); out.println(""); out.println("int main(int argc, char** argv){"); printStructInfos(fw, arch, out); out.println("\treturn 0;"); out.println("}"); out.close(); return tempfile.getAbsolutePath(); }
Example #20
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 #21
Source File: StructOffsetResolver.java From dragonwell8_jdk 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 #22
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 #23
Source File: StructOffsetResolver.java From openjdk-8-source 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 #24
Source File: ClassGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static List<OutputFile> generateClasses(final List<Framework> frameworks) { final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>(); generatedClassFiles.add(new RootJObjCClass(frameworks)); for (final Framework f : frameworks) { f.generateClasses(generatedClassFiles); } return generatedClassFiles; }
Example #25
Source File: ClassGenerator.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static List<OutputFile> generateClasses(final List<Framework> frameworks) { final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>(); generatedClassFiles.add(new RootJObjCClass(frameworks)); for (final Framework f : frameworks) { f.generateClasses(generatedClassFiles); } return generatedClassFiles; }
Example #26
Source File: StructOffsetResolver.java From dragonwell8_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 #27
Source File: ClassGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static List<OutputFile> generateClasses(final List<Framework> frameworks) { final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>(); generatedClassFiles.add(new RootJObjCClass(frameworks)); for (final Framework f : frameworks) { f.generateClasses(generatedClassFiles); } return generatedClassFiles; }
Example #28
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 #29
Source File: ClassGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static List<OutputFile> generateClasses(final List<Framework> frameworks) { final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>(); generatedClassFiles.add(new RootJObjCClass(frameworks)); for (final Framework f : frameworks) { f.generateClasses(generatedClassFiles); } return generatedClassFiles; }
Example #30
Source File: ClassGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
public static List<OutputFile> generateClasses(final List<Framework> frameworks) { final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>(); generatedClassFiles.add(new RootJObjCClass(frameworks)); for (final Framework f : frameworks) { f.generateClasses(generatedClassFiles); } return generatedClassFiles; }