'\" '\" Copyright (c) 2002 Andreas Kupries '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: RegConfig.3,v 1.6 2004/10/07 15:15:47 dkf Exp $ .so man.macros .TH Tcl_RegisterConfig 3 8.4 Tcl "Tcl Library Procedures" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME Tcl_RegisterConfig \- procedures to register embedded configuration information .SH SYNOPSIS .nf \fB#include \fR .sp void \fBTcl_RegisterConfig\fR(\fIinterp, pkgName, configuration, valEncoding\fR) .sp .SH ARGUMENTS .AS Tcl_Interp *configuration .AP Tcl_Interp *interp in Refers to the interpreter the embedded configuration information is registered for. Must not be NULL. .AP "const char" *pkgName in Contains the name of the package registering the embedded configuration as ASCII string. This means that this information is in UTF-8 too. Must not be NULL. .AP Tcl_Config *configuration in Refers to an array of Tcl_Config entries containing the information embedded in the binary library. Must not be NULL. The end of the array is signaled by either a key identical to NULL, or a key referring to the empty string. .AP "const char" *valEncoding in Contains the name of the encoding used to store the configuration values as ASCII string. This means that this information is in UTF-8 too. Must not be NULL. .BE .SH DESCRIPTION .PP The function described here has its base in TIP 59 and provides extensions with support for the embedding of configuration information into their binary library and the generation of a Tcl-level interface for querying this information. .PP To embed configuration information into their binary library an extension has to define a non-volatile array of Tcl_Config entries in one if its source files and then call \fBTcl_RegisterConfig\fR to register that information. .PP \fBTcl_RegisterConfig\fR takes four arguments; first, a reference to the interpreter we are registering the information with, second, the name of the package registering its configuration information, third, a pointer to an array of structures, and fourth a string declaring the encoding used by the configuration values. .PP The string \fIvalEncoding\fR contains the name of an encoding known to Tcl. All these names are use only characters in the ASCII subset of UTF-8 and are thus implicitly in the UTF-8 encoding. It is expected that keys are legible English text and therefore using the ASCII subset of UTF-8. In other words, they are expected to be in UTF-8 too. The values associated with the keys can be any string however. For these the contents of \fIvalEncoding\fR define which encoding was used to represent the characters of the strings. .PP Each element of the \fIconfiguration\fR array refers to two strings containing the key and the value associated with that key. The end of the array is signaled by either an empty key or a key identical to NULL. The function makes \fBno\fR copy of the \fIconfiguration\fR array. This means that the caller has to make sure that the memory holding this array is never released. This is the meaning behind the word \fBnon-volatile\fR used earlier. The easiest way to accomplish this is to define a global static array of Tcl_Config entries. See the file "generic/tclPkgConfig.c" in the sources of the Tcl core for an example. .PP When called \fBTcl_RegisterConfig\fR will .IP (1) create a namespace having the provided \fIpkgName\fR, if not yet existing. .IP (2) create the command \fBpkgconfig\fR in that namespace and link it to the provided information so that the keys from _configuration_ and their associated values can be retrieved through calls to \fBpkgconfig\fR. .PP The command \fBpkgconfig\fR will provide two subcommands, \fBlist\fR and \fBget\fR: .RS .TP ::\fIpkgName\fR::\fBpkgconfig\fR list Returns a list containing the names of all defined keys. .TP ::\fIpkgName\fR::\fBpkgconfig\fR get \fIkey\fR Returns the configuration value associated with the specified \fIkey\fR. .RE .SH TCL_CONFIG The \fBTcl_Config\fR structure contains the following fields: .PP .CS typedef struct Tcl_Config { const char* key; const char* value; } Tcl_Config; .CE '\" No cross references yet. '\" .SH "SEE ALSO" .SH KEYWORDS embedding, configuration, bianry library ug_2152292'>bug_2152292 Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* const addition (pkge.c)nijtmans2009-08-161-1/+1
* const addition (pkge.c)nijtmans2009-08-165-29/+34
* TIP #353 IMPLEMENTATIONdgp2009-08-1211-97/+264
* * doc/refchan.n [Bug 2827000]: Extended the implementation ofandreas_kupries2009-08-064-7/+184
* * tests/coroutine.test: fix testfile cleanupMiguel Sofer2009-08-022-8/+10
* Added *unsupported* command to report an object's representation.dkf2009-08-024-4/+52
* Stop calling endpwent() and endgrent(); unneeded. [Bug 1942222]dkf2009-08-023-18/+20
* eliminate TclWinResetInterfaceEncodings, becausenijtmans2009-08-025-66/+46
* * generic/tclStringObj.c: Corrected failure to grow bufferdgp2009-07-313-2/+15
* Simplify a bit further following more testingdkf2009-07-261-10/+3
* Use [try] to replace obscurer uses of [catch].dkf2009-07-265-611/+612
* Forced LF translation when generating .h's to avoid spurious diffs when regen...ferrieux2009-07-262-1/+7
* [Bug 2827066] msys build --enable-symbols brokennijtmans2009-07-264-6/+20
* Correct "incidental" test failure; exact error message generated bydkf2009-07-251-55/+33
* Make [history] (well, [::tcl::history]) be a real ensemble.dkf2009-07-253-190/+134
* minor cleanupsdgp2009-07-242-3/+5
* Clarify code by using [try] instead of [catch] in a few placesdkf2009-07-241-557/+426
* Removed mention of auto_mkindex_old from indexed locations; we reallydkf2009-07-241-7/+9
* Made it clearer what most people want instead of [self class].dkf2009-07-242-13/+26
* Revert series of local changes not relevant to the last commit.andreas_kupries2009-07-236-34/+11
* * generic/tclIO.c (Tcl_GetChannelHandle): Do not crash forandreas_kupries2009-07-239-16/+63
* fix SunCC warningdas2009-07-231-2/+2
* Fix for [Bug 2820349]Joe Mistachkin2009-07-232-1/+7
* Feature Request 2814786: remove TclpPanicnijtmans2009-07-225-36/+17
* * macosx/tclMacOSXFCmd.c: CONST -> constnijtmans2009-07-225-10/+17
* Refined the 20090617 patch on [exit] streamlining, so that it now correctly c...ferrieux2009-07-222-5/+21
* 2009-07-21 Kevin B. Kenny <kennykb@acm.org>Kevin B Kenny2009-07-213-184/+8
* Performance boost for [string is].dkf2009-07-202-36/+75
* Expose function to efficiently return current name of an object.dkf2009-07-196-14/+61
* * unix/Makefile.in: Define NDEBUG in optimized (non-symbols) build todas2009-07-182-2/+7
* * generic/tclBinary.c: Removed unused variables.dgp2009-07-16