Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 2015 04:56:46 +0000 (UTC)
From:      Mikhail Teterin <mi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r378043 - in head/devel/tcllib: . files
Message-ID:  <201501280456.t0S4ukYZ093681@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mi
Date: Wed Jan 28 04:56:45 2015
New Revision: 378043
URL: https://svnweb.freebsd.org/changeset/ports/378043
QAT: https://qat.redports.org/buildarchive/r378043/

Log:
  Use native (written in C) implementations, where available. This
  speeds up some operations -- like JSON-parsing, for example --
  by a lot.
  
  Pick a few other nits and bump PORTREVISION.
  
  PR:		195863
  Submitted by:	mi
  Approved by:	maintainer timeout
  Sponsored by:	http://sybpipe.com/

Added:
  head/devel/tcllib/files/patch-jpeg   (contents, props changed)
  head/devel/tcllib/files/patch-json   (contents, props changed)
  head/devel/tcllib/files/patch-tests   (contents, props changed)
  head/devel/tcllib/files/patch-warnings   (contents, props changed)
Modified:
  head/devel/tcllib/Makefile
  head/devel/tcllib/pkg-plist

Modified: head/devel/tcllib/Makefile
==============================================================================
--- head/devel/tcllib/Makefile	Wed Jan 28 02:22:43 2015	(r378042)
+++ head/devel/tcllib/Makefile	Wed Jan 28 04:56:45 2015	(r378043)
@@ -3,6 +3,7 @@
 
 PORTNAME=	tcllib
 PORTVERSION=	1.16
+PORTREVISION=	1
 CATEGORIES=	devel tcl
 
 MAINTAINER=	tcltk@FreeBSD.org
@@ -13,6 +14,8 @@ LICENSE_NAME=	Tcl/Tk License
 LICENSE_FILE=	${WRKSRC}/license.terms
 LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
 
+BUILD_DEPENDS=	critcl:${PORTSDIR}/devel/critcl
+
 OPTIONS_DEFINE=	DOCS MANPAGES
 
 USE_GITHUB=	yes
@@ -24,9 +27,12 @@ GH_TAGNAME=	${PORTNAME}_${PORTVERSION:S/
 USES+=		tcl
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV+=	ac_cv_path_tclsh="${TCLSH}"
-ALL_TARGET=	all
+ALL_TARGET=	critcl
 MAKE_ENV+=	LANG=C
 PORTDOCS=	*
+REINPLACE_ARGS=	-i'""'
+CFLAGS+=	-Wno-pointer-sign -Werror
+PLIST_SUB+=	BINARCH=${OPSYS:tl}-${ARCH}
 
 INSTALL_ARGS=	-pkgs -pkg-path ${STAGEDIR}${PREFIX}/lib/tcllib \
 		-apps -app-path ${STAGEDIR}${PREFIX}/bin \
@@ -73,11 +79,6 @@ post-patch:
 	   ${WRKSRC}/modules/doctools/tests/text/04 > ${WRKSRC}/modules/doctools/tests/text/04.new
 	${MV} ${WRKSRC}/modules/doctools/tests/text/04.new ${WRKSRC}/modules/doctools/tests/text/04
 #
-#	 .orig files confuse the pt module test suite and eventually get
-#	 installed
-#
-	${FIND} ${WRKSRC} -name "*.orig" -delete
-#
 #	man pages have the .tcllib suffix, so there's no need to have a
 #	tcllib_ prefix too
 #
@@ -99,9 +100,12 @@ post-patch:
 	for man in `${FIND} . -name "*.n"`; do \
 	    ${MV} $$man `echo $$man | ${SED} -e 's|n$$|tcllib.n|'`; \
 	done
+	cd ${WRKSRC}/modules/json/c && ${YACC} -b json json.y
 
 do-install:
 	cd ${WRKSRC} && ${TCLSH} ./installer.tcl ${INSTALL_ARGS}
+	${CP} -Rp ${WRKSRC}/modules/tcllibc ${STAGEDIR}${PREFIX}/lib/tcllib/
+	rm ${STAGEDIR}${PREFIX}/lib/tcllib/tcllibc/license.terms
 
 regression-test: build
 	cd ${WRKSRC} && ${SETENV} LANG=C LC_ALL=C DISPLAY= ${MAKE} test

Added: head/devel/tcllib/files/patch-jpeg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/tcllib/files/patch-jpeg	Wed Jan 28 04:56:45 2015	(r378043)
@@ -0,0 +1,12 @@
+--- modules/jpeg/jpeg.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/jpeg/jpeg.tcl	2014-12-09 00:28:21.000000000 -0500
+@@ -364,5 +364,8 @@
+     set fh [openJFIF $file]
+     set r [catch {getExifFromChannel $fh $type} err]
+-    close $fh
++    if {$err != ""} {
++	# If err is empty, the file is closed already
++	close $fh
++    }
+     return -code $r $err
+ }

Added: head/devel/tcllib/files/patch-json
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/tcllib/files/patch-json	Wed Jan 28 04:56:45 2015	(r378043)
@@ -0,0 +1,250 @@
+--- modules/json/c/json.y
++++ modules/json/c/json.y
+@@ -3,26 +3,32 @@
+  * Mikhail.
+  */
+ 
+ %{
+ #include <tcl.h>
++#include <errno.h>
+ #include <ctype.h>
+ #include <math.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <assert.h>
++#if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 4
++#define USE_DICT
++#endif
+ 
+ #include <json_y.h>
+ 
+ #define TOKEN(tok)   TRACE (("TOKEN  %s\n", tok))
+ #define TOKEN1(tok)  TRACE (("TOKEN  %s (%s)\n", tok, Tcl_GetString(context->obj)))
+ #define REDUCE(rule) TRACE (("REDUCE %s\n", rule))
+ 
+-#define TRUE_O  (Tcl_NewStringObj("true", 4))
+-#define FALSE_O (Tcl_NewStringObj("false", 5))
+-#define NULL_O  (Tcl_NewStringObj("null", 4))
++#define TRUE_O  staticobj(TRUEO)
++#define FALSE_O staticobj(FALSEO)
++#define NULL_O  staticobj(NULLO)
+ 
++enum constants { FALSEO, TRUEO, NULLO, NUMCONSTANTS };
++static Tcl_Obj * staticobj(enum constants);
+ static void jsonerror(struct context *, const char *);
+ static int  jsonlexp(struct context *context);
+ 
+ #define YYPARSE_PARAM_TYPE void *
+ #define YYPARSE_PARAM	   context
+@@ -105,18 +111,27 @@
+ 	}
+ 	;
+ 
+ members	: member
+ 	{
++#ifdef USE_DICT
++		$$ = Tcl_NewDictObj();
++		Tcl_DictObjPut(NULL, $$, $1.key, $1.val);
++#else
+ 	        $$ = Tcl_NewListObj(0, NULL);
+ 		Tcl_ListObjAppendElement(NULL, $$, $1.key);
+ 		Tcl_ListObjAppendElement(NULL, $$, $1.val);
++#endif
+ 	}
+ 	| members ',' member
+ 	{
++#ifdef USE_DICT
++		Tcl_DictObjPut(NULL, $1, $3.key, $3.val);
++#else
+ 		Tcl_ListObjAppendElement(NULL, $1, $3.key);
+ 		Tcl_ListObjAppendElement(NULL, $1, $3.val);
++#endif
+ 		$$ = $1;
+ 	}
+ 	;
+ 
+ member	: string ':' value
+@@ -177,10 +192,69 @@
+       continue;
+     }
+     break;
+   }
+ }
++
++/*
++ * JSON has 3 string-literals: "null", "true", and "false". Instead of
++ * creating a NEW Tcl-object EACH TIME such literal is encountered, we
++ * return the reference to the first such object created (and bump its
++ * reference-count to prevent memory errors).
++ */
++Tcl_Obj *
++staticobj(enum constants constant)
++{
++    static Tcl_Obj   *objects[NUMCONSTANTS];
++    Tcl_Obj         **p;
++
++    assert(constant >= 0 && constant < NUMCONSTANTS);
++    p = objects + constant;
++    if (*p == NULL) {
++	/*
++	 * This is the first time we were asked for an object for
++	 * this constant. Create it to the best of our ability.
++	 *
++	 * Using the trick below, rather than the usual
++	 * Tcl_NewStringObj(), avoids creation of a COPY
++	 * of the string "null". Such copying is a waste,
++	 * if the object itself is never to be freed...
++	 */
++	*p = Tcl_NewObj();
++	switch (constant) {
++	case NULLO:
++	    (*p)->bytes = (void *)"null";
++	    (*p)->length = 4;
++	    break;
++	case TRUEO:
++	    /*
++	     * A boolean-object's default string representation is
++	     * "0" or "1", but we'd like the fancier "false" and
++	     * "true" for our objects to better match the
++	     * expectations of JSON-users.
++	     */
++	    Tcl_SetBooleanObj(*p, 1);
++	    (*p)->bytes = (void *)"true";
++	    (*p)->length = 4;
++	    break;
++	case FALSEO:
++	    Tcl_SetBooleanObj(*p, 0);
++	    (*p)->bytes = (void *)"false";
++	    (*p)->length = 5;
++	    break;
++	default:
++	    Tcl_Panic("Internal error in %s:%d unknown constant %d",
++		__FILE__, __LINE__, (int)constant);
++	}
++    }
++    /*
++     * Increase the ref-count so nothing ever attempts to free
++     * neither the static object we are returning, nor its bytes.
++     */
++    Tcl_IncrRefCount(*p);
++    return *p;
++}
+ 
+ static int
+ jsonlexp(struct context *context)
+ {
+   const char *bp = NULL;
+@@ -191,10 +265,17 @@
+   enum {
+     PLAIN	= 0x0000ff00,
+     INSTR	= 0x00ff0000
+   } lstate;
+   double 	 d;
++  int		 i;
++  long	 	 l;
++  long long	 ll;
++  Tcl_WideInt	 wi;
++#ifdef USE_BIG_NUM
++  mp_int	 mpi;
++#endif
+   char		*end;
+   const char	*p;
+   int		 initialized = 0;
+ 
+   /*
+@@ -343,32 +424,63 @@
+       yyerror("Escape character outside of string");
+       TOKEN ("escape error");
+       return -1;
+     }
+ 
++    context->obj = NULL;
+     /*
+      * We already considered the null, true, and false
+      * above, so it can only be a number now.
+-     *
+-     * NOTE: At this point we do not care about double
+-     * versus integer, nor about the possible integer
+-     * range. We generate a plain string Tcl_Obj and leave
+-     * it to the user of the generated structure to
+-     * convert to a number when actually needed. This
+-     * defered conversion also ensures that the Tcl and
+-     * platform we are building against does not matter
+-     * regarding integer range, only the abilities of the
+-     * Tcl at runtime.
+      */
+-
++    errno = 0;
+     d = strtod(context->text, &end);
+-    if (end == context->text)
+-      goto bareword; /* Nothing parsed */
+-
+-    context->obj = Tcl_NewStringObj (context->text,
+-				     end - context->text);
+-
++    if (end == context->text || isnan(d) || isinf(d))
++	goto bareword; /* Nothing parsed */
++    if (context->text[0] == '0' && context->text[1] != '.') {
++	yyerror("Leading zeros aren't allowed in JSON");
++	TOKEN("Leading zero error");
++	return -1;
++    }
++    if (errno == ERANGE) {
++	/* Too large. Let TCL core deal with it */
++	goto donewithnumber;
++    }
++    /* See, if there was anything other than digit there: */
++    for (p = context->text; p != end; p++) {
++	if ((*p >= '0' && *p <= '9') || *p == '+' || *p == '-')
++	    continue;
++	context->obj = Tcl_NewDoubleObj(d);
++	goto donewithnumber;
++    }
++    /* Didn't find any non-digits, must be an integer: */
++    errno = 0;
++    ll = strtoll(context->text, &end, 10);
++    if (errno == ERANGE) {
++	/* Too large. Let TCL core deal with it */
++	goto donewithnumber;
++    }
++    /* Find the right integer-type for this number */
++    i = ll;	/* int ? */
++    if (i == ll) {
++	context->obj = Tcl_NewIntObj(i);
++	goto donewithnumber;
++    }
++    l = ll;	/* long ? */
++    if (l == ll) {
++	context->obj = Tcl_NewLongObj(l);
++	goto donewithnumber;
++    }
++    wi = ll;	/* Tcl_WideInt */
++    if (wi == ll) {
++	context->obj = Tcl_NewWideIntObj(wi);
++	goto donewithnumber;
++    }
++  donewithnumber:
++    if (context->obj == NULL) {
++	context->obj = Tcl_NewStringObj(context->text,
++					end - context->text);
++    }
+     context->remaining -= (end - context->text);
+     context->text = end;
+     TOKEN1 ("CONSTANT");
+     return CONSTANT;
+   }
+
+--- modules/json/tests/numbers.json
++++ modules/json/tests/numbers.json
+@@ -0,0 +1,6 @@
++{"numbers": {
++	"int"	:	123,
++	"long"	:	1234567890123456789,
++	"bigint":	12345678901234567890123456789012345678901234567890123456789
++}
++}
+
+--- modules/json/tests/numbers.result
++++ modules/json/tests/numbers.result
+@@ -0,0 +1,1 @@
++numbers {int 123 long 1234567890123456789 bigint 12345678901234567890123456789012345678901234567890123456789}

