diff options
-rw-r--r-- | ChangeLog | 42 | ||||
-rw-r--r-- | compat/strtoll.c | 107 | ||||
-rw-r--r-- | compat/strtoull.c | 255 | ||||
-rw-r--r-- | generic/tcl.h | 7 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 117 | ||||
-rw-r--r-- | generic/tclParse.c | 4 | ||||
-rw-r--r-- | tests/string.test | 8 | ||||
-rw-r--r-- | tools/mkdepend.tcl | 411 | ||||
-rw-r--r-- | unix/Makefile.in | 8 | ||||
-rwxr-xr-x | unix/configure | 4 | ||||
-rw-r--r-- | unix/configure.in | 4 | ||||
-rw-r--r-- | unix/tclConfig.h.in | 6 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 9 | ||||
-rw-r--r-- | win/Makefile.in | 7 | ||||
-rw-r--r-- | win/coffbase.txt | 8 | ||||
-rw-r--r-- | win/makefile.bc | 2 | ||||
-rw-r--r-- | win/makefile.vc | 85 | ||||
-rw-r--r-- | win/nmakehlp.c | 6 | ||||
-rw-r--r-- | win/rules.vc | 239 | ||||
-rw-r--r-- | win/tclWinPort.h | 9 |
20 files changed, 719 insertions, 619 deletions
@@ -1,3 +1,45 @@ +2007-10-15 Miguel Sofer <msofer@users.sf.net> + + * generic/tclParse.c (Tcl_ParseBraces): fix for possible read + after the end of buffer, [Bug 1813528] (Joe Mistachkin). + +2007-10-14 David Gravereaux <davygrvy@pobox.com> + + * tools/mkdepend.tcl (new): Initial stab at generating automatic + * win/makefile.vc: dependencies. + +2007-10-12 Pat Thoyts <patthoyts@users.sourceforge.net> + + * win/makefile.vc: Mine all version information from headers. + * win/rules.vc: Sync tcl and tk and bring extension versions + * win/nmakehlp.c: closer together. Try and avoid using tclsh + to do substitutions as we may cross compile. + * win/coffbase.txt: Added offsets for snack dlls. + +2007-10-11 David Gravereaux <davygrvy@pobox.com> + + * win/makefile.vc: Fixed my bad spelling mistakes from years back. + Dedependency, duh! Rather funny. + +2007-10-11 Don Porter <dgp@users.sourceforge.net> + + * generic/tclCmdMZ.c: Correct [string is (wide)integer] failure + * tests/string.test: to report correct failindex values for + non-decimal integer strings. [Bug 1805887]. + + * compat/strtoll.c (removed): The routines strtoll() and strtoull() + * compat/strtoull.c (removed): are no longer called by the Tcl source + * generic/tcl.h: code. (Their functionality has been replaced + * unix/Makefile.in: by TclParseNumber().) Remove outdated comments + * unix/configure.in: and mountains of configury autogoo that + * unix/tclUnixPort.h: allegedly support the mythical systems where + * win/Makefile.in: these routines might not have been available. + * win/makefile.bc: + * win/makefile.vc: + * win/tclWinPort.h: + + * unix/configure: autoconf-2.59 + 2007-10-11 Miguel Sofer <msofer@users.sf.net> * generic/tclObj.c: remove superfluous #include of tclCompile.h diff --git a/compat/strtoll.c b/compat/strtoll.c deleted file mode 100644 index ce1c8a1..0000000 --- a/compat/strtoll.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * strtoll.c -- - * - * Source code for the "strtoll" library procedure. - * - * Copyright (c) 1988 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: strtoll.c,v 1.9 2007/04/16 13:36:34 dkf Exp $ - */ - -#include "tclInt.h" -#include <ctype.h> - -#define TCL_WIDEINT_MAX (((Tcl_WideUInt)Tcl_LongAsWide(-1))>>1) - - -/* - *---------------------------------------------------------------------- - * - * strtoll -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -#if TCL_WIDE_INT_IS_LONG -long long -#else -Tcl_WideInt -#endif -strtoll( - CONST char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - register CONST char *p; - Tcl_WideInt result = Tcl_LongAsWide(0); - Tcl_WideUInt uwResult; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - - /* - * Check for a sign. - */ - - errno = 0; - if (*p == '-') { - p += 1; - uwResult = strtoull(p, endPtr, base); - if (errno != ERANGE) { - if (uwResult > TCL_WIDEINT_MAX+1) { - errno = ERANGE; - return Tcl_LongAsWide(-1); - } else if (uwResult > TCL_WIDEINT_MAX) { - return ~((Tcl_WideInt)TCL_WIDEINT_MAX); - } else { - result = -((Tcl_WideInt) uwResult); - } - } - } else { - if (*p == '+') { - p += 1; - } - uwResult = strtoull(p, endPtr, base); - if (errno != ERANGE) { - if (uwResult > TCL_WIDEINT_MAX) { - errno = ERANGE; - return Tcl_LongAsWide(-1); - } else { - result = uwResult; - } - } - } - if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { - *endPtr = (char *) string; - } - return result; -} diff --git a/compat/strtoull.c b/compat/strtoull.c deleted file mode 100644 index b31567f..0000000 --- a/compat/strtoull.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * strtoull.c -- - * - * Source code for the "strtoull" library procedure. - * - * Copyright (c) 1988 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: strtoull.c,v 1.9 2007/04/16 13:36:34 dkf Exp $ - */ - -#include "tclInt.h" -#include <ctype.h> - -/* - * The table below is used to convert from ASCII digits to a numerical - * equivalent. It maps from '0' through 'z' to integers (100 for non-digit - * characters). - */ - -static char cvtIn[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* '0' - '9' */ - 100, 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'A' - 'Z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, - 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'a' - 'z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35}; - - -/* - *---------------------------------------------------------------------- - * - * strtoull -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -#if TCL_WIDE_INT_IS_LONG -unsigned long long -#else -Tcl_WideUInt -#endif -strtoull( - CONST char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - register CONST char *p; - register Tcl_WideUInt result = 0; - register unsigned digit; - register Tcl_WideUInt shifted; - int anyDigits = 0, negative = 0; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { /* INTL: locale-dependent */ - p += 1; - } - - /* - * Check for a sign. - */ - - if (*p == '-') { - p += 1; - negative = 1; - } else { - if (*p == '+') { - p += 1; - } - } - - /* - * If no base was provided, pick one from the leading characters of the - * string. - */ - - if (base == 0) { - if (*p == '0') { - p += 1; - if (*p == 'x' || *p == 'X') { - p += 1; - base = 16; - } else { - /* - * Must set anyDigits here, otherwise "0" produces a "no - * digits" error. - */ - - anyDigits = 1; - base = 8; - } - } else { - base = 10; - } - } else if (base == 16) { - /* - * Skip a leading "0x" from hex numbers. - */ - - if ((p[0] == '0') && (p[1] == 'x' || *p == 'X')) { - p += 2; - } - } - - /* - * Sorry this code is so messy, but speed seems important. Do different - * things for base 8, 10, 16, and other. - */ - - if (base == 8) { - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 7) { - break; - } - shifted = result << 3; - if ((shifted >> 3) != result) { - goto overflow; - } - result = shifted + digit; - if ( result < shifted ) { - goto overflow; - } - anyDigits = 1; - } - } else if (base == 10) { - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 9) { - break; - } - shifted = 10 * result; - if ((shifted / 10) != result) { - goto overflow; - } - result = shifted + digit; - if ( result < shifted ) { - goto overflow; - } - anyDigits = 1; - } - } else if (base == 16) { - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit > 15) { - break; - } - shifted = result << 4; - if ((shifted >> 4) != result) { - goto overflow; - } - result = shifted + digit; - if ( result < shifted ) { - goto overflow; - } - anyDigits = 1; - } - } else if ( base >= 2 && base <= 36 ) { - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit >= (unsigned) base) { - break; - } - shifted = result * base; - if ((shifted/base) != result) { - goto overflow; - } - result = shifted + digit; - if ( result < shifted ) { - goto overflow; - } - anyDigits = 1; - } - } - - /* - * Negate if we found a '-' earlier. - */ - - if (negative) { - result = (Tcl_WideUInt)(-((Tcl_WideInt)result)); - } - - /* - * See if there were any digits at all. - */ - - if (!anyDigits) { - p = string; - } - - if (endPtr != 0) { - *endPtr = (char *) p; - } - - return result; - - /* - * On overflow generate the right output - */ - - overflow: - errno = ERANGE; - if (endPtr != 0) { - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit >= (unsigned) base) { - break; - } - } - *endPtr = (char *) p; - } - return (Tcl_WideUInt)Tcl_LongAsWide(-1); -} diff --git a/generic/tcl.h b/generic/tcl.h index 01840de..af46ad9 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.231.2.7 2007/10/05 17:15:01 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.231.2.8 2007/10/15 18:38:06 dgp Exp $ */ #ifndef _TCL @@ -348,8 +348,9 @@ typedef long LONG; * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) * * Note on converting between Tcl_WideInt and strings. This implementation (in - * tclObj.c) depends on the functions strtoull() and sprintf(...,"%" - * TCL_LL_MODIFIER "d",...). TCL_LL_MODIFIER_SIZE is the length of the + * tclObj.c) depends on the function + * sprintf(...,"%" TCL_LL_MODIFIER "d",...). + * TCL_LL_MODIFIER_SIZE is the length of the * modifier string, which is "ll" on most 32-bit Unix systems. It has to be * split up like this to allow for the more complex formats sometimes needed * (e.g. in the format(n) command.) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 41fe7d8..8c69ecc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.150.2.4 2007/09/04 17:43:48 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.150.2.5 2007/10/15 18:38:06 dgp Exp $ */ #include "tclInt.h" @@ -1401,7 +1401,7 @@ Tcl_StringObjCmd( break; } case STR_IS: { - char *end; + char *end, *stop; Tcl_UniChar ch; /* @@ -1521,8 +1521,6 @@ Tcl_StringObjCmd( chcomp = Tcl_UniCharIsDigit; break; case STR_IS_DOUBLE: { - char *stop; - /* TODO */ if ((objPtr->typePtr == &tclDoubleType) || (objPtr->typePtr == &tclIntType) || @@ -1549,49 +1547,53 @@ Tcl_StringObjCmd( case STR_IS_GRAPH: chcomp = Tcl_UniCharIsGraph; break; - case STR_IS_INT: { - char *stop; - long int l = 0; - - if (TCL_OK == Tcl_GetIntFromObj(NULL, objPtr, &i)) { + case STR_IS_INT: + case STR_IS_WIDE: + if ((((enum isOptions) index) == STR_IS_INT) + && (TCL_OK == Tcl_GetIntFromObj(NULL, objPtr, &i))) { + break; + } + if ((((enum isOptions) index) == STR_IS_WIDE) + && (TCL_OK == Tcl_GetWideIntFromObj(NULL, objPtr, &w))) { break; } - - /* - * Like STR_IS_DOUBLE, but we use strtoul. Since Tcl_GetIntFromObj - * already failed, we set result to 0. - */ result = 0; - errno = 0; - l = strtol(string1, &stop, 0); /* INTL: Tcl source. */ - if ((errno == ERANGE) || (l > INT_MAX) || (l < INT_MIN)) { - /* - * if (errno == ERANGE) or the long value won't fit in an int, - * then it was an over/underflow problem, but in this method, - * we only want to know yes or no, so bad flow returns 0 - * (false) and sets the failVarObj to the string length. - */ - failat = -1; - } else if (stop == string1) { + if (failVarObj == NULL) { /* - * In this case, nothing like a number was found + * Don't bother computing the failure point if we're not + * going to return it. */ - - failat = 0; + break; + } + if (TclParseNumber(NULL, objPtr, NULL, NULL, -1, + (const char **) &stop, TCL_PARSE_INTEGER_ONLY) == TCL_OK) { + if (stop == end) { + /* + * Entire string parses as an integer, but rejected by + * Tcl_Get(Wide)IntFromObj() so we must have overflowed + * the target type, and our convention is to return + * failure at index -1 in that situation. + */ + failat = -1; + } else { + /* + * Some prefix parsed as an integer, but not the whole + * string, so return failure index as the point where + * parsing stopped. Clear out the internal rep, since + * keeping it would leave *objPtr in an inconsistent + * state. + */ + failat = stop - string1; + TclFreeIntRep(objPtr); + objPtr->typePtr = NULL; + } } else { - /* - * Assume we sucked up one char per byte and then we go onto - * SPACE, since we are allowed trailing whitespace. - */ - - failat = stop - string1; - string1 = stop; - chcomp = Tcl_UniCharIsSpace; + /* No prefix is a valid integer. Fail at beginning. */ + failat = 0; } break; - } case STR_IS_LIST: /* * We ignore the strictness here, since empty strings are always @@ -1661,47 +1663,6 @@ Tcl_StringObjCmd( case STR_IS_UPPER: chcomp = Tcl_UniCharIsUpper; break; - case STR_IS_WIDE: { - char *stop; - - if (TCL_OK == Tcl_GetWideIntFromObj(NULL, objPtr, &w)) { - break; - } - - /* - * Like STR_IS_DOUBLE, but we use strtoll. Since - * Tcl_GetWideIntFromObj already failed, we set result to 0. - */ - - result = 0; - errno = 0; - w = strtoll(string1, &stop, 0); /* INTL: Tcl source. */ - if (errno == ERANGE) { - /* - * If (errno == ERANGE), then it was an over/underflow - * problem, but in this method, we only want to know yes or - * no, so bad flow returns 0 (false) and sets the failVarObj - * to the string length. - */ - - failat = -1; - } else if (stop == string1) { - /* - * In this case, nothing like a number was found - */ - failat = 0; - } else { - /* - * Assume we sucked up one char per byte and then we go onto - * SPACE, since we are allowed trailing whitespace. - */ - - failat = stop - string1; - string1 = stop; - chcomp = Tcl_UniCharIsSpace; - } - break; - } case STR_IS_WORD: chcomp = Tcl_UniCharIsWordChar; break; diff --git a/generic/tclParse.c b/generic/tclParse.c index 84ffa84..2c3f52e 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.52.2.4 2007/07/19 22:52:58 dgp Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.52.2.5 2007/10/15 18:38:07 dgp Exp $ */ #include "tclInt.h" @@ -1785,7 +1785,7 @@ Tcl_ParseBraces( { register int openBrace = 0; - for (; src > start; src--) { + while (--src > start) { switch (*src) { case '{': openBrace = 1; diff --git a/tests/string.test b/tests/string.test index 87a7f88..6ad7212 100644 --- a/tests/string.test +++ b/tests/string.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: string.test,v 1.62.2.1 2007/06/12 15:56:44 dgp Exp $ +# RCS: @(#) $Id: string.test,v 1.62.2.2 2007/10/15 18:38:07 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -482,6 +482,9 @@ test string-6.57 {string is integer, false} { test string-6.58 {string is integer, false on bad octal} { list [string is integer -fail var 036963] $var } {0 3} +test string-6.58.1 {string is integer, false on bad octal} { + list [string is integer -fail var 0o36963] $var +} {0 4} test string-6.59 {string is integer, false on bad hex} { list [string is integer -fail var 0X345XYZ] $var } {0 5} @@ -649,6 +652,9 @@ test string-6.104 {string is wideinteger, false} { test string-6.105 {string is wideinteger, false on bad octal} { list [string is wideinteger -fail var 036963] $var } {0 3} +test string-6.105.1 {string is wideinteger, false on bad octal} { + list [string is wideinteger -fail var 0o36963] $var +} {0 4} test string-6.106 {string is wideinteger, false on bad hex} { list [string is wideinteger -fail var 0X345XYZ] $var } {0 5} diff --git a/tools/mkdepend.tcl b/tools/mkdepend.tcl new file mode 100644 index 0000000..2a19a6f --- /dev/null +++ b/tools/mkdepend.tcl @@ -0,0 +1,411 @@ +#============================================================================== +# +# mkdepend : generate dependency information from C/C++ files +# +# Copyright (c) 1998, Nat Pryce +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF +# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" +# BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, +# UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +#============================================================================== +# +# Modified heavily by David Gravereaux <davygrvy@pobox.com> about 9/17/2006. +# Original can be found @ http://www.doc.ic.ac.uk/~np2/software/mkdepend.html +# +#============================================================================== +# RCS: @(#) $Id: mkdepend.tcl,v 1.1.4.2 2007/10/15 18:38:07 dgp Exp $ +#============================================================================== + +array set mode_data {} +set mode_data(vc32) {cl -nologo -E} + +set cpp_args "" +set source_extensions [list .c .cpp .cxx] +set target_extension ".obj" +set target_prefix "" +set remove_prefix "" +set verbose 1 + +set excludes [list] +if [info exists env(INCLUDE)] { + set rawExcludes [split [string trim $env(INCLUDE) ";"] ";"] + foreach exclude $rawExcludes { + lappend excludes [file normalize $exclude] + } +} + + +# openOutput -- +# +# Opens the output file. +# +# Arguments: +# file The file to open +# +# Results: +# None. + +proc openOutput {file} { + global output + set output [open $file w] + puts $output "# Automatically generated at [clock format [clock seconds]] by [info script]" +} + +# closeOutput -- +# +# Closes output file. +# +# Arguments: +# none +# +# Results: +# None. + +proc closeOutput {} { + global output + if {[string match stdout $output]} { + close $output + } +} + +# readDepends -- +# +# Read off CCP pipe for #include references. pipe channel +# is closed when done. +# +# Arguments: +# chan The pipe channel we are reading in. +# +# Results: +# Raw dependency list pairs. + +proc readDepends {chan} { + global source_extensions target_extension verbose + + array set depends {} + set line "" + + while {[gets $chan line] != -1} { + if {[regexp {^#line [0-9]+ \"(.*)\"$} $line tmp fname] != 0} { + if {[lsearch $source_extensions [file extension $fname]] != -1} { + set target2 "[file rootname $fname]$target_extension" + + if {![info exists target] || + [string compare $target $target2] != 0} \ + { + set target $target2 + set depends($target|[file normalize $fname]) "" + + if $verbose { + puts stderr "processing [file tail $fname]" + } + } + } else { + set depends($target|[file normalize $fname]) "" + } + } + } + catch {close $chan} + + set result {} + foreach n [array names depends] { + set pair [split $n "|"] + lappend result [list [lindex $pair 0] [lindex $pair 1]] + } + + return $result +} + +# genStubs::interface -- +# +# This function is used in the declarations file to set the name +# of the interface currently being defined. +# +# Arguments: +# name The name of the interface. +# +# Results: +# None. +proc writeDepends {out depends} { + foreach pair $depends { + puts $out "[lindex $pair 0] : \\\n\t[join [lindex $pair 1] " \\\n\t"]" + } +} + +# genStubs::interface -- +# +# This function is used in the declarations file to set the name +# of the interface currently being defined. +# +# Arguments: +# name The name of the interface. +# +# Results: +# None. +proc stringStartsWith {str prefix} { + set front [string range $str 0 [expr {[string length $prefix] - 1}]] + return [expr {[string compare [string tolower $prefix] \ + [string tolower $front]] == 0}] +} + +# genStubs::interface -- +# +# This function is used in the declarations file to set the name +# of the interface currently being defined. +# +# Arguments: +# name The name of the interface. +# +# Results: +# None. +proc filterExcludes {depends excludes} { + set filtered {} + + foreach pair $depends { + set excluded 0 + set file [lindex $pair 1] + + foreach dir $excludes { + if [stringStartsWith $file $dir] { + set excluded 1 + break; + } + } + + if {!$excluded} { + lappend filtered $pair + } + } + + return $filtered +} + +# genStubs::interface -- +# +# This function is used in the declarations file to set the name +# of the interface currently being defined. +# +# Arguments: +# name The name of the interface. +# +# Results: +# None. +proc replacePrefix {file} { + global srcPathList srcPathReplaceList + + foreach was $srcPathList is $srcPathReplaceList { + regsub $was $file $is file + } + return $file +} + +# rebaseFiles -- +# +# Replaces normalized paths with original macro names. +# +# Arguments: +# depends Dependency pair list. +# +# Results: +# None. + +proc rebaseFiles {depends} { + set rebased {} + foreach pair $depends { + lappend rebased [list \ + [replacePrefix [lindex $pair 0]] \ + [replacePrefix [lindex $pair 1]]] + + } + return $rebased +} + +# compressDeps -- +# +# Compresses same named tragets into one pair with +# multiple deps. +# +# Arguments: +# depends Dependency pair list. +# +# Results: +# The processed list. + +proc compressDeps {depends} { + array set compressed [list] + + foreach pair $depends { + lappend compressed([lindex $pair 0]) [lindex $pair 1] + } + + foreach n [array names compressed] { + lappend result [list $n $compressed($n)] + } + + return $result +} + +# addSearchPath -- +# +# Adds a new set of path and replacement string to the global list. +# +# Arguments: +# newPathInfo comma seperated path and replacement string +# +# Results: +# None. + +proc addSearchPath {newPathInfo} { + global srcPathList srcPathReplaceList + + set infoList [split $newPathInfo ,] + lappend srcPathList [file normalize [lindex $infoList 0]] + lappend srcPathReplaceList [lindex $infoList 1] +} + + +# displayUsage -- +# +# Displays usage to stderr +# +# Arguments: +# none. +# +# Results: +# None. + +proc displayUsage {} { + puts stderr "mkdepend.tcl \[options\] genericDir,macroName compatDir,macroName platformDir,macroName" +} + +# readInputListFile -- +# +# Open and read the object file list. +# +# Arguments: +# objectListFile - name of the file to open. +# +# Results: +# None. + +proc readInputListFile {objectListFile} { + global srcFileList srcPathList + set f [open $objectListFile r] + + # this probably isn't bullet-proof. + set fl [split [read $f]] + close $f + + foreach fname $fl { + # compiled .res resource files should be ignored. + if {[file extension $fname] ne ".obj"} {continue} + + # just filename without path or extension. + set baseName [file rootname [file tail $fname]] + + foreach path $srcPathList { + if {[file exist [file join $path ${baseName}.c]]} { + lappend srcFileList [file join $path ${baseName}.c] + } elseif {[file exist [file join $path ${baseName}.cpp]]} { + lappend srcFileList [file join $path ${baseName}.cpp] + } else { + # ignore it + } + } + } +} + +# main -- +# +# The main procedure of this script. +# +# Arguments: +# none. +# +# Results: +# None. + +proc main {} { + global argc argv mode mode_data srcFileList srcPathList excludes + global remove_prefix target_prefix output env + + set srcPathList [list] + set srcFileList [list] + + if {$argc == 1} {displayUsage} + + # Parse mkdepend input + for {set i 0} {$i < [llength $argv]} {incr i} { + switch -glob -- [set arg [lindex $argv $i]] { + -vc32 { + set mode vc32 + } + -bc32 { + set mode bc32 + } + -wc32 { + set mode wc32 + } + -lc32 { + set mode lc32 + } + -mgw32 { + set mode mgw32 + } + -passthru:* { + puts stderr [set passthru [string range $arg 10 end]] + } + -out:* { + openOutput [string range $arg 5 end] + } + @* { + readInputListFile [string range $arg 1 end] + } + -? - + -help - + --help { + displayUsage + exit 1 + } + default { + if {![info exist mode]} { + puts stderr "mode not set" + displayUsage + } + addSearchPath $arg + } + } + } + + # Execute the CPP command and parse output + + foreach srcFile $srcFileList { + set command "$mode_data($mode) $passthru \"$srcFile\"" + set input [open |$command r] + + set depends [readDepends $input] + set depends [filterExcludes $depends $excludes] + set depends [rebaseFiles $depends] + set depends [compressDeps $depends] + set depends [lsort -index 0 $depends] + writeDepends $output $depends + } + + closeOutput +} + +# kick it up. +main diff --git a/unix/Makefile.in b/unix/Makefile.in index 3811c03..97fee9b 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.207.2.10 2007/09/17 16:26:19 dgp Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.207.2.11 2007/10/15 18:38:07 dgp Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -1501,15 +1501,9 @@ strtod.o: $(COMPAT_DIR)/strtod.c strtol.o: $(COMPAT_DIR)/strtol.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtol.c -strtoll.o: $(COMPAT_DIR)/strtoll.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoll.c - strtoul.o: $(COMPAT_DIR)/strtoul.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoul.c -strtoull.o: $(COMPAT_DIR)/strtoull.c - $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/strtoull.c - tmpnam.o: $(COMPAT_DIR)/tmpnam.c $(CC) -c $(STUB_CC_SWITCHES) $(COMPAT_DIR)/tmpnam.c diff --git a/unix/configure b/unix/configure index a08931a..266c542 100755 --- a/unix/configure +++ b/unix/configure @@ -9654,9 +9654,7 @@ done - - -for ac_func in opendir strtol strtoll strtoull tmpnam waitpid +for ac_func in opendir strtol tmpnam waitpid do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/unix/configure.in b/unix/configure.in index 41ca82b..af01767 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.157.2.5 2007/10/02 20:12:07 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.157.2.6 2007/10/15 18:38:08 dgp Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -151,7 +151,7 @@ AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD, 1, [Is getcwd Posix-compliant?])]) # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really # define USEGETWD even if the posix getcwd exists. Add a test ? -AC_REPLACE_FUNCS(opendir strtol strtoll strtoull tmpnam waitpid) +AC_REPLACE_FUNCS(opendir strtol tmpnam waitpid) AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR, 1, [Do we have strerror()])]) AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD, 1, [Do we have getwd()])]) AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3, 1, [Do we have wait3()])]) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 489b8fb..5ed9eaf 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -181,12 +181,6 @@ /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL -/* Define to 1 if you have the `strtoll' function. */ -#undef HAVE_STRTOLL - -/* Define to 1 if you have the `strtoull' function. */ -#undef HAVE_STRTOULL - /* Is 'struct dirent64' in <sys/types.h>? */ #undef HAVE_STRUCT_DIRENT64 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index cd01440..32bb21f 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.56.2.1 2007/09/04 17:44:23 dgp Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.56.2.2 2007/10/15 18:38:09 dgp Exp $ */ #ifndef _TCLUNIXPORT @@ -79,13 +79,6 @@ typedef off_t Tcl_SeekOffset; # define TclOSlstat lstat #endif -#if !HAVE_STRTOLL && defined(TCL_WIDE_INT_TYPE) && !TCL_WIDE_INT_IS_LONG -EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((CONST char *string, - char **endPtr, int base)); -EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string, - char **endPtr, int base)); -#endif - #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> diff --git a/win/Makefile.in b/win/Makefile.in index 410665b..830e076 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.115.2.3 2007/09/14 16:28:39 dgp Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.115.2.4 2007/10/15 18:38:09 dgp Exp $ VERSION = @TCL_VERSION@ @@ -359,9 +359,6 @@ WIN_OBJS = \ tclWinThrd.$(OBJEXT) \ tclWinTime.$(OBJEXT) -COMPAT_OBJS = \ - strtoll.$(OBJEXT) strtoull.$(OBJEXT) - PIPE_OBJS = stub16.$(OBJEXT) DDE_OBJS = tclWinDde.$(OBJEXT) @@ -372,7 +369,7 @@ STUB_OBJS = tclStubLib.$(OBJEXT) TCLSH_OBJS = tclAppInit.$(OBJEXT) -TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${COMPAT_OBJS} +TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] diff --git a/win/coffbase.txt b/win/coffbase.txt index 93f46d5..c93dc08 100644 --- a/win/coffbase.txt +++ b/win/coffbase.txt @@ -12,7 +12,7 @@ ; they're mutually exclusive. This info is placed in the DLL's PE header by the ; linker with the `-base:@$(TCLDIR)\win\coffbase.txt,<key>` option. ; -; RCS: @(#) $Id: coffbase.txt,v 1.9 2007/05/04 18:04:54 patthoyts Exp $ +; RCS: @(#) $Id: coffbase.txt,v 1.9.2.1 2007/10/15 18:38:09 dgp Exp $ tcl 0x10000000 0x00200000 tcldde 0x10200000 0x00010000 @@ -28,4 +28,8 @@ tls 0x10780000 0x00100000 winico 0x10880000 0x00010000 tile 0x10900000 0x00080000 memchan 0x109D0000 0x00010000 -tdom 0x109E0000 0x00080000
\ No newline at end of file +tdom 0x109E0000 0x00080000 +tkvideo 0x10B00000 0x00010000 +snack 0x1E000000 0x00400000 +sound 0x1E400000 0x00400000 +snackogg 0x1E800000 0x00200000 diff --git a/win/makefile.bc b/win/makefile.bc index 97846d6..f750555 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -193,8 +193,6 @@ TCLOBJS = \ $(TMPDIR)\regexec.obj \ $(TMPDIR)\regfree.obj \ $(TMPDIR)\regerror.obj \ - $(TMPDIR)\strtoll.obj \ - $(TMPDIR)\strtoull.obj \ $(TMPDIR)\tclAlloc.obj \ $(TMPDIR)\tclAsync.obj \ $(TMPDIR)\tclBasic.obj \ diff --git a/win/makefile.vc b/win/makefile.vc index 447ad0e..4c050d1 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.160.2.4 2007/09/17 15:03:48 dgp Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.160.2.5 2007/10/15 18:38:09 dgp Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -103,13 +103,14 @@ the build instructions. # memdbg = Enables the debugging memory allocator. # compdbg = Enables byte compilation logging. # -# CHECKS=nodep,fullwarn,none +# CHECKS=nodep,fullwarn,64bit,none # Sets special macros for checking compatability. # # nodep = Turns off compatability macros to ensure the core # isn't being built with deprecated functions. # fullwarn = Builds with full compiler and link warnings enabled. # Very verbose. +# 64bit = Enable 64bit portability warnings (if available) # # MACHINE=(IX86|IA64|AMD64|ALPHA) # Set the machine type used for the compiler, linker, and @@ -175,20 +176,9 @@ Please `cd` to its location first. PROJECT = tcl !include "rules.vc" -STUBPREFIX = $(PROJECT)stub - -!if [nmakehlp -g ../generic/tcl.h TCL_VERSION] == 85 -DOTVERSION = 8.5 -!elseif [nmakehlp -g ../generic/tcl.h TCL_VERSION] == 86 -DOTVERSION = 8.6 -!elseif [nmakehlp -g ../generic/tcl.h TCL_VERSION] == 90 -DOTVERSION = 9.0 -!elseif [nmakehlp -g ../generic/tcl.h TCL_VERSION] == 0 -MSG =^ -Cannot get version string from ../generic/tcl.h -!error $(MSG) -!endif -VERSION = $(DOTVERSION:.=) +STUBPREFIX = $(PROJECT)stub +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) DDEDOTVERSION = 1.3 DDEVERSION = $(DDEDOTVERSION:.=) @@ -252,8 +242,6 @@ TCLOBJS = \ $(TMP_DIR)\regerror.obj \ $(TMP_DIR)\regexec.obj \ $(TMP_DIR)\regfree.obj \ - $(TMP_DIR)\strtoll.obj \ - $(TMP_DIR)\strtoull.obj \ $(TMP_DIR)\tclAlloc.obj \ $(TMP_DIR)\tclAsync.obj \ $(TMP_DIR)\tclBasic.obj \ @@ -430,15 +418,9 @@ cdebug = -Zi -WX $(DEBUGFLAGS) !endif ### Declarations common to all compiler options -cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ -!if $(FULLWARNINGS) -cflags = $(cflags) -W4 -!else -cflags = $(cflags) -W3 -!endif - !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) crt = -MDd @@ -454,9 +436,8 @@ crt = -MT !endif TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" -BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) \ - -DTCL_PIPE_DLL=\"$(TCLPIPEDLLNAME)\" -DTCL_TOMMATH \ - -DMP_PREC=4 -Dinline=__inline +TCL_DEFINES = -DTCL_PIPE_DLL=\"$(TCLPIPEDLLNAME)\" -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline +BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE TCL_CFLAGS = $(BASE_CFLAGS) $(OPTDEFINES) STUB_CFLAGS = $(cflags) $(cdebug) $(OPTDEFINES) @@ -475,10 +456,6 @@ ldebug = -release -opt:ref -opt:icf,3 ### Declarations common to all linker options lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) -!if $(FULLWARNINGS) -lflags = $(lflags) -warn:3 -!endif - !if $(PROFILE) lflags = $(lflags) -profile !endif @@ -650,23 +627,6 @@ gentommath_h: !endif #--------------------------------------------------------------------- -# Generate the makefile depedancies. -#--------------------------------------------------------------------- - -depend: -!if !exist($(TCLSH)) - @echo Build tclsh first! -!else - $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \ - -passthru:"-DBUILD_tcl $(TCL_INCLUDES:"="")" $(GENERICDIR) \ - $(COMPATDIR) $(WINDIR) @<< -$(TCLOBJS) -<< -!endif - -#" for emacs font-locking. - -#--------------------------------------------------------------------- # Build the windows help file. #--------------------------------------------------------------------- @@ -796,11 +756,13 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in << +#--------------------------------------------------------------------- # The following target generates the file generic/tclDate.c # from the yacc grammar found in generic/tclGetDate.y. This is # only run by hand as yacc is not available in all environments. # The name of the .c file is different than the name of the .y file # so that make doesn't try to automatically regenerate the .c file. +#--------------------------------------------------------------------- gendate: bison --output-file=$(GENERICDIR)/tclDate.c \ @@ -864,15 +826,34 @@ $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c ### The following objects are part of the stub library and should not -### be built as DLL objects. -Zl is used to avoid a dependancy on any +### be built as DLL objects. -Zl is used to avoid a dependency on any ### specific C run-time. $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? +#--------------------------------------------------------------------- +# Generate the source dependencies. Having dependency rules will +# improve incrimental build accuracy without having to resort to a +# full rebuild just because some non-global header file like tclCompile.h +# was changed. These rules aren't needed when building from scratch. +#--------------------------------------------------------------------- + +depend: +!if !exist($(TCLSH)) + @echo Build tclsh first! +!else + $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \ + -passthru:"-DBUILD_tcl $(TCL_INCLUDES:"=""")" $(GENERICDIR),$$(GENERICDIR) \ + $(COMPATDIR),$$(COMPATDIR) $(TOMMATHDIR),$$(TOMMATHDIR) $(WINDIR),$$(WINDIR) @<< +$(TCLOBJS) +<< +!endif + +#" emacs fix #--------------------------------------------------------------------- -# Dedependency rules +# Dependency rules #--------------------------------------------------------------------- $(GENERICDIR)\regcomp.c: \ @@ -1040,6 +1021,8 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(ROOT)\library\encoding\*.enc" \ "$(SCRIPT_INSTALL_DIR)\encoding\" +#" emacs fix + install-tzdata: @echo Installing time zone data @set TCL_LIBRARY=$(ROOT)/library diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 7dd3aac..a5eb1c4 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -11,7 +11,7 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * ---------------------------------------------------------------------------- - * RCS: @(#) $Id: nmakehlp.c,v 1.17.2.1 2007/09/14 16:28:39 dgp Exp $ + * RCS: @(#) $Id: nmakehlp.c,v 1.17.2.2 2007/10/15 18:38:09 dgp Exp $ * ---------------------------------------------------------------------------- */ @@ -299,7 +299,9 @@ CheckForCompilerFeature( return !(strstr(Out.buffer, "D4002") != NULL || strstr(Err.buffer, "D4002") != NULL || strstr(Out.buffer, "D9002") != NULL - || strstr(Err.buffer, "D9002") != NULL); + || strstr(Err.buffer, "D9002") != NULL + || strstr(Out.buffer, "D2021") != NULL + || strstr(Err.buffer, "D2021") != NULL); } int diff --git a/win/rules.vc b/win/rules.vc index 2f1f27e..76e70c1 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -8,10 +8,10 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # Copyright (c) 2001-2003 David Gravereaux. -# Copyright (c) 2003-2006 Patrick Thoyts +# Copyright (c) 2003-2007 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.29.2.1 2007/09/14 16:28:39 dgp Exp $ +# RCS: @(#) $Id: rules.vc,v 1.29.2.2 2007/10/15 18:38:09 dgp Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -88,7 +88,7 @@ MKDIR = mkdir !message *** Compiler has 'Optimizations' OPTIMIZING = 1 !else -!message *** Compiler doesn't have 'Optimizations' +!message *** Compiler does not have 'Optimizations' OPTIMIZING = 0 !endif @@ -106,9 +106,19 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi OPTIMIZATIONS = $(OPTIMIZATIONS) -Op !endif +# Tk doesnt seem to be able to use -fp:strict. +!if "$(PROJECT)" != "tk" !if [nmakehlp -c -fp:strict] OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict !endif +!else +!if [nmakehlp -c -fp:precise] +OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:precise +!endif +!if [nmakehlp -c -fp:except] +OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:except +!endif +!endif !if [nmakehlp -c -Gs] OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs @@ -145,7 +155,7 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -YX !message *** Compiler has 'Pentium 0x0f fix' COMPILERFLAGS = $(COMPILERFLAGSS) -QI0f !else -!message *** Compiler doesn't have 'Pentium 0x0f fix' +!message *** Compiler does not have 'Pentium 0x0f fix' !endif !endif @@ -165,7 +175,7 @@ COMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx !message *** Linker has 'Win98 alignment problem' ALIGN98_HACK = 1 !else -!message *** Linker doesn't have 'Win98 alignment problem' +!message *** Linker does not have 'Win98 alignment problem' ALIGN98_HACK = 0 !endif !else @@ -380,7 +390,7 @@ TCL_COMPILE_DEBUG = 0 !if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] TCL_NO_DEPRECATED = 0 -FULLWARNINGS = 0 +WARNINGS = -W3 !else !if [nmakehlp -f $(CHECKS) "nodep"] !message *** Doing nodep check @@ -390,12 +400,18 @@ TCL_NO_DEPRECATED = 0 !endif !if [nmakehlp -f $(CHECKS) "fullwarn"] !message *** Doing full warnings check -FULLWARNINGS = 1 +WARNINGS = -W4 +!if [nmakehlp -l -warn:3] +LINKERFLAGS = $(LINKERFLAGS) -warn:3 +!endif !else -FULLWARNINGS = 0 +WARNINGS = -W3 +!endif +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] +!message *** Doing 64bit portability warnings +WARNINGS = $(WARNINGS) -Wp64 !endif !endif - #---------------------------------------------------------- # Set our defines now armed with our options. @@ -436,16 +452,26 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT #---------------------------------------------------------- -# Get common info used when building extensions. +# Locate the Tcl headers to build against #---------------------------------------------------------- -!if "$(PROJECT)" != "tcl" +!if "$(PROJECT)" == "tcl" -!if !defined(TCLDIR) +_TCL_H = ..\generic\tcl.h + +!else + +# If INSTALLDIR set to tcl root dir then reset to the lib dir. !if exist("$(_INSTALLDIR)\include\tcl.h") -TCLH = "$(_INSTALLDIR)\include\tcl.h" +_INSTALLDIR=$(_INSTALLDIR)\lib +!endif + +!if !defined(TCLDIR) +!if exist("$(_INSTALLDIR)\..\include\tcl.h") TCLINSTALL = 1 -_TCLDIR = $(_INSTALLDIR) +_TCLDIR = $(_INSTALLDIR)\.. +_TCL_H = $(_INSTALLDIR)\..\include\tcl.h +TCLDIR = $(_INSTALLDIR)\.. !else MSG=^ Failed to find tcl.h. Set the TCLDIR macro. @@ -454,48 +480,64 @@ Failed to find tcl.h. Set the TCLDIR macro. !else _TCLDIR = $(TCLDIR:/=\) !if exist("$(_TCLDIR)\include\tcl.h") -TCLH = "$(_TCLDIR)\include\tcl.h" TCLINSTALL = 1 +_TCL_H = $(_TCLDIR)\include\tcl.h !elseif exist("$(_TCLDIR)\generic\tcl.h") -TCLH = "$(_TCLDIR)\generic\tcl.h" TCLINSTALL = 0 +_TCL_H = $(_TCLDIR)\generic\tcl.h !else MSG =^ Failed to find tcl.h. The TCLDIR macro does not appear correct. !error $(MSG) !endif !endif +!endif -#---------------------------------------------------------- -# Get the version from the header file. Try all possibles -# even though some aren't fully valid. -#---------------------------------------------------------- +#-------------------------------------------------------------- +# Extract various version numbers from tcl headers +# The generated file is then included in the makefile. +#-------------------------------------------------------------- -!if [nmakehlp -g $(TCLH) TCL_VERSION] == 76 -TCL_DOTVERSION = 7.6 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 80 -TCL_DOTVERSION = 8.0 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 81 -TCL_DOTVERSION = 8.1 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 82 -TCL_DOTVERSION = 8.2 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 83 -TCL_DOTVERSION = 8.3 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 84 -TCL_DOTVERSION = 8.4 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 85 -TCL_DOTVERSION = 8.5 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 86 -TCL_DOTVERSION = 8.6 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 90 -TCL_DOTVERSION = 9.0 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 0 -MSG =^ -Can't get version string from $(TCLH) -!error $(MSG) +!if [echo REM = This file is generated from rules.vc > versions.vc] +!endif +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] +!endif +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] +!endif +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] !endif -TCL_VERSION = $(TCL_DOTVERSION:.=) +# If building the tcl core then we need additional package versions +!if "$(PROJECT)" == "tcl" +!if [echo PKG_HTTP_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] +!endif +!if [echo PKG_TCLTEST_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc] +!endif +!if [echo PKG_MSGCAT_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc] +!endif +!if [echo PKG_PLATFORM_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc] +!endif +!if [echo PKG_SHELL_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc] +!endif +!endif + +!include versions.vc + +#-------------------------------------------------------------- +# Setup tcl version dependent stuff headers +#-------------------------------------------------------------- + +!if "$(PROJECT)" != "tcl" + +TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) !if $(TCL_VERSION) < 81 TCL_DOES_STUBS = 0 @@ -504,16 +546,23 @@ TCL_DOES_STUBS = 1 !endif !if $(TCLINSTALL) -TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" -TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib" -TCLIMPLIB = "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" -TCL_LIBRARY = $(_INSTALLDIR)\lib -TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib" -TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib" +TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" +!if !exist($(TCLSH)) && $(TCL_THREADS) +TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe" +!endif +TCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib" +TCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" +TCL_LIBRARY = $(_TCLDIR)\lib +TCLREGLIB = "$(_TCLDIR)\lib\tclreg11$(SUFX:t=).lib" +TCLDDELIB = "$(_TCLDIR)\lib\tcldde12$(SUFX:t=).lib" COFFBASE = \must\have\tcl\sources\to\build\this\target TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target +TCL_INCLUDES = -I"$(_TCLDIR)\include" !else TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" +!if !exist($(TCLSH)) && $(TCL_THREADS) +TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe" +!endif TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\library @@ -521,48 +570,84 @@ TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib" TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib" COFFBASE = "$(_TCLDIR)\win\coffbase.txt" TCLTOOLSDIR = $(_TCLDIR)\tools +TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif !endif +#------------------------------------------------------------------------- +# Locate the Tk headers to build against +#------------------------------------------------------------------------- -#-------------------------------------------------------------- -# Extract various version numbers from tcl modules and headers -# The generated file is then included in the makefile. -#-------------------------------------------------------------- - -!if "$(PROJECT)" == "tcl" - -!if [echo REM = This file is generated from rules.vc > versions.vc] +!if "$(PROJECT)" == "tk" +_TK_H = ..\generic\tk.h +_INSTALLDIR = $(_INSTALLDIR)\.. !endif -# Note we can do the Tcl and/or Tk version extraction -!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V ..\generic\tcl.h TCL_MAJOR_VERSION >> versions.vc] -!endif -!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V ..\generic\tcl.h TCL_MINOR_VERSION >> versions.vc] + +!ifdef PROJECT_REQUIRES_TK +!if !defined(TKDIR) +!if exist("$(_INSTALLDIR)\..\include\tk.h") +TKINSTALL = 1 +_TKDIR = $(_INSTALLDIR)\.. +_TK_H = $(_TKDIR)\include\tk.h +TKDIR = $(_TKDIR) +!elseif exist("$(_TCLDIR)\include\tk.h") +TKINSTALL = 1 +_TKDIR = $(_TCLDIR) +_TK_H = $(_TKDIR)\include\tk.h +TKDIR = $(_TKDIR) !endif -!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ - && [nmakehlp -V ..\generic\tcl.h TCL_PATCH_LEVEL >> versions.vc] +!else +_TKDIR = $(TKDIR:/=\) +!if exist("$(_TKDIR)\include\tk.h") +TKINSTALL = 1 +_TK_H = $(_TKDIR)\include\tk.h +!elseif exist("$(_TKDIR)\generic\tk.h") +TKINSTALL = 0 +_TK_H = $(_TKDIR)\generic\tk.h +!else +MSG =^ +Failed to find tk.h. The TKDIR macro does not appear correct. +!error $(MSG) !endif -!if [echo PKG_HTTP_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] !endif -!if [echo PKG_TCLTEST_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc] !endif -!if [echo PKG_MSGCAT_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc] + +#------------------------------------------------------------------------- +# Extract Tk version numbers +#------------------------------------------------------------------------- + +!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk" + +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] !endif -!if [echo PKG_PLATFORM_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc] +!if [echo TK_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] !endif -!if [echo PKG_SHELL_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc] +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] !endif !include versions.vc +TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) + +!if "$(PROJECT)" != "tk" +!if $(TKINSTALL) +WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" +TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" +TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" +TK_INCLUDES = -I"$(_TKDIR)\include" +!else +WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" +TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" +TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" +TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" +!endif +!endif + !endif #---------------------------------------------------------- @@ -573,8 +658,8 @@ TCLTOOLSDIR = $(_TCLDIR)\tools !message *** Output directory will be '$(OUT_DIR)' !message *** Suffix for binaries will be '$(SUFX)' !message *** Optional defines are '$(OPTDEFINES)' -!message *** Compiler version $(VCVER) -!message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)' +!message *** Compiler version $(VCVER). Target machine is $(MACHINE) +!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)' !message *** Link options '$(LINKERFLAGS)' !endif diff --git a/win/tclWinPort.h b/win/tclWinPort.h index b1765dd..ac53b29 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.48 2005/11/27 02:33:50 das Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.48.8.1 2007/10/15 18:38:09 dgp Exp $ */ #ifndef _TCLWINPORT @@ -520,13 +520,6 @@ #define TclpExit exit -#ifdef TCL_WIDE_INT_TYPE -MODULE_SCOPE Tcl_WideInt strtoll _ANSI_ARGS_((CONST char *string, - char **endPtr, int base)); -MODULE_SCOPE Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string, - char **endPtr, int base)); -#endif /* TCL_WIDE_INT_TYPE */ - #ifndef INVALID_SET_FILE_POINTER #define INVALID_SET_FILE_POINTER 0xFFFFFFFF #endif /* INVALID_SET_FILE_POINTER */ |