[packages/tcl] - up to 8.6.1; drop readline patch (there is external tcl module for this afaik now); drop cflags ha

arekm arekm at pld-linux.org
Sat May 31 20:20:09 CEST 2014


commit b3b916a12a97c5a749e1e486d0404779d4e7a998
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat May 31 20:20:04 2014 +0200

    - up to 8.6.1; drop readline patch (there is external tcl module for this afaik now); drop cflags hacking - use simpler way

 tcl-hidden.patch   |  37 ++---
 tcl-multilib.patch |  10 +-
 tcl-norpath.patch  |   7 +-
 tcl-opt.patch      |  29 ++++
 tcl-readline.patch | 418 -----------------------------------------------------
 tcl.spec           |  21 ++-
 6 files changed, 68 insertions(+), 454 deletions(-)
---
diff --git a/tcl.spec b/tcl.spec
index 35bcff4..9142b51 100644
--- a/tcl.spec
+++ b/tcl.spec
@@ -5,8 +5,8 @@
 %bcond_with	threads
 %bcond_without	tests	# don't perform "make test"
 #
-%define		major	8.5
-%define		minor	15
+%define		major	8.6
+%define		minor	1
 Summary:	Tool Command Language embeddable scripting language, with shared libraries
 Summary(fr.UTF-8):	Tool Command Language, langage de script avec bibliothèques partagées
 Summary(pl.UTF-8):	Tool Command Language - język skryptowy z bibliotekami dynamicznymi
@@ -18,12 +18,12 @@ Version:	%{major}.%{minor}
 Release:	1
 License:	BSD
 Group:		Development/Languages/Tcl
-Source0:	http://downloads.sourceforge.net/tcl/%{name}%{version}-src.tar.gz
-# Source0-md5:	f3df162f92c69b254079c4d0af7a690f
+Source0:	http://downloads.sourceforge.net/tcl/%{name}-core%{version}-src.tar.gz
+# Source0-md5:	f9d2fb6d673f19fbe387c792a6197477
 Source1:	%{name}-pl-man-pages.tar.bz2
 # Source1-md5:	dd3370f2b588763758787831a4bf48fc
 Patch0:		%{name}-ieee.patch
-Patch1:		%{name}-readline.patch
+
 Patch2:		%{name}-opt.patch
 Patch3:		%{name}-mannames.patch
 Patch4:		%{name}-soname_fix.patch
@@ -36,7 +36,6 @@ Patch10:	libc-version.patch
 URL:		http://www.tcl.tk/
 BuildRequires:	autoconf >= 2.59
 BuildRequires:	ncurses-devel >= 5.2
-BuildRequires:	readline-devel >= 4.2
 Requires:	tzdata
 Provides:	tcl(abi) = %{major}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -116,7 +115,7 @@ Pliki nagłówkowe oraz dokumentacja dla Tcl (Tool Command Language).
 %prep
 %setup -q -n %{name}%{version}
 %patch0 -p1
-%patch1 -p1
+
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
@@ -138,12 +137,9 @@ fi
 %endif
 
 cd unix
-sed -i -e "s/^CFLAGS_OPTIMIZE.*/CFLAGS_OPTIMIZE=%{rpmcflags} -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_REENTRANT -DTCL_NO_STACK_CHECK=1 -fPIC/" \
-       -e "s/^SHLIB_LD .*/SHLIB_LD=ld.bfd/" \
-       -e "s/^SHLIB_CFLAGS.*/SHLIB_CFLAGS=%{rpmldflags}/" \
-	Makefile.in
 %{__autoconf}
 %configure \
+	OPTFLAGS="%{rpmcflags} %{rpmcppflags}" \
 	--enable-langinfo \
 	--enable-shared \
 	--%{?with_threads:en}%{!?with_threads:dis}able-threads \
@@ -199,6 +195,7 @@ ln -sf libtcl%{major}.so.0.0 $RPM_BUILD_ROOT%{_libdir}/libtcl%{major}.so.0
 mv -f $RPM_BUILD_ROOT%{_bindir}/tclsh%{major} $RPM_BUILD_ROOT%{_bindir}/tclsh
 
 %{?have_ulibdir:mv $RPM_BUILD_ROOT%{_libdir}/tclConfig.sh $RPM_BUILD_ROOT%{_ulibdir}/tclConfig.sh}
