Commit d0d19e38 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

using prefixed model class names

refs 121
parent f0bee6bc
......@@ -29,9 +29,9 @@ import org.fortiss.af3.expression.model.definitions.EnumerationMember;
import org.fortiss.af3.expression.model.definitions.FunctionDefinition;
import org.fortiss.af3.expression.model.definitions.TypeDefinition;
import org.fortiss.af3.expression.model.generator.Program;
import org.fortiss.af3.generator.common.model.c.CHeaderFile;
import org.fortiss.af3.generator.common.model.c.CImplementationFile;
import org.fortiss.af3.generator.common.model.c.CSourcePackage;
import org.fortiss.af3.generator.common.model.c.HeaderFile;
import org.fortiss.af3.generator.common.model.c.ImplementationFile;
import org.fortiss.af3.generator.common.model.c.types.CEnumerationDeclaration;
import org.fortiss.af3.generator.common.model.c.types.CEnumerationMember;
import org.fortiss.af3.generator.common.model.source.SourcePackage;
......@@ -82,8 +82,8 @@ public class ProgramTransformation implements ITransformationProvider {
}
/** Creates the implementation source code. */
private ImplementationFile createImplementation(Program p) {
ImplementationFile implFile = createImplementationFile(p.getName());
private CImplementationFile createImplementation(Program p) {
CImplementationFile implFile = createImplementationFile(p.getName());
for(Program sub : p.getSubProgramsList()) {
implFile.getImportsList().add(createInclude(sub.getName(), false));
}
......@@ -92,8 +92,8 @@ public class ProgramTransformation implements ITransformationProvider {
}
/** Creates the header source code. */
private HeaderFile createHeader(Program p) {
HeaderFile h = createHeaderFile(p.getName());
private CHeaderFile createHeader(Program p) {
CHeaderFile h = createHeaderFile(p.getName());
for(TypeDefinition td : p.getTypesList()) {
if(td instanceof Enumeration) {
addCEnumeration((Enumeration)td, h);
......@@ -106,7 +106,7 @@ public class ProgramTransformation implements ITransformationProvider {
}
/** Adds the C enumeration for the given enumeration to the given header file. */
private void addCEnumeration(Enumeration e, HeaderFile h) {
private void addCEnumeration(Enumeration e, CHeaderFile h) {
CEnumerationDeclaration decl = createCEnumerationDeclaration(e.getName());
int val = 0;
for(EnumerationMember mem : e.getMembersList()) {
......
......@@ -91,7 +91,7 @@
</eSubpackages>
<eSubpackages name="c" nsURI="http://www.fortiss.org/af3/generator/common/languages/c"
nsPrefix="org-fortiss-af3-generator-common-languages-c">
<eClassifiers xsi:type="ecore:EClass" name="HeaderFile" eSuperTypes="#//source/FormattedSourceUnit">
<eClassifiers xsi:type="ecore:EClass" name="CHeaderFile" eSuperTypes="#//source/FormattedSourceUnit">
<eOperations name="toFormattedSource" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the formatted content of this source unit."/>
......@@ -99,7 +99,7 @@
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ImplementationFile" eSuperTypes="#//source/FormattedSourceUnit">
<eClassifiers xsi:type="ecore:EClass" name="CImplementationFile" eSuperTypes="#//source/FormattedSourceUnit">
<eOperations name="toFormattedSource" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the formatted content of this source unit."/>
......@@ -107,26 +107,26 @@
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="Modifier">
<eClassifiers xsi:type="ecore:EEnum" name="CModifier">
<eLiterals name="EXTERN"/>
<eLiterals name="STATIC" value="1"/>
<eLiterals name="NONE" value="2" literal=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="PreProcessorDefine" eSuperTypes="#//source/Declaration"/>
<eClassifiers xsi:type="ecore:EClass" name="Include" eSuperTypes="#//source/Import">
<eClassifiers xsi:type="ecore:EClass" name="CPreProcessorDefine" eSuperTypes="#//source/Declaration"/>
<eClassifiers xsi:type="ecore:EClass" name="CInclude" eSuperTypes="#//source/Import">
<eOperations name="toString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return org.fortiss.af3.generator.common.textgen.c.CLanguageConstructTextGenerator.includeToString(this);"/>
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FunctionDeclaration" eSuperTypes="#//source/Declaration">
<eStructuralFeatures xsi:type="ecore:EReference" name="definition" eType="#//c/FunctionDefinition"
eOpposite="#//c/FunctionDefinition/declaration"/>
<eClassifiers xsi:type="ecore:EClass" name="CFunctionDeclaration" eSuperTypes="#//source/Declaration">
<eStructuralFeatures xsi:type="ecore:EReference" name="definition" eType="#//c/CFunctionDefinition"
eOpposite="#//c/CFunctionDefinition/declaration"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FunctionDefinition" eSuperTypes="#//source/Definition">
<eStructuralFeatures xsi:type="ecore:EReference" name="declaration" eType="#//c/FunctionDeclaration"
eOpposite="#//c/FunctionDeclaration/definition"/>
<eClassifiers xsi:type="ecore:EClass" name="CFunctionDefinition" eSuperTypes="#//source/Definition">
<eStructuralFeatures xsi:type="ecore:EReference" name="declaration" eType="#//c/CFunctionDeclaration"
eOpposite="#//c/CFunctionDeclaration/definition"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CSourcePackage" eSuperTypes="#//source/SourcePackage">
<eOperations name="getIncGenPackage" eType="#//source/SourcePackage">
......@@ -154,10 +154,10 @@
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TypeDeclaration" eSuperTypes="#//source/Declaration platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"/>
<eClassifiers xsi:type="ecore:EClass" name="CTypeDeclaration" eSuperTypes="#//source/Declaration platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"/>
<eSubpackages name="types" nsURI="http://www.fortiss.org/af3/generator/common/languages/c/types"
nsPrefix="org-fortiss-af3-generator-common-languages-c-types">
<eClassifiers xsi:type="ecore:EClass" name="CEnumerationDeclaration" eSuperTypes="#//c/TypeDeclaration">
<eClassifiers xsi:type="ecore:EClass" name="CEnumerationDeclaration" eSuperTypes="#//c/CTypeDeclaration">
<eOperations name="toString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return org.fortiss.af3.generator.common.textgen.c.CLanguageTypesTextGenerator.enumerationToString(this);"/>
......
......@@ -49,28 +49,28 @@
</nestedGenPackages>
<nestedGenPackages prefix="AF3GeneratorCommonLanguagesC" basePackage="org.fortiss.af3.generator.common.model"
disposableProviderFactory="true" ecorePackage="languages.ecore#//c">
<genEnums typeSafeEnumCompatible="false" ecoreEnum="languages.ecore#//c/Modifier">
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/Modifier/EXTERN"/>
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/Modifier/STATIC"/>
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/Modifier/NONE"/>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="languages.ecore#//c/CModifier">
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/CModifier/EXTERN"/>
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/CModifier/STATIC"/>
<genEnumLiterals ecoreEnumLiteral="languages.ecore#//c/CModifier/NONE"/>
</genEnums>
<genClasses ecoreClass="languages.ecore#//c/HeaderFile">
<genOperations ecoreOperation="languages.ecore#//c/HeaderFile/toFormattedSource"/>
<genClasses ecoreClass="languages.ecore#//c/CHeaderFile">
<genOperations ecoreOperation="languages.ecore#//c/CHeaderFile/toFormattedSource"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/ImplementationFile">
<genOperations ecoreOperation="languages.ecore#//c/ImplementationFile/toFormattedSource"/>
<genClasses ecoreClass="languages.ecore#//c/CImplementationFile">
<genOperations ecoreOperation="languages.ecore#//c/CImplementationFile/toFormattedSource"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/PreProcessorDefine"/>
<genClasses ecoreClass="languages.ecore#//c/Include">
<genOperations ecoreOperation="languages.ecore#//c/Include/toString"/>
<genClasses ecoreClass="languages.ecore#//c/CPreProcessorDefine"/>
<genClasses ecoreClass="languages.ecore#//c/CInclude">
<genOperations ecoreOperation="languages.ecore#//c/CInclude/toString"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/FunctionDeclaration">
<genClasses ecoreClass="languages.ecore#//c/CFunctionDeclaration">
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference languages.ecore#//c/FunctionDeclaration/definition"/>
ecoreFeature="ecore:EReference languages.ecore#//c/CFunctionDeclaration/definition"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/FunctionDefinition">
<genClasses ecoreClass="languages.ecore#//c/CFunctionDefinition">
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference languages.ecore#//c/FunctionDefinition/declaration"/>
ecoreFeature="ecore:EReference languages.ecore#//c/CFunctionDefinition/declaration"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/CSourcePackage">
<genOperations ecoreOperation="languages.ecore#//c/CSourcePackage/getIncGenPackage"/>
......@@ -78,7 +78,7 @@
<genOperations ecoreOperation="languages.ecore#//c/CSourcePackage/getIncPackage"/>
<genOperations ecoreOperation="languages.ecore#//c/CSourcePackage/getSrcPackage"/>
</genClasses>
<genClasses ecoreClass="languages.ecore#//c/TypeDeclaration"/>
<genClasses ecoreClass="languages.ecore#//c/CTypeDeclaration"/>
<nestedGenPackages prefix="Types" basePackage="org.fortiss.af3.generator.common.model.c"
disposableProviderFactory="true" ecorePackage="languages.ecore#//c/types">
<genClasses ecoreClass="languages.ecore#//c/types/CEnumerationDeclaration">
......
......@@ -17,7 +17,7 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.generator.common.textgen.c;
import org.fortiss.af3.generator.common.model.c.Include;
import org.fortiss.af3.generator.common.model.c.CInclude;
/**
* Text generator for C language constructs.
......@@ -35,7 +35,7 @@ public class CLanguageConstructTextGenerator {
* the include statement
* @return the C include code
*/
public static String includeToString(Include inc) {
public static String includeToString(CInclude inc) {
return "#include " + inc.getSourceUnitReference() + '\n';
}
}
......@@ -19,10 +19,10 @@ package org.fortiss.af3.generator.common.utils;
import org.fortiss.af3.generator.common.model.c.AF3GeneratorCommonLanguagesCFactory;
import org.fortiss.af3.generator.common.model.c.AF3GeneratorCommonLanguagesCPackage;
import org.fortiss.af3.generator.common.model.c.CHeaderFile;
import org.fortiss.af3.generator.common.model.c.CImplementationFile;
import org.fortiss.af3.generator.common.model.c.CInclude;
import org.fortiss.af3.generator.common.model.c.CSourcePackage;
import org.fortiss.af3.generator.common.model.c.HeaderFile;
import org.fortiss.af3.generator.common.model.c.ImplementationFile;
import org.fortiss.af3.generator.common.model.c.Include;
import org.fortiss.af3.generator.common.model.c.types.CEnumerationDeclaration;
import org.fortiss.af3.generator.common.model.c.types.CEnumerationMember;
import org.fortiss.af3.generator.common.model.c.types.TypesFactory;
......@@ -75,17 +75,17 @@ public class CLanguageModelElementFactory {
return cPack;
}
/** Creates a {@link HeaderFile} with the given name (.h is appended). */
public static HeaderFile createHeaderFile(String name) {
HeaderFile hFile = AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createHeaderFile();
/** Creates a {@link CHeaderFile} with the given name (.h is appended). */
public static CHeaderFile createHeaderFile(String name) {
CHeaderFile hFile = AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCHeaderFile();
hFile.setName(name + ".h");
return hFile;
}
/** Creates an {@link ImplementationFile} with the given name (.c is appended). */
public static ImplementationFile createImplementationFile(String name) {
ImplementationFile iFile =
AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createImplementationFile();
/** Creates an {@link CImplementationFile} with the given name (.c is appended). */
public static CImplementationFile createImplementationFile(String name) {
CImplementationFile iFile =
AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCImplementationFile();
iFile.setName(name + ".c");
return iFile;
}
......@@ -112,8 +112,8 @@ public class CLanguageModelElementFactory {
* if {@code true} a standard library header is included (e.g. {@code<stdio.h>})
* otherwise a normal header is included (e.g.{@code "myheader.h"});
*/
public static Include createInclude(String headerRef, boolean stdLibRef) {
Include inc = AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createInclude();
public static CInclude createInclude(String headerRef, boolean stdLibRef) {
CInclude inc = AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCInclude();
if(stdLibRef) {
headerRef = "<" + headerRef + ".h>";
} else {
......
......@@ -19,8 +19,8 @@ package org.fortiss.af3.generator.common.utils;
import java.util.Date;
import org.fortiss.af3.generator.common.model.c.HeaderFile;
import org.fortiss.af3.generator.common.model.c.ImplementationFile;
import org.fortiss.af3.generator.common.model.c.CHeaderFile;
import org.fortiss.af3.generator.common.model.c.CImplementationFile;
import org.fortiss.af3.generator.common.model.source.Declaration;
import org.fortiss.af3.generator.common.model.source.Definition;
import org.fortiss.af3.generator.common.model.source.Import;
......@@ -42,7 +42,7 @@ public class CLanguageUtils {
* the header file
* @return the source code for this header file
*/
public static String headerToSource(HeaderFile headerFile) {
public static String headerToSource(CHeaderFile headerFile) {
StringBuffer buf = new StringBuffer();
String ifdefString = headerFile.getName().replaceAll("\\W", "_");
buf.append("/* generated by AutoFOCUS 3 (").append(new Date().toString()).append(") */\n");
......@@ -65,7 +65,7 @@ public class CLanguageUtils {
* the implementation file
* @return the source code for this implementation file
*/
public static String implementationToSource(ImplementationFile implFile) {
public static String implementationToSource(CImplementationFile implFile) {
StringBuffer buf = new StringBuffer();
buf.append("/* generated by AutoFOCUS 3 (").append(new Date().toString()).append(") */\n");
for(Import ib : implFile.getImportsList()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment