Module: Yadriggy::C
- Defined in:
- lib/yadriggy/c.rb,
lib/yadriggy/c/c.rb,
lib/yadriggy/c/ffi.rb,
lib/yadriggy/c/ctype.rb,
lib/yadriggy/c/config.rb,
lib/yadriggy/c/opencl.rb,
lib/yadriggy/c/codegen.rb,
lib/yadriggy/c/program.rb,
lib/yadriggy/c/ctypecheck.rb
Overview
C language embedded in Ruby
Defined Under Namespace
Modules: CType, Config Classes: ArrayType, BuildError, ClangTypeChecker, CodeGen, FFIArray, Float32Array, FloatArray, ForeignMethodType, IntArray, NativeMethodType, OclCodeGen, OclTypeChecker, Program, WithReturnType
Class Method Summary collapse
-
.compile(obj, lib_name = nil, dir = Config::WorkDir, module_name = nil) ⇒ Module
Compiles methods into binary code.
-
.ocl_compile(obj, lib_name = nil, dir = Config::WorkDir, module_name = nil) ⇒ Object
Compiles OpenCL methods into binary code.
-
.run(lib_name = nil, *args, dir: Config::WorkDir, &block) ⇒ Object
Compiles and runs a block.
-
.syntax ⇒ Syntax
The syntax.
Class Method Details
.compile(obj, lib_name = nil, dir = Config::WorkDir, module_name = nil) ⇒ Module
Compiles methods into binary code.
92 93 94 95 96 |
# File 'lib/yadriggy/c/c.rb', line 92 def self.compile(obj, lib_name=nil, dir=Config::WorkDir, module_name=nil) mod, funcs = compile0(obj, lib_name, dir, module_name, ClangTypeChecker, CodeGen)[0] mod end |
.ocl_compile(obj, lib_name = nil, dir = Config::WorkDir, module_name = nil) ⇒ Object
Compiles OpenCL methods into binary code.
13 14 15 16 17 18 |
# File 'lib/yadriggy/c/opencl.rb', line 13 def self.ocl_compile(obj, lib_name=nil, dir=Config::WorkDir, module_name=nil) mod, funcs = compile0(obj, lib_name, dir, module_name, OclTypeChecker, OclCodeGen) mod end |
.run(lib_name = nil, *args, dir: Config::WorkDir, &block) ⇒ Object
Compiles and runs a block.
213 214 215 216 217 218 |
# File 'lib/yadriggy/c/c.rb', line 213 def self.run(lib_name=nil, *args, dir: Config::WorkDir, &block) raise BuildError.new('no block given') if block.nil? mod, mths = compile0(block, lib_name, dir, nil, ClangTypeChecker, CodeGen) mod.method(mths[0]).call(*args) end |
.syntax ⇒ Syntax
Returns the syntax.
75 76 77 |
# File 'lib/yadriggy/c/c.rb', line 75 def self.syntax @syntax end |