Lines Matching defs:obj

8 _basic_ucl_type (ucl_object_t const *obj)
10 switch (obj->type) {
12 return Py_BuildValue ("L", (long long)ucl_object_toint (obj));
14 return Py_BuildValue ("d", ucl_object_todouble (obj));
16 return Py_BuildValue ("s", ucl_object_tostring (obj));
18 return PyBool_FromLong (ucl_object_toboolean (obj));
20 return Py_BuildValue ("d", ucl_object_todouble (obj));
28 _iterate_valid_ucl (ucl_object_t const *obj)
33 tmp = obj;
35 while ((obj = ucl_object_iterate (tmp, &it, false))) {
38 val = _basic_ucl_type(obj);
42 if (obj->key != NULL) {
43 key = Py_BuildValue("s", ucl_object_key(obj));
46 if (obj->type == UCL_OBJECT) {
52 while ((cur = ucl_object_iterate (obj, &it_obj, true))) {
56 } else if (obj->type == UCL_ARRAY) {
62 while ((cur = ucl_object_iterate (obj, &it_obj, true))) {
65 } else if (obj->type == UCL_USERDATA) {
69 val = PyBytes_FromString(obj->value.ud);
127 _iterate_python (PyObject *obj)
129 if (obj == Py_None) {
132 else if (PyBool_Check (obj)) {
133 return ucl_object_frombool (obj == Py_True);
136 else if (PyInt_Check (obj)) {
137 return ucl_object_fromint (PyInt_AsLong (obj));
140 else if (PyLong_Check (obj)) {
141 return ucl_object_fromint (PyLong_AsLong (obj));
143 else if (PyFloat_Check (obj)) {
144 return ucl_object_fromdouble (PyFloat_AsDouble (obj));
146 else if (PyUnicode_Check (obj)) {
148 PyObject *str = PyUnicode_AsASCIIString(obj);
154 else if (PyString_Check (obj)) {
155 return ucl_object_fromstring (PyString_AsString (obj));
158 else if (PyDict_Check(obj)) {
166 while (PyDict_Next(obj, &pos, &key, &value)) {
189 else if (PySequence_Check(obj)) {
194 len = PySequence_Length(obj);
198 value = PySequence_GetItem(obj, pos);
216 PyObject *obj;
222 if (!PyArg_ParseTuple(args, "O|i", &obj, &emitter)) {
232 if (obj == Py_None) {
236 root = _iterate_python(obj);