Lines Matching refs:field

301         # We don't support conditions and field having the same name.
324 for field in (f for f in self.fields if f.default is not None):
325 if field.is_builtin_type:
326 default_fields.append(" .%-35s = %6d" % (field.name, field.default))
328 if not root.is_known_enum(field.type):
332 % (field.name, field.type)
335 enum = root.get_enum(field.type)
338 value = enum.get_value(field.default)
341 % (field.default, enum.full_name, field.name))
343 default_fields.append(" .%-35s = %s" % (field.name, value.full_name))
350 for field in (f for f in self.fields if f.defines):
351 print("/* Helper macros for %s */" % field.name)
353 for define in field.defines:
435 raise ValueError("Bool field can only be 1 bit long. Field '%s'" % self.name)
463 # We override prefix so that the defines will contain the field's name too.
500 raise RuntimeError("No element can be nested in an mbo field. Element Type: %s, Field: %s"
619 raise ValueError("Duplicate field. Field: '%s'" % element.name)
703 for field in self.fields:
704 index = (start + field.start) // 32
708 clone = copy.copy(field)
713 if field.type == "address":
717 # Coalesce all the dwords covered by this field. The two cases we
719 # and address and a few bits) or where a single struct field
721 while index < (start + field.end) // 32:
761 # Special case: only one field and it's a struct at the beginning
766 field = dw.fields[0]
767 if root.is_known_struct(field.type) and field.start % 32 == 0:
770 % (self.parser.gen_prefix(safe_name(field.type)), index, field.name))
776 for field in dw.fields:
777 if root.is_known_struct(field.type):
781 % (self.parser.gen_prefix(safe_name(field.type)), index, field_index, field.name))
799 for field in dw.fields:
800 if field.type == "mbo":
802 % (field.start - dword_start, field.end - dword_start))
803 elif field.type == "address":
805 elif field.type == "uint":
807 % (field.name, field.start - dword_start, field.end - dword_start))
808 elif root.is_known_enum(field.type):
810 % (field.name, field.start - dword_start, field.end - dword_start))
811 elif field.type == "int":
813 % (field.name, field.start - dword_start, field.end - dword_start))
814 elif field.type == "bool":
816 % (field.name, field.start - dword_start, field.end - dword_start))
817 elif field.type == "float":
818 non_address_fields.append("__pvr_float(values->%s)" % field.name)
819 elif field.type == "offset":
821 % (field.name, field.start - dword_start, field.end - dword_start))
822 elif field.is_struct_type():
824 % (index, field_index, field.start - dword_start,
825 field.end - dword_start))
829 "/* unhandled field %s," " type %s */\n" % (field.name, field.type)
876 # Special case: only one field and it's a struct at the beginning
881 field = dw.fields[0]
882 if root.is_known_struct(field.type) and field.start % 32 == 0:
883 prefix = root.get_struct(field.type)
885 print(" %s_unpack(data, &dw[%d], &values->%s);" % (prefix, index, field.name))
899 for field_index, field in enumerate(f for f in dw.fields if root.is_known_struct(f.type)):
900 prefix = root.get_struct(field.type).prefix
904 % (vname, v, field.start - dword_start, field.end - dword_start))
905 print(" %s_unpack(data, &%s, &values->%s);" % (prefix, vname, field.name))
907 for field in dw.fields:
908 dword_field_start = field.start - dword_start
909 dword_field_end = field.end - dword_start
911 if field.type == "mbo" or root.is_known_struct(field.type):
913 elif field.type == "uint" or root.is_known_enum(field.type) or field.type == "bool":
915 % (field.name, v, dword_field_start, dword_field_end))
916 elif field.type == "int":
918 % (field.name, v, dword_field_start, dword_field_end))
919 elif field.type == "float":
920 print(" values->%s = __pvr_float_unpack(%s);" % (field.name, v))
921 elif field.type == "offset":
923 % (field.name, v, dword_field_start, dword_field_end))
924 elif field.type == "address":
926 % (field.name, v, field.shift, dword_field_start, dword_field_end))
928 print("/* unhandled field %s, type %s */" % (field.name, field.type))
964 elif name == "field":
973 field = Field(parent, name=attrs["name"], start=int(attrs["start"]), end=int(attrs["end"]),
975 self.context.append(field)
1027 elif name == "field":
1029 raise RuntimeError("Expected field tag to be closed.")