/** * 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"); }
@SuppressWarnings("unchecked") private static List<AdditionalCompilationUnitDecoration> getDecoration( final Definition def) { return (List<AdditionalCompilationUnitDecoration>) def .astGetDecoration(ADDITIONAL_COMPILATION_UNIT_DECORATION_NAME); }
public static void addAdditionalCompilationUnit(final Definition def, final AdditionalCompilationUnitDecoration decoration) { List<AdditionalCompilationUnitDecoration> list = getDecoration(def); if (list == null) { list = new ArrayList<AdditionalCompilationUnitDecoration>(); def.astSetDecoration(ADDITIONAL_COMPILATION_UNIT_DECORATION_NAME, list); } list.add(decoration); }
/** * 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}; * * @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 getIncFileName(final Definition definition) { return fullyQualifiedNameToPath(definition.getName(), FILE_EXT); }
protected String getComponentName(final Node container) { if (container instanceof Definition) return ((Definition) container).getName(); else if (container instanceof org.objectweb.fractal.adl.components.Component) return ((org.objectweb.fractal.adl.components.Component) container) .getName(); else throw new IllegalArgumentException( "The given node is neither a Definition nor a Component"); }
/** * 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"); }
protected String getFileContent(final Definition definition) { final StringBuilder sb = new StringBuilder(); sb.append("/* Generated file: ").append(getImplHeaderFileName(definition)) .append("*/\n"); sb.append("#ifndef ").append(toUpperCName(definition.getName())).append( "_IMPL_H\n"); sb.append("#define ").append(toUpperCName(definition.getName())).append( "_IMPL_H\n"); final Source[] sources = ((ImplementationContainer) definition) .getSources(); for (int i = 0; i < sources.length; i++) { sb.append("#include \"").append( toCPath(getImplHeaderFileName(definition, i))).append("\"\n"); } sb.append("#endif //").append(toUpperCName(definition.getName())).append( "_IMPL_H\n"); return sb.toString(); }
/** * 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; }
public void visit(final Definition input, final Map<Object, Object> context) throws ADLException { final String name = input.getName(); final int i = name.indexOf('<'); if (i == -1) return;
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 {
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; }
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; }
name = ((Definition) componentContainer).getName(); } else { name = ((DeployableComponent) componentContainer).getName();
name = ((Definition) container).getName(); } else if (container instanceof Component) { name = ((Component) container).getName();