/usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/2.5.0/rbgobject.h is in ruby-gnome2-dev 3.2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011-2018 Ruby-GNOME2 Project Team
* Copyright (C) 2003,2006 Ruby-GNOME2 Project Team
* Copyright (C) 2002,2003 Masahiro Sakai
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#ifndef __RBGOBJECT_H__
#define __RBGOBJECT_H__
#include <glib-object.h>
#include "ruby.h"
#include "rbglib.h"
#include "rbgutil.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* macros */
#define G_INITIALIZE(obj, cobj)\
(rbgobj_initialize_object(obj, (gpointer)cobj))
#define G_DEF_CLASS(gtype, name, module)\
(rbgobj_define_class(gtype, name, module, 0, 0, Qnil))
#define G_DEF_CLASS_WITH_GC_FUNC(gtype, name, module, mark, free) \
(rbgobj_define_class(gtype, name, module, mark, free, Qnil))
#define G_DEF_CLASS2(gtype, name, module, mark, free) \
G_DEF_CLASS_WITH_GC_FUNC(gtype, name, module, mark, free)
#define G_DEF_CLASS3(gtype_name, name, module)\
(rbgobj_define_class_dynamic(gtype_name, name, module, 0, 0))
#define G_DEF_CLASS_WITH_PARENT(gtype, name, module, parent) \
(rbgobj_define_class(gtype, name, module, 0, 0, parent))
#define G_DEF_CLASS4(gtype, name, module, parent) \
G_DEF_CLASS_WITH_PARENT(gtype, name, module, parent)
#define G_DEF_INTERFACE(gtype, name, module)\
(rbgobj_define_class(gtype, name, module, 0, 0, Qnil))
#define G_DEF_INTERFACE2(gtype, name, module, mark, free)\
(rbgobj_define_class(gtype, name, module, mark, free, Qnil))
#define RG_DEF_CONVERSION(table) (rbgobj_convert_define(table))
#define G_RELATIVE(obj, rel) (rbgobj_add_relative(obj, rel))
/* G_RELATIVE2 is useless now. Try G_CHILD_ADD/REMOVE first. */
#define G_RELATIVE2(obj, rel, id, hash_key)\
(rbgobj_add_relative_removable(obj, rel, id, hash_key))
#define G_GET_RELATIVE(obj, id, hash_key)\
(rbgobj_get_relative_removable(obj, id, hash_key))
#define G_REMOVE_RELATIVE(obj, id, hash_key)\
(rbgobj_remove_relative(obj, id, hash_key))
RUBY_GLIB2_VAR ID rbgobj_id_children;
#define G_CHILD_SET(self, id, child) (rb_ivar_set(self, id, child))
#define G_CHILD_UNSET(self, id) (rb_ivar_set(self, id, Qnil))
/* G_CHILD_ADD is same as G_RELATIVE, but the macro name is more obviously
to use than G_RELATIVE, and also support "remove" operation with the key
which is the object itself.
*/
#define G_CHILD_ADD(self, child) \
(rbgobj_add_relative_removable(self, Qnil, rbgobj_id_children, child))
#define G_CHILD_REMOVE(self, child) \
(rbgobj_remove_relative(self, rbgobj_id_children, child))
#define G_CHILD_REMOVE_ALL(self) \
(rbgobj_remove_relative_all(self, rbgobj_id_children))
#define G_DEF_SIGNAL_FUNC(klass, sig_name, func)\
(rbgobj_set_signal_func(klass, sig_name, func))
#define CLASS2CINFO(klass) (rbgobj_lookup_class(klass))
#define GTYPE2CINFO(gtype) (rbgobj_lookup_class_by_gtype(gtype, Qnil))
#define GTYPE2CINFO_NO_CREATE(gtype) (rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE))
#define RVAL2CINFO(obj) (rbgobj_lookup_class(CLASS_OF(obj)))
#define GTYPE2CLASS(gtype) (rbgobj_gtype_to_ruby_class(gtype))
#define CLASS2GTYPE(klass) (rbgobj_lookup_class(klass)->gtype)
#define RVAL2GTYPE(obj) (CLASS2GTYPE(CLASS_OF(obj)))
#define RVAL2GOBJ(obj) (rbgobj_instance_from_ruby_object(obj))
#define GOBJ2RVAL(gobj) (rbgobj_ruby_object_from_instance(gobj))
#define GOBJ2RVAL_UNREF(gobj) (rbgobj_ruby_object_from_instance_with_unref(gobj))
#define GOBJ2RVALU(gobj) GOBJ2RVAL_UNREF(gobj)
#define GVAL2RVAL(v) (rbgobj_gvalue_to_rvalue(v))
#define GVAL2RVAL_UNSET(v) (rbgobj_gvalue_to_rvalue(v))
#define RVAL2BOXED(obj, gtype) (rbgobj_boxed_get(obj, gtype))
#define BOXED2RVAL(cobj, gtype) (rbgobj_make_boxed(cobj, gtype))
#define RVAL2GENUM(obj, gtype) (rbgobj_get_enum(obj, gtype))
#define RVAL2GFLAGS(obj, gtype) (rbgobj_get_flags(obj, gtype))
#define GENUM2RVAL(n, gtype) (rbgobj_make_enum(n, gtype))
#define GFLAGS2RVAL(n, gtype) (rbgobj_make_flags(n, gtype))
#define RVAL2GPTR(object) (rbgobj_ptr2cptr(object))
#define GPTR2RVAL(ptr, gtype) (rbgobj_ptr_new(gtype, ptr))
#define G_DEF_CONSTANTS(mod, type, strip_prefix) \
rbgobj_add_constants(mod, type, strip_prefix)
#define G_RENAME_CONSTANT(orig, alt) \
rbgobj_constant_remap(orig, alt)
#define G_RENAME_NICK(orig, alt) \
rbgobj_constant_remap(orig, alt)
typedef enum
{
RBGOBJ_ABSTRACT_BUT_CREATABLE = 1 << 0, /* deprecated */
RBGOBJ_BOXED_NOT_COPY = 1 << 1,
RBGOBJ_DEFINED_BY_RUBY = 1 << 2,
} RGObjClassFlag;
typedef void (*RGMarkFunc)(gpointer object);
typedef void (*RGFreeFunc)(gpointer object);
typedef struct {
VALUE klass;
GType gtype;
RGMarkFunc mark;
RGFreeFunc free;
int flags; /* RGObjClassFlag */
gchar *name;
rb_data_type_t *data_type;
} RGObjClassInfo;
/* rbgobject.c */
extern void rbgobj_initialize_object(VALUE obj, gpointer cobj);
extern gpointer rbgobj_instance_from_ruby_object(VALUE obj);
extern VALUE rbgobj_ruby_object_from_instance(gpointer instance);
extern VALUE rbgobj_ruby_object_from_instance2(gpointer instance, gboolean alloc);
extern VALUE rbgobj_ruby_object_from_instance_with_unref(gpointer instance);
extern void rbgobj_instance_unref(gpointer instance);
extern void rbgobj_add_relative(VALUE obj, VALUE relative);
extern void rbgobj_invalidate_relatives(VALUE obj);
extern void rbgobj_add_relative_removable(VALUE obj, VALUE relative,
ID obj_ivar_id, VALUE hash_key);
extern VALUE rbgobj_get_relative_removable(VALUE obj, ID obj_ivar_id,
VALUE hash_key);
extern void rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key);
extern void rbgobj_remove_relative_all(VALUE obj, ID obj_ivar_id);
extern GObject* rbgobj_gobject_new(GType type, VALUE params_hash);
extern VALUE rbgobj_create_object(VALUE klass); /* deprecated */
extern VALUE rbgobj_get_ruby_object_from_gobject(GObject* gobj, gboolean alloc);
/* For Ruby/Gstreamer */
extern void rbgobj_gobject_initialize(VALUE obj, gpointer cobj);
/* deprecated */
extern void rbgobj_add_abstract_but_create_instance_class(GType gtype);
/* rbgobj_typeinstance.c */
extern gboolean rbgobj_gc_mark_instance(gpointer instance);
/* rbgobj_type.c */
extern const RGObjClassInfo *rbgobj_class_info_lookup(VALUE klass);
extern const RGObjClassInfo *rbgobj_class_info_lookup_by_gtype(GType gtype);
extern RGObjClassInfo *rbgobj_class_info_define(GType gtype,
const gchar *name,
VALUE module,
VALUE parent);
/* deprecated */
extern const RGObjClassInfo *rbgobj_lookup_class(VALUE klass);
/* deprecated */
extern const RGObjClassInfo *rbgobj_lookup_class_by_gtype(GType gtype, VALUE parent);
/* deprecated */
extern const RGObjClassInfo *rbgobj_lookup_class_by_gtype_full(GType gtype,
VALUE parent,
gboolean create_object);
extern VALUE rbgobj_gtype_to_ruby_class(GType gtype);
extern VALUE rbgobj_define_class(GType gtype, const gchar* name, VALUE module,
RGMarkFunc mark, RGFreeFunc free, VALUE parent);
extern VALUE rbgobj_define_class_dynamic(const gchar* gtype_name,
const gchar* name, VALUE module,
RGMarkFunc mark, RGFreeFunc free);
extern void rbgobj_register_class(VALUE klass,
GType gtype,
gboolean klass2gtype,
gboolean gtype2klass);
extern void rbgobj_register_mark_func(GType gtype, RGMarkFunc mark);
extern void rbgobj_register_free_func(GType gtype, RGFreeFunc free);
extern VALUE rbgobj_cType;
extern VALUE rbgobj_gtype_new(GType gtype);
extern GType rbgobj_gtype_get(VALUE obj);
/* rbgobj_signal.c */
typedef VALUE (*GValToRValSignalFunc)(guint num,const GValue* values);
extern void rbgobj_set_signal_func(VALUE klass, const gchar *sig_name, GValToRValSignalFunc func);
extern GValToRValSignalFunc rbgobj_get_signal_func(guint signal_id);
extern VALUE rbgobj_signal_wrap(guint sig_id);
typedef struct {
GValue *return_value;
guint n_param_values;
const GValue *param_values;
VALUE callback;
VALUE extra_args;
} RGClosureCallData;
typedef void (*RGClosureCallFunc)(RGClosureCallData *data);
extern void rbgobj_set_signal_call_func(VALUE klass,
const gchar *signal_name,
RGClosureCallFunc func);
extern RGClosureCallFunc rbgobj_get_signal_call_func(guint signal_id);
/* rbgobj_closure.c */
extern GClosure* g_rclosure_new(VALUE callback_proc, VALUE extra_args,
GValToRValSignalFunc func);
extern GClosure* g_rclosure_new_call(VALUE callback_proc,
VALUE extra_args,
RGClosureCallFunc func);
extern void g_rclosure_attach(GClosure *closure, VALUE object);
extern void g_rclosure_set_tag(GClosure *closure, const gchar *tag);
/* rbgobj_value.c */
extern VALUE rbgobj_gvalue_to_rvalue(const GValue* value);
extern VALUE rbgobj_gvalue_to_rvalue_unset(GValue *value);
extern void rbgobj_rvalue_to_gvalue(VALUE val, GValue* result);
extern void rbgobj_initialize_gvalue(GValue *result, VALUE value);
typedef void (*RValueToGValueFunc)(VALUE from, GValue* to);
typedef VALUE (*GValueToRValueFunc)(const GValue* from);
extern void rbgobj_register_r2g_func(GType gtype, RValueToGValueFunc func);
extern void rbgobj_register_g2r_func(GType gtype, GValueToRValueFunc func);
extern void rbgobj_gc_mark_gvalue(GValue* value);
/* rbgobj_valuetypes.c */
extern VALUE rbgobj_ptr_new(GType type, gpointer ptr);
extern gpointer rbgobj_ptr2cptr(VALUE ptr);
#define RBGOBJ_TYPE_RUBY_VALUE (rbgobj_ruby_value_get_type())
extern GType rbgobj_ruby_value_get_type(void);
extern VALUE g_value_get_ruby_value(const GValue* value);
extern void g_value_set_ruby_value(GValue* value, VALUE ruby);
/* rbgobj_object.c */
extern void rbgobj_register_property_setter(GType gtype, const char* prop_name, RValueToGValueFunc func);
extern void rbgobj_register_property_getter(GType gtype, const char* prop_name, GValueToRValueFunc func);
extern void rbgobj_class_init_func(gpointer g_class, gpointer class_data);
extern void rbgobj_register_type(VALUE klass, VALUE type_name, GClassInitFunc class_init);
extern VALUE rbgobj_object_alloc_func(VALUE klass);
/* rbgobj_boxed.c */
extern VALUE rbgobj_boxed_alloc_func(VALUE klass);
extern VALUE rbgobj_boxed_create(VALUE klass); /* deprecated */
extern gpointer rbgobj_boxed_get(VALUE obj, GType gtype);
extern gpointer rbgobj_boxed_get_default(VALUE obj, GType gtype);
extern VALUE rbgobj_make_boxed(gpointer data, GType gtype);
extern VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype,
VALUE klass, gint flags);
extern VALUE rbgobj_make_boxed_default(gpointer data, GType gtype);
extern void rbgobj_boxed_not_copy_obj(GType gtype);
extern void rbgobj_boxed_unown(VALUE boxed);
/* rbgobj_enums.c */
extern void rbgobj_constant_remap(const char *original, const char *replacement);
extern void rbgobj_add_constants(VALUE mod, GType type, const gchar *strip_prefix);
extern VALUE rbgobj_make_enum(gint n, GType gtype);
extern gint rbgobj_get_enum(VALUE obj, GType gtype);
extern VALUE rbgobj_make_flags(guint n, GType gtype);
extern guint rbgobj_get_flags(VALUE obj, GType gtype);
extern void rbgobj_define_const(VALUE mod, const char *name, VALUE value);
extern VALUE rbgobj_enum_alloc_func(VALUE klass);
extern VALUE rbgobj_flags_alloc_func(VALUE klass);
/* rbglib_mainloop.c */
#if !GLIB_CHECK_VERSION(2,30,0)
#define G_TYPE_MAIN_LOOP (g_main_loop_get_type())
extern GType g_main_loop_get_type(void);
#endif
/* rbglib_maincontext.c */
#if !GLIB_CHECK_VERSION(2,30,0)
#define G_TYPE_MAIN_CONTEXT (g_main_context_get_type())
#define G_TYPE_SOURCE (g_source_get_type())
extern GType g_main_context_get_type(void);
extern GType g_source_get_type(void);
#endif
#define G_TYPE_POLL_FD (g_poll_fd_get_type())
extern GType g_poll_fd_get_type(void);
/* rbglib_keyfile.c */
#if !GLIB_CHECK_VERSION(2,31,2)
#define G_TYPE_KEY_FILE (g_key_file_get_type())
extern GType g_key_file_get_type(void);
#endif
/* rbgobj_convert.c */
typedef struct {
GType type;
VALUE klass;
gpointer user_data;
GDestroyNotify notify;
VALUE (*get_superclass)(gpointer user_data);
void (*type_init_hook)(VALUE klass, gpointer user_data);
void (*rvalue2gvalue)(VALUE value, GValue *result, gpointer user_data);
VALUE (*gvalue2rvalue)(const GValue *value, gpointer user_data);
void (*initialize)(VALUE rb_instance, gpointer instance, gpointer user_data);
gpointer (*robj2instance)(VALUE rb_instance, gpointer user_data);
VALUE (*instance2robj)(gpointer instance, gpointer user_data);
void (*unref)(gpointer instance, gpointer user_data);
} RGConvertTable;
extern void rbgobj_convert_define(const RGConvertTable *table);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __RBGOBJECT_H__ */
#include "rbgcompat.h"
|