Skip to content

Commit 7ec9f7d

Browse files
committed
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.
1 parent 4e0d73d commit 7ec9f7d

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/fedex_python/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include_directories(
44
${SCL_SOURCE_DIR}/include
55
${SCL_SOURCE_DIR}/include/exppp
66
${SCL_SOURCE_DIR}/include/express
7+
${SCL_SOURCE_DIR}/src/base
78
${SCL_SOURCE_DIR}/src/fedex_plus
89
)
910

@@ -13,6 +14,7 @@ IF(MSVC)
1314
set(fedex_plus_MSVC_SOURCES
1415
${SCL_SOURCE_DIR}/src/fedex_plus/xgetopt.cc
1516
)
17+
add_definitions( -DSCL_BASE_DLL_IMPORTS )
1618
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
1719
add_definitions( -DSCL_EXPPP_DLL_IMPORTS )
1820
ENDIF(MSVC)
@@ -38,7 +40,7 @@ set(fedex_python_SOURCES
3840
${SCL_SOURCE_DIR}/src/fedex_plus/write.cc
3941
${SCL_SOURCE_DIR}/src/fedex_plus/print.cc
4042
)
41-
SCL_ADDEXEC(fedex_python "${fedex_python_SOURCES} ${fedex_plus_MSVC_SOURCES}" "libexppp express")
43+
SCL_ADDEXEC(fedex_python "${fedex_python_SOURCES} ${fedex_plus_MSVC_SOURCES}" "libexppp express base")
4244

4345
add_dependencies( fedex_python version_string )
4446
endif(PYTHON_GENERATOR)

src/fedex_python/src/classes_python.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ process_aggregate (FILE *file, Type t) {
533533
char *lower_str = EXPRto_string(lower);
534534
Expression upper = AGGR_TYPEget_upper_limit(t);
535535
char *upper_str = NULL;
536+
Type base_type;
536537
if (upper == LITERAL_INFINITY) {
537538
upper_str = "None";
538539
}
@@ -557,7 +558,7 @@ process_aggregate (FILE *file, Type t) {
557558
}
558559
fprintf(file,"(%s,%s,",lower_str,upper_str);
559560
//write base type
560-
Type base_type = TYPEget_base_type(t);
561+
base_type = TYPEget_base_type(t);
561562
if (TYPEis_aggregate(base_type)) {
562563
process_aggregate(file,base_type);
563564
fprintf(file,")"); //close parenthesis
@@ -567,7 +568,6 @@ process_aggregate (FILE *file, Type t) {
567568
//fprintf(file,"%s)",array_base_type);
568569
fprintf(file,"'%s')",array_base_type);
569570
}
570-
571571
}
572572

573573
void
@@ -578,6 +578,11 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
578578
bool generate_constructor = true; //by default, generates a python constructor
579579
bool inheritance = false;
580580
Type t;
581+
Linked_List list;
582+
int num_parent = 0;
583+
int num_derived_inverse_attr = 0;
584+
int index_attribute = 0;
585+
581586
/* class name
582587
need to use new-style classes for properties to work correctly
583588
so class must inherit from object */
@@ -587,9 +592,8 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
587592
/*
588593
* Look for inheritance and super classes
589594
*/
590-
Linked_List list;
591595
list = ENTITYget_supertypes( entity );
592-
int num_parent = 0;
596+
num_parent = 0;
593597
if( ! LISTempty( list ) ) {
594598
inheritance = true;
595599
LISTdo( list, e, Entity )
@@ -632,7 +636,7 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
632636
* other wise just a 'pass' statement is enough
633637
*/
634638
attr_count_tmp = 0;
635-
int num_derived_inverse_attr = 0;
639+
num_derived_inverse_attr = 0;
636640
LISTdo(ENTITYget_attributes( entity ), v, Variable)
637641
if (VARis_derived(v) || VARget_inverse(v)) {
638642
num_derived_inverse_attr++;
@@ -656,7 +660,8 @@ LIBdescribe_entity( Entity entity, FILE * file, Schema schema ) {
656660
}
657661
// if inheritance, first write the inherited parameters
658662
list = ENTITYget_supertypes( entity );
659-
int num_parent = 0, index_attribute = 0;
663+
num_parent = 0;
664+
index_attribute = 0;
660665
if( ! LISTempty( list ) ) {
661666
LISTdo( list, e, Entity )
662667
/* search attribute names for superclass */

src/fedex_python/src/selects_python.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,9 @@ class.
690690
*******************/
691691
void
692692
TYPEselect_lib_print( const Type type, FILE * f, Schema schema ) {
693+
int nbr_select = 0;
694+
int num = 0;
695+
693696
fprintf( f, "# SELECT TYPE %s_\n", TYPEget_name(type) );
694697
// writes the variable with strings
695698
LISTdo( SEL_TYPEget_items( type ), t, Type )
@@ -712,12 +715,12 @@ TYPEselect_lib_print( const Type type, FILE * f, Schema schema ) {
712715
}
713716

714717
// first compute the number of types (necessary to insert commas)
715-
int nbr_select = 0;
718+
nbr_select = 0;
716719
LISTdo( SEL_TYPEget_items( type ), t, Type )
717720
nbr_select++;
718721
LISTod;
719722
// then write types
720-
int num = 0;
723+
num = 0;
721724
LISTdo( SEL_TYPEget_items( type ), t, Type )
722725
if (is_python_keyword(TYPEget_name(t))) {
723726
fprintf( f, "\n\t'%s_'",TYPEget_name(t));

0 commit comments

Comments
 (0)