Skip to content

Commit d8ba713

Browse files
authored
The latest code generators for Python & C
1 parent 0ba5aa3 commit d8ba713

File tree

3 files changed

+2539
-35
lines changed

3 files changed

+2539
-35
lines changed

mmUML2Camm.txt

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ boolean
100100

101101
query
102102
true
103-
(name = "OclType" => result = false) & (name = "OclAttribute" => result = false) & (name = "OclOperation" => result = false) & (name = "OclProcess" => result = false) & (name = "OclProcessGroup" => result = false) & (name = "ocltnode" => result = false) & (name = "OclIterator" => result = false) & (name = "OclFile" => result = false) & (name = "MathLib" => result = false) & (name = "OclDate" => result = false) & (name = "OclRandom" => result = false) & (name = "OclException" => result = false) & (true => result = true)
103+
(name = "OclType" => result = false) & (name = "OclAttribute" => result = false) & (name = "OclOperation" => result = false) & (name = "OclProcess" => result = false) & (name = "OclProcessGroup" => result = false) & (name = "ocltnode" => result = false) & (name = "OclIterator" => result = false) & (name = "OclFile" => result = false) & (name = "MathLib" => result = false) & (name = "OclDate" => result = false) & (name = "OclRandom" => result = false) & (name = "OclException" => result = false) & (name->hasSuffix("Exception") => result = false) & (true => result = true)
104104

105105

106106

@@ -1129,10 +1129,18 @@ Association:
11291129
CVariable CType 0 1047 993 937 900 1 type null
11301130

11311131

1132+
11321133
Association:
11331134
COperation CType 0 816 917 901 899 1 returnType null
11341135

11351136

1137+
1138+
Association:
1139+
COperation CType 0 816 917 901 899 1 elementType null
1140+
1141+
1142+
1143+
11361144
Association:
11371145
CArrayType CType 0 740 820 901 851 1 componentType null 741 847
11381146

@@ -1242,7 +1250,7 @@ Property Expression -1 664 678 335 816 1 initialValue null 665 826 514 822
12421250

12431251

12441252
Association:
1245-
BasicExpression BasicExpression -1 490 953 408 1162 -1 objectRef null 552 953 551 1002 443 1203
1253+
BasicExpression Expression -1 490 953 408 1162 -1 objectRef null 552 953 551 1002 443 1203
12461254

12471255

12481256
Generalisation:
@@ -1606,7 +1614,7 @@ false
16061614
Constraint:
16071615
null
16081616
self.isApplicationClass() & BinaryExpression->exists( be | be.operator = "->collect" & be.left.elementType.name = name )
1609-
( " void** collect" + name + "(struct " + name + "* col[], void* (*fe)(struct " + name + "*));\n" )->display() & ( " int* collect" + name + "_int(struct " + name + "* col[], int (*fe)(struct " + name + "*));\n" )->display() & ( " long* collect" + name + "_long(struct " + name + "* col[], long (*fe)(struct " + name + "*));\n" )->display() & ( " double* collect" + name + "_double(struct " + name + "* col[], double (*fe)(struct " + name + "*));\n" )->display()
1617+
( "void** collect" + name + "(struct " + name + "* col[], void* (*fe)(struct " + name + "*));\n" )->display() & ( "int** collect" + name + "int(struct " + name + "* col[], int (*fe)(struct " + name + "*));\n" )->display() & ( "long** collect" + name + "long(struct " + name + "* col[], long (*fe)(struct " + name + "*));\n" )->display() & ( "double** collect" + name + "double(struct " + name + "* col[], double (*fe)(struct " + name + "*));\n" )->display() & ( "unsigned char** collect" + name + "boolean(struct " + name + "* col[], unsigned char (*fe)(struct " + name + "*));\n" )->display()
16101618
CStruct printcode
16111619
false
16121620

@@ -1887,24 +1895,29 @@ false
18871895

18881896

18891897

1898+
1899+
1900+
18901901
Constraint:
1891-
name = "OclAny"
1902+
name = "void"
18921903
null
1893-
CPointerType->exists( t | t.ctypeId = typeId & CPrimitiveType->exists( p | p.name = "void" & p.ctypeId = typeId + "_void" & t.pointsTo = p ) )
1904+
CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "void" )
18941905
PrimitiveType types2C
18951906
false
18961907

18971908

18981909

1910+
18991911
Constraint:
1900-
name = "void"
1912+
name = "OclAny"
19011913
null
1902-
CPrimitiveType->exists( p | p.ctypeId = typeId & p.name = "void" )
1914+
CPointerType->exists( t | t.ctypeId = typeId & CPrimitiveType->exists( p | p.name = "void" & p.ctypeId = "void" & t.pointsTo = p ) )
19031915
PrimitiveType types2C
19041916
false
19051917

