Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
# build static libs by default
OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF)

OPTION(PYTHON_GENERATOR "Compile fedex_plus_python" ON)
OPTION(CPP_GENERATOR "Compile fedex_plus" ON)

# Set version
SET(SCL_VERSION_MAJOR "3")
SET(SCL_VERSION_MINOR "2")
Expand Down Expand Up @@ -258,6 +261,7 @@ include_directories(
ADD_SUBDIRECTORY(src/express)
ADD_SUBDIRECTORY(src/exppp)
ADD_SUBDIRECTORY(src/fedex_plus)
ADD_SUBDIRECTORY(src/fedex_python)
ADD_SUBDIRECTORY(src/clstepcore)
ADD_SUBDIRECTORY(src/cleditor)
ADD_SUBDIRECTORY(src/cldai)
Expand Down
2 changes: 2 additions & 0 deletions include/express/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_corrupted_type INITIALLY( ERROR_none );
#define TYPEis_identifier(t) ((t)->u.type->body->type == identifier_)
#define TYPEis_logical(t) ((t)->u.type->body->type == logical_)
#define TYPEis_boolean(t) ((t)->u.type->body->type == boolean_)
#define TYPEis_real(t) ((t)->u.type->body->type == real_)
#define TYPEis_integer(t) ((t)->u.type->body->type == integer_)
#define TYPEis_string(t) ((t)->u.type->body->type == string_)
#define TYPEis_expression(t) ((t)->u.type->body->type == op_)
#define TYPEis_oneof(t) ((t)->u.type->body->type == oneof_)
Expand Down
44 changes: 44 additions & 0 deletions src/fedex_python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if(PYTHON_GENERATOR)

include_directories(
${SCL_SOURCE_DIR}/include
${SCL_SOURCE_DIR}/include/exppp
${SCL_SOURCE_DIR}/include/express
${SCL_SOURCE_DIR}/src/fedex_plus
)

add_definitions( -DHAVE_CONFIG_H )

IF(MSVC)
set(fedex_plus_MSVC_SOURCES
${SCL_SOURCE_DIR}/src/fedex_plus/xgetopt.cc
)
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
add_definitions( -DSCL_EXPPP_DLL_IMPORTS )
ENDIF(MSVC)

set(fedex_python_SOURCES
src/classes_misc_python.c
${SCL_SOURCE_DIR}/src/express/fedex.c
src/fedex_main_python.c
src/classes_wrapper_python.cc
src/classes_python.c
src/selects_python.c
src/multpass_python.c
${SCL_SOURCE_DIR}/src/fedex_plus/collect.cc
${SCL_SOURCE_DIR}/src/fedex_plus/complexlist.cc
${SCL_SOURCE_DIR}/src/fedex_plus/entlist.cc
${SCL_SOURCE_DIR}/src/fedex_plus/multlist.cc
${SCL_SOURCE_DIR}/src/fedex_plus/orlist.cc
${SCL_SOURCE_DIR}/src/fedex_plus/entnode.cc
${SCL_SOURCE_DIR}/src/fedex_plus/expressbuild.cc
${SCL_SOURCE_DIR}/src/fedex_plus/non-ors.cc
${SCL_SOURCE_DIR}/src/fedex_plus/match-ors.cc
${SCL_SOURCE_DIR}/src/fedex_plus/trynext.cc
${SCL_SOURCE_DIR}/src/fedex_plus/write.cc
${SCL_SOURCE_DIR}/src/fedex_plus/print.cc
)
SCL_ADDEXEC(fedex_python "${fedex_python_SOURCES} ${fedex_plus_MSVC_SOURCES}" "libexppp express")

add_dependencies( fedex_python version_string )
endif(PYTHON_GENERATOR)
1 change: 1 addition & 0 deletions src/fedex_python/REAMDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Howto
19 changes: 19 additions & 0 deletions src/fedex_python/examples/unitary_schemas/gcc_incomplete_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by fedex_python. You probably don't want to edit
# it since your modifications will be lost if fedex_plus is used to
# regenerate it.
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 *
maths_number = NUMBER
# SELECT TYPE atom_based_value_
if (not 'maths_number' in globals().keys()):
maths_number = 'maths_number'
if (not 'atom_based_tuple' in globals().keys()):
atom_based_tuple = 'atom_based_tuple'
atom_based_value = SELECT(
'maths_number',
'atom_based_tuple')
atom_based_tuple = LIST(0,None,'atom_based_value')
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__doc__= ''' This script runs fedex_python over each EXPRESS schema in the test/unitary_schemas folder'''

unitary_schemas_path = '../../../../test/unitary_schemas'
fedex_python_path = '../../../../cmake-build/bin/fedex_python'

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([fedex_python_path,unitary_schema])
117 changes: 117 additions & 0 deletions src/fedex_python/examples/unitary_schemas/index_attribute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This file was generated by fedex_python. You probably don't want to edit
# it since your modifications will be lost if fedex_plus is used to
# regenerate it.
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 *
common_datum_list = LIST(1,None,'datum_reference_element')
label = STRING
# SELECT TYPE datum_or_common_datum_
if (not 'common_datum_list' in globals().keys()):
common_datum_list = 'common_datum_list'
if (not 'datum' in globals().keys()):
datum = 'datum'
datum_or_common_datum = SELECT(
'common_datum_list',
'datum')

####################
# ENTITY shape_aspect #
####################
class shape_aspect(BaseEntityClass):
'''Entity shape_aspect definition.

:param name
:type name:STRING

: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 mantatory and can not be set to None')
if not check_type(value,STRING):
self._name = STRING(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 mantatory 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())

####################
# 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 , shape_aspect__name , shape_aspect__of_shape , base, ):
shape_aspect.__init__(self , shape_aspect__name , shape_aspect__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 mantatory 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())

####################
# 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 , general_datum_reference__base , ):
general_datum_reference.__init__(self , general_datum_reference__base , )

####################
# ENTITY datum #
####################
class datum(shape_aspect):
'''Entity datum definition.
'''
def __init__( self , shape_aspect__name , shape_aspect__of_shape , ):
shape_aspect.__init__(self , shape_aspect__name , shape_aspect__of_shape , )
Loading