@@ -422,7 +422,7 @@ fn load_register(
422
422
load_field (ctx , field_node , register_id ) catch | err | {
423
423
const reg_name = if (node .get_value ("name" )) | nm | nm else "EMPTY" ;
424
424
const field_name = if (field_node .get_value ("name" )) | nm | nm else "EMPTY" ;
425
- log .warn (" failed to load field {s}.{s}: {}" , .{ reg_name , field_name , err });
425
+ log .warn ("failed to load field {s}.{s}: {}" , .{ reg_name , field_name , err });
426
426
};
427
427
// TODO: derivision
428
428
//if (node.get_attribute("derivedFrom")) |derived_from|
@@ -490,11 +490,6 @@ fn load_enumerated_values(ctx: *Context, node: xml.Node, enum_size_bits: u8) !En
490
490
.size_bits = enum_size_bits ,
491
491
});
492
492
493
- // TODO:
494
- // - Enumerated values are allowed to have an enumeratedValue element with isDefault: true and NO value field to allow
495
- // setting a name and description for "all other" unused possible values for the bitfield
496
- // - Currently this generates an error.EnumFieldMissingValue, since there is no value field in these items
497
- // - Ultimately, this "name" and "description" belongs in a comment over the non-exhaustive enum "_" field, but unsure how to make that happen
498
493
var value_it = node .iterate (&.{}, &.{"enumeratedValue" });
499
494
while (value_it .next ()) | value_node |
500
495
try load_enumerated_value (ctx , value_node , enum_id );
@@ -515,6 +510,13 @@ fn load_enumerated_value(ctx: *Context, node: xml.Node, enum_id: EnumID) !void {
515
510
} else {
516
511
break :v try std .fmt .parseInt (u32 , value_str , 0 );
517
512
}
513
+ } else if (node .get_value ("isDefault" )) | is_default_str | {
514
+ // TODO:
515
+ // - Enumerated values are allowed to have an enumeratedValue element with isDefault: true and NO value field to allow
516
+ // setting a name and description for "all other" unused possible values for the bitfield
517
+ // - Ultimately, this "name" and "description" belongs in a comment over the non-exhaustive enum "_" field, but unsure how to make that happen
518
+ if (is_default_str .len == 0 ) return error .EnumFieldMalformed ;
519
+ if (try parse_bool (is_default_str )) return error .TodoIsDefaultEnumValue else return error .EnumFieldMalformed ;
518
520
} else {
519
521
return error .EnumFieldMissingValue ;
520
522
}
0 commit comments