Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed fedex_python issues for msvc build.
* Mixed code/declarations are not allowed for c files on msvc.
  Moved variable declarations to top of function where needed.
* Added base library usage to fedex_python application.
  • Loading branch information
davyw committed Feb 27, 2012
commit 7ec9f7d8fb126d32f9518c3952e3db4fd7d9d4c4
4 changes: 3 additions & 1 deletion src/fedex_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include_directories(
${SCL_SOURCE_DIR}/include
${SCL_SOURCE_DIR}/include/exppp
${SCL_SOURCE_DIR}/include/express
${SCL_SOURCE_DIR}/src/base
${SCL_SOURCE_DIR}/src/fedex_plus
)

Expand All @@ -13,6 +14,7 @@ IF(MSVC)
set(fedex_plus_MSVC_SOURCES
${SCL_SOURCE_DIR}/src/fedex_plus/xgetopt.cc
)
add_definitions( -DSCL_BASE_DLL_IMPORTS )
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
add_definitions( -DSCL_EXPPP_DLL_IMPORTS )
ENDIF(MSVC)
Expand All @@ -38,7 +40,7 @@ set(fedex_python_SOURCES
${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")
SCL_ADDEXEC(fedex_python "${fedex_python_SOURCES} ${fedex_plus_MSVC_SOURCES}" "libexppp express base")

add_dependencies( fedex_python version_string )
endif(PYTHON_GENERATOR)
17 changes: 11 additions & 6 deletions src/fedex_python/src/classes_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ process_aggregate (FILE *file, Type t) {
char *lower_str = EXPRto_string(lower);
Expression upper = AGGR_TYPEget_upper_limit(t);
char *upper_str = NULL;
Type base_type;
if (upper == LITERAL_INFINITY) {
upper_str = "None";
}
Expand All @@ -557,7 +558,7 @@ process_aggregate (FILE *file, Type t) {
}
fprintf(file,"(%s,%s,",lower_str,upper_str);
//write base type
Type base_type = TYPEget_base_type(t);
base_type = TYPEget_base_type(t);
if (TYPEis_aggregate(base_type)) {
process_aggregate(file,base_type);
fprintf(file,")"); //close parenthesis
Expand All @@ -567,7 +568,6 @@ process_aggregate (FILE *file, Type t) {
//fprintf(file,"%s)",array_base_type);
fprintf(file,"'%s')",array_base_type);
}

}

void
Expand All @@ -578,6 +578,11 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
bool generate_constructor = true; //by default, generates a python constructor
bool inheritance = false;
Type t;
Linked_List list;
int num_parent = 0;
int num_derived_inverse_attr = 0;
int index_attribute = 0;

/* class name
need to use new-style classes for properties to work correctly
so class must inherit from object */
Expand All @@ -587,9 +592,8 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
/*
* Look for inheritance and super classes
*/
Linked_List list;
list = ENTITYget_supertypes( entity );
int num_parent = 0;
num_parent = 0;
if( ! LISTempty( list ) ) {
inheritance = true;
LISTdo( list, e, Entity )
Expand Down Expand Up @@ -632,7 +636,7 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
* other wise just a 'pass' statement is enough
*/
attr_count_tmp = 0;
int num_derived_inverse_attr = 0;
num_derived_inverse_attr = 0;
LISTdo(ENTITYget_attributes( entity ), v, Variable)
if (VARis_derived(v) || VARget_inverse(v)) {
num_derived_inverse_attr++;
Expand All @@ -656,7 +660,8 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
}
// if inheritance, first write the inherited parameters
list = ENTITYget_supertypes( entity );
int num_parent = 0, index_attribute = 0;
num_parent = 0;
index_attribute = 0;
if( ! LISTempty( list ) ) {
LISTdo( list, e, Entity )
/* search attribute names for superclass */
Expand Down
7 changes: 5 additions & 2 deletions src/fedex_python/src/selects_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class.
*******************/
void
TYPEselect_lib_print( const Type type, FILE * f, Schema schema ) {
int nbr_select = 0;
int num = 0;

fprintf( f, "# SELECT TYPE %s_\n", TYPEget_name(type) );
// writes the variable with strings
LISTdo( SEL_TYPEget_items( type ), t, Type )
Expand All @@ -712,12 +715,12 @@ TYPEselect_lib_print( const Type type, FILE * f, Schema schema ) {
}

// first compute the number of types (necessary to insert commas)
int nbr_select = 0;
nbr_select = 0;
LISTdo( SEL_TYPEget_items( type ), t, Type )
nbr_select++;
LISTod;
// then write types
int num = 0;
num = 0;
LISTdo( SEL_TYPEget_items( type ), t, Type )
if (is_python_keyword(TYPEget_name(t))) {
fprintf( f, "\n\t'%s_'",TYPEget_name(t));
Expand Down