當前位置: 首頁>>代碼示例>>Java>>正文


Java JNAeratorConfig類代碼示例

本文整理匯總了Java中com.ochafik.lang.jnaerator.JNAeratorConfig的典型用法代碼示例。如果您正苦於以下問題:Java JNAeratorConfig類的具體用法?Java JNAeratorConfig怎麽用?Java JNAeratorConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JNAeratorConfig類屬於com.ochafik.lang.jnaerator包,在下文中一共展示了JNAeratorConfig類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: close

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
public void close(JFrame f) {
    try {
        save();
        setPref("window.width", f.getWidth());
        setPref("window.height", f.getHeight());
        setPref("window.extendedState", f.getExtendedState());
        setPref("options.libraryName", libraryName.getText());
        setPref("options.direct", directCallingCb.isSelected());
        setPref("options.topLevelStructs", structsAsTopLevelClassesCb.isSelected());
        setPref("options.reification", reificationCb.isSelected());
        setPref("options.convertBodies", convertBodiesCb.isSelected());
        setPref("options.extractInterface", extractInterfaceCb.isSelected());
        setPref("options.genRawBindings", genRawBindingsCb.isSelected());
        //setPref("options.scalaSetters", scalaSettersCb.isSelected());
        setPref("options.beautifyNames", beautifyNamesCb.isSelected());
        setPref("options.forceNames", forceNamesCb.isSelected());
        setPref("options.charPtrAsString", charPtrAsString.isSelected());
        setPref("options.targetRuntime", ((JNAeratorConfig.Runtime) runtimeCombo.getSelectedItem()).name());
        setPref("options.outputMode", ((JNAeratorConfig.OutputMode) modeCombo.getSelectedItem()).name());
        setPref("options.noComments", noCommentCb.isSelected());
        setPref("splitPane.orientation", sp.getOrientation());
        setPref("splitPane.dividedLocation", getProportionalDividerLocation(sp));
        prefNode().flush();
        System.exit(0);
    } catch (Throwable ex) {
        error(null, "Error while closing", ex);
    }
}
 
開發者ID:nativelibs4java,項目名稱:JNAerator,代碼行數:29,代碼來源:JNAeratorStudio.java

示例2: newParser

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
public static ObjCppParser newParser(String s) throws IOException {
	Result result = new Result(new JNAeratorConfig(), null, null);
	ObjCppParser parser = new ObjCppParser(new CommonTokenStream(new ObjCppLexer(
			new ANTLRReaderStream(new StringReader(s))))
	// , new DummyDebugEventListener()
	);
	parser.objCParserHelper = result.typeConverter;
	return parser;
}
 
開發者ID:nativelibs4java,項目名稱:JNAerator,代碼行數:10,代碼來源:ObjCppParsingTest.java

示例3: run

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
@TaskAction
public void run() {
    List<String> args = new ArrayList<String>();

    args.add(JNAeratorCommandLineArgs.OptionDef.CurrentLibrary.clSwitch);
    args.add(getLibraryName());
    args.add(JNAeratorCommandLineArgs.OptionDef.CurrentPackage.clSwitch);
    args.add(getPackageName());

    for (File file : getHeaderFiles())
        args.add(file.getAbsolutePath());

    args.add(JNAeratorCommandLineArgs.OptionDef.OutputMode.clSwitch);
    args.add(JNAeratorConfig.OutputMode.Directory.name());

    args.add(JNAeratorCommandLineArgs.OptionDef.Runtime.clSwitch);
    args.add(getRuntimeMode().name());

    args.add(JNAeratorCommandLineArgs.OptionDef.OutputDir.clSwitch);
    // String outputPath = getPackageName().replace('.', File.separatorChar);
    // File outputDir = new File(getOutputDir(), outputPath);
    args.add(getOutputDir().getAbsolutePath());

    args.add(JNAeratorCommandLineArgs.OptionDef.ForceOverwrite.clSwitch);
    // args.add(JNAeratorCommandLineArgs.OptionDef.Verbose.clSwitch);
    args.add("-v");

    for (String d : define)
        args.add("-D" + d);
    for (String u : undefine)
        args.add("-U" + u);

    args.addAll(getExtraArgs());

    DefaultGroovyMethods.deleteDir(outputDir);
    outputDir.mkdirs();
    getLogger().info("Invoking jnaerator " + args);

    JNAerator.main(args.toArray(new String[args.size()]));
}
 
開發者ID:shevek,項目名稱:gradle-jnaerator-plugin,代碼行數:41,代碼來源:JNAeratorTask.java

