com.apple.internal.jobjc.generator.Utils Java Examples

The following examples show how to use com.apple.internal.jobjc.generator.Utils. 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: Framework.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public MacOSXFramework load(){
    if(nativeFramework == null){
        String[] bins = new String[binaries.size()];
        for(int i = 0; i < binaries.size(); ++i)
            bins[i] = Utils.getCanonicalPath(binaries.get(i));
        nativeFramework = UnsafeRuntimeAccess.getFramework(bins);
    }
    return nativeFramework;
}
 
Example #2
Source File: Framework.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}
 
Example #3
Source File: Framework.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #4
Source File: FrameworkClassFile.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #5
Source File: PrimitiveCoderDescriptor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PrimitiveCoderDescriptor(final Coder coder,
        final String defaultReturnValue, final String mismatchMessage) {
    super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
    this.javaPrimitiveClazz = coder.getJavaPrimitive();
    this.javaObjectClazz = coder.getJavaClass();
    this.defaultReturnValue = defaultReturnValue;
    this.primitiveCoderName = coder.getClass().getSimpleName();
    this._mismatchMessage = mismatchMessage;
}
 
Example #6
Source File: Framework.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}
 
Example #7
Source File: JavaLang.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
    singleton.replace("IVAR", instanceVariable);
    singleton.replace("METHOD", methodName);
    singleton.replace("CLASS", className);
    singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
    return singleton.toString();
}
 
Example #8
Source File: FrameworkClassFile.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #9
Source File: Framework.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #10
Source File: FrameworkClassFile.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #11
Source File: FrameworkClassFile.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #12
Source File: Framework.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #13
Source File: Framework.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}
 
Example #14
Source File: PrimitiveCoderDescriptor.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PrimitiveCoderDescriptor(final Coder coder,
        final String defaultReturnValue, final String mismatchMessage) {
    super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
    this.javaPrimitiveClazz = coder.getJavaPrimitive();
    this.javaObjectClazz = coder.getJavaClass();
    this.defaultReturnValue = defaultReturnValue;
    this.primitiveCoderName = coder.getClass().getSimpleName();
    this._mismatchMessage = mismatchMessage;
}
 
Example #15
Source File: PrimitiveCoderDescriptor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public PrimitiveCoderDescriptor(final Coder coder,
        final String defaultReturnValue, final String mismatchMessage) {
    super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
    this.javaPrimitiveClazz = coder.getJavaPrimitive();
    this.javaObjectClazz = coder.getJavaClass();
    this.defaultReturnValue = defaultReturnValue;
    this.primitiveCoderName = coder.getClass().getSimpleName();
    this._mismatchMessage = mismatchMessage;
}
 
Example #16
Source File: Framework.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #17
Source File: JavaLang.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
    singleton.replace("IVAR", instanceVariable);
    singleton.replace("METHOD", methodName);
    singleton.replace("CLASS", className);
    singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
    return singleton.toString();
}
 
Example #18
Source File: PrimitiveCoderDescriptor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PrimitiveCoderDescriptor(final Coder coder,
        final String defaultReturnValue, final String mismatchMessage) {
    super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
    this.javaPrimitiveClazz = coder.getJavaPrimitive();
    this.javaObjectClazz = coder.getJavaClass();
    this.defaultReturnValue = defaultReturnValue;
    this.primitiveCoderName = coder.getClass().getSimpleName();
    this._mismatchMessage = mismatchMessage;
}
 
Example #19
Source File: Framework.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}
 
Example #20
Source File: Framework.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #21
Source File: Framework.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MacOSXFramework load(){
    if(nativeFramework == null){
        String[] bins = new String[binaries.size()];
        for(int i = 0; i < binaries.size(); ++i)
            bins[i] = Utils.getCanonicalPath(binaries.get(i));
        nativeFramework = UnsafeRuntimeAccess.getFramework(bins);
    }
    return nativeFramework;
}
 
Example #22
Source File: JavaLang.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
    singleton.replace("IVAR", instanceVariable);
    singleton.replace("METHOD", methodName);
    singleton.replace("CLASS", className);
    singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
    return singleton.toString();
}
 
Example #23
Source File: JavaLang.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
    singleton.replace("IVAR", instanceVariable);
    singleton.replace("METHOD", methodName);
    singleton.replace("CLASS", className);
    singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
    return singleton.toString();
}
 
Example #24
Source File: FrameworkClassFile.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #25
Source File: Framework.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}
 
Example #26
Source File: Framework.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void parseStructs() {
    structs = getNodesFor(rootNode, "struct", Struct.class, this);

    // HACK BS bug #6100313
    if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
        structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));

    // GLIFunctionDispatch is frequently out of sync in BS / system
    if(name.equals("OpenGL"))
        structs.remove(getStructByName("GLIFunctionDispatch"));
}
 
Example #27
Source File: JavaLang.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
    singleton.replace("IVAR", instanceVariable);
    singleton.replace("METHOD", methodName);
    singleton.replace("CLASS", className);
    singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
    return singleton.toString();
}
 
Example #28
Source File: FrameworkClassFile.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override public void writeBeginning(final PrintStream out) {
    List<String> binPaths = Fp.map(new Map1<File,String>(){
        public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
        framework.binaries);
    out.println(new Utils.Substituter(
            "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
            "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
            "#}~"
    ));
}
 
Example #29
Source File: PrimitiveCoderDescriptor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public PrimitiveCoderDescriptor(final Coder coder,
        final String defaultReturnValue, final String mismatchMessage) {
    super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
    this.javaPrimitiveClazz = coder.getJavaPrimitive();
    this.javaObjectClazz = coder.getJavaClass();
    this.defaultReturnValue = defaultReturnValue;
    this.primitiveCoderName = coder.getClass().getSimpleName();
    this._mismatchMessage = mismatchMessage;
}
 
Example #30
Source File: Framework.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void generateClasses(final List<OutputFile> generatedClassFiles) {
    generatedClassFiles.add(new FrameworkClassFile(this));

    final List<List<OutputFileGenerator>> generatorLists =
              Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
    for (final List<OutputFileGenerator> generators : generatorLists) {
        for (final OutputFileGenerator generator : generators)
            generator.generateClasses(generatedClassFiles);
    }
}