Retrieve the field names associated with a structure
String_Type[] = get_struct_field_names (Struct_Type s)
The get_struct_field_names
function returns an array of
strings whose elements specify the names of the fields of the
struct s
.
The following example illustrates how the
get_struct_field_names
function may be used to print the
value of a structure.
define print_struct (s)
{
variable names, i, num;
variable name, value;
names = get_struct_field_names (s);
% num values will be placed on stack by next call
num = _push_struct_field_values (s);
for (i = 0; i < num; i++)
{
name = names[i];
value = ();
vmessage ("s.%s = %s\n", name, string(value));
}
}
_push_struct_field_values, get_struct_field_value