Ignore:
Timestamp:
10/31/19 12:37:11 (5 years ago)
Author:
jdquinn
Message:

BUG: Completed update to JavaScript wrappers; now successfully pulling and compiling with latest version of Emscripten (yay!)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp

    r24301 r24304  
    1515/*FUNCTION FetchData(char** pstring, char* string){{{*/
    1616void FetchData(char** pstring, char* stringin){
    17 
    18         char* string=xNew<char>(strlen(stringin)+1);
    19         xMemCpy<char>(string,stringin,strlen(stringin)+1);
     17        char* string=NULL;
     18
     19        string=xNew<char>(strlen(stringin)+1); xMemCpy<char>(string,stringin,strlen(stringin)+1);
    2020
    2121        *pstring=string;
    2222}
    2323/*}}}*/
    24 /*FUNCTION FetchData(int* pinteger,int integer){{{*/
    25 void FetchData(int* pinteger,int integer){
    26 
    27         *pinteger = integer;
    28 }
    29 /*}}}*/
    30 /*FUNCTION FetchData(double* pscalar,double scalar){{{*/
    31 void FetchData(double* pscalar,double scalar){
    32 
    33         *pscalar = scalar;
     24/*FUNCTION FetchData(int* pinteger, int integer){{{*/
     25void FetchData(int* pinteger, int integer){
     26        *pinteger=integer;
     27}
     28/*}}}*/
     29/*FUNCTION FetchData(double* pscalar, double scalar){{{*/
     30void FetchData(double* pscalar, double scalar){
     31        *pscalar=scalar;
    3432}
    3533/*}}}*/
    3634/*FUNCTION FetchData(double **pvector, double* vectorin, int nods){{{*/
    3735void FetchData(double** pvector, double* vectorin, int nods){
    38 
    3936        double* vector=NULL;
    4037
     
    4643/*FUNCTION FetchData(double **pvector, int* pnods, double* vectorin, int nods){{{*/
    4744void FetchData(double** pvector, int* pnods, double* vectorin, int nods){
    48 
    4945        double* vector=NULL;
    5046
     
    5753/*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/
    5854void FetchData(double **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){
    59 
    6055        double*  outmatrix=NULL;
    61         int      outmatrix_rows,outmatrix_cols;
     56        int      outmatrix_rows, outmatrix_cols;
    6257
    6358        if(M == 0 || N == 0){
     
    7166                outmatrix_cols=N;
    7267                outmatrix=xNew<IssmPDouble>(M*N);
    73                 for(int i=0;i<M*N;i++)outmatrix[i]=(IssmPDouble)matrixin[i];
     68                for(int i=0;i<M*N;i++){outmatrix[i]=(IssmPDouble)matrixin[i];}
    7469        }
    7570
    7671        /*Assign output pointers:*/
    7772        *pmatrix=outmatrix;
    78         if (pM)*pM=outmatrix_rows;
    79         if (pN)*pN=outmatrix_cols;
     73        if (pM){*pM=outmatrix_rows;}
     74        if (pN){*pN=outmatrix_cols;}
    8075}
    8176/*}}}*/
    8277/*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, double* matrix, int M, int N){{{*/
    8378void FetchData(double **pmatrix, int* pM, int* pN, double* matrixin, int M, int N){
    84 
    8579        double*  outmatrix=NULL;
    86         int      outmatrix_rows,outmatrix_cols;
     80        int      outmatrix_rows, outmatrix_cols;
    8781
    8882        if(M == 0 || N == 0){
     
    10094        /*Assign output pointers:*/
    10195        *pmatrix=outmatrix;
    102         if (pM)*pM=outmatrix_rows;
    103         if (pN)*pN=outmatrix_cols;
     96        if (pM){*pM=outmatrix_rows;}
     97        if (pN){*pN=outmatrix_cols;}
    10498}
    10599/*}}}*/
    106100/*FUNCTION FetchData(int **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/
    107101void FetchData(int **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){
    108 
    109102        int*     outmatrix=NULL;
    110         int      outmatrix_rows,outmatrix_cols;
     103        int      outmatrix_rows, outmatrix_cols;
    111104
    112105        if(M == 0 || N == 0){
     
    124117        /*Assign output pointers:*/
    125118        *pmatrix=outmatrix;
    126         if (pM)*pM=outmatrix_rows;
    127         if (pN)*pN=outmatrix_cols;
     119        if (pM){*pM=outmatrix_rows;}
     120        if (pN){*pN=outmatrix_cols;}
    128121}
    129122/*}}}*/
    130123/*ISSM objects*/
    131 /*FUNCTION FetchData(Contours** pcontours,double* x, double* y, int nods){{{*/
    132 void FetchData(Contours** pcontours,double* x, double* y, int nods){
    133 
    134         int             numcontours,index,test1,test2;
     124/*FUNCTION FetchData(Contours** pcontours, double* x, double* y, int nods){{{*/
     125void FetchData(Contours** pcontours, double* x, double* y, int nods){
     126        int             numcontours, index, test1, test2;
    135127        char            *contourname = NULL;
    136128        Contours        *contours    = NULL;
     
    141133
    142134        if (nods){
    143 
    144135                contouri=new Contour<double>();
    145136                contouri->nods=nods;
    146137                contouri->x=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->x,x,nods);
    147138                contouri->y=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->y,y,nods);
    148 
    149139                contours->AddObject(contouri);
    150140        }
     
    157147
    158148        /*Initialize output*/
    159         BamgGeom* bamggeom = new BamgGeom();
     149        BamgGeom* bamggeom=new BamgGeom();
    160150
    161151        /*Fetch all fields*/
     
    169159
    170160        /*Assign output pointers:*/
    171         *pbamggeom = bamggeom;
     161        *pbamggeom=bamggeom;
    172162}
    173163/*}}}*/
     
    176166
    177167        /*Initialize output*/
    178         BamgMesh* bamgmesh = new BamgMesh();
     168        BamgMesh* bamgmesh=new BamgMesh();
    179169
    180170        /*Fetch all fields*/
     
    189179
    190180        /*Assign output pointers:*/
    191         *pbamgmesh = bamgmesh;
     181        *pbamgmesh=bamgmesh;
    192182}
    193183/*}}}*/
     
    232222
    233223        /*Assign output pointers:*/
    234         *pbamgopts              = bamgopts;
    235 }
    236 /*}}}*/
    237 /*FUNCTION FetchData(Options** poptions,int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/
    238 void FetchData(Options** poptions,int NRHS, int nrhs, const char* optionname, double optionvalue){
     224        *pbamgopts=bamgopts;
     225}
     226/*}}}*/
     227/*FUNCTION FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/
     228void FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){
    239229
    240230        /*Initialize output*/
     
    242232
    243233        /*check and parse the name  */
    244         GenericOption<double> *odouble = new GenericOption<double>();
     234        GenericOption<double> *odouble=new GenericOption<double>();
    245235        odouble=new GenericOption<double>();
    246         odouble->name =xNew<char>(strlen(optionname)+1);
     236        odouble->name=xNew<char>(strlen(optionname)+1);
    247237        memcpy(odouble->name,optionname,(strlen(optionname)+1)*sizeof(char));
    248238        odouble->value=optionvalue;
Note: See TracChangeset for help on using the changeset viewer.