Class: MilkTea::OpenGLRegistry::Generator
- Inherits:
-
Object
- Object
- MilkTea::OpenGLRegistry::Generator
- Defined in:
- lib/milk_tea/bindings/opengl_registry.rb
Constant Summary collapse
- KHRONOS_TYPE_REWRITES =
{ "khronos_float_t" => "float", "khronos_int8_t" => "int8_t", "khronos_uint8_t" => "uint8_t", "khronos_int16_t" => "int16_t", "khronos_uint16_t" => "uint16_t", "khronos_int32_t" => "int32_t", "khronos_uint32_t" => "uint32_t", "khronos_int64_t" => "int64_t", "khronos_uint64_t" => "uint64_t", "khronos_intptr_t" => "intptr_t", "khronos_ssize_t" => "ptrdiff_t", }.freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(xml_path: nil, xml_source: nil, api: DEFAULT_API, version: DEFAULT_VERSION, profile: DEFAULT_PROFILE, extensions: []) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(xml_path: nil, xml_source: nil, api: DEFAULT_API, version: DEFAULT_VERSION, profile: DEFAULT_PROFILE, extensions: []) ⇒ Generator
Returns a new instance of Generator.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/milk_tea/bindings/opengl_registry.rb', line 71 def initialize(xml_path: nil, xml_source: nil, api: DEFAULT_API, version: DEFAULT_VERSION, profile: DEFAULT_PROFILE, extensions: []) raise ArgumentError, "xml_path or xml_source is required" if xml_path.nil? && xml_source.nil? @xml_source = xml_source || File.read(xml_path) @source_label = xml_path ? File.(xml_path.to_s) : "<memory>" @api = api @version = version @profile = profile @extensions = extensions.to_set end |
Instance Method Details
#generate ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/milk_tea/bindings/opengl_registry.rb', line 82 def generate registry = parse_registry active_enums, active_commands = active_surface(registry) emit_header( types: registry.fetch(:types), enums: active_enums, commands: active_commands, ) end |