gen_ze_bindings.rb 619 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_relative 'gen_ze_library_base.rb'


puts <<EOF
require_relative 'ze_library.rb'
require_relative 'ze_refinements.rb'
require_relative 'ze_bindings_base.rb'

module ZE

EOF

$all_funcs.each { |f|
  type, params = f.type.to_ffi
  puts <<EOF
  attach_function #{to_ffi_name(f.name)},
Brice Videau's avatar
Brice Videau committed
17
                  [ #{params.join(",\n"+" "*20)} ],
18
19
20
21
22
23
                  #{type}

EOF
}

puts <<EOF
24
25
26
27
28
29
30
31
32
33
34
35
  ZE.init

  at_exit {
    ZE::ZE_OBJECTS_MUTEX.synchronize {
      ZE::ZE_OBJECTS.to_a.reverse.each do |h, d|
        result = method(d).call(h)
        ZE.error_check(result)
      end
      ZE::ZE_OBJECTS.clear
    }
  }

36
37
end
EOF