Changeset 2697


Ignore:
Timestamp:
01/25/12 02:12:12 (4 months ago)
Author:
joni
Message:

python 2.7 executable changes

Location:
simo/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • simo/trunk/dev/pyinstaller/simo_onedir.spec

    r2670 r2697  
    1919#################################### 
    2020EXTRA_LIBS = '/EXTRA_LIBS' 
    21 libnames = ('libgeos', 'libiconv', 'libproj', 'libspatialite', 'libfreexl', 
    22             'libstdc++', 'libgcc_s_dw2') 
     21libnames = ('geos_c', 'iconv', 'proj', 'libspatialite-2', 'sqlite3') 
    2322spatialite_libs = [] 
    2423for name in libnames: 
     
    2625        spatialite_libs.append((os.path.basename(lib), lib, 'BINARY')) 
    2726 
     27op_ext_file = '../../simulator/models/operation/silviculture.py' 
     28 
     29exclude_dlls = [('powrprof.dll', '', ''), 
     30               ('secur32.dll', '', ''), 
     31               ('crypt32.dll', '', ''), 
     32               ('mswsock.dll', '', ''), 
     33               ('shfolder.dll', '', ''), 
     34               ('API-MS-Win-Core-ErrorHandling-L1-1-0.dll', '', ''), 
     35               ('API-MS-Win-Core-Interlocked-L1-1-0.dll', '', ''), 
     36               ('API-MS-Win-Core-LibraryLoader-L1-1-0.dll', '', ''), 
     37               ('API-MS-Win-Core-LocalRegistry-L1-1-0.dll', '', ''), 
     38               ('API-MS-Win-Core-Misc-L1-1-0.dll', '', ''), 
     39               ('API-MS-Win-Core-ProcessThreads-L1-1-0.dll', '', ''), 
     40               ('API-MS-Win-Core-Profile-L1-1-0.dll', '', ''), 
     41               ('API-MS-Win-Core-Synch-L1-1-0.dll', '', ''), 
     42               ('API-MS-Win-Core-SysInfo-L1-1-0.dll', '', ''), 
     43               ('API-MS-Win-Security-Base-L1-1-0.dll', '', ''), 
     44               ('HID.dll', '', ''), 
     45               ('SETUPAPI.dll', '', ''), 
     46               ('CFGMGR.dll', '', ''), 
     47               ('DEVOBJ.dll', '', ''), 
     48               ('MSASN1.dll', '', ''),] 
     49            
    2850######################## 
    2951# Builder 
     
    4769          console=True) 
    4870coll = COLLECT( exe, 
    49                a.binaries-[('powrprof.dll', '', ''),  
    50                            ('secur32.dll', '', ''),  
    51                            ('crypt32.dll', '', ''), ], 
     71               a.binaries-exclude_dlls, 
    5272               a.zipfiles, 
    5373               a.datas, 
     
    7494          console=True ) 
    7595coll = COLLECT( exe, 
    76                a.binaries-[('powrprof.dll', '', ''),  
    77                            ('secur32.dll', '', ''),  
    78                            ('crypt32.dll', '', ''),]+spatialite_libs, 
     96               a.binaries-exclude_dlls+spatialite_libs, 
    7997               a.zipfiles, 
    8098               a.datas, 
     
    90108print '#' * 70 
    91109basefiles[-1] = '../../src/runner.py' 
     110basefiles.append(op_ext_file) 
    92111a = Analysis(basefiles, pathex=[''], hookspath=['hooks']) 
    93112pyz = PYZ(a.pure) 
     
    101120          console=True ) 
    102121coll = COLLECT( exe, 
    103                a.binaries-[('powrprof.dll', '', ''),  
    104                            ('secur32.dll', '', ''),  
    105                            ('crypt32.dll', '', ''),]+spatialite_libs, 
     122               a.binaries-exclude_dlls+spatialite_libs, 
    106123               a.zipfiles, 
    107124               a.datas, 
  • simo/trunk/dev/utils/cextensions.py

    r1599 r2697  
    5656                       'build_ext', '--force', '--inplace'] 
    5757    else: 
    58         script_args = ['build',     '--build-base', tmp_dir, 
     58        script_args = ['build', '--build-base', tmp_dir, 
    5959                       'build_ext', '--force', '--inplace'] 
    60     include_dir = '%s/numpy/core/include' % (numpy_path,) 
     60    include_dirs = ['%s/numpy/core/include' % (numpy_path,)] 
     61 
    6162    try: 
    6263        # compile the operation model C extensions 
     
    6465              description = "C extension modules for SIMO operation libraries", 
    6566              script_args = script_args, 
    66               ext_modules=[Extension("operations_ext", ["operations_ext.c"], 
    67                              include_dirs=[include_dir]) 
     67              ext_modules=[Extension("operations_ext",  
     68                           sources=["operations_ext.c"], 
     69                           include_dirs=include_dirs,) 
    6870                          ], 
    6971             ) 
     
    7577              cmdclass = {'build_ext': build_ext}, 
    7678              ext_modules = [Extension('handler_ext', ['handler_ext.pyx'], 
    77                              include_dirs=[include_dir]) 
     79                             include_dirs=include_dirs) 
    7880                            ], 
    7981             ) 
     
    8587              cmdclass = {'build_ext': build_ext}, 
    8688              ext_modules = [Extension('opt_ext', ['opt_ext.pyx'], 
    87                              include_dirs=[include_dir]) 
     89                             include_dirs=include_dirs) 
    8890                            ], 
    8991             ) 
     
    9597              cmdclass = {'build_ext': build_ext}, 
    9698              ext_modules = [Extension('out_ext', ['out_ext.pyx'], 
    97                              include_dirs=[include_dir]) 
     99                             include_dirs=include_dirs) 
    98100                            ], 
    99101             ) 
  • simo/trunk/src/models/Finland/c/BiomassmodelLibrary.h

    r1708 r2697  
    4545//  factor for the model. This way the models can be called easily from python 
    4646//  and C/C++ implementation. / AM 2.9.2005 
     47 
     48//Undecorate C++ functions 
     49#ifdef __cplusplus 
     50extern "C" { 
     51#endif 
    4752 
    4853DLLEXPORT int Biomass_stem_pine_Marklund (double d, double h, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    128133DLLEXPORT int Biomass_tree_JKK (double d, double h, double a, double SP, double TS, int *nres, struct Biomass_tree *biomass, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    129134DLLEXPORT int Biomass_tree_Yasso_JKK (double d, double h, double a, double SP, double TS, int *nres, struct Biomass_tree_Yasso *biomass, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     135 
     136#ifdef __cplusplus 
     137} 
     138#endif 
  • simo/trunk/src/models/Finland/c/DistributionmodelLibrary.c

    r2695 r2697  
    458458        int i; 
    459459        double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 
    460         double dist_2[class_count][2]; 
    461  
     460        //double dist_2[class_count][2];     
     461    double** dist_2 = NULL; 
     462    dist_2 = new double*[class_count]; 
     463    for (int i=0; i < class_count; i++) { 
     464        dist_2[i] = new double[2]; 
     465        for (int j=0; j<2; j++) { 
     466            dist_2[i][j] = 0; 
     467        } 
     468    } 
     469     
    462470        left_out = 0; 
    463471        //diameters & stem numbers 
     
    530538                dist[2].n = N/3; 
    531539                class_count_new = 3; 
    532         }        
     540        } 
     541     
     542    for (int i=0; i < class_count; i++) { 
     543        delete[] dist_2[i]; 
     544        dist_2[i] = NULL; 
     545    } 
     546    delete[] dist_2; 
     547    dist_2 = NULL; 
     548     
    533549        return class_count_new; 
    534550} 
     
    546562        int i; 
    547563        double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 
    548         double dist_2[class_count][2]; 
    549  
     564        //double dist_2[class_count][2]; 
     565    double** dist_2 = NULL; 
     566    dist_2 = new double*[class_count]; 
     567    for (int i=0; i < class_count; i++) { 
     568        dist_2[i] = new double[2]; 
     569        for (int j=0; j<2; j++) { 
     570            dist_2[i][j] = 0; 
     571        } 
     572    } 
     573     
    550574        left_out = 0; 
    551575        //diameters & stem numbers 
     
    635659                dist[2].n = (BA/3)/(PI * pow(( dist_2[biggest_class+1][0] / 200 ), 2)); 
    636660                class_count_new = 3; 
    637         } 
     661        }     
     662    for (int i=0; i < class_count; i++) { 
     663        delete[] dist_2[i]; 
     664        dist_2[i] = NULL; 
     665    } 
     666    delete[] dist_2; 
     667    dist_2 = NULL; 
    638668        return class_count_new; 
    639669} 
     
    650680        int i; 
    651681        double low_boundary, high_boundary, low_mass, high_mass, stem_number, N_calc, left_out; 
    652         double dist_2[class_count][2]; 
    653  
    654         N_calc = 0; 
     682        //double dist_2[class_count][2]; 
     683    double** dist_2 = NULL; 
     684    dist_2 = new double*[class_count]; 
     685    for (int i=0; i < class_count; i++) { 
     686        dist_2[i] = new double[2]; 
     687        for (int j=0; j<2; j++) { 
     688            dist_2[i][j] = 0; 
     689        } 
     690    } 
     691     
     692    N_calc = 0; 
    655693        left_out = 0; 
    656694        //diameters & stem numbers 
     
    747785                dist[2].n = N_calc/3; 
    748786                class_count_new = 3; 
    749         } 
     787        }     
     788    for (int i=0; i < class_count; i++) { 
     789        delete[] dist_2[i]; 
     790        dist_2[i] = NULL; 
     791    } 
     792    delete[] dist_2; 
     793    dist_2 = NULL; 
    750794        return class_count_new; 
    751795         
     
    791835        int i;   
    792836        double cur_dbh, cur_N, low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 
    793         double dist_2[class_count][2]; 
    794  
     837        //double dist_2[class_count][2]; 
     838    double** dist_2 = NULL; 
     839    dist_2 = new double*[class_count]; 
     840    for (int i=0; i < class_count; i++) { 
     841        dist_2[i] = new double[2]; 
     842        for (int j=0; j<2; j++) { 
     843            dist_2[i][j] = 0; 
     844        } 
     845    } 
     846     
    795847        left_out = 0; 
    796848        //diameters & stem numbers 
     
    869921                dist[2].n = (BA/3)/(PI * pow(( dist_2[biggest_class+1][0] / 200 ), 2)); 
    870922                class_count_new = 3; 
    871         } 
     923        }     
     924    for (int i=0; i < class_count; i++) { 
     925        delete[] dist_2[i]; 
     926        dist_2[i] = NULL; 
     927    } 
     928    delete[] dist_2; 
     929    dist_2 = NULL; 
    872930        return class_count_new; 
    873931} 
     
    31673225        double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 
    31683226        double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step, counter1, counter2, counter3; 
    3169         double dist_2[class_count][3]; 
    3170  
     3227        //double dist_2[class_count][3]; 
     3228 
     3229    double** dist_2 = NULL; 
     3230    dist_2 = new double*[class_count]; 
     3231    for (int i=0; i < class_count; i++) { 
     3232        dist_2[i] = new double[3]; 
     3233        for (int j=0; j<3; j++) { 
     3234            dist_2[i][j] = 0; 
     3235        } 
     3236    } 
     3237     
    31713238        left_out = 0; 
    31723239        counter1 = 0; 
     
    33633430                        counter3++; 
    33643431                } 
    3365         } 
     3432        }     
     3433     
     3434    for (int i=0; i < class_count; i++) { 
     3435        delete[] dist_2[i]; 
     3436        dist_2[i] = NULL; 
     3437    } 
     3438    delete[] dist_2; 
     3439    dist_2 = NULL; 
     3440     
    33663441        return class_count_new; 
    33673442         
     
    34793554        int i, j; 
    34803555        double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 
    3481         double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step; 
    3482         double dist_2[class_count][3]; 
    3483  
     3556    double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step; 
     3557    //double dist_2[class_count][3]; 
     3558 
     3559    double** dist_2 = NULL; 
     3560    dist_2 = new double*[class_count]; 
     3561    for (int i=0; i < class_count; i++) { 
     3562        dist_2[i] = new double[3]; 
     3563        for (int j=0; j<3; j++) { 
     3564            dist_2[i][j] = 0; 
     3565        } 
     3566    } 
     3567         
    34843568        left_out = 0; 
    34853569        //heights & stem numbers 
     
    36163700                } 
    36173701        } 
     3702     
     3703    for (int i=0; i < class_count; i++) { 
     3704        delete[] dist_2[i]; 
     3705        dist_2[i] = NULL; 
     3706    } 
     3707    delete[] dist_2; 
     3708    dist_2 = NULL; 
     3709     
    36183710        return class_count_new; 
    36193711         
  • simo/trunk/src/models/Finland/c/DistributionmodelLibrary.h

    r2692 r2697  
    5858//  and C/C++ implementation. / AM 2.9.2005 
    5959 
     60//Undecorate C++ functions 
     61#ifdef __cplusplus 
     62extern "C" { 
     63#endif 
     64 
    6065DLLEXPORT int Diameter_distribution_pine_percent_point_KangasMaltamo ( double BA, double DgM, double Age, double N, double DIAM_CLASS_WIDTH, double MAX_CLASS_COUNT, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    6166DLLEXPORT int Diameter_distribution_spruce_percent_point_KangasMaltamo ( double BA, double BA_total, double DgM, double Age, double N, double DIAM_CLASS_WIDTH, double SC, double MAX_CLASS_COUNT, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    96101DLLEXPORT int Height_distribution_young_pine_Siipilehto (double N, double H_gM, double H_dom, double HEIGHT_CLASS_WIDTH, double max_class_count, int *nres, struct heightclass_weibull *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    97102DLLEXPORT int Diameter_distribution_little_ba_and_n_JKK (double N, double D_gM, double H_gM, double BA, double BA_measured, double MAX_CLASS_COUNT, int *nres, struct diamclass_seedtree *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     103 
     104#ifdef __cplusplus 
     105} 
     106#endif 
  • simo/trunk/src/models/Finland/c/GeomodelLibrary.h

    r1708 r2697  
    3030}; 
    3131 
     32//Undecorate C++ functions 
     33#ifdef __cplusplus 
     34extern "C" { 
     35#endif 
     36 
    3237DLLEXPORT int Coordinates_JKK (double Municipal_id, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    3338DLLEXPORT int Altitude_JKK (double Municipal_id, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    4348DLLEXPORT int YKJ_rectangular_to_EUREF_FIN_geographical_coordinates_JKK (double Y, double X, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    4449DLLEXPORT int EUREF_FIN_rectangular_to_EUREF_FIN_geographical_coordinates_JKK (double Y, double X, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     50 
     51#ifdef __cplusplus 
     52} 
     53#endif 
  • simo/trunk/src/models/Finland/c/InitmodelLibrary.c

    r2696 r2697  
    19971997        double Age_init, H_dom, N_init, BA, V, DgM_real, DgM_init, H_gM; 
    19981998 
     1999        int iSC = (int) SC; 
     2000    double diff; 
    19992001 
    20002002        DgM_real=D_gM; 
    20012003 
    2002         int iSC = (int) SC; 
    20032004        switch ( iSC ) 
    20042005        { 
     
    20872088        *nres = 1; 
    20882089 
    2089         double diff; 
    20902090        diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 
    20912091 
     
    21272127        int ret = 1; 
    21282128        double Age_init, H_dom, N_init, BA, V, SP, DgM_real, DgM_init, H_gM; 
    2129  
     2129        int iSC = (int) SC; 
     2130    double diff; 
    21302131 
    21312132        DgM_real=D_gM; 
    21322133 
    2133         int iSC = (int) SC; 
    21342134        switch ( iSC ) 
    21352135        { 
     
    22182218        *nres = 1; 
    22192219 
    2220         double diff; 
    22212220        diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 
    22222221 
     
    22592258        int ret = 1; 
    22602259        double Age_init, H_dom, N_init, BA, V, SP, DgM_real, DgM_init, H_gM; 
     2260        int iSC = (int) SC; 
     2261        double diff; 
    22612262 
    22622263 
    22632264        DgM_real=D_gM; 
    22642265 
    2265         int iSC = (int) SC; 
    22662266        switch ( iSC ) 
    22672267        { 
     
    23502350        *nres = 1; 
    23512351 
    2352         double diff; 
    23532352        diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 
    23542353 
     
    23912390        int ret = 1; 
    23922391        double Age_init, H_dom, N_init, BA, V, DgM_real, DgM_init, H_gM; 
     2392        int iSC = (int) SC; 
     2393        double diff; 
    23932394 
    23942395 
    23952396        DgM_real=D_gM; 
    23962397 
    2397         int iSC = (int) SC; 
    23982398        switch ( iSC ) 
    23992399        { 
     
    24872487                N=5000; 
    24882488 
    2489         double diff; 
    24902489        diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 
    24912490 
  • simo/trunk/src/models/Finland/c/InitmodelLibrary.h

    r2696 r2697  
    529529//  and C/C++ implementation. / AM 2.9.2005 
    530530 
     531//Undecorate C++ functions 
     532#ifdef __cplusplus 
     533extern "C" { 
     534#endif 
     535 
    531536DLLEXPORT int Assign_to_zero_after_clearcut_comp_unit_JKK (int *nres, struct To_zero_clearcut_comp_unit *to_zero, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    532537DLLEXPORT int Assign_to_zero_after_seedtreecut_comp_unit_JKK (int *nres, struct To_zero_seedtreecut_comp_unit *to_zero, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    561566DLLEXPORT int Initial_values_supplemental_planting_spruce_JKK (double SC, double N_Sp, double N_Ns, double N_sb, double SP_regen, int *nres, struct initial_values *init, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    562567DLLEXPORT int Initial_values_supplemental_planting_white_birch_JKK (double SC, double N_Sp, double N_Ns, double N_sb, double SP_regen, int *nres, struct initial_values *init, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     568 
     569#ifdef __cplusplus 
     570} 
     571#endif 
  • simo/trunk/src/models/Finland/c/NaturalremovalmodelLibrary.h

    r1757 r2697  
    5151//  and C/C++ implementation. / AM 2.9.2005 
    5252 
     53//Undecorate C++ functions 
     54#ifdef __cplusplus 
     55extern "C" { 
     56#endif 
     57 
    5358DLLEXPORT int Mimimum_growing_space_pine_Hynynenym (double d_s, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    5459DLLEXPORT int Mimimum_growing_space_spruce_Hynynenym (double d_s, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    8994DLLEXPORT int Tree_survival_urban_area_forest_JKK (double d, double age, double SP, double BA, double BA_L, double RDF_L, double SC, double TS, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    9095DLLEXPORT int Probability_a_tree_to_die_due_to_aging_urban_area_forest_Hynynenym (double age, double sp, double TS, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     96 
     97#ifdef __cplusplus 
     98} 
     99#endif 
  • simo/trunk/src/models/Finland/c/SeedlingmodelLibrary.h

    r2343 r2697  
    3737//  factor for the model. This way the models can be called easily from python 
    3838//  and C/C++ implementation. / AM 2.9.2005 
     39 
     40//Undecorate C++ functions 
     41#ifdef __cplusplus 
     42extern "C" { 
     43#endif 
     44 
    3945DLLEXPORT int Initial_age_for_a_new_tree_pine_Hynynenym (double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    4046DLLEXPORT int Initial_age_for_a_new_tree_spruce_Hynynenym (double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    115121DLLEXPORT int Diameter_small_tree_pine_Siipilehto (double h, double D_gM, double H_gM, double H_dom, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    116122DLLEXPORT int Initial_age_JKK (double SP, double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     123 
     124#ifdef __cplusplus 
     125} 
     126#endif 
  • simo/trunk/src/models/Finland/c/StandgrowthmodelLibrary.h

    r1708 r2697  
    3434//  and C/C++ implementation. / AM 2.9.2005 
    3535 
     36//Undecorate C++ functions 
     37#ifdef __cplusplus 
     38extern "C" { 
     39#endif 
    3640 
    3741DLLEXPORT int Basal_area_growth_under_bark_pine_VuokilaValiaho (double BA_u, double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    7882DLLEXPORT int Dominant_height_growth_pine_Gustavsen (double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    7983DLLEXPORT int Dominant_height_growth_spruce_Gustavsen (double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     84 
     85#ifdef __cplusplus 
     86} 
     87#endif 
  • simo/trunk/src/models/Finland/c/StandmodelLibrary.h

    r2687 r2697  
    118118//  factor for the model. This way the models can be called easily from python 
    119119//  and C/C++ implementation. / AM 2.9.2005 
     120 
     121//Undecorate C++ functions 
     122#ifdef __cplusplus 
     123extern "C" { 
     124#endif 
    120125 
    121126DLLEXPORT int Volume_BAHdomF (double BA, double H_dom, double F, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    237242DLLEXPORT int Site_index_increment_JKK (double SI_50, double climate_change_scenario, double time_step, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    238243DLLEXPORT int Site_index_present_state_JKK (double SI_50, double climate_change_scenario, double year, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     244 
     245#ifdef __cplusplus 
     246} 
     247#endif 
  • simo/trunk/src/models/Finland/c/ThinningmodelLibrary.h

    r2347 r2697  
    3434}; 
    3535 
     36//Undecorate C++ functions 
     37#ifdef __cplusplus 
     38extern "C" { 
     39#endif 
     40 
    3641DLLEXPORT int Thinning_limits_JKK (double H_dom, double BA, double MAIN_SP, double MANAGEMENT_REGION, double SC, double TS, double PEAT, double THINNING_LEVEL, int *nres, struct Thinning_limits *limits, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    3742DLLEXPORT int Thinning_statutory_limits_JKK (double H_dom, double BA, double MAIN_SP, double MANAGEMENT_REGION, double SC, double TS, double PEAT, double Municipal_id, double THINNING_LEVEL, int *nres, struct Thinning_statutory_limits *limits, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     43 
     44#ifdef __cplusplus 
     45} 
     46#endif 
  • simo/trunk/src/models/Finland/c/TreegrowthmodelLibrary.h

    r1708 r2697  
    3434//  factor for the model. This way the models can be called easily from python 
    3535//  and C/C++ implementation. / AM 2.9.2005 
     36 
     37//Undecorate C++ functions 
     38#ifdef __cplusplus 
     39extern "C" { 
     40#endif 
    3641 
    3742DLLEXPORT int Height_growth_pine_Hynynenym (double d, double D_domvmi, double i_Hdom5, double cr, double CR_domvmi, double RDF_L, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    7479DLLEXPORT int Dominant_height_after_5_years_spruce_with_bias_corr_Hynynenym (double A, double TS, double LAKE, double SEA, double SC, double STONY, double PALU, double HUMUS, double ALT, double SCRUB, double WASTE, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    7580DLLEXPORT int Dominant_height_after_5_years_birch_with_bias_corr_Hynynenym (double A, double TS, double LAKE, double PLANT, double SC, double SP, double PUB, double PALU, double HUMUS, double SEA, double ALT, double SCRUB, double WASTE, double STONY, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     81 
     82#ifdef __cplusplus 
     83} 
     84#endif 
  • simo/trunk/src/models/Finland/c/TreemodelLibrary.h

    r2587 r2697  
    3434//  factor for the model. This way the models can be called easily from python 
    3535//  and C/C++ implementation. / AM 2.9.2005 
     36 
     37//Undecorate C++ functions 
     38#ifdef __cplusplus 
     39extern "C" { 
     40#endif 
    3641 
    3742DLLEXPORT int Age_pine_hemib_h_KalliovirtaTokola (double h, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     
    203208DLLEXPORT int Calibration_height_JKK (double Age, double BA, double D_gM, double H_gM, double H_dom, double SP, double TS, double ALT, double SC, double PEAT, double PEAT_transf, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
    204209DLLEXPORT int Crown_ratio_JKK (double d, double h, double SP, double BA, double BA_prosb, double H_dom, double RDF, double RDF_L, double TS, double ALT, double LAKE, double SEA, double SCRUB, double SC, double SI_50, double STONY, double PALU, double HUMUS, double SINCE_THINNING, double PLANT, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 
     210 
     211#ifdef __cplusplus 
     212} 
     213#endif 
  • simo/trunk/src/models/Finland/c/make_dll.py

    r738 r2697  
    11import sys, os 
     2 
     3python_include = os.path.join(os.path.dirname(sys.executable), 'include') 
     4python_libs = os.path.join(os.path.dirname(sys.executable), 'libs') 
     5python_PC = os.path.join(os.path.dirname(sys.executable), 'PC') 
     6python_PCbuild = os.path.join(os.path.dirname(sys.executable), 'PCbuild') 
     7python_lib = os.path.join(os.path.dirname(sys.executable),  
     8                          'libs\\python%d%d.lib' % sys.version_info[:2]) 
    29 
    310def make_dll(filenames): 
     
    2633    else: 
    2734        dmode = '-DMODE=3' 
    28     for filename in filenames[1:]: 
     35    if sys.version_info[:2] <= (2, 5) or sys_id != 'win': 
     36        for filename in filenames[1:]: 
    2937            print "Compiling %s..." % filename 
    3038            os.system(' '.join(('gcc', fpic, '-c', dmode, posix_source, 
    3139                                '%s.h' % filename, '%s.c' % filename))) 
    3240            input=' '.join((input, '%s.o' % filename)) 
    33     print "output =", dllname 
    34     print "input =", input 
    35     print "Creating dll..." 
    36     os.system(' '.join(('gcc', '-shared', '-dynamiclib', '-o', 
    37                         ''.join((dllname, input)) )) ) 
     41        print "output =", dllname 
     42        print "input =", input 
     43        print "Creating dll..." 
     44        os.system(' '.join(('gcc', '-shared', '-dynamiclib', '-o', 
     45                            ''.join((dllname, input)) )) ) 
     46    else: 
     47        #for filename in filenames[1:]: 
     48        print "Compiling %s..." % dllname 
     49        to_run = ' '.join(('cl', '/c', dmode, '/O2', '/MD',  
     50                           '/W3', '/GS-',  
     51                           '/DNDEBUG',  
     52                           '/D_CRT_SECURE_NO_WARNINGS', '-I'+python_include, 
     53                           '-I'+python_PC, 
     54                           ' '.join(['/Tp%s.c' % filename \ 
     55                                     for filename in filenames[1:]]))) 
     56        print to_run 
     57        os.system(to_run) 
     58        to_run = ' '.join(('link', '/DLL', '/nologo', '/INCREMENTAL:NO', 
     59                           '/LIBPATH:'+python_libs,  
     60                           '/LIBPATH:'+python_PCbuild, 
     61                           ' '.join(['%s.obj' % filename \ 
     62                                     for filename in filenames[1:]]), 
     63                           '/OUT:'+filenames[0]+'.dll',  
     64                           '/IMPLIB:'+filenames[0]+'.lib', 
     65                           '/MANIFESTFILE:'+filenames[0]+'.dll.manifest', 
     66                           )) 
     67        print to_run 
     68        os.system(to_run) 
     69        to_run = ' '.join(('mt', '-nologo', '-manifest',  
     70                           filenames[0]+'.dll.manifest', 
     71                           '-outputresource:'+filenames[0]+'.dll;2')) 
     72        print to_run 
     73        os.system(to_run) 
     74         
     75     
    3876    print "Removing lingering files..." 
    3977 
    4078    tmpfiles = [file for file in os.listdir('.') if file.endswith('.o') or 
    41                 file.endswith('.gch')] 
     79                file.endswith('.gch') or file.endswith('.exp') or 
     80                file.endswith('.obj') or file.endswith('.lib') or 
     81                file.endswith('.exe') or file.endswith('.manifest')] 
    4282    for file in tmpfiles: 
    4383        os.remove(os.path.join(file)) 
Note: See TracChangeset for help on using the changeset viewer.