This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| recurs_sym_type(ex::Any) = | |
| (ex==None || typeof(ex)==Symbol || length(ex.args)==1) ? eval(ex) : Expr(ex.head, ex.args[1], recurs_sym_type(ex.args[2])) | |
| macro c(ret_type, func, arg_types, lib) | |
| local _arg_types = Expr(:tuple, [recurs_sym_type(a) for a in arg_types.args]...) | |
| local _ret_type = recurs_sym_type(ret_type) | |
| local _args_in = Any[ symbol(string('a',x)) for x in 1:length(_arg_types.args) ] | |
| local _lib = eval(lib) | |
| quote | |
| $(esc(func))($(_args_in...)) = ccall( ($(string(func)), $(Expr(:quote, _lib)) ), $_ret_type, $_arg_types, $(_args_in...) ) |