method
parse_struct_signature

v1_9_3_125 -
Show latest stable
-
0 notes -
Class: CParser
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
parse_struct_signature(signature, tymap=nil)
public
Hide source
# File ext/dl/lib/dl/cparser.rb, line 3 def parse_struct_signature(signature, tymap=nil) if( signature.is_a?(String) ) signature = signature.split(/\s*,\s*/) end mems = [] tys = [] signature.each{|msig| tks = msig.split(/\s+(\*)?/) ty = tks[0..-2].join(" ") member = tks[-1] case ty when /\[(\d+)\]/ n = $1.to_i ty.gsub!(/\s*\[\d+\]/,"") ty = [ty, n] when /\[\]/ ty.gsub!(/\s*\[\]/, "*") end case member when /\[(\d+)\]/ ty = [ty, $1.to_i] member.gsub!(/\s*\[\d+\]/,"") when /\[\]/ ty = ty + "*" member.gsub!(/\s*\[\]/, "") end mems.push(member) tys.push(parse_ctype(ty,tymap)) } return tys, mems end