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

moved C source package utils

added program to C transformation
refs 118
parent 34cabfcf
......@@ -27,7 +27,7 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.seq
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.var;
import static org.fortiss.af3.generator.common.model.oldc.Function.createExternFunction;
import static org.fortiss.af3.generator.common.model.oldc.VoidType.VOID_TYPE;
import static org.fortiss.af3.generator.common.utils.CSourcePackageUtils.flattenAndSortHierarchicSourcePackages;
import static org.fortiss.af3.generator.common.utils.OldCSourcePackageUtils.flattenAndSortHierarchicSourcePackages;
import java.util.LinkedList;
import java.util.List;
......
......@@ -63,4 +63,20 @@
</modelElementClass>
</modelElementConstraintChecker>
</extension>
<extension
point="org.fortiss.tooling.kernel.transformationProvider">
<transformationProvider
transformationProvider="org.fortiss.af3.expression.generator.imperative.DataDictionaryTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.expression.model.DataDictionary">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.expression.model.generator.Program">
</objectClass>
</target>
</transformationProvider>
</extension>
</plugin>
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2012 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.generator.c;
import org.fortiss.af3.expression.model.generator.Program;
import org.fortiss.af3.generator.common.model.source.SourcePackage;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
import org.fortiss.tooling.kernel.extension.exception.TransformationFailedException;
/**
* An {@link ITransformationProvider} for the transformation of {@link Program} into a C
* {@link SourcePackage}. The resulting package contains two sub-packages {@code inc-gen} and
* {@code src-gen}, which contain the header and implementation files respectively.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class ProgramTransformation implements ITransformationProvider {
/** {@inheritDoc} */
@Override
public Class<?> getTargetClass() {
return null;
}
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
// TODO Auto-generated method stub
return false;
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
// TODO Auto-generated method stub
return false;
}
/** {@inheritDoc} */
@Override
public Object transform(Object source, ITransformationContext context)
throws TransformationFailedException {
// TODO Auto-generated method stub
return null;
}
}
......@@ -97,5 +97,6 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="declaration" eType="#//c/FunctionDeclaration"
eOpposite="#//c/FunctionDeclaration/definition"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CSourcePackage" eSuperTypes="#//source/SourcePackage"/>
</eSubpackages>
</ecore:EPackage>
......@@ -31,7 +31,7 @@ import org.fortiss.af3.generator.common.model.oldsource.SourceUnitBase;
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DCF53C35BBD6407BADD559BEAFF8D13A
*/
public class CSourcePackageUtils {
public class OldCSourcePackageUtils {
/**
* Flattens the given source package and puts the source files into the given root package. The
* root package is required to have two or more sub-packages. The first will be used for header
......
......@@ -42,7 +42,7 @@ import static org.fortiss.af3.generator.common.model.oldc.Function.createExternF
import static org.fortiss.af3.generator.common.model.oldc.Function.createInternFunction;
import static org.fortiss.af3.generator.common.model.oldc.Modifier.STATIC;
import static org.fortiss.af3.generator.common.model.oldc.VoidType.VOID_TYPE;
import static org.fortiss.af3.generator.common.utils.CSourcePackageUtils.flattenAndSortHierarchicSourcePackages;
import static org.fortiss.af3.generator.common.utils.OldCSourcePackageUtils.flattenAndSortHierarchicSourcePackages;
import java.util.LinkedList;
import java.util.List;
......
Supports Markdown
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