Class: GeneratedCode
- Inherits:
-
Struct
- Object
- Struct
- GeneratedCode
- Defined in:
- ext/generate_gvl_code.rb
Instance Attribute Summary collapse
-
#calling_fns ⇒ Object
Returns the value of attribute calling_fns.
-
#structs ⇒ Object
Returns the value of attribute structs.
-
#wrapper_fns ⇒ Object
Returns the value of attribute wrapper_fns.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*a) ⇒ GeneratedCode
constructor
A new instance of GeneratedCode.
Constructor Details
#initialize(*a) ⇒ GeneratedCode
Returns a new instance of GeneratedCode.
186 187 188 189 190 191 192 |
# File 'ext/generate_gvl_code.rb', line 186 def initialize(*a) super self.structs ||= [] self.wrapper_fns ||= [] self.calling_fns ||= [] end |
Instance Attribute Details
#calling_fns ⇒ Object
Returns the value of attribute calling_fns
185 186 187 |
# File 'ext/generate_gvl_code.rb', line 185 def calling_fns @calling_fns end |
#structs ⇒ Object
Returns the value of attribute structs
185 186 187 |
# File 'ext/generate_gvl_code.rb', line 185 def structs @structs end |
#wrapper_fns ⇒ Object
Returns the value of attribute wrapper_fns
185 186 187 |
# File 'ext/generate_gvl_code.rb', line 185 def wrapper_fns @wrapper_fns end |
Class Method Details
.from_zookeeper_h(text) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'ext/generate_gvl_code.rb', line 194 def self.from_zookeeper_h(text) new.tap do |code| while true break unless text =~ REGEXP text = $~.post_match zoo_fn_name, argstr = $1 argstr = $2 typed_args = argstr.split(',').map(&:strip) # gah, fix up functions which have a void_completion_t with no name assigned if idx = typed_args.index('void_completion_t') typed_args[idx] = 'void_completion_t completion' end struct = CallStruct.new(zoo_fn_name, typed_args) wrapper_fn = WrapperFunction.new(zoo_fn_name, struct) calling_fn = CallingFunction.new(zoo_fn_name, struct, wrapper_fn) code.structs << struct code.wrapper_fns << wrapper_fn code.calling_fns << calling_fn end end end |