Compaq AA-RH99A-TE Remote Starter User Manual


 
3.2.5 Returning the Size of an Array
The array_size function returns the size of the specified array. This
function has the following syntax:
unsigned int array_size(
DataStruct sym,
char** error);
Argument Input/Output Description
sym
Input Names the array
error
Output Returns a pointer to an error message if
the return value is non-NULL
For example:
busses = read_sym("bus_list");
if((n = array_size(busses, &error)) == -1){
fprintf(stderr, "Couldnt call array_size:\n");
fprintf(stderr, "%s\n", error);
quit(1);
}
3.2.6 Casting a Pointer to a Data Structure
The cast function casts the pointer to a structure as a structure data type
and returns the structure. This function has the following syntax:
Boolean cast(
long addr,
char* type,
DataStruct* ret_type,
char** error);
Argument
Input/Output
Description
addr
Input Specifies the address of the data structure
you want returned
type
Input Specifies the datatype of the data structure
ret_type
Output Returns the name of the data structure
error
Output Returns a pointer to an error message if
the return value is FALSE
You usually use the cast function with the read_field_vals function.
Given the address of a structure, you call the cast function to convert the
pointer from the type long to the type DataStruct. Then, you pass the
result to the read_field_vals function, as its first argument, to retrieve
the values of data fields in the structure.
3–6 Writing Extensions to the kdbx Debugger