summaryrefslogtreecommitdiffstats
path: root/lib/e17/evas.rb
blob: 7a8d4888053a0b79bcb655b0c930348291dd3d3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'ffi'
#
module E17
    module EVAS
        #
        extend FFI::Library
        #
        callback :evas_async_events_put_cb, [:pointer, :int, :pointer], :void
        #
        ffi_lib 'evas'
        [
            # http://docs.enlightenment.org/auto/evas/group__Evas__Group.html
            [ :evas_init, [], :int],
            [ :evas_shutdown, [], :int],
            [ :evas_alloc_error, [], :int],
            [ :evas_async_events_fd_get, [], :int],
            [ :evas_async_events_process, [], :int],
            [ :evas_async_events_put, [:pointer, :int, :pointer, :evas_async_events_put_cb], :bool],
        ].each do |func|
            begin
                attach_function *func
            rescue Object => e
                puts "Could not attach #{func} #{e.message}"
            end
        end
        #
        ALLOC_ERROR_NONE = 0
        ALLOC_ERROR_FATAL = 1
        ALLOC_ERROR_RECOVERED = 2
        #
        class << self
            alias init evas_init
            alias shutdown evas_shutdown
            alias alloc_error evas_alloc_error
            alias async_events_fd_get evas_async_events_fd_get
            alias async_events_process evas_async_events_process
            alias async_events_put evas_async_events_put
        end
        #
    end
end
#
# EOF