[Xcircuit-dev] patch for 3.3.36: events.c, prototypes.h, python.c

ldoolitt at recycle.lbl.gov ldoolitt at recycle.lbl.gov
Tue Jun 27 14:03:41 PDT 2006


Change log:
  Fix typo in events.c (broke non-Tcl compilation)
  Use long instead of int to hold integer version of pointers in python.c
  Add python_key_command() to prototype.c
Enjoy!
   - Larry

diff --exclude=configure -ur xcircuit-3.6.36/events.c xcircuit-3.6.36-lrd/events.c
--- xcircuit-3.6.36/events.c	2006-06-21 23:46:12.000000000 -0700
+++ xcircuit-3.6.36-lrd/events.c	2006-06-27 12:47:38.000000000 -0700
@@ -1759,7 +1759,7 @@
 	 result = dospecial();
 	 break;
 #ifndef TCL_WRAPPER
-      case XCF_Parameter;
+      case XCF_Parameter:
 	 insertparam();
 	 break;
 #endif
diff --exclude=configure -ur xcircuit-3.6.36/prototypes.h xcircuit-3.6.36-lrd/prototypes.h
--- xcircuit-3.6.36/prototypes.h	2006-06-14 17:44:34.000000000 -0700
+++ xcircuit-3.6.36-lrd/prototypes.h	2006-06-27 12:51:57.000000000 -0700
@@ -742,6 +742,7 @@
 /* from python.c: */
 
 #ifdef HAVE_PYTHON
+extern int python_key_command(int);
 extern void init_interpreter(void);
 extern void exit_interpreter(void);
 #endif
diff --exclude=configure -ur xcircuit-3.6.36/python.c xcircuit-3.6.36-lrd/python.c
--- xcircuit-3.6.36/python.c	2006-05-20 13:01:37.000000000 -0700
+++ xcircuit-3.6.36-lrd/python.c	2006-06-27 13:01:32.000000000 -0700
@@ -605,14 +605,15 @@
 genericptr *CheckHandle(PyObject *ehandle)
 {
    genericptr *gelem;
-   int i, j, eaddr;
+   int i, j;
+   long int eaddr;
    objectptr thisobj;
    Library *thislib;
 
-   eaddr = (int)PyInt_AsLong(ehandle);
+   eaddr = PyInt_AsLong(ehandle);
    for (gelem = topobject->plist; gelem < topobject->plist +
 	topobject->parts; gelem++)
-      if ((int)(*gelem) == eaddr) goto exists;
+      if ((long int)(*gelem) == eaddr) goto exists;
 
    /* Okay, it isn't in topobject.  Try all other pages. */
 
@@ -620,7 +621,7 @@
       if (xobjs.pagelist[i]->pageinst == NULL) continue;
       thisobj = xobjs.pagelist[i]->pageinst->thisobject;
       for (gelem = thisobj->plist; gelem < thisobj->plist + thisobj->parts; gelem++)
-         if ((int)(*gelem) == eaddr) goto exists;
+         if ((long int)(*gelem) == eaddr) goto exists;
    }
 
    /* Still not found?  Maybe in a library */
@@ -630,7 +631,7 @@
       for (j = 0; j < thislib->number; j++) {
          thisobj = thislib->library[j];
          for (gelem = thisobj->plist; gelem < thisobj->plist + thisobj->parts; gelem++)
-            if ((int)(*gelem) == eaddr) goto exists;
+            if ((long int)(*gelem) == eaddr) goto exists;
       }
    }
 
@@ -648,9 +649,10 @@
 
 objectptr CheckPageHandle(PyObject *ehandle)
 {
-   int eaddr, pageno;
+   int pageno;
+   long int eaddr;
 
-   eaddr = (int)PyInt_AsLong(ehandle);
+   eaddr = PyInt_AsLong(ehandle);
    pageno = is_page((objectptr)eaddr);
    if (pageno < 0) return NULL;
    return (objectptr)eaddr;
@@ -1734,7 +1736,7 @@
 {  
    int status;
 
-   sprintf(_STR2, "buttondict[%d]()\n", w);
+   sprintf(_STR2, "buttondict[%ld]()\n", (long int)w);
    status = PyRun_SimpleString(_STR2);
    refresh(NULL, NULL, NULL);
    return status;
@@ -1764,7 +1766,7 @@
    }
    if (i == MaxMenuWidgets) {
       Wprintf("Cannot find specified menu.");
-      return;
+      return NULL;
    }
 
    XtnSetArg(XtNfont, appdata.xcfont);
@@ -1774,7 +1776,7 @@
    XtAddCallback (newbutton, XtNselect, (XtCallbackProc)pybutton, newbutton);
    XtManageChild(newbutton);
 
-   sprintf(_STR2, "buttondict[%d] = %s\n", newbutton, pfunction);
+   sprintf(_STR2, "buttondict[%ld] = %s\n", (long int)newbutton, pfunction);
    status = PyRun_SimpleString(_STR2);
    return PyInt_FromLong((long)status);
 }
@@ -1789,7 +1791,7 @@
 {  
    int status;
 
-   sprintf(_STR2, "tooldict[%d]()\n", w);
+   sprintf(_STR2, "tooldict[%ld]()\n", (long int)w);
    status = PyRun_SimpleString(_STR2);
    refresh(NULL, NULL, NULL);
    return status;
@@ -1839,7 +1841,7 @@
    XtAddCallback (newtool, XtNselect, (XtCallbackProc)pybutton, newtool);
    XtManageChild(newtool);
 
-   sprintf(_STR2, "tooldict[%d] = %s\n", newtool, pfunction);
+   sprintf(_STR2, "tooldict[%ld] = %s\n", (long int)newtool, pfunction);
    status = PyRun_SimpleString(_STR2);
    return PyInt_FromLong((long)status);
 }
@@ -1879,7 +1881,7 @@
          PyErr_Clear();
 	 return NULL;
       }
-      ptools[i] = (Widget)((int)PyInt_AsLong(rval));
+      ptools[i] = (Widget)PyInt_AsLong(rval);
       Py_DECREF(rval);
    }
    return ptools;



More information about the Xcircuit-dev mailing list