//
// MATLAB Compiler: 2.2
// Date: Wed Mar 10 16:44:48 2004
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-p" "-W" "main" "-L"
// "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "hier_community.m" "Default.m" "Stop_Simulation.m"
// "Call_SaveLoad_Fig.m" "SaveLoad_Fig.m" "SaveLoad.m" "Load_Population_Data.m"
// "Save_Population_Data.m" "Start_hier_community.m" "MyInline.m" "My_Eval.m"
// "isnumber.m" "Find_Var.m" "Change_Number_of_Populations.m"
// "Switch_Populations.m" "Store_Parameters.m" 
//
#include "isnumber.hpp"
#include "libmatlbm.hpp"

static mxChar _array1_[134] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'i', 's', 'n', 'u', 'm',
                                'b', 'e', 'r', ' ', 'L', 'i', 'n', 'e', ':',
                                ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n',
                                ':', ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f',
                                'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '"',
                                'i', 's', 'n', 'u', 'm', 'b', 'e', 'r', '"',
                                ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l', 'l',
                                'e', 'd', ' ', 'w', 'i', 't', 'h', ' ', 'm',
                                'o', 'r', 'e', ' ', 't', 'h', 'a', 'n', ' ',
                                't', 'h', 'e', ' ', 'd', 'e', 'c', 'l', 'a',
                                'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b', 'e',
                                'r', ' ', 'o', 'f', ' ', 'o', 'u', 't', 'p',
                                'u', 't', 's', ' ', '(', '1', ')', '.' };
static mwArray _mxarray0_ = mclInitializeString(134, _array1_);

static mxChar _array3_[133] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
                                'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
                                'l', 'e', ':', ' ', 'i', 's', 'n', 'u', 'm',
                                'b', 'e', 'r', ' ', 'L', 'i', 'n', 'e', ':',
                                ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm', 'n',
                                ':', ' ', '1', ' ', 'T', 'h', 'e', ' ', 'f',
                                'u', 'n', 'c', 't', 'i', 'o', 'n', ' ', '"',
                                'i', 's', 'n', 'u', 'm', 'b', 'e', 'r', '"',
                                ' ', 'w', 'a', 's', ' ', 'c', 'a', 'l', 'l',
                                'e', 'd', ' ', 'w', 'i', 't', 'h', ' ', 'm',
                                'o', 'r', 'e', ' ', 't', 'h', 'a', 'n', ' ',
                                't', 'h', 'e', ' ', 'd', 'e', 'c', 'l', 'a',
                                'r', 'e', 'd', ' ', 'n', 'u', 'm', 'b', 'e',
                                'r', ' ', 'o', 'f', ' ', 'i', 'n', 'p', 'u',
                                't', 's', ' ', '(', '1', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(133, _array3_);

static mxChar _array7_[1] = { '0' };
static mxArray * _mxarray6_ = mclInitializeString(1, _array7_);

static mxChar _array9_[1] = { '1' };
static mxArray * _mxarray8_ = mclInitializeString(1, _array9_);

static mxChar _array11_[1] = { '2' };
static mxArray * _mxarray10_ = mclInitializeString(1, _array11_);

static mxChar _array13_[1] = { '3' };
static mxArray * _mxarray12_ = mclInitializeString(1, _array13_);

static mxChar _array15_[1] = { '4' };
static mxArray * _mxarray14_ = mclInitializeString(1, _array15_);

static mxChar _array17_[1] = { '5' };
static mxArray * _mxarray16_ = mclInitializeString(1, _array17_);

static mxChar _array19_[1] = { '6' };
static mxArray * _mxarray18_ = mclInitializeString(1, _array19_);

static mxChar _array21_[1] = { '7' };
static mxArray * _mxarray20_ = mclInitializeString(1, _array21_);

static mxChar _array23_[1] = { '8' };
static mxArray * _mxarray22_ = mclInitializeString(1, _array23_);

static mxChar _array25_[1] = { '9' };
static mxArray * _mxarray24_ = mclInitializeString(1, _array25_);

static mxArray * _array5_[10] = { _mxarray6_, _mxarray8_, _mxarray10_,
                                  _mxarray12_, _mxarray14_, _mxarray16_,
                                  _mxarray18_, _mxarray20_, _mxarray22_,
                                  _mxarray24_ };
static mwArray _mxarray4_ = mclInitializeCellVector(1, 10, _array5_);
static mwArray _mxarray26_ = mclInitializeDoubleVector(0, 0, (double *)NULL);

void InitializeModule_isnumber() {
}

void TerminateModule_isnumber() {
    mxDestroyArray(_mxarray24_);
    mxDestroyArray(_mxarray22_);
    mxDestroyArray(_mxarray20_);
    mxDestroyArray(_mxarray18_);
    mxDestroyArray(_mxarray16_);
    mxDestroyArray(_mxarray14_);
    mxDestroyArray(_mxarray12_);
    mxDestroyArray(_mxarray10_);
    mxDestroyArray(_mxarray8_);
    mxDestroyArray(_mxarray6_);
}

static mwArray Misnumber(int nargout_, mwArray var);

_mexLocalFunctionTable _local_function_table_isnumber
  = { 0, (mexFunctionTableEntry *)NULL };

//
// The function "isnumber" contains the normal interface for the "isnumber"
// M-function from file "C:\shu\hier_community_exe\isnumber.m" (lines 1-6).
// This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
mwArray isnumber(mwArray var) {
    int nargout(1);
    mwArray value(mclGetUninitializedArray());
    value = Misnumber(nargout, var);
    return value;
}

//
// The function "mlxIsnumber" contains the feval interface for the "isnumber"
// M-function from file "C:\shu\hier_community_exe\isnumber.m" (lines 1-6). The
// feval function calls the implementation version of isnumber through this
// function. This function processes any input arguments and passes them to the
// implementation version of the function, appearing above.
//
void mlxIsnumber(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[1];
        mwArray mplhs[1];
        int i;
        mclCppUninitializeArrays(1, mplhs);
        if (nlhs > 1) {
            error(_mxarray0_);
        }
        if (nrhs > 1) {
            error(_mxarray2_);
        }
        for (i = 0; i < 1 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 1; ++i) {
            mprhs[i].MakeDIN();
        }
        mplhs[0] = Misnumber(nlhs, mprhs[0]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Misnumber" is the implementation version of the "isnumber"
// M-function from file "C:\shu\hier_community_exe\isnumber.m" (lines 1-6). It
// contains the actual compiled code for that M-function. It is a static
// function and must only be called from one of the interface functions,
// appearing below.
//
//
// function value = isnumber(var)
//
static mwArray Misnumber(int nargout_, mwArray var) {
    mwLocalFunctionTable save_local_function_table_
      (&_local_function_table_isnumber);
    mwArray value(mclGetUninitializedArray());
    mwArray i(mclGetUninitializedArray());
    mwArray num(mclGetUninitializedArray());
    //
    // 
    // num = [{'0'},{'1'},{'2'},{'3'},{'4'},{'5'},{'6'},{'7'},{'8'},{'9'}];
    //
    num = _mxarray4_;
    //
    // for i=1:length(var)
    //
    {
        int v_(mclForIntStart(1));
        int e_(mclForIntEnd(mwArray(mclLengthInt(mwVa(var, "var")))));
        if (v_ > e_) {
            i = _mxarray26_;
        } else {
            //
            // value(i) = any(strcmp(var(i),num));
            // end
            //
            for (; ; ) {
                mclIntArrayAssign(
                  &value,
                  any(
                    mwVe(
                      strcmp(
                        mwVe(mclIntArrayRef(mwVsa(var, "var"), v_)),
                        mwVv(num, "num")))),
                  v_);
                if (v_ == e_) {
                    break;
                }
                ++v_;
            }
            i = v_;
        }
    }
    mwValidateOutput(value, 1, nargout_, "value", "isnumber");
    return value;
}
