Class: DefInterp
- Inherits:
-
DefGslClass
- Object
- ErbPP
- DefModule
- DefClass
- DefGslClass
- DefInterp
- Includes:
- ErbppGsl
- Defined in:
- ext/numo/gsl/interp/parse_interp.rb
Constant Summary collapse
- INTERP_TYPES =
types.select{|s| /gsl_interp_/ =~ s}
- INTERP2D_TYPES =
types.select{|s| /gsl_interp2d_/ =~ s}
Instance Attribute Summary
Attributes inherited from ErbPP
Instance Method Summary collapse
Methods included from ErbppGsl
FM, dbl, dblp, int, intp, long, read_const, read_enum, read_eval, read_func, read_func_pattern, read_type, str, szt, sztp, tp, uint, ulong, void
Methods inherited from DefGslClass
#define_method, #to_method_name
Methods inherited from DefClass
#_mod_var, #free_func, #init_erb, #initialize, #super_class
Methods inherited from DefModule
#_mod_var, #def_id, #id_list, #init_def, #init_erb, #initialize, #method_code
Methods included from DeclMethod
#def_alias, #def_alloc_func, #def_const, #def_method, #def_module_function, #def_singleton_method, #undef_alloc_func, #undef_method, #undef_singleton_method
Methods inherited from ErbPP
#add_child, #description, #find, #find_tmpl, #get, #init_def, #initialize, #load_erb, #method_missing, #method_missing_alias, #result, #run, #set, #write
Constructor Details
This class inherits a constructor from DefClass
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ErbPP
Instance Method Details
#check_func(h) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'ext/numo/gsl/interp/parse_interp.rb', line 28 def check_func(h) if t = lookup(h) m = h[:func_name].sub(/^gsl_[^_]+_(accel_)?/,"") DefMethod.new(self, t, name:m, **h) def_type_new(h) return true end $stderr.puts "skip #{h[:func_name]}" false end |
#def_type_new(h) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'ext/numo/gsl/interp/parse_interp.rb', line 39 def def_type_new(h) case h[:func_name] when "gsl_interp_init" t = "interp_type_new" INTERP_TYPES.each do |v| st = v.sub(/^gsl_interp_/,"") DefSubclassNew.new(self, t, v, st, **h) end when "gsl_spline_init" t = "interp_type_new" INTERP_TYPES.each do |v| st = v.sub(/^gsl_interp_/,"") DefSubclassNew.new(self, t, v, st, **h) end when "gsl_interp2d_init" t = "interp2d_type_new" INTERP2D_TYPES.each do |v| st = v.sub(/^gsl_interp2d_/,"") DefSubclassNew.new(self, t, v, st, **h) end when "gsl_spline2d_init" t = "interp2d_type_new" INTERP2D_TYPES.each do |v| st = v.sub(/^gsl_interp2d_/,"") DefSubclassNew.new(self, t, v, st, **h) end end end |
#lookup(h) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'ext/numo/gsl/interp/parse_interp.rb', line 10 def lookup(h) dblbk = [dbl, /\[\]$/] case h when FM(name:/_free$/); false when FM(tp,*[dblbk]*3,szt,szt,name:/_init$/); "interp2d_new" when FM(tp,*[dblbk]*2,szt,name:/_init$/); "interp_new" when FM(name:"gsl_interp_bsearch"); "interp_bsearch" when FM(tp, type:str); "c_str_f_void" when FM(tp, type:uint); "c_uint_f_void" when FM(tp, dbl, /accel/, type:dbl); "spline_eval" when FM(tp,*[dbl]*2, /accel/, type:dbl); "spline_integ" when FM(tp,*[dbl]*2,*[/accel/]*2,type:dbl); "spline2d_eval" when FM(name:"gsl_interp_accel_alloc"); "c_new_void" when FM(tp); "c_self_f_void" end end |