Lines Matching refs:field
297 def overlaps(self, field): argument
298 return self != field and max(self.start, field.start) <= min(self.end, field.end)
313 calculated = max(field.end // 8 for field in self.fields) + 1 if len(self.fields) > 0 else 0
331 for field in self.fields:
332 if field.exact is not None:
335 field.emit_template_struct(dim)
343 def __init__(self, field, path, start, end): argument
344 self.field = field
350 for field in fields:
351 field_path = '{}{}'.format(path, field.name)
352 field_offset = offset + field.start
354 if field.type in self.parser.structs:
355 sub_struct = self.parser.structs[field.type]
360 end = offset + field.end
361 all_fields.append(self.FieldRef(field, field_path, start, end))
364 for field in fields:
365 field_path = '{}{}'.format(path, field.name)
366 start = offset + field.start
368 if field.type in self.parser.structs:
369 sub_fields = self.parser.structs[field.type].fields
373 end = offset + field.end
374 contributor = self.FieldRef(field, field_path, start, end)
389 for field in self.fields:
390 if field.modifier is None:
393 assert(field.exact is None)
395 if field.modifier[0] == "shr":
396 shift = field.modifier[1]
398 print(" assert((values->{} & {}) == 0);".format(field.name, mask))
399 elif field.modifier[0] == "minus":
400 print(" assert(values->{} >= {});".format(field.name, field.modifier[1]))
401 elif field.modifier[0] == "log2":
402 print(" assert(util_is_power_of_two_nonzero(values->{}));".format(field.name))
418 field = contributor.field
419 name = field.name
426 … value = str(field.exact) if field.exact is not None else "values->{}".format(contributor.path)
427 if field.modifier is not None:
428 if field.modifier[0] == "shr":
429 value = "{} >> {}".format(value, field.modifier[1])
430 elif field.modifier[0] == "minus":
431 value = "{} - {}".format(value, field.modifier[1])
432 elif field.modifier[0] == "align":
433 value = "ALIGN_POT({}, {})".format(value, field.modifier[1])
434 elif field.modifier[0] == "log2":
437 if field.type in ["uint", "hex", "Pixel Format", "address"]:
440 elif field.type in self.parser.enums:
443 elif field.type == "int":
446 elif field.type == "bool":
449 elif field.type == "float":
452 elif field.type == "lod":
456 s = "#error unhandled field {}, type {}".format(contributor.path, field.type)
503 field = fieldref.field
511 …if field.type in set(["uint", "uint/float", "address", "Pixel Format", "hex"]) | self.parser.enums:
513 elif field.type == "int":
515 elif field.type == "bool":
517 elif field.type == "float":
519 elif field.type == "lod":
522 s = "/* unhandled field %s, type %s */\n" % (field.name, field.type)
526 if field.modifier:
527 if field.modifier[0] == "minus":
528 suffix = " + {}".format(field.modifier[1])
529 elif field.modifier[0] == "shr":
530 suffix = " << {}".format(field.modifier[1])
531 if field.modifier[0] == "log2":
534 if field.type in self.parser.enums:
540 if field.modifier and field.modifier[0] == "align":
541 mask = hex(field.modifier[1] - 1)
545 for field in self.fields:
547 name, val = field.human_name, 'values->{}'.format(field.name)
549 if field.type in self.parser.structs:
550 pack_name = self.parser.gen_prefix(safe_name(field.type)).upper()
551 print(' fprintf(fp, "%*s{}:\\n", indent, "");'.format(field.human_name))
552 print(" {}_print(fp, &values->{}, indent + 2);".format(pack_name, field.name))
553 elif field.type == "address":
556 elif field.type in self.parser.enums:
557 print(' if ({}_as_str({}))'.format(enum_name(field.type), val))
558 … fprintf(fp, "%*s{}: %s\\n", indent, "", {}_as_str({}));'.format(name, enum_name(field.type), val))
561 elif field.type == "int":
563 elif field.type == "bool":
565 elif field.type in ["float", "lod"]:
567 elif field.type in ["uint", "hex"] and (field.end - field.start) >= 32:
569 elif field.type == "hex":
571 elif field.type in "Pixel Format":
573 elif field.type == "uint/float":
640 for field in self.group.fields:
641 if not type(field) is Field:
643 if field.default is not None:
644 default_fields.append(" .{} = {}".format(field.name, field.default))
645 elif field.type in self.structs:
646 …efault_fields.append(" .{} = {{ {}_header }}".format(field.name, self.gen_prefix(safe_name(field…