当前位置: 首页>>代码示例>>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;未经允许,请勿转载。