File: _coder_wind_mex.c

    1   /*
    2    * _coder_wind_mex.c
    3    *
    4    * Code generation for function '_coder_wind_mex'
    5    *
    6    */
    7   
    8   /* Include files */
    9   #include "wind.h"
   10   #include "_coder_wind_mex.h"
   11   #include "wind_terminate.h"
   12   #include "_coder_wind_api.h"
   13   #include "wind_initialize.h"
   14   #include "wind_data.h"
   15   
   16   /* Function Declarations */
   17   static void wind_mexFunction(int32_T nlhs, mxArray *plhs[3], int32_T nrhs, const
   18     mxArray *prhs[3]);
   19   
   20   /* Function Definitions */
   21   static void wind_mexFunction(int32_T nlhs, mxArray *plhs[3], int32_T nrhs, const
   22     mxArray *prhs[3])
   23   {
   24     int32_T n;
   25     const mxArray *inputs[3];
   26     const mxArray *outputs[3];
   27     int32_T b_nlhs;
   28     emlrtStack st = { NULL, NULL, NULL };
   29   
   30     st.tls = emlrtRootTLSGlobal;
   31   
   32     /* Check for proper number of arguments. */
   33     if (nrhs != 3) {
   34       emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, 12, 3, 4, 4,
   35                           "wind");
   36     }
   37   
   38     if (nlhs > 3) {
   39       emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, 4, 4,
   40                           "wind");
   41     }
   42   
   43     /* Temporary copy for mex inputs. */
   44     for (n = 0; n < nrhs; n++) {
   45       inputs[n] = prhs[n];
   46       if (*emlrtBreakCheckR2012bFlagVar != 0) {
   47         emlrtBreakCheckR2012b(&st);
   48       }
   49     }
   50   
   51     /* Call the function. */
   52     wind_api(inputs, outputs);
   53   
   54     /* Copy over outputs to the caller. */
   55     if (nlhs < 1) {
   56       b_nlhs = 1;
   57     } else {
   58       b_nlhs = nlhs;
   59     }
   60   
   61     emlrtReturnArrays(b_nlhs, plhs, outputs);
   62   
   63     /* Module termination. */
   64     wind_terminate();
   65   }
   66   
   67   void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
   68                    *prhs[])
   69   {
   70     mexAtExit(wind_atexit);
   71   
   72     /* Initialize the memory manager. */
   73     /* Module initialization. */
   74     wind_initialize();
   75   
   76     /* Dispatch the entry-point. */
   77     wind_mexFunction(nlhs, plhs, nrhs, prhs);
   78   }
   79   
   80   emlrtCTX mexFunctionCreateRootTLS(void)
   81   {
   82     emlrtCreateRootTLS(&emlrtRootTLSGlobal, &emlrtContextGlobal, NULL, 1);
   83     return emlrtRootTLSGlobal;
   84   }
   85   
   86   /* End of code generation (_coder_wind_mex.c) */
   87