gclosure.inc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // included by glib2.pas
  2. {$IFDEF read_forward_definitions}
  3. {$ENDIF read_forward_definitions}
  4. //------------------------------------------------------------------------------
  5. {$IFDEF read_interface_types}
  6. PGClosure = ^TGClosure;
  7. PGClosureNotifyData = ^TGClosureNotifyData;
  8. TGClosureNotify = procedure (data:gpointer; closure:PGClosure); cdecl;
  9. TGClosure = record
  10. flag0 : longint;
  11. marshal : procedure (closure:PGClosure; return_value:PGValue; n_param_values:guint; param_values:PGValue; invocation_hint:gpointer;
  12. marshal_data:gpointer); cdecl;
  13. data : gpointer;
  14. notifiers : PGClosureNotifyData;
  15. end;
  16. PGCClosure = ^TGCClosure;
  17. TGCClosure = record
  18. closure : TGClosure;
  19. callback : gpointer;
  20. end;
  21. TGCallBackProcedure = procedure;
  22. TGCallback = procedure (para1: TGCallBackProcedure); cdecl;
  23. TGClosureMarshal = procedure (closure:PGClosure; return_value:PGValue; n_param_values:guint; param_values:PGValue; invocation_hint:gpointer;
  24. marshal_data:gpointer); cdecl;
  25. { --- structures --- }
  26. TGClosureNotifyData = record
  27. data : gpointer;
  28. notify : TGClosureNotify;
  29. end;
  30. {$ENDIF read_interface_types}
  31. //------------------------------------------------------------------------------
  32. {$IFDEF read_interface_rest}
  33. { --- defines --- }
  34. function G_CLOSURE_NEEDS_MARSHAL(closure : Pointer) : boolean;
  35. function G_CLOSURE_N_NOTIFIERS(cl : PGClosure) : longint;
  36. function G_CCLOSURE_SWAP_DATA(cclosure : PGClosure) : longint;
  37. function G_CALLBACK(f : pointer) : TGCallback;
  38. const
  39. bm_TGClosure_ref_count = $7FFF;
  40. bp_TGClosure_ref_count = 0;
  41. bm_TGClosure_meta_marshal = $8000;
  42. bp_TGClosure_meta_marshal = 15;
  43. bm_TGClosure_n_guards = $10000;
  44. bp_TGClosure_n_guards = 16;
  45. bm_TGClosure_n_fnotifiers = $60000;
  46. bp_TGClosure_n_fnotifiers = 17;
  47. bm_TGClosure_n_inotifiers = $7F80000;
  48. bp_TGClosure_n_inotifiers = 19;
  49. bm_TGClosure_in_inotify = $8000000;
  50. bp_TGClosure_in_inotify = 27;
  51. bm_TGClosure_floating = $10000000;
  52. bp_TGClosure_floating = 28;
  53. bm_TGClosure_derivative_flag = $20000000;
  54. bp_TGClosure_derivative_flag = 29;
  55. bm_TGClosure_in_marshal = $40000000;
  56. bp_TGClosure_in_marshal = 30;
  57. bm_TGClosure_is_invalid = $80000000;
  58. bp_TGClosure_is_invalid = 31;
  59. function ref_count(var a : TGClosure) : guint;
  60. procedure set_ref_count(var a : TGClosure; __ref_count : guint);
  61. function meta_marshal(a : PGClosure) : guint;
  62. procedure set_meta_marshal(var a : TGClosure; __meta_marshal : guint);
  63. function n_guards(a : PGClosure) : guint;
  64. procedure set_n_guards(var a : TGClosure; __n_guards : guint);
  65. function n_fnotifiers(a : PGClosure) : guint;
  66. procedure set_n_fnotifiers(var a : TGClosure; __n_fnotifiers : guint);
  67. function n_inotifiers(a : PGClosure) : guint;
  68. procedure set_n_inotifiers(var a : TGClosure; __n_inotifiers : guint);
  69. function in_inotify(var a : TGClosure) : guint;
  70. procedure set_in_inotify(var a : TGClosure; __in_inotify : guint);
  71. function floating(var a : TGClosure) : guint;
  72. procedure set_floating(var a : TGClosure; __floating : guint);
  73. function derivative_flag(a : PGClosure) : guint;
  74. procedure set_derivative_flag(var a : TGClosure; __derivative_flag : guint);
  75. function in_marshal(var a : TGClosure) : guint;
  76. procedure set_in_marshal(var a : TGClosure; __in_marshal : guint);
  77. function is_invalid(var a : TGClosure) : guint;
  78. procedure set_is_invalid(var a : TGClosure; __is_invalid : guint);
  79. { closure for C function calls, callback() is the user function }
  80. { --- prototypes --- }
  81. function g_cclosure_new(callback_func:TGCallback; user_data:gpointer; destroy_data:TGClosureNotify):PGClosure; cdecl; external gliblib;
  82. function g_cclosure_new_swap(callback_func:TGCallback; user_data:gpointer; destroy_data:TGClosureNotify):PGClosure; cdecl; external gliblib;
  83. function g_signal_type_cclosure_new(itype:GType; struct_offset:guint):PGClosure; cdecl; external gliblib;
  84. { --- prototypes --- }
  85. function g_closure_ref(closure:PGClosure):PGClosure; cdecl; external gliblib;
  86. procedure g_closure_sink(closure:PGClosure); cdecl; external gliblib;
  87. procedure g_closure_unref(closure:PGClosure); cdecl; external gliblib;
  88. { intimidating }
  89. function g_closure_new_simple(sizeof_closure:guint; data:gpointer):PGClosure; cdecl; external gliblib;
  90. procedure g_closure_add_finalize_notifier(closure:PGClosure; notify_data:gpointer; notify_func:TGClosureNotify); cdecl; external gliblib;
  91. procedure g_closure_remove_finalize_notifier(closure:PGClosure; notify_data:gpointer; notify_func:TGClosureNotify); cdecl; external gliblib;
  92. procedure g_closure_add_invalidate_notifier(closure:PGClosure; notify_data:gpointer; notify_func:TGClosureNotify); cdecl; external gliblib;
  93. procedure g_closure_remove_invalidate_notifier(closure:PGClosure; notify_data:gpointer; notify_func:TGClosureNotify); cdecl; external gliblib;
  94. procedure g_closure_add_marshal_guards(closure:PGClosure; pre_marshal_data:gpointer; pre_marshal_notify:TGClosureNotify; post_marshal_data:gpointer; post_marshal_notify:TGClosureNotify); cdecl; external gliblib;
  95. procedure g_closure_set_marshal(closure:PGClosure; marshal:TGClosureMarshal); cdecl; external gliblib;
  96. procedure g_closure_set_meta_marshal(closure:PGClosure; marshal_data:gpointer; meta_marshal:TGClosureMarshal); cdecl; external gliblib;
  97. procedure g_closure_invalidate(closure:PGClosure); cdecl; external gliblib;
  98. {out }
  99. procedure g_closure_invoke(closure:PGClosure; return_value:PGValue; n_param_values:guint; param_values:PGValue; invocation_hint:gpointer); cdecl; external gliblib;
  100. { FIXME:
  101. OK: data_object::destroy -> closure_invalidate();
  102. MIS: closure_invalidate() -> disconnect(closure);
  103. MIS: disconnect(closure) -> (unlink) closure_unref();
  104. OK: closure_finalize() -> g_free (data_string);
  105. random remarks:
  106. - need marshaller repo with decent aliasing to base types
  107. - provide marshaller collection, virtually covering anything out there
  108. }
  109. {$ENDIF read_interface_rest}
  110. // included by glib2.pas