This commit is contained in:
Vitor Santos Costa
2018-03-12 15:11:59 +00:00
parent 31fd3eb344
commit 1a8c26b886
32 changed files with 442 additions and 307 deletions

View File

@@ -35,6 +35,7 @@ static PyObject *s_to_python(const char *s, bool eval, PyObject *p0) {
// char *ns = Py_Malloc(strlen(s)+1);
/// strcpy(ns,s);
PyObject *pobj = PyUnicode_FromString(s);
Py_INCREF(pobj);
return pobj;
}
}
@@ -48,6 +49,8 @@ static PyObject *s_to_python(const char *s, bool eval, PyObject *p0) {
* @return a Python object descriptor or NULL if failed
*/
X_API PyObject *string_to_python(const char *s, bool eval, PyObject *p0) {
char *buf = malloc(strlen(s) + 1), *child;
while ((child = strchr(s, '.')) != NULL) {
size_t len = child - s;
@@ -341,6 +344,7 @@ PyObject *term_to_python(term_t t, bool eval, PyObject *o, bool cvt) {
AOK(PL_get_arg(1, t, t), NULL);
if (!(dict = PyDict_New()))
return NULL;
Py_INCREF(dict);
DebugPrintf("Dict %p\n", dict);
while (PL_is_functor(t, FUNCTOR_comma2)) {