Ejemplo n.º 1
0
static bool read_short_data(int dataset, VarInfo6& info)
{
    char* ctype = getScilabTypeFromDataSet6(dataset);
    std::string type(ctype);
    FREE(ctype);
    info.ctype = type;

    if (type == g_SCILAB_CLASS_DOUBLE)
    {
        info.type = sci_matrix;
    }
    else if (type == g_SCILAB_CLASS_STRING)
    {
        info.type = sci_strings;
    }
    else if (type == g_SCILAB_CLASS_LIST)
    {
        info.type = sci_list;
    }
    else if (type == g_SCILAB_CLASS_TLIST)
    {
        info.type = sci_tlist;
    }
    else if (type == g_SCILAB_CLASS_MLIST)
    {
        info.type = sci_mlist;
    }
    else if (type == g_SCILAB_CLASS_BOOLEAN)
    {
        info.type = sci_boolean;
    }
    else if (type == g_SCILAB_CLASS_POLY)
    {
        info.type = sci_poly;
    }
    else if (type == g_SCILAB_CLASS_INT)
    {
        info.type = sci_ints;
    }
    else if (type == g_SCILAB_CLASS_SPARSE)
    {
        info.type = sci_sparse;
    }
    else if (type == g_SCILAB_CLASS_BSPARSE)
    {
        info.type = sci_boolean_sparse;
    }
    else if (type == g_SCILAB_CLASS_VOID)
    {
        info.type = sci_void;
    }
    else if (type == g_SCILAB_CLASS_UNDEFINED)
    {
        info.type = sci_undefined;
    }
    else if (type == g_SCILAB_CLASS_STRUCT)
    {
        info.type = sci_mlist;
    }
    else if (type == g_SCILAB_CLASS_CELL)
    {
        info.type = sci_mlist;
    }
    else if (type == g_SCILAB_CLASS_HANDLE)
    {
        info.type = sci_handles;
    }
    else if (type == g_SCILAB_CLASS_MACRO)
    {
        info.type = sci_c_function;
    }
    else if (type == g_SCILAB_CLASS_USERTYPE)
    {
        info.type = sci_pointer;
    }
    else
    {
        Scierror(999, _("%s: Invalid HDF5 Scilab format.\n"), "listvar_in_hdf5");
        return false;
    }

    return true;
}
Ejemplo n.º 2
0
static bool read_data(int dataset, VarInfo6& info)
{
    bool bRet = false;

    char* ctype = getScilabTypeFromDataSet6(dataset);
    std::string type(ctype);
    FREE(ctype);
    info.ctype = type;

    if (type == g_SCILAB_CLASS_DOUBLE)
    {
        info.type = sci_matrix;
        return read_double(dataset, info);
    }

    if (type == g_SCILAB_CLASS_STRING)
    {
        info.type = sci_strings;
        return read_string(dataset, info);
    }

    if (type == g_SCILAB_CLASS_LIST)
    {
        info.type = sci_list;
        return read_list(dataset, info, "list");
    }

    if (type == g_SCILAB_CLASS_TLIST)
    {
        info.type = sci_tlist;
        return read_list(dataset, info, "tlist");
    }

    if (type == g_SCILAB_CLASS_MLIST)
    {
        info.type = sci_mlist;
        return read_list(dataset, info, "mlist");
    }

    if (type == g_SCILAB_CLASS_BOOLEAN)
    {
        info.type = sci_boolean;
        return read_boolean(dataset, info);
    }

    if (type == g_SCILAB_CLASS_POLY)
    {
        info.type = sci_poly;
        return read_poly(dataset, info);
    }

    if (type == g_SCILAB_CLASS_INT)
    {
        info.type = sci_ints;
        return read_integer(dataset, info);
    }

    if (type == g_SCILAB_CLASS_SPARSE)
    {
        info.type = sci_sparse;
        return read_sparse(dataset, info);
    }

    if (type == g_SCILAB_CLASS_BSPARSE)
    {
        info.type = sci_boolean_sparse;
        return read_boolean_sparse(dataset, info);
    }

    if (type == g_SCILAB_CLASS_VOID)
    {
        info.type = sci_void;
        return read_void(dataset, info);
    }

    if (type == g_SCILAB_CLASS_UNDEFINED)
    {
        info.type = sci_undefined;
        return read_undefined(dataset, info);
    }

    if (type == g_SCILAB_CLASS_STRUCT)
    {
        info.type = sci_mlist;
        return read_struct(dataset, info);
    }

    if (type == g_SCILAB_CLASS_CELL)
    {
        info.type = sci_mlist;
        return read_cell(dataset, info);
    }

    if (type == g_SCILAB_CLASS_HANDLE)
    {
        info.type = sci_handles;
        return read_handles(dataset, info);
    }

    if (type == g_SCILAB_CLASS_MACRO)
    {
        info.type = sci_c_function;
        return read_macro(dataset, info);
    }

    Scierror(999, _("%s: Invalid HDF5 Scilab format.\n"), "listvar_in_hdf5");
    return false;
}
Ejemplo n.º 3
0
types::InternalType* import_data(int dataset)
{
    //get var type
    char* ctype = getScilabTypeFromDataSet6(dataset);
    std::string type(ctype);
    FREE(ctype);

    if (type == g_SCILAB_CLASS_DOUBLE)
    {
        return import_double(dataset);
    }

    if (type == g_SCILAB_CLASS_STRING)
    {
        return import_string(dataset);
    }

    if (type == g_SCILAB_CLASS_INT)
    {
        return import_int(dataset);
    }

    if (type == g_SCILAB_CLASS_BOOLEAN)
    {
        return import_boolean(dataset);
    }

    if (type == g_SCILAB_CLASS_LIST)
    {
        return import_list(dataset, new types::List());
    }

    if (type == g_SCILAB_CLASS_TLIST)
    {
        return import_list(dataset, new types::TList());
    }

    if (type == g_SCILAB_CLASS_MLIST)
    {
        return import_list(dataset, new types::MList());
    }

    if (type == g_SCILAB_CLASS_STRUCT)
    {
        return import_struct(dataset);
    }

    if (type == g_SCILAB_CLASS_POLY)
    {
        return import_poly(dataset);
    }

    if (type == g_SCILAB_CLASS_SPARSE)
    {
        return import_sparse(dataset);
    }

    if (type == g_SCILAB_CLASS_BSPARSE)
    {
        return import_boolean_sparse(dataset);
    }

    if (type == g_SCILAB_CLASS_CELL)
    {
        return import_cell(dataset);
    }

    if (type == g_SCILAB_CLASS_HANDLE)
    {
        return import_handles(dataset);
    }

    if (type == g_SCILAB_CLASS_MACRO)
    {
        return import_macro(dataset);
    }

    if (type == g_SCILAB_CLASS_VOID)
    {
        closeDataSet(dataset);
        return new types::Void();
    }

    if (type == g_SCILAB_CLASS_UNDEFINED)
    {
        closeDataSet(dataset);
        return new types::ListUndefined();
    }

    if (type == g_SCILAB_CLASS_USERTYPE)
    {
        return import_usertype(dataset);
    }


    return nullptr;
}