Added: head/devel/tcllib/files/patch-tests
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/tcllib/files/patch-tests	Wed Jan 28 04:56:45 2015	(r378043)
@@ -0,0 +1,48 @@
+--- modules/clock/iso8601.test	2014-02-11 14:04:18.000000000 -0500
++++ modules/clock/iso8601.test	2014-12-09 00:12:22.000000000 -0500
+@@ -27,5 +27,5 @@
+ test clock-iso8601-1.1 {parse_date, bad option} -body {
+     clock::iso8601 parse_date 1994-11-05 -foo x
+-} -returnCodes error -result {bad switch "-foo", must be -base, -format, -gmt, -locale or -timezone}
++} -returnCodes error -match regexp -result {bad (option|switch) "-foo", must be -base, -format, -gmt, -locale or -timezone}
+ 
+ # NOTE: While listed as legal, -format is NOT. This is because the
+--- modules/json/json.testsuite	2014-02-11 14:04:18.000000000 -0500
++++ modules/json/json.testsuite	2014-12-09 00:42:29.000000000 -0500
+@@ -51,9 +51,9 @@
+ test json-${impl}-3.0 {many-json2dict, wrong args, not enough} -body {
+     json::many-json2dict
+-} -returnCodes error -result {wrong # args: should be "json::many-json2dict jsonText ?max?"}
++} -returnCodes error -match glob -result {wrong # args: should be "*json::many?json2dict* jsonText ?max?"}
+ 
+ test json-${impl}-3.1 {many-json2dict, wrong args, too many} -body {
+     json::many-json2dict J M X
+-} -returnCodes error -result {wrong # args: should be "json::many-json2dict jsonText ?max?"}
++} -returnCodes error -match glob -result {wrong # args: should be "*json::many?json2dict* jsonText ?max?"}
+ 
+ test json-${impl}-3.2 {many-json2dict, bad limit, zero} -body {
+--- modules/snit/snit.test	2014-02-11 14:04:18.000000000 -0500
++++ modules/snit/snit.test	2014-12-09 01:18:46.000000000 -0500
+@@ -784,5 +784,5 @@
+ } -returnCodes {
+     error
+-} -result {unknown or ambiguous subcommand "foo": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}
++} -result {unknown or ambiguous subcommand "foo": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}
+ 
+ test dtypemethod-1.7 {can't delegate local typemethod: order 1} -body {
+@@ -3340,5 +3340,5 @@
+ } -cleanup {
+     dog destroy
+-} -result {unknown or ambiguous subcommand "foo": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}
++} -result {unknown or ambiguous subcommand "foo": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}
+ 
+ test dmethod-1.7 {can't delegate local method: order 1} -body {
+--- modules/struct/sets.test	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/sets.test	2014-12-09 01:39:00.000000000 -0500
+@@ -87,5 +87,5 @@
+ 	}
+ 	tcl {
+-	    if {[package vsatisfies [package present Tcl] 8.5]} {
++	    if {$tcl_version == 8.5} {
+ 		# In 8.5 head the alias itself is reported, not what it
+ 		# resolved to.

Added: head/devel/tcllib/files/patch-warnings
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/tcllib/files/patch-warnings	Wed Jan 28 04:56:45 2015	(r378043)
@@ -0,0 +1,876 @@
+--- modules/md4/md4c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/md4/md4c.tcl	2014-12-08 18:40:11.000000000 -0500
+@@ -23,4 +23,5 @@
+ 
+     critcl::ccode {
++        #include <string.h>
+         #include "md4.h"
+ 
+--- modules/sha1/sha1c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/sha1/sha1c.tcl	2014-12-08 20:08:21.000000000 -0500
+@@ -24,4 +24,5 @@
+         #include "sha1.h"
+         #include <stdlib.h>
++        #include <string.h>
+         #include <assert.h>
+         
+@@ -32,6 +33,5 @@
+         sha1_free_rep(Tcl_Obj* obj)
+         {
+-            SHA1_CTX* mp = (SHA1_CTX*) obj->internalRep.otherValuePtr;
+-            Tcl_Free(mp);
++            Tcl_Free(obj->internalRep.otherValuePtr);
+         }
+         
+--- modules/md5/md5c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/md5/md5c.tcl	2014-12-08 20:09:14.000000000 -0500
+@@ -19,4 +19,5 @@
+         #include "md5.h"
+         #include <assert.h>
++        #include <string.h>
+ 
+         static
+@@ -26,6 +27,5 @@
+         md5_free_rep(Tcl_Obj *obj)
+         {
+-            MD5_CTX *mp = (MD5_CTX *) obj->internalRep.otherValuePtr;
+-            Tcl_Free(mp);
++            Tcl_Free(obj->internalRep.otherValuePtr);
+         }
+         
+--- modules/struct/graph/arc.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/arc.c	2014-12-08 18:42:51.000000000 -0500
+@@ -3,8 +3,9 @@
+  */
+ 
+-#include <arc.h>
+-#include <attr.h>
+-#include <graph.h>
+-#include <util.h>
++#include "arc.h"
++#include "attr.h"
++#include "graph.h"
++#include "nacommon.h"
++#include "util.h"
+ 
+ /* .................................................. */
+--- modules/struct/graph/attr.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/attr.c	2014-12-08 18:52:56.000000000 -0500
+@@ -3,6 +3,8 @@
+  */
+ 
+-#include <attr.h>
+-#include <util.h>
++#include "attr.h"
++#include "util.h"
++#include <string.h>
++
+ 
+ /* .................................................. */
+--- modules/struct/graph/filter.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/filter.c	2014-12-08 19:09:17.000000000 -0500
+@@ -3,7 +3,8 @@
+  */
+ 
+-#include <nacommon.h>
+-#include <util.h>
+-#include <node.h>
++#include <string.h>
++#include "nacommon.h"
++#include "util.h"
++#include "node.h"
+ 
+ /* .................................................. */
+@@ -254,11 +254,10 @@
+ 	filter_none (interp, gx, &l);
+     } else {
+-	if (na->mode != NA_NONE) {
+-	    if (nodes) {
+-		filter_mode_n (na->mode, gx, &l, na->nc, na->nv, g);
+-	    } else {
+-		filter_mode_a (na->mode, gx, &l, na->nc, na->nv, g);
+-	    }
++	if (nodes) {
++	    filter_mode_n (na->mode, gx, &l, na->nc, na->nv, g);
++	} else {
++	    filter_mode_a (na->mode, gx, &l, na->nc, na->nv, g);
+ 	}
++
+ 	if (na->key && na->value) {
+ 	    filter_kv (interp, gx, &l, gf, g, na->key, na->value);
+@@ -325,4 +324,5 @@
+     case NA_INNER:     filter_mode_a_inn (gx, l, nc, nv, g); break;
+     case NA_OUT:       filter_mode_a_out (gx, l, nc, nv, g); break;
++    case NA_NONE:      /* nothing */;
+     }
+ }
+@@ -585,4 +585,5 @@
+     case NA_INNER:     filter_mode_n_inn (gx, l, nc, nv, g); break;
+     case NA_OUT:       filter_mode_n_out (gx, l, nc, nv, g); break;
++    case NA_NONE:      /* nothing */;
+     }
+ }
+--- modules/struct/sets_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/sets_c.tcl	2014-12-08 19:14:25.000000000 -0500
+@@ -54,5 +54,5 @@
+             S_intersect3,       S_size, S_subsetof,     S_subtract,
+             S_symdiff,  S_union
+-        };
++        } method;
+ 
+ 	int m;
+@@ -70,5 +70,5 @@
+          */
+ 
+-        switch (m) {
++        switch (method = m) {
+             case S_add:        return sm_ADD        (NULL, interp, objc, objv);
+             case S_contains:   return sm_CONTAINS   (NULL, interp, objc, objv);
+--- modules/struct/stack/ms.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/stack/ms.c	2014-12-08 20:27:34.000000000 -0500
+@@ -40,5 +40,5 @@
+ 	M_CLEAR, M_DESTROY, M_GET,    M_GETR, M_PEEK, M_PEEKR,
+ 	M_POP,   M_PUSH,    M_ROTATE, M_SIZE, M_TRIM, M_TRIMV
+-    };
++    } method;
+ 
+     if (objc < 2) {
+@@ -54,5 +54,5 @@
+      */
+ 
+-    switch (m) {
++    switch (method = m) {
+     case M_CLEAR:	return stm_CLEAR   (s, interp, objc, objv);
+     case M_DESTROY:	return stm_DESTROY (s, interp, objc, objv);
+--- modules/pt/pt_rdengine_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/pt/pt_rdengine_c.tcl	2014-12-08 19:24:26.000000000 -0500
+@@ -49,5 +49,5 @@
+ 
+ 	typedef struct PARAMg {
+-	    long int counter;
++	    size_t counter;
+ 	    char     buf [50];
+ 	} PARAMg;
+@@ -77,5 +77,5 @@
+ 	    
+ 	    paramg->counter ++;
+-	    sprintf (paramg->buf, "rde%d", paramg->counter);
++	    sprintf (paramg->buf, "rde%td", paramg->counter);
+ 	    return paramg->buf;
+ 
+--- modules/struct/queue_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/queue_c.tcl	2014-12-08 19:52:34.000000000 -0500
+@@ -36,5 +36,5 @@
+ 
+ 	typedef struct QDg {
+-	    long int counter;
++	    size_t counter;
+ 	    char buf [50];
+ 	} QDg;
+@@ -64,5 +64,5 @@
+ 	    
+ 	    qdg->counter ++;
+-	    sprintf (qdg->buf, "queue%d", qdg->counter);
++	    sprintf (qdg->buf, "queue%td", qdg->counter);
+ 	    return qdg->buf;
+ 
+--- modules/struct/stack_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/stack_c.tcl	2014-12-08 19:52:34.000000000 -0500
+@@ -41,5 +41,5 @@
+ 
+ 	typedef struct SDg {
+-	    long int counter;
++	    size_t counter;
+ 	    char buf [50];
+ 	} SDg;
+@@ -69,5 +69,5 @@
+ 	    
+ 	    sdg->counter ++;
+-	    sprintf (sdg->buf, "stack%d", sdg->counter);
++	    sprintf (sdg->buf, "stack%td", sdg->counter);
+ 	    return sdg->buf;
+ 
+--- modules/struct/tree_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree_c.tcl	2014-12-08 19:52:34.000000000 -0500
+@@ -42,5 +42,5 @@
+ 
+ 	typedef struct TDg {
+-	    long int counter;
++	    size_t   counter;
+ 	    char buf [50];
+ 	} TDg;
+@@ -70,5 +70,5 @@
+ 	    
+ 	    tdg->counter ++;
+-	    sprintf (tdg->buf, "tree%d", tdg->counter);
++	    sprintf (tdg->buf, "tree%td", tdg->counter);
+ 	    return tdg->buf;
+ 
+--- modules/struct/graph/ds.h	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/ds.h	2014-12-08 20:36:48.000000000 -0500
+@@ -161,5 +161,5 @@
+ 
+ typedef struct GG {
+-    long int counter;  /* Graph id generator */
++    size_t   counter;  /* Graph id generator */
+     char     buf [50]; /* Buffer for handle construction */
+ } GG;
+--- modules/struct/graph/global.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/global.c	2014-12-08 20:35:07.000000000 -0500
+@@ -25,5 +25,5 @@
+ 	    
+   gg->counter ++;
+-  sprintf (gg->buf, "graph%d", gg->counter);
++  sprintf (gg->buf, "graph%td", gg->counter);
+   return gg->buf;
+ }
+--- modules/pt/rde_critcl/param.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/pt/rde_critcl/param.c	2014-12-08 21:28:24.000000000 -0500
+@@ -4,9 +4,11 @@
+  */
+ 
+-#include <param.h> /* Public and private APIs */
+-#include <stack.h> /* Stack handling */
+-#include <tc.h>    /* Token cache handling */
+-#include <util.h>  /* Allocation utilities */
++#include <stdint.h>
++#include <stdlib.h>
+ #include <string.h>
++#include "param.h" /* Public and private APIs */
++#include "stack.h" /* Stack handling */
++#include "tc.h"    /* Token cache handling */
++#include "util.h"  /* Allocation utilities */
+ 
+ /*
+@@ -652,5 +654,5 @@
+     ASSERT_BOUNDS(s,p->numstr);
+ 
+-    rde_stack_push (p->ER->msg, (void*) s);
++    rde_stack_push (p->ER->msg, (void*)(intptr_t)s);
+ }
+ 
+@@ -799,5 +801,5 @@
+ 
+     tablePtr = (Tcl_HashTable*) Tcl_GetHashValue (hPtr);
+-    hPtr = Tcl_FindHashEntry (tablePtr, (char*) s);
++    hPtr = Tcl_FindHashEntry (tablePtr, (void*)(intptr_t)s);
+     if (!hPtr) { return 0; }
+ 
+@@ -840,5 +842,5 @@
+      */
+ 
+-    hPtr = Tcl_CreateHashEntry (&p->NC, (char*) at, &isnew);
++    hPtr = Tcl_CreateHashEntry (&p->NC, (void*)(intptr_t)at, &isnew);
+ 
+     if (isnew) {
+@@ -850,5 +852,5 @@
+     }
+ 
+-    hPtr = Tcl_CreateHashEntry (tablePtr, (char*) s, &isnew);
++    hPtr = Tcl_CreateHashEntry (tablePtr, (void *)(intptr_t)s, &isnew);
+ 
+     if (isnew) {
+@@ -922,5 +924,5 @@
+ 
+ SCOPE void
+-rde_param_i_test_char (RDE_PARAM p, char* c, int msg)
++rde_param_i_test_char (RDE_PARAM p, const char* c, int msg)
+ {
+     ASSERT_BOUNDS(msg,p->numstr);
+@@ -973,5 +975,5 @@
+ 
+ SCOPE void
+-rde_param_i_test_range (RDE_PARAM p, char* s, char* e, int msg)
++rde_param_i_test_range (RDE_PARAM p, const char* s, const char* e, int msg)
+ {
+     ASSERT_BOUNDS(msg,p->numstr);
+@@ -1044,5 +1046,7 @@
+ UniCharIsHexDigit (int character)
+ {
+-    return (character >= 0) && (character < 0x80) && isxdigit(character);
++    return UniCharIsDecDigit(character) ||
++	(character >= 'a' && character <= 'f') ||
++	(character >= 'A' && character <= 'F');
+ }
+ 
+@@ -1050,5 +1054,5 @@
+ UniCharIsDecDigit (int character)
+ {
+-    return (character >= 0) && (character < 0x80) && isdigit(character);
++    return (character >= '0') && (character <= '9');
+ }
+ 
+@@ -1678,5 +1682,5 @@
+ 
+ SCOPE void
+-rde_param_i_next_str (RDE_PARAM p, char* str, int m)
++rde_param_i_next_str (RDE_PARAM p, const char* str, int m)
+ {
+     int at = p->CL;
+@@ -1700,5 +1704,5 @@
+ 
+ SCOPE void
+-rde_param_i_next_class (RDE_PARAM p, char* class, int m)
++rde_param_i_next_class (RDE_PARAM p, const char* class, int m)
+ {
+     rde_param_i_input_next (p, m);
+--- modules/struct/tree/m.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/m.c	2014-12-08 20:05:53.000000000 -0500
+@@ -5,4 +5,6 @@
+  */
+ 
++#include <ctype.h>
++#include <stdint.h>
+ #include <string.h>
+ #include "util.h"
+@@ -19,4 +21,6 @@
+ static int TclGetIntForIndex (Tcl_Interp* interp, Tcl_Obj* objPtr,
+ 			      int endValue, int* indexPtr);
++static int TclCheckBadOctal (Tcl_Interp *interp, const char *value);
++static int TclFormatInt (char *buffer, long n);
+ 
+ /* .................................................. */
+@@ -2546,5 +2550,5 @@
+     res = t_walk (interp, tn, type, order,
+ 		  t_walk_invokecmd,
+-		  (Tcl_Obj*) cc, (Tcl_Obj*) ev, objv [0]);
++		  (void *)(intptr_t)cc, (Tcl_Obj*) ev, objv [0]);
+ 
+     ckfree ((char*) ev);
+--- modules/struct/tree/walk.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/walk.c	2014-12-08 20:07:16.000000000 -0500
+@@ -1,7 +1,8 @@
+ 
++#include <stdint.h>
+ #include <string.h>
+-#include "tcl.h"
+-#include <t.h>
+-#include <util.h>
++#include <tcl.h>
++#include "t.h"
++#include "util.h"
+ 
+ /* .................................................. */
+@@ -238,5 +239,5 @@
+ {
+     int	      res;
+-    int	      cc = (int)       dummy0;
++    int	      cc = (intptr_t)  dummy0;
+     Tcl_Obj** ev = (Tcl_Obj**) dummy1; /* cc+3 elements */
+ 
+--- modules/md5/md5.h	2014-02-11 14:04:18.000000000 -0500
++++ modules/md5/md5.h	2014-12-08 20:23:10.000000000 -0500
+@@ -60,5 +60,5 @@
+ 
+ void MD5Init   (MD5_CTX *mdContext);
+-void MD5Update (MD5_CTX *mdContext, unsigned char *buf, unsigned int len);
++void MD5Update (MD5_CTX *mdContext, const unsigned char *buf, unsigned int len);
+ void MD5Final  (unsigned char digest[16], MD5_CTX *mdContext);
+ void Transform (UINT4 *buf, UINT4 *in);
+--- modules/md5/md5.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/md5/md5.c	2014-12-08 20:22:05.000000000 -0500
+@@ -116,5 +116,5 @@
+  */
+ void MD5Update (mdContext, inBuf, inLen)
+-register MD5_CTX *mdContext; unsigned char *inBuf;
++register MD5_CTX *mdContext; const unsigned char *inBuf;
+ 		 unsigned int inLen;
+ {
+--- modules/md5crypt/md5cryptc.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/md5crypt/md5cryptc.tcl	2014-12-08 20:20:05.000000000 -0500
+@@ -30,4 +30,5 @@
+ namespace eval ::md5crypt {
+     critcl::ccode {
++#include <string.h>
+ #include "md5.h"
+ #ifdef _MSC_VER
+@@ -57,6 +58,7 @@
+                                const char *magic)
+         {
+-            static char     passwd[120], *p;
+-            static const unsigned char *sp,*ep;
++            static char     passwd[120];
++            char     *p;
++            const unsigned char *sp,*ep;
+             unsigned char	final[16];
+             int sl,pl,i;
+@@ -113,5 +115,5 @@
+             
+             /* Now make the output string */
+-            snprintf(passwd, sizeof(passwd), "%s%.*s$", (char *)magic,
++            p = passwd + snprintf(passwd, sizeof(passwd), "%s%.*s$", (char *)magic,
+                     sl, (const char *)sp);
+             
+@@ -143,6 +145,4 @@
+             }
+ 
+-            p = passwd + strlen(passwd);
+-            
+             l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
+             l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
+--- modules/rc4/rc4c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/rc4/rc4c.tcl	2014-12-08 20:25:20.000000000 -0500
+@@ -21,4 +21,6 @@
+ 
+     critcl::ccode {
++	#include <string.h>
++
+         typedef struct RC4_CTX {
+             unsigned char x;
+--- modules/sha1/sha256c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/sha1/sha256c.tcl	2014-12-08 20:26:13.000000000 -0500
+@@ -31,4 +31,5 @@
+         #include "sha256.h"
+         #include <stdlib.h>
++        #include <string.h>
+         #include <assert.h>
+         
+--- modules/struct/sets/m.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/sets/m.c	2014-12-08 20:40:10.000000000 -0500
+@@ -81,5 +81,5 @@
+ 	    }
+ 
+-	    (void*) Tcl_CreateHashEntry(&vs->el, key, &new);
++	    Tcl_CreateHashEntry(&vs->el, key, &new);
+ 	    nx = 1;
+ 	}
+--- modules/struct/sets/s.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/sets/s.c	2014-12-08 21:36:17.000000000 -0500
+@@ -294,5 +294,5 @@
+ 	/* key is in a, not in b <=> in (a-b) */
+ 
+-	(void*) Tcl_CreateHashEntry(&s->el, key, &new);
++	Tcl_CreateHashEntry(&s->el, key, &new);
+     }
+ 
+@@ -330,5 +330,5 @@
+ 	/* key is in a, in b <=> in (a*b) */
+ 
+-	(void*) Tcl_CreateHashEntry(&s->el, key, &new);
++	Tcl_CreateHashEntry(&s->el, key, &new);
+     }
+ 
+@@ -366,5 +366,5 @@
+ 	    he = Tcl_NextHashEntry(&hs)) {
+ 	    key = Tcl_GetHashKey (&b->el, he);
+-	    (void*) Tcl_CreateHashEntry(&a->el, key, &new);
++	    Tcl_CreateHashEntry(&a->el, key, &new);
+ 	    if (new) {nx = 1;}
+ 	}
+@@ -378,5 +378,5 @@
+     int new;
+ 
+-    (void*) Tcl_CreateHashEntry(&a->el, item, &new);
++    Tcl_CreateHashEntry(&a->el, item, &new);
+ }
+ 
+--- modules/struct/tree/ms.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/ms.c	2014-12-08 21:02:50.000000000 -0500
+@@ -313,5 +313,5 @@
+ 	M_ROOTNAME,    M_SERIALIZE,   M_SET,	   M_SIZE,     M_SPLICE,
+ 	M_SWAP,	       M_UNSET,	      M_WALK,	   M_WALKPROC
+-    };
++    } method;
+ 
+     if (objc < 2) {
+@@ -327,5 +327,5 @@
+      */
+ 
+-    switch (m) {
++    switch (method = m) {
+     case M_TASSIGN:	return tm_TASSIGN     (t, interp, objc, objv);
+     case M_TSET:	return tm_TSET	      (t, interp, objc, objv);
+--- modules/struct/tree/t.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/t.c	2014-12-08 21:07:14.000000000 -0500
+@@ -3,7 +3,8 @@
+  */
+ 
+-#include <t.h>
+-#include <tn.h>
+-#include <util.h>
++#include <string.h>
++#include "t.h"
++#include "tn.h"
++#include "util.h"
+ 
+ /* .................................................. */
+--- modules/struct/tree/tn.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/tn.c	2014-12-08 21:09:28.000000000 -0500
+@@ -3,6 +3,7 @@
+  */
+ 
+-#include <tn.h>
+-#include <util.h>
++#include "t.h"
++#include "tn.h"
++#include "util.h"
+ 
+ /* .................................................. */
+--- modules/struct/tree/util.h	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/util.h	2014-12-08 21:15:54.000000000 -0500
+@@ -53,5 +53,5 @@
+ void  nlq_push   (NLQ* q, void* n);
+ void* nlq_pop    (NLQ* q);
+-void* nlq_clear  (NLQ* q);
++void  nlq_clear  (NLQ* q);
+ 
+ #endif /* _UTIL_H */
+--- modules/struct/tree/util.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/tree/util.c	2014-12-08 21:15:58.000000000 -0500
+@@ -78,5 +78,5 @@
+  */
+ 
+-void*
++void
+ nlq_clear (NLQ* q)
+ {
+--- modules/struct/graph/util.h	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/util.h	2014-12-08 21:56:17.000000000 -0500
+@@ -54,5 +54,5 @@
+ void  g_nlq_push   (NLQ* q, void* n);
+ void* g_nlq_pop    (NLQ* q);
+-void* g_nlq_clear  (NLQ* q);
++void  g_nlq_clear  (NLQ* q);
+ 
+ #endif /* _G_UTIL_H */
+--- modules/struct/graph/util.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/struct/graph/util.c	2014-12-08 21:55:44.000000000 -0500
+@@ -78,5 +78,5 @@
+  */
+ 
+-void*
++void
+ g_nlq_clear (NLQ* q)
+ {
+--- modules/pt/rde_critcl/p.c	2014-02-11 14:04:18.000000000 -0500
++++ modules/pt/rde_critcl/p.c	2014-12-08 21:21:53.000000000 -0500
+@@ -3,7 +3,8 @@
+  */
+ 
+-#include <pInt.h> /* Our public and internal APIs */
+-#include <util.h> /* Allocation macros */
++#include <stdint.h>
+ #include <string.h>
++#include "pInt.h" /* Our public and internal APIs */
++#include "util.h" /* Allocation macros */
+ 
+ /* .................................................. */
+@@ -129,5 +130,5 @@
+     ASSERT (isnew, "Should have found entry");
+ 
+-    Tcl_SetHashValue (hPtr, p->numstr);
++    Tcl_SetHashValue (hPtr, (intptr_t)p->numstr);
+ 
+     if (p->numstr >= p->maxnum) {
+--- modules/pt/rde_critcl/param.h	2014-02-11 14:04:18.000000000 -0500
++++ modules/pt/rde_critcl/param.h	2014-12-08 21:25:36.000000000 -0500
+@@ -90,6 +90,6 @@
+ SCOPE void rde_param_i_symbol_save       (RDE_PARAM p, int s);
+ 
+-SCOPE void rde_param_i_test_char         (RDE_PARAM p, char* c, int m);
+-SCOPE void rde_param_i_test_range        (RDE_PARAM p, char* s, char* e, int m);
++SCOPE void rde_param_i_test_char         (RDE_PARAM p, const char* c, int m);
++SCOPE void rde_param_i_test_range        (RDE_PARAM p, const char* s, const char* e, int m);
+ 
+ SCOPE void rde_param_i_test_alnum        (RDE_PARAM p);
+@@ -166,6 +166,6 @@
+ SCOPE int  rde_param_i_bra_value2value (RDE_PARAM p);
+ 
+-SCOPE void rde_param_i_next_str   (RDE_PARAM p, char* str,   int m);
+-SCOPE void rde_param_i_next_class (RDE_PARAM p, char* class, int m);
++SCOPE void rde_param_i_next_str   (RDE_PARAM p, const char* str,   int m);
++SCOPE void rde_param_i_next_class (RDE_PARAM p, const char* class, int m);
+ 
+ /* SKIP END */
+--- modules/pt/pt_parse_peg_c.tcl	2014-02-11 14:04:18.000000000 -0500
++++ modules/pt/pt_parse_peg_c.tcl	2014-12-08 21:04:35.000000000 -0500
+@@ -46,4 +46,6 @@
+ 	/* -*- c -*- */
+ 
++	#include <stdint.h>
++	#include <stdlib.h>
+ 	#include <string.h>
+ 	#define SCOPE static
+@@ -883,5 +885,5 @@
+ 	    p->ER->msg      = rde_stack_new (NULL);
+ 	    ASSERT_BOUNDS(s,p->numstr);
+-	    rde_stack_push (p->ER->msg, (void*) s);
++	    rde_stack_push (p->ER->msg, (void*)(intptr_t)s);
+ 	}
+ 	static void
+@@ -972,5 +974,5 @@
+ 	    if (!hPtr) { return 0; }
+ 	    tablePtr = (Tcl_HashTable*) Tcl_GetHashValue (hPtr);
+-	    hPtr = Tcl_FindHashEntry (tablePtr, (char*) s);
++	    hPtr = Tcl_FindHashEntry (tablePtr, (void *)(intptr_t)s);
+ 	    if (!hPtr) { return 0; }
+ 	    
+@@ -988,5 +990,5 @@
+ 	rde_param_i_symbol_save (RDE_PARAM p, int s)
+ 	{
+-	    long int       at = (long int) rde_stack_top (p->LS);
++	    intptr_t       at = (intptr_t)rde_stack_top (p->LS);
+ 	    NC_STATE*      scs;
+ 	    Tcl_HashEntry* hPtr;
+@@ -997,5 +999,5 @@
+ 	    TRACE (("INT       %d",s));
+ 	    
+-	    hPtr = Tcl_CreateHashEntry (&p->NC, (char*) at, &isnew);
++	    hPtr = Tcl_CreateHashEntry (&p->NC, (void*) at, &isnew);
+ 	    if (isnew) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501280456.t0S4ukYZ093681>