コード例 #1
0
ファイル: _csv.c プロジェクト: Oize/pspstacklesspython
			PyErr_Format(error_obj, "%c expected after %c", 
					dialect->delimiter, 
                                        dialect->quotechar);
		}
		break;

	}
}

/*
 * READER
 */
#define R_OFF(x) offsetof(ReaderObj, x)

static struct PyMemberDef Reader_memberlist[] = {
	{ "dialect", T_OBJECT, R_OFF(dialect), RO },
	{ NULL }
};

static PyObject *
Reader_getiter(ReaderObj *self)
{
	Py_INCREF(self);
	return (PyObject *)self;
}

static PyObject *
Reader_iternext(ReaderObj *self)
{
        PyObject *lineobj;
        PyObject *fields;
コード例 #2
0
ファイル: _csv.c プロジェクト: AbnerChang/edk2-staging
}

PyDoc_STRVAR(Reader_Type_doc,
"CSV reader\n"
"\n"
"Reader objects are responsible for reading and parsing tabular data\n"
"in CSV format.\n"
);

static struct PyMethodDef Reader_methods[] = {
    { NULL, NULL }
};
#define R_OFF(x) offsetof(ReaderObj, x)

static struct PyMemberDef Reader_memberlist[] = {
    { "dialect", T_OBJECT, R_OFF(dialect), RO },
    { "line_num", T_ULONG, R_OFF(line_num), RO },
    { NULL }
};


static PyTypeObject Reader_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_csv.reader",                          /*tp_name*/
    sizeof(ReaderObj),                      /*tp_basicsize*/
    0,                                      /*tp_itemsize*/
    /* methods */
    (destructor)Reader_dealloc,             /*tp_dealloc*/
    (printfunc)0,                           /*tp_print*/
    (getattrfunc)0,                         /*tp_getattr*/
    (setattrfunc)0,                         /*tp_setattr*/
コード例 #3
0
ファイル: csv.c プロジェクト: takada-at/logq
PyDoc_STRVAR(CSVParser_Type_doc,
"CSV reader\n"
"\n"
"CSVParser objects are responsible for reading and parsing tabular data\n"
"in CSV format.\n"
);

static struct PyMethodDef CSVParser_methods[] = {
    {"read", (PyCFunction)CSVParser_read, METH_VARARGS, ""},
    {"eof", (PyCFunction)CSVParser_feof, METH_NOARGS, ""},
    { NULL, NULL }
};
#define R_OFF(x) offsetof(CSVParser, x)

static struct PyMemberDef CSVParser_memberlist[] = {
    { "engine", T_ULONG, R_OFF(engine), RO },
    { "pyfile", T_ULONG, R_OFF(pyfile), RO },
    { "fields", T_ULONG, R_OFF(fields), RO },
    { "line_num", T_ULONG, R_OFF(line_num), RO },
    { NULL }
};


static PyTypeObject CSVParser_Type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "engine.CSVParser",                     /*tp_name*/
    sizeof(CSVParser),                      /*tp_basicsize*/
    0,                                      /*tp_itemsize*/
    /* methods */
    (destructor)CSVParser_dealloc,             /*tp_dealloc*/
    (printfunc)0,                           /*tp_print*/