{"id":7432,"date":"2022-12-20T19:38:05","date_gmt":"2022-12-20T22:38:05","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/tcl_dstring-man3-10\/"},"modified":"2022-12-20T19:38:05","modified_gmt":"2022-12-20T22:38:05","slug":"tcl_dstring-man3-10","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/tcl_dstring-man3-10\/","title":{"rendered":"Tcl_DString (man3)"},"content":{"rendered":"<h1 align=\"center\">Tcl_DString<\/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=\"#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_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult \u2212 manipulate dynamic strings<\/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\"><b>Tcl_DStringInit<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_DStringAppend<\/b>(<i>dsPtr, bytes, length<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_DStringAppendElement<\/b>(<i>dsPtr, element<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringStartSublist<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringEndSublist<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">int <b><br \/> Tcl_DStringLength<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_DStringValue<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringSetLength<\/b>(<i>dsPtr, newLength<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringTrunc<\/b>(<i>dsPtr, newLength<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringFree<\/b>(<i>dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringResult<\/b>(<i>interp, dsPtr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringGetResult<\/b>(<i>interp, dsPtr<\/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=\"41%\">\n<p style=\"margin-top: 1em\">Tcl_DString <i>*dsPtr<\/i> (in\/out)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p style=\"margin-top: 1em\">Pointer to structure that is used to manage a dynamic string.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"41%\">\n<p>const char <i>*bytes<\/i> (in)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p>Pointer to characters to append to dynamic string.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"41%\">\n<p>const char <i>*element<\/i> (in)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p>Pointer to characters to append as list element to dynamic string.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"41%\">\n<p>int <i>length<\/i> (in)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p>Number of bytes from <i>bytes<\/i> to add to dynamic string. If -1, add all characters up to null terminating character.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"41%\">\n<p>int <i>newLength<\/i> (in)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p>New length for dynamic string, not including null terminating character.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"41%\">\n<p>Tcl_Interp <i>*interp<\/i> (in\/out)<\/p>\n<\/td>\n<td width=\"14%\"><\/td>\n<td width=\"34%\">\n<p>Interpreter whose result is to be set from or moved to the dynamic string.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:66%;\">______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Dynamic strings provide a mechanism for building up arbitrarily long strings by gradually appending information. If the dynamic string is short then there will be no memory allocation overhead; as the string gets larger, additional space will be allocated as needed.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringInit<\/b> initializes a dynamic string to zero length. The Tcl_DString structure must have been allocated by the caller. No assumptions are made about the current state of the structure; anything already in it is discarded. If the structure has been used previously, <b>Tcl_DStringFree<\/b> should be called first to free up any memory allocated for the old string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringAppend<\/b> adds new information to a dynamic string, allocating more memory for the string if needed. If <i>length<\/i> is less than zero then everything in <i>bytes<\/i> is appended to the dynamic string; otherwise <i>length<\/i> specifies the number of bytes to append. <b>Tcl_DStringAppend<\/b> returns a pointer to the characters of the new string. The string can also be retrieved from the <i>string<\/i> field of the Tcl_DString structure.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringAppendElement<\/b> is similar to <b>Tcl_DStringAppend<\/b> except that it does not take a <i>length<\/i> argument (it appends all of <i>element<\/i>) and it converts the string to a proper list element before appending. <b>Tcl_DStringAppendElement<\/b> adds a separator space before the new list element unless the new list element is the first in a list or sub-list (i.e. either the current string is empty, or it contains the single character \u201c{\u201d, or the last two characters of the current string are \u201c {\u201d). <b>Tcl_DStringAppendElement<\/b> returns a pointer to the characters of the new string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringStartSublist<\/b> and <b>Tcl_DStringEndSublist<\/b> can be used to create nested lists. To append a list element that is itself a sublist, first call <b>Tcl_DStringStartSublist<\/b>, then call <b>Tcl_DStringAppendElement<\/b> for each of the elements in the sublist, then call <b>Tcl_DStringEndSublist<\/b> to end the sublist. <b>Tcl_DStringStartSublist<\/b> appends a space character if needed, followed by an open brace; <b>Tcl_DStringEndSublist<\/b> appends a close brace. Lists can be nested to any depth.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringLength<\/b> is a macro that returns the current length of a dynamic string (not including the terminating null character). <b>Tcl_DStringValue<\/b> is a macro that returns a pointer to the current contents of a dynamic string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringSetLength<\/b> changes the length of a dynamic string. If <i>newLength<\/i> is less than the string\u2019s current length, then the string is truncated. If <i>newLength<\/i> is greater than the string\u2019s current length, then the string will become longer and new space will be allocated for the string if needed. However, <b>Tcl_DStringSetLength<\/b> will not initialize the new space except to provide a terminating null character; it is up to the caller to fill in the new space. <b>Tcl_DStringSetLength<\/b> does not free up the string\u2019s storage space even if the string is truncated to zero length, so <b>Tcl_DStringFree<\/b> will still need to be called.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringTrunc<\/b> changes the length of a dynamic string. This procedure is now deprecated. <b>Tcl_DStringSetLength<\/b> should be used instead.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringFree<\/b> should be called when you are finished using the string. It frees up any memory that was allocated for the string and reinitializes the string\u2019s value to an empty string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringResult<\/b> sets the result of <i>interp<\/i> to the value of the dynamic string given by <i>dsPtr<\/i>. It does this by moving a pointer from <i>dsPtr<\/i> to the interpreter\u2019s result. This saves the cost of allocating new memory and copying the string. <b>Tcl_DStringResult<\/b> also reinitializes the dynamic string to an empty string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_DStringGetResult<\/b> does the opposite of <b>Tcl_DStringResult<\/b>. It sets the value of <i>dsPtr<\/i> to the result of <i>interp<\/i> and it clears <i>interp<\/i>\u2019s result. If possible it does this by moving a pointer rather than by copying the string.<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">append, dynamic string, free, result<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringSetLength, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult, Tcl_DStringGetResult \u2212 manipulate dynamic strings <\/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,3744,3007],"class_list":["post-7432","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-dstring","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7432","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=7432"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7432\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}