⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parserconfigurationfactory.java

📁 plugin for eclipse
💻 JAVA
字号:
package isis.anp.config;

import isis.anp.common.ParserConfiguration;
import isis.commons.fs.SearchPath;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;


public class ParserConfigurationFactory {
	/**
	 * Builds a parser configuration using preconfigured platform and
	 * sensorboard settings.
	 * 
	 * @param tosDir
	 *            the tos directory.
	 * @param platformProfile
	 *            the platform profile.
	 * @param sensorBoardProfile
	 *            the sensor board profile.
	 * @param userSearchPathList
	 *            the user search path list. It usually includes the application
	 *            directory and the lib directories.
	 * @param defines
	 *            defines and macros.
	 * @return the parser configuration.
	 * @throws IOException
	 *             if the configuration files cannot be read.
	 */
	public static ParserConfiguration create(String tosDir, String tmpDir,
			PlatformProfile platformProfile,
			SensorBoardProfile sensorBoardProfile,
			SearchPath userSearchPathList, Map defines) throws IOException {

		// Create a new parser configuration
		ParserConfiguration parserConfig = new ParserConfiguration();

		// set temp dir
		parserConfig.setTempDir(tmpDir);

		// set up search path
		SearchPath searchPathList;
		searchPathList = (SearchPath) userSearchPathList.clone();
		searchPathList.addAllWithPrefix(sensorBoardProfile.getSearchPathList(),
				tosDir + "/");
		searchPathList.addAllWithPrefix(platformProfile.getSearchPathList(),
				tosDir + "/");
		searchPathList
				.addAllWithPrefix(SearchPath
						.load("isis/anp/config/syspath/syspath.properties"),
						tosDir + "/");

		parserConfig.setSearchPath(searchPathList);

		// set cpp executable
		parserConfig.setCppExecutable(platformProfile.getCppExecutable());

		// set cpp options
		parserConfig.setCppOptions(platformProfile.getCppOptions());

		// add tos.h to nesc includes
		parserConfig.getNesCIncludes().add("tos.h");

		// set defines
		if(defines == null) {
			defines = new HashMap();
		}
		defines.put("NESC","110");
		parserConfig.setDefines(defines);

		return parserConfig;
	}

	private ParserConfigurationFactory() {
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -