Esempio n. 1
0
static PyObject *
Splitter_indexes(Splitter *self, PyObject *args)
{
    int i=0, size;
    PyObject *word=NULL,*item=NULL,*r=NULL,*index=NULL;

    if (! (PyArg_ParseTuple(args,"O",&word)))
        return NULL;
    if (! (r=PyList_New(0)))
        return NULL;

    size = PyList_Size(self->list);
    for (i=0;i<size;i++) {
        item=PyList_GET_ITEM(self->list,i);

        if (PyUnicode_Compare(word,item)==0) {
            index=INT_FROM_LONG(i);
            if(!index)
                return NULL;
            PyList_Append(r,index);
        }
    }

    return r;
}
Esempio n. 2
0
static PyObject *
longlong_as_object(PY_LONG_LONG val)
{
    if ((val > LONG_MAX) || (val < LONG_MIN))
        return PyLong_FromLongLong(val);
    return INT_FROM_LONG((long)val);
}
Esempio n. 3
0
static PyObject *
longlong_as_object(PY_LONG_LONG val)
{
    static PY_LONG_LONG maxint = 0;

    if (maxint == 0)
        maxint = INT_GETMAX();
    if ((val > maxint) || (val < (-maxint-1)))
        return PyLong_FromLongLong(val);
    return INT_FROM_LONG((long)val);
}
Esempio n. 4
0
static PyObject *
IndexError(int i)
{
    PyObject *v;

    v = INT_FROM_LONG(i);
    if (!v) {
	v = Py_None;
	Py_INCREF(v);
    }
    PyErr_SetObject(PyExc_IndexError, v);
    Py_DECREF(v);
    return NULL;
}
Esempio n. 5
0
static PyObject *
Per_get_estimated_size(cPersistentObject *self)
{
    return INT_FROM_LONG(_estimated_size_in_bytes(self->estimated_size));
}
Esempio n. 6
0
static PyObject *
Per_get_state(cPersistentObject *self)
{
    return INT_FROM_LONG(self->state);
}