diff --git a/src/api.jl b/src/api.jl index fd41d56e..e4733637 100644 --- a/src/api.jl +++ b/src/api.jl @@ -14,28 +14,34 @@ end const libopencl = "OpenCL" end -macro ocl_func(func, ret_type, arg_types) +function _ocl_func(func, ret_type, arg_types) local args_in = Symbol[symbol("arg$i::$T") for (i, T) in enumerate(arg_types.args)] esc(quote - $func($(args_in...)) = ccall(($(string(func)), libopencl), - $ret_type, - $arg_types, - $(args_in...)) + function $func($(args_in...)) + ccall(($(string(func)), libopencl), + $ret_type, + $arg_types, + $(args_in...)) + end end) end +macro ocl_func(func, ret_type, arg_types) + _ocl_func(func, ret_type, arg_types) +end + typealias CL_callback Ptr{Void} typealias CL_user_data Any -include("api/opencl_10.jl") -include("api/opencl_11.jl") -include("api/opencl_12.jl") +include("api/opencl_1.0.0.jl") +include("api/opencl_1.1.0.jl") +include("api/opencl_1.2.0.jl") function parse_version(version_string) mg = match(r"^OpenCL ([0-9]+)\.([0-9]+) .*$", version_string) if mg == nothing - error("Non conform version string: $(ver)") + error("Non conforming version string: $(ver)") end return VersionNumber(int(mg.captures[1]), int(mg.captures[2])) end diff --git a/src/api/opencl_10.jl b/src/api/opencl_1.0.0.jl similarity index 100% rename from src/api/opencl_10.jl rename to src/api/opencl_1.0.0.jl diff --git a/src/api/opencl_11.jl b/src/api/opencl_1.1.0.jl similarity index 100% rename from src/api/opencl_11.jl rename to src/api/opencl_1.1.0.jl diff --git a/src/api/opencl_12.jl b/src/api/opencl_1.2.0.jl similarity index 100% rename from src/api/opencl_12.jl rename to src/api/opencl_1.2.0.jl