Skip to content
Tcl Source Code Artifact [bcef79d4d0]
Login

Artifact [bcef79d4d0]

Artifact bcef79d4d04159ecfbf03d7457f263a592543f4e:

Wiki page [byteArray Object Type] by dkf on 2016-09-24 15:45:59.
D 2016-09-24T15:45:59.936
L byteArray\sObject\sType
P 67d1a20384ed61ea9734a63cadf088c73a241b80
U dkf
W 1285
<h1>Source Files</h1>
  *  portions of [/finfo?name=generic/tclBinary.c|tclBinary.c]

<h1>Public Interface</h1>
  *  Tcl_NewByteArrayObj
  *  Tcl_DbNewByteArrayObj
  *  Tcl_SetByteArrayObj
  *  Tcl_GetByteArrayFromObj
  *  Tcl_SetByteArrayLength

<h1>Private Interface</h1>
  *  TclAppendBytesToByteArray
  *  tclByteArrayType

<h1>Directly Depends On Public Interface Of</h1>
  *  [Tcl_Obj System]
  *  [Panic]
  *  [UTF-8 String]
  *  [Allocation]

<h1>Directly Depends On Private Interface of</h1>
  *  [Tcl_Obj System]

<h1>Discussion</h1>

The rest of the file implements the [binary] command.

The public routines have similar INT_MAX size limitations to
other parts of Tcl.

The type is implemented by a pointer in the <tt>ptr1</tt> field of the <tt>internalRep</tt>; that points to a <tt>ByteArray</tt> structure with the following declaration (NB: normative declaration is in the code).
<pre>
typedef struct ByteArray {
    int used;			/* The number of bytes used in the byte
				 * array. */
    int allocated;		/* The amount of space actually allocated
				 * minus 1 byte. */
    unsigned char bytes[];	/* The array of bytes. The actual size of this
				 * field depends on the 'allocated' field
				 * above. */
} ByteArray;
</pre>
Z 1b23d9c018dc0a8b14f2f0b96ef044a0