logging goes to stdout now
[swftools.git] / lib / python / pyutils.c
index 2fdc0e1..95c222b 100644 (file)
@@ -20,7 +20,7 @@ char* setError(char*format, ...)
     return strdup(buf);
 }
 
-static int verbose = 1;
+int verbose = 1;
 void mylog(char*format, ...)
 {
     char buf[1024];
@@ -36,8 +36,8 @@ void mylog(char*format, ...)
        buf[l-1] = 0;
        l--;
     }
-    fprintf(stderr, "[SWF] %s\n", buf);
-    fflush(stderr);
+    fprintf(stdout, "[SWF] %s\n", buf);
+    fflush(stdout);
 }
 
 #define PY_NONE Py_BuildValue("s", 0)
@@ -64,3 +64,19 @@ void dummy_dealloc(PyObject* self)
     PyObject_Del(self);
 }
 
+PyMethodDef* addMethods(PyMethodDef*obj1, PyMethodDef*obj2) 
+{
+    int num1=0,num2=0;
+    if(obj1) for(num1=0;obj1[num1].ml_name;num1++);
+    if(obj2) for(num2=0;obj2[num2].ml_name;num2++);
+    PyMethodDef* result = malloc(sizeof(PyMethodDef)*(num1+num2+1));
+    memcpy(result, obj1, num1*sizeof(PyMethodDef));
+    memcpy(&result[num1], obj2, (num2+1)*sizeof(PyMethodDef));
+    //free(obj1)?
+    return result;
+}
+void setVerbosity(int _verbose)
+{
+    verbose = _verbose;
+    mylog("setting verbosity to %d", verbose);
+}