File: _coder_nrt_mex.c

    1   /*
    2    * _coder_nrt_mex.c
    3    *
    4    * Code generation for function 'nrt'
    5    *
    6    */
    7   
    8   /* Include files */
    9   #include "mex.h"
   10   #include "_coder_nrt_api.h"
   11   #include "nrt_initialize.h"
   12   #include "nrt_terminate.h"
   13   
   14   /* Function Declarations */
   15   static void nrt_mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
   16   
   17   /* Variable Definitions */
   18   emlrtContext emlrtContextGlobal = { true, false, EMLRT_VERSION_INFO, NULL, "nrt", NULL, false, {2045744189U,2170104910U,2743257031U,4284093946U}, NULL };
   19   void *emlrtRootTLSGlobal = NULL;
   20   
   21   /* Function Definitions */
   22   static void nrt_mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   23   {
   24     const mxArray *outputs[3];
   25     const mxArray *inputs[3];
   26     int n = 0;
   27     int nOutputs = (nlhs < 1 ? 1 : nlhs);
   28     int nInputs = nrhs;
   29     emlrtStack st = { NULL, NULL, NULL };
   30     /* Module initialization. */
   31     nrt_initialize(&emlrtContextGlobal);
   32     st.tls = emlrtRootTLSGlobal;
   33     /* Check for proper number of arguments. */
   34     if (nrhs != 3) {
   35       emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, mxINT32_CLASS, 3, mxCHAR_CLASS, 3, "nrt");
   36     } else if (nlhs > 3) {
   37       emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, mxCHAR_CLASS, 3, "nrt");
   38     }
   39     /* Temporary copy for mex inputs. */
   40     for (n = 0; n < nInputs; ++n) {
   41       inputs[n] = prhs[n];
   42     }
   43     /* Call the function. */
   44     nrt_api(inputs, outputs);
   45     /* Copy over outputs to the caller. */
   46     for (n = 0; n < nOutputs; ++n) {
   47       plhs[n] = emlrtReturnArrayR2009a(outputs[n]);
   48     }
   49     /* Module finalization. */
   50     nrt_terminate();
   51   }
   52   
   53   void nrt_atexit_wrapper(void)
   54   {
   55      nrt_atexit();
   56   }
   57   
   58   void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   59   {
   60     /* Initialize the memory manager. */
   61     mexAtExit(nrt_atexit_wrapper);
   62     /* Dispatch the entry-point. */
   63     nrt_mexFunction(nlhs, plhs, nrhs, prhs);
   64   }
   65   /* End of code generation (_coder_nrt_mex.c) */
   66