+%{?have_ulibdir:mv $RPM_BUILD_ROOT%{_libdir}/tclooConfig.sh $RPM_BUILD_ROOT%{_ulibdir}/tclooConfig.sh}
 
 bzip2 -dc %{SOURCE1} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
 
@@ -360,12 +357,14 @@ rm -rf $RPM_BUILD_ROOT
 %files devel
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_ulibdir}/tclConfig.sh
+%attr(755,root,root) %{_ulibdir}/tclooConfig.sh
 %{_ulibdir}/tcl%{major}/tclAppInit.c
 %attr(755,root,root) %{_libdir}/libtcl%{major}.so
 %attr(755,root,root) %{_libdir}/libtcl.so
 %{_libdir}/libtclstub%{major}.a
 %{_includedir}/tcl*.h
 %{_includedir}/tcl-private
+%{_pkgconfigdir}/tcl.pc
 %{_mandir}/man3/TCL_*.3*
 %{_mandir}/man3/Tcl_*.3*
 %{_mandir}/man3/attemptck*alloc.3*
diff --git a/tcl-hidden.patch b/tcl-hidden.patch
index a6e3ee1..a37aabf 100644
--- a/tcl-hidden.patch
+++ b/tcl-hidden.patch
@@ -1,18 +1,8 @@
---- tcl8.5.9/generic/tclPort.h.orig	2010-02-01 00:51:36.000000000 +0100
-+++ tcl8.5.9/generic/tclPort.h	2010-10-02 08:15:42.668708988 +0200
-@@ -20,7 +20,7 @@
- #if defined(_WIN32)
- #   include "tclWinPort.h"
- #else
--#   include "tclUnixPort.h"
-+#   include "../unix/tclUnixPort.h"
- #endif
- #include "tcl.h"
- 
-diff -up tcl8.5.6/generic/tclInt.h.bbb tcl8.5.6/generic/tclInt.h
---- tcl8.5.6/generic/tclInt.h.bbb	2008-11-14 01:22:39.000000000 +0100
-+++ tcl8.5.6/generic/tclInt.h	2009-02-11 13:05:13.000000000 +0100
-@@ -2773,7 +2773,7 @@ MODULE_SCOPE void	TclClockInit(Tcl_Inter
+diff --git a/generic/tclInt.h b/generic/tclInt.h
+index 380284f..7bb5eb9 100644
+--- a/generic/tclInt.h
++++ b/generic/tclInt.h
+@@ -3160,7 +3160,7 @@ MODULE_SCOPE void	TclClockInit(Tcl_Interp *interp);
  MODULE_SCOPE int	TclClockOldscanObjCmd(
  			    ClientData clientData, Tcl_Interp *interp,
  			    int objc, Tcl_Obj *const objv[]);
@@ -21,8 +11,8 @@ diff -up tcl8.5.6/generic/tclInt.h.bbb tcl8.5.6/generic/tclInt.h
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj *const objv[]);
  MODULE_SCOPE int	Tcl_ConcatObjCmd(ClientData clientData,
-@@ -2934,7 +2934,7 @@ MODULE_SCOPE int	Tcl_RegsubObjCmd(Client
- MODULE_SCOPE int	Tcl_RenameObjCmd(ClientData clientData,
+@@ -3343,7 +3343,7 @@ MODULE_SCOPE int	Tcl_RenameObjCmd(ClientData clientData,
+ MODULE_SCOPE int	Tcl_RepresentationCmd(ClientData clientData,
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj *const objv[]);
 -MODULE_SCOPE int	Tcl_ReturnObjCmd(ClientData clientData,
@@ -30,3 +20,16 @@ diff -up tcl8.5.6/generic/tclInt.h.bbb tcl8.5.6/generic/tclInt.h
  			    Tcl_Interp *interp, int objc,
  			    Tcl_Obj *const objv[]);
  MODULE_SCOPE int	Tcl_ScanObjCmd(ClientData clientData,
+diff --git a/generic/tclPort.h b/generic/tclPort.h
+index 12a60db..d817154 100644
+--- a/generic/tclPort.h
++++ b/generic/tclPort.h
+@@ -20,7 +20,7 @@
+ #if defined(_WIN32)
+ #   include "tclWinPort.h"
+ #else
+-#   include "tclUnixPort.h"
++#   include "../unix/tclUnixPort.h"
+ #endif
+ #include "tcl.h"
+ 
diff --git a/tcl-multilib.patch b/tcl-multilib.patch
index f595c7d..225deb7 100644
--- a/tcl-multilib.patch
+++ b/tcl-multilib.patch
@@ -1,11 +1,11 @@
---- tcl8.5a5/unix/Makefile.in.orig	2007-03-02 15:35:09.000000000 +0100
-+++ tcl8.5a5/unix/Makefile.in	2007-03-02 15:35:26.000000000 +0100
-@@ -188,7 +188,7 @@
- # these definitions by hand.
+--- tcl8.6.1/unix/Makefile.in~	2014-05-31 18:42:07.000000000 +0200
++++ tcl8.6.1/unix/Makefile.in	2014-05-31 18:42:50.235198470 +0200
+@@ -176,7 +176,7 @@
+ # need to modify any of these definitions by hand.
  
  STLIB_LD		= @STLIB_LD@
 -SHLIB_LD		= @SHLIB_LD@
 +SHLIB_LD		= @SHLIB_LD@ ${CFLAGS}
- SHLIB_CFLAGS		= @SHLIB_CFLAGS@
+ SHLIB_CFLAGS		= @SHLIB_CFLAGS@ -DBUILD_tcl
  SHLIB_LD_LIBS		= @SHLIB_LD_LIBS@
  TCL_SHLIB_LD_EXTRAS	= @TCL_SHLIB_LD_EXTRAS@
diff --git a/tcl-norpath.patch b/tcl-norpath.patch
index a9aa9d8..ba72169 100644
--- a/tcl-norpath.patch
+++ b/tcl-norpath.patch
@@ -13,12 +13,13 @@
  # available; this causes everything in the "dltest" subdirectory to be built
 --- tcl8.5.13/unix/tcl.m4.orig	2012-11-28 21:29:42.223960573 +0100
 +++ tcl8.5.13/unix/tcl.m4	2012-11-28 21:31:03.440627511 +0100
-@@ -2103,7 +2103,7 @@
+@@ -2050,7 +2050,7 @@
  
      AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
          LIB_SUFFIX=${SHARED_LIB_SUFFIX}
--        MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
-+        MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS}'
+-        MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${TCL_SHLIB_LD_EXTRAS} ${SHLIB_LD_LIBS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
++        MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${TCL_SHLIB_LD_EXTRAS} ${SHLIB_LD_LIBS} ${TK_SHLIB_LD_EXTRAS}'
          AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
              INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
              DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
+
diff --git a/tcl-opt.patch b/tcl-opt.patch
index 4b228b7..9032290 100644
--- a/tcl-opt.patch
+++ b/tcl-opt.patch
@@ -13,3 +13,32 @@ diff -urN tcl8.5a2.org/unix/Makefile.in tcl8.5a2/unix/Makefile.in
  
  # Flags to pass to the linker
  LDFLAGS_DEBUG		= @LDFLAGS_DEBUG@
+--- tcl8.6.1/unix/tcl.m4~	2013-09-19 22:17:13.000000000 +0200
++++ tcl8.6.1/unix/tcl.m4	2014-05-31 19:44:20.670186134 +0200
+@@ -1114,7 +1114,7 @@
+     TCL_LIB_VERSIONS_OK=ok
+     CFLAGS_DEBUG=-g
+     AS_IF([test "$GCC" = yes], [
+-	CFLAGS_OPTIMIZE=-O2
++	CFLAGS_OPTIMIZE=${OPTFLAGS}
+ 	CFLAGS_WARNING="-Wall"
+     ], [
+ 	CFLAGS_OPTIMIZE=-O
+@@ -1409,7 +1409,7 @@
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_SUFFIX=".so"
+ 
+-	    CFLAGS_OPTIMIZE="-O2"
++	    CFLAGS_OPTIMIZE="${OPTFLAGS}"
+ 	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
+ 	    # when you inline the string and math operations.  Turn this off to
+ 	    # get rid of the warnings.
+@@ -1507,7 +1507,7 @@
+ 		CFLAGS_OPTIMIZE="-O0"
+ 		;;
+ 	    *)
+-		CFLAGS_OPTIMIZE="-O2"
++		CFLAGS_OPTIMIZE="${OPTFLAGS}"
+ 		;;
+ 	    esac
+ 	    AS_IF([test "${TCL_THREADS}" = "1"], [
diff --git a/tcl-readline.patch b/tcl-readline.patch
deleted file mode 100644
index 5596424..0000000
--- a/tcl-readline.patch
+++ /dev/null
@@ -1,418 +0,0 @@
---- tcl8.5.9/unix/Makefile.in.orig	2010-09-08 19:40:48.000000000 +0200
-+++ tcl8.5.9/unix/Makefile.in	2010-10-02 08:09:01.572556463 +0200
-@@ -269,7 +269,7 @@
- DEPEND_SWITCHES	= ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \
- ${AC_FLAGS} ${PROTO_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@
- 
--TCLSH_OBJS = tclAppInit.o
-+TCLSH_OBJS = tclAppInit.o rl-tclMain.o
- 
- TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \
- 	tclThreadTest.o tclUnixTest.o
-@@ -567,7 +567,7 @@
- 
- ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE}
- 	${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \
--		${CC_SEARCH_FLAGS} -o ${TCL_EXE}
-+		-lreadline -lncurses ${CC_SEARCH_FLAGS} -o ${TCL_EXE}
- 
- # Resetting the LIB_RUNTIME_DIR below is required so that the generated
- # tcltest executable gets the build directory burned into its ld search path.
---- /dev/null	1970-01-01 01:00:00.000000000 +0100
-+++ tcl8.4.3/unix/rl-tclMain.c	2003-06-09 22:13:58.000000000 +0200
-@@ -0,0 +1,395 @@
-+/* 
-+ * tclMain.c --
-+ *
-+ *	Main program for Tcl shells and other Tcl-based applications.
-+ *
-+ * Copyright (c) 1988-1994 The Regents of the University of California.
-+ * Copyright (c) 1994-1996 Sun Microsystems, Inc.
-+ *
-+ * See the file "license.terms" for information on usage and redistribution
-+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-+ *
-+ * SCCS: @(#) tclMain.c 1.54 97/08/07 19:04:43
-+ */
-+
-+#include "tcl.h"
-+#include "tclInt.h"
-+
-+#ifndef USESTDIN
-+#ifndef __cplusplus
-+#include <readline/readline.h>
-+#else /* __cplusplus */
-+EXTERN char *readline (char *prompt);
-+EXTERN void add_history (char *line);
-+#endif /* __cplusplus */
-+#endif /* USESTDIN */
-+
-+/*
-+ * The following code ensures that tclLink.c is linked whenever
-+ * Tcl is linked.  Without this code there's no reference to the
-+ * code in that file from anywhere in Tcl, so it may not be
-+ * linked into the application.
-+ */
-+
-+EXTERN int tcl_LinkVar _ANSI_ARGS_((Tcl_Interp *interp,
-+				    char *varName, char *addr, int type));
-+#ifdef __cplusplus
-+EXTERN 
-+#endif /* __cplusplus */
-+typedef int (*dummyfnptrtype)(Tcl_Interp *interp, char *varName, char *addr, int type);
-+
-+dummyfnptrtype tclDummyLinkVarPtr = Tcl_LinkVar;
-+
-+/*
-+ * Declarations for various library procedures and variables (don't want
-+ * to include tclPort.h here, because people might copy this file out of
-+ * the Tcl source directory to make their own modified versions).
-+ * Note:  "exit" should really be declared here, but there's no way to
-+ * declare it without causing conflicts with other definitions elsewher
-+ * on some systems, so it's better just to leave it out.
-+ */
-+
-+EXTERN int		isatty _ANSI_ARGS_((int fd));
-+EXTERN char *		strcpy _ANSI_ARGS_((char *dst, CONST char *src));
-+
-+static Tcl_Interp *interp;	/* Interpreter for application. */
-+
-+#ifdef TCL_MEM_DEBUG
-+static char dumpFile[100];	/* Records where to dump memory allocation
-+				 * information. */
-+static int quitFlag = 0;	/* 1 means "checkmem" command was called,
-+				 * so the application should quit and dump
-+				 * memory allocation information. */
-+#endif
-+
-+/*
-+ * Forward references for procedures defined later in this file:
-+ */
-+
-+#ifdef TCL_MEM_DEBUG
-+static int		CheckmemCmd _ANSI_ARGS_((ClientData clientData,
-+			    Tcl_Interp *interp, int argc, char *argv[]));
-+#endif
-+

-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * Tcl_Main --
-+ *
-+ *	Main program for tclsh and most other Tcl-based applications.
-+ *
-+ * Results:
-+ *	None. This procedure never returns (it exits the process when
-+ *	it's done.
-+ *
-+ * Side effects:
-+ *	This procedure initializes the Tk world and then starts
-+ *	interpreting commands;  almost anything could happen, depending
-+ *	on the script being interpreted.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+
-+void
-+Tcl_Main(
-+    int argc,			/* Number of arguments. */
-+    char **argv,		/* Array of argument strings. */
-+    Tcl_AppInitProc *appInitProc)
-+				/* Application-specific initialization
-+				 * procedure to call after most
-+				 * initialization but before starting to
-+				 * execute commands. */
-+{
-+    Tcl_Obj *prompt1NamePtr = NULL;
-+    Tcl_Obj *prompt2NamePtr = NULL;
-+    Tcl_Obj *resultPtr;
-+    Tcl_Obj *commandPtr = NULL;
-+    char buffer[1000], *args, *fileName, *bytes;
-+    int code, gotPartial, tty, length;
-+    int exitCode = 0;
-+    Tcl_Channel inChannel, outChannel, errChannel;
-+
-+    Tcl_FindExecutable(argv[0]);
-+    interp = Tcl_CreateInterp();
-+#ifdef TCL_MEM_DEBUG
-+    Tcl_InitMemory(interp);
-+    Tcl_CreateCommand(interp, "checkmem", CheckmemCmd, (ClientData) 0,
-+	    (Tcl_CmdDeleteProc *) NULL);
-+#endif
-+
-+    /*
-+     * Make command-line arguments available in the Tcl variables "argc"
-+     * and "argv".  If the first argument doesn't start with a "-" then
-+     * strip it off and use it as the name of a script file to process.
-+     */
-+
-+    fileName = NULL;
-+    if ((argc > 1) && (argv[1][0] != '-')) {
-+	fileName = argv[1];
-+	argc--;
-+	argv++;
-+    }
-+    args = Tcl_Merge(argc-1, argv+1);
-+    Tcl_SetVar(interp, "argv", args, TCL_GLOBAL_ONLY);
-+    ckfree(args);
-+    TclFormatInt(buffer, argc-1);
-+    Tcl_SetVar(interp, "argc", buffer, TCL_GLOBAL_ONLY);
-+    Tcl_SetVar(interp, "argv0", (fileName != NULL) ? fileName : argv[0],
-+	    TCL_GLOBAL_ONLY);
-+
-+    /*
-+     * Set the "tcl_interactive" variable.
-+     */
-+
-+    tty = isatty(0);
-+    Tcl_SetVar(interp, "tcl_interactive",
-+	    ((fileName == NULL) && tty) ? "1" : "0", TCL_GLOBAL_ONLY);
-+    
-+    /*
-+     * Invoke application-specific initialization.
-+     */
-+
-+    if ((*appInitProc)(interp) != TCL_OK) {
-+	errChannel = Tcl_GetStdChannel(TCL_STDERR);
-+	if (errChannel) {
-+	    Tcl_Write(errChannel,
-+		    "application-specific initialization failed: ", -1);
-+	    Tcl_Write(errChannel, interp->result, -1);
-+	    Tcl_Write(errChannel, "\n", 1);
-+	}
-+    }
-+
-+    /*
-+     * If a script file was specified then just source that file
-+     * and quit.
-+     */
-+
-+    if (fileName != NULL) {
-+	code = Tcl_EvalFile(interp, fileName);
-+	if (code != TCL_OK) {
-+	    errChannel = Tcl_GetStdChannel(TCL_STDERR);
-+	    if (errChannel) {
-+		/*
-+		 * The following statement guarantees that the errorInfo
-+		 * variable is set properly.
-+		 */
-+
-+		Tcl_AddErrorInfo(interp, "");
-+		Tcl_Write(errChannel,
-+			Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1);
-+		Tcl_Write(errChannel, "\n", 1);
-+	    }
-+	    exitCode = 1;
-+	}
-+	goto done;
-+    }
-+
-+    /*
-+     * We're running interactively.  Source a user-specific startup
-+     * file if the application specified one and if the file exists.
-+     */
-+
-+    Tcl_SourceRCFile(interp);
-+
-+    /*
-+     * Process commands from stdin until there's an end-of-file.  Note
-+     * that we need to fetch the standard channels again after every
-+     * eval, since they may have been changed.
-+     */
-+
-+    commandPtr = Tcl_NewObj();
-+    Tcl_IncrRefCount(commandPtr);
-+    prompt1NamePtr = Tcl_NewStringObj("tcl_prompt1", -1);
-+    Tcl_IncrRefCount(prompt1NamePtr);
-+    prompt2NamePtr = Tcl_NewStringObj("tcl_prompt2", -1);
-+    Tcl_IncrRefCount(prompt2NamePtr);
-+    
-+    inChannel = Tcl_GetStdChannel(TCL_STDIN);
-+    outChannel = Tcl_GetStdChannel(TCL_STDOUT);
-+    gotPartial = 0;
-+    while (1) {
-+	if (tty) {
-+	    Tcl_Obj *promptCmdPtr;
-+	    char *prompt;
-+	    char *line;
-+
-+	    promptCmdPtr = Tcl_ObjGetVar2(interp,
-+		    (gotPartial? prompt2NamePtr : prompt1NamePtr),
-+		    (Tcl_Obj *) NULL, TCL_GLOBAL_ONLY);
-+	    if (promptCmdPtr == NULL) {
-+                defaultPrompt:
-+		if (!gotPartial) {
-+		    prompt = "% ";
-+		} else {
-+		    prompt = "+ ";
-+		}
-+		length = strlen(prompt);
-+	    } else {
-+		code = Tcl_EvalObj(interp, promptCmdPtr);
-+		inChannel = Tcl_GetStdChannel(TCL_STDIN);
-+		outChannel = Tcl_GetStdChannel(TCL_STDOUT);
-+		errChannel = Tcl_GetStdChannel(TCL_STDERR);
-+		if (code != TCL_OK) {
-+		    if (errChannel) {
-+			resultPtr = Tcl_GetObjResult(interp);
-+			bytes = Tcl_GetStringFromObj(resultPtr, &length);
-+			Tcl_Write(errChannel, bytes, length);
-+			Tcl_Write(errChannel, "\n", 1);
-+		    }
-+		    Tcl_AddErrorInfo(interp,
-+			    "\n    (script that generates prompt)");
-+		    goto defaultPrompt;
-+		}
-+		resultPtr = Tcl_GetObjResult(interp);
-+		prompt = Tcl_GetStringFromObj(resultPtr, &length);
-+	    }
-+#ifdef USESTDIN
-+	    if (outChannel) {
-+		Tcl_Write(outChannel, prompt, length);
-+		Tcl_Flush(outChannel);
-+	    }
-+	}
-+	if (!inChannel) {
-+	    goto done;
-+	}
-+        length = Tcl_GetsObj(inChannel, commandPtr);
-+	if (length < 0) {
-+	    goto done;
-+	}
-+	if ((length == 0) && Tcl_Eof(inChannel) && (!gotPartial)) {
-+	    goto done;
-+	}
-+
-+#else /* !USESTDIN */
-+	    line = readline(prompt);
-+	    if(line != NULL) {
-+		length = strlen(line);
-+		Tcl_AppendToObj(commandPtr, line, length);
-+	    } else {
-+		goto done;
-+	    }
-+            /* Clean up the string allocated by readline & add it to history */
-+	    if(line) {
-+	        if(*line) {
-+		    add_history(line);
-+	        }
-+	        free(line);
-+ 	    }
-+	} else {
-+	    /* using readline but not a tty - must use gets */
-+	    if (!inChannel) {
-+		goto done;
-+	    }
-+	    length = Tcl_GetsObj(inChannel, commandPtr);
-+	    if (length < 0) {
-+		goto done;
-+	    }
-+	    if ((length == 0) && Tcl_Eof(inChannel) && (!gotPartial)) {
-+		goto done;
-+	    }
-+	}
-+
-+#endif /* USESTDIN */
-+
-+        /*
-+         * Add the newline removed by Tcl_GetsObj back to the string.
-+         */
-+
-+	Tcl_AppendToObj(commandPtr, "\n", 1);
-+	if (!TclObjCommandComplete(commandPtr)) {
-+	    gotPartial = 1;
-+	    continue;
-+	}
-+
-+	gotPartial = 0;
-+	code = Tcl_RecordAndEvalObj(interp, commandPtr, 0);
-+	inChannel = Tcl_GetStdChannel(TCL_STDIN);
-+	outChannel = Tcl_GetStdChannel(TCL_STDOUT);
-+	errChannel = Tcl_GetStdChannel(TCL_STDERR);
-+	Tcl_SetObjLength(commandPtr, 0);
-+	if (code != TCL_OK) {
-+	    if (errChannel) {
-+		resultPtr = Tcl_GetObjResult(interp);
-+		bytes = Tcl_GetStringFromObj(resultPtr, &length);
-+		Tcl_Write(errChannel, bytes, length);
-+		Tcl_Write(errChannel, "\n", 1);
-+	    }
-+	} else if (tty) {
-+	    resultPtr = Tcl_GetObjResult(interp);
-+	    bytes = Tcl_GetStringFromObj(resultPtr, &length);
-+	    if ((length > 0) && outChannel) {
-+		Tcl_Write(outChannel, bytes, length);
-+		Tcl_Write(outChannel, "\n", 1);
-+	    }
-+	}
-+#ifdef TCL_MEM_DEBUG
-+	if (quitFlag) {
-+	    Tcl_DecrRefCount(commandPtr);
-+	    Tcl_DecrRefCount(prompt1NamePtr);
-+	    Tcl_DecrRefCount(prompt2NamePtr);
-+	    Tcl_DeleteInterp(interp);
-+	    Tcl_Exit(0);
-+	}
-+#endif
-+    }
-+
-+    /*
-+     * Rather than calling exit, invoke the "exit" command so that
-+     * users can replace "exit" with some other command to do additional
-+     * cleanup on exit.  The Tcl_Eval call should never return.
-+     */
-+
-+    done:
-+    if (commandPtr != NULL) {
-+	Tcl_DecrRefCount(commandPtr);
-+    }
-+    if (prompt1NamePtr != NULL) {
-+	Tcl_DecrRefCount(prompt1NamePtr);
-+    }
-+    if (prompt2NamePtr != NULL) {
-+	Tcl_DecrRefCount(prompt2NamePtr);
-+    }
-+    sprintf(buffer, "exit %d", exitCode);
-+    Tcl_Eval(interp, buffer);
-+}
-+

-+/*
-+ *----------------------------------------------------------------------
-+ *
-+ * CheckmemCmd --
-+ *
-+ *	This is the command procedure for the "checkmem" command, which
-+ *	causes the application to exit after printing information about
-+ *	memory usage to the file passed to this command as its first
-+ *	argument.
-+ *
-+ * Results:
-+ *	Returns a standard Tcl completion code.
-+ *
-+ * Side effects:
-+ *	None.
-+ *
-+ *----------------------------------------------------------------------
-+ */
-+#ifdef TCL_MEM_DEBUG
-+
-+	/* ARGSUSED */
-+static int
-+CheckmemCmd(
-+    ClientData clientData,		/* Not used. */
-+    Tcl_Interp *interp, 		/* Interpreter for evaluation. */
-+    int argc,				/* Number of arguments. */
-+    char *argv[])			/* String values of arguments. */
-+{
-+    extern char *tclMemDumpFileName;
-+    if (argc != 2) {
-+	Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
-+		" fileName\"", (char *) NULL);
-+	return TCL_ERROR;
-+    }
-+    strcpy(dumpFile, argv[1]);
-+    tclMemDumpFileName = dumpFile;
-+    quitFlag = 1;
-+    return TCL_OK;
-+}
-+#endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tcl.git/commitdiff/b3b916a12a97c5a749e1e486d0404779d4e7a998



More information about the pld-cvs-commit mailing list