Example #1
0
static void sf_gateway_c5_testYarpReadSHORE(SFc5_testYarpReadSHOREInstanceStruct
  *chartInstance)
{
  real_T c5_hoistedGlobal;
  real_T c5_b_hoistedGlobal;
  real_T c5_c_hoistedGlobal;
  real_T c5_nextX;
  real_T c5_currentX;
  real_T c5_oldX;
  uint32_T c5_debug_family_var_map[9];
  real_T c5_nx;
  real_T c5_cx;
  real_T c5_ox;
  real_T c5_nargin = 3.0;
  real_T c5_nargout = 1.0;
  real_T c5_y;
  real_T *c5_b_nextX;
  real_T *c5_b_currentX;
  real_T *c5_b_y;
  real_T *c5_b_oldX;
  boolean_T guard1 = false;
  c5_b_oldX = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c5_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c5_b_currentX = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c5_b_nextX = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
  _sfTime_ = sf_get_time(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c5_b_nextX, 0U);
  _SFD_DATA_RANGE_CHECK(*c5_b_currentX, 1U);
  chartInstance->c5_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  c5_hoistedGlobal = *c5_b_nextX;
  c5_b_hoistedGlobal = *c5_b_currentX;
  c5_c_hoistedGlobal = *c5_b_oldX;
  c5_nextX = c5_hoistedGlobal;
  c5_currentX = c5_b_hoistedGlobal;
  c5_oldX = c5_c_hoistedGlobal;
  _SFD_SYMBOL_SCOPE_PUSH_EML(0U, 9U, 9U, c5_debug_family_names,
    c5_debug_family_var_map);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nx, 0U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_cx, 1U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_ox, 2U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargin, 3U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_nargout, 4U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_nextX, 5U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_currentX, 6U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML(&c5_oldX, 7U, c5_sf_marshallOut);
  _SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c5_y, 8U, c5_sf_marshallOut,
    c5_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 7);
  if (CV_EML_IF(0, 1, 0, c5_nextX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 8);
    c5_nx = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 10);
    c5_nx = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 12);
  if (CV_EML_IF(0, 1, 1, c5_currentX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 13);
    c5_cx = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 15);
    c5_cx = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 17);
  if (CV_EML_IF(0, 1, 2, c5_oldX > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 18);
    c5_ox = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 20);
    c5_ox = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 23);
  guard1 = false;
  if (CV_EML_COND(0, 1, 0, c5_nx != c5_cx)) {
    if (CV_EML_COND(0, 1, 1, c5_cx != c5_ox)) {
      CV_EML_MCDC(0, 1, 0, true);
      CV_EML_IF(0, 1, 3, true);
      _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 24);
      c5_currentX = c5_oldX;
    } else {
      guard1 = true;
    }
  } else {
    guard1 = true;
  }

  if (guard1 == true) {
    CV_EML_MCDC(0, 1, 0, false);
    CV_EML_IF(0, 1, 3, false);
  }

  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, 26);
  c5_y = c5_currentX;
  _SFD_EML_CALL(0U, chartInstance->c5_sfEvent, -26);
  _SFD_SYMBOL_SCOPE_POP();
  *c5_b_y = c5_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c5_sfEvent);
  _SFD_SYMBOL_SCOPE_POP();
  _SFD_CHECK_FOR_STATE_INCONSISTENCY(_testYarpReadSHOREMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
  _SFD_DATA_RANGE_CHECK(*c5_b_y, 2U);
  _SFD_DATA_RANGE_CHECK(*c5_b_oldX, 3U);
}