File: _coder_nrt_api.c

    1   /*
    2    * _coder_nrt_api.c
    3    *
    4    * Code generation for function '_coder_nrt_api'
    5    *
    6    */
    7   
    8   /* Include files */
    9   #include "rt_nonfinite.h"
   10   #include "nrt.h"
   11   #include "_coder_nrt_api.h"
   12   
   13   /* Function Declarations */
   14   static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
   15     emlrtMsgIdentifier *parentId);
   16   static const mxArray *b_emlrt_marshallOut(const real_T u[50]);
   17   static real_T c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
   18     emlrtMsgIdentifier *msgId);
   19   static real_T emlrt_marshallIn(const emlrtStack *sp, const mxArray *varargin_1,
   20     const char_T *identifier);
   21   static const mxArray *emlrt_marshallOut(const real_T u);
   22   
   23   /* Function Definitions */
   24   static real_T b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
   25     emlrtMsgIdentifier *parentId)
   26   {
   27     real_T y;
   28     y = c_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
   29     emlrtDestroyArray(&u);
   30     return y;
   31   }
   32   
   33   static const mxArray *b_emlrt_marshallOut(const real_T u[50])
   34   {
   35     const mxArray *y;
   36     static const int32_T iv0[2] = { 0, 0 };
   37   
   38     const mxArray *m1;
   39     static const int32_T iv1[2] = { 1, 50 };
   40   
   41     y = NULL;
   42     m1 = emlrtCreateNumericArray(2, iv0, mxDOUBLE_CLASS, mxREAL);
   43     mxSetData((mxArray *)m1, (void *)u);
   44     emlrtSetDimensions((mxArray *)m1, iv1, 2);
   45     emlrtAssign(&y, m1);
   46     return y;
   47   }
   48   
   49   static real_T c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
   50     emlrtMsgIdentifier *msgId)
   51   {
   52     real_T ret;
   53     emlrtCheckBuiltInR2012b(sp, msgId, src, "double", false, 0U, 0);
   54     ret = *(real_T *)mxGetData(src);
   55     emlrtDestroyArray(&src);
   56     return ret;
   57   }
   58   
   59   static real_T emlrt_marshallIn(const emlrtStack *sp, const mxArray *varargin_1,
   60     const char_T *identifier)
   61   {
   62     real_T y;
   63     emlrtMsgIdentifier thisId;
   64     thisId.fIdentifier = identifier;
   65     thisId.fParent = NULL;
   66     y = b_emlrt_marshallIn(sp, emlrtAlias(varargin_1), &thisId);
   67     emlrtDestroyArray(&varargin_1);
   68     return y;
   69   }
   70   
   71   static const mxArray *emlrt_marshallOut(const real_T u)
   72   {
   73     const mxArray *y;
   74     const mxArray *m0;
   75     y = NULL;
   76     m0 = emlrtCreateDoubleScalar(u);
   77     emlrtAssign(&y, m0);
   78     return y;
   79   }
   80   
   81   void nrt_api(const mxArray * const prhs[3], const mxArray *plhs[3])
   82   {
   83     real_T (*hstry)[50];
   84     real_T varargin_1;
   85     real_T varargin_2;
   86     real_T varargin_3;
   87     real_T iterations;
   88     real_T nth_rt;
   89     emlrtStack st = { NULL, NULL, NULL };
   90   
   91     st.tls = emlrtRootTLSGlobal;
   92     hstry = (real_T (*)[50])mxMalloc(sizeof(real_T [50]));
   93   
   94     /* Marshall function inputs */
   95     varargin_1 = emlrt_marshallIn(&st, emlrtAliasP(prhs[0]), "varargin_1");
   96     varargin_2 = emlrt_marshallIn(&st, emlrtAliasP(prhs[1]), "varargin_2");
   97     varargin_3 = emlrt_marshallIn(&st, emlrtAliasP(prhs[2]), "varargin_3");
   98   
   99     /* Invoke the target function */
  100     nrt(&st, varargin_1, varargin_2, varargin_3, &nth_rt, &iterations, *hstry);
  101   
  102     /* Marshall function outputs */
  103     plhs[0] = emlrt_marshallOut(nth_rt);
  104     plhs[1] = emlrt_marshallOut(iterations);
  105     plhs[2] = b_emlrt_marshallOut(*hstry);
  106   }
  107   
  108   /* End of code generation (_coder_nrt_api.c) */
  109