[Xcircuit-dev] de-linting patch for CVS
ldoolitt at recycle.lbl.gov
ldoolitt at recycle.lbl.gov
Fri Jun 2 10:22:02 PDT 2006
Friends -
On Thu, Jun 01, 2006 at 09:51:38AM -0700, ldoolitt at recycle.lbl.gov wrote:
> After some or all of this relatively long but simple patch
> is applied, I will dig into some of the trickier bits.
More language cleanup, more subtle this time.
One behavior change, in menudep.c: use fopen/fclose
to create an empty file, in both normal and XC_WIN32
code paths.
I gave both the tcl and python configurations a quick
check, I don't think I broke anything. Please review
and apply. If the e-mail system mangles the patch,
you can fetch a fresh copy from
http://recycle.lbl.gov/~ldoolitt/xcircuit-patch-20060602.txt
- Larry
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/elements.c /home/ldoolitt/src/xcircuit-3.6-work/elements.c
--- xcircuit-3.6/elements.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/elements.c 2006-06-01 15:33:25.000000000 -0700
@@ -520,7 +520,7 @@
labelptr curlabel;
stringpart *curpos, *labelbuf;
int locpos;
- Boolean r, do_redraw = False;
+ Boolean r = False, do_redraw = False;
short tmplength, tmpheight, cfont;
TextExtents tmpext;
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/events.c /home/ldoolitt/src/xcircuit-3.6-work/events.c
--- xcircuit-3.6/events.c 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/events.c 2006-06-02 10:04:39.000000000 -0700
@@ -1204,9 +1204,9 @@
/*--------------------------*/
#ifdef TCL_WRAPPER
-xcTimeOutProc makepress(caddr_t clientdata)
+void makepress(ClientData clientdata)
#else
-xcTimeOutProc makepress(caddr_t clientdata, xcIntervalId *id)
+void makepress(XtPointer clientdata, xcIntervalId *id)
#endif
{
int keywstate = (int)((pointertype)clientdata);
@@ -1216,8 +1216,6 @@
areawin->time_id = 0;
pressmode = keywstate;
eventdispatch(keywstate | HOLD_MASK, areawin->save.x, areawin->save.y);
-
- return NULL;
}
/*------------------------------------------------------*/
@@ -2189,7 +2187,7 @@
areawin->save.x = event->x;
areawin->save.y = event->y;
areawin->time_id = xcAddTimeOut(app, PRESSTIME,
- (xcTimeOutProc)makepress, (ClientData)((pointertype)keywstate));
+ makepress, (ClientData)((pointertype)keywstate));
return;
}
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/files.c /home/ldoolitt/src/xcircuit-3.6-work/files.c
--- xcircuit-3.6/files.c 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/files.c 2006-06-02 10:05:52.000000000 -0700
@@ -3912,7 +3912,7 @@
#ifdef TCL_WRAPPER
-xcTimeOutProc savetemp(caddr_t clientdata)
+void savetemp(ClientData clientdata)
{
if (xobjs.timeout_id == NULL) { /* Not called by timeout callback */
xcRemoveTimeOut(xobjs.timeout_id);
@@ -3921,7 +3921,7 @@
#else
-xcTimeOutProc savetemp(caddr_t clientdata, xcIntervalId *id)
+void savetemp(XtPointer clientdata, xcIntervalId *id)
{
if (id == NULL) /* Not called by timeout callback */
xcRemoveTimeOut(xobjs.timeout_id);
@@ -3948,7 +3948,6 @@
if (fd == -1) {
Fprintf(stderr, "Error generating file for savetemp\n");
free(template);
- return NULL;
}
close(fd);
xobjs.tempfile = strdup(template);
@@ -3958,8 +3957,7 @@
}
xobjs.timeout_id = xcAddTimeOut(app, 60000 * xobjs.save_interval,
- (xcTimeOutProc)savetemp, NULL);
- return NULL;
+ savetemp, NULL);
}
/*----------------------------------------------------------------------*/
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/menudep.c /home/ldoolitt/src/xcircuit-3.6-work/menudep.c
--- xcircuit-3.6/menudep.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/menudep.c 2006-06-01 14:19:57.000000000 -0700
@@ -155,20 +155,10 @@
int main()
{
-#ifdef XC_WIN32
+ /* create empty file menudep.h */
FILE *fid = fopen("menudep.h", "w");
fclose(fid);
return 0;
-#else
- /* create empty file menudep.h */
- const char *argv[] = {
- "touch",
- "menudep.h",
- NULL,
- };
- execvp(argv[0], argv);
- exit(0);
-#endif
}
#endif /* TCL_WRAPPER */
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/netlist.c /home/ldoolitt/src/xcircuit-3.6-work/netlist.c
--- xcircuit-3.6/netlist.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/netlist.c 2006-06-02 09:51:56.000000000 -0700
@@ -3373,7 +3373,8 @@
LabellistPtr infolist, infoptr;
FILE *finclude;
- if (locmode = mode) {
+ locmode = mode;
+ if (locmode) {
/* "sim" format files are flattened by definition */
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/parameter.c /home/ldoolitt/src/xcircuit-3.6-work/parameter.c
--- xcircuit-3.6/parameter.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/parameter.c 2006-06-02 09:53:51.000000000 -0700
@@ -221,7 +221,7 @@
oparamptr fparam, ops;
fparam = match_instance_param(thisinst, key);
ops = match_param(thisinst->thisobject, key);
- if ((fparam == NULL) || (ops->type == XC_EXPR) && (fparam->type != XC_EXPR))
+ if ((fparam == NULL) || ((ops->type == XC_EXPR) && (fparam->type != XC_EXPR)))
fparam = ops;
return fparam;
}
@@ -1657,7 +1657,7 @@
Wprintf("%s", sstart);
free(sstart);
- /* Need a new non-Tcl version method . . . */
+ /* XXX Need a new non-Tcl version method . . . */
ops = NULL; /* placeholder */
}
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/prototypes.h /home/ldoolitt/src/xcircuit-3.6-work/prototypes.h
--- xcircuit-3.6/prototypes.h 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/prototypes.h 2006-06-02 10:06:04.000000000 -0700
@@ -178,9 +178,9 @@
extern void elementflip(XPoint *);
extern void elementvflip(XPoint *);
#ifdef TCL_WRAPPER
-extern xcTimeOutProc makepress(caddr_t);
+extern void makepress(ClientData);
#else
-extern xcTimeOutProc makepress(caddr_t, xcIntervalId *);
+extern void makepress(XtPointer, xcIntervalId *);
#endif
extern void reviseselect(short *, int, short *);
extern void deletebutton(int, int);
@@ -289,11 +289,11 @@
char standard_delimiter_end(char);
#ifdef TCL_WRAPPER
-void setfile(char *, int);
-extern xcTimeOutProc savetemp(caddr_t);
+extern void setfile(char *, int);
+extern void savetemp(ClientData);
#else
extern void setfile(xcWidget, xcWidget, caddr_t);
-extern xcTimeOutProc savetemp(caddr_t, xcIntervalId *);
+extern void savetemp(XtPointer, xcIntervalId *);
#endif
extern void incr_changes(objectptr);
extern void savelibpopup(xcWidget, pointertype, caddr_t);
@@ -926,6 +926,7 @@
extern caddr_t CvtStringToPixel(XrmValuePtr, int *, XrmValuePtr, XrmValuePtr);
extern void outputpopup(xcWidget, caddr_t, caddr_t);
extern void docommand(void);
+extern int installowncmap(void); /* sometimes from xtgui.c */
extern void destroypopup(xcWidget, popupstruct *, caddr_t);
extern int xc_alloccolor(char *);
extern void dointr(int);
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/rcfile.c /home/ldoolitt/src/xcircuit-3.6-work/rcfile.c
--- xcircuit-3.6/rcfile.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/rcfile.c 2006-06-01 18:29:48.000000000 -0700
@@ -13,6 +13,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
+#include <unistd.h> /* for usleep() */
#ifndef XC_WIN32
#include <X11/Intrinsic.h>
@@ -125,7 +127,7 @@
if (!strncmp(argptr, "default", 7)) {
argptr += 7;
while (isspace(*argptr) && (*argptr != '\0')) argptr++;
- if (*argptr == '\0') return; /* bad syntax */
+ if (*argptr == '\0') return flags; /* bad syntax */
}
sscanf(argptr, "%49s", value);
@@ -287,7 +289,7 @@
if (!strncmp(argptr, "default", 7)) {
argptr += 7;
while (isspace(*argptr) && (*argptr != '\0')) argptr++;
- if (*argptr == '\0') return; /* bad syntax */
+ if (*argptr == '\0') return flags; /* bad syntax */
}
if (!strncmp(argptr, "font", 4)) {
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/tclxcircuit.c /home/ldoolitt/src/xcircuit-3.6-work/tclxcircuit.c
--- xcircuit-3.6/tclxcircuit.c 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/tclxcircuit.c 2006-06-01 18:09:50.000000000 -0700
@@ -11,9 +11,6 @@
#include <stdarg.h> /* for va_copy() */
#include <stdlib.h> /* for atoi() and others */
#include <ctype.h>
-#ifndef _MSC_VER
-#include <unistd.h> /* for usleep() */
-#endif
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/undo.c /home/ldoolitt/src/xcircuit-3.6-work/undo.c
--- xcircuit-3.6/undo.c 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/undo.c 2006-06-01 15:04:48.000000000 -0700
@@ -158,7 +158,7 @@
k++;
}
else
- Fprintf(stderr, "Error: element 0x%x in select list but not object\n",
+ Fprintf(stderr, "Error: element %p in select list but not object\n",
egen);
}
@@ -241,6 +241,7 @@
return NULL;
}
}
+ return NULL; /* yes, this can be reached, if thisrecord->next == NULL */
}
/*----------------------------------------------------------------------*/
@@ -638,8 +639,9 @@
thisrecord->undodata = NULL;
break;
}
- else
- delete_one_element(thisrecord->thisinst, egen);
+ else {
+ delete_one_element(thisrecord->thisinst, egen); /* XXX egen is uninitialized! */
+ }
/* Put back all the parts */
areawin->selects = thisobj->parts;
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/xcircuit.c /home/ldoolitt/src/xcircuit-3.6-work/xcircuit.c
--- xcircuit-3.6/xcircuit.c 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/xcircuit.c 2006-06-02 09:40:14.000000000 -0700
@@ -500,7 +500,8 @@
/* For formatted strings, format first into _STR */
/*-------------------------------------------------*/
-xcTimeOutProc clrmessage(caddr_t clientdata)
+/* XXX it looks like this routine is an orphan */
+void clrmessage(caddr_t clientdata)
{
char buf1[50], buf2[50];
@@ -514,7 +515,6 @@
measurestr(xobjs.pagelist[areawin->page]->snapspace, buf2);
Wprintf("Grid %.50s : Snap %.50s", buf1, buf2);
}
- /* XXX where is the xcTimeOutProc to return? */
}
#endif /* TCL_WRAPPER */
@@ -1470,7 +1470,7 @@
xobjs.save_interval = appdata.timeout;
xobjs.timeout_id = xcAddTimeOut(app, 60000 * xobjs.save_interval,
- (xcTimeOutProc)savetemp, NULL);
+ savetemp, NULL);
}
/*----------------------------------------------------------------------*/
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/xtfuncs.c /home/ldoolitt/src/xcircuit-3.6-work/xtfuncs.c
--- xcircuit-3.6/xtfuncs.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/xtfuncs.c 2006-06-01 14:58:11.000000000 -0700
@@ -929,7 +929,7 @@
default:
for (titem = ToolBar; titem < ToolBar + toolbuttons; titem++) {
- if (func == (int)(titem->passeddata)) {
+ if (func == (pointertype)(titem->passeddata)) {
self = XtNameToWidget(parent, titem->name);
break;
}
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/xtgui.c /home/ldoolitt/src/xcircuit-3.6-work/xtgui.c
--- xcircuit-3.6/xtgui.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/xtgui.c 2006-06-02 09:30:08.000000000 -0700
@@ -1302,7 +1302,7 @@
/* For formatted strings, format first into _STR */
/*-------------------------------------------------*/
-xcTimeOutProc clrmessage(caddr_t clientdata, xcIntervalId *id)
+void clrmessage(XtPointer clientdata, xcIntervalId *id)
{
char buf1[50], buf2[50];
@@ -1367,7 +1367,7 @@
/* 10 second timeout */
if (widget == message3) {
- printtime_id = xcAddTimeOut(app, 10000, (xcTimeOutProc)clrmessage, NULL);
+ printtime_id = xcAddTimeOut(app, 10000, clrmessage, NULL);
}
}
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/Xw/Form.c /home/ldoolitt/src/xcircuit-3.6-work/Xw/Form.c
--- xcircuit-3.6/Xw/Form.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/Xw/Form.c 2006-06-01 14:19:57.000000000 -0700
@@ -960,7 +960,7 @@
/* For both the width and height references, if the ref parent was */
- /* not null, find the reference to be removed within the parents
+ /* not null, find the reference to be removed within the parents */
/* list, remove this reference. Then, for any references attached */
/* to the one just removed, reparent them to the parent reference. */
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/Xw/PopupMgr.h /home/ldoolitt/src/xcircuit-3.6-work/Xw/PopupMgr.h
--- xcircuit-3.6/Xw/PopupMgr.h 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/Xw/PopupMgr.h 2006-06-02 09:50:10.000000000 -0700
@@ -41,4 +41,5 @@
typedef struct _XwPopupMgrClassRec *XwPopupMgrWidgetClass;
typedef struct _XwPopupMgrRec *XwPopupMgrWidget;
+extern void XwAppInitialize(XtAppContext);
extern void XwPostPopup(Widget, Widget, Widget, Position, Position);
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/Xw/Traversal.c /home/ldoolitt/src/xcircuit-3.6-work/Xw/Traversal.c
--- xcircuit-3.6/Xw/Traversal.c 2006-04-10 14:52:19.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/Xw/Traversal.c 2006-06-01 14:19:57.000000000 -0700
@@ -31,6 +31,7 @@
#include <X11/StringDefs.h>
#include <Xw/Xw.h>
#include <Xw/XwP.h>
+#include <stdlib.h> /* abs */
static int Overlap();
diff --exclude=CVS --exclude=Makefile --exclude=aclocal.m4 --exclude=configure --exclude=Makefile.in -ur xcircuit-3.6/Xw/XwP.h /home/ldoolitt/src/xcircuit-3.6-work/Xw/XwP.h
--- xcircuit-3.6/Xw/XwP.h 2006-06-01 14:07:17.000000000 -0700
+++ /home/ldoolitt/src/xcircuit-3.6-work/Xw/XwP.h 2006-06-01 14:19:57.000000000 -0700
@@ -219,7 +219,9 @@
************************************************************************/
extern void mgr_traversal();
+extern void _XwDrawBox();
extern void XwSetFocusPath();
+extern void XwMoveFocus();
extern void XwProcessTraversal();
extern void XwSetInputFocus();
extern void _XwInitCheckList();
@@ -251,6 +253,7 @@
extern void _XwRealize();
extern void _XwResizeButton();
extern void _XwRegisterName();
+extern Boolean _XwRecomputeSize();
extern Boolean XwTestTraversability();
/************************************************************************
More information about the Xcircuit-dev
mailing list