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); }
protected void addRuntimeClasses(Result result, MemoryFileManager mfm) throws IOException { Map<String, URL> files = getRuntimeFiles(result.config.runtime, result.hasObjectiveC()); boolean needsObjCRuntime = result.hasObjectiveC(); for (Map.Entry<String, URL> e : files.entrySet()) { String file = e.getKey(); URL url = e.getValue(); file = "file:///" + file; if (!mfm.outputs.containsKey(file)) { mfm.outputs.put(file, new URLFileObject(url)); } } }
public void addFile(File file, List<File> out) throws IOException { if (file.isFile()) { out.add(file); } else { File[] fs = file.listFiles(); if (fs != null) { for (File f : fs) { addFile(f, out); } } } }
if (config.autoConf) { feedback.setStatus("Auto-configuring parser..."); autoConfigure(); fixConfig(config); config.preprocessorConfig.implicitMacros.keySet().removeAll(config.undefines); config.preprocessorConfig.explicitMacros.keySet().removeAll(config.undefines); if (config.outputMode.isMaven()) { String pom = config.runtime.generateMavenProjectModel(config.mavenGroupId, config.mavenArtifactId, config.mavenVersion); PrintWriter pomOut = newFileWriter(new File(config.outputDir, POM_FILENAME)); pomOut.println(pom); pomOut.close(); Result result = createResult(new ClassOutputter() { public PrintWriter getSourceWriter(String path) throws IOException { PrintWriter out = JNAerator.this.getSourceWriter(classOutputter[0], path); PrintWriter out = newFileWriter(new File(config.outputDir, "src/main/jnaerator/" + DEFAULT_CONFIG_FILE)); out.println(StringUtils.implode(lines, "\n")); out.close(); SourceFiles sourceFiles = parseSources(feedback, result.typeConverter); if (config.extractLibSymbols) { parseLibSymbols(sourceFiles, result); jnaerationCore(sourceFiles, result); if (sgen != null) { sgen.jnaerationCompleted();
public static void main(String[] args) { String[] prefArgs = JNAerator.getJNAeratorArgsFromPref(); if (args.length > 0 || prefArgs != null) { String[] nargs = null; JNAerator.main(nargs); return;
com.ochafik.lang.jnaerator.JNAerator.main(args.toArray(new String[0]));
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
if (config.autoConf) { feedback.setStatus("Auto-configuring parser..."); autoConfigure(); fixConfig(config); config.preprocessorConfig.implicitMacros.keySet().removeAll(config.undefines); config.preprocessorConfig.explicitMacros.keySet().removeAll(config.undefines); if (config.outputMode.isMaven()) { String pom = config.runtime.generateMavenProjectModel(config.mavenGroupId, config.mavenArtifactId, config.mavenVersion); PrintWriter pomOut = newFileWriter(new File(config.outputDir, POM_FILENAME)); pomOut.println(pom); pomOut.close(); Result result = createResult(new ClassOutputter() { public PrintWriter getSourceWriter(String path) throws IOException { PrintWriter out = JNAerator.this.getSourceWriter(classOutputter[0], path); PrintWriter out = newFileWriter(new File(config.outputDir, "src/main/jnaerator/" + DEFAULT_CONFIG_FILE)); out.println(StringUtils.implode(lines, "\n")); out.close(); SourceFiles sourceFiles = parseSources(feedback, result.typeConverter); if (config.extractLibSymbols) { parseLibSymbols(sourceFiles, result); jnaerationCore(sourceFiles, result); if (sgen != null) { sgen.jnaerationCompleted();
public static void main(String[] args) { String[] prefArgs = JNAerator.getJNAeratorArgsFromPref(); if (args.length > 0 || prefArgs != null) { String[] nargs = null; JNAerator.main(nargs); return;
public static void main(String[] args) { JNAerator.main(new JavaCLGenerator(new JNAeratorConfig()), new String[] { "-o", "target/generated-sources/test", //"-o", "/Users/ochafik/Prog/Java/versionedSources/nativelibs4java/trunk/libraries/OpenCL/Demos/target/generated-sources/main/java", "-noJar", "-noComp", "-v", "-addRootDir", "src/test/opencl", "src/test/opencl/com/nativelibs4java/opencl/generator/Structs.c", //"-addRootDir", "/Users/ochafik/Prog/Java/versionedSources/nativelibs4java/trunk/libraries/OpenCL/Blas/target/../src/main/opencl", //"/Users/ochafik/Prog/Java/versionedSources/nativelibs4java/trunk/libraries/OpenCL/Blas/src/main/opencl/com/nativelibs4java/opencl/blas/LinearAlgebraKernels.c" //"-addRootDir", "/Users/ochafik/Prog/Java/versionedSources/nativelibs4java/trunk/libraries/OpenCL/Demos/target/../src/main/opencl", //"/Users/ochafik/Prog/Java/versionedSources/nativelibs4java/trunk/libraries/OpenCL/Demos/target/../src/main/opencl/com/nativelibs4java/opencl/demos/sobelfilter/SimpleSobel.cl" } ); } }
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
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); }
protected void addRuntimeClasses(Result result, MemoryFileManager mfm) throws IOException { Map<String, URL> files = getRuntimeFiles(result.config.runtime, result.hasObjectiveC()); boolean needsObjCRuntime = result.hasObjectiveC(); for (Map.Entry<String, URL> e : files.entrySet()) { String file = e.getKey(); URL url = e.getValue(); file = "file:///" + file; if (!mfm.outputs.containsKey(file)) { mfm.outputs.put(file, new URLFileObject(url)); } } }
public void addFile(File file, List<File> out) throws IOException { if (file.isFile()) { out.add(file); } else { File[] fs = file.listFiles(); if (fs != null) { for (File f : fs) { addFile(f, out); } } } }
@Test public void testFilesLists() throws IOException { for (JNAeratorConfig.Runtime runtime : JNAeratorConfig.Runtime.values()) { JNAerator.getRuntimeFiles(runtime, false); } } }