svn commit: r318161 - in head/cad/tkgate: . files
Pietro Cerutti
gahr at FreeBSD.org
Tue May 14 14:05:12 UTC 2013
Author: gahr
Date: Tue May 14 14:05:09 2013
New Revision: 318161
URL: http://svnweb.freebsd.org/changeset/ports/318161
Log:
- Update to 2.0-b10
- Fix build with Tcl/Tk 8.6. Unfortunately, tkgate segfaults on startup when
built against 8.6, so set 86 as an invalid version for this port.
Reported by: miwi (Tcl/Tk 86 exp-run)
Added:
head/cad/tkgate/files/
head/cad/tkgate/files/patch-configure (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_Makefile.in (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_block.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_editstate.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_generic.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_hdl.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_html.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_locale.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_main.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_scopewin.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_selection.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_simulate.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_tclfuncs.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_tkgate.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_tkgatewin.c (contents, props changed)
head/cad/tkgate/files/patch-src-tkgate_verilog_out.c (contents, props changed)
Modified:
head/cad/tkgate/Makefile
head/cad/tkgate/distinfo (contents, props changed)
head/cad/tkgate/pkg-plist (contents, props changed)
Modified: head/cad/tkgate/Makefile
==============================================================================
--- head/cad/tkgate/Makefile Tue May 14 13:40:09 2013 (r318160)
+++ head/cad/tkgate/Makefile Tue May 14 14:05:09 2013 (r318161)
@@ -2,12 +2,9 @@
# $FreeBSD$
PORTNAME= tkgate
-PORTVERSION= 1.8.7
-PORTREVISION= 4
+DISTVERSION= 2.0-b10
CATEGORIES= cad
-MASTER_SITES= http://ark2.media.eng.hokudai.ac.jp/microprocessor/ \
- http://www.info.kindai.ac.jp/LC/TkGate/ \
- http://www.tkgate.org/downloads/
+MASTER_SITES= http://www.tkgate.org/downloads/
EXTRACT_SUFX= .tgz
MAINTAINER= ports at FreeBSD.org
@@ -15,32 +12,23 @@ COMMENT= Tcl/Tk based digital circuit ed
LICENSE= GPLv2 # (or later)
-USE_XORG= x11
-USE_TCL_BUILD= yes
-USE_TK_BUILD= yes
-USE_TCL= yes
-USE_TK= yes
-USE_IMAKE= yes
+GNU_CONFIGURE= yes
+USES= iconv
+USE_TK= 84+
+INVALID_TK_VER= 86
MAKE_JOBS_SAFE= yes
-PLIST_SUB= VERSION="${PORTVERSION}"
-
-MAN1= gmac.1 tkgate.1
+MAN1= gmac.1 tkgate.1 verga.1
TKGATE_IPATH= -I${TK_INCLUDEDIR} -I${TCL_INCLUDEDIR}
TKGATE_LIBS= -ltk${TK_VER:S/.//} -ltcl${TCL_VER:S/.//} -lX11 -lm
post-patch:
+ @${REINPLACE_CMD} -e 's|/usr/bin/wish|${WISH}|g' ${WRKSRC}/scripts/tree.tcl
@${REINPLACE_CMD} -e \
- 's|/usr/X11R6|${LOCALBASE}|g ; \
- s|dl socket nsl||g ; \
- /^#define TKGATE_IPATH/s|-I.*|${TKGATE_IPATH}|g ; \
- /^#define TKGATE_LIBS/s|-l.*|${TKGATE_LIBS}|g ; \
- /^#define TKGATE_GCCFLAGS/s|-O||g ; \
- /^#define TKGATE_CC/s|gcc|${CC}|g' ${WRKSRC}/config.h
-.for file in tree.tcl elistbox.tcl
- @${REINPLACE_CMD} -e \
- 's|^#!.*|#!${WISH}|g' ${WRKSRC}/scripts/${file}
-.endfor
+ 's|%%TCL_VER%%|${TCL_VER}|g; \
+ s|%%TCL_INCLUDEDIR%%|${TCL_INCLUDEDIR}|g; \
+ s|%%LOCALBASE%%|${LOCALBASE}|g' \
+ ${WRKSRC}/configure
.include <bsd.port.mk>
Modified: head/cad/tkgate/distinfo
==============================================================================
--- head/cad/tkgate/distinfo Tue May 14 13:40:09 2013 (r318160)
+++ head/cad/tkgate/distinfo Tue May 14 14:05:09 2013 (r318161)
@@ -1,2 +1,2 @@
-SHA256 (tkgate-1.8.7.tgz) = daa150619c22e8aea544dee13a96238dd6c8883b090e105190ab5dd7e2e41edf
-SIZE (tkgate-1.8.7.tgz) = 1541823
+SHA256 (tkgate-2.0-b10.tgz) = 4ef6a9c5b71325cec0d53d55dfd386a344dc7f139c49e9a145ad4ace7a302057
+SIZE (tkgate-2.0-b10.tgz) = 8588819
Added: head/cad/tkgate/files/patch-configure
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-configure Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,36 @@
+--- configure.orig 2009-09-27 02:24:57.000000000 +0200
++++ configure 2013-05-14 15:47:22.000000000 +0200
+@@ -2488,17 +2488,17 @@
+ #
+ # Tcl/Tk version we will try to use (from most favored to least favored)
+ #
+-TKGATE_TCLTK_VERSIONS="8.5 8.4 8.3"
++TKGATE_TCLTK_VERSIONS="%%TCL_VER%%"
+
+ #
+ # Directories to search for include files
+ #
+-TKGATE_INCDIRS="/usr/X11R6/include /usr/X11/include /pkgs/include /usr/local/include /usr/openwin/include /usr/X/include /usr/include /sw/include /opt/local/include"
++TKGATE_INCDIRS="%%LOCALBASE%%/include %%TCL_INCLUDEDIR%%"
+
+ #
+ # Directories to search for library files
+ #
+-TKGATE_LIBDIRS="/usr/X11R6/lib /usr/X11/lib /pkgs/lib /usr/local/lib /usr/lib /sw/lib /opt/local/lib"
++TKGATE_LIBDIRS="%%LOCALBASE%%/lib"
+
+ #
+ # Libraries we may need if available.
+@@ -23820,10 +23820,10 @@
+ else
+ TCLTK_VERSION=$TCL_VERSION
+
+- TCL_LIB=$TCL_LIB_SPEC
++ TCL_LIB="$TCL_LIB_SPEC $TCL_STUB_LIB_SPEC"
+ TCL_LPATH=""
+ TCL_IPATH=$TCL_INCLUDE_SPEC
+- TK_LIB=$TK_LIB_SPEC
++ TK_LIB="$TK_LIB_SPEC $TK_STU_LIB_SPEC"
+ TK_LPATH=""
+ TK_IPATH=$TK_INCLUDE_SPEC
+
Added: head/cad/tkgate/files/patch-src-tkgate_Makefile.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_Makefile.in Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,15 @@
+--- src/tkgate/Makefile.in.orig 2013-05-14 15:31:59.000000000 +0200
++++ src/tkgate/Makefile.in 2013-05-14 15:32:21.000000000 +0200
+@@ -263,10 +263,10 @@
+ editstate.h igenerate.h script.h yybasic.h elements.h message.h simulate.h zoom.h \
+ error.h modsym.h text.h expr.h module.h tkgate.h functions.h net.h tkgate_config.h tkgate_misc.h
+
+-tkgate_LDFLAGS = @TKGATE_LPATH@ @X_LIBS@ @COMMON_LPATH@
++tkgate_LDFLAGS = @COMMON_LPATH@ @TKGATE_LPATH@ @X_LIBS@
+ tkgate_SOURCES = $(BASE_OBJS) main.c
+ #tkgate_LDADD=libtkgate.la
+-tkgate_LDADD = @TKGATE_LIB@ -lcommon
++tkgate_LDADD = -lcommon @TKGATE_LIB@
+ all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
Added: head/cad/tkgate/files/patch-src-tkgate_block.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_block.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,31 @@
+--- src/tkgate/block.c.orig 2013-05-14 14:38:34.000000000 +0200
++++ src/tkgate/block.c 2013-05-14 14:40:01.000000000 +0200
+@@ -1100,8 +1100,8 @@
+ */
+ if (best_w) {
+ DoTcl("PortEntry::generateNextNameFrom %s",best_w->name);
+- if (*TkGate.tcl->result)
+- strcpy(buf,TkGate.tcl->result);
++ if (*(Tcl_GetStringResult(TkGate.tcl)))
++ strcpy(buf,Tcl_GetStringResult(TkGate.tcl));
+ }
+
+ if (!*buf) {
+@@ -1164,7 +1164,7 @@
+ else
+ DoTcl("PortEdit::post [offsetgeometry . %d %d] -ismodule 1 -showsig 0",ctow_x(x+125),ctow_y(y+50));
+
+- if (strcmp(TkGate.tcl->result,"1") == 0) {
++ if (strcmp(Tcl_GetStringResult(TkGate.tcl),"1") == 0) {
+ const char *numBits;
+ int new_dir;
+
+@@ -1543,7 +1543,7 @@
+ DoTcl("PortEdit::post [offsetgeometry . %d %d] -ismodule 1 -showsig 0",
+ ctow_x(x+125),ctow_y(y+50));
+
+- if (strcmp(TkGate.tcl->result,"1") == 0) {
++ if (strcmp(Tcl_GetStringResult(TkGate.tcl),"1") == 0) {
+ const char *numBits;
+ const char *sigName;
+ const char *portName;
Added: head/cad/tkgate/files/patch-src-tkgate_editstate.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_editstate.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/editstate.c.orig 2013-05-14 14:41:05.000000000 +0200
++++ src/tkgate/editstate.c 2013-05-14 14:41:30.000000000 +0200
+@@ -513,7 +513,7 @@
+
+ sprintf(buf,msgLookup("msg.modoverwt"),dst); /* Destination module '%s' already exists. Overwrite? */
+ DoTcl("confirmMsg \"%s\" ",buf);
+- if (*TkGate.tcl->result != '1')
++ if (Tcl_GetStringResult(TkGate.tcl)[0] != '1')
+ return;
+
+ env_removeModule(dst,0);
Added: head/cad/tkgate/files/patch-src-tkgate_generic.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_generic.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/generic.c.orig 2013-05-14 14:41:47.000000000 +0200
++++ src/tkgate/generic.c 2013-05-14 14:42:07.000000000 +0200
+@@ -749,7 +749,7 @@
+ y = ctow_y(g->ypos-50);
+
+ DoTcl("offsetgeometry . %d %d",x,y);
+- sscanf(TkGate.tcl->result,"+%d+%d",&x,&y);
++ sscanf(Tcl_GetStringResult(TkGate.tcl),"+%d+%d",&x,&y);
+
+ if (x < 25) x = 25;
+ if (y < 25) y = 25;
Added: head/cad/tkgate/files/patch-src-tkgate_hdl.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_hdl.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,74 @@
+--- src/tkgate/hdl.c.orig 2013-05-14 14:42:23.000000000 +0200
++++ src/tkgate/hdl.c 2013-05-14 14:45:35.000000000 +0200
+@@ -90,7 +90,7 @@
+ {
+ GModuleDef *M;
+ int rvalue = 0;
+- char *text;
++ const char *text;
+
+ if (name)
+ M = env_findModule(name);
+@@ -104,7 +104,7 @@
+ if (M->m_type != MT_TEXTHDL) return 0;
+
+ DoTcl("HdlEditor::dumpText");
+- text = TkGate.tcl->result;
++ text = Tcl_GetStringResult(TkGate.tcl);
+
+ #if 0
+ printf("hdl_save(%s)\n",M->m_name);
+@@ -339,7 +339,7 @@
+ int module_count = 0;
+ HdlModuleData module_data[MAXMODS];
+ GModuleDef *M;
+- char *text;
++ const char *text;
+ int rvalue = 0;
+
+ if (name)
+@@ -358,7 +358,7 @@
+ M->m_needScan = 1;
+
+ DoTcl("HdlEditor::dumpText");
+- text = TkGate.tcl->result;
++ text = Tcl_GetStringResult(TkGate.tcl);
+
+ /*
+ * Turn text into a copy. Use non-ob functions since we only use it here
+@@ -368,7 +368,7 @@
+ /*
+ * Find the partition points for modules
+ */
+- module_count = hdl_findPartitions(text,module_data,MAXMODS);
++ module_count = hdl_findPartitions((char *)text,module_data,MAXMODS);
+
+ ob_touch(M);
+
+@@ -400,10 +400,10 @@
+
+ if (!ismatch(M->m_name,module_data[0].name,module_data[0].name_len)) {
+ DoTcl("HdlEditor::askRename");
+- if (strcmp(TkGate.tcl->result,"autoedit") == 0) {
++ if (strcmp(Tcl_GetStringResult(TkGate.tcl),"autoedit") == 0) {
+ hdl_replaceName(M,M->m_name);
+ DoTclL("HdlEditor::loadText",M->m_text,NULL);
+- } else if (strcmp(TkGate.tcl->result,"ignore") == 0) {
++ } else if (strcmp(Tcl_GetStringResult(TkGate.tcl),"ignore") == 0) {
+ /* Do nothing */
+ } else { /* cancel */
+ rvalue = -1;
+@@ -416,11 +416,11 @@
+ * which action they want to take.
+ */
+ DoTcl("HdlEditor::askSaveOption");
+- if (strcmp(TkGate.tcl->result,"split") == 0) {
++ if (strcmp(Tcl_GetStringResult(TkGate.tcl),"split") == 0) {
+ GModuleDef_saveText(M, text);
+ hdl_splitModules(M,module_data,module_count);
+ DoTclL("HdlEditor::loadText",M->m_text,NULL);
+- } else if (strcmp(TkGate.tcl->result,"ignore") == 0) {
++ } else if (strcmp(Tcl_GetStringResult(TkGate.tcl),"ignore") == 0) {
+ GModuleDef_saveText(M, text);
+ } else {
+ /* "cancel" or unknown value */
Added: head/cad/tkgate/files/patch-src-tkgate_html.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_html.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/html.c.orig 2013-05-14 14:43:09.000000000 +0200
++++ src/tkgate/html.c 2013-05-14 14:43:39.000000000 +0200
+@@ -894,7 +894,7 @@
+ ob_touch(hc);
+
+ DoTcl("gifI %s",gifFile);
+- hu->hu_image = Tk_GetImage(TkGate.tcl, Tk_MainWindow(TkGate.tcl), TkGate.tcl->result, 0, 0);
++ hu->hu_image = Tk_GetImage(TkGate.tcl, Tk_MainWindow(TkGate.tcl), Tcl_GetStringResult(TkGate.tcl), 0, 0);
+ if (hu->hu_image)
+ Tk_SizeOfImage(hu->hu_image, &width, &height);
+
Added: head/cad/tkgate/files/patch-src-tkgate_locale.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_locale.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,14 @@
+--- src/tkgate/locale.c.orig 2013-05-14 14:46:02.000000000 +0200
++++ src/tkgate/locale.c 2013-05-14 14:46:35.000000000 +0200
+@@ -395,10 +395,7 @@
+ if (argc < 2) return TCL_OK;
+
+ msg = msgLookup(argv[1]);
+- if (strlen(msg) < 127)
+- strcpy(tcl->result,msg);
+- else
+- tcl->result = strdup(msg);
++ Tcl_SetResult(tcl, msg, TCL_VOLATILE);
+
+ return TCL_OK;
+ }
Added: head/cad/tkgate/files/patch-src-tkgate_main.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_main.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/main.c.orig 2013-05-14 15:23:12.000000000 +0200
++++ src/tkgate/main.c 2013-05-14 15:23:30.000000000 +0200
+@@ -38,7 +38,7 @@
+
+ r = Tcl_Init(tcl);
+ if (r == TCL_ERROR) {
+- fprintf(stderr,"Tcl_Init Error in tkgate:\n%s\n",tcl->result);
++ fprintf(stderr,"Tcl_Init Error in tkgate:\n%s\n",Tcl_GetStringResult(tcl));
+ fprintf(stderr,"Perhaps you could try setting the environment variable TCL_LIBRARY\n");
+ fprintf(stderr,"to the directory in which init.tcl can be found. You can also\n");
+ fprintf(stderr,"set TCL_LIBRARY in options.h.\n");
Added: head/cad/tkgate/files/patch-src-tkgate_scopewin.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_scopewin.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/scopewin.c.orig 2013-05-14 14:46:53.000000000 +0200
++++ src/tkgate/scopewin.c 2013-05-14 14:47:30.000000000 +0200
+@@ -469,7 +469,7 @@
+ return TCL_ERROR;
+ }
+
+- tcl->result = Tk_PathName(w);
++ Tcl_SetResult(tcl, Tk_PathName(w), TCL_STATIC);
+
+ scope_active = 1;
+
Added: head/cad/tkgate/files/patch-src-tkgate_selection.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_selection.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,40 @@
+--- src/tkgate/selection.c.orig 2013-05-14 14:48:09.000000000 +0200
++++ src/tkgate/selection.c 2013-05-14 14:49:50.000000000 +0200
+@@ -178,7 +178,7 @@
+
+ if (TkGate.circuit && TkGate.circuit->es && hdl_isactive) { /* GModuleDef_getType(TkGate.circuit->es->env) == MT_TEXTHDL*/
+ DoTcl("HdlEditor::isselection");
+- sel_ok = (*TkGate.tcl->result == '1');
++ sel_ok = (Tcl_GetStringResult(TkGate.tcl)[0] == '1');
+ } else {
+ sel_ok = (TkGate.circuit->select != 0) || (TkGate.circuit->mg_selection != 0);
+ }
+@@ -661,7 +661,7 @@
+ if (hdl_isactive) {
+ DoTcl("HdlEditor::dumpSelection");
+ cbm->m_type = MT_TEXTHDL;
+- GModuleDef_saveText(cbm, TkGate.tcl->result);
++ GModuleDef_saveText(cbm, Tcl_GetStringResult(TkGate.tcl));
+ } else {
+ GModuleDef_copyInto(cbm, m, 0,0,1,0);
+ GCutBuffer_computeBounds(TkGate.circuit->cut_buffer);
+@@ -701,8 +701,8 @@
+
+ ob_touch(cbm);
+ cbm->m_type = MT_TEXTHDL;
+- GModuleDef_allocText(cbm, strlen(cbm->m_text) + strlen(TkGate.tcl->result) + 1);
+- strcat(cbm->m_text, TkGate.tcl->result);
++ GModuleDef_allocText(cbm, strlen(cbm->m_text) + strlen(Tcl_GetStringResult(TkGate.tcl)) + 1);
++ strcat(cbm->m_text, Tcl_GetStringResult(TkGate.tcl));
+
+ sel_updateMenuState();
+ }
+@@ -713,7 +713,7 @@
+
+ if (hdl_isactive) {
+ DoTcl("HdlEditor::isselection2");
+- if (*TkGate.tcl->result != '1') return;
++ if (Tcl_GetStringResult(TkGate.tcl)[0] != '1') return;
+ sel_copy(es);
+ DoTcl("HdlEditor::doDelete 0");
+ } else {
Added: head/cad/tkgate/files/patch-src-tkgate_simulate.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_simulate.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,11 @@
+--- src/tkgate/simulate.c.orig 2013-05-14 14:50:07.000000000 +0200
++++ src/tkgate/simulate.c 2013-05-14 14:50:30.000000000 +0200
+@@ -1117,7 +1117,7 @@
+
+
+ DoTcl("VPD::isallowed %s",cmdName);
+- if (*TkGate.tcl->result != '1') return -1;
++ if (Tcl_GetStringResult(TkGate.tcl)[0] != '1') return -1;
+
+ DoTcl(cmd);
+ return 0;
Added: head/cad/tkgate/files/patch-src-tkgate_tclfuncs.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/cad/tkgate/files/patch-src-tkgate_tclfuncs.c Tue May 14 14:05:09 2013 (r318161)
@@ -0,0 +1,715 @@
+--- src/tkgate/tclfuncs.c.orig 2013-05-14 14:50:49.000000000 +0200
++++ src/tkgate/tclfuncs.c 2013-05-14 15:19:00.000000000 +0200
+@@ -102,18 +102,19 @@
+ hdl_load(es->env);
+ else if (strcmp(argv[1],"save") == 0) {
+ if (hdl_save(name) < 0)
+- sprintf(tcl->result,"cancel");
++ Tcl_SetResult(tcl, "cancel", TCL_STATIC);
+ } else if (strcmp(argv[1],"checksave") == 0) {
+- if (hdl_checkSave(name) < 0)
+- sprintf(tcl->result,"cancel");
++ Tcl_SetResult(tcl, "cancel", TCL_STATIC);
+ } else if (strcmp(argv[1],"close") == 0) {
+ hdl_close();
+ } else if (strcmp(argv[1],"getindex") == 0) {
+ int line,pos;
+ if (hdl_getCursor(&line,&pos) == 0) {
+- sprintf(tcl->result,"%d.%d",line,pos);
++ char res[127];
++ sprintf(res,"%d.%d",line,pos);
++ Tcl_SetResult(tcl, res, TCL_VOLATILE);
+ } else
+- sprintf(tcl->result,"1.0");
++ Tcl_SetResult(tcl, "1.0", TCL_STATIC);
+ } else if (strcmp(argv[1],"touch") == 0) {
+ ob_touch(TkGate.circuit); /* Modify somthing to force undo to thing there are changes */
+ }
+@@ -154,12 +155,12 @@
+ static int gat_interface(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ if (argc < 3) {
+- strcpy(tcl->result,"too few arguments.");
++ Tcl_SetResult(tcl, "too few arguments.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (igen_command(argv[1],argv[2],argc-3,argv + 3) != 0) {
+- strcpy(tcl->result,"invalid command.");
++ Tcl_SetResult(tcl, "invalid command.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -243,7 +244,7 @@
+
+ if ((modFlag = Tcl_GetVar(tcl,"tkg_modifiedFlag",TCL_GLOBAL_ONLY)) && *modFlag != '0') {
+ DoTcl("File::confDelMods");
+- if (!TkGate.tcl->result || strcmp(TkGate.tcl->result,"yes") != 0) {
++ if (!Tcl_GetStringResult(TkGate.tcl) || strcmp(Tcl_GetStringResult(TkGate.tcl),"yes") != 0) {
+ Tcl_SetResult(tcl,"0", TCL_STATIC);
+ return TCL_OK;
+ }
+@@ -308,7 +309,7 @@
+ ob_touch(gw->parms->circuit);
+
+ if (VerilogOpen(&gw->parms->circuit->es,name,1) < 0) {
+- sprintf(tcl->result,"0");
++ Tcl_SetResult(tcl, "0", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -319,7 +320,7 @@
+ FlagRedraw();
+
+
+- sprintf(tcl->result,"1");
++ Tcl_SetResult(tcl, "1", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -330,9 +331,9 @@
+ return TCL_OK;
+
+ if (SHash_find(TkGate.libraries,argv[1]))
+- sprintf(TkGate.tcl->result,"1");
++ Tcl_SetResult(TkGate.tcl, "1", TCL_STATIC);
+ else
+- sprintf(TkGate.tcl->result,"0");
++ Tcl_SetResult(TkGate.tcl, "0", TCL_STATIC);
+
+ return TCL_OK;
+ }
+@@ -547,7 +548,7 @@
+ }
+
+ if (hdl_checkSave(0) < 0) { /* Make sure hdl is up to date */
+- sprintf(tcl->result,"cancel");
++ Tcl_SetResult(tcl, "cancel", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -761,11 +762,13 @@
+
+ ob_touch(TkGate.circuit);
+
++ char res[127];
+ if (argc != 2 || sscanf(argv[1],"%d",&N) != 1) {
+ if (argc != 2)
+- sprintf(tcl->result,"argument error argc=%d",argc);
++ sprintf(res,"argument error argc=%d",argc);
+ else
+- sprintf(tcl->result,"argument error argv[1]=<%s>",argv[1]);
++ sprintf(res,"argument error argv[1]=<%s>",argv[1]);
++ Tcl_SetResult(tcl, res, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+@@ -804,7 +807,7 @@
+
+ if (f) {
+ DoTcl("yesno [format [m circ.reallyoverwrite] %s]",fileName);
+- if (strcmp(tcl->result,"yes") != 0)
++ if (strcmp(Tcl_GetStringResult(tcl),"yes") != 0)
+ abortSave = 1;
+
+ fclose(f);
+@@ -908,7 +911,7 @@
+ if (TkGate.circuit->select || TkGate.circuit->mg_selection) {
+ sel_delete(es);
+ scrollbar_bbx_update();
+- } else if (DoTcl("tkg_getSelectedBlock") == TCL_OK && *tcl->result != 0) {
++ } else if (DoTcl("tkg_getSelectedBlock") == TCL_OK && Tcl_GetStringResult(tcl)[0] != 0) {
+ DoTcl("BlockOp::delete");
+ } else {
+ message(1,msgLookup("err.nodel")); /* "No deletable selection." */
+@@ -985,11 +988,11 @@
+ static int gat_computestrhash(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ if (argc != 2) {
+- sprintf(tcl->result,"wrong number of parameters.");
++ Tcl_SetResult(tcl, "wrong number of parameters.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+- sprintf(tcl->result,"%u",computestrhash(argv[1]));
++ Tcl_SetObjResult(tcl, Tcl_NewLongObj(computestrhash(argv[1])));
+
+ return TCL_OK;
+ }
+@@ -1094,7 +1097,7 @@
+ const char *modName;
+
+ if (argc != 2) {
+- strcpy(tcl->result,"wrong number of arguments.");
++ Tcl_SetResult(tcl, "wrong number of arguments.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -1310,7 +1313,7 @@
+ Circuit *c = TkGate.circuit;
+
+ if (argc != 3) {
+- strcpy(tcl->result,"wrong number of arguments.");
++ Tcl_SetResult(tcl, "wrong number of arguments.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -1423,7 +1426,7 @@
+ }
+ }
+ } else {
+- strcpy(tcl->result,"bad command.");
++ Tcl_SetResult(tcl, "bad command.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -1447,7 +1450,7 @@
+ GModuleDef *M;
+
+ if (argc != 4) {
+- strcpy(tcl->result,"wrong number of arguments.");
++ Tcl_SetResult(tcl, "wrong number of arguments.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -1468,7 +1471,7 @@
+ SetModified(MF_MODULE);
+ SynchronizeInterface();
+ } else {
+- strcpy(tcl->result,"bad command.");
++ Tcl_SetResult(tcl, "bad command.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -1560,8 +1563,8 @@
+ }
+
+ if (strcmp(argv[1],"-all") == 0) {
+- if (DoTcl("tkg_getSelectedBlock") == TCL_OK && *tcl->result != 0)
+- modName = tcl->result;
++ if (DoTcl("tkg_getSelectedBlock") == TCL_OK && Tcl_GetStringResult(tcl)[0] != 0)
++ modName = Tcl_GetStringResult(tcl);
+ else if (g && (GCElement_getType(g) == GC_BLOCK || GCElement_getType(g) == GC_SYMBLOCK))
+ modName = g->u.block.moduleName;
+ else
+@@ -1579,7 +1582,7 @@
+ /*
+ * Scan circuit for instance of module M and update their interfaces.
+ */
+- if (strcmp(tcl->result,"yes") == 0) {
++ if (strcmp(Tcl_GetStringResult(tcl),"yes") == 0) {
+ Circuit *C = TkGate.circuit;
+ HashElem *he;
+ for (he = Hash_first(C->moduleTable);he;he = Hash_next(C->moduleTable,he)) {
+@@ -1965,7 +1968,7 @@
+ r = 0;
+ }
+
+- sprintf(tcl->result,"%d",r);
++ Tcl_SetObjResult(tcl, Tcl_NewIntObj(r));
+ return TCL_OK;
+ }
+
+@@ -1976,7 +1979,7 @@
+ int match = 0;
+
+ if (!g) {
+- *tcl->result = 0;
++ Tcl_ResetResult(tcl);
+ return TCL_OK;
+ }
+
+@@ -1991,11 +1994,11 @@
+ }
+
+ if (!match) {
+- *tcl->result = 0;
++ Tcl_ResetResult(tcl);
+ return TCL_OK;
+ }
+
+- GSimModule_getFullPath(TkGate.circuit->es->smod,g,tcl->result);
++ GSimModule_getFullPath(TkGate.circuit->es->smod,g,(char *)Tcl_GetStringResult(tcl));
+
+ return TCL_OK;
+ }
+@@ -2097,7 +2100,7 @@
+ double timeCorrection;
+
+ if (!Scope) {
+- sprintf(tcl->result,"0 0 0 0 ns 0");
++ Tcl_SetResult(tcl, "0 0 0 0 ns 0", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -2130,7 +2133,8 @@
+
+ timeCorrection = TkGate.circuit->simulator.si_tsmult/(double)Scope->s_precision;
+
+- sprintf(tcl->result,"%llu %llu %llu %lf %s %llu %llu",
++ char res[128];
++ sprintf(res,"%llu %llu %llu %lf %s %llu %llu",
+ start,
+ stop,
+ Scope->s_range,
+@@ -2138,6 +2142,7 @@
+ SimInterface_unitsToStr(TkGate.circuit->simulator.si_units),
+ first,
+ Scope->s_time);
++ Tcl_SetResult(tcl, res, TCL_VOLATILE);
+
+ return TCL_OK;
+ }
+@@ -2159,7 +2164,7 @@
+ }
+
+ lpp = traceLinesPerPage(orient, paper);
+- sprintf(tcl->result,"%lf",lpp);
++ Tcl_SetObjResult(tcl, Tcl_NewDoubleObj(lpp));
+
+ return TCL_OK;
+ }
+@@ -2200,14 +2205,14 @@
+
+ static int gat_getCircProp(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+- *tcl->result = 0;
++ Tcl_ResetResult(tcl);
+
+ if (strcmp(argv[1],"-script") == 0 && argc > 2) {
+ int i;
+
+ if (sscanf(argv[2],"%d",&i) != 1) return TCL_OK;
+ if (i >= TkGate.circuit->numInitScripts) return TCL_OK;
+- strcpy(tcl->result,TkGate.circuit->initScripts[i]);
++ Tcl_SetResult(tcl, TkGate.circuit->initScripts[i], TCL_STATIC);
+ }
+
+ return TCL_OK;
+@@ -2253,6 +2258,7 @@
+
+ if (argc != 3) return TCL_OK;
+
++ char res[128];
+ if (SimInterface_lookupGate(&TkGate.circuit->simulator,argv[1],&M,&g,&ss) == 0) {
+
+ if (M == TkGate.circuit->es->smod) gate_draw(g,0);
+@@ -2271,11 +2277,13 @@
+ g->wires[0]->net->n_nbits,
+ g->u.sw.dipval);
+
+- sprintf(tcl->result,"%x",g->u.sw.dipval);
++ sprintf(res,"%x",g->u.sw.dipval);
+ } else {
+- sprintf(tcl->result,"0");
++ sprintf(res,"0");
+ }
+
++ Tcl_SetResult(tcl, res, TCL_VOLATILE);
++
+
+ return TCL_OK;
+ }
+@@ -2349,9 +2357,9 @@
+ if (sscanf(argv[1],"%llu",&t) != 1) return TCL_ERROR;
+
+ if (tkgate_currentMode() == MM_SIMULATE)
+- SimInterface_formatTime(si, tcl->result, t);
++ SimInterface_formatTime(si, (char *)Tcl_GetStringResult(tcl), t);
+ else
+- sprintf(tcl->result,"%llu",t);
++ Tcl_SetObjResult(tcl, Tcl_NewLongObj(t));
+
+ return TCL_OK;
+ }
+@@ -2376,7 +2384,7 @@
+ else
+ old_mode = 0;
+
+- sprintf(tcl->result,"%d",old_mode);
++ Tcl_SetObjResult(tcl, Tcl_NewIntObj(old_mode));
+
+ if (argc > 1) {
+ sscanf(argv[1],"%d",&mode);
+@@ -2587,11 +2595,11 @@
+ */
+ if (tkgate_currentMode() == MM_SIMULATE) {
+ if (g && GCElement_isModule(g))
+- strcpy(tcl->result,"blksimu");
++ Tcl_SetResult(tcl, "blksimu", TCL_STATIC);
+ else if (TkGate.popstate.n)
+- strcpy(tcl->result,"wiresimu");
++ Tcl_SetResult(tcl, "wiresimu", TCL_STATIC);
+ else
+- strcpy(tcl->result,"simu");
++ Tcl_SetResult(tcl, "simu", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -2600,9 +2608,9 @@
+ */
+ if (tkgate_currentMode() == MM_ANALYZE) {
+ if (g && GCElement_isModule(g))
+- strcpy(tcl->result,"blkanal");
++ Tcl_SetResult(tcl, "blkanal", TCL_STATIC);
+ else
+- strcpy(tcl->result,"anal");
++ Tcl_SetResult(tcl, "anal", TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -2612,27 +2620,27 @@
+ if (TkGate.circuit->es->isInterface) {
+ if (g && GCElement_getType(g) == GC_BLOCK) {
+ if (block_hitPort(g,cx,cy))
+- strcpy(tcl->result,"intfblockport");
++ Tcl_SetResult(tcl, "intfblockport", TCL_STATIC);
+ else if (block_edgehit(g,x,y))
+- strcpy(tcl->result,"intfblockedge");
++ Tcl_SetResult(tcl, "intfblockedge", TCL_STATIC);
+ else
+- strcpy(tcl->result,"intfblock");
++ Tcl_SetResult(tcl, "intfblock", TCL_STATIC);
+ } else if (g && GCElement_getType(g) == GC_SYMBLOCK) {
+- strcpy(tcl->result,"intfblock");
++ Tcl_SetResult(tcl, "intfblock", TCL_STATIC);
+ } else
+- strcpy(tcl->result,"intf");
++ Tcl_SetResult(tcl, "intf", TCL_STATIC);
+
+ return TCL_OK;
+ }
+
+
+ if (EditState_getMode() != MODE_MOVE && EditState_getMode() != MODE_MOVESEL) {
+- strcpy(tcl->result,"notmove");
++ Tcl_SetResult(tcl, "notmove", TCL_STATIC);
+ return TCL_OK;
+ }
+
+ if (TkGate.circuit->mg_selection && !g)
+- strcpy(tcl->result,"multi");
++ Tcl_SetResult(tcl, "multi", TCL_STATIC);
+ else if (g) {
+ int N = GCElement_numPads(g);
+ int can_add = 0;
+@@ -2644,33 +2652,33 @@
+
+ if (g->typeinfo->Code == GC_BLOCK) {
+ if (block_hitPort(g,cx,cy))
+- strcpy(tcl->result,"blockport");
++ Tcl_SetResult(tcl, "blockport", TCL_STATIC);
+ else if (block_edgehit(g,cx,cy))
+- strcpy(tcl->result,"blockedge");
++ Tcl_SetResult(tcl, "blockedge", TCL_STATIC);
+ else
+- strcpy(tcl->result,"block");
++ Tcl_SetResult(tcl, "block", TCL_STATIC);
+ } else if (g->typeinfo->Code == GC_SYMBLOCK) {
+- strcpy(tcl->result,"block");
++ Tcl_SetResult(tcl, "block", TCL_STATIC);
+ } else if (g->typeinfo->Code == GC_JOINT) {
+ if (!g->wires[0] || !g->wires[1] || !g->wires[2] || !g->wires[3])
+- strcpy(tcl->result,"joint3");
++ Tcl_SetResult(tcl, "joint3", TCL_STATIC);
+ else
+- strcpy(tcl->result,"joint4");
++ Tcl_SetResult(tcl, "joint4", TCL_STATIC);
+ } else if (can_add)
+- strcpy(tcl->result,"MIgate");
++ Tcl_SetResult(tcl, "MIgate", TCL_STATIC);
+ else
+- strcpy(tcl->result,"gate");
++ Tcl_SetResult(tcl, "gate", TCL_STATIC);
+ } else if (TkGate.popstate.n) {
+ char *labelCode = TkGate.popstate.n->isLabeled ? "L" : "";
+ char *sizeCode = TkGate.popstate.n->showSize ? "S" : "";
+
+ if (TkGate.popstate.net && TkGate.popstate.net->n_nbits > 1)
+- sprintf(tcl->result,"mbwire%s%s",labelCode,sizeCode);
++ Tcl_AppendResult(tcl, "mbwire", labelCode, sizeCode, NULL);
+ else
+- sprintf(tcl->result,"wire%s",labelCode);
++ Tcl_AppendResult(tcl, "wire", labelCode, NULL);
+ }
+ else
+- strcpy(tcl->result,"canv");
++ Tcl_SetResult(tcl, "canv", TCL_STATIC);
+
+ /* ob_touch(TkGate.popstate); (popstate may need to be made undoable?) */
+
+@@ -2700,7 +2708,7 @@
+ int has_plus = 0;
+
+ if (argc < 2) {
+- strcpy(tcl->result,"bad mode ");
++ Tcl_SetResult(tcl, "bad mode", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2716,7 +2724,7 @@
+ } else if (strcmp(argv[1],"analyze") == 0) {
+ target_mode = MM_ANALYZE;
+ } else {
+- strcpy(tcl->result,"bad mode ");
++ Tcl_SetResult(tcl, "bad mode", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2760,7 +2768,7 @@
+ static int gat_getMajorMode(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ if (argc != 1) {
+- strcpy(tcl->result,"illegal argument.");
++ Tcl_SetResult(tcl, "illegal argument.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2768,16 +2776,16 @@
+
+ switch (tkgate_currentMode()) {
+ case MM_SIMULATE :
+- strcpy(tcl->result,"simulate");
++ Tcl_SetResult(tcl, "simulate", TCL_STATIC);
+ break;
+ case MM_EDIT :
+ if (editstate_isInterfaceMode())
+- strcpy(tcl->result,"interface");
++ Tcl_SetResult(tcl, "interface", TCL_STATIC);
+ else
+- strcpy(tcl->result,"edit");
++ Tcl_SetResult(tcl, "edit", TCL_STATIC);
+ break;
+ case MM_ANALYZE :
+- strcpy(tcl->result,"analyze");
++ Tcl_SetResult(tcl, "analyze", TCL_STATIC);
+ break;
+ }
+ return TCL_OK;
+@@ -2791,7 +2799,7 @@
+ GWireNode *wn1,*wn2;
+
+ if (argc < 2) {
+- strcpy(tcl->result,"bad cpath");
++ Tcl_SetResult(tcl, "bad cpath", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2807,7 +2815,7 @@
+
+ n = GModuleDef_findNet(TkGate.circuit->es->env,p);
+ if (!n) {
+- sprintf(tcl->result,"net '%s' not found.",p);
++ Tcl_AppendResult(tcl, "net '", p, "' not found.", NULL);
+ return TCL_ERROR;
+ }
+
+@@ -2849,7 +2857,7 @@
+ GWire *w = 0;
+
+ if (argc < 2) {
+- strcpy(tcl->result,"bad popup");
++ Tcl_SetResult(tcl, "bad popup", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2894,7 +2902,7 @@
+ } else if (strcmp(argv[1],"size") == 0) {
+ int size;
+ if (argc < 3 || sscanf(argv[2],"%d",&size) != 1) {
+- strcpy(tcl->result,"bad port size");
++ Tcl_SetResult(tcl, "bad port size", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ GNet_draw(w->net);
+@@ -2914,7 +2922,7 @@
+ SetModified(MF_INTERFACE);
+ SynchronizeInterface();
+ } else {
+- strcpy(tcl->result,"illegal port command.");
++ Tcl_SetResult(tcl, "illegal port command.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -2926,7 +2934,7 @@
+ if (argc > 1)
+ sscanf(argv[1],"%d",&TkGate.popstate.isSet);
+ else
+- sprintf(tcl->result,"%d",TkGate.popstate.isSet);
++ Tcl_SetObjResult(tcl, Tcl_NewIntObj(TkGate.popstate.isSet));
+
+ return TCL_OK;
+ }
+@@ -3075,11 +3083,10 @@
+ static int gat_getTechList(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ char **techs = GDelayDef_getTechList();
+- char *s,*p;
+ int l,i;
+
+ if (!techs) {
+- strcpy(TkGate.tcl->result,TKGATE_DEFAULT_TECH);
++ Tcl_SetResult(tcl, TKGATE_DEFAULT_TECH, TCL_STATIC);
+ return TCL_OK;
+ }
+
+@@ -3088,11 +3095,8 @@
+ l += strlen(techs[i])+1;
+ l++;
+
+- p = s = (char*)ob_malloc(l,"char*");
+ for (i = 0;techs[i];i++)
+- p += sprintf(p," %s",techs[i]);
+-
+- TkGate.tcl->result = s;
++ Tcl_AppendResult(tcl, " ", techs[i], NULL);
+
+ return TCL_OK;
+ }
+@@ -3147,7 +3151,7 @@
+ }
+
+ if (!tech) tech = "";
+- strcpy(tcl->result,tech);
++ Tcl_SetResult(tcl, tech, TCL_STATIC);
+
+ return TCL_OK;
+ }
+@@ -3155,7 +3159,7 @@
+ static int gat_makeMakeMenu(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ if (argc != 2) {
+- strcpy(tcl->result,"bad make menu");
++ Tcl_SetResult(tcl, "bad make menu", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -3173,6 +3177,8 @@
+ *
+ *
+ *****************************************************************************/
++int igen_strToSide(const char *side);
++void guessPortName(char *buf,GCElement *g,int orient,int dir,int nbits);
+ static int gat_validatePortName(ClientData _d,Tcl_Interp *tcl,int argc,const char *argv[])
+ {
+ TkgGateWin *gw = TkGate.gw;
+@@ -3192,7 +3198,7 @@
+
+
+ if (argc < 3) {
+- sprintf(tcl->result,"wrong number of parameters.");
++ Tcl_SetResult(tcl, "wrong number of parameters.", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+@@ -3254,7 +3260,7 @@
+
+ pickValidName(validName,newPortName,"P",curPorts);
+
+- strcpy(tcl->result,validName);
++ Tcl_SetResult(tcl, validName, TCL_VOLATILE);
+
+ if (curPorts)
+ delete_SHash(curPorts);
+@@ -3396,7 +3402,7 @@
+ unsigned flags = 0;
+
+ if (ob_get_mode() == OM_DISABLED) {
+- sprintf(tcl->result,"0");
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-ports-all
mailing list