Changeset 7734


Ignore:
Timestamp:
03/31/11 14:09:49 (14 years ago)
Author:
jschierm
Message:

Added mex options parsing to KMLMeshWrite module (as a prototype).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/KMLMeshWrite/KMLMeshWrite.cpp

    r7661 r7734  
    1313        char*   notes=NULL;
    1414        const mxArray* notesi;
    15         mwSize         nsize;
    1615        mwIndex        nindex;
    1716
     
    4241
    4342        FILE*   fid=NULL;
     43
     44        DataSet* options=NULL;
    4445
    4546        /* output: */
     
    5253        if (nlhs > NLHS) {
    5354                KMLMeshWriteUsage();
    54                 _error_("KMLMeshWriteUsage usage error");
    55         }
    56         if (nrhs != NRHS) {
     55                _error_("KMLMeshWrite usage error");
     56        }
     57        if (nrhs < NRHS) {
    5758                KMLMeshWriteUsage();
    58                 _error_("KMLMeshWriteUsage usage error");
     59                _error_("KMLMeshWrite usage error");
    5960        }
    6061
     
    6667/*  notes is typically a cell array of character strings  */
    6768        if (mxIsCell(NOTES)) {
    68                 nsize=mxGetNumberOfElements(NOTES);
    69                 for (nindex=0; nindex<nsize; nindex++) {
     69                for (nindex=0; nindex<mxGetNumberOfElements(NOTES); nindex++) {
    7070                        notesi=mxGetCell(NOTES,nindex);
    7171                        if (notesi && mxIsChar(notesi) && mxGetNumberOfElements(notesi)) {
     
    107107        if (verbose) printf("  filnam =\"%s\"\n",filnam);
    108108
     109        if (nrhs > NRHS) {
     110                if (verbose) printf("Parsing options:\n");
     111                options=OptionsParse(NRHS,nrhs,prhs);
     112        }
     113
    109114        /*some checks*/
    110115        if (verbose) printf("Checking inputs:\n");
     
    158163        WriteData(ERRORFLAG,ierror);
    159164
     165        if (options) {
     166                delete options;
     167                options=NULL;
     168        }
     169
    160170        if (mxIsCell(NOTES) && notes)
    161171                xfree((void**)&notes);
     
    191201        _printf_(true,"\n");
    192202}
     203
Note: See TracChangeset for help on using the changeset viewer.