/src/wrappers/glib/library/core/g_io_func.e

http://github.com/tybor/Liberty · Specman e · 56 lines · 40 code · 15 blank · 1 comment · 0 complexity · b432210cd522d60bfe7d4c5d7e4b2716 MD5 · raw file

  1. class G_IO_FUNC
  2. inherit
  3. C_STRUCT
  4. EIFFEL_OWNED
  5. create
  6. make
  7. feature {} -- Creation
  8. make (ch: G_IO_CHANNEL; a: like action) is
  9. do
  10. channel := ch
  11. action := a
  12. allocate
  13. g_io_func_closure_init (handle, to_pointer, $call)
  14. end
  15. feature -- Access
  16. function: POINTER is
  17. external "C macro use <glib-callbacks.h>"
  18. alias "g_io_func_closure_invoke"
  19. end
  20. data: POINTER is
  21. do
  22. Result := handle
  23. end
  24. feature {} -- Internal
  25. channel: G_IO_CHANNEL
  26. action: FUNCTION [TUPLE [G_IO_CHANNEL, INTEGER], BOOLEAN]
  27. call (ch: POINTER; condition: INTEGER): BOOLEAN is
  28. do
  29. -- We ignore the passed channel, it should be `channel'
  30. check channel.handle = ch end
  31. Result := action.item ([channel, condition])
  32. end
  33. feature {} -- Externals
  34. struct_size: INTEGER is
  35. external "C macro use <glib-callbacks.h>"
  36. alias "(sizeof (struct GIOFuncClosure))"
  37. end
  38. g_io_func_closure_init (h, self, func: POINTER) is
  39. external "C use <glib-callbacks.h>"
  40. end
  41. end -- class G_IO_FUNC