示例4: testJNAerator

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
@Test
public void testJNAerator() throws Exception {
    List<String> args = new ArrayList<String>();
    args.add(JNAeratorCommandLineArgs.OptionDef.CurrentLibrary.clSwitch);
    args.add("xcb");
    args.add("/usr/include/xcb/xcb.h");
    args.add(JNAeratorCommandLineArgs.OptionDef.OutputMode.clSwitch);
    args.add(JNAeratorConfig.OutputMode.Directory.name());
    args.add(JNAeratorCommandLineArgs.OptionDef.Runtime.clSwitch);
    args.add(JNAeratorConfig.Runtime.JNA.name());
    args.add(JNAeratorCommandLineArgs.OptionDef.OutputDir.clSwitch);
    args.add("build/test/org/anarres/jnaerator/test");
    args.add(JNAeratorCommandLineArgs.OptionDef.Verbose.clSwitch);
    JNAerator.main(args.toArray(new String[args.size()]));
}
 
開發者ID:shevek,項目名稱:gradle-jnaerator-plugin,代碼行數:16,代碼來源:JNAeratorTest.java

示例5: generateAll

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
public void generateAll(File root, File javaOutDir, File openCLOutDir) throws IOException, MojoExecutionException {
    List<File> sources = new ArrayList<File>();
    root = root.getCanonicalFile();
    listOpenCLFiles(root, sources);

    getLog().info("Found " + sources.size() + " files in " + root);
    String rootPath = root.getCanonicalPath();
    String openCLOutPath = openCLOutDir.getCanonicalPath();
    String javaOutPath = javaOutDir.getCanonicalPath();
    for (File file : sources) {
        final JNAeratorConfig config = new JNAeratorConfig();
        config.autoConf = true;
        config.forceOverwrite = true;
        config.outputMode = JNAeratorConfig.OutputMode.Directory;
        config.outputJar = null;
        if (!javaOutDir.exists())
            javaOutDir.mkdirs();
        config.outputDir = javaOutDir;
        config.addSourceFile(file, null, false, true, true);
        config.addRootDir(root);
        
        final String fileName = file.getName();
        String filePath = file.getCanonicalPath();
        File openCLOutFile = new File(openCLOutPath + filePath.substring(rootPath.length()));

        int i = filePath.lastIndexOf(".");
        File javaOutFile = new File(javaOutPath + filePath.substring(rootPath.length(), i) + ".java");
        if (javaOutFile.exists() && javaOutFile.lastModified() > file.lastModified()) {
            getLog().info("File " + fileName + " is up-to-date. Skipping generation.");
            continue;
        }

        File openCLOutParent = openCLOutFile.getParentFile();
        if (!openCLOutParent.exists())
            openCLOutParent.mkdirs();

        getLog().info("Copying " + file + " to " + openCLOutFile);
        FileWriter out = new FileWriter(openCLOutFile);
        FileReader in = new FileReader(file);
        IOUtils.readWrite(in, out);
        out.close();
        in.close();
        
        JavaCLGenerator generator = new JavaCLGenerator(config);
        final Throwable[] ex = new Throwable[1];
        generator.jnaerate(new Feedback() {

            @Override
            public void setStatus(String string) {
                if (config.verbose)
                    getLog().info(string);
            }

            @Override
            public void setFinished(Throwable e) {
                getLog().info("JNAeration failed !");
                e.printStackTrace();
                ex[0] = e;
            }

            @Override
            public void setFinished(File toOpen) {
                getLog().info("JNAeration of " + fileName + " completed in " + toOpen.getAbsolutePath());
            }

            @Override
            public void sourcesParsed(SourceFiles sourceFiles) {

            }

            @Override
            public void wrappersGenerated(
                    com.ochafik.lang.jnaerator.Result result) {
            }
        });
        if (ex[0] != null)
            throw new MojoExecutionException( "Error JNAerating " + fileName, ex[0]);
    }
}
 
開發者ID:nativelibs4java,項目名稱:JavaCL,代碼行數:80,代碼來源:JavaCLGeneratorMojo.java

示例6: getRuntimeMode

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
@Nonnull
public JNAeratorConfig.Runtime getRuntimeMode() {
    return runtimeMode;
}
 
開發者ID:shevek,項目名稱:gradle-jnaerator-plugin,代碼行數:5,代碼來源:JNAeratorTask.java

示例7: setRuntimeMode

import com.ochafik.lang.jnaerator.JNAeratorConfig; //導入依賴的package包/類
public void setRuntimeMode(@Nonnull JNAeratorConfig.Runtime runtimeMode) {
    this.runtimeMode = runtimeMode;
}
 
開發者ID:shevek,項目名稱:gradle-jnaerator-plugin,代碼行數:4,代碼來源:JNAeratorTask.java


注:本文中的com.ochafik.lang.jnaerator.JNAeratorConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。