diff options
-rw-r--r-- | library/word.tcl | 10 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 12 | ||||
-rw-r--r-- | win/tclWinInit.c | 11 |
3 files changed, 20 insertions, 13 deletions
diff --git a/library/word.tcl b/library/word.tcl index b8f34a5..3a73b88 100644 --- a/library/word.tcl +++ b/library/word.tcl @@ -13,16 +13,6 @@ # The following variables are used to determine which characters are # interpreted as white space. -if {$::tcl_platform(platform) eq "windows"} { - # Windows style - any but a unicode space char - set ::tcl_wordchars {\S} - set ::tcl_nonwordchars {\s} -} else { - # Motif style - any unicode word char (number, letter, or underscore) - set ::tcl_wordchars {\w} - set ::tcl_nonwordchars {\W} -} - # Arrange for caches of the real matcher REs to be kept, which enables the REs # themselves to be cached for greater performance (and somewhat greater # clarity too). diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 5fc0035..1551e79 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -738,8 +738,8 @@ Tcl_GetEncodingNameFromEnvironment( * None. * * Side effects: - * Sets "tclDefaultLibrary", "tcl_pkgPath", and "tcl_platform" Tcl - * variables. + * Sets "tclDefaultLibrary", "tcl_pkgPath", "tcl_platform", + * "tcl_wordchars" and "tcl_nonwordchars" Tcl variables. * *---------------------------------------------------------------------- */ @@ -973,6 +973,14 @@ TclpSetVariables( */ Tcl_SetVar2(interp, "tcl_platform","pathSeparator", ":", TCL_GLOBAL_ONLY); + + /* + * Define the tcl_wordchars and tcl_nonwordchars regexps + * Motif style: any unicode word char (number, letter, or underscore) + */ + + Tcl_SetVar(interp, "tcl_wordchars", "\\w", TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_nonwordchars", "\\W", TCL_GLOBAL_ONLY); } /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 8b600f6..34c7dd1 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -511,7 +511,8 @@ Tcl_GetEncodingNameFromEnvironment( * None. * * Side effects: - * Sets "tcl_platform", and "env(HOME)" Tcl variables. + * Sets "tcl_platform", "env(HOME)", "tcl_wordchars" and "tcl_nonwordchars" + * Tcl variables. * *---------------------------------------------------------------------- */ @@ -628,6 +629,14 @@ TclpSetVariables( */ Tcl_SetVar2(interp, "tcl_platform","pathSeparator", ";", TCL_GLOBAL_ONLY); + + /* + * Define the tcl_wordchars and tcl_nonwordchars regexps + * Windows style: any but a unicode space char + */ + + Tcl_SetVar(interp, "tcl_wordchars", "\\S", TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_nonwordchars", "\\s", TCL_GLOBAL_ONLY); } /* |