Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
520e7a3789 | ||
|
|
af637a28d8 | ||
|
|
0cefcae153 | ||
|
|
b42a909e65 | ||
|
|
dace0f70ef | ||
|
|
43329f557f | ||
|
|
3e8b836b3e | ||
|
|
ead7c6c8c3 | ||
|
|
fc3bcf0578 | ||
|
|
68cca0e222 | ||
|
|
bfe5219dc2 | ||
|
|
ae6f9d9310 | ||
|
|
f8b786ac40 | ||
|
|
53a2bcdd8b | ||
|
|
f11d325641 | ||
|
|
aa6cbe2d72 | ||
|
|
50e2cdb527 | ||
|
|
1f184eae8c | ||
|
|
90f3c5ce26 | ||
|
|
aa85c396bf | ||
|
|
f19cfecebe |
@@ -1,6 +1,8 @@
|
||||
name: STEPCODE
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
@@ -183,9 +185,9 @@ jobs:
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth 1 git://github.com/BRL-CAD/brlcad.git -b main
|
||||
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
|
||||
cd brlcad/src/other/ext && rm -rf stepcode
|
||||
git clone --depth 1 git://github.com/stepcode/stepcode.git -b develop
|
||||
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
|
||||
# Ordinarily BRL-CAD keeps track of what files are supposed to be
|
||||
# present in the repository. In this case we're not interested in
|
||||
# updating the list to the working stepcode filelist, so use an empty
|
||||
@@ -240,10 +242,10 @@ jobs:
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth 1 git://github.com/BRL-CAD/brlcad.git -b main
|
||||
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
|
||||
cd brlcad/src/other/ext
|
||||
cmake -E rm -r stepcode
|
||||
git clone --depth 1 git://github.com/stepcode/stepcode.git -b develop
|
||||
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
|
||||
# Ordinarily BRL-CAD keeps track of what files are supposed to be
|
||||
# present in the repository. In this case we're not interested in
|
||||
# updating the list to the working stepcode filelist, so use an empty
|
||||
|
||||
@@ -19,6 +19,7 @@ Paviot, Thomas (tpaviot)
|
||||
Pictor, Mark (mpictor)
|
||||
Reed, Nick (nickreed)
|
||||
Shah, Kesha (kesha, keshashah)
|
||||
Sparks, Devon (devonsparks)
|
||||
Thomas, Dawn (homovulgaris, madant)
|
||||
Wouters, Dave (davyw)
|
||||
Yapp, Clifford (starseeker)
|
||||
|
||||
+4
-1
@@ -11,9 +11,12 @@ We love contributions!
|
||||
* Encouraged but not enforced: each commit should stand alone, in the sense that the code should compile and run at that point.
|
||||
* One major topic per pull request. Commits that fix small things (typos, formatting) are perfectly acceptable in a PR fixing a bug or adding a feature.
|
||||
* Tests are good. Tests are required unless you're fixing something simple or that was obviously broken.
|
||||
* Do not change EXPRESS schema definition without reference to an upstream change.
|
||||
* Make your changes and push them to your GitHub repo
|
||||
* Once your branch is pushed, submit a pull request.
|
||||
* We'll look at the PR and either merge or add feedback. If there isn't any activity within several days, send a message to the mailing list - `scl-dev` AT `groups.google.com`.
|
||||
- enable github option on each PR 'Allow edits from maintainers', refer to github help if necessary
|
||||
* We'll look at the PR and either merge (possibly after rebase) or add feedback.
|
||||
- If there isn't any activity within several days send a message to the mailing list - `scl-dev` AT `groups.google.com`.
|
||||
|
||||
## Coding Standards
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
***********************************************************************
|
||||
STEPcode v0.8 -- github.com/stepcode/stepcode
|
||||
|
||||
* test PR integration
|
||||
|
||||
* What is STEPcode? SC reads ISO10303-11 EXPRESS schemas and generates
|
||||
C++ source code that can read and write Part 21 files conforming
|
||||
to that schema. In addition to C++, SC includes experimental
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SCL_CF_H
|
||||
#define SCL_CF_H
|
||||
|
||||
/**** Define statements for CMake ****/
|
||||
#cmakedefine SC_VERSION "@SC_VERSION@"
|
||||
#cmakedefine HAVE_NDIR_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
#cmakedefine HAVE_SYSENT_H 1
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
#cmakedefine HAVE_DIRENT_H 1
|
||||
#cmakedefine HAVE_STDBOOL_H 1
|
||||
#cmakedefine HAVE_PROCESS_H 1
|
||||
#cmakedefine HAVE_IO_H 1
|
||||
|
||||
#cmakedefine SC_TRACE_FPRINTF 1
|
||||
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
|
||||
|
||||
#cmakedefine HAVE_ABS 1
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
#cmakedefine HAVE_MEMMOVE 1
|
||||
#cmakedefine HAVE_GETOPT 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
|
||||
#cmakedefine HAVE_SSIZE_T 1
|
||||
|
||||
#cmakedefine HAVE_STD_THREAD 1
|
||||
#cmakedefine HAVE_STD_CHRONO 1
|
||||
#cmakedefine HAVE_NULLPTR 1
|
||||
|
||||
#endif /* SCL_CF_H */
|
||||
@@ -61,10 +61,10 @@ class SC_UTILS_EXPORT DirObj {
|
||||
const char * File( int index );
|
||||
// check for file in the currently loaded directory
|
||||
bool FileExists( const char * file ) {
|
||||
return Index( file ) ? 1 : 0;
|
||||
return Index( file ) != -1;
|
||||
}
|
||||
bool FileExists( const std::string & file ) {
|
||||
return Index( file.c_str() ) ? true : false;
|
||||
return Index( file.c_str() ) != -1;
|
||||
}
|
||||
int Count();
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'gcc_incomplete_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype maths_number
|
||||
class maths_number(NUMBER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE atom_based_value
|
||||
atom_based_value = SELECT(
|
||||
'maths_number',
|
||||
'atom_based_tuple',
|
||||
scope = schema_scope)
|
||||
atom_based_tuple = LIST(0,None,'atom_based_value', scope = schema_scope)
|
||||
@@ -1,13 +0,0 @@
|
||||
__doc__= ''' This script runs exp2python over each EXPRESS schema in the test/unitary_schemas folder'''
|
||||
|
||||
unitary_schemas_path = '../../../../test/unitary_schemas'
|
||||
exp2python_path = '../../../../cmake-build/bin/exp2python'
|
||||
|
||||
import subprocess
|
||||
import glob
|
||||
import os
|
||||
|
||||
unitary_schemas = glob.glob(os.path.join(unitary_schemas_path,'*.exp'))
|
||||
|
||||
for unitary_schema in unitary_schemas:
|
||||
subprocess.call([exp2python_path,unitary_schema])
|
||||
@@ -1,140 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'index_attribute'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
common_datum_list = LIST(1,None,'datum_reference_element', scope = schema_scope)
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE datum_or_common_datum
|
||||
datum_or_common_datum = SELECT(
|
||||
'common_datum_list',
|
||||
'datum',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY shape_aspect #
|
||||
####################
|
||||
class shape_aspect(BaseEntityClass):
|
||||
'''Entity shape_aspect definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param of_shape
|
||||
:type of_shape:product_definition_shape
|
||||
'''
|
||||
def __init__( self , name,of_shape, ):
|
||||
self.name = name
|
||||
self.of_shape = of_shape
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def of_shape():
|
||||
def fget( self ):
|
||||
return self._of_shape
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument of_shape is mandatory and can not be set to None')
|
||||
if not check_type(value,product_definition_shape):
|
||||
self._of_shape = product_definition_shape(value)
|
||||
else:
|
||||
self._of_shape = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'INDEX_ATTRIBUTE.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY general_datum_reference #
|
||||
####################
|
||||
class general_datum_reference(shape_aspect):
|
||||
'''Entity general_datum_reference definition.
|
||||
|
||||
:param base
|
||||
:type base:datum_or_common_datum
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , base, ):
|
||||
shape_aspect.__init__(self , inherited0__name , inherited1__of_shape , )
|
||||
self.base = base
|
||||
|
||||
@apply
|
||||
def base():
|
||||
def fget( self ):
|
||||
return self._base
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument base is mandatory and can not be set to None')
|
||||
if not check_type(value,datum_or_common_datum):
|
||||
self._base = datum_or_common_datum(value)
|
||||
else:
|
||||
self._base = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (( not ('INDEX_ATTRIBUTE.COMMON_DATUM_LIST' == TYPEOF(self.base))) or (self.self.shape_aspect.self.of_shape == self.base[1].self.shape_aspect.self.of_shape))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY product_definition_shape #
|
||||
####################
|
||||
class product_definition_shape(BaseEntityClass):
|
||||
'''Entity product_definition_shape definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# ENTITY datum_reference_element #
|
||||
####################
|
||||
class datum_reference_element(general_datum_reference):
|
||||
'''Entity datum_reference_element definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , inherited2__base , ):
|
||||
general_datum_reference.__init__(self , inherited0__name , inherited1__of_shape , inherited2__base , )
|
||||
|
||||
####################
|
||||
# ENTITY datum #
|
||||
####################
|
||||
class datum(shape_aspect):
|
||||
'''Entity datum definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , ):
|
||||
shape_aspect.__init__(self , inherited0__name , inherited1__of_shape , )
|
||||
@@ -1,353 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'multiple_rep'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype text
|
||||
class text(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype representation_context
|
||||
class representation_context(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype identifier
|
||||
class identifier(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype shape_definition
|
||||
class shape_definition(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype transformation
|
||||
class transformation(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype representation_item
|
||||
class representation_item(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype characterized_product_definition
|
||||
class characterized_product_definition(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE characterized_definition
|
||||
characterized_definition = SELECT(
|
||||
'characterized_object',
|
||||
'characterized_product_definition',
|
||||
'shape_definition',
|
||||
scope = schema_scope)
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype characterized_object
|
||||
class characterized_object(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY representation_relationship #
|
||||
####################
|
||||
class representation_relationship(BaseEntityClass):
|
||||
'''Entity representation_relationship definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param rep_1
|
||||
:type rep_1:representation
|
||||
|
||||
:param rep_2
|
||||
:type rep_2:representation
|
||||
'''
|
||||
def __init__( self , name,rep_1,rep_2, ):
|
||||
self.name = name
|
||||
self.rep_1 = rep_1
|
||||
self.rep_2 = rep_2
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def rep_1():
|
||||
def fget( self ):
|
||||
return self._rep_1
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rep_1 is mandatory and can not be set to None')
|
||||
if not check_type(value,representation):
|
||||
self._rep_1 = representation(value)
|
||||
else:
|
||||
self._rep_1 = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def rep_2():
|
||||
def fget( self ):
|
||||
return self._rep_2
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rep_2 is mandatory and can not be set to None')
|
||||
if not check_type(value,representation):
|
||||
self._rep_2 = representation(value)
|
||||
else:
|
||||
self._rep_2 = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY shape_representation_relationship #
|
||||
####################
|
||||
class shape_representation_relationship(representation_relationship):
|
||||
'''Entity shape_representation_relationship definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , ):
|
||||
representation_relationship.__init__(self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , )
|
||||
def wr1(self):
|
||||
eval_wr1_wr = ('MULTIPLE_REP.SHAPE_REPRESENTATION' == (TYPEOF(self.self.representation_relationship.self.rep_1) + TYPEOF(self.self.representation_relationship.self.rep_2)))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY representation #
|
||||
####################
|
||||
class representation(BaseEntityClass):
|
||||
'''Entity representation definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param items
|
||||
:type items:SET(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param context_of_items
|
||||
:type context_of_items:representation_context
|
||||
'''
|
||||
def __init__( self , name,items,context_of_items, ):
|
||||
self.name = name
|
||||
self.items = items
|
||||
self.context_of_items = context_of_items
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def items():
|
||||
def fget( self ):
|
||||
return self._items
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument items is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'STRING', scope = schema_scope)):
|
||||
self._items = SET(value)
|
||||
else:
|
||||
self._items = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def context_of_items():
|
||||
def fget( self ):
|
||||
return self._context_of_items
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument context_of_items is mandatory and can not be set to None')
|
||||
if not check_type(value,representation_context):
|
||||
self._context_of_items = representation_context(value)
|
||||
else:
|
||||
self._context_of_items = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
def wr2(self):
|
||||
eval_wr2_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1)
|
||||
if not eval_wr2_wr:
|
||||
raise AssertionError('Rule wr2 violated')
|
||||
else:
|
||||
return eval_wr2_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY property_definition #
|
||||
####################
|
||||
class property_definition(BaseEntityClass):
|
||||
'''Entity property_definition definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param definition
|
||||
:type definition:characterized_definition
|
||||
'''
|
||||
def __init__( self , name,definition, ):
|
||||
self.name = name
|
||||
self.definition = definition
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def definition():
|
||||
def fget( self ):
|
||||
return self._definition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument definition is mandatory and can not be set to None')
|
||||
if not check_type(value,characterized_definition):
|
||||
self._definition = characterized_definition(value)
|
||||
else:
|
||||
self._definition = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY context_dependent_shape_representation #
|
||||
####################
|
||||
class context_dependent_shape_representation(BaseEntityClass):
|
||||
'''Entity context_dependent_shape_representation definition.
|
||||
|
||||
:param representation_relation
|
||||
:type representation_relation:shape_representation_relationship
|
||||
'''
|
||||
def __init__( self , representation_relation, ):
|
||||
self.representation_relation = representation_relation
|
||||
|
||||
@apply
|
||||
def representation_relation():
|
||||
def fget( self ):
|
||||
return self._representation_relation
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument representation_relation is mandatory and can not be set to None')
|
||||
if not check_type(value,shape_representation_relationship):
|
||||
self._representation_relation = shape_representation_relationship(value)
|
||||
else:
|
||||
self._representation_relation = value
|
||||
return property(**locals())
|
||||
def wr2(self):
|
||||
eval_wr2_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1)
|
||||
if not eval_wr2_wr:
|
||||
raise AssertionError('Rule wr2 violated')
|
||||
else:
|
||||
return eval_wr2_wr
|
||||
|
||||
def wr3(self):
|
||||
eval_wr3_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'NAME_ATTRIBUTE.NAMED_ITEM')) <= 1)
|
||||
if not eval_wr3_wr:
|
||||
raise AssertionError('Rule wr3 violated')
|
||||
else:
|
||||
return eval_wr3_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY definitional_representation_relationship #
|
||||
####################
|
||||
class definitional_representation_relationship(representation_relationship):
|
||||
'''Entity definitional_representation_relationship definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , ):
|
||||
representation_relationship.__init__(self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , )
|
||||
|
||||
####################
|
||||
# ENTITY component_2d_location #
|
||||
####################
|
||||
class component_2d_location(context_dependent_shape_representation,shape_representation_relationship,definitional_representation_relationship):
|
||||
'''Entity component_2d_location definition.
|
||||
|
||||
:param context_dependent_shape_representation_representation_relation
|
||||
:type context_dependent_shape_representation_representation_relation:component_2d_location
|
||||
'''
|
||||
def __init__( self , inherited0__representation_relation , inherited1__name , inherited2__rep_1 , inherited3__rep_2 , inherited4__name , inherited5__rep_1 , inherited6__rep_2 , ):
|
||||
context_dependent_shape_representation.__init__(self , inherited0__representation_relation , )
|
||||
shape_representation_relationship.__init__(self , inherited1__name , inherited2__rep_1 , inherited3__rep_2 , )
|
||||
definitional_representation_relationship.__init__(self , inherited4__name , inherited5__rep_1 , inherited6__rep_2 , )
|
||||
|
||||
@apply
|
||||
def context_dependent_shape_representation_representation_relation():
|
||||
def fget( self ):
|
||||
attribute_eval = self
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument context_dependent_shape_representation_representation_relation is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (self.self.representation_relationship.self.name == 'component 2d location')
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
|
||||
:param coords
|
||||
:type coords:ARRAY(1,3,'REAL', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , coords, ):
|
||||
self.coords = coords
|
||||
|
||||
@apply
|
||||
def coords():
|
||||
def fget( self ):
|
||||
return self._coords
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument coords is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'REAL', scope = schema_scope)):
|
||||
self._coords = ARRAY(value)
|
||||
else:
|
||||
self._coords = value
|
||||
return property(**locals())
|
||||
@@ -1,43 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array_of_array_of_simple_types'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY transformation #
|
||||
####################
|
||||
class transformation(BaseEntityClass):
|
||||
'''Entity transformation definition.
|
||||
|
||||
:param rotation
|
||||
:type rotation:ARRAY(1,3,ARRAY(1,3,'REAL', scope = schema_scope))
|
||||
'''
|
||||
def __init__( self , rotation, ):
|
||||
self.rotation = rotation
|
||||
|
||||
@apply
|
||||
def rotation():
|
||||
def fget( self ):
|
||||
return self._rotation
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rotation is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,ARRAY(1,3,'REAL', scope = schema_scope))):
|
||||
self._rotation = ARRAY(value)
|
||||
else:
|
||||
self._rotation = value
|
||||
return property(**locals())
|
||||
@@ -1,79 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array_of_simple_types'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
|
||||
:param arr_real
|
||||
:type arr_real:ARRAY(1,3,'REAL', scope = schema_scope)
|
||||
|
||||
:param arr_string
|
||||
:type arr_string:ARRAY(1,3,'STRING', scope = schema_scope)
|
||||
|
||||
:param arr_integer
|
||||
:type arr_integer:ARRAY(1,None,'INTEGER', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , arr_real,arr_string,arr_integer, ):
|
||||
self.arr_real = arr_real
|
||||
self.arr_string = arr_string
|
||||
self.arr_integer = arr_integer
|
||||
|
||||
@apply
|
||||
def arr_real():
|
||||
def fget( self ):
|
||||
return self._arr_real
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_real is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'REAL', scope = schema_scope)):
|
||||
self._arr_real = ARRAY(value)
|
||||
else:
|
||||
self._arr_real = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def arr_string():
|
||||
def fget( self ):
|
||||
return self._arr_string
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_string is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'STRING', scope = schema_scope)):
|
||||
self._arr_string = ARRAY(value)
|
||||
else:
|
||||
self._arr_string = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def arr_integer():
|
||||
def fget( self ):
|
||||
return self._arr_integer
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_integer is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,None,'INTEGER', scope = schema_scope)):
|
||||
self._arr_integer = ARRAY(value)
|
||||
else:
|
||||
self._arr_integer = value
|
||||
return property(**locals())
|
||||
@@ -1,123 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_derived_attribute'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY vector #
|
||||
####################
|
||||
class vector(BaseEntityClass):
|
||||
'''Entity vector definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# ENTITY circle #
|
||||
####################
|
||||
class circle(BaseEntityClass):
|
||||
'''Entity circle definition.
|
||||
|
||||
:param centre
|
||||
:type centre:point
|
||||
|
||||
:param radius
|
||||
:type radius:REAL
|
||||
|
||||
:param axis
|
||||
:type axis:vector
|
||||
|
||||
:param area
|
||||
:type area:REAL
|
||||
|
||||
:param perimeter
|
||||
:type perimeter:REAL
|
||||
'''
|
||||
def __init__( self , centre,radius,axis, ):
|
||||
self.centre = centre
|
||||
self.radius = radius
|
||||
self.axis = axis
|
||||
|
||||
@apply
|
||||
def centre():
|
||||
def fget( self ):
|
||||
return self._centre
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument centre is mandatory and can not be set to None')
|
||||
if not check_type(value,point):
|
||||
self._centre = point(value)
|
||||
else:
|
||||
self._centre = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def radius():
|
||||
def fget( self ):
|
||||
return self._radius
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument radius is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._radius = REAL(value)
|
||||
else:
|
||||
self._radius = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def axis():
|
||||
def fget( self ):
|
||||
return self._axis
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument axis is mandatory and can not be set to None')
|
||||
if not check_type(value,vector):
|
||||
self._axis = vector(value)
|
||||
else:
|
||||
self._axis = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def area():
|
||||
def fget( self ):
|
||||
attribute_eval = ( PI * (self.radius ** 2))
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument area is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def perimeter():
|
||||
def fget( self ):
|
||||
attribute_eval = ((2 * PI ) * self.radius)
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument perimeter is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
@@ -1,322 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_entity_where_rule'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY unit_vector #
|
||||
####################
|
||||
class unit_vector(BaseEntityClass):
|
||||
'''Entity unit_vector definition.
|
||||
|
||||
:param a
|
||||
:type a:REAL
|
||||
|
||||
:param b
|
||||
:type b:REAL
|
||||
|
||||
:param c
|
||||
:type c:REAL
|
||||
'''
|
||||
def __init__( self , a,b,c, ):
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.c = c
|
||||
|
||||
@apply
|
||||
def a():
|
||||
def fget( self ):
|
||||
return self._a
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument a is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._a = REAL(value)
|
||||
else:
|
||||
self._a = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def b():
|
||||
def fget( self ):
|
||||
return self._b
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument b is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._b = REAL(value)
|
||||
else:
|
||||
self._b = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def c():
|
||||
def fget( self ):
|
||||
return self._c
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument c is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._c = REAL(value)
|
||||
else:
|
||||
self._c = value
|
||||
return property(**locals())
|
||||
def length_1(self):
|
||||
eval_length_1_wr = ((((self.a ** 2) + (self.b ** 2)) + (self.c ** 2)) == 1)
|
||||
if not eval_length_1_wr:
|
||||
raise AssertionError('Rule length_1 violated')
|
||||
else:
|
||||
return eval_length_1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY address #
|
||||
####################
|
||||
class address(BaseEntityClass):
|
||||
'''Entity address definition.
|
||||
|
||||
:param internal_location
|
||||
:type internal_location:label
|
||||
|
||||
:param street_number
|
||||
:type street_number:label
|
||||
|
||||
:param street
|
||||
:type street:label
|
||||
|
||||
:param postal_box
|
||||
:type postal_box:label
|
||||
|
||||
:param town
|
||||
:type town:label
|
||||
|
||||
:param region
|
||||
:type region:label
|
||||
|
||||
:param postal_code
|
||||
:type postal_code:label
|
||||
|
||||
:param country
|
||||
:type country:label
|
||||
|
||||
:param facsimile_number
|
||||
:type facsimile_number:label
|
||||
|
||||
:param telephone_number
|
||||
:type telephone_number:label
|
||||
|
||||
:param electronic_mail_address
|
||||
:type electronic_mail_address:label
|
||||
|
||||
:param telex_number
|
||||
:type telex_number:label
|
||||
'''
|
||||
def __init__( self , internal_location,street_number,street,postal_box,town,region,postal_code,country,facsimile_number,telephone_number,electronic_mail_address,telex_number, ):
|
||||
self.internal_location = internal_location
|
||||
self.street_number = street_number
|
||||
self.street = street
|
||||
self.postal_box = postal_box
|
||||
self.town = town
|
||||
self.region = region
|
||||
self.postal_code = postal_code
|
||||
self.country = country
|
||||
self.facsimile_number = facsimile_number
|
||||
self.telephone_number = telephone_number
|
||||
self.electronic_mail_address = electronic_mail_address
|
||||
self.telex_number = telex_number
|
||||
|
||||
@apply
|
||||
def internal_location():
|
||||
def fget( self ):
|
||||
return self._internal_location
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._internal_location = label(value)
|
||||
else:
|
||||
self._internal_location = value
|
||||
else:
|
||||
self._internal_location = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street_number():
|
||||
def fget( self ):
|
||||
return self._street_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street_number = label(value)
|
||||
else:
|
||||
self._street_number = value
|
||||
else:
|
||||
self._street_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street():
|
||||
def fget( self ):
|
||||
return self._street
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street = label(value)
|
||||
else:
|
||||
self._street = value
|
||||
else:
|
||||
self._street = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_box():
|
||||
def fget( self ):
|
||||
return self._postal_box
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_box = label(value)
|
||||
else:
|
||||
self._postal_box = value
|
||||
else:
|
||||
self._postal_box = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def town():
|
||||
def fget( self ):
|
||||
return self._town
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._town = label(value)
|
||||
else:
|
||||
self._town = value
|
||||
else:
|
||||
self._town = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def region():
|
||||
def fget( self ):
|
||||
return self._region
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._region = label(value)
|
||||
else:
|
||||
self._region = value
|
||||
else:
|
||||
self._region = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_code():
|
||||
def fget( self ):
|
||||
return self._postal_code
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_code = label(value)
|
||||
else:
|
||||
self._postal_code = value
|
||||
else:
|
||||
self._postal_code = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def country():
|
||||
def fget( self ):
|
||||
return self._country
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._country = label(value)
|
||||
else:
|
||||
self._country = value
|
||||
else:
|
||||
self._country = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def facsimile_number():
|
||||
def fget( self ):
|
||||
return self._facsimile_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._facsimile_number = label(value)
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telephone_number():
|
||||
def fget( self ):
|
||||
return self._telephone_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telephone_number = label(value)
|
||||
else:
|
||||
self._telephone_number = value
|
||||
else:
|
||||
self._telephone_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def electronic_mail_address():
|
||||
def fget( self ):
|
||||
return self._electronic_mail_address
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._electronic_mail_address = label(value)
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telex_number():
|
||||
def fget( self ):
|
||||
return self._telex_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telex_number = label(value)
|
||||
else:
|
||||
self._telex_number = value
|
||||
else:
|
||||
self._telex_number = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (((((((((((EXISTS(self.internal_location) or EXISTS(self.street_number)) or EXISTS(self.street)) or EXISTS(self.postal_box)) or EXISTS(self.town)) or EXISTS(self.region)) or EXISTS(self.postal_code)) or EXISTS(self.country)) or EXISTS(self.facsimile_number)) or EXISTS(self.telephone_number)) or EXISTS(self.electronic_mail_address)) or EXISTS(self.telex_number))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_enum_entity_name'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
# ENUMERATION TYPE simple_datum_reference_modifier
|
||||
simple_datum_reference_modifier = ENUMERATION(
|
||||
'line',
|
||||
'translation',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY line #
|
||||
####################
|
||||
class line(BaseEntityClass):
|
||||
'''Entity line definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
@@ -1,29 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_enums_same_name'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
# ENUMERATION TYPE hair_color
|
||||
hair_color = ENUMERATION(
|
||||
'bald',
|
||||
'red',
|
||||
scope = schema_scope)
|
||||
|
||||
# ENUMERATION TYPE favorite_color
|
||||
favorite_color = ENUMERATION(
|
||||
'clear',
|
||||
'red',
|
||||
scope = schema_scope)
|
||||
@@ -1,80 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_function'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY dummy #
|
||||
####################
|
||||
class dummy(BaseEntityClass):
|
||||
'''Entity dummy definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# FUNCTION add #
|
||||
####################
|
||||
def add(r1,r2,):
|
||||
'''
|
||||
:param r1
|
||||
:type r1:REAL
|
||||
:param r2
|
||||
:type r2:REAL
|
||||
'''
|
||||
result = r1 + r2
|
||||
return result
|
||||
|
||||
####################
|
||||
# FUNCTION pow_n #
|
||||
####################
|
||||
def pow_n(r1,n,):
|
||||
'''
|
||||
:param r1
|
||||
:type r1:REAL
|
||||
:param n
|
||||
:type n:INTEGER
|
||||
'''
|
||||
if (n == 0):
|
||||
return 1
|
||||
else:
|
||||
result = r1
|
||||
for i in range(1,n,1):
|
||||
result = result * r1
|
||||
return result
|
||||
|
||||
####################
|
||||
# FUNCTION case_1 #
|
||||
####################
|
||||
def case_1(a,):
|
||||
'''
|
||||
:param a
|
||||
:type a:INTEGER
|
||||
'''
|
||||
case_selector = a
|
||||
if case_selector == 1:
|
||||
x = SIN(a)
|
||||
elif case_selector == 2:
|
||||
x = EXP(a)
|
||||
elif case_selector == 3:
|
||||
x = SQRT(a)
|
||||
elif case_selector == 4:
|
||||
x = LOG(a)
|
||||
elif case_selector == 5:
|
||||
x = LOG(a)
|
||||
else:
|
||||
x = 0
|
||||
return x
|
||||
@@ -1,582 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_multiple_inheritance'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# SELECT TYPE classification_item
|
||||
classification_item = SELECT(
|
||||
'person_and_organization_address',
|
||||
'address',
|
||||
scope = schema_scope)
|
||||
# Defined datatype text
|
||||
class text(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype identifier
|
||||
class identifier(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY address #
|
||||
####################
|
||||
class address(BaseEntityClass):
|
||||
'''Entity address definition.
|
||||
|
||||
:param internal_location
|
||||
:type internal_location:label
|
||||
|
||||
:param street_number
|
||||
:type street_number:label
|
||||
|
||||
:param street
|
||||
:type street:label
|
||||
|
||||
:param postal_box
|
||||
:type postal_box:label
|
||||
|
||||
:param town
|
||||
:type town:label
|
||||
|
||||
:param region
|
||||
:type region:label
|
||||
|
||||
:param postal_code
|
||||
:type postal_code:label
|
||||
|
||||
:param country
|
||||
:type country:label
|
||||
|
||||
:param facsimile_number
|
||||
:type facsimile_number:label
|
||||
|
||||
:param telephone_number
|
||||
:type telephone_number:label
|
||||
|
||||
:param electronic_mail_address
|
||||
:type electronic_mail_address:label
|
||||
|
||||
:param telex_number
|
||||
:type telex_number:label
|
||||
'''
|
||||
def __init__( self , internal_location,street_number,street,postal_box,town,region,postal_code,country,facsimile_number,telephone_number,electronic_mail_address,telex_number, ):
|
||||
self.internal_location = internal_location
|
||||
self.street_number = street_number
|
||||
self.street = street
|
||||
self.postal_box = postal_box
|
||||
self.town = town
|
||||
self.region = region
|
||||
self.postal_code = postal_code
|
||||
self.country = country
|
||||
self.facsimile_number = facsimile_number
|
||||
self.telephone_number = telephone_number
|
||||
self.electronic_mail_address = electronic_mail_address
|
||||
self.telex_number = telex_number
|
||||
|
||||
@apply
|
||||
def internal_location():
|
||||
def fget( self ):
|
||||
return self._internal_location
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._internal_location = label(value)
|
||||
else:
|
||||
self._internal_location = value
|
||||
else:
|
||||
self._internal_location = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street_number():
|
||||
def fget( self ):
|
||||
return self._street_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street_number = label(value)
|
||||
else:
|
||||
self._street_number = value
|
||||
else:
|
||||
self._street_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street():
|
||||
def fget( self ):
|
||||
return self._street
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street = label(value)
|
||||
else:
|
||||
self._street = value
|
||||
else:
|
||||
self._street = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_box():
|
||||
def fget( self ):
|
||||
return self._postal_box
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_box = label(value)
|
||||
else:
|
||||
self._postal_box = value
|
||||
else:
|
||||
self._postal_box = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def town():
|
||||
def fget( self ):
|
||||
return self._town
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._town = label(value)
|
||||
else:
|
||||
self._town = value
|
||||
else:
|
||||
self._town = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def region():
|
||||
def fget( self ):
|
||||
return self._region
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._region = label(value)
|
||||
else:
|
||||
self._region = value
|
||||
else:
|
||||
self._region = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_code():
|
||||
def fget( self ):
|
||||
return self._postal_code
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_code = label(value)
|
||||
else:
|
||||
self._postal_code = value
|
||||
else:
|
||||
self._postal_code = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def country():
|
||||
def fget( self ):
|
||||
return self._country
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._country = label(value)
|
||||
else:
|
||||
self._country = value
|
||||
else:
|
||||
self._country = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def facsimile_number():
|
||||
def fget( self ):
|
||||
return self._facsimile_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._facsimile_number = label(value)
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telephone_number():
|
||||
def fget( self ):
|
||||
return self._telephone_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telephone_number = label(value)
|
||||
else:
|
||||
self._telephone_number = value
|
||||
else:
|
||||
self._telephone_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def electronic_mail_address():
|
||||
def fget( self ):
|
||||
return self._electronic_mail_address
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._electronic_mail_address = label(value)
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telex_number():
|
||||
def fget( self ):
|
||||
return self._telex_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telex_number = label(value)
|
||||
else:
|
||||
self._telex_number = value
|
||||
else:
|
||||
self._telex_number = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY personal_address #
|
||||
####################
|
||||
class personal_address(address):
|
||||
'''Entity personal_address definition.
|
||||
|
||||
:param people
|
||||
:type people:SET(1,None,'person', scope = schema_scope)
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , people,description, ):
|
||||
address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , )
|
||||
self.people = people
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def people():
|
||||
def fget( self ):
|
||||
return self._people
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument people is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'person', scope = schema_scope)):
|
||||
self._people = SET(value)
|
||||
else:
|
||||
self._people = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY organizational_address #
|
||||
####################
|
||||
class organizational_address(address):
|
||||
'''Entity organizational_address definition.
|
||||
|
||||
:param organizations
|
||||
:type organizations:SET(1,None,'organization', scope = schema_scope)
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , organizations,description, ):
|
||||
address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , )
|
||||
self.organizations = organizations
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def organizations():
|
||||
def fget( self ):
|
||||
return self._organizations
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument organizations is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'organization', scope = schema_scope)):
|
||||
self._organizations = SET(value)
|
||||
else:
|
||||
self._organizations = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY person #
|
||||
####################
|
||||
class person(BaseEntityClass):
|
||||
'''Entity person definition.
|
||||
|
||||
:param id
|
||||
:type id:identifier
|
||||
|
||||
:param last_name
|
||||
:type last_name:label
|
||||
|
||||
:param first_name
|
||||
:type first_name:label
|
||||
|
||||
:param middle_names
|
||||
:type middle_names:LIST(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param prefix_titles
|
||||
:type prefix_titles:LIST(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param suffix_titles
|
||||
:type suffix_titles:LIST(1,None,'STRING', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , id,last_name,first_name,middle_names,prefix_titles,suffix_titles, ):
|
||||
self.id = id
|
||||
self.last_name = last_name
|
||||
self.first_name = first_name
|
||||
self.middle_names = middle_names
|
||||
self.prefix_titles = prefix_titles
|
||||
self.suffix_titles = suffix_titles
|
||||
|
||||
@apply
|
||||
def id():
|
||||
def fget( self ):
|
||||
return self._id
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument id is mandatory and can not be set to None')
|
||||
if not check_type(value,identifier):
|
||||
self._id = identifier(value)
|
||||
else:
|
||||
self._id = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def last_name():
|
||||
def fget( self ):
|
||||
return self._last_name
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._last_name = label(value)
|
||||
else:
|
||||
self._last_name = value
|
||||
else:
|
||||
self._last_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def first_name():
|
||||
def fget( self ):
|
||||
return self._first_name
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._first_name = label(value)
|
||||
else:
|
||||
self._first_name = value
|
||||
else:
|
||||
self._first_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def middle_names():
|
||||
def fget( self ):
|
||||
return self._middle_names
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._middle_names = LIST(value)
|
||||
else:
|
||||
self._middle_names = value
|
||||
else:
|
||||
self._middle_names = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def prefix_titles():
|
||||
def fget( self ):
|
||||
return self._prefix_titles
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._prefix_titles = LIST(value)
|
||||
else:
|
||||
self._prefix_titles = value
|
||||
else:
|
||||
self._prefix_titles = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def suffix_titles():
|
||||
def fget( self ):
|
||||
return self._suffix_titles
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._suffix_titles = LIST(value)
|
||||
else:
|
||||
self._suffix_titles = value
|
||||
else:
|
||||
self._suffix_titles = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (EXISTS(self.last_name) or EXISTS(self.first_name))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY organization #
|
||||
####################
|
||||
class organization(BaseEntityClass):
|
||||
'''Entity organization definition.
|
||||
|
||||
:param id
|
||||
:type id:identifier
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , id,name,description, ):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def id():
|
||||
def fget( self ):
|
||||
return self._id
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,identifier):
|
||||
self._id = identifier(value)
|
||||
else:
|
||||
self._id = value
|
||||
else:
|
||||
self._id = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY person_and_organization_address #
|
||||
####################
|
||||
class person_and_organization_address(organizational_address,personal_address):
|
||||
'''Entity person_and_organization_address definition.
|
||||
|
||||
:param organizational_address_organizations
|
||||
:type organizational_address_organizations:SET(1,1,'organization', scope = schema_scope)
|
||||
|
||||
:param personal_address_people
|
||||
:type personal_address_people:SET(1,1,'person', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , inherited12__organizations , inherited13__description , inherited14__internal_location , inherited15__street_number , inherited16__street , inherited17__postal_box , inherited18__town , inherited19__region , inherited20__postal_code , inherited21__country , inherited22__facsimile_number , inherited23__telephone_number , inherited24__electronic_mail_address , inherited25__telex_number , inherited26__people , inherited27__description , organizational_address_organizations,personal_address_people, ):
|
||||
organizational_address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , inherited12__organizations , inherited13__description , )
|
||||
personal_address.__init__(self , inherited14__internal_location , inherited15__street_number , inherited16__street , inherited17__postal_box , inherited18__town , inherited19__region , inherited20__postal_code , inherited21__country , inherited22__facsimile_number , inherited23__telephone_number , inherited24__electronic_mail_address , inherited25__telex_number , inherited26__people , inherited27__description , )
|
||||
self.organizational_address_organizations = organizational_address_organizations
|
||||
self.personal_address_people = personal_address_people
|
||||
|
||||
@apply
|
||||
def organizational_address_organizations():
|
||||
def fget( self ):
|
||||
return self._organizational_address_organizations
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument organizational_address_organizations is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,1,'organization', scope = schema_scope)):
|
||||
self._organizational_address_organizations = SET(value)
|
||||
else:
|
||||
self._organizational_address_organizations = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def personal_address_people():
|
||||
def fget( self ):
|
||||
return self._personal_address_people
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument personal_address_people is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,1,'person', scope = schema_scope)):
|
||||
self._personal_address_people = SET(value)
|
||||
else:
|
||||
self._personal_address_people = value
|
||||
return property(**locals())
|
||||
@@ -1,94 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_named_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype measure
|
||||
class measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype type2
|
||||
class type2(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype type3
|
||||
class type3(type2):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY line #
|
||||
####################
|
||||
class line(BaseEntityClass):
|
||||
'''Entity line definition.
|
||||
|
||||
:param line_length
|
||||
:type line_length:measure
|
||||
|
||||
:param other_param
|
||||
:type other_param:type3
|
||||
|
||||
:param and_another
|
||||
:type and_another:REAL
|
||||
'''
|
||||
def __init__( self , line_length,other_param,and_another, ):
|
||||
self.line_length = line_length
|
||||
self.other_param = other_param
|
||||
self.and_another = and_another
|
||||
|
||||
@apply
|
||||
def line_length():
|
||||
def fget( self ):
|
||||
return self._line_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument line_length is mandatory and can not be set to None')
|
||||
if not check_type(value,measure):
|
||||
self._line_length = measure(value)
|
||||
else:
|
||||
self._line_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def other_param():
|
||||
def fget( self ):
|
||||
return self._other_param
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument other_param is mandatory and can not be set to None')
|
||||
if not check_type(value,type3):
|
||||
self._other_param = type3(value)
|
||||
else:
|
||||
self._other_param = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def and_another():
|
||||
def fget( self ):
|
||||
return self._and_another
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument and_another is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._and_another = REAL(value)
|
||||
else:
|
||||
self._and_another = value
|
||||
return property(**locals())
|
||||
@@ -1,252 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_select_data_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# SELECT TYPE permanent_attachment
|
||||
permanent_attachment = SELECT(
|
||||
'glue',
|
||||
'weld',
|
||||
scope = schema_scope)
|
||||
# SELECT TYPE temporary_attachment
|
||||
temporary_attachment = SELECT(
|
||||
'nail',
|
||||
'screw',
|
||||
scope = schema_scope)
|
||||
# SELECT TYPE attachment_method
|
||||
attachment_method = SELECT(
|
||||
'permanent_attachment',
|
||||
'temporary_attachment',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY weld #
|
||||
####################
|
||||
class weld(BaseEntityClass):
|
||||
'''Entity weld definition.
|
||||
|
||||
:param composition
|
||||
:type composition:STRING
|
||||
'''
|
||||
def __init__( self , composition, ):
|
||||
self.composition = composition
|
||||
|
||||
@apply
|
||||
def composition():
|
||||
def fget( self ):
|
||||
return self._composition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument composition is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._composition = STRING(value)
|
||||
else:
|
||||
self._composition = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY glue #
|
||||
####################
|
||||
class glue(BaseEntityClass):
|
||||
'''Entity glue definition.
|
||||
|
||||
:param composition
|
||||
:type composition:STRING
|
||||
|
||||
:param solvent
|
||||
:type solvent:STRING
|
||||
'''
|
||||
def __init__( self , composition,solvent, ):
|
||||
self.composition = composition
|
||||
self.solvent = solvent
|
||||
|
||||
@apply
|
||||
def composition():
|
||||
def fget( self ):
|
||||
return self._composition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument composition is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._composition = STRING(value)
|
||||
else:
|
||||
self._composition = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def solvent():
|
||||
def fget( self ):
|
||||
return self._solvent
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument solvent is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._solvent = STRING(value)
|
||||
else:
|
||||
self._solvent = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY wall_mounting #
|
||||
####################
|
||||
class wall_mounting(BaseEntityClass):
|
||||
'''Entity wall_mounting definition.
|
||||
|
||||
:param mounting
|
||||
:type mounting:STRING
|
||||
|
||||
:param on
|
||||
:type on:STRING
|
||||
|
||||
:param using
|
||||
:type using:attachment_method
|
||||
'''
|
||||
def __init__( self , mounting,on,using, ):
|
||||
self.mounting = mounting
|
||||
self.on = on
|
||||
self.using = using
|
||||
|
||||
@apply
|
||||
def mounting():
|
||||
def fget( self ):
|
||||
return self._mounting
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument mounting is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._mounting = STRING(value)
|
||||
else:
|
||||
self._mounting = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def on():
|
||||
def fget( self ):
|
||||
return self._on
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument on is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._on = STRING(value)
|
||||
else:
|
||||
self._on = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def using():
|
||||
def fget( self ):
|
||||
return self._using
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument using is mandatory and can not be set to None')
|
||||
if not check_type(value,attachment_method):
|
||||
self._using = attachment_method(value)
|
||||
else:
|
||||
self._using = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY screw #
|
||||
####################
|
||||
class screw(BaseEntityClass):
|
||||
'''Entity screw definition.
|
||||
|
||||
:param body_length
|
||||
:type body_length:REAL
|
||||
|
||||
:param pitch
|
||||
:type pitch:REAL
|
||||
'''
|
||||
def __init__( self , body_length,pitch, ):
|
||||
self.body_length = body_length
|
||||
self.pitch = pitch
|
||||
|
||||
@apply
|
||||
def body_length():
|
||||
def fget( self ):
|
||||
return self._body_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument body_length is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._body_length = REAL(value)
|
||||
else:
|
||||
self._body_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def pitch():
|
||||
def fget( self ):
|
||||
return self._pitch
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument pitch is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._pitch = REAL(value)
|
||||
else:
|
||||
self._pitch = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY nail #
|
||||
####################
|
||||
class nail(BaseEntityClass):
|
||||
'''Entity nail definition.
|
||||
|
||||
:param body_length
|
||||
:type body_length:REAL
|
||||
|
||||
:param head_area
|
||||
:type head_area:REAL
|
||||
'''
|
||||
def __init__( self , body_length,head_area, ):
|
||||
self.body_length = body_length
|
||||
self.head_area = head_area
|
||||
|
||||
@apply
|
||||
def body_length():
|
||||
def fget( self ):
|
||||
return self._body_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument body_length is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._body_length = REAL(value)
|
||||
else:
|
||||
self._body_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def head_area():
|
||||
def fget( self ):
|
||||
return self._head_area
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument head_area is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._head_area = REAL(value)
|
||||
else:
|
||||
self._head_area = value
|
||||
return property(**locals())
|
||||
@@ -1,121 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_single_inheritance'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype length_measure
|
||||
class length_measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype point
|
||||
class point(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY shape #
|
||||
####################
|
||||
class shape(BaseEntityClass):
|
||||
'''Entity shape definition.
|
||||
|
||||
:param item_name
|
||||
:type item_name:label
|
||||
|
||||
:param number_of_sides
|
||||
:type number_of_sides:INTEGER
|
||||
'''
|
||||
def __init__( self , item_name,number_of_sides, ):
|
||||
self.item_name = item_name
|
||||
self.number_of_sides = number_of_sides
|
||||
|
||||
@apply
|
||||
def item_name():
|
||||
def fget( self ):
|
||||
return self._item_name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument item_name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._item_name = label(value)
|
||||
else:
|
||||
self._item_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def number_of_sides():
|
||||
def fget( self ):
|
||||
return self._number_of_sides
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument number_of_sides is mandatory and can not be set to None')
|
||||
if not check_type(value,INTEGER):
|
||||
self._number_of_sides = INTEGER(value)
|
||||
else:
|
||||
self._number_of_sides = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY rectangle #
|
||||
####################
|
||||
class rectangle(shape):
|
||||
'''Entity rectangle definition.
|
||||
|
||||
:param height
|
||||
:type height:length_measure
|
||||
|
||||
:param width
|
||||
:type width:length_measure
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , height,width, ):
|
||||
shape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
self.height = height
|
||||
self.width = width
|
||||
|
||||
@apply
|
||||
def height():
|
||||
def fget( self ):
|
||||
return self._height
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument height is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._height = length_measure(value)
|
||||
else:
|
||||
self._height = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def width():
|
||||
def fget( self ):
|
||||
return self._width
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument width is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._width = length_measure(value)
|
||||
else:
|
||||
self._width = value
|
||||
return property(**locals())
|
||||
@@ -1,130 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_single_inheritance_multi_level'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype length_measure
|
||||
class length_measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype point
|
||||
class point(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY shape #
|
||||
####################
|
||||
class shape(BaseEntityClass):
|
||||
'''Entity shape definition.
|
||||
|
||||
:param item_name
|
||||
:type item_name:label
|
||||
|
||||
:param number_of_sides
|
||||
:type number_of_sides:INTEGER
|
||||
'''
|
||||
def __init__( self , item_name,number_of_sides, ):
|
||||
self.item_name = item_name
|
||||
self.number_of_sides = number_of_sides
|
||||
|
||||
@apply
|
||||
def item_name():
|
||||
def fget( self ):
|
||||
return self._item_name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument item_name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._item_name = label(value)
|
||||
else:
|
||||
self._item_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def number_of_sides():
|
||||
def fget( self ):
|
||||
return self._number_of_sides
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument number_of_sides is mandatory and can not be set to None')
|
||||
if not check_type(value,INTEGER):
|
||||
self._number_of_sides = INTEGER(value)
|
||||
else:
|
||||
self._number_of_sides = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY subshape #
|
||||
####################
|
||||
class subshape(shape):
|
||||
'''Entity subshape definition.
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , ):
|
||||
shape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
|
||||
####################
|
||||
# ENTITY rectangle #
|
||||
####################
|
||||
class rectangle(subshape):
|
||||
'''Entity rectangle definition.
|
||||
|
||||
:param height
|
||||
:type height:length_measure
|
||||
|
||||
:param width
|
||||
:type width:length_measure
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , height,width, ):
|
||||
subshape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
self.height = height
|
||||
self.width = width
|
||||
|
||||
@apply
|
||||
def height():
|
||||
def fget( self ):
|
||||
return self._height
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument height is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._height = length_measure(value)
|
||||
else:
|
||||
self._height = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def width():
|
||||
def fget( self ):
|
||||
return self._width
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument width is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._width = length_measure(value)
|
||||
else:
|
||||
self._width = value
|
||||
return property(**locals())
|
||||
@@ -1,51 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_where_rule'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype month
|
||||
class month(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
self.unnamed_wr_0()
|
||||
self.unnamed_wr_1()
|
||||
|
||||
def unnamed_wr_0(self):
|
||||
eval_unnamed_wr_0 = (self <= 12)
|
||||
if not eval_unnamed_wr_0:
|
||||
raise AssertionError('Rule unnamed_wr_0 violated')
|
||||
else:
|
||||
return eval_unnamed_wr_0
|
||||
|
||||
def unnamed_wr_1(self):
|
||||
eval_unnamed_wr_1 = (self >= 1)
|
||||
if not eval_unnamed_wr_1:
|
||||
raise AssertionError('Rule unnamed_wr_1 violated')
|
||||
else:
|
||||
return eval_unnamed_wr_1
|
||||
|
||||
# Defined datatype positive
|
||||
class positive(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
self.notnegative()
|
||||
|
||||
def notnegative(self):
|
||||
eval_notnegative_wr = (self > 0)
|
||||
if not eval_notnegative_wr:
|
||||
raise AssertionError('Rule notnegative violated')
|
||||
else:
|
||||
return eval_notnegative_wr
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
|
||||
# Copyright (c) 2014, Christopher HORLER (cshorler@googlemail.com)
|
||||
# Copyright (c) 2021, Devon Sparks (devonsparks.com)
|
||||
|
||||
# All rights reserved.
|
||||
|
||||
# This file is part StepClassLibrary (SCL).
|
||||
# This file is part of the StepClassLibrary (SCL).
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@@ -29,15 +30,4 @@
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
setup(name='SCL',
|
||||
version='0.5',
|
||||
description='Python STEP Class Library',
|
||||
author='Thomas Paviot',
|
||||
author_email='tpaviot@gmail.com',
|
||||
url='https://github.com/mpictor/StepClassLibrary',
|
||||
packages=['SCL'],
|
||||
)
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,22 @@
|
||||
# SCL - A Python3 STEP Class Library
|
||||
|
||||
SCL is a Python3-based library for parsing and manipulating ISO 10303 Part 21 ("STEP") files.
|
||||
|
||||
# Use
|
||||
|
||||
To parse a ISO 10303 Part 21 file, use the `Parser` class of `SCL.Part21`. On a successful parse, the result will be a Part 21 parse tree and associated STEP instances.
|
||||
|
||||
See [test_parser](tests/test_parser.py) for use of the `SCL.Part21` parser with a sample STEP file.
|
||||
|
||||
|
||||
# Building
|
||||
|
||||
The SCL Python package can be built directly using [PyPA's build module](https://github.com/pypa/build). Run `python3 -m build` from this directory.
|
||||
|
||||
# Testing
|
||||
|
||||
SCL comes with a small test suite (additions welcome!) From this directory, `python3 -m unittest discover`.
|
||||
|
||||
# License
|
||||
|
||||
See [LICENSE](LICENSE)
|
||||
@@ -33,7 +33,7 @@ from SimpleDataTypes import *
|
||||
from TypeChecker import check_type
|
||||
import BaseType
|
||||
|
||||
class BaseAggregate(object):
|
||||
class BaseAggregate:
|
||||
""" A class that define common properties to ARRAY, LIST, SET and BAG.
|
||||
"""
|
||||
def __init__( self , bound1 , bound2 , base_type ):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
|
||||
# All rights reserved.
|
||||
|
||||
@@ -30,7 +29,7 @@ from __future__ import print_function
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
class Type(object):
|
||||
class Type:
|
||||
'''
|
||||
A type can be defined from its name and scope
|
||||
Looking into the scope dict returns the python type class.
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
from enum import Enum
|
||||
import BaseType
|
||||
|
||||
@@ -59,7 +58,7 @@ class ENUMERATION(Enum):
|
||||
"""
|
||||
pass
|
||||
|
||||
class SELECT(object):
|
||||
class SELECT:
|
||||
""" A select data type has as its domain the union of the domains of the named data types in
|
||||
its select list. The select data type is a generalization of each of the named data types in its
|
||||
select list.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
# Copyright (c) 2011-2012, Thomas Paviot (tpaviot@gmail.com)
|
||||
# All rights reserved.
|
||||
|
||||
@@ -30,7 +29,7 @@ from __future__ import print_function
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
class Model(object):
|
||||
class Model:
|
||||
""" The container for entity instances
|
||||
"""
|
||||
def __init_(self):
|
||||
|
||||
@@ -41,19 +41,6 @@ import ply.yacc as yacc
|
||||
from ply.lex import LexError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ensure Python 2.6 compatibility
|
||||
if not hasattr(logging, 'NullHandler'):
|
||||
class NullHandler(logging.Handler):
|
||||
def handle(self, record):
|
||||
pass
|
||||
def emit(self, record):
|
||||
pass
|
||||
def createLock(self):
|
||||
self.lock = None
|
||||
|
||||
setattr(logging, 'NullHandler', NullHandler)
|
||||
|
||||
logger.addHandler(logging.NullHandler())
|
||||
|
||||
####################################################################################################
|
||||
@@ -66,7 +53,7 @@ base_tokens = ['INTEGER', 'REAL', 'USER_DEFINED_KEYWORD', 'STANDARD_KEYWORD', 'S
|
||||
####################################################################################################
|
||||
# Lexer
|
||||
####################################################################################################
|
||||
class Lexer(object):
|
||||
class Lexer:
|
||||
tokens = list(base_tokens)
|
||||
states = (('slurp', 'exclusive'),)
|
||||
|
||||
@@ -252,7 +239,7 @@ class TypedParameter:
|
||||
####################################################################################################
|
||||
# Parser
|
||||
####################################################################################################
|
||||
class Parser(object):
|
||||
class Parser:
|
||||
tokens = list(base_tokens)
|
||||
start = 'exchange_file'
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
__doc__ = "This module defines EXPRESS rules"
|
||||
|
||||
class Rule(object):
|
||||
class Rule:
|
||||
'''
|
||||
This class describes a RULE
|
||||
@TODO: to be implemented
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
class BaseEntityClass(object):
|
||||
class BaseEntityClass:
|
||||
""" A class that allows advanced __repr__ features for entity instances
|
||||
"""
|
||||
def __repr__(self):
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
"""
|
||||
Docstrings are courtesy of ISO 10303-11:1994(E)
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
class NUMBER:
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
|
||||
# All rights reserved.
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
|
||||
# Copyright (c) 2021, Devon Sparks (devonsparks.com)
|
||||
|
||||
# All rights reserved.
|
||||
|
||||
# This file is part of the StepClassLibrary (SCL).
|
||||
@@ -30,7 +32,6 @@
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
''' This module provide string utils'''
|
||||
from __future__ import print_function
|
||||
|
||||
def process_nested_parent_str(attr_str,idx=0):
|
||||
'''
|
||||
@@ -62,10 +63,10 @@ def process_nested_parent_str(attr_str,idx=0):
|
||||
return params,k
|
||||
|
||||
if __name__=="__main__":
|
||||
print(process_nested_parent_str2("'A'")[0])
|
||||
print(process_nested_parent_str2("30.0,0.0,5.0")[0])
|
||||
print(process_nested_parent_str2("1,2,(3,4,5),6,7,8")[0])
|
||||
print(process_nested_parent_str2("(#9149,#9166),#9142,.T.")[0])
|
||||
print(process_nested_parent_str("'A'")[0])
|
||||
print(process_nested_parent_str("30.0,0.0,5.0")[0])
|
||||
print(process_nested_parent_str("1,2,(3,4,5),6,7,8")[0])
|
||||
print(process_nested_parent_str("(#9149,#9166),#9142,.T.")[0])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
__all__ = ['SCLBase','SimpleDataTypes','AggregationDataTypes','TypeChecker','ConstructedDataTypes','Expr','Part21']
|
||||
__all__ = ['SCLBase','SimpleDataTypes','AggregationDataTypes','TypeChecker','ConstructedDataTypes','Part21']
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import print_function
|
||||
def process_nested_parent_str(attr_str):
|
||||
'''
|
||||
The first letter should be a parenthesis
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools>=40",
|
||||
"wheel"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
@@ -0,0 +1,22 @@
|
||||
[metadata]
|
||||
name = SCL
|
||||
version = 0.6.1
|
||||
author = Thomas Paviot <tpaviot@gmail.com>, Christopher HORLER (cshorler@googlemail.com), Devon Sparks (devonsparks.com)
|
||||
description = SCL is a Python3-based library for parsing and manipulating ISO 10303 Part 21 ("STEP") files.
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
|
||||
url = https://github.com/stepcode/stepcode
|
||||
project_urls =
|
||||
Bug Tracker = https://github.com/stepcode/stepcode/issues
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
|
||||
[options]
|
||||
package_dir =
|
||||
=.
|
||||
packages = SCL
|
||||
python_requires = >=3.6
|
||||
install_requires =
|
||||
ply
|
||||
|
||||
@@ -403,10 +403,9 @@ class TestSET(unittest.TestCase):
|
||||
#
|
||||
class TestENUMERATION(unittest.TestCase):
|
||||
def test_simple_enum(self):
|
||||
scp = sys.modules[__name__]
|
||||
ahead_or_behind = ENUMERATION('ahead','behind',scope=scp)
|
||||
check_type(ahead,ahead_or_behind)
|
||||
check_type(behind,ahead_or_behind)
|
||||
ahead_or_behind = ENUMERATION('ahead_or_behind', 'ahead behind', module=__name__)
|
||||
check_type(ahead_or_behind.ahead,ahead_or_behind)
|
||||
check_type(ahead_or_behind.behind,ahead_or_behind)
|
||||
try:
|
||||
check_type("some string",ahead_or_behind)
|
||||
except TypeError:
|
||||
@@ -416,9 +415,9 @@ class TestENUMERATION(unittest.TestCase):
|
||||
else:
|
||||
self.fail('ExpectedException not thrown')
|
||||
|
||||
class ob1(object):
|
||||
class ob1:
|
||||
pass
|
||||
class ob2(object):
|
||||
class ob2:
|
||||
pass
|
||||
class TestSELECT(unittest.TestCase):
|
||||
def test_select(self):
|
||||
@@ -0,0 +1,111 @@
|
||||
# Copyright (c) 2021, Devon Sparks (devonsparks.com)
|
||||
# All rights reserved.
|
||||
|
||||
# This file is part StepClassLibrary (SCL).
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# Neither the name of the <ORGANIZATION> nor the names of its contributors may
|
||||
# be used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import unittest
|
||||
from SCL.Part21 import Parser
|
||||
|
||||
ShapesSample ="""
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('simple example file'),'1');
|
||||
FILE_NAME('testfile.step','1997-10-06T16:15:42',('long forgotten'),('nist'),'0','1','2');
|
||||
FILE_SCHEMA(('example_schema'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
#0=SQUARE('Square9',.BROWN.,13,15.,51.);
|
||||
#1=CIRCLE('Circle8',.ORANGE.,19,12.);
|
||||
#2=TRIANGLE('Triangle7',.BLACK.,67,84.,60.,25.);
|
||||
#3=LINE(#6,#7);
|
||||
#4=SHAPE('Shape4',.WHITE.,83);
|
||||
#5=RECTANGLE('Rectangle8',.BROWN.,66,78.,95.);
|
||||
#6=CARTESIAN_POINT(11.,67.,54.);
|
||||
#7=CARTESIAN_POINT(1.,2.,3.);
|
||||
ENDSEC;
|
||||
END-ISO-10303-21;
|
||||
"""
|
||||
|
||||
class TestSample(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.parser = Parser()
|
||||
def tearDown(self):
|
||||
self.parser = None
|
||||
|
||||
|
||||
class TestShapesParse(TestSample):
|
||||
"""
|
||||
Tests whether we're able to parse the shapes sample at all
|
||||
"""
|
||||
def test_parse(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
self.assertIsNotNone(model)
|
||||
|
||||
|
||||
class TestShapesHeader(TestSample):
|
||||
"""
|
||||
Test basic structure and payload of Header section
|
||||
"""
|
||||
def test_header_name(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
self.assertEqual(model.header.file_name.params[0][0], "testfile.step")
|
||||
|
||||
def test_header_schema(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
self.assertEqual(model.header.file_schema.params[0][0][0], "example_schema")
|
||||
|
||||
|
||||
class TestShapesData(TestSample):
|
||||
"""
|
||||
Test basic structure and shape of data section
|
||||
"""
|
||||
def test_data_section_form(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
self.assertEqual(len(model.sections), 1)
|
||||
self.assertEqual(len(model.sections[0].entities), 8)
|
||||
|
||||
|
||||
class TestEntity(TestSample):
|
||||
"""
|
||||
Test structure and contents of several entities within the DATA section
|
||||
"""
|
||||
def test_line(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
line = model.sections[0].entities[3]
|
||||
self.assertEqual(line.type_name, "LINE")
|
||||
self.assertEqual(line.ref, "#3")
|
||||
self.assertEqual(line.params[0], ["#6", "#7"])
|
||||
|
||||
def test_rectangle8(self):
|
||||
model = self.parser.parse(ShapesSample)
|
||||
rect8 = model.sections[0].entities[5]
|
||||
self.assertEqual(rect8.type_name, "RECTANGLE")
|
||||
self.assertEqual(rect8.ref, "#5")
|
||||
self.assertEqual(rect8.params[0], ['Rectangle8', '.BROWN.', 66, 78.0, 95.0])
|
||||
|
||||
+4
-2
@@ -31,14 +31,16 @@
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('../examples/unitary_schemas')
|
||||
import os
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(here, "..", "..", "examples", "unitary_schemas"))
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Expr import *
|
||||
|
||||
class TestSelectDataType(unittest.TestCase):
|
||||
'''
|
||||
Reference in New Issue
Block a user