19061918

19071919

1920+
19081921
Constraint:
19091922
name = "OclType"
19101923
null
@@ -1914,6 +1927,8 @@ false
19141927

19151928

19161929

1930+
1931+
19171932
Constraint:
19181933
null
19191934
true
@@ -2005,7 +2020,7 @@ false
20052020

20062021
Constraint:
20072022
name = "Function"
2008-
null
2023+
not(keyType->oclIsUndefined())
20092024
CFunctionPointerType->exists( a | a.ctypeId = typeId & a.rangeType = CType@pre[elementType.typeId] & a.domainType = CType@pre[keyType.typeId] )
20102025
CollectionType types2C
20112026
false
@@ -2040,7 +2055,7 @@ false
20402055
Constraint:
20412056
null
20422057
isStatic = false
2043-
COperation->exists( op | op.name = name + "_" + owner.name & op.opId = name + "_" + owner.name & op.inheritedFrom = "" & op.scope = "entity" & op.isQuery = isQuery & op.isStatic = isStatic & op.isAbstract = isAbstract & op.classname = owner.name & op.definers = CStruct[definers.name] & op.returnType = CType[type.typeId] & CVariable->exists( s | s.name = "self" & s.type = CType[owner.typeId] & s : op.parameters ) & parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
2058+
COperation->exists( op | op.name = name + "_" + owner.name & op.opId = name + "_" + owner.name & op.inheritedFrom = "" & op.scope = "entity" & op.isQuery = isQuery & op.isStatic = isStatic & op.isAbstract = isAbstract & op.classname = owner.name & op.definers = CStruct[definers.name] & op.returnType = CType[type.typeId] & op.elementType = CType[elementType.typeId] & CVariable->exists( s | s.name = "self" & s.type = CType[owner.typeId] & s : op.parameters ) & parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
20442059
Operation program2C
20452060
false
20462061

@@ -2052,7 +2067,7 @@ false
20522067
Constraint:
20532068
iop : inheritedOperations()
20542069
iop.isStatic = false & iop.name /: ownedOperation.name
2055-
COperation->exists( op | op.name = iop.name + "_" + name & op.inheritedFrom = superclass.any.name & op.opId = iop.name + "_" + name & op.scope = "entity" & op.isQuery = iop.isQuery & op.isStatic = false & op.classname = name & op.returnType = CType[iop.type.typeId] & CVariable->exists( s | s.name = "self" & s.type = CType[typeId] & s : op.parameters ) & iop.parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
2070+
COperation->exists( op | op.name = iop.name + "_" + name & op.inheritedFrom = superclass.any.name & op.opId = iop.name + "_" + name & op.scope = "entity" & op.isQuery = iop.isQuery & op.isStatic = false & op.classname = name & op.returnType = CType[iop.type.typeId] & op.elementType = CType[iop.elementType.typeId] & CVariable->exists( s | s.name = "self" & s.type = CType[typeId] & s : op.parameters ) & iop.parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
20562071
Entity program2C
20572072
false
20582073

@@ -2063,7 +2078,7 @@ false
20632078
Constraint:
20642079
null
20652080
isStatic = true
2066-
COperation->exists( op | op.name = name & op.opId = name + "_" + owner.name & op.scope = "entity" & op.isQuery = isQuery & op.isStatic = isStatic & op.classname = owner.name & op.returnType = CType[type.typeId] & parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
2081+
COperation->exists( op | op.name = name & op.opId = name + "_" + owner.name & op.scope = "entity" & op.isQuery = isQuery & op.isStatic = isStatic & op.classname = owner.name & op.returnType = CType[type.typeId] & op.elementType = CType[elementType.typeId] & parameters->forAll( p | CVariable->exists( v | v.name = p.name & v.type = CType[p.type.typeId] & v : op.parameters ) ) )
20672082
Operation program2C
20682083
false
20692084

@@ -2426,17 +2441,6 @@ Statement *
24262441

24272442

24282443

2429-
Operation:
2430-
toPython
2431-
ErrorStatement
2432-
String
2433-
indent int
2434-
query
2435-
true
2436-
obs = thrownObject.objectRef & pars = thrownObject.parameters => result = Statement.tab(indent) + "raise " + thrownObject.mapErrorCall(obs.toPython(),pars.toPython()) + "\n"
2437-
2438-
2439-
24402444

24412445

24422446
Entity:

0 commit comments

Comments
 (0)