本文简要介绍ruby语言中 Fiddle::CParser.parse_signature
的用法。
用法
parse_signature(signature, tymap=nil)
解析 C 原型签名
如果提供了 Hash
tymap
,则返回值和来自signature
的参数应该是键,值是要查找的C 类型。
例子:
require 'fiddle/import'
include Fiddle::CParser
#=> Object
parse_signature('double sum(double, double)')
#=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]]
parse_signature('void update(void (*cb)(int code))')
#=> ["update", Fiddle::TYPE_VOID, [Fiddle::TYPE_VOIDP]]
parse_signature('char (*getbuffer(void))[80]')
#=> ["getbuffer", Fiddle::TYPE_VOIDP, []]
相关用法
- Ruby CParser.parse_struct_signature用法及代码示例
- Ruby CParser.parse_ctype用法及代码示例
- Ruby CParser模块用法及代码示例
- Ruby CStructEntity.[]=用法及代码示例
- Ruby Context.save_history=用法及代码示例
- Ruby CSV.header_convert用法及代码示例
- Ruby Constants模块用法及代码示例
- Ruby CMath tanh()用法及代码示例
- Ruby CSV.skip_lines用法及代码示例
- Ruby CGI.new用法及代码示例
- Ruby Comparable.between?用法及代码示例
- Ruby CGI.print用法及代码示例
- Ruby CGI.http_header用法及代码示例
- Ruby Class类用法及代码示例
- Ruby CMath cos()用法及代码示例
- Ruby Complex.arg用法及代码示例
- Ruby CSV.table用法及代码示例
- Ruby CSV.force_quotes?用法及代码示例
- Ruby CSV.unconverted_fields?用法及代码示例
- Ruby ComposedSet类用法及代码示例
- Ruby C.handle_constants用法及代码示例
- Ruby Continuation类用法及代码示例
- Ruby Closure类用法及代码示例
- Ruby CStructEntity.[]用法及代码示例
- Ruby Complex.abs2用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 CParser.parse_signature。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。