.eggs/Cython-0.29.24-py3.8-linux-x86_64.egg/Cython/Utility/Buffer.c
/* Parse an array in the format string (e.g. (1,2,3)) */
Parse an array in the format string )
Parse an array in the format string )
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number, ndim;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    ndim = ctx->head->field->type->ndim;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;  
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static PyObject * __pyx_buffmt_parse_array ( __Pyx_BufFmt_Context * ctx , const char * * tsp ) { const char * ts = * tsp ; int i = 0 , number , ndim ; ++ ts ; if ( ctx -> new_count != 1 ) { PyErr_SetString ( PyExc_ValueError , " " ) ; return NULL ; } if ( __Pyx_BufFmt_ProcessTypeChunk ( ctx ) == -1 ) return NULL ; ndim = ctx -> head -> field -> type -> ndim ; while ( * ts && * ts != ' ' ) { switch ( * ts ) { case ' ' : case ' \f ' : case ' \r ' : case ' \n ' : case ' \t ' : case ' \v ' : continue ; default : break ; } number = __Pyx_BufFmt_ExpectNumber ( & ts ) ; if ( number == -1 ) return NULL ; if ( i < ndim && ( size_t ) number != ctx -> head -> field -> type -> arraysize [ i ] ) return PyErr_Format ( PyExc_ValueError , " " , ctx -> head -> field -> type -> arraysize [ i ] , number ) ; if ( * ts != ' ' && * ts != ' ' ) return PyErr_Format ( PyExc_ValueError , " " , * ts ) ; if ( * ts == ' ' ) ts ++ ; i ++ ; } if ( i != ndim ) return PyErr_Format ( PyExc_ValueError , " " , ctx -> head -> field -> type -> ndim , i ) ; if ( ! * ts ) { PyErr_SetString ( PyExc_ValueError , " " ) ; return NULL ; } ctx -> is_valid_array = 1 ; ctx -> new_count = 1 ; * tsp = ++ ts ; return Py_None ; }
Parse an array in the format string (e.g.
Parse an array in the format string ( e . g .
/* Process the previous element */ // store ndim now, as field advanced by __Pyx_BufFmt_ProcessTypeChunk call /* Parse all numbers in the format string */ // ignore space characters (not using isspace() due to C/C++ problem on MacOS-X) /* not a 'break' in the loop */