17.2.4 struct array
Internally Pike uses a struct array to represent the type
array. As with strings, arrays are used in many different ways,
so they have many supporting functions for making them easier to manipulate.
Usually you will not have to construct array structures yourself, but it
is often nessecary to read data from arrays.
A struct array has these members:
Here is an example function which will print the type of each value in
- INT32 refs;
- The references to this array.
- INT32 size;
- The number of elements in the array.
- INT32 malloced_size;
- The number of elements there is room for in the array without re-allocating.
- TYPE_FIELD type_field;
- This bit field contains one bit for each type present in the array.
Note that bits may be set that are not present in the array, but not
vice versa. See TYPE_FIELD for more information.
- INT16 flags;
- ARRAY_* flags, you may set one or more of:
- struct svalue item[size];
- This is a variable-size array of svalues which contains the actual
values in this array.
void prtypes(struct array *a)
printf("Element %d is of type %d\n",e,a->item[e].type);