class
Cradare2::DSL::Types
- Cradare2::DSL::Types
- Reference
- Object
Overview
DSL for defining, inspecting, and decoding custom binary structures using radare2's pf and type engine.
Defined in:
cradare2/dsl/types.crConstructors
Instance Method Summary
-
#define_format(name : String, format : String, field_names : Array(String) = [] of String) : self
Registers a custom print format (
pf.<name> <format> <fields...>). -
#define_struct(name : String, fields : Hash(String, String)) : self
Convenience helper to define a struct using a mapping of Field Name => Format specifier.
-
#define_struct(name : String, fields : Array(Tuple(String, String))) : self
Convenience helper to define a struct using an array of tuples ({format, field_name} or {field_name, format}).
-
#delete_format(name : String) : self
Deletes a registered format (
pf.-<name>). -
#format(name : String) : String | Nil
Returns the registered format definition for a named format, or nil if not defined (
pf.<name>). -
#parse_c_definition(c_code : String) : self
Defines a C typedef, struct, or union in radare2 (
td "<c_code>"). -
#parse_c_header(header_path : String) : self
Loads C header declarations into radare2 (
to <path>). -
#print_format(name : String, address : Address) : Hash(String, JSON::Any)
Decodes and prints formatted struct at
addressinto a structured dictionary of Field => JSON::Any (pfj.<name> @ <addr>). -
#register_godot_formats! : self
Registers all standard Godot 4.x GDExtension print formats (
pf.godot_*).
Constructor Detail
Instance Method Detail
Registers a custom print format (pf.<name> <format> <fields...>).
Format specifiers:
b: uint8, bytew: uint16, wordd: uint32, dwordq: uint64, qwordf: float (32-bit)F: double (64-bit)p: pointer (architecture bits)z: null-terminated stringx: hex pairs
Convenience helper to define a struct using a mapping of Field Name => Format specifier.
Convenience helper to define a struct using an array of tuples ({format, field_name} or {field_name, format}).
Returns the registered format definition for a named format, or nil if not defined (pf.<name>).
Defines a C typedef, struct, or union in radare2 (td "<c_code>").
Loads C header declarations into radare2 (to <path>).
Decodes and prints formatted struct at address into a structured dictionary of Field => JSON::Any (pfj.<name> @ <addr>).
Registers all standard Godot 4.x GDExtension print formats (pf.godot_*).