summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-15 10:29:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-15 10:29:05 (GMT)
commit9b6c85d82e18b0baa54b73e6b53a77a4047b0131 (patch)
treedb3b01ed0900ca6e8db9f69313c360d3f8fb1a57
parent88b8fc30a2b364c4344fcd6e964703ef491c4a46 (diff)
parentc5687412d6bad613f680ef09a7e0a942f49eca3d (diff)
downloadtcl-9b6c85d82e18b0baa54b73e6b53a77a4047b0131.zip
tcl-9b6c85d82e18b0baa54b73e6b53a77a4047b0131.tar.gz
tcl-9b6c85d82e18b0baa54b73e6b53a77a4047b0131.tar.bz2
Merge trunk.
Move Tcl_InitSubsystems documentation to its own manpage
-rw-r--r--ChangeLog6
-rw-r--r--doc/FindExec.389
-rw-r--r--doc/InitSubSyst.3108
-rw-r--r--doc/msgcat.n2
-rw-r--r--library/msgcat/msgcat.tcl15
-rw-r--r--library/msgcat/pkgIndex.tcl2
-rw-r--r--tests/msgcat.test4
-rw-r--r--unix/Makefile.in4
-rw-r--r--win/Makefile.in4
9 files changed, 130 insertions, 104 deletions
diff --git a/ChangeLog b/ChangeLog
index 64d80c1..97fcc85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-02-14 Harald Oehlmann <oehhar@users.sf.net>
+
+ * library/msgcat/msgcat.tcl: [Bug 3604576]: Catch missing registry entry
+ "HCU\Control Panel\International".
+ Bumped msgcat version to 1.5.1
+
2013-02-11 Donal K. Fellows <dkf@users.sf.net>
* generic/tclZlib.c (ZlibTransformOutput): [Bug 3603553]: Ensure that
diff --git a/doc/FindExec.3 b/doc/FindExec.3
index 1b3c7c5..e4b4ed0 100644
--- a/doc/FindExec.3
+++ b/doc/FindExec.3
@@ -8,7 +8,7 @@
.TH Tcl_FindExecutable 3 8.1 Tcl "Tcl Library Procedures"
.BS
.SH NAME
-Tcl_FindExecutable, Tcl_GetNameOfExecutable, Tcl_InitSubsystems \- identify or return the name of the binary file containing the application
+Tcl_FindExecutable, Tcl_GetNameOfExecutable \- identify or return the name of the binary file containing the application
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -18,18 +18,11 @@ void
.sp
const char *
\fBTcl_GetNameOfExecutable\fR()
-.sp
-Tcl_Interp *
-\fBTcl_InitSubsystems\fR(\fIflags\fR, \fI...\fR)
.SH ARGUMENTS
.AS char *argv0
.AP char *argv0 in
The first command-line argument to the program, which gives the
application's name.
-.AP int flags in
-Any combination of flags which indicate whether a custom panicProc
-is registered and/or a real interpreter is created.
-The value 0 can be used if Tcl is used as utility library only.
.BE
.SH DESCRIPTION
@@ -65,84 +58,6 @@ internal full path name of the executable file as computed by
equivalent to the \fBinfo nameofexecutable\fR command. NULL
is returned if the internal full path name has not been
computed or unknown.
-.PP
-The \fBTcl_InitSubsystems\fR can be used as an alternative to
-\fBTcl_FindExecutable\fR, when more flexibility is required.
-Its flags control exactly what is initialized, and what
-additional arguments are expected.
-.PP
-The call \fBTcl_InitSubsystems(0)\fR does the same as
-\fBTcl_FindExecutable(NULL)\fR, except that a Tcl_Interp *
-is returned which can be used only by \fBTcl_InitStubs\fR
-to initialize the stub table. This opens up the Tcl Stub
-technology for Tcl embedders, which now can dynamically
-load the Tcl shared library and use functions in it
-without ever creating an interpreter. E.g. the
-following code can be compiled with -DUSE_TCL_STUBS:
-.CS
- Tcl_Interp *interp, *(*initSubSystems)(int, ...);
- const char *version;
- void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL);
- initSubSystems = dlsym(handle, "Tcl_InitSubsystems");
- version = Tcl_InitStubs(initSubSystems(0), NULL, 0);
- /* At this point, Tcl C API calls without interp are ready for use */
- interp = Tcl_CreateInterp(); /* Now we have a real interpreter */
- Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */
-.CE
-This is equivalent to (without dynamical loading)
-.CS
- Tcl_Interp *interp;
- const char *version;
- version = Tcl_InitStubs(Tcl_InitSubSystems(0), NULL, 0);
- /* At this point, Tcl C API calls without interp are ready for use */
- interp = Tcl_CreateInterp(); /* Now we have a real interpreter */
- Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */
-.CE
-The function \fBTcl_CreateInterp\fR, or any other Tcl function you
-would like to call, no longer needs to be searched for in the
-shared library. It can be called directly through the stub table.
-Note that the stub table needs to be initialized twice, in order
-to be sure that you can call all functions without limitations
-after the real interpreter is created.
-.PP
-If you supply the flag \fBTCL_INIT_PANIC\fR to \fBTcl_InitSubsystems\fR,
-the function expects an additional argument, a custom panicProc.
-This is equivalent to calling \fBTcl_SetPanicProc\fR immediately
-before \fBTcl_InitSubsystems\fR, except that you possibly cannot do
-that yet if it requires an initialized stub table. Of course you
-could call \fBTcl_SetPanicProc\fR immediately after \fBTcl_InitSubsystems\fR,
-but then panics which could be produced by the initialization
-itself still use the default panic procedure.
-.PP
-If you supply one of the flags \fBTCL_INIT_CREATE\fR, \fBTCL_INIT_CREATE_UTF8\fR or
-\fBTCL_INIT_CREATE_UNICODE\fR to \fBTcl_InitSubsystems\fR, the function
-gets two additional parameters, argc and argv. Then a real
-Tcl interpreter will be created. If argc > 0 then the variables
-\fBargc\fR and \fBargv\fR will be set in this interpreter. The 3
-variants assume a different encoding for the arguments, except for
-\fIargv[0]\fR which is always assumed to be in the system encoding.
-So, the above example code could be simplified to:
-.CS
- interp = Tcl_InitSubSystems(TCL_INIT_CREATE, 0, NULL);
- Tcl_InitStubs(interp, TCL_VERSION, 0); /* initialize the stub table */
-.CE
-.PP
-If the \fBTCL_INIT_PANIC\fR and one of the \fBTCL_INIT_CREATE\fR
-flags are used in combination, the \fBpanicProc\fR argument comes
-before the \fBargc\fR/\fBargv\fR arguments.
-.PP
-The reason for \fBargv0\fR always using the system encoding is that this way,
-argv0 can be derived directly from the main() (or mainw, on Windows)
-arguments without any processing. \fBTCL_INIT_CREATE_UNICODE\fR is really only
-useful on Windows. But on Windows, the argv0 parameter is not used for
-determining the value of [info executable] anyway. Modern UNIX system already
-have UTF-8 as system encoding, so \fBTCL_INIT_CREATE_UTF8\fR would have the same
-effect as \fBTCL_INIT_CREATE\fR, only slightly faster. Other parameters can be
-preprocessed at will by the application, and if the application uses unicode
-or UTF-8 internally there is no need to convert it back to the system encoding.
-.PP
-The interpreter returned by Tcl_InitSubsystems(0) cannot be passed to
-any other function than Tcl_InitStubs(). Tcl functions with an "interp"
-argument can only be called if the function supports passing NULL.
+
.SH KEYWORDS
binary, executable file
diff --git a/doc/InitSubSyst.3 b/doc/InitSubSyst.3
new file mode 100644
index 0000000..efe4861
--- /dev/null
+++ b/doc/InitSubSyst.3
@@ -0,0 +1,108 @@
+'\"
+'\" Copyright (c) 1995-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.
+'\"
+.so man.macros
+.TH Tcl_InitSubsystems 3 8.6 Tcl "Tcl Library Procedures"
+.BS
+.SH NAME
+Tcl_InitSubsystems \- initialize the Tcl library.
+.SH SYNOPSIS
+.nf
+\fB#include <tcl.h>\fR
+.sp
+Tcl_Interp *
+\fBTcl_InitSubsystems\fR(\fIflags\fR, \fI...\fR)
+.SH ARGUMENTS
+.AS int flags
+.AP int flags in
+Any combination of flags which indicate whether a custom panicProc
+is registered and/or a real interpreter is created.
+The value 0 can be used if Tcl is used as utility library only.
+.BE
+
+.SH DESCRIPTION
+.PP
+The \fBfBTcl_InitSubsystems\fR procedure initializes the Tcl
+library. This procedure is typically invoked as the very
+first thing in the application's main program.
+Its \fBflags\fR argument controls exactly what is initialized,
+and what additional arguments are expected.
+.PP
+The call \fBTcl_InitSubsystems(0)\fR does the same as
+\fBTcl_FindExecutable(NULL)\fR, except that a Tcl_Interp *
+is returned which can be used only by \fBTcl_InitStubs\fR
+to initialize the stub table. This opens up the Tcl Stub
+technology for Tcl embedders, which now can dynamically
+load the Tcl shared library and use functions in it
+without ever creating an interpreter. E.g. the
+following code can be compiled with -DUSE_TCL_STUBS:
+.CS
+ Tcl_Interp *interp, *(*initSubSystems)(int, ...);
+ const char *version;
+ void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL);
+ initSubSystems = dlsym(handle, "Tcl_InitSubsystems");
+ version = Tcl_InitStubs(initSubSystems(0), NULL, 0);
+ /* At this point, Tcl C API calls without interp are ready for use */
+ interp = Tcl_CreateInterp(); /* Now we have a real interpreter */
+ Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */
+.CE
+This is equivalent to (without dynamical loading)
+.CS
+ Tcl_Interp *interp;
+ const char *version;
+ version = Tcl_InitStubs(Tcl_InitSubSystems(0), NULL, 0);
+ /* At this point, Tcl C API calls without interp are ready for use */
+ interp = Tcl_CreateInterp(); /* Now we have a real interpreter */
+ Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */
+.CE
+The function \fBTcl_CreateInterp\fR, or any other Tcl function you
+would like to call, no longer needs to be searched for in the
+shared library. It can be called directly through the stub table.
+Note that the stub table needs to be initialized twice, in order
+to be sure that you can call all functions without limitations
+after the real interpreter is created.
+.PP
+If you supply the flag \fBTCL_INIT_PANIC\fR to \fBTcl_InitSubsystems\fR,
+the function expects an additional argument, a custom panicProc.
+This is equivalent to calling \fBTcl_SetPanicProc\fR immediately
+before \fBTcl_InitSubsystems\fR, except that you possibly cannot do
+that yet if it requires an initialized stub table. Of course you
+could call \fBTcl_SetPanicProc\fR immediately after \fBTcl_InitSubsystems\fR,
+but then panics which could be produced by the initialization
+itself still use the default panic procedure.
+.PP
+If you supply one of the flags \fBTCL_INIT_CREATE\fR, \fBTCL_INIT_CREATE_UTF8\fR or
+\fBTCL_INIT_CREATE_UNICODE\fR to \fBTcl_InitSubsystems\fR, the function
+gets two additional parameters, argc and argv. Then a real
+Tcl interpreter will be created. If argc > 0 then the variables
+\fBargc\fR and \fBargv\fR will be set in this interpreter. The 3
+variants assume a different encoding for the arguments, except for
+\fIargv[0]\fR which is always assumed to be in the system encoding.
+So, the above example code could be simplified to:
+.CS
+ Tcl_Interp *interp = Tcl_InitSubSystems(TCL_INIT_CREATE, 0, NULL);
+ Tcl_InitStubs(interp, TCL_VERSION, 0); /* initialize the stub table */
+.CE
+.PP
+If the \fBTCL_INIT_PANIC\fR and one of the \fBTCL_INIT_CREATE\fR
+flags are used in combination, the \fBpanicProc\fR argument comes
+before the \fBargc\fR/\fBargv\fR arguments.
+.PP
+The reason for \fBargv0\fR always using the system encoding is that this way,
+argv0 can be derived directly from the main() (or mainw, on Windows)
+arguments without any processing. \fBTCL_INIT_CREATE_UNICODE\fR is really only
+useful on Windows. But on Windows, the argv0 parameter is not used for
+determining the value of [info executable] anyway. Modern UNIX system already
+have UTF-8 as system encoding, so \fBTCL_INIT_CREATE_UTF8\fR would have the same
+effect as \fBTCL_INIT_CREATE\fR, only slightly faster. Other parameters can be
+preprocessed at will by the application, and if the application uses unicode
+or UTF-8 internally there is no need to convert it back to the system encoding.
+.PP
+The interpreter returned by Tcl_InitSubsystems(0) cannot be passed to
+any other function than Tcl_InitStubs(). Tcl functions with an "interp"
+argument can only be called if the function supports passing NULL.
+.SH KEYWORDS
+binary, executable file
diff --git a/doc/msgcat.n b/doc/msgcat.n
index 57fbb78..47b6bf7 100644
--- a/doc/msgcat.n
+++ b/doc/msgcat.n
@@ -13,7 +13,7 @@ msgcat \- Tcl message catalog
.SH SYNOPSIS
\fBpackage require Tcl 8.5\fR
.sp
-\fBpackage require msgcat 1.5.0\fR
+\fBpackage require msgcat 1.5\fR
.sp
\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR?
.sp
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 112507a..5f0ba2e 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -13,7 +13,7 @@
package require Tcl 8.5
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the installation directory in the Makefiles.
-package provide msgcat 1.5.0
+package provide msgcat 1.5.1
namespace eval msgcat {
namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \
@@ -287,7 +287,7 @@ proc msgcat::mcload {langdir} {
}
set x 0
foreach p [mcpreferences] {
- if { $p eq {} } {
+ if {$p eq {}} {
set p ROOT
}
set langfile [file join $langdir $p.msg]
@@ -374,7 +374,7 @@ proc msgcat::mcflset {src {dest ""}} {
# Results:
# Returns the number of pairs processed
-proc msgcat::mcmset {locale pairs } {
+proc msgcat::mcmset {locale pairs} {
variable Msgs
set length [llength $pairs]
@@ -551,10 +551,9 @@ proc msgcat::Init {} {
# Examples: de-CH -> de_ch, sr-Latn-CS -> sr_cs@latin, es-419 -> es
#
set key {HKEY_CURRENT_USER\Control Panel\International}
- if {([registry values $key "LocaleName"] ne "")
+ if {![catch {registry get $key LocaleName} localeName]
&& [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\
- [string tolower [registry get $key "LocaleName"]] match locale\
- script territory]} {
+ [string tolower $localeName] match locale script territory]} {
if {"" ne $territory} {
append locale _ $territory
}
@@ -562,9 +561,7 @@ proc msgcat::Init {} {
if {[dict exists $modifierDict $script]} {
append locale @ [dict get $modifierDict $script]
}
- if {![catch {
- mclocale [ConvertLocale $locale]
- }]} {
+ if {![catch {mclocale [ConvertLocale $locale]}]} {
return
}
}
diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl
index 832bf81..3fdb25a 100644
--- a/library/msgcat/pkgIndex.tcl
+++ b/library/msgcat/pkgIndex.tcl
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-package ifneeded msgcat 1.5.0 [list source [file join $dir msgcat.tcl]]
+package ifneeded msgcat 1.5.1 [list source [file join $dir msgcat.tcl]]
diff --git a/tests/msgcat.test b/tests/msgcat.test
index 70a7af2..050b592 100644
--- a/tests/msgcat.test
+++ b/tests/msgcat.test
@@ -17,8 +17,8 @@ if {[catch {package require tcltest 2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2 required."
return
}
-if {[catch {package require msgcat 1.5.0}]} {
- puts stderr "Skipping tests in [info script]. No msgcat 1.5.0 found to test."
+if {[catch {package require msgcat 1.5}]} {
+ puts stderr "Skipping tests in [info script]. No msgcat 1.5 found to test."
return
}
diff --git a/unix/Makefile.in b/unix/Makefile.in
index fe95797..0eea33a 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -846,8 +846,8 @@ install-libraries: libraries
do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \
done;
- @echo "Installing package msgcat 1.5.0 as a Tcl Module";
- @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.0.tm;
+ @echo "Installing package msgcat 1.5.1 as a Tcl Module";
+ @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.1.tm;
@echo "Installing package tcltest 2.3.5 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.5.tm;
diff --git a/win/Makefile.in b/win/Makefile.in
index 2764813..99009b9 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -646,8 +646,8 @@ install-libraries: libraries install-tzdata install-msgs
do \
$(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \
done;
- @echo "Installing package msgcat 1.5.0 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.0.tm;
+ @echo "Installing package msgcat 1.5.1 as a Tcl Module";
+ @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.1.tm;
@echo "Installing package tcltest 2.3.5 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.5.tm;
@echo "Installing package platform 1.0.11 as a Tcl Module";