public void init() { declarationsConverter = config.runtime.createDeclarationsConverter(this); globalsGenerator = config.runtime.createGlobalsGenerator(this); typeConverter = config.runtime.createTypeConversion(this); reifier = new Reifier(this); objectiveCGenerator = new ObjectiveCGenerator(this); universalReconciliator = new UniversalReconciliator(); bridjer = new BridJer(this); } Set<Identifier> javaPackages = new TreeSet<Identifier>();
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
static TypeRef primRef(Element element, JavaPrim p) { if (p == null) { return null; } if (p.type == null) { throw new UnsupportedConversionException(element, "Primitive without known type for this runtime: " + p); } return new JavaPrimitive(p); // return new SimpleTypeRef(toString(p)); }
public void outputObjectiveCClass(Struct in) throws IOException { Identifier fullClassName = getFullClassName(in); Signatures signatures = new Signatures(); Struct s = generateObjectiveCClass(in, signatures); result.notifyBeforeWritingClass(fullClassName, s, signatures, result.getLibrary(in)); PrintWriter out = result.classOutputter.getClassSourceWriter(fullClassName.toString()); result.printJavaClass(getPackageName(in), s, out); out.close(); } static Identifier NSObjectIdent = ident(NSObject.class),
static List<Declaration> parseDeclarations(String source) throws IOException, LexerException, InterruptedException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); //config.noCPlusPlus = true; config.preprocessorConfig.includeStrings.add(source); Result result = new Result(config, null, null); SourceFiles parse = new JNAeratorParser().parse(config, result.typeConverter, null); List<Declaration> ret = new ArrayList<Declaration>(); flatten(parse, ret); return ret; }
static String preprocess(File source) throws IOException, LexerException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); config.preprocessorConfig.implicitIncludes.add("C:\\program files\\Microsoft SDKs\\Windows\\v7.0A\\Include"); config.preprocessorConfig.implicitIncludes.add("C:\\program files\\Microsoft Visual Studio 10.0\\VC\\include"); //config.preprocessorConfig.includeStrings.add(source); config.addSourceFile(source, null, false, true, true); Result result = new Result(config, null, null); String pre = PreprocessorUtils.preprocessSources(config, Collections.EMPTY_LIST, false, result.typeConverter, null); return pre; }
public static void main(String[] argsArray) { // argsArray = "-library foo -dependencies bar,baz /Users/ochafik/test.h -mode Directory -o /Users/ochafik/tmp".split(" "); // argsArray = new String[] { "/Users/ochafik/github/nativelibs4java/libraries/tmp/glib/config.jnaerator", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/tmp/glib" }; // argsArray = new String[] { "/Users/ochafik/tmp/test.h", "-T__be16=short", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/jnaerator/test", "-v" }; // argsArray = new String[] { "/Users/ochafik/tmp/test.h", "-T__be16=short", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/jnaerator/test", "-v", "-Dfoo" }; // argsArray = new String[] { "-mode", "Jar", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/tmp", "/Users/ochafik/github/nativelibs4java/libraries/OpenCL/OpenCL4Java/src/main/jnaerator/config.jnaerator" }; main(new JNAerator(new JNAeratorConfig()), argsArray); }
public static void main(String[] args) { try { JNAeratorConfig config = new JNAeratorConfig(); config.verbose = true; Result result = new Result(config, null, null); SourceFiles sourceFiles = new SourceFiles(); File file = new File("/System/Library/Frameworks/Foundation.framework/Resources/BridgeSupport/FoundationFull.bridgesupport"); new BridgeSupportParser(result, sourceFiles).parseBridgeSupportFile(file); } catch (Exception ex) { ex.printStackTrace(); } }
@Override public TypeRef findCallbackRef(TypeRef.FunctionSignature s, Identifier callerLibraryClass) { return pointerTypeRef(super.findCallbackRef(s, callerLibraryClass)); }
static List<Declaration> parseDeclarations(String source) throws IOException, LexerException, InterruptedException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); //config.noCPlusPlus = true; config.preprocessorConfig.includeStrings.add(source); Result result = new Result(config, null, null); SourceFiles parse = new JNAeratorParser().parse(config, result.typeConverter, null); List<Declaration> ret = new ArrayList<Declaration>(); flatten(parse, ret); return ret; }
static String preprocess(File source) throws IOException, LexerException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); config.preprocessorConfig.implicitIncludes.add("C:\\program files\\Microsoft SDKs\\Windows\\v7.0A\\Include"); config.preprocessorConfig.implicitIncludes.add("C:\\program files\\Microsoft Visual Studio 10.0\\VC\\include"); //config.preprocessorConfig.includeStrings.add(source); config.addSourceFile(source, null, false, true, true); Result result = new Result(config, null, null); String pre = PreprocessorUtils.preprocessSources(config, Collections.EMPTY_LIST, false, result.typeConverter, null); return pre; }
public void init() { declarationsConverter = config.runtime.createDeclarationsConverter(this); globalsGenerator = config.runtime.createGlobalsGenerator(this); typeConverter = config.runtime.createTypeConversion(this); reifier = new Reifier(this); objectiveCGenerator = new ObjectiveCGenerator(this); universalReconciliator = new UniversalReconciliator(); bridjer = new BridJer(this); } Set<Identifier> javaPackages = new TreeSet<Identifier>();
public static void main(String[] argsArray) { // argsArray = "-library foo -dependencies bar,baz /Users/ochafik/test.h -mode Directory -o /Users/ochafik/tmp".split(" "); // argsArray = new String[] { "/Users/ochafik/github/nativelibs4java/libraries/tmp/glib/config.jnaerator", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/tmp/glib" }; // argsArray = new String[] { "/Users/ochafik/tmp/test.h", "-T__be16=short", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/jnaerator/test", "-v" }; // argsArray = new String[] { "/Users/ochafik/tmp/test.h", "-T__be16=short", "-mode", "Directory", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/jnaerator/test", "-v", "-Dfoo" }; // argsArray = new String[] { "-mode", "Jar", "-f", "-o", "/Users/ochafik/github/nativelibs4java/libraries/tmp", "/Users/ochafik/github/nativelibs4java/libraries/OpenCL/OpenCL4Java/src/main/jnaerator/config.jnaerator" }; main(new JNAerator(new JNAeratorConfig()), argsArray); }
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
static TypeRef primRef(Element element, JavaPrim p) { if (p == null) { return null; } if (p.type == null) { throw new UnsupportedConversionException(element, "Primitive without known type for this runtime: " + p); } return new JavaPrimitive(p); // return new SimpleTypeRef(toString(p)); }
@Override public TypeRef findCallbackRef(TypeRef.FunctionSignature s, Identifier callerLibraryClass) { return pointerTypeRef(super.findCallbackRef(s, callerLibraryClass)); }