Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
a6afb89b
Commit
a6afb89b
authored
May 22, 2012
by
Florian Hölzl
Browse files
moved generator model
refs 118
parent
05944c76
Changes
9
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.expression/trunk/model/expression.ecore
View file @
a6afb89b
...
...
@@ -460,4 +460,20 @@
containment=
"true"
/>
</eClassifiers>
</eSubpackages>
<eSubpackages
name=
"generator"
nsURI=
"http://www.fortiss.org/af3/expression/generator"
nsPrefix=
"org-fortiss-af3-expression-generator"
>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"Program"
eSuperTypes=
"platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"types"
upperBound=
"-1"
eType=
"#//definitions/TypeDefinition"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"variables"
upperBound=
"-1"
eType=
"#//generator/ProgramVariable"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"functions"
upperBound=
"-1"
eType=
"#//definitions/FunctionDefinition"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"subPrograms"
upperBound=
"-1"
eType=
"#//generator/Program"
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"ProgramVariable"
eSuperTypes=
"#//definitions/FunctionParameter"
>
<eStructuralFeatures
xsi:type=
"ecore:EAttribute"
name=
"exported"
eType=
"ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
org.fortiss.af3.expression/trunk/model/expression.genmodel
View file @
a6afb89b
...
...
@@ -190,5 +190,17 @@
<genOperations
ecoreOperation=
"expression.ecore#//definitions/FunctionParameter/getFunctionDefinition"
/>
</genClasses>
</nestedGenPackages>
<nestedGenPackages
prefix=
"Generator"
basePackage=
"org.fortiss.af3.expression.model"
disposableProviderFactory=
"true"
ecorePackage=
"expression.ecore#//generator"
>
<genClasses
ecoreClass=
"expression.ecore#//generator/Program"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference expression.ecore#//generator/Program/types"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference expression.ecore#//generator/Program/variables"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference expression.ecore#//generator/Program/functions"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference expression.ecore#//generator/Program/subPrograms"
/>
</genClasses>
<genClasses
ecoreClass=
"expression.ecore#//generator/ProgramVariable"
>
<genFeatures
createChild=
"false"
ecoreFeature=
"ecore:EAttribute expression.ecore#//generator/ProgramVariable/exported"
/>
</genClasses>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
org.fortiss.af3.expression/trunk/src/org/fortiss/af3/expression/generator/imperative/DataDictionaryTransformation.java
0 → 100644
View file @
a6afb89b
/*--------------------------------------------------------------------------+
$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.imperative
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
GeneratorModelElementFactory
.
createProgram
;
import
org.fortiss.af3.expression.model.DataDictionary
;
import
org.fortiss.af3.expression.model.definitions.TypeDefinition
;
import
org.fortiss.af3.expression.model.generator.Program
;
import
org.fortiss.tooling.kernel.extension.ITransformationProvider
;
import
org.fortiss.tooling.kernel.extension.data.ITransformationContext
;
/**
* An {@link ITransformationProvider} for the transformation from {@link DataDictionary} to
* {@link Program}.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
class
DataDictionaryTransformation
implements
ITransformationProvider
{
/** {@inheritDoc} */
@Override
public
Class
<?>
getTargetClass
()
{
return
Program
.
class
;
}
/** {@inheritDoc} */
@Override
public
boolean
canHandleChainTransformation
(
Class
<?>
sourceClass
,
ITransformationContext
context
)
{
return
DataDictionary
.
class
.
isAssignableFrom
(
sourceClass
);
}
/** {@inheritDoc} */
@Override
public
boolean
canTransform
(
Object
source
,
ITransformationContext
context
)
{
return
source
instanceof
DataDictionary
;
}
/** {@inheritDoc} */
@Override
public
Object
transform
(
Object
source
,
ITransformationContext
context
)
{
return
createProgramFor
((
DataDictionary
)
source
);
}
/** Creates the program for the data dictionary. */
private
Object
createProgramFor
(
DataDictionary
dict
)
{
Program
p
=
createProgram
(
"data_dictionary"
);
return
p
;
}
/** Creates the int type definition. */
private
TypeDefinition
createIntTypeDefinition
()
{
return
null
;
}
/** Creates the boolean type definition. */
private
TypeDefinition
createBooleanTypeDefinition
()
{
return
null
;
}
}
org.fortiss.af3.expression/trunk/src/org/fortiss/af3/expression/utils/GeneratorModelElementFactory.java
0 → 100644
View file @
a6afb89b
/*--------------------------------------------------------------------------+
$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.utils
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
var
;
import
org.fortiss.af3.expression.model.generator.GeneratorFactory
;
import
org.fortiss.af3.expression.model.generator.GeneratorPackage
;
import
org.fortiss.af3.expression.model.generator.Program
;
import
org.fortiss.af3.expression.model.generator.ProgramVariable
;
import
org.fortiss.af3.project.model.typesystem.IType
;
/**
* Model element factory for {@link GeneratorPackage} elements.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
class
GeneratorModelElementFactory
{
/** Creates a program with the given name. */
public
static
Program
createProgram
(
String
name
)
{
Program
p
=
GeneratorFactory
.
eINSTANCE
.
createProgram
();
p
.
setName
(
name
);
return
p
;
}
/** Creates a variable with the given name and type. The variable is not exported. */
public
static
ProgramVariable
createVariable
(
String
name
,
IType
type
)
{
ProgramVariable
v
=
GeneratorFactory
.
eINSTANCE
.
createProgramVariable
();
v
.
setExported
(
false
);
v
.
setVariable
(
var
(
name
));
v
.
setType
(
type
);
return
v
;
}
}
org.fortiss.af3.generator.common/trunk/META-INF/MANIFEST.MF
View file @
a6afb89b
...
...
@@ -10,7 +10,13 @@ Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.generator.common.AF3GeneratorCommonActivator
Require-Bundle: org.fortiss.af3.project;bundle-version="2.1.0";visibility:=reexport
Export-Package: org.fortiss.af3.generator.common,
org.fortiss.af3.generator.common.model.c,
org.fortiss.af3.generator.common.model.c.impl,
org.fortiss.af3.generator.common.model.c.util,
org.fortiss.af3.generator.common.model.oldc,
org.fortiss.af3.generator.common.model.oldsource,
org.fortiss.af3.generator.common.model.source,
org.fortiss.af3.generator.common.model.source.impl,
org.fortiss.af3.generator.common.model.source.util,
org.fortiss.af3.generator.common.model.vhdl,
org.fortiss.af3.generator.common.utils
org.fortiss.af3.generator.common/trunk/buckminster.cspex
0 → 100644
View file @
a6afb89b
<?xml version="1.0" encoding="UTF-8"?>
<cspecExtension
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:bc=
"http://www.eclipse.org/buckminster/Common-1.0"
xmlns=
"http://www.eclipse.org/buckminster/CSpec-1.0"
>
<actions>
<!-- Place your Actions here -->
<public
name=
"generate-ecore"
actor=
"jdt.ant"
always=
"true"
>
<actorProperties>
<property
key=
"buildFile"
value=
"model/generate-ecore.xml"
/>
<property
key=
"targets"
value=
"generate-ecore"
/>
</actorProperties>
<products>
<path
path=
"generated-src"
/>
</products>
</public>
</actions>
<alterGroups>
<!-- Place your Group alterations here -->
<public
name=
"eclipse.build.source"
>
<attribute
name=
"generate-ecore"
/>
</public>
</alterGroups>
</cspecExtension>
org.fortiss.af3.generator.common/trunk/model/languages.ecore
View file @
a6afb89b
...
...
@@ -98,27 +98,4 @@
eOpposite=
"#//c/FunctionDeclaration/definition"
/>
</eClassifiers>
</eSubpackages>
<eSubpackages
name=
"imperative"
nsURI=
"http://www.fortiss.org/af3/generator/common/languages/imperative"
nsPrefix=
"org-fortiss-af3-generator-common-languages-imperative"
>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"Program"
eSuperTypes=
"../../org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"variables"
upperBound=
"-1"
eType=
"ecore:EClass ../../org.fortiss.af3.project/model/project.ecore#//typesystem/VarBase"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"procedures"
upperBound=
"-1"
eType=
"#//imperative/Procedure"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"subPrograms"
upperBound=
"-1"
eType=
"#//imperative/Program"
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"Procedure"
eSuperTypes=
"../../org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"type"
eType=
"ecore:EClass ../../org.fortiss.af3.project/model/project.ecore#//typesystem/IType"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"parameters"
upperBound=
"-1"
eType=
"#//imperative/Variable"
containment=
"true"
/>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"body"
eType=
"ecore:EClass ../../org.fortiss.af3.project/model/project.ecore#//typesystem/ITerm"
containment=
"true"
/>
</eClassifiers>
<eClassifiers
xsi:type=
"ecore:EClass"
name=
"Variable"
eSuperTypes=
"../../org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement"
>
<eStructuralFeatures
xsi:type=
"ecore:EReference"
name=
"type"
eType=
"ecore:EClass ../../org.fortiss.af3.project/model/project.ecore#//typesystem/IType"
containment=
"true"
/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
org.fortiss.af3.generator.common/trunk/model/languages.genmodel
View file @
a6afb89b
...
...
@@ -43,7 +43,7 @@
<genOperations
ecoreOperation=
"languages.ecore#//source/FormattedSourceUnit/toSource"
/>
</genClasses>
</nestedGenPackages>
<nestedGenPackages
prefix=
"C"
basePackage=
"org.fortiss.af3.generator.common.model"
<nestedGenPackages
prefix=
"
AF3GeneratorCommonLanguages
C"
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"
/>
...
...
@@ -63,9 +63,10 @@
ecoreFeature=
"ecore:EReference languages.ecore#//c/FunctionDefinition/declaration"
/>
</genClasses>
</nestedGenPackages>
<nestedGenPackages
prefix=
"Imperative"
basePackage=
"org.fortiss.af3.generator.common.model"
<nestedGenPackages
prefix=
"
AF3GeneratorCommonLanguages
Imperative"
basePackage=
"org.fortiss.af3.generator.common.model"
disposableProviderFactory=
"true"
ecorePackage=
"languages.ecore#//imperative"
>
<genClasses
ecoreClass=
"languages.ecore#//imperative/Program"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference languages.ecore#//imperative/Program/types"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference languages.ecore#//imperative/Program/variables"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference languages.ecore#//imperative/Program/procedures"
/>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference languages.ecore#//imperative/Program/subPrograms"
/>
...
...
@@ -79,6 +80,7 @@
<genClasses
ecoreClass=
"languages.ecore#//imperative/Variable"
>
<genFeatures
property=
"None"
children=
"true"
createChild=
"true"
ecoreFeature=
"ecore:EReference languages.ecore#//imperative/Variable/type"
/>
</genClasses>
<genClasses
ecoreClass=
"languages.ecore#//imperative/TypeDefinition"
/>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
org.fortiss.af3.generator.common/trunk/plugin.xml
View file @
a6afb89b
...
...
@@ -10,15 +10,11 @@
<extension
point=
"org.eclipse.emf.ecore.generated_package"
>
<package
uri=
"http://www.fortiss.org/af3/generator/common/languages/source"
class=
"org.fortiss.af3.generator.common.model.
old
source.AF3GeneratorCommonLanguagesSourcePackage"
class=
"org.fortiss.af3.generator.common.model.source.AF3GeneratorCommonLanguagesSourcePackage"
genModel=
"model/languages.genmodel"
/>
<package
uri=
"http://www.fortiss.org/af3/generator/common/languages/c"
class=
"org.fortiss.af3.generator.common.model.oldsource.AF3GeneratorCommonLanguagesCPackage"
genModel=
"model/languages.genmodel"
/>
<package
uri=
"http://www.fortiss.org/af3/generator/common/languages/imperative"
class=
"org.fortiss.af3.generator.common.model.oldsource.AF3GeneratorCommonLanguagesImperativePackage"
class=
"org.fortiss.af3.generator.common.model.c.AF3GeneratorCommonLanguagesCPackage"
genModel=
"model/languages.genmodel"
/>
</extension>
</plugin>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment