Class: MilkTea::Steamworks::Generator
- Inherits:
-
Object
- Object
- MilkTea::Steamworks::Generator
- Defined in:
- lib/milk_tea/bindings/steamworks.rb
Constant Summary collapse
- HEADER_GUARD =
"MT_LANG_STEAMWORKS_H"- MANUAL_OPAQUE_TYPES =
%w[ CCallbackBase CallbackMsg_t ISteamNetworkingConnectionSignaling ISteamNetworkingSignalingRecvContext ScePadTriggerEffectParam SteamDatagramRelayAuthTicket ].freeze
- SPECIAL_TYPE_REWRITES =
{ "CGameID" => "uint64_gameid", "CSteamID" => "uint64_steamid", "SteamInputActionEvent_t::AnalogAction_t" => "SteamInputActionEvent_t_AnalogAction_t", "SteamInputActionEvent_t::DigitalAction_t" => "SteamInputActionEvent_t_DigitalAction_t", }.freeze
- MANUAL_FUNCTION_POINTER_TYPEDEFS =
{ "SteamAPIWarningMessageHook_t" => ["void", ["int", "const char *"]], }.freeze
- MANUAL_SUPPORT_STRUCT_DEFINITIONS =
[ "typedef struct SteamInputActionEvent_t_AnalogAction_t {", " InputAnalogActionHandle_t actionHandle;", " InputAnalogActionData_t analogActionData;", "} SteamInputActionEvent_t_AnalogAction_t;", "", "typedef struct SteamInputActionEvent_t_DigitalAction_t {", " InputDigitalActionHandle_t actionHandle;", " InputDigitalActionData_t digitalActionData;", "} SteamInputActionEvent_t_DigitalAction_t;", ].freeze
- MANUAL_FUNCTIONS =
[ { return_type: "ESteamAPIInitResult", name: "SteamAPI_InitFlat", params: [{ name: "pOutErrMsg", type: "SteamErrMsg *" }] }, { return_type: "void", name: "SteamAPI_Shutdown", params: [] }, { return_type: "bool", name: "SteamAPI_RestartAppIfNecessary", params: [{ name: "unOwnAppID", type: "uint32" }] }, { return_type: "void", name: "SteamAPI_ReleaseCurrentThreadMemory", params: [] }, { return_type: "void", name: "SteamAPI_WriteMiniDump", params: [{ name: "uStructuredExceptionCode", type: "uint32" }, { name: "pvExceptionInfo", type: "void *" }, { name: "uBuildID", type: "uint32" }] }, { return_type: "void", name: "SteamAPI_SetMiniDumpComment", params: [{ name: "pchMsg", type: "const char *" }] }, { return_type: "bool", name: "SteamAPI_IsSteamRunning", params: [] }, { return_type: "const char *", name: "SteamAPI_GetSteamInstallPath", params: [] }, { return_type: "void", name: "SteamAPI_SetTryCatchCallbacks", params: [{ name: "bTryCatchCallbacks", type: "bool" }] }, { return_type: "bool", name: "SteamAPI_InitSafe", params: [] }, { return_type: "void", name: "SteamAPI_UseBreakpadCrashHandler", params: [{ name: "pchVersion", type: "const char *" }, { name: "pchDate", type: "const char *" }, { name: "pchTime", type: "const char *" }, { name: "bFullMemoryDumps", type: "bool" }, { name: "pvContext", type: "void *" }, { name: "pfnPreMinidumpCallback", type: "PFNPreMinidumpCallback" }] }, { return_type: "void", name: "SteamAPI_SetBreakpadAppID", params: [{ name: "unAppID", type: "uint32" }] }, { return_type: "void", name: "SteamAPI_ManualDispatch_Init", params: [] }, { return_type: "void", name: "SteamAPI_ManualDispatch_RunFrame", params: [{ name: "hSteamPipe", type: "HSteamPipe" }] }, { return_type: "bool", name: "SteamAPI_ManualDispatch_GetNextCallback", params: [{ name: "hSteamPipe", type: "HSteamPipe" }, { name: "pCallbackMsg", type: "CallbackMsg_t *" }] }, { return_type: "void", name: "SteamAPI_ManualDispatch_FreeLastCallback", params: [{ name: "hSteamPipe", type: "HSteamPipe" }] }, { return_type: "bool", name: "SteamAPI_ManualDispatch_GetAPICallResult", params: [{ name: "hSteamPipe", type: "HSteamPipe" }, { name: "hSteamAPICall", type: "SteamAPICall_t" }, { name: "pCallback", type: "void *" }, { name: "cubCallback", type: "int" }, { name: "iCallbackExpected", type: "int" }, { name: "pbFailed", type: "bool *" }] }, { return_type: "ESteamAPIInitResult", name: "SteamInternal_SteamAPI_Init", params: [{ name: "pszInternalCheckInterfaceVersions", type: "const char *" }, { name: "pOutErrMsg", type: "SteamErrMsg *" }] }, { return_type: "void", name: "SteamAPI_RunCallbacks", params: [] }, { return_type: "void", name: "SteamGameServer_RunCallbacks", params: [] }, { return_type: "HSteamPipe", name: "SteamAPI_GetHSteamPipe", params: [] }, { return_type: "HSteamUser", name: "SteamAPI_GetHSteamUser", params: [] }, { return_type: "HSteamPipe", name: "SteamGameServer_GetHSteamPipe", params: [] }, { return_type: "HSteamUser", name: "SteamGameServer_GetHSteamUser", params: [] }, { return_type: "void *", name: "SteamInternal_ContextInit", params: [{ name: "pContextInitData", type: "void *" }] }, { return_type: "void *", name: "SteamInternal_CreateInterface", params: [{ name: "ver", type: "const char *" }] }, { return_type: "void *", name: "SteamInternal_FindOrCreateUserInterface", params: [{ name: "hSteamUser", type: "HSteamUser" }, { name: "pszVersion", type: "const char *" }] }, { return_type: "void *", name: "SteamInternal_FindOrCreateGameServerInterface", params: [{ name: "hSteamUser", type: "HSteamUser" }, { name: "pszVersion", type: "const char *" }] }, { return_type: "void", name: "SteamAPI_RegisterCallback", params: [{ name: "pCallback", type: "CCallbackBase *" }, { name: "iCallback", type: "int" }] }, { return_type: "void", name: "SteamAPI_UnregisterCallback", params: [{ name: "pCallback", type: "CCallbackBase *" }] }, { return_type: "void", name: "SteamAPI_RegisterCallResult", params: [{ name: "pCallback", type: "CCallbackBase *" }, { name: "hAPICall", type: "SteamAPICall_t" }] }, { return_type: "void", name: "SteamAPI_UnregisterCallResult", params: [{ name: "pCallback", type: "CCallbackBase *" }, { name: "hAPICall", type: "SteamAPICall_t" }] }, { return_type: "void", name: "SteamGameServer_Shutdown", params: [] }, { return_type: "bool", name: "SteamGameServer_BSecure", params: [] }, { return_type: "uint64", name: "SteamGameServer_GetSteamID", params: [] }, { return_type: "ESteamAPIInitResult", name: "SteamInternal_GameServer_Init_V2", params: [{ name: "unIP", type: "uint32" }, { name: "usGamePort", type: "uint16" }, { name: "usQueryPort", type: "uint16" }, { name: "eServerMode", type: "EServerMode" }, { name: "pchVersionString", type: "const char *" }, { name: "pszInternalCheckInterfaceVersions", type: "const char *" }, { name: "pOutErrMsg", type: "SteamErrMsg *" }] }, ].freeze
Instance Method Summary collapse
- #all_enums ⇒ Object
- #callback_structs ⇒ Object
- #emit_accessors ⇒ Object
- #emit_constant(name:, type:, value:) ⇒ Object
- #emit_constants ⇒ Object
- #emit_enums ⇒ Object
- #emit_flat_aliases ⇒ Object
- #emit_forward_declarations ⇒ Object
- #emit_function(return_type, name, params) ⇒ Object
- #emit_generic_struct(entry) ⇒ Object
- #emit_inline_wrappers ⇒ Object
- #emit_interface_methods ⇒ Object
- #emit_manual_function_pointer_typedefs ⇒ Object
- #emit_manual_functions ⇒ Object
- #emit_steam_input_action_event_struct(entry) ⇒ Object
- #emit_struct_methods ⇒ Object
- #emit_structs ⇒ Object
- #emit_typedef(entry) ⇒ Object
- #emit_typedefs ⇒ Object
- #format_declarator(type, name) ⇒ Object
- #function_pointer_type?(source) ⇒ Boolean
- #generate ⇒ Object
-
#initialize(json_path: nil, json_source: nil, source_label: nil) ⇒ Generator
constructor
A new instance of Generator.
- #interfaces ⇒ Object
- #metadata ⇒ Object
- #normalize_function_pointer_params(source) ⇒ Object
- #normalize_type(type) ⇒ Object
- #scoped_type_rewrites ⇒ Object
- #split_array_type(source) ⇒ Object
- #structs ⇒ Object
- #typedefs ⇒ Object
Constructor Details
#initialize(json_path: nil, json_source: nil, source_label: nil) ⇒ Generator
Returns a new instance of Generator.
228 229 230 231 232 233 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 228 def initialize(json_path: nil, json_source: nil, source_label: nil) raise ArgumentError, "json_path or json_source is required" if json_path.nil? && json_source.nil? @json_source = json_source || File.read(json_path) @source_label = source_label || File.(json_path.to_s) end |
Instance Method Details
#all_enums ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 303 def all_enums @all_enums ||= begin enums = {} .fetch("enums", []).each { |entry| enums[entry.fetch("enumname")] ||= entry } [interfaces, structs, callback_structs].each do |group| group.each do |entry| Array(entry["enums"]).each do |enum_entry| enums[enum_entry.fetch("enumname")] ||= enum_entry end end end enums.values end end |
#callback_structs ⇒ Object
299 300 301 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 299 def callback_structs .fetch("callback_structs", []) end |
#emit_accessors ⇒ Object
506 507 508 509 510 511 512 513 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 506 def emit_accessors interfaces.flat_map do |entry| interface_name = entry.fetch("classname") Array(entry["accessors"]).map do |accessor| emit_function("#{interface_name} *", accessor.fetch("name_flat"), []) end end end |
#emit_constant(name:, type:, value:) ⇒ Object
493 494 495 496 497 498 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 493 def emit_constant(name:, type:, value:) normalized_type = normalize_type(type) return "static const #{normalized_type} #{name} = #{value};" if normalized_type == "float" "enum { #{name} = #{value} };" end |
#emit_constants ⇒ Object
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 466 def emit_constants lines = [] .fetch("consts", []).each do |entry| lines << emit_constant(name: entry.fetch("constname"), type: entry.fetch("consttype"), value: entry.fetch("constval")) end structs.each do |entry| Array(entry["consts"]).each do |const_entry| scoped_name = "#{entry.fetch('struct')}_#{const_entry.fetch('constname')}" lines << emit_constant(name: scoped_name, type: const_entry.fetch("consttype"), value: const_entry.fetch("constval")) end end callback_structs.each do |entry| callback_name = entry.fetch("struct") if entry["callback_id"] lines << emit_constant(name: "#{callback_name}_k_iCallback", type: "int", value: entry.fetch("callback_id").to_s) end Array(entry["consts"]).each do |const_entry| scoped_name = "#{callback_name}_#{const_entry.fetch('constname')}" lines << emit_constant(name: scoped_name, type: const_entry.fetch("consttype"), value: const_entry.fetch("constval")) end end lines end |
#emit_enums ⇒ Object
393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 393 def emit_enums all_enums.flat_map do |entry| lines = [] name = entry.fetch("enumname") lines << "typedef enum #{name} {" Array(entry.fetch("values", [])).each do |value| lines << " #{value.fetch('name')} = #{value.fetch('value')}," end lines << "} #{name};" lines << "" lines end[0..-2] || [] end |
#emit_flat_aliases ⇒ Object
386 387 388 389 390 391 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 386 def emit_flat_aliases [ "typedef uint64 uint64_steamid;", "typedef uint64 uint64_gameid;", ] end |
#emit_forward_declarations ⇒ Object
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 333 def emit_forward_declarations lines = [] opaque_types = [] opaque_types.concat(interfaces.map { |entry| entry.fetch("classname") }) opaque_types.concat(MANUAL_OPAQUE_TYPES) opaque_types.uniq.sort.each do |name| lines << "typedef struct #{name} #{name};" end record_names = structs.map { |entry| entry.fetch("struct") } + callback_structs.map { |entry| entry.fetch("struct") } record_names.uniq.sort.each do |name| lines << "typedef struct #{name} #{name};" end lines end |
#emit_function(return_type, name, params) ⇒ Object
564 565 566 567 568 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 564 def emit_function(return_type, name, params) signature = params.map { |param| format_declarator(normalize_type(param.fetch(:type)), param.fetch(:name)) } signature = ["void"] if signature.empty? "#{normalize_type(return_type)} #{name}(#{signature.join(', ')});" end |
#emit_generic_struct(entry) ⇒ Object
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 432 def emit_generic_struct(entry) name = entry.fetch("struct") return emit_steam_input_action_event_struct(entry) if name == "SteamInputActionEvent_t" fields = Array(entry.fetch("fields", [])) lines = [] lines << "struct #{name} {" if fields.empty? lines << " char _mt_dummy;" end fields.each do |field| lines << " #{format_declarator(normalize_type(field.fetch('fieldtype')), field.fetch('fieldname'))};" end lines << "};" lines end |
#emit_inline_wrappers ⇒ Object
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 537 def emit_inline_wrappers lines = [] lines << "static inline bool SteamAPI_Init(void) {" lines << " return SteamAPI_InitFlat(NULL) == k_ESteamAPIInitResult_OK;" lines << "}" lines << "" lines << "static inline void SteamGameServer_ReleaseCurrentThreadMemory(void) {" lines << " SteamAPI_ReleaseCurrentThreadMemory();" lines << "}" accessor_wrappers = interfaces.flat_map do |entry| interface_name = entry.fetch("classname") Array(entry["accessors"]).flat_map do |accessor| wrapper_name = accessor.fetch("name_flat").sub(/_v[0-9A-Za-z]+\z/, "") [ "", "static inline #{interface_name} * #{wrapper_name}(void) {", " return #{accessor.fetch('name_flat')}();", "}", ] end end lines.concat(accessor_wrappers) lines end |
#emit_interface_methods ⇒ Object
515 516 517 518 519 520 521 522 523 524 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 515 def emit_interface_methods interfaces.flat_map do |entry| interface_name = entry.fetch("classname") Array(entry.fetch("methods", [])).map do |method| params = [{ name: "self", type: "#{interface_name} *" }] params.concat(Array(method["params"]).map { |param| { name: param.fetch("paramname"), type: param["paramtype_flat"] || param.fetch("paramtype") } }) emit_function(method["returntype_flat"] || method.fetch("returntype"), method.fetch("methodname_flat"), params) end end end |
#emit_manual_function_pointer_typedefs ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 367 def emit_manual_function_pointer_typedefs lines = [] typedefs.each do |entry| next unless function_pointer_type?(entry.fetch("type")) match = entry.fetch("type").strip.match(/\A(.+?)\(\s*\*\s*\)\s*\((.*)\)\z/) return_type = normalize_type(match[1]) params = normalize_function_pointer_params(match[2]) lines << "typedef #{return_type} (*#{entry.fetch('typedef')})(#{params.join(', ')});" end MANUAL_FUNCTION_POINTER_TYPEDEFS.each do |name, (return_type, params)| lines << "typedef #{normalize_type(return_type)} (*#{name})(#{params.map { |param| normalize_type(param) }.join(', ')});" end lines end |
#emit_manual_functions ⇒ Object
500 501 502 503 504 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 500 def emit_manual_functions MANUAL_FUNCTIONS.map do |entry| emit_function(entry.fetch(:return_type), entry.fetch(:name), entry.fetch(:params)) end end |
#emit_steam_input_action_event_struct(entry) ⇒ Object
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 449 def emit_steam_input_action_event_struct(entry) fields = Array(entry.fetch("fields", [])) lines = [] lines << "struct SteamInputActionEvent_t {" fields.each do |field| next if field.fetch("fieldname") == "analogAction" lines << " #{format_declarator(normalize_type(field.fetch('fieldtype')), field.fetch('fieldname'))};" end lines << " union {" lines << " SteamInputActionEvent_t_AnalogAction_t analogAction;" lines << " SteamInputActionEvent_t_DigitalAction_t digitalAction;" lines << " };" lines << "};" lines end |
#emit_struct_methods ⇒ Object
526 527 528 529 530 531 532 533 534 535 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 526 def emit_struct_methods structs.flat_map do |entry| struct_name = entry.fetch("struct") Array(entry["methods"]).map do |method| params = [{ name: "self", type: "#{struct_name} *" }] params.concat(Array(method["params"]).map { |param| { name: param.fetch("paramname"), type: param["paramtype_flat"] || param.fetch("paramtype") } }) emit_function(method["returntype_flat"] || method.fetch("returntype"), method.fetch("methodname_flat"), params) end end end |
#emit_structs ⇒ Object
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 407 def emit_structs regular_entries = [] delayed_entries = [] (structs + callback_structs).each do |entry| if entry.fetch("struct") == "SteamInputActionEvent_t" delayed_entries << entry else regular_entries << entry end end lines = regular_entries.flat_map { |entry| emit_generic_struct(entry) + [""] } unless delayed_entries.empty? lines.concat(MANUAL_SUPPORT_STRUCT_DEFINITIONS) lines << "" delayed_entries.each do |entry| lines.concat(emit_generic_struct(entry)) lines << "" end end lines[0..-2] || [] end |
#emit_typedef(entry) ⇒ Object
354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 354 def emit_typedef(entry) name = entry.fetch("typedef") source = entry.fetch("type") return if function_pointer_type?(source) if (match = split_array_type(source)) return "typedef #{normalize_type(match[0])} #{name}[#{match[1]}];" end "typedef #{normalize_type(source)} #{name};" end |
#emit_typedefs ⇒ Object
350 351 352 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 350 def emit_typedefs typedefs.filter_map { |entry| emit_typedef(entry) } end |
#format_declarator(type, name) ⇒ Object
593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 593 def format_declarator(type, name) if (match = type.match(/\A(.+?)\(\s*\*\s*\)\s*\((.*)\)\z/)) params = normalize_function_pointer_params(match[2]).join(', ') return "#{normalize_type(match[1])} (*#{name})(#{params})" end if (match = split_array_type(type)) return "#{match[0]} #{name}[#{match[1]}]" end "#{type} #{name}" end |
#function_pointer_type?(source) ⇒ Boolean
613 614 615 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 613 def function_pointer_type?(source) source.to_s.strip.match?(/\A.+?\(\s*\*\s*\)\s*\(.*\)\z/) end |
#generate ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 235 def generate lines = [] lines << "/* generated by mtc steamworks from #{@source_label} */" lines << "#ifndef #{HEADER_GUARD}" lines << "#define #{HEADER_GUARD}" lines << "" lines << "#include <stdbool.h>" lines << "#include <stddef.h>" lines << "#include <stdint.h>" lines << "" lines << "#ifdef __cplusplus" lines << 'extern "C" {' lines << "#endif" lines << "" lines.concat(emit_forward_declarations) lines << "" unless lines.last.empty? lines.concat(emit_typedefs) lines << "" unless lines.last.empty? lines.concat(emit_flat_aliases) lines << "" unless lines.last.empty? lines.concat(emit_enums) lines << "" unless lines.last.empty? lines.concat(emit_structs) lines << "" unless lines.last.empty? lines.concat(emit_manual_function_pointer_typedefs) lines << "" unless lines.last.empty? lines.concat(emit_constants) lines << "" unless lines.last.empty? lines.concat(emit_manual_functions) lines << "" unless lines.last.empty? lines.concat(emit_accessors) lines << "" unless lines.last.empty? lines.concat(emit_interface_methods) lines << "" unless lines.last.empty? lines.concat(emit_struct_methods) lines << "" unless lines.last.empty? lines.concat(emit_inline_wrappers) lines << "" lines << "#ifdef __cplusplus" lines << "}" lines << "#endif" lines << "" lines << "#endif" lines.join("\n") + "\n" end |
#interfaces ⇒ Object
291 292 293 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 291 def interfaces .fetch("interfaces", []) end |
#metadata ⇒ Object
281 282 283 284 285 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 281 def @metadata ||= JSON.parse(@json_source) rescue JSON::ParserError => e raise Error, "failed to parse Steamworks metadata #{@source_label}: #{e.}" end |
#normalize_function_pointer_params(source) ⇒ Object
606 607 608 609 610 611 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 606 def normalize_function_pointer_params(source) params = source.strip return ["void"] if params.empty? || params == "void" params.split(/\s*,\s*/).map { |param| normalize_type(param) } end |
#normalize_type(type) ⇒ Object
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 570 def normalize_type(type) value = type.to_s.strip return value if value.empty? if (match = split_array_type(value)) return "#{normalize_type(match[0])}[#{match[1]}]" end scoped_type_rewrites.each do |source, target| value = value.gsub(source, target) end SPECIAL_TYPE_REWRITES.each do |source, target| value = value.gsub(source, target) end value = value.gsub(/\b(?:class|struct|enum)\s+/, "") value = value.gsub(/\s*&/, " *") value = value.gsub(/\s*\*\s*/, " *") value = value.gsub(/\s+/, " ").strip value end |
#scoped_type_rewrites ⇒ Object
318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 318 def scoped_type_rewrites @scoped_type_rewrites ||= begin rewrites = {} [interfaces, structs, callback_structs].each do |group| group.each do |entry| Array(entry["enums"]).each do |enum_entry| fqname = enum_entry["fqname"] rewrites[fqname] = enum_entry.fetch("enumname") if fqname end end end rewrites end end |
#split_array_type(source) ⇒ Object
617 618 619 620 621 622 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 617 def split_array_type(source) match = source.strip.match(/\A(.+?)\s*\[(.+)\]\z/) return unless match [match[1].strip, match[2].strip] end |
#structs ⇒ Object
295 296 297 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 295 def structs .fetch("structs", []) end |
#typedefs ⇒ Object
287 288 289 |
# File 'lib/milk_tea/bindings/steamworks.rb', line 287 def typedefs .fetch("typedefs", []) end |