com.apple.internal.jobjc.generator.utils.Fp.Map1 Java Examples

The following examples show how to use com.apple.internal.jobjc.generator.utils.Fp.Map1. 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 openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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: StructOffsetResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 #3
Source File: StructOffsetResolverBigBang.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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: StructClassFile.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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: StructOffsetResolverBigBang.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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 jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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: StructClassFile.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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 6 votes vote down vote up
@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 #9
Source File: StructOffsetResolverBigBang.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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 TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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 jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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: StructClassFile.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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 #13
Source File: StructOffsetResolverBigBang.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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 #14
Source File: StructOffsetResolver.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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 #15
Source File: StructClassFile.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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 #16
Source File: StructOffsetResolver.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #17
Source File: StructClassFile.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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 #18
Source File: StructOffsetResolverBigBang.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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 #19
Source File: StructOffsetResolverBigBang.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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 #20
Source File: StructClassFile.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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 #21
Source File: StructOffsetResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 #22
Source File: StructOffsetResolver.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 #23
Source File: StructOffsetResolverBigBang.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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 #24
Source File: StructClassFile.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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 #25
Source File: StructClassFile.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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 #26
Source File: StructOffsetResolver.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #27
Source File: StructOffsetResolverBigBang.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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 #28
Source File: StructOffsetResolverBigBang.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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 #29
Source File: StructOffsetResolver.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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 #30
Source File: StructClassFile.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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}");
}