Lines Matching defs:type

40  * Externalized type definitions.
151 adr_type_free(adr_type_t *type)
153 if (type == NULL || !type->t_dynamic)
156 switch (type->t_type) {
158 adr_type_free(type->t_aux.t_array);
161 for (int i = 0; i < type->t_size + 1; i++) {
162 free((void *)type->t_aux.t_enum[i].ev_name);
163 adr_data_free(type->t_aux.t_enum[i].ev_data);
165 free(type->t_aux.t_enum);
168 for (int i = 0; i < type->t_size; i++) {
169 free((void *)type->t_aux.t_fields[i].sf_name);
170 adr_type_free(type->t_aux.t_fields[i].sf_type);
172 free(type->t_aux.t_fields);
176 if (type->adr_t_name != NULL)
177 free((void *)type->adr_t_name);
178 free(type);
182 adr_type_print(FILE *file, adr_type_t *type)
186 switch (type->t_type) {
189 adr_type_print(file, type->t_aux.t_array);
193 for (i = 0; i < type->t_size; i++) {
195 type->t_aux.t_fields[i].sf_name);
196 adr_type_print(file, type->t_aux.t_fields[i].sf_type);
200 (void) fprintf(file, "%s\n", adr_strtype(type->t_type));
380 " *unknown data type*\n"));
391 adr_data_verify(adr_data_t *data, adr_type_t *type, boolean_t recursive)
398 if (type != NULL && dtype != type)
709 adr_data_new_struct(adr_type_t *type)
711 assert(type->t_type == DT_STRUCT);
717 unsigned int size = type->t_size;
719 result->d_type = type;
731 adr_data_new_union_indexed(adr_type_t *type, unsigned int index,
734 assert(type->t_type == DT_UNION);
735 assert(index <= type->t_size);
738 adr_unionarm_t *ua = &type->t_aux.t_union.arms[index];
750 result->d_type = type;
758 adr_data_new_union(adr_type_t *type, adr_data_t *arm, adr_data_t *data)
760 assert(type->t_type == DT_UNION);
764 for (i = type->t_size; i > 0; i--)
765 if (type->t_aux.t_union.arms[i].ua_value == arm)
767 return (adr_data_new_union_indexed(type, i, arm, data));
771 adr_data_new_array(adr_type_t *type, unsigned int size)
773 assert(type == NULL || type->t_type == DT_ARRAY);
782 result->d_type = type;
794 adr_data_new_enum_index(adr_type_t *type, int index)
804 result->d_type = type;
810 adr_data_new_enum(adr_type_t *type, int value)
812 assert(type->t_type == DT_ENUM);
814 for (int i = 1; i < type->t_size + 1; i++) {
815 adr_enumval_t *ev = &type->t_aux.t_enum[i];
819 return (adr_data_new_enum_index(type, i));
826 adr_data_new_enum_byname(adr_type_t *type, const char *value)
828 assert(type->t_type == DT_ENUM);
830 for (int i = 0; i < type->t_size + 1; i++) {
831 adr_enumval_t *ev = &type->t_aux.t_enum[i];
840 return (adr_data_new_enum_index(type, i));
893 adr_data_get_internal(adr_data_t *data, adr_datatype_t type)
895 assert(adr_data_basetype(data) == type);
1085 path_valid(adr_type_t *type, adr_type_t *endtype, const char * const * path)
1088 if (type->t_type != DT_STRUCT)
1090 adr_structfield_t *sf = adr_type_struct_get(type, *(path++));
1093 type = sf->sf_type;
1096 return (endtype == NULL || type == endtype);
1209 adr_type_struct_get(adr_type_t *type, const char *name)
1211 assert(type->t_type == DT_STRUCT);
1213 for (int i = 0; i < type->t_size; i++) {
1214 adr_structfield_t *sf = &type->t_aux.t_fields[i];
1223 adr_type_struct_nget(adr_type_t *type, const char *name, int len)
1225 assert(type->t_type == DT_STRUCT);
1227 for (int i = 0; i < type->t_size; i++) {
1228 adr_structfield_t *sf = &type->t_aux.t_fields[i];
1237 adr_union_arm_type(adr_type_t *type, adr_data_t *arm)
1239 assert(type->t_type == DT_UNION);
1242 for (i = type->t_size; i > 0; i--)
1243 if (type->t_aux.t_union.arms[i].ua_value == arm)
1245 return (&type->t_aux.t_union.arms[i]);