/*
 * _coder_test_call_mex.cpp
 *
 * Code generation for function '_coder_test_call_mex'
 *
 */

/* Include files */
#include "test_call.h"
#include "_coder_test_call_mex.h"
#include "test_call_terminate.h"
#include "_coder_test_call_api.h"
#include "test_call_initialize.h"
#include "test_call_data.h"

/* Function Declarations */
static void test_call_mexFunction(int32_T nlhs, mxArray *plhs[1], int32_T nrhs,
  const mxArray *prhs[1]);

/* Function Definitions */
static void test_call_mexFunction(int32_T nlhs, mxArray *plhs[1], int32_T nrhs,
  const mxArray *prhs[1])
{
  const mxArray *outputs[1];
  emlrtStack st = { NULL,              /* site */
    NULL,                              /* tls */
    NULL                               /* prev */
  };

  st.tls = emlrtRootTLSGlobal;

  /* Check for proper number of arguments. */
  if (nrhs != 1) {
    emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, 12, 1, 4, 9,
                        "test_call");
  }

  if (nlhs > 1) {
    emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, 4, 9,
                        "test_call");
  }

  /* Call the function. */
  test_call_api(prhs, nlhs, outputs);

  /* Copy over outputs to the caller. */
  emlrtReturnArrays(1, plhs, outputs);
}

void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  mexAtExit(test_call_atexit);

  /* Module initialization. */
  test_call_initialize();

  /* Dispatch the entry-point. */
  test_call_mexFunction(nlhs, plhs, nrhs, prhs);

  /* Module termination. */
  test_call_terminate();
}

emlrtCTX mexFunctionCreateRootTLS()
{
  emlrtCreateRootTLS(&emlrtRootTLSGlobal, &emlrtContextGlobal, NULL, 1);
  return emlrtRootTLSGlobal;
}

/* End of code generation (_coder_test_call_mex.cpp) */
