/src/wrappers/glib/library/core/g_io_func.e
Specman e | 56 lines | 40 code | 15 blank | 1 comment | 0 complexity | b432210cd522d60bfe7d4c5d7e4b2716 MD5 | raw file
1class G_IO_FUNC 2 3inherit 4 C_STRUCT 5 EIFFEL_OWNED 6 7create 8 make 9 10feature {} -- Creation 11 12 make (ch: G_IO_CHANNEL; a: like action) is 13 do 14 channel := ch 15 action := a 16 allocate 17 g_io_func_closure_init (handle, to_pointer, $call) 18 end 19 20feature -- Access 21 22 function: POINTER is 23 external "C macro use <glib-callbacks.h>" 24 alias "g_io_func_closure_invoke" 25 end 26 27 data: POINTER is 28 do 29 Result := handle 30 end 31 32feature {} -- Internal 33 34 channel: G_IO_CHANNEL 35 36 action: FUNCTION [TUPLE [G_IO_CHANNEL, INTEGER], BOOLEAN] 37 38 call (ch: POINTER; condition: INTEGER): BOOLEAN is 39 do 40 -- We ignore the passed channel, it should be `channel' 41 check channel.handle = ch end 42 Result := action.item ([channel, condition]) 43 end 44 45feature {} -- Externals 46 47 struct_size: INTEGER is 48 external "C macro use <glib-callbacks.h>" 49 alias "(sizeof (struct GIOFuncClosure))" 50 end 51 52 g_io_func_closure_init (h, self, func: POINTER) is 53 external "C use <glib-callbacks.h>" 54 end 55 56end -- class G_IO_FUNC