girepository: Add Header for Version Macros

This adds a header to the girepository library, which is then included
either directly or indirectly by the other headers so that all the public
symbols (and the 2 symbols in gitypelib-internal.h used by the tools) are
decorated by a macro, that can later be used to export the symbols and also
to be used to display compile-time warnings for usage of deprecated APIs,
which is like what is now being done in GLib (and GTK+, Clutter, and so
on).

This marks the first step that we begin to stop depending on the .symbols/
.def files to export the symbols.

https://bugzilla.gnome.org/show_bug.cgi?id=732669
This commit is contained in:
Chun-wei Fan 2014-07-04 18:18:32 +08:00
parent adc6f08ff7
commit 265ea792c1
22 changed files with 505 additions and 0 deletions

View File

@ -40,17 +40,41 @@ G_BEGIN_DECLS
#define GI_IS_ARG_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ARG)
GI_AVAILABLE_IN_ALL
GIDirection g_arg_info_get_direction (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_arg_info_is_return_value (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_arg_info_is_optional (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_arg_info_is_caller_allocates (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_arg_info_may_be_null (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_arg_info_is_skip (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
GITransfer g_arg_info_get_ownership_transfer (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
GIScopeType g_arg_info_get_scope (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gint g_arg_info_get_closure (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
gint g_arg_info_get_destroy (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_arg_info_get_type (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
void g_arg_info_load_type (GIArgInfo *info,
GITypeInfo *type);
G_END_DECLS

View File

@ -66,23 +66,49 @@ typedef struct {
#define GI_TYPE_BASE_INFO (g_base_info_gtype_get_type ())
GI_AVAILABLE_IN_ALL
GType g_base_info_gtype_get_type (void) G_GNUC_CONST;
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_base_info_ref (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
void g_base_info_unref (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
GIInfoType g_base_info_get_type (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_base_info_get_name (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_base_info_get_namespace (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_base_info_is_deprecated (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_base_info_get_attribute (GIBaseInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
GIAttributeIter *iterator,
char **name,
char **value);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
GITypelib * g_base_info_get_typelib (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_base_info_equal (GIBaseInfo *info1,
GIBaseInfo *info2);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_info_new (GIInfoType type,
GIBaseInfo *container,
GITypelib *typelib,

View File

@ -43,26 +43,52 @@ G_BEGIN_DECLS
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL) || \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC))
GI_AVAILABLE_IN_1_34
gboolean g_callable_info_is_method (GICallableInfo *info);
GI_AVAILABLE_IN_1_34
gboolean g_callable_info_can_throw_gerror (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_callable_info_get_return_type (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
void g_callable_info_load_return_type (GICallableInfo *info,
GITypeInfo *type);
GI_AVAILABLE_IN_ALL
const gchar * g_callable_info_get_return_attribute (GICallableInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gboolean g_callable_info_iterate_return_attributes (GICallableInfo *info,
GIAttributeIter *iterator,
char **name,
char **value);
GI_AVAILABLE_IN_ALL
GITransfer g_callable_info_get_caller_owns (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_callable_info_may_return_null (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_callable_info_skip_return (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
gint g_callable_info_get_n_args (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
GIArgInfo * g_callable_info_get_arg (GICallableInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
void g_callable_info_load_arg (GICallableInfo *info,
gint n,
GIArgInfo *arg);
GI_AVAILABLE_IN_1_34
gboolean g_callable_info_invoke (GICallableInfo *info,
gpointer function,
const GIArgument *in_args,
@ -73,6 +99,8 @@ gboolean g_callable_info_invoke (GICallableInfo *info,
gboolean is_method,
gboolean throws,
GError **error);
GI_AVAILABLE_IN_1_42
GITransfer g_callable_info_get_instance_ownership_transfer (GICallableInfo *info);
G_END_DECLS

View File

@ -40,9 +40,15 @@ G_BEGIN_DECLS
#define GI_IS_CONSTANT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CONSTANT)
GI_AVAILABLE_IN_ALL
GITypeInfo * g_constant_info_get_type (GIConstantInfo *info);
GI_AVAILABLE_IN_ALL
void g_constant_info_free_value(GIConstantInfo *info,
GIArgument *value);
GI_AVAILABLE_IN_ALL
gint g_constant_info_get_value(GIConstantInfo *info,
GIArgument *value);
G_END_DECLS

View File

@ -50,15 +50,29 @@ G_BEGIN_DECLS
#define GI_IS_VALUE_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VALUE)
GI_AVAILABLE_IN_ALL
gint g_enum_info_get_n_values (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
GIValueInfo * g_enum_info_get_value (GIEnumInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_enum_info_get_n_methods (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_enum_info_get_method (GIEnumInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GITypeTag g_enum_info_get_storage_type (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_enum_info_get_error_domain (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
gint64 g_value_info_get_value (GIValueInfo *info);
G_END_DECLS

View File

@ -41,13 +41,25 @@ G_BEGIN_DECLS
#define GI_IS_FIELD_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FIELD)
GI_AVAILABLE_IN_ALL
GIFieldInfoFlags g_field_info_get_flags (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
gint g_field_info_get_size (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
gint g_field_info_get_offset (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_field_info_get_type (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_field_info_get_field (GIFieldInfo *field_info,
gpointer mem,
GIArgument *value);
GI_AVAILABLE_IN_ALL
gboolean g_field_info_set_field (GIFieldInfo *field_info,
gpointer mem,
const GIArgument *value);

View File

@ -40,9 +40,17 @@ G_BEGIN_DECLS
#define GI_IS_FUNCTION_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FUNCTION)
GI_AVAILABLE_IN_ALL
const gchar * g_function_info_get_symbol (GIFunctionInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
GI_AVAILABLE_IN_ALL
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
/**
@ -51,6 +59,8 @@ GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
* TODO
*/
#define G_INVOKE_ERROR (g_invoke_error_quark ())
GI_AVAILABLE_IN_ALL
GQuark g_invoke_error_quark (void);
/**
@ -72,6 +82,8 @@ typedef enum
G_INVOKE_ERROR_ARGUMENT_MISMATCH
} GInvokeError;
GI_AVAILABLE_IN_ALL
gboolean g_function_info_invoke (GIFunctionInfo *info,
const GIArgument *in_args,
int n_in_args,

View File

@ -40,31 +40,63 @@ G_BEGIN_DECLS
#define GI_IS_INTERFACE_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE)
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_interface_info_get_prerequisite (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_properties (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIPropertyInfo * g_interface_info_get_property (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_methods (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_1_34
GISignalInfo * g_interface_info_find_signal (GIInterfaceInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_interface_info_get_vfunc (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_interface_info_find_vfunc (GIInterfaceInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gint g_interface_info_get_n_constants (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * g_interface_info_get_constant (GIInterfaceInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIStructInfo * g_interface_info_get_iface_struct (GIInterfaceInfo *info);
G_END_DECLS

View File

@ -77,60 +77,126 @@ typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
#define GI_IS_OBJECT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT)
GI_AVAILABLE_IN_ALL
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_object_info_get_abstract (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_object_info_get_fundamental (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_interfaces (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIInterfaceInfo * g_object_info_get_interface (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_fields (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * g_object_info_get_field (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_properties (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIPropertyInfo * g_object_info_get_property (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_methods (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_object_info_get_method (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_object_info_find_method (GIObjectInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_object_info_find_method_using_interfaces (GIObjectInfo *info,
const gchar *name,
GIObjectInfo **implementor);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_signals (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * g_object_info_get_signal (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GISignalInfo * g_object_info_find_signal (GIObjectInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_vfuncs (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_object_info_get_vfunc (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_object_info_find_vfunc (GIObjectInfo *info,
const gchar *name);
GI_AVAILABLE_IN_1_32
GIVFuncInfo * g_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
const gchar *name,
GIObjectInfo **implementor);
GI_AVAILABLE_IN_ALL
gint g_object_info_get_n_constants (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * g_object_info_get_constant (GIObjectInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
const char * g_object_info_get_ref_function (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIObjectInfoRefFunction g_object_info_get_ref_function_pointer (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
const char * g_object_info_get_unref_function (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIObjectInfoUnrefFunction g_object_info_get_unref_function_pointer (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
const char * g_object_info_get_set_value_function (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIObjectInfoSetValueFunction g_object_info_get_set_value_function_pointer (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
const char * g_object_info_get_get_value_function (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIObjectInfoGetValueFunction g_object_info_get_get_value_function_pointer (GIObjectInfo *info);

View File

@ -40,8 +40,14 @@ G_BEGIN_DECLS
#define GI_IS_PROPERTY_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_PROPERTY)
GI_AVAILABLE_IN_ALL
GParamFlags g_property_info_get_flags (GIPropertyInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_property_info_get_type (GIPropertyInfo *info);
GI_AVAILABLE_IN_ALL
GITransfer g_property_info_get_ownership_transfer (GIPropertyInfo *info);
G_END_DECLS

View File

@ -48,8 +48,13 @@ G_BEGIN_DECLS
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION) || \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_BOXED))
GI_AVAILABLE_IN_ALL
const gchar * g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
GI_AVAILABLE_IN_ALL
const gchar * g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info);
GI_AVAILABLE_IN_ALL
GType g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
G_END_DECLS

View File

@ -45,6 +45,7 @@
#include <gitypelib.h>
#include <gitypes.h>
#include <giunioninfo.h>
#include <giversionmacros.h>
#include <givfuncinfo.h>
G_BEGIN_DECLS
@ -92,57 +93,99 @@ typedef enum
/* Repository */
GI_AVAILABLE_IN_ALL
GType g_irepository_get_type (void) G_GNUC_CONST;
GI_AVAILABLE_IN_ALL
GIRepository *g_irepository_get_default (void);
GI_AVAILABLE_IN_ALL
void g_irepository_prepend_search_path (const char *directory);
GI_AVAILABLE_IN_1_36
void g_irepository_prepend_library_path (const char *directory);
GI_AVAILABLE_IN_ALL
GSList * g_irepository_get_search_path (void);
GI_AVAILABLE_IN_ALL
const char * g_irepository_load_typelib (GIRepository *repository,
GITypelib *typelib,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_ALL
gboolean g_irepository_is_registered (GIRepository *repository,
const gchar *namespace_,
const gchar *version);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_irepository_find_by_name (GIRepository *repository,
const gchar *namespace_,
const gchar *name);
GI_AVAILABLE_IN_ALL
GList * g_irepository_enumerate_versions (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
GITypelib * g_irepository_require (GIRepository *repository,
const gchar *namespace_,
const gchar *version,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_ALL
GITypelib * g_irepository_require_private (GIRepository *repository,
const gchar *typelib_dir,
const gchar *namespace_,
const gchar *version,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_ALL
gchar ** g_irepository_get_dependencies (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
gchar ** g_irepository_get_loaded_namespaces (GIRepository *repository);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_irepository_find_by_gtype (GIRepository *repository,
GType gtype);
GI_AVAILABLE_IN_ALL
gint g_irepository_get_n_infos (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_irepository_get_info (GIRepository *repository,
const gchar *namespace_,
gint index);
GI_AVAILABLE_IN_ALL
GIEnumInfo * g_irepository_find_by_error_domain (GIRepository *repository,
GQuark domain);
GI_AVAILABLE_IN_ALL
const gchar * g_irepository_get_typelib_path (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
const gchar * g_irepository_get_shared_library (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
const gchar * g_irepository_get_c_prefix (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
const gchar * g_irepository_get_version (GIRepository *repository,
const gchar *namespace_);
GI_AVAILABLE_IN_ALL
GOptionGroup * g_irepository_get_option_group (void);
GI_AVAILABLE_IN_ALL
gboolean g_irepository_dump (const char *arg, GError **error);
/**
@ -175,11 +218,13 @@ typedef enum
*/
#define G_IREPOSITORY_ERROR (g_irepository_error_quark ())
GI_AVAILABLE_IN_ALL
GQuark g_irepository_error_quark (void);
/* Global utility functions */
GI_AVAILABLE_IN_ALL
void gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
guint n_param_values,

View File

@ -64,30 +64,38 @@ struct _GIFunctionInvoker {
*/
typedef GIArgument GIFFIReturnValue;
GI_AVAILABLE_IN_ALL
ffi_type * gi_type_tag_get_ffi_type (GITypeTag type_tag, gboolean is_pointer);
GI_AVAILABLE_IN_ALL
ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
GI_AVAILABLE_IN_1_32
void gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
GIFFIReturnValue *ffi_value,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
GIFunctionInvoker *invoker,
GError **error);
GI_AVAILABLE_IN_1_32
gboolean g_function_invoker_new_for_address (gpointer addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
GError **error);
GI_AVAILABLE_IN_ALL
void g_function_invoker_destroy (GIFunctionInvoker *invoker);
GI_AVAILABLE_IN_ALL
ffi_closure * g_callable_info_prepare_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data);
GI_AVAILABLE_IN_ALL
void g_callable_info_free_closure (GICallableInfo *callable_info,
ffi_closure *closure);

View File

@ -41,8 +41,14 @@ G_BEGIN_DECLS
#define GI_IS_SIGNAL_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL)
GI_AVAILABLE_IN_ALL
GSignalFlags g_signal_info_get_flags (GISignalInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * g_signal_info_get_class_closure (GISignalInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_signal_info_true_stops_emit (GISignalInfo *info);
G_END_DECLS

View File

@ -40,17 +40,35 @@ G_BEGIN_DECLS
#define GI_IS_STRUCT_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT)
GI_AVAILABLE_IN_ALL
gint g_struct_info_get_n_fields (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * g_struct_info_get_field (GIStructInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_struct_info_get_n_methods (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_struct_info_get_method (GIStructInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_struct_info_find_method (GIStructInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gsize g_struct_info_get_size (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
gsize g_struct_info_get_alignment (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_struct_info_is_foreign (GIStructInfo *info);
G_END_DECLS

View File

@ -48,17 +48,36 @@ G_BEGIN_DECLS
*/
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY || tag == GI_TYPE_TAG_UNICHAR)
GI_AVAILABLE_IN_ALL
const gchar* g_type_tag_to_string (GITypeTag type);
GI_AVAILABLE_IN_ALL
const gchar* g_info_type_to_string (GIInfoType type);
GI_AVAILABLE_IN_ALL
gboolean g_type_info_is_pointer (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
GITypeTag g_type_info_get_tag (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_type_info_get_param_type (GITypeInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIBaseInfo * g_type_info_get_interface (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
gint g_type_info_get_array_length (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
gint g_type_info_get_array_fixed_size(GITypeInfo *info);
GI_AVAILABLE_IN_ALL
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
G_END_DECLS

View File

@ -1217,6 +1217,8 @@ DirEntry *g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
gboolean g_typelib_matches_gtype_name_prefix (GITypelib *typelib,
const gchar *gtype_name);
GI_AVAILABLE_IN_ALL
void g_typelib_check_sanity (void);
/**
@ -1259,6 +1261,8 @@ typedef enum
GQuark g_typelib_error_quark (void);
GI_AVAILABLE_IN_ALL
gboolean g_typelib_validate (GITypelib *typelib,
GError **error);

View File

@ -29,6 +29,8 @@
#include <glib.h>
#include <giversionmacros.h>
G_BEGIN_DECLS
/**
@ -46,19 +48,29 @@ G_BEGIN_DECLS
*/
typedef struct _GITypelib GITypelib;
GI_AVAILABLE_IN_ALL
GITypelib * g_typelib_new_from_memory (guint8 *memory,
gsize len,
GError **error);
GI_AVAILABLE_IN_ALL
GITypelib * g_typelib_new_from_const_memory (const guint8 *memory,
gsize len,
GError **error);
GI_AVAILABLE_IN_ALL
GITypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile,
GError **error);
GI_AVAILABLE_IN_ALL
void g_typelib_free (GITypelib *typelib);
GI_AVAILABLE_IN_ALL
gboolean g_typelib_symbol (GITypelib *typelib,
const gchar *symbol_name,
gpointer *symbol);
GI_AVAILABLE_IN_ALL
const gchar * g_typelib_get_namespace (GITypelib *typelib);

View File

@ -27,6 +27,8 @@
#error "Only <girepository.h> can be included directly."
#endif
#include <giversionmacros.h>
G_BEGIN_DECLS
#ifndef __GTK_DOC_IGNORE__

View File

@ -40,20 +40,41 @@ G_BEGIN_DECLS
#define GI_IS_UNION_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION)
GI_AVAILABLE_IN_ALL
gint g_union_info_get_n_fields (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * g_union_info_get_field (GIUnionInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gint g_union_info_get_n_methods (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_union_info_get_method (GIUnionInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
gboolean g_union_info_is_discriminated (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
gint g_union_info_get_discriminator_offset (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * g_union_info_get_discriminator_type (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * g_union_info_get_discriminator (GIUnionInfo *info,
gint n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_union_info_find_method (GIUnionInfo *info,
const gchar *name);
GI_AVAILABLE_IN_ALL
gsize g_union_info_get_size (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
gsize g_union_info_get_alignment (GIUnionInfo *info);
G_END_DECLS

128
giversionmacros.h Normal file
View File

@ -0,0 +1,128 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
* GObject introspection: Versioning and export macros
*
* Copyright (C) 2014 Chun-wei Fan
*
* 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 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#ifndef __GIVERSIONMACROS_H__
#define __GIVERSIONMACROS_H__
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
#error "Only <girepository.h> can be included directly."
#endif
#ifndef _GI_EXTERN
#define _GI_EXTERN extern
#endif
#define GI_AVAILABLE_IN_ALL _GI_EXTERN
/* XXX: Every new stable minor release should add a set of macros here
*
* We are using the GLib versions here as the G-I minor versions
* need to be in sync with the GLib minor versions. Api's added
* at or before 1.30 are marked as GI_AVAILABLE_IN_ALL
*/
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
# define GI_DEPRECATED_IN_1_32 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_32_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_32 _GI_EXTERN
# define GI_DEPRECATED_IN_1_32_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
# define GI_AVAILABLE_IN_1_32 GLIB_UNAVAILABLE(2, 32)
#else
# define GI_AVAILABLE_IN_1_32 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
# define GI_DEPRECATED_IN_1_34 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_34_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_34 _GI_EXTERN
# define GI_DEPRECATED_IN_1_34_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
# define GI_AVAILABLE_IN_1_34 GLIB_UNAVAILABLE(2, 34)
#else
# define GI_AVAILABLE_IN_1_34 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
# define GI_DEPRECATED_IN_1_36 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_36_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_36 _GI_EXTERN
# define GI_DEPRECATED_IN_1_36_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
# define GI_AVAILABLE_IN_1_36 GLIB_UNAVAILABLE(2, 36)
#else
# define GI_AVAILABLE_IN_1_36 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
# define GI_DEPRECATED_IN_1_38 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_38_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_38 _GI_EXTERN
# define GI_DEPRECATED_IN_1_38_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
# define GI_AVAILABLE_IN_1_38 GLIB_UNAVAILABLE(2, 38)
#else
# define GI_AVAILABLE_IN_1_38 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
# define GI_DEPRECATED_IN_1_40 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_40_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_40 _GI_EXTERN
# define GI_DEPRECATED_IN_1_40_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
# define GI_AVAILABLE_IN_1_40 GLIB_UNAVAILABLE(2, 40)
#else
# define GI_AVAILABLE_IN_1_40 _GI_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
# define GI_DEPRECATED_IN_1_42 GLIB_DEPRECATED
# define GI_DEPRECATED_IN_1_42_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
# define GI_DEPRECATED_IN_1_42 _GI_EXTERN
# define GI_DEPRECATED_IN_1_42_FOR(f) _GI_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
# define GI_AVAILABLE_IN_1_42 GLIB_UNAVAILABLE(2, 42)
#else
# define GI_AVAILABLE_IN_1_42 _GI_EXTERN
#endif
#endif /* __GIVERSIONMACROS_H__ */

View File

@ -40,13 +40,24 @@ G_BEGIN_DECLS
#define GI_IS_VFUNC_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC)
GI_AVAILABLE_IN_ALL
GIVFuncInfoFlags g_vfunc_info_get_flags (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
gint g_vfunc_info_get_offset (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * g_vfunc_info_get_signal (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * g_vfunc_info_get_invoker (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
gpointer g_vfunc_info_get_address (GIVFuncInfo *info,
GType implementor_gtype,
GError **error);
GI_AVAILABLE_IN_ALL
gboolean g_vfunc_info_invoke (GIVFuncInfo *info,
GType implementor,
const GIArgument *in_args,