{"id":6698,"date":"2022-12-20T19:33:27","date_gmt":"2022-12-20T22:33:27","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/tcl_registerconfig-man3\/"},"modified":"2022-12-20T19:33:27","modified_gmt":"2022-12-20T22:33:27","slug":"tcl_registerconfig-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/tcl_registerconfig-man3\/","title":{"rendered":"Tcl_RegisterConfig (man3)"},"content":{"rendered":"<h1 align=\"center\">Tcl_RegisterConfig<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#ARGUMENTS\">ARGUMENTS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#TCL_CONFIG\">TCL_CONFIG<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Tcl_RegisterConfig \u2212 procedures to register embedded configuration information<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <tcl.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">void <b><br \/> Tcl_RegisterConfig<\/b>(<i>interp, pkgName, configuration, valEncoding<\/i>)<\/p>\n<h2>ARGUMENTS <a name=\"ARGUMENTS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"55%\">\n<p style=\"margin-top: 1em\">Tcl_Interp <i>*interp<\/i> (in)<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"28%\">\n<p style=\"margin-top: 1em\">Refers to the interpreter the embedded configuration information is registered for. Must not be NULL.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"55%\">\n<p>const char <i>*pkgName<\/i> (in)<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"28%\">\n<p>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.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"55%\">\n<p>const Tcl_Config <i>*configuration<\/i> (in)<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"28%\">\n<p>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.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"55%\">\n<p>const char <i>*valEncoding<\/i> (in)<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"28%\">\n<p>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.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:72%;\">______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">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.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">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 <b>Tcl_RegisterConfig<\/b> to register that information.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_RegisterConfig<\/b> 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.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The string <i>valEncoding<\/i> 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 <i>valEncoding<\/i> define which encoding was used to represent the characters of the strings.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Each element of the <i>configuration<\/i> 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 <b>no<\/b> copy of the <i>configuration<\/i> 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 <b>non-volatile<\/b> used earlier. The easiest way to accomplish this is to define a global static array of Tcl_Config entries. See the file \u201cgeneric\/tclPkgConfig.c\u201d in the sources of the Tcl core for an example.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When called <b>Tcl_RegisterConfig<\/b> will<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\">(1)<\/p>\n<\/td>\n<td width=\"7%\"><\/td>\n<td width=\"78%\">\n<p style=\"margin-top: 1em\">create a namespace having the provided <i>pkgName<\/i>, if not yet existing.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p>(2)<\/p>\n<\/td>\n<td width=\"7%\"><\/td>\n<td width=\"78%\">\n<p>create the command <b>pkgconfig<\/b> in that namespace and link it to the provided information so that the keys from <i>configuration<\/i> and their associated values can be retrieved through calls to <b>pkgconfig<\/b>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">The command <b>pkgconfig<\/b> will provide two subcommands, <b>list<\/b> and <b>get<\/b>:<\/p>\n<p style=\"margin-left:22%;\">::<i>pkgName<\/i>::<b>pkgconfig<\/b> list<\/p>\n<p style=\"margin-left:32%;\">Returns a list containing the names of all defined keys.<\/p>\n<p style=\"margin-left:22%;\">::<i>pkgName<\/i>::<b>pkgconfig<\/b> get <i>key<\/i><\/p>\n<p style=\"margin-left:32%;\">Returns the configuration value associated with the specified <i>key<\/i>.<\/p>\n<h2>TCL_CONFIG <a name=\"TCL_CONFIG\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>Tcl_Config<\/b> structure contains the following fields:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">typedef struct Tcl_Config { <br \/> const char *<i>key<\/i>; <br \/> const char *<i>value<\/i>; <br \/> } <b>Tcl_Config<\/b>;<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">embedding, configuration, binary library<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Tcl_RegisterConfig \u2212 procedures to register embedded configuration information <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3007,3076],"class_list":["post-6698","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-man3","tag-tcl_registerconfig"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6698"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6698\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}