/*--------------------------------------------------------------------------*/
types::Function::ReturnValue sci_getsystemmetrics(types::typed_list &in, int _iRetCount, types::typed_list &out)
{
    types::String* pS = nullptr;
    std::wstring param1;

    if (in.size() != 1)
    {
        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname.data(), 1);
        return types::Function::Error;
    }

    if (_iRetCount != 1)
    {
        Scierror(999, _("%s: Wrong number of output arguments: %d expected.\n"), fname.data(), 1);
        return types::Function::Error;
    }

    pS = in[0]->getAs<types::String>();
    param1 = pS->get()[0];

    int val = getnIndexFromString(param1);
    if (val != -1)
    {
        out.push_back(new types::Double(GetSystemMetrics(val)));
    }
    else
    {
        Scierror(999, _("%s: Wrong value for input argument: %s.\n"), fname.data(), _("see help"));
        return types::Function::Error;
    }
    return types::Function::OK;
}
/*--------------------------------------------------------------------------*/
int sci_getsystemmetrics(char *fname, unsigned long l)
{
    char *param = NULL;
    int nIndex = -1;
    int m1 = 0;
    int n1 = 0;
    int l1 = 0;

    CheckRhs(1, 1);

    if (GetType(1) != sci_strings)
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
        return 0;
    }

    GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);
    param = cstk(l1);

    nIndex = getnIndexFromString(param);
    if ( nIndex > -1 )
    {
        int one = 1;
        CreateVar(Rhs + 1, MATRIX_OF_INTEGER_DATATYPE, &one, &one, &l1);
        *istk(l1) = GetSystemMetrics(nIndex);
        LhsVar(1) = Rhs + 1;

        PutLhsVar();
    }
    else
    {
        Scierror(999, _("%s: Wrong value for input argument: %s.\n"), fname, _("see help"));
    }
    return 0;
}