/** * Returns the absolute path corresponding to the given fully qualified name. * * @param fullyQualifiedName a fully qualified name * @param extension the file extension to add at the end of the returned path. * May be <code>null</code> * @return the absolute path corresponding to the given fully qualified name. */ public static String fullyQualifiedNameToPath( final String fullyQualifiedName, final String extension) { return fullyQualifiedNameToPath(fullyQualifiedName, null, extension); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getIncFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getMacroFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getHeaderFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getImplHeaderFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), "_impl", ".h"); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition}; * * @param definition a {@link Definition} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getCtrlImplFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_SUFFIX, FILE_EXT); }
/** * A static method that returns the name of the file that is generated by this * component for the given {@link Definition} and source index * * @param definition a {@link Definition} node. * @param srcIndex the index of the source node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getImplHeaderFileName(final Definition definition, final int srcIndex) { return fullyQualifiedNameToPath(definition.getName(), "_impl" + srcIndex, ".h"); }
public static StringTemplate getTemplate(final String groupName, final String templateName) { final String groupFileName = fullyQualifiedNameToPath(groupName, ".st") .substring(1); final InputStream groupFile = ClassLoader .getSystemResourceAsStream(groupFileName); if (groupFile == null) { throw new IllegalArgumentException("Can't find template group file \"" + groupFileName + "\""); } final StringTemplateGroup group = new StringTemplateGroup( new InputStreamReader(groupFile)); final StringTemplate template = group.getInstanceOf(templateName); template.registerRenderer(String.class, new BackendFormatRenderer()); return template; }
public static StringTemplate getTemplate(final String groupName, final String superGroupName, final String templateName) { final String groupFileName = fullyQualifiedNameToPath(groupName, ".st") .substring(1); final InputStream groupFile = ClassLoader new InputStreamReader(groupFile)); final String superGroupFileName = fullyQualifiedNameToPath(superGroupName, ".st").substring(1); final InputStream superGroupFile = ClassLoader
fullyQualifiedNameToPath(templateName, FILE_EXT), context); final Properties map = new Properties(); if (mapFile.exists()) {
/** * A static method that returns the name of the file that is generated by this * component for the given {@link InstancesDescriptor}; * * @param instanceDesc an {@link InstancesDescriptor} node. * @return the name of the file that is generated by this component for the * given {@link Definition}; */ public static String getInstancesFileName( final InstancesDescriptor instanceDesc) { String outputFileName = toValidName(instanceDesc.topLevelDefinition .getName()); outputFileName += "_" + toValidName(instanceDesc.instanceDefinition.getName()).replace('.', '_') + "_instances"; outputFileName = fullyQualifiedNameToPath(outputFileName, FILE_EXT); return outputFileName; }
outputPath = fullyQualifiedNameToPath(graph.getDefinition().getName(), null);
final String implSuffix = "_impl" + i; final File cppFile = outputFileLocatorItf.getCSourceOutputFile( fullyQualifiedNameToPath(definition.getName(), implSuffix, ".i"), context); final File mppFile = outputFileLocatorItf.getCSourceOutputFile( fullyQualifiedNameToPath(definition.getName(), implSuffix, ".mpp.c"), context); final File objectFile = outputFileLocatorItf.getCCompiledOutputFile( fullyQualifiedNameToPath(definition.getName(), implSuffix, ".o"), context); fullyQualifiedNameToPath(definition.getName(), implSuffix, ".c"), context); try {
public void visit(final IDL idl, final Map<Object, Object> context) throws ADLException { final String headerFileName; if (idl.getName().startsWith("/")) { headerFileName = PathHelper.replaceExtension(idl.getName(), IDT_FILE_EXT); } else { headerFileName = PathHelper.fullyQualifiedNameToPath(idl.getName(), ITF_FILE_EXT); } final File headerFile = outputFileLocatorItf.getCSourceOutputFile( headerFileName, context); if (!inputResourceLocatorItf.isUpToDate(headerFile, InputResourcesHelper .getInputResources(idl), context)) { final StringTemplate st = getInstanceOf("idlFile"); st.setAttribute("idl", idl); try { writeToFile(headerFile, st.toString()); } catch (final IOException e) { throw new CompilerError(IOErrors.WRITE_ERROR, e, headerFile .getAbsolutePath()); } } }
protected CompilerCommand newCompilerCommand(final Definition definition, final File inputFile, final File outputFile, final Map<Object, Object> context) throws ADLException { final CompilerCommand command = compilerWrapperItf .newCompilerCommand(context); command.setOutputFile(outputFile).setInputFile(inputFile); command.addIncludeDir(outputFileLocatorItf.getCSourceOutputDir(context)); // TODO how to avoid re-computation of this file name ? final String includefileName = fullyQualifiedNameToPath(definition .getName(), DefinitionMacroSourceGenerator.FILE_EXT); command.addIncludeFile(outputFileLocatorItf.getCSourceOutputFile( includefileName, context)); // Add definition level C-Flags final CFlags definitionflags = getAnnotation(definition, CFlags.class); if (definitionflags != null) command.addFlags(splitOptionString(definitionflags.value)); return command; }
protected CompilerCommand newCompilerCommand(final Definition definition, final File inputFile, final File outputFile, final Map<Object, Object> context) throws ADLException { final CompilerCommand command = compilerWrapperItf .newCompilerCommand(context); command.setOutputFile(outputFile).setInputFile(inputFile); command.addIncludeDir(outputFileLocatorItf.getCSourceOutputDir(context)); final String includefileName = fullyQualifiedNameToPath(definition .getName(), DefinitionMacroSourceGenerator.FILE_EXT); command.addIncludeFile(outputFileLocatorItf.getCSourceOutputFile( includefileName, context)); // Add definition level C-Flags final CFlags definitionflags = getAnnotation(definition, CFlags.class); if (definitionflags != null) command.addFlags(splitOptionString(definitionflags.value)); return command; }