⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stringobj.3

📁 linux系统下的音频通信
💻 3
字号:
'\"'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) @(#) StringObj.3 1.13 97/06/25 13:40:25'\" .so man.macros.TH Tcl_StringObj 3 8.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_NewStringObj, Tcl_SetStringObj, Tcl_GetStringFromObj, Tcl_AppendToObj, Tcl_AppendStringsToObj, Tcl_SetObjLength, TclConcatObj \- manipulate Tcl objects as strings.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spTcl_Obj *\fBTcl_NewStringObj\fR(\fIbytes, length\fR).sp\fBTcl_SetStringObj\fR(\fIobjPtr, bytes, length\fR).spchar *\fBTcl_GetStringFromObj\fR(\fIobjPtr, lengthPtr\fR).sp\fBTcl_AppendToObj\fR(\fIobjPtr, bytes, length\fR).sp\fBTcl_AppendStringsToObj\fR(\fIobjPtr, string, string, ... \fB(char *) NULL\fR).sp\fBTcl_SetObjLength\fR(\fIobjPtr, newLength\fR).spTcl_Obj *\fBTcl_ConcatObj\fR(\fIobjc, objv\fR).SH ARGUMENTS.AS Tcl_Interp *lengthPtr out.AP char *bytes inPoints to the first byte of an array of bytesused to set or append to a string object.This byte array may contain embedded null bytesunless \fIlength\fR is negative..AP int length inThe number of bytes to copy from \fIbytes\fR wheninitializing, setting, or appending to a string object.If negative, all bytes up to the first null are used..AP Tcl_Obj *objPtr in/outPoints to an object to manipulate..AP int *lengthPtr outIf non-NULL, the location where \fBTcl_GetStringFromObj\fR will storethe the length of an object's string representation..AP char *string inNull-terminated string value to append to \fIobjPtr\fR..AP int newLength inNew length for the string value of \fIobjPtr\fR, not including thefinal NULL character..AP int objc inThe number of elements to concatenate..AP Tcl_Obj *objv[] inThe array of objects to concatenate..BE.SH DESCRIPTION.PPThe procedures described in this manual entry allow Tcl objects tobe manipulated as string values.  They use the internal representationof the object to store additional information to make the stringmanipulations more efficient.  In particular, they make a series ofappend operations efficient by allocating extra storage space for thestring so that it doesn't have to be copied for each append..PP\fBTcl_NewStringObj\fR and \fBTcl_SetStringObj\fR create a new objector modify an existing object to hold a copy ofthe string given by \fIbytes\fR and \fIlength\fR.\fBTcl_NewStringObj\fR returns a pointer to a newly created objectwith reference count zero.Both procedures set the object to hold a copy of the specified string.\fBTcl_SetStringObj\fR frees any old string representationas well as any old internal representation of the object..PP\fBTcl_GetStringFromObj\fR returns an object's string representation.This is given by the returned byte pointerand length, which is stored in \fIlengthPtr\fR if it is non-NULL.If the object's string representation is invalid(its byte pointer is NULL),the string representation is regenerated from theobject's internal representation.The storage referenced by the returned byte pointeris owned by the object manager and should not be modified by the caller..PP\fBTcl_AppendToObj\fR appends the data given by \fIbytes\fR and\fIlength\fR to the object specified by \fIobjPtr\fR.  It does thisin a way that handles repeated calls relatively efficiently (itoverallocates the string space to avoid repeated reallocationsand copies of object's string value)..PP\fBTcl_AppendStringsToObj\fR is similar to \fBTcl_AppendToObj\fRexcept that it can be passed more than one value to append andeach value must be a null-terminated string (i.e. none of thevalues may contain internal null characters).  Any number of\fIstring\fR arguments may be provided, but the last argumentmust be a NULL pointer to indicate the end of the list..PPThe \fBTcl_SetObjLength\fR procedure changes the length of thestring value of its \fIobjPtr\fR argument.  If the \fInewLength\fRargument is greater than the space allocated for the object'sstring, then the string space is reallocated and the old valueis copied to the new space; the bytes between the old length ofthe string and the new length may have arbitrary values.If the \fInewLength\fR argument is less than the current lengthof the object's string, with \fIobjPtr->length\fR is reduced withoutreallocating the string space; the original allocated size for thestring is recorded in the object, so that the string length can beenlarged in a subsequent call to \fBTcl_SetObjLength\fR withoutreallocating storage.  In all cases \fBTcl_SetObjLength\fR leavesa null character at \fIobjPtr->bytes[newLength]\fR..PPThe \fBTcl_ConcatObj\fR function returns a new string object whosevalue is the space-separated concatenation of the stringrepresentations of all of the objects in the \fIobjv\fRarray. \fBTcl_ConcatObj\fR eliminates leading and trailing white spaceas it copies the string representations of the \fIobjv\fR array to theresult. If an element of the \fIobjv\fR array consists of nothing butwhite space, then that object is ignored entirely. This white-spaceremoval was added to make the output of the \fBconcat\fR commandcleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to anewly-created object whose ref count is zero..SH "SEE ALSO"Tcl_NewObj, Tcl_IncrRefCount, Tcl_DecrRefCount.SH KEYWORDSappend, internal representation, object, object type, string object,string type, string representation, concat, concatenate

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -