File: _coder_gjbf_mex.c

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