diff options
Diffstat (limited to 'glib/src')
54 files changed, 15106 insertions, 1049 deletions
diff --git a/glib/src/binding.ccg b/glib/src/binding.ccg index c9e839b7..29d69ec7 100644 --- a/glib/src/binding.ccg +++ b/glib/src/binding.ccg @@ -22,25 +22,24 @@ namespace struct BindingTransformSlots { BindingTransformSlots( - const Glib::Binding::BindingTransformSlot& transform_to, - const Glib::Binding::BindingTransformSlot& transform_from) + const Glib::Binding::SlotTransform& transform_to, + const Glib::Binding::SlotTransform& transform_from) : from_source_to_target(transform_to), from_target_to_source(transform_from) {} - Glib::Binding::BindingTransformSlot from_source_to_target; - Glib::Binding::BindingTransformSlot from_target_to_source; + Glib::Binding::SlotTransform from_source_to_target; + Glib::Binding::SlotTransform from_target_to_source; }; -gboolean Binding_transform_callback_common(GBinding* binding, +gboolean Binding_transform_callback_common( const GValue* from_value, GValue* to_value, - Glib::Binding::BindingTransformSlot& the_slot) + Glib::Binding::SlotTransform& the_slot) { bool result = false; try { - Glib::RefPtr<Glib::Binding> cpp_binding = Glib::wrap(binding, true); - result = the_slot(cpp_binding, from_value, to_value); + result = the_slot(from_value, to_value); } catch (...) { @@ -49,22 +48,22 @@ gboolean Binding_transform_callback_common(GBinding* binding, return result; } -gboolean Binding_transform_to_callback(GBinding* binding, +gboolean Binding_transform_to_callback(GBinding*, const GValue* from_value, GValue* to_value, gpointer user_data) { - Glib::Binding::BindingTransformSlot& the_slot = + Glib::Binding::SlotTransform& the_slot = static_cast<BindingTransformSlots*>(user_data)->from_source_to_target; - return Binding_transform_callback_common(binding, from_value, to_value, the_slot); + return Binding_transform_callback_common(from_value, to_value, the_slot); } -gboolean Binding_transform_from_callback(GBinding* binding, +gboolean Binding_transform_from_callback(GBinding*, const GValue* from_value, GValue* to_value, gpointer user_data) { - Glib::Binding::BindingTransformSlot& the_slot = + Glib::Binding::SlotTransform& the_slot = static_cast<BindingTransformSlots*>(user_data)->from_target_to_source; - return Binding_transform_callback_common(binding, from_value, to_value, the_slot); + return Binding_transform_callback_common(from_value, to_value, the_slot); } void Binding_transform_callback_destroy(gpointer user_data) @@ -81,10 +80,10 @@ Glib::RefPtr<Binding> Binding::bind_property_value( const PropertyProxy_Base& source_property, const PropertyProxy_Base& target_property, BindingFlags flags, - const BindingTransformSlot& transform_to, - const BindingTransformSlot& transform_from) + const SlotTransform& transform_to, + const SlotTransform& transform_from) { - GBinding* binding = 0; + GBinding* binding = nullptr; if (transform_to.empty() && transform_from.empty()) { // No user-supplied transformations. diff --git a/glib/src/binding.hg b/glib/src/binding.hg index f7760376..5b5dd4bc 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -24,7 +24,7 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Glib { -_WRAP_ENUM(BindingFlags, GBindingFlags) +_WRAP_ENUM(BindingFlags, GBindingFlags, newin "2,44") /** Bind two object properties. * @@ -57,10 +57,8 @@ _WRAP_ENUM(BindingFlags, GBindingFlags) * applying it; for instance, the following binding: * * @code - * bool celsius_to_fahrenheit(const Glib::RefPtr<Glib::Binding>& binding, - * const double& celsius, double& fahrenheit); - * bool fahrenheit_to_celsius(const Glib::RefPtr<Glib::Binding>& binding, - * const double& fahrenheit, double& celsius); + * bool celsius_to_fahrenheit(const double& celsius, double& fahrenheit); + * bool fahrenheit_to_celsius(const double& fahrenheit, double& celsius); * Glib::Binding::bind_property(adjustment1->property_value(), * adjustment2->property_value(), Glib::BINDING_BIDIRECTIONAL, * sigc::ptr_fun(celsius_to_fahrenheit), sigc::ptr_fun(fahrenheit_to_celsius)); @@ -104,11 +102,11 @@ class Binding : public Glib::Object public: /** For instance,<br> - * bool on_transform_to(const Glib::RefPtr<Binding>& binding, const GValue* from_value, GValue* to_value); + * bool on_transform_to(const GValue* from_value, GValue* to_value); * * @return <tt>true</tt> if the transformation was successful, and <tt>false</tt> otherwise. */ - typedef sigc::slot<bool, const Glib::RefPtr<Binding>&, const GValue*, GValue*> BindingTransformSlot; + typedef sigc::slot<bool, const GValue*, GValue*> SlotTransform; /** Creates a binding between @a source_property and @a target_property, * allowing you to set the transformation functions to be used by the binding. @@ -143,8 +141,8 @@ public: const PropertyProxy_Base& source_property, const PropertyProxy_Base& target_property, BindingFlags flags = BINDING_DEFAULT, - const BindingTransformSlot& transform_to = BindingTransformSlot(), - const BindingTransformSlot& transform_from = BindingTransformSlot()); + const SlotTransform& transform_to = SlotTransform(), + const SlotTransform& transform_from = SlotTransform()); _IGNORE(g_object_bind_property, g_object_bind_property_full, g_object_bind_property_with_closures) @@ -185,7 +183,7 @@ public: * stored in a Glib::Value<T_target> object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>. + * sigc::slot<bool, const T_source&, T_target&>. * * @see bind_property_value() * @@ -198,10 +196,10 @@ public: BindingFlags flags, const T_functor_to& transform_to) { - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to; + sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, - slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to)); + slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to)); } /** Creates a binding between @a source_property and @a target_property, @@ -221,7 +219,7 @@ public: * stored in a Glib::Value<T_target> object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>. + * sigc::slot<bool, const T_source&, T_target&>. * * @see bind_property_value() * @@ -234,10 +232,10 @@ public: BindingFlags flags, const T_functor_to& transform_to) { - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to; + sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, - slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to)); + slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to)); } /** Creates a binding between @a source_property and @a target_property, @@ -257,7 +255,7 @@ public: * stored in a Glib::Value<T_target> object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>. + * sigc::slot<bool, const T_source&, T_target&>. * * @see bind_property_value() * @@ -270,10 +268,10 @@ public: BindingFlags flags, const T_functor_to& transform_to) { - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to; + sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, - slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to)); + slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to)); } /** Creates a binding between @a source_property and @a target_property, @@ -293,7 +291,7 @@ public: * stored in a Glib::Value<T_target> object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>. + * sigc::slot<bool, const T_source&, T_target&>. * * @see bind_property_value() * @@ -306,10 +304,10 @@ public: BindingFlags flags, const T_functor_to& transform_to) { - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to; + sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, - slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to)); + slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to)); } /** Creates a binding between @a source_property and @a target_property, @@ -331,10 +329,10 @@ public: * stored in a Glib::Value<T_target> object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&>. + * sigc::slot<bool, const T_source&, T_target&>. * @tparam T_functor_from Type of functor that translates from the target to the source. * Must be convertible to<br> - * sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_target&, T_source&>. + * sigc::slot<bool, const T_target&, T_source&>. * * @see bind_property_value() * @@ -348,21 +346,21 @@ public: const T_functor_to& transform_to, const T_functor_from& transform_from) { - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_source&, T_target&> slot_transform_to = transform_to; - sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_target&, T_source&> slot_transform_from = transform_from; + sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to; + sigc::slot<bool, const T_target&, T_source&> slot_transform_from = transform_from; return bind_property_value(source_property, target_property, flags, - slot_transform_to.empty() ? BindingTransformSlot() : TransformProp<T_source, T_target>(slot_transform_to), - slot_transform_from.empty() ? BindingTransformSlot() : TransformProp<T_target, T_source>(slot_transform_from)); + slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to), + slot_transform_from.empty() ? SlotTransform() : TransformProp<T_target, T_source>(slot_transform_from)); } - _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_source(), g_binding_get_source, refreturn) - _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_source() const, g_binding_get_source, refreturn, constversion) - _WRAP_METHOD(Glib::ustring get_source_property() const, g_binding_get_source_property) - _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_target(), g_binding_get_target, refreturn) - _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_target() const, g_binding_get_target, refreturn, constversion) - _WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property) - _WRAP_METHOD(BindingFlags get_flags() const, g_binding_get_flags) + _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_source(), g_binding_get_source, refreturn, newin "2,44") + _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_source() const, g_binding_get_source, refreturn, constversion, newin "2,44") + _WRAP_METHOD(Glib::ustring get_source_property() const, g_binding_get_source_property, newin "2,44") + _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_target(), g_binding_get_target, refreturn, newin "2,44") + _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_target() const, g_binding_get_target, refreturn, constversion, newin "2,44") + _WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property, newin "2,44") + _WRAP_METHOD(BindingFlags get_flags() const, g_binding_get_flags, newin "2,44") /** Explicitly releases the binding between the source and the target * property expressed by this Binding instance. @@ -376,32 +374,32 @@ public: void unbind(); _IGNORE(g_binding_unbind) - _WRAP_PROPERTY("flags", Glib::BindingFlags) - _WRAP_PROPERTY("source", Glib::RefPtr<Glib::ObjectBase>) - _WRAP_PROPERTY("source-property", Glib::ustring) - _WRAP_PROPERTY("target", Glib::RefPtr<Glib::ObjectBase>) - _WRAP_PROPERTY("target-property", Glib::ustring) + _WRAP_PROPERTY("flags", Glib::BindingFlags, newin "2,44") + _WRAP_PROPERTY("source", Glib::RefPtr<Glib::ObjectBase>, newin "2,44") + _WRAP_PROPERTY("source-property", Glib::ustring, newin "2,44") + _WRAP_PROPERTY("target", Glib::RefPtr<Glib::ObjectBase>, newin "2,44") + _WRAP_PROPERTY("target-property", Glib::ustring, newin "2,44") #ifndef DOXYGEN_SHOULD_SKIP_THIS /** Decrement the reference count for this object. * You should never need to do this manually - use the object via a RefPtr instead. */ - virtual void unreference() const; + void unreference() const override; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ private: - // The functor TransformProp can be implicitly converted to a BindingTransformSlot + // The functor TransformProp can be implicitly converted to a SlotTransform // and used in a call to bind_property_value(). template <typename T_from, typename T_to> class TransformProp : public sigc::functor_base { public: typedef bool result_type; - typedef sigc::slot<bool, const Glib::RefPtr<Binding>&, const T_from&, T_to&> TypedBindingTransformSlot; + typedef sigc::slot<bool, const T_from&, T_to&> SlotTypedTransform; - TransformProp(const TypedBindingTransformSlot& slot) : typed_transform(slot) {} + TransformProp(const SlotTypedTransform& slot) : typed_transform(slot) {} - bool operator()(const Glib::RefPtr<Binding>& binding, const GValue* from_value, GValue* to_value) + bool operator()(const GValue* from_value, GValue* to_value) { Glib::Value<T_from> from_glib_value; from_glib_value.init(from_value); @@ -409,14 +407,14 @@ private: to_glib_value.init(to_value); T_to to = to_glib_value.get(); - const bool result = typed_transform(binding, from_glib_value.get(), to); + const bool result = typed_transform(from_glib_value.get(), to); to_glib_value.set(to); g_value_copy(to_glib_value.gobj(), to_value); return result; } private: - TypedBindingTransformSlot typed_transform; + SlotTypedTransform typed_transform; }; }; diff --git a/glib/src/checksum.ccg b/glib/src/checksum.ccg index efa0d724..9a700501 100644 --- a/glib/src/checksum.ccg +++ b/glib/src/checksum.ccg @@ -28,7 +28,7 @@ Checksum::Checksum(ChecksumType type) Checksum::operator bool() const { - return gobject_ != 0; + return gobject_ != nullptr; } gssize Checksum::get_length(ChecksumType checksum_type) diff --git a/glib/src/convert.ccg b/glib/src/convert.ccg index 295088b1..e7523139 100644 --- a/glib/src/convert.ccg +++ b/glib/src/convert.ccg @@ -35,7 +35,7 @@ IConv::IConv(const std::string& to_codeset, const std::string& from_codeset) { if(gobject_ == reinterpret_cast<GIConv>(-1)) { - GError* gerror = 0; + GError* gerror = nullptr; // Abuse g_convert() to create a GError object. This may seem a weird // thing to do, but it gives us consistently translated error messages @@ -43,7 +43,7 @@ IConv::IConv(const std::string& to_codeset, const std::string& from_codeset) g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &gerror); // If this should ever fail we're fucked. - g_assert(gerror != 0); + g_assert(gerror != nullptr); if(gerror) ::Glib::Error::throw_exception(gerror); } @@ -70,7 +70,7 @@ void IConv::reset() // NULL for anything but inbuf; work around that. (NULL outbuf // or NULL *outbuf is allowed by Unix98.) - char* outbuf = 0; + char* outbuf = nullptr; gsize inbytes_left = 0; gsize outbytes_left = 0; @@ -80,7 +80,7 @@ void IConv::reset() std::string IConv::convert(const std::string& str) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_convert_with_iconv( str.data(), str.size(), gobject_, 0, &bytes_written, &gerror); @@ -100,7 +100,7 @@ bool get_charset() bool get_charset(std::string& charset) { - const char* charset_cstr = 0; + const char* charset_cstr = nullptr; const bool is_utf8 = g_get_charset(&charset_cstr); charset = charset_cstr; @@ -113,7 +113,7 @@ std::string convert(const std::string& str, const std::string& from_codeset) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_convert( str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), @@ -163,7 +163,7 @@ std::string convert_with_fallback(const std::string& str, Glib::ustring locale_to_utf8(const std::string& opsys_string) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_locale_to_utf8( opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror); @@ -178,7 +178,7 @@ Glib::ustring locale_to_utf8(const std::string& opsys_string) std::string locale_from_utf8(const Glib::ustring& utf8_string) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_locale_from_utf8( utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror); @@ -192,7 +192,7 @@ std::string locale_from_utf8(const Glib::ustring& utf8_string) Glib::ustring filename_to_utf8(const std::string& opsys_string) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_filename_to_utf8( opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror); @@ -207,7 +207,7 @@ Glib::ustring filename_to_utf8(const std::string& opsys_string) std::string filename_from_utf8(const Glib::ustring& utf8_string) { gsize bytes_written = 0; - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_filename_from_utf8( utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror); @@ -220,8 +220,8 @@ std::string filename_from_utf8(const Glib::ustring& utf8_string) std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname) { - char* hostname_buf = 0; - GError* gerror = 0; + char* hostname_buf = nullptr; + GError* gerror = nullptr; char *const buf = g_filename_from_uri(uri.c_str(), &hostname_buf, &gerror); @@ -241,7 +241,7 @@ std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname) std::string filename_from_uri(const Glib::ustring& uri) { - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_filename_from_uri(uri.c_str(), 0, &gerror); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -252,7 +252,7 @@ std::string filename_from_uri(const Glib::ustring& uri) Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname) { - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &gerror); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -263,7 +263,7 @@ Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& Glib::ustring filename_to_uri(const std::string& filename) { - GError* gerror = 0; + GError* gerror = nullptr; char *const buf = g_filename_to_uri(filename.c_str(), 0, &gerror); if(gerror) ::Glib::Error::throw_exception(gerror); diff --git a/glib/src/date.ccg b/glib/src/date.ccg index bc7590c0..ad6b6ef0 100644 --- a/glib/src/date.ccg +++ b/glib/src/date.ccg @@ -305,7 +305,7 @@ Glib::ustring Date::format_string(const Glib::ustring& format) const struct tm tm_data; g_date_to_struct_tm(&gobject_, &tm_data); - const std::string locale_format = locale_from_utf8(format); + const auto locale_format = locale_from_utf8(format); gsize bufsize = std::max<gsize>(2 * locale_format.size(), 128); @@ -316,7 +316,7 @@ Glib::ustring Date::format_string(const Glib::ustring& format) const // Set the first byte to something other than '\0', to be able to // recognize whether strftime actually failed or just returned "". buf.get()[0] = '\1'; - const gsize len = strftime(buf.get(), bufsize, locale_format.c_str(), &tm_data); + const auto len = strftime(buf.get(), bufsize, locale_format.c_str(), &tm_data); if(len != 0 || buf.get()[0] == '\0') { diff --git a/glib/src/date.hg b/glib/src/date.hg index 472dc609..5a307e61 100644 --- a/glib/src/date.hg +++ b/glib/src/date.hg @@ -17,12 +17,6 @@ _DEFS(glibmm,glib) -#m4 _PUSH(SECTION_CC_PRE_INCLUDES) -/* So we can use deprecated functions in our deprecated methods */ -#undef G_DISABLE_DEPRECATED -#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 -#m4 _POP() - #include <glibmmconfig.h> #include <glibmm/ustring.h> #include <glib.h> diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg index 601d9770..82bcd56f 100644 --- a/glib/src/datetime.hg +++ b/glib/src/datetime.hg @@ -95,6 +95,7 @@ public: * TimeSpan that is returned is effectively @a *this - @a other. * * @newin{2,26} + * * @param other The other DateTime. * @return The difference between the two DateTime, as a time * span expressed in microseconds. @@ -106,6 +107,7 @@ public: * as a CompareFunc. * * @newin{2,26} + * * @param other The DateTime to compare with. * @return -1, 0 or 1 if @a *this is less than, equal to or greater * than @a other. @@ -120,6 +122,7 @@ public: * them to the same time zone. * * @newin{2,26} + * * @param other The DateTime to compare with. * @return <tt>true</tt> if @a *this and @a other are equal. */ @@ -146,7 +149,7 @@ public: _WRAP_METHOD(DateTime to_timezone(const TimeZone& tz) const, g_date_time_to_timezone) _WRAP_METHOD(DateTime to_local() const, g_date_time_to_local) _WRAP_METHOD(DateTime to_utc() const, g_date_time_to_utc) - _WRAP_METHOD(Glib::ustring format(const Glib::ustring& format) const, g_date_time_format) + _WRAP_METHOD(Glib::ustring format(const Glib::ustring& format_str) const, g_date_time_format) }; } // namespace Glib diff --git a/glib/src/filelist.am b/glib/src/filelist.am index c66e01b0..94341328 100644 --- a/glib/src/filelist.am +++ b/glib/src/filelist.am @@ -3,13 +3,11 @@ glibmm_files_defs = \ glib.defs \ glib_enums.defs \ - glib_deprecated_enums.defs \ glib_functions.defs \ glib_extra_objects.defs \ glib_signals.defs \ gmodule_enums.defs \ gmodule_functions.defs \ - gobject.defs \ gobject_enums.defs \ gobject_functions.defs \ glib_docs.xml \ @@ -28,6 +26,7 @@ glibmm_files_any_hg = \ iochannel.hg \ keyfile.hg \ markup.hg \ + miscutils.hg \ module.hg \ nodetree.hg \ optioncontext.hg \ diff --git a/glib/src/fileutils.ccg b/glib/src/fileutils.ccg index 59fe145c..43dc1857 100644 --- a/glib/src/fileutils.ccg +++ b/glib/src/fileutils.ccg @@ -26,7 +26,7 @@ namespace Glib Dir::Dir(const std::string& path) { - GError* error = 0; + GError* error = nullptr; gobject_ = g_dir_open(path.c_str(), 0, &error); if(error) @@ -60,7 +60,7 @@ void Dir::close() if(gobject_) { g_dir_close(gobject_); - gobject_ = 0; + gobject_ = nullptr; } } @@ -125,7 +125,7 @@ bool file_test(const std::string& filename, FileTest test) int mkstemp(std::string& filename_template) { const ScopedPtr<char> buf (g_strndup(filename_template.data(), filename_template.size())); - const int fileno = g_mkstemp(buf.get()); + const auto fileno = g_mkstemp(buf.get()); filename_template = buf.get(); return fileno; @@ -136,10 +136,10 @@ int file_open_tmp(std::string& name_used, const std::string& prefix) std::string basename_template (prefix); basename_template += "XXXXXX"; // this sillyness shouldn't be in the interface - GError* error = 0; + GError* error = nullptr; ScopedPtr<char> buf_name_used; - const int fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error); + const auto fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error); if(error) Glib::Error::throw_exception(error); @@ -150,10 +150,10 @@ int file_open_tmp(std::string& name_used, const std::string& prefix) int file_open_tmp(std::string& name_used) { - GError* error = 0; + GError* error = nullptr; ScopedPtr<char> buf_name_used; - const int fileno = g_file_open_tmp(0, buf_name_used.addr(), &error); + const auto fileno = g_file_open_tmp(0, buf_name_used.addr(), &error); if(error) Glib::Error::throw_exception(error); @@ -166,7 +166,7 @@ std::string file_get_contents(const std::string& filename) { ScopedPtr<char> contents; gsize length = 0; - GError* error = 0; + GError* error = nullptr; g_file_get_contents(filename.c_str(), contents.addr(), &length, &error); @@ -181,7 +181,7 @@ file_set_contents(const std::string& filename, const gchar *contents, gssize length) { - GError* error = 0; + GError* error = nullptr; g_file_set_contents(filename.c_str(), contents, length, &error); diff --git a/glib/src/glib.defs b/glib/src/glib.defs index e106d6b7..dd679a35 100644 --- a/glib/src/glib.defs +++ b/glib/src/glib.defs @@ -1,7 +1,5 @@ (include glib_functions.defs) -(include glib_deprecated_functions.defs) (include glib_enums.defs) -(include glib_deprecated_enums.defs) (include glib_extra_objects.defs) (include glib_signals.defs) (include gobject_enums.defs) diff --git a/glib/src/glib_deprecated_enums.defs b/glib/src/glib_deprecated_enums.defs deleted file mode 100644 index b80fc58c..00000000 --- a/glib/src/glib_deprecated_enums.defs +++ /dev/null @@ -1,22 +0,0 @@ -;; From gthread.h - -;; Original typedef: -;; typedef enum -;; { -;; G_THREAD_PRIORITY_LOW, -;; G_THREAD_PRIORITY_NORMAL, -;; G_THREAD_PRIORITY_HIGH, -;; G_THREAD_PRIORITY_URGENT -;; } GThreadPriority; - -(define-enum-extended ThreadPriority - (in-module "G") - (c-name "GThreadPriority") - (values - '("low" "G_THREAD_PRIORITY_LOW" "0") - '("normal" "G_THREAD_PRIORITY_NORMAL" "1") - '("high" "G_THREAD_PRIORITY_HIGH" "2") - '("urgent" "G_THREAD_PRIORITY_URGENT" "3") - ) -) - diff --git a/glib/src/glib_deprecated_functions.defs b/glib/src/glib_deprecated_functions.defs deleted file mode 100644 index eb230a6e..00000000 --- a/glib/src/glib_deprecated_functions.defs +++ /dev/null @@ -1,50 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -;; Enumerations and flags ... - -(define-enum Priority - (in-module "GThread") - (c-name "GThreadPriority") - (gtype-id "G_TYPE_THREAD_PRIORITY") - (values - '("low" "G_THREAD_PRIORITY_LOW") - '("normal" "G_THREAD_PRIORITY_NORMAL") - '("high" "G_THREAD_PRIORITY_HIGH") - '("urgent" "G_THREAD_PRIORITY_URGENT") - ) -) - - -;; From gallocator.h - - - -;; From gcache.h - - - -;; From gcompletion.h - - - -;; From grel.h - - - -;; From gthread.h - -(define-function guint64 - (c-name "guint64") - (return-type "GLIB_VAR") - (parameters - '("*" "g_thread_gettime") - ) -) - -(define-method get_mutex_impl - (of-object "GStaticMutex") - (c-name "g_static_mutex_get_mutex_impl") - (return-type "GMutex*") -) - - diff --git a/glib/src/glib_docs.xml b/glib/src/glib_docs.xml index cba1b917..1708607a 100644 --- a/glib/src/glib_docs.xml +++ b/glib/src/glib_docs.xml @@ -1,4 +1,51 @@ <root> +<property name="GBinding:flags"> +<description> +Flags to be used to control the #GBinding + +Since: 2.26 + +</description> +</property> + +<property name="GBinding:source"> +<description> +The #GObject that should be used as the source of the binding + +Since: 2.26 + +</description> +</property> + +<property name="GBinding:source-property"> +<description> +The name of the property of #GBinding:source that should be used +as the source of the binding + +Since: 2.26 + +</description> +</property> + +<property name="GBinding:target"> +<description> +The #GObject that should be used as the target of the binding + +Since: 2.26 + +</description> +</property> + +<property name="GBinding:target-property"> +<description> +The name of the property of #GBinding:target that should be used +as the target of the binding + +Since: 2.26 + +</description> +</property> + <enum name="GBindingFlags"> <description> Flags to be passed to g_object_bind_property() or @@ -1169,8 +1216,8 @@ option: `--name arg` or combined in a single argument: `--name=arg`. </parameter_description> </parameter> <parameter name="G_OPTION_ARG_CALLBACK"> -<parameter_description> The option provides a callback to parse the -extra argument. +<parameter_description> The option provides a callback (of type +#GOptionArgFunc) to parse the extra argument. </parameter_description> </parameter> <parameter name="G_OPTION_ARG_FILENAME"> @@ -1284,7 +1331,7 @@ your direct control. Since 2.8. <enum name="GParamFlags"> <description> Through the #GParamFlags flag values, certain aspects of parameters -can be configured. See also #G_PARAM_READWRITE and #G_PARAM_STATIC_STRINGS. +can be configured. See also #G_PARAM_STATIC_STRINGS. </description> <parameters> @@ -1305,7 +1352,7 @@ can be configured. See also #G_PARAM_READWRITE and #G_PARAM_STATIC_STRINGS. </parameter_description> </parameter> <parameter name="G_PARAM_CONSTRUCT_ONLY"> -<parameter_description> the parameter will only be set upon object construction +<parameter_description> the parameter can only be set upon object construction </parameter_description> </parameter> <parameter name="G_PARAM_LAX_VALIDATION"> @@ -2558,6 +2605,10 @@ Deprecated: 2.36: g_type_init() is now done automatically <parameter_description> Mask covering all debug flags </parameter_description> </parameter> +<parameter name="G_TYPE_DEBUG_INSTANCE_COUNT"> +<parameter_description> Keep a count of instances of each type +</parameter_description> +</parameter> </parameters> </enum> @@ -2807,7 +2858,7 @@ a value never returned from g_unichar_get_script() </parameter> <parameter name="G_UNICODE_SCRIPT_INHERITED"> <parameter_description> a mark glyph that takes its script from the -i base glyph to which it is attached +base glyph to which it is attached </parameter_description> </parameter> <parameter name="G_UNICODE_SCRIPT_ARABIC"> @@ -3310,7 +3361,10 @@ Old South Arabian. Since 2.26 </parameter> <parameter name="G_UNICODE_SCRIPT_TIRHUTA"> <parameter_description> Tirhuta. Since: 2.42 -@G_UNICODE_SCRIPT_WARANG_CITI Warang Citi. Since: 2.42 +</parameter_description> +</parameter> +<parameter name="G_UNICODE_SCRIPT_WARANG_CITI"> +<parameter_description> Warang Citi. Since: 2.42 </parameter_description> </parameter> </parameters> @@ -3666,6 +3720,30 @@ Error codes returned by parsing text-format GVariants. </parameters> </enum> +<enum name="GWin32OSType"> +<description> +Type of Windows edition to check for at run-time. + +</description> +<parameters> +<parameter name="G_WIN32_OS_ANY"> +<parameter_description> The running system can be a workstation or a server edition of +Windows. The type of the running system is therefore not checked. +</parameter_description> +</parameter> +<parameter name="G_WIN32_OS_WORKSTATION"> +<parameter_description> The running system is a workstation edition of Windows, +such as Windows 7 Professional. +</parameter_description> +</parameter> +<parameter name="G_WIN32_OS_SERVER"> +<parameter_description> The running system is a server edition of Windows, such as +Windows Server 2008 R2. +</parameter_description> +</parameter> +</parameters> +</enum> + <function name="g_access"> <description> A wrapper for the POSIX access() function. This function is used to @@ -4280,7 +4358,8 @@ This function generates enough precision that converting the string back using g_ascii_strtod() gives the same machine-number (on machines with IEEE compatible 64bit doubles). It is guaranteed that the size of the resulting string will never -be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes. +be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes, including the terminating +nul character, which is always added. </description> @@ -4309,6 +4388,8 @@ decimal point. To format the number you pass in a printf()-style format string. Allowed conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'. +The returned buffer is guaranteed to be nul-terminated. + If you just want to want to serialize the value into a string, use g_ascii_dtostr(). @@ -5387,6 +5468,54 @@ Pushes the @data into the @queue. @data must not be %NULL. <return></return> </function> +<function name="g_async_queue_push_front"> +<description> +Pushes the @data into the @queue. @data must not be %NULL. +In contrast to g_async_queue_push(), this function +pushes the new item ahead of the items already in the queue, +so that it will be the next one to be popped off the queue. + +Since: 2.46 + +</description> +<parameters> +<parameter name="queue"> +<parameter_description> a #GAsyncQueue +</parameter_description> +</parameter> +<parameter name="data"> +<parameter_description> @data to push into the @queue +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="g_async_queue_push_front_unlocked"> +<description> +Pushes the @data into the @queue. @data must not be %NULL. +In contrast to g_async_queue_push_unlocked(), this function +pushes the new item ahead of the items already in the queue, +so that it will be the next one to be popped off the queue. + +This function must be called while holding the @queue's lock. + +Since: 2.46 + +</description> +<parameters> +<parameter name="queue"> +<parameter_description> a #GAsyncQueue +</parameter_description> +</parameter> +<parameter name="data"> +<parameter_description> @data to push into the @queue +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_async_queue_push_sorted"> <description> Inserts @data into @queue using @func to determine the new @@ -5521,6 +5650,52 @@ lock. <return></return> </function> +<function name="g_async_queue_remove"> +<description> +Remove an item from the queue. This function does not block. + +Since: 2.46 + +</description> +<parameters> +<parameter name="queue"> +<parameter_description> a #GAsyncQueue +</parameter_description> +</parameter> +<parameter name="data"> +<parameter_description> the @data to remove from the @queue +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the item was removed + +</return> +</function> + +<function name="g_async_queue_remove_unlocked"> +<description> +Remove an item from the queue. This function does not block. + +This function must be called while holding the @queue's lock. + +Since: 2.46 + +</description> +<parameters> +<parameter name="queue"> +<parameter_description> a #GAsyncQueue +</parameter_description> +</parameter> +<parameter name="data"> +<parameter_description> the @data to remove from the @queue +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the item was removed + +</return> +</function> + <function name="g_async_queue_sort"> <description> Sorts @queue using @func. @@ -6297,6 +6472,168 @@ Since: 2.30 </return> </function> +<function name="g_auto"> +<description> +Helper to declare a variable with automatic cleanup. + +The variable is cleaned up in a way appropriate to its type when the +variable goes out of scope. The type must support this. + +This feature is only supported on GCC and clang. This macro is not +defined on other compilers and should not be used in programs that +are intended to be portable to those compilers. + +This is meant to be used with stack-allocated structures and +non-pointer types. For the (more commonly used) pointer version, see +g_autoptr(). + +This macro can be used to avoid having to do explicit cleanups of +local variables when exiting functions. It often vastly simplifies +handling of error conditions, removing the need for various tricks +such as 'goto out' or repeating of cleanup code. It is also helpful +for non-error cases. + +Consider the following example: + +|[ +GVariant * +my_func(void) +{ +g_auto(GQueue) queue = G_QUEUE_INIT; +g_auto(GVariantBuilder) builder; + +g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); + +... + +if (error_condition) +return NULL; + +... + +return g_variant_builder_end (&builder); +} +]| + +You must initialise the variable in some way -- either by use of an +initialiser or by ensuring that an _init function will be called on +it unconditionally before it goes out of scope. + +Since: 2.44 + +</description> +<parameters> +<parameter name="TypeName"> +<parameter_description> a supported variable type +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="g_autofree"> +<description> +Macro to add an attribute to pointer variable to ensure automatic +cleanup using g_free(). + +This macro differs from g_autoptr() in that it is an attribute supplied +before the type name, rather than wrapping the type definition. Instead +of using a type-specific lookup, this macro always calls g_free() directly. + +This means it's useful for any type that is returned from +g_malloc(). + +Otherwise, this macro has similar constraints as g_autoptr() - only +supported on GCC and clang, the variable must be initialized, etc. + +|[ +gboolean +operate_on_malloc_buf (void) +{ +g_autofree guint8* membuf = NULL; + +membuf = g_malloc (8192); + +/ * Some computation on membuf * / + +/ * membuf will be automatically freed here * / +return TRUE; +} +]| + +Since: 2.44 + +</description> +<parameters> +</parameters> +<return></return> +</function> + +<function name="g_autoptr"> +<description> +Helper to declare a pointer variable with automatic cleanup. + +The variable is cleaned up in a way appropriate to its type when the +variable goes out of scope. The type must support this. + +This feature is only supported on GCC and clang. This macro is not +defined on other compilers and should not be used in programs that +are intended to be portable to those compilers. + +This is meant to be used to declare pointers to types with cleanup +functions. The type of the variable is a pointer to @TypeName. You +must not add your own '*'. + +This macro can be used to avoid having to do explicit cleanups of +local variables when exiting functions. It often vastly simplifies +handling of error conditions, removing the need for various tricks +such as 'goto out' or repeating of cleanup code. It is also helpful +for non-error cases. + +Consider the following example: + +|[ +gboolean +check_exists(GVariant *dict) +{ +g_autoptr(GVariant) dirname; +g_autoptr(GVariant) basename = NULL; +g_autoptr(gchar) path = NULL; + +dirname = g_variant_lookup_value (dict, "dirname", G_VARIANT_TYPE_STRING); + +if (dirname == NULL) +return FALSE; + +basename = g_variant_lookup_value (dict, "basename", G_VARIANT_TYPE_STRING); + +if (basename == NULL) +return FALSE; + +path = g_build_filename (g_variant_get_string (dirname, NULL), +g_variant_get_string (basename, NULL), +NULL); + +return g_access (path, R_OK) == 0; +} +]| + +You must initialise the variable in some way -- either by use of an +initialiser or by ensuring that it is assigned to unconditionally +before it goes out of scope. + +Since: 2.44 + +</description> +<parameters> +<parameter name="TypeName"> +<parameter_description> a supported variable type +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_base64_decode"> <description> Decode a sequence of Base-64 encoded text into binary data. Note @@ -9094,6 +9431,91 @@ data structures to @func; use g_cache_key_foreach() instead <return></return> </function> +<function name="g_cclosure_marshal_BOOLEAN__BOXED_BOXED"> +<description> +A #GClosureMarshal function for use with signals with handlers that +take two boxed pointers as arguments and return a boolean. If you +have such a signal, you will probably also need to use an +accumulator, such as g_signal_accumulator_true_handled(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> A #GClosure. +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> A #GValue to store the return value. May be %NULL +if the callback of closure doesn't return a value. +</parameter_description> +</parameter> +<parameter name="n_param_values"> +<parameter_description> The length of the @param_values array. +</parameter_description> +</parameter> +<parameter name="param_values"> +<parameter_description> An array of #GValues holding the arguments +on which to invoke the callback of closure. +</parameter_description> +</parameter> +<parameter name="invocation_hint"> +<parameter_description> The invocation hint given as the last argument to +g_closure_invoke(). +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> Additional data specified when registering the +marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_BOOLEAN__BOXED_BOXED(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_BOOLEAN__FLAGS"> <description> A marshaller for a #GCClosure with a callback of type @@ -9131,6 +9553,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_BOOLEAN__FLAGSv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_BOOLEAN__FLAGS(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_BOOLEAN__OBJECT_BOXED_BOXED"> <description> A marshaller for a #GCClosure with a callback of type @@ -9169,6 +9634,45 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_BOOL__BOXED_BOXED"> +<description> +An old alias for g_cclosure_marshal_BOOLEAN__BOXED_BOXED(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> A #GClosure. +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> A #GValue to store the return value. May be %NULL +if the callback of closure doesn't return a value. +</parameter_description> +</parameter> +<parameter name="n_param_values"> +<parameter_description> The length of the @param_values array. +</parameter_description> +</parameter> +<parameter name="param_values"> +<parameter_description> An array of #GValues holding the arguments +on which to invoke the callback of closure. +</parameter_description> +</parameter> +<parameter name="invocation_hint"> +<parameter_description> The invocation hint given as the last argument to +g_closure_invoke(). +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> Additional data specified when registering the +marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_BOOL__FLAGS"> <description> Another name for g_cclosure_marshal_BOOLEAN__FLAGS(). @@ -9215,6 +9719,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_STRING__OBJECT_POINTERv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_STRING__OBJECT_POINTER(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__BOOLEAN"> <description> A marshaller for a #GCClosure with a callback of type @@ -9251,6 +9798,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__BOOLEANv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__BOOLEAN(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__BOXED"> <description> A marshaller for a #GCClosure with a callback of type @@ -9287,6 +9877,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__BOXEDv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__BOXED(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__CHAR"> <description> A marshaller for a #GCClosure with a callback of type @@ -9323,6 +9956,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__CHARv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__CHAR(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__DOUBLE"> <description> A marshaller for a #GCClosure with a callback of type @@ -9359,6 +10035,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__DOUBLEv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__DOUBLE(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__ENUM"> <description> A marshaller for a #GCClosure with a callback of type @@ -9395,6 +10114,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__ENUMv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__ENUM(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__FLAGS"> <description> A marshaller for a #GCClosure with a callback of type @@ -9431,6 +10193,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__FLAGSv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__FLAGS(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__FLOAT"> <description> A marshaller for a #GCClosure with a callback of type @@ -9467,6 +10272,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__FLOATv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__FLOAT(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__INT"> <description> A marshaller for a #GCClosure with a callback of type @@ -9503,6 +10351,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__INTv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__INT(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__LONG"> <description> A marshaller for a #GCClosure with a callback of type @@ -9539,6 +10430,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__LONGv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__LONG(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__OBJECT"> <description> A marshaller for a #GCClosure with a callback of type @@ -9575,6 +10509,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__OBJECTv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__OBJECT(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__PARAM"> <description> A marshaller for a #GCClosure with a callback of type @@ -9611,6 +10588,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__PARAMv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__PARAM(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__POINTER"> <description> A marshaller for a #GCClosure with a callback of type @@ -9647,6 +10667,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__POINTERv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__POINTER(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__STRING"> <description> A marshaller for a #GCClosure with a callback of type @@ -9683,6 +10746,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__STRINGv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__STRING(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__UCHAR"> <description> A marshaller for a #GCClosure with a callback of type @@ -9719,6 +10825,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__UCHARv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UCHAR(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__UINT"> <description> A marshaller for a #GCClosure with a callback of type @@ -9791,6 +10940,92 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__UINT_POINTERv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UINT_POINTER(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="g_cclosure_marshal_VOID__UINTv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__UINT(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__ULONG"> <description> A marshaller for a #GCClosure with a callback of type @@ -9827,6 +11062,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__ULONGv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__ULONG(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__VARIANT"> <description> A marshaller for a #GCClosure with a callback of type @@ -9865,6 +11143,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__VARIANTv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__VARIANT(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_VOID__VOID"> <description> A marshaller for a #GCClosure with a callback of type @@ -9901,6 +11222,49 @@ to g_closure_invoke() <return></return> </function> +<function name="g_cclosure_marshal_VOID__VOIDv"> +<description> +The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__VOID(). + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_marshal_generic"> <description> A generic marshaller function implemented via @@ -9946,6 +11310,52 @@ g_closure_set_meta_marshal() <return></return> </function> +<function name="g_cclosure_marshal_generic_va"> +<description> +A generic #GVaClosureMarshal function implemented via +[libffi](http://sourceware.org/libffi/). + +Since: 2.30 + +</description> +<parameters> +<parameter name="closure"> +<parameter_description> the #GClosure to which the marshaller belongs +</parameter_description> +</parameter> +<parameter name="return_value"> +<parameter_description> a #GValue to store the return +value. May be %NULL if the callback of @closure doesn't return a +value. +</parameter_description> +</parameter> +<parameter name="instance"> +<parameter_description> the instance on which the closure is invoked. +</parameter_description> +</parameter> +<parameter name="args_list"> +<parameter_description> va_list of arguments to be passed to the closure. +</parameter_description> +</parameter> +<parameter name="marshal_data"> +<parameter_description> additional data specified when +registering the marshaller, see g_closure_set_marshal() and +g_closure_set_meta_marshal() +</parameter_description> +</parameter> +<parameter name="n_params"> +<parameter_description> the length of the @param_types array +</parameter_description> +</parameter> +<parameter name="param_types"> +<parameter_description> the #GType of each argument from +@args_list. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_cclosure_new"> <description> Creates a new closure which invokes @callback_func with @user_data as @@ -10513,7 +11923,9 @@ Since: 2.36 </parameter_description> </parameter> </parameters> -<return></return> +<return> %TRUE on success, %FALSE if there was an error. + +</return> </function> <function name="g_closure_add_finalize_notifier"> @@ -12800,8 +14212,8 @@ etc. The date must be valid. <function name="g_date_get_monday_week_of_year"> <description> Returns the week of the year, where weeks are understood to start on -Monday. If the date is before the first Monday of the year, return -0. The date must be valid. +Monday. If the date is before the first Monday of the year, return 0. +The date must be valid. </description> @@ -12855,9 +14267,9 @@ Returns the month of the year. The date must be valid. <function name="g_date_get_sunday_week_of_year"> <description> -Returns the week of the year during which this date falls, if weeks -are understood to being on Sunday. The date must be valid. Can return -0 if the day is before the first Sunday of the year. +Returns the week of the year during which this date falls, if +weeks are understood to being on Sunday. The date must be valid. +Can return 0 if the day is before the first Sunday of the year. </description> @@ -13695,7 +15107,7 @@ The following format specifiers are supported: - \%A: the full weekday name according to the current locale - \%b: the abbreviated month name according to the current locale - \%B: the full month name according to the current locale -- \%c: the preferred date and time rpresentation for the current locale +- \%c: the preferred date and time representation for the current locale - \%C: the century number (year/100) as a 2-digit integer (00-99) - \%d: the day of the month as a decimal number (range 01 to 31) - \%e: the day of the month as a decimal number (range 1 to 31) @@ -14024,7 +15436,7 @@ this may mean that the week-numbering year is one greater than the calendar year (so that these days have the same week-numbering year as the Thursday occurring early in the next year). -For Friday, Saturaday and Sunday occurring near the start of the year, +For Friday, Saturday and Sunday occurring near the start of the year, this may mean that the week-numbering year is one less than the calendar year (so that these days have the same week-numbering year as the Thursday occurring late in the previous year). @@ -15419,8 +16831,7 @@ for an empty environment list </parameter_description> </parameter> <parameter name="variable"> -<parameter_description> the environment variable to get, in the GLib file name -encoding +<parameter_description> the environment variable to get </parameter_description> </parameter> </parameters> @@ -15558,7 +16969,7 @@ be returned. If @domain contains a `FAILED` (or otherwise generic) error code, you should generally not check for it explicitly, but should instead treat any not-explicitly-recognized error code as being -equilalent to the `FAILED` code. This way, if the domain is +equivalent to the `FAILED` code. This way, if the domain is extended in the future to provide a more specific error code for a certain case, your code will still work. @@ -16428,7 +17839,9 @@ Since: 2.2 <function name="g_free"> <description> Frees the memory pointed to by @mem. -If @mem is %NULL it simply returns. + +If @mem is %NULL it simply returns, so there is no need to check @mem +against %NULL before calling this function. </description> <parameters> @@ -16513,7 +17926,8 @@ freed. </description> <parameters> <parameter name="charset"> -<parameter_description> return location for character set name +<parameter_description> return location for character set +name, or %NULL. </parameter_description> </parameter> </parameters> @@ -17087,9 +18501,9 @@ GLib and should not be modified or freed. <description> Returns the value of an environment variable. -The name and value are in the GLib file name encoding. On UNIX, -this means the actual bytes which might or might not be in some -consistent character set and encoding. On Windows, it is in UTF-8. +On UNIX, the name and value are byte strings which might or might not +be in some consistent character set and encoding. On Windows, they are +in UTF-8. On Windows, in case the environment variable's value contains references to other environment variables, they are expanded. @@ -17097,8 +18511,7 @@ references to other environment variables, they are expanded. </description> <parameters> <parameter name="variable"> -<parameter_description> the environment variable to get, in the GLib file name -encoding +<parameter_description> the environment variable to get </parameter_description> </parameter> </parameters> @@ -17154,7 +18567,9 @@ Since: 2.32 </parameter_description> </parameter> </parameters> -<return></return> +<return> %TRUE if @key is in @hash_table, %FALSE otherwise. + +</return> </function> <function name="g_hash_table_destroy"> @@ -17327,6 +18742,10 @@ release of GLib. It does nothing. Retrieves every key inside @hash_table. The returned data is valid until changes to the hash release those keys. +This iterates over every entry in the hash table to build its return value. +To iterate over the entries in a #GHashTable more efficiently, use a +#GHashTableIter. + Since: 2.14 </description> @@ -17353,7 +18772,11 @@ key. Use @length to determine the true length if it's possible that %NULL was used as the value for a key. Note: in the common case of a string-keyed #GHashTable, the return -value of this function can be conveniently cast to (gchar **). +value of this function can be conveniently cast to (const gchar **). + +This iterates over every entry in the hash table to build its return value. +To iterate over the entries in a #GHashTable more efficiently, use a +#GHashTableIter. You should always free the return result with g_free(). In the above-mentioned case of a string-keyed hash table, it may be @@ -17384,6 +18807,10 @@ Since: 2.40 Retrieves every value inside @hash_table. The returned data is valid until @hash_table is modified. +This iterates over every entry in the hash table to build its return value. +To iterate over the entries in a #GHashTable more efficiently, use a +#GHashTableIter. + Since: 2.14 </description> @@ -17686,6 +19113,13 @@ count of 1 and allows to specify functions to free the memory allocated for the key and value that get called when removing the entry from the #GHashTable. +Since version 2.42 it is permissible for destroy notify functions to +recursively remove further items from the hash table. This is only +permissible if the application still holds a reference to the hash table. +This means that you may need to ensure that the hash table is empty by +calling g_hash_table_remove_all before releasing the last reference using +g_hash_table_unref(). + </description> <parameters> @@ -18857,8 +20291,10 @@ returns %FALSE it is automatically removed from the list of event sources and will not be called again. This internally creates a main loop source using g_idle_source_new() -and attaches it to the main loop context using g_source_attach(). -You can do these steps manually if you need greater control. +and attaches it to the global #GMainContext using g_source_attach(), so +the callback will be invoked in whichever thread is running that main +context. You can do these steps manually if you need greater control or to +use a custom main context. </description> @@ -18883,8 +20319,10 @@ events pending. If the function returns %FALSE it is automatically removed from the list of event sources and will not be called again. This internally creates a main loop source using g_idle_source_new() -and attaches it to the main loop context using g_source_attach(). -You can do these steps manually if you need greater control. +and attaches it to the global #GMainContext using g_source_attach(), so +the callback will be invoked in whichever thread is running that main +context. You can do these steps manually if you need greater control or to +use a custom main context. </description> @@ -20283,10 +21721,12 @@ should be freed with g_free() when no longer needed. <function name="g_key_file_get_comment"> <description> Retrieves a comment above @key from @group_name. -If @key is %NULL then @comment will be read from above -@group_name. If both @key and @group_name are %NULL, then +If @key is %NULL then @comment will be read from above +@group_name. If both @key and @group_name are %NULL, then @comment will be read from above the first group in the file. +Note that the returned string includes the '#' comment markers. + Since: 2.6 </description> @@ -21254,10 +22694,14 @@ Since: 2.6 <function name="g_key_file_set_comment"> <description> Places a comment above @key from @group_name. -If @key is %NULL then @comment will be written above @group_name. -If both @key and @group_name are %NULL, then @comment will be + +If @key is %NULL then @comment will be written above @group_name. +If both @key and @group_name are %NULL, then @comment will be written above the first group in the file. +Note that this function prepends a '#' comment marker to +each line of @comment. + Since: 2.6 </description> @@ -22002,7 +23446,10 @@ Another name for g_list_free_1(). <function name="g_list_free_1"> <description> -Frees one #GList element. +Frees one #GList element, but does not update links from the next and +previous elements in the list, so you should not call this function on an +element that is currently part of a list. + It is usually used after g_list_remove_link(). </description> @@ -22204,7 +23651,8 @@ Gets the number of elements in a #GList. This function iterates over the whole list to count its elements. Use a #GQueue instead of a GList if you regularly need the number -of items. +of items. To check whether the list is non-empty, it is faster to check +@list against %NULL. </description> @@ -22240,6 +23688,10 @@ Note that it is considered perfectly acceptable to access <description> Gets the element at the given position in a #GList. +This iterates over the list until it reaches the @n-th position. If you +intend to iterate over every element, it is better to use a for-loop as +described in the #GList introduction. + </description> <parameters> @@ -22261,6 +23713,10 @@ the end of the #GList <description> Gets the data of the element at the given position. +This iterates over the list until it reaches the @n-th position. If you +intend to iterate over every element, it is better to use a for-loop as +described in the #GList introduction. + </description> <parameters> @@ -22864,6 +24320,44 @@ the log levels with the #G_LOG_FLAG_FATAL and </return> </function> +<function name="g_log_set_handler_full"> +<description> +Like g_log_sets_handler(), but takes a destroy notify for the @user_data. + +Since: 2.46 + +</description> +<parameters> +<parameter name="log_domain"> +<parameter_description> the log domain, or %NULL for the default "" +application domain +</parameter_description> +</parameter> +<parameter name="log_levels"> +<parameter_description> the log levels to apply the log handler for. +To handle fatal and recursive messages as well, combine +the log levels with the #G_LOG_FLAG_FATAL and +#G_LOG_FLAG_RECURSION bit flags. +</parameter_description> +</parameter> +<parameter name="log_func"> +<parameter_description> the log handler function +</parameter_description> +</parameter> +<parameter name="user_data"> +<parameter_description> data passed to the log handler +</parameter_description> +</parameter> +<parameter name="destroy"> +<parameter_description> destroy notify for @user_data, or %NULL +</parameter_description> +</parameter> +</parameters> +<return> the id of the new handler + +</return> +</function> + <function name="g_logv"> <description> Logs an error or debugging message. @@ -25910,6 +27404,70 @@ already been locked by the same thread results in undefined behaviour <return></return> </function> +<function name="g_mutex_locker_free"> +<description> +Unlock @locker's mutex. See g_mutex_locker_new() for details. + +Since: 2.44 + +</description> +<parameters> +<parameter name="locker"> +<parameter_description> a GMutexLocker +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + +<function name="g_mutex_locker_new"> +<description> +Lock @mutex and return a new #GMutexLocker. Unlock with +g_mutex_locker_free(). Using g_mutex_unlock() on @mutex +while a #GMutexLocker exists can lead to undefined behaviour. + +This is intended to be used with g_autoptr(). Note that g_autoptr() +is only available when using GCC or clang, so the following example +will only work with those compilers: +|[ +typedef struct +{ +... +GMutex mutex; +... +} MyObject; + +static void +my_object_do_stuff (MyObject *self) +{ +g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->mutex); + +// Code with mutex locked here + +if (cond) +// No need to unlock +return; + +// Optionally early unlock +g_clear_pointer (&locker, g_mutex_locker_free); + +// Code with mutex unlocked here +} +]| + +Since: 2.44 + +</description> +<parameters> +<parameter name="mutex"> +<parameter_description> a mutex to lock +</parameter_description> +</parameter> +</parameters> +<return> a #GMutexLocker +</return> +</function> + <function name="g_mutex_new"> <description> Allocates and initializes a new #GMutex. @@ -28118,7 +29676,7 @@ by @newval, %FALSE otherwise. Releases all references to other objects. This can be used to break reference cycles. -This functions should only be called from object system implementations. +This function should only be called from object system implementations. </description> <parameters> @@ -28420,6 +29978,11 @@ It is an error to call this function when the freeze count is zero. Decreases the reference count of @object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed). +If the pointer to the #GObject may be reused in future (for example, if it is +an instance variable of another object), it is recommended to clear the +pointer to %NULL rather than retain a dangling pointer to a potentially +invalid #GObject instance. Use g_clear_object() for this. + </description> <parameters> <parameter name="object"> @@ -28749,10 +30312,8 @@ from open(). <function name="g_option_context_add_group"> <description> Adds a #GOptionGroup to the @context, so that parsing with @context -will recognize the options in the group. Note that the group will -be freed together with the context when g_option_context_free() is -called, so you must not free the group yourself after adding it -to a context. +will recognize the options in the group. Note that this will take +ownership of the @group and thus the @group should not be freed. Since: 2.6 @@ -28918,9 +30479,29 @@ Since: 2.6 </parameter_description> </parameter> </parameters> -<return> the main group of @context, or %NULL if @context doesn't -have a main group. Note that group belongs to @context and should -not be modified or freed. +<return> the main group of @context, or %NULL if +@context doesn't have a main group. Note that group belongs to +@context and should not be modified or freed. + +</return> +</function> + +<function name="g_option_context_get_strict_posix"> +<description> +Returns whether strict POSIX code is enabled. + +See g_option_context_set_strict_posix() for more information. + +Since: 2.44 + +</description> +<parameters> +<parameter name="context"> +<parameter_description> a #GoptionContext +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if strict POSIX is enabled, %FALSE otherwise. </return> </function> @@ -29174,6 +30755,49 @@ Since: 2.6 <return></return> </function> +<function name="g_option_context_set_strict_posix"> +<description> +Sets strict POSIX mode. + +By default, this mode is disabled. + +In strict POSIX mode, the first non-argument parameter encountered +(eg: filename) terminates argument processing. Remaining arguments +are treated as non-options and are not attempted to be parsed. + +If strict POSIX mode is disabled then parsing is done in the GNU way +where option arguments can be freely mixed with non-options. + +As an example, consider "ls foo -l". With GNU style parsing, this +will list "foo" in long mode. In strict POSIX style, this will list +the files named "foo" and "-l". + +It may be useful to force strict POSIX mode when creating "verb +style" command line tools. For example, the "gsettings" command line +tool supports the global option "--schemadir" as well as many +subcommands ("get", "set", etc.) which each have their own set of +arguments. Using strict POSIX mode will allow parsing the global +options up to the verb name while leaving the remaining options to be +parsed by the relevant subcommand (which can be determined by +examining the verb name, which should be present in argv[1] after +parsing). + +Since: 2.44 + +</description> +<parameters> +<parameter name="context"> +<parameter_description> a #GoptionContext +</parameter_description> +</parameter> +<parameter name="strict_posix"> +<parameter_description> the new value +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_option_context_set_summary"> <description> Adds a string to be displayed in `--help` output before the list @@ -29286,6 +30910,8 @@ which have been added to a #GOptionContext. Since: 2.6 +Deprecated: 2.44: Use g_option_group_unref() instead. + </description> <parameters> <parameter name="group"> @@ -29332,7 +30958,25 @@ the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULL </parameter> </parameters> <return> a newly created option group. It should be added -to a #GOptionContext or freed with g_option_group_free(). +to a #GOptionContext or freed with g_option_group_unref(). + +</return> +</function> + +<function name="g_option_group_ref"> +<description> +Increments the reference count of @group by one. + +Since: 2.44 + +</description> +<parameters> +<parameter name="group"> +<parameter_description> a #GOptionGroup +</parameter_description> +</parameter> +</parameters> +<return> a #GoptionGroup </return> </function> @@ -29445,30 +31089,31 @@ Since: 2.6 <return></return> </function> -<function name="g_param_get_default_value"> +<function name="g_option_group_unref"> <description> -Gets the default value of @param as a pointer to a #GValue. +Decrements the reference count of @group by one. +If the reference count drops to 0, the @group will be freed. +and all memory allocated by the @group is released. -The #GValue will remain value for the life of @param. - -Since: 2.38 +Since: 2.44 </description> <parameters> -<parameter name="param"> -<parameter_description> a #GParamSpec +<parameter name="group"> +<parameter_description> a #GOptionGroup </parameter_description> </parameter> </parameters> -<return> a pointer to a #GValue which must not be modified - -</return> +<return></return> </function> <function name="g_param_spec_boolean"> <description> Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN -property. +property. In many cases, it may be more appropriate to use an enum with +g_param_spec_enum(), both to improve code clarity by using explicitly named +values, and to allow for more values to be added in future without breaking +API. See g_param_spec_internal() for details on property names. @@ -29754,6 +31399,26 @@ Get the short description of a #GParamSpec. </return> </function> +<function name="g_param_spec_get_default_value"> +<description> +Gets the default value of @param as a pointer to a #GValue. + +The #GValue will remain value for the life of @param. + +Since: 2.38 + +</description> +<parameters> +<parameter name="param"> +<parameter_description> a #GParamSpec +</parameter_description> +</parameter> +</parameters> +<return> a pointer to a #GValue which must not be modified + +</return> +</function> + <function name="g_param_spec_get_name"> <description> Get the name of a #GParamSpec. @@ -30143,6 +31808,8 @@ See g_param_spec_internal() for details on property names. <function name="g_param_spec_pointer"> <description> Creates a new #GParamSpecPointer instance specifying a pointer property. +Where possible, it is better to use g_param_spec_object() or +g_param_spec_boxed() to expose memory management information. See g_param_spec_internal() for details on property names. @@ -31560,6 +33227,10 @@ the #GDestroyNotify for @key is not called on the old value. If @dest is %NULL, free @src; otherwise, moves @src into *@dest. The error variable @dest points to must be %NULL. +Note that @src is no longer valid after this call. If you want +to keep using the same GError*, you need to set it to %NULL +after calling this function on it. + </description> <parameters> <parameter name="dest"> @@ -32429,9 +34100,10 @@ Since: 2.14 <function name="g_queue_insert_after"> <description> -Inserts @data into @queue after @sibling +Inserts @data into @queue after @sibling. -@sibling must be part of @queue +@sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the +data at the head of the queue. Since: 2.4 @@ -32442,7 +34114,8 @@ Since: 2.4 </parameter_description> </parameter> <parameter name="sibling"> -<parameter_description> a #GList link that must be part of @queue +<parameter_description> a #GList link that must be part of @queue, or %NULL to +push at the head of the queue. </parameter_description> </parameter> <parameter name="data"> @@ -32457,7 +34130,8 @@ Since: 2.4 <description> Inserts @data into @queue before @sibling. -@sibling must be part of @queue. +@sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the +data at the tail of the queue. Since: 2.4 @@ -32468,7 +34142,8 @@ Since: 2.4 </parameter_description> </parameter> <parameter name="sibling"> -<parameter_description> a #GList link that must be part of @queue +<parameter_description> a #GList link that must be part of @queue, or %NULL to +push at the tail of the queue. </parameter_description> </parameter> <parameter name="data"> @@ -36765,6 +38440,52 @@ Since: 2.18 <return></return> </function> +<function name="g_set_object"> +<description> +Updates a #GObject pointer to refer to @new_object. It increments the +reference count of @new_object (if non-%NULL), decrements the reference +count of the current value of @object_ptr (if non-%NULL), and assigns +@new_object to @object_ptr. The assignment is not atomic. + +@object_ptr must not be %NULL. + +A macro is also included that allows this function to be used without +pointer casts. The function itself is static inline, so its address may vary +between compilation units. + +One convenient usage of this function is in implementing property setters: +|[ +void +foo_set_bar (Foo *foo, +Bar *new_bar) +{ +g_return_if_fail (IS_FOO (foo)); +g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); + +if (g_set_object (&foo->bar, new_bar)) +g_object_notify (foo, "bar"); +} +]| + +Since: 2.44 + +</description> +<parameters> +<parameter name="object_ptr"> +<parameter_description> a pointer to a #GObject reference +</parameter_description> +</parameter> +<parameter name="new_object"> +<parameter_description> a pointer to the new #GObject to +assign to it, or %NULL to clear the pointer +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the value of @object_ptr changed, %FALSE otherwise + +</return> +</function> + <function name="g_set_prgname"> <description> Sets the name of the program. This name should not be localized, @@ -36828,10 +38549,9 @@ example. <function name="g_setenv"> <description> -Sets an environment variable. Both the variable's name and value -should be in the GLib file name encoding. On UNIX, this means that -they can be arbitrary byte strings. On Windows, they should be in -UTF-8. +Sets an environment variable. On UNIX, both the variable's name and +value can be arbitrary byte strings, except that the variable's name +cannot contain '='. On Windows, they should be in UTF-8. Note that on some systems, when variables are overwritten, the memory used for the previous variables and its value isn't reclaimed. @@ -37493,7 +39213,9 @@ is being emitted on. The rest are any arguments to be passed to the signal. </parameter_description> </parameter> <parameter name="return_value"> -<parameter_description> Location to store the return value of the signal emission. +<parameter_description> Location to +store the return value of the signal emission. This must be provided if the +specified signal returns a value, but may be ignored otherwise. </parameter_description> </parameter> </parameters> @@ -37917,6 +39639,12 @@ and/or @data the handlers have to match. Returns whether there are any handlers connected to @instance for the given signal id and detail. +If @detail is 0 then it will only match handlers that were connected +without detail. If @detail is non-zero then it will match handlers +connected both without detail and with the given detail. This is +consistent with how a signal emitted with @detail would be delivered +to those handlers. + One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost @@ -38427,6 +40155,33 @@ g_signal_add_emission_hook() <return></return> </function> +<function name="g_signal_set_va_marshaller"> +<description> +Change the #GSignalCVaMarshaller used for a given signal. This is a +specialised form of the marshaller that can often be used for the +common case of a single connected signal handler and avoids the +overhead of #GValue. Its use is optional. + +Since: 2.32 + +</description> +<parameters> +<parameter name="signal_id"> +<parameter_description> the signal id +</parameter_description> +</parameter> +<parameter name="instance_type"> +<parameter_description> the instance type on which to set the marshaller. +</parameter_description> +</parameter> +<parameter name="va_marshaller"> +<parameter_description> the marshaller to set. +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_signal_stop_emission"> <description> Stops a signal's current emission. @@ -39231,7 +40986,8 @@ or %NULL if the #GSList has no elements Gets the number of elements in a #GSList. This function iterates over the whole list to -count its elements. +count its elements. To check whether the list is non-empty, it is faster to +check @list against %NULL. </description> @@ -41582,6 +43338,69 @@ Deprectated: 2.32: Use g_rw_lock_writer_unlock() instead <return></return> </function> +<function name="g_steal_pointer"> +<description> +Sets @pp to %NULL, returning the value that was there before. + +Conceptually, this transfers the ownership of the pointer from the +referenced variable to the "caller" of the macro (ie: "steals" the +reference). + +The return value will be properly typed, according to the type of +@pp. + +This can be very useful when combined with g_autoptr() to prevent the +return value of a function from being automatically freed. Consider +the following example (which only works on GCC and clang): + +|[ +GObject * +create_object (void) +{ +g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); + +if (early_error_case) +return NULL; + +return g_steal_pointer (&obj); +} +]| + +It can also be used in similar ways for 'out' parameters and is +particularly useful for dealing with optional out parameters: + +|[ +gboolean +get_object (GObject **obj_out) +{ +g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); + +if (early_error_case) +return FALSE; + +if (obj_out) +*obj_out = g_steal_pointer (&obj); + +return TRUE; +} +]| + +In the above example, the object will be automatically freed in the +early error case and also in the case that %NULL was given for +@obj_out. + +Since: 2.44 + +</description> +<parameters> +<parameter name="pp"> +<parameter_description> a pointer to a pointer +</parameter_description> +</parameter> +</parameters> +<return></return> +</function> + <function name="g_stpcpy"> <description> Copies a nul-terminated string into the dest buffer, include the @@ -42231,8 +44050,10 @@ characters escaped. See above. <function name="g_strfreev"> <description> -Frees a %NULL-terminated array of strings, and the array itself. -If called on a %NULL value, g_strfreev() simply returns. +Frees a %NULL-terminated array of strings, as well as each +string it contains. + +If @str_array is %NULL, this function simply returns. </description> <parameters> @@ -43775,6 +45596,28 @@ or g_utf8_strup() instead. </return> </function> +<function name="g_strv_contains"> +<description> +Checks if @strv contains @str. @strv must not be %NULL. + +Since: 2.44 + +</description> +<parameters> +<parameter name="strv"> +<parameter_description> a %NULL-terminated array of strings +</parameter_description> +</parameter> +<parameter name="str"> +<parameter_description> a string +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if @str is an element of @strv, according to g_str_equal(). + +</return> +</function> + <function name="g_strv_length"> <description> Returns the length of the given %NULL-terminated @@ -43797,11 +45640,12 @@ Since: 2.6 <function name="g_test_add"> <description> Hook up a new test case at @testpath, similar to g_test_add_func(). -A fixture data structure with setup and teardown function may be provided -though, similar to g_test_create_case(). +A fixture data structure with setup and teardown functions may be provided, +similar to g_test_create_case(). + g_test_add() is implemented as a macro, so that the fsetup(), ftest() and -fteardown() callbacks can expect a @Fixture pointer as first argument in -a type safe manner. +fteardown() callbacks can expect a @Fixture pointer as their first argument +in a type safe manner. They otherwise have type #GTestFixtureFunc. Since: 2.16 @@ -43852,15 +45696,15 @@ Since: 2.16 </description> <parameters> <parameter name="testpath"> -<parameter_description> /-separated test case path name for the test. +<parameter_description> /-separated test case path name for the test. </parameter_description> </parameter> <parameter name="test_data"> -<parameter_description> Test data argument for the test function. +<parameter_description> Test data argument for the test function. </parameter_description> </parameter> <parameter name="test_func"> -<parameter_description> The test function to invoke for this test. +<parameter_description> The test function to invoke for this test. </parameter_description> </parameter> </parameters> @@ -43912,7 +45756,7 @@ Since: 2.16 </description> <parameters> <parameter name="testpath"> -<parameter_description> /-separated test case path name for the test. +<parameter_description> /-separated test case path name for the test. </parameter_description> </parameter> <parameter name="test_func"> @@ -44036,14 +45880,14 @@ Since: 2.38 Create a new #GTestCase, named @test_name, this API is fairly low level, calling g_test_add() or g_test_add_func() is preferable. When this test is executed, a fixture structure of size @data_size -will be allocated and filled with 0s. Then @data_setup is called -to initialize the fixture. After fixture setup, the actual test -function @data_test is called. Once the test run completed, the -fixture structure is torn down by calling @data_teardown and -after that the memory is released. +will be automatically allocated and filled with zeros. Then @data_setup is +called to initialize the fixture. After fixture setup, the actual test +function @data_test is called. Once the test run completes, the +fixture structure is torn down by calling @data_teardown and +after that the memory is automatically released by the test framework. Splitting up a test run into fixture setup, test function and -fixture teardown is most usful if the same fixture is used for +fixture teardown is most useful if the same fixture is used for multiple tests. In this cases, g_test_create_case() will be called with the same fixture, but varying @test_name and @data_test arguments. @@ -44065,11 +45909,11 @@ Since: 2.16 </parameter_description> </parameter> <parameter name="data_setup"> -<parameter_description> the function to set up the fixture data +<parameter_description> the function to set up the fixture data </parameter_description> </parameter> <parameter name="data_test"> -<parameter_description> the actual test function +<parameter_description> the actual test function </parameter_description> </parameter> <parameter name="data_teardown"> @@ -45641,6 +47485,29 @@ Returns the number of currently unused threads. </return> </function> +<function name="g_thread_pool_move_to_front"> +<description> +Moves the item to the front of the queue of unprocessed +items, so that it will be processed next. + +Since: 2.46 + +</description> +<parameters> +<parameter name="pool"> +<parameter_description> a #GThreadPool +</parameter_description> +</parameter> +<parameter name="data"> +<parameter_description> an unprocessed item in the pool +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the item was found and moved + +</return> +</function> + <function name="g_thread_pool_new"> <description> This function creates a new thread pool. @@ -45668,7 +47535,7 @@ global pool. @error can be %NULL to ignore errors, or non-%NULL to report errors. An error can only occur when @exclusive is set to %TRUE and not all @max_threads threads could be created. -See #GThreadError for possible errors that may occurr. +See #GThreadError for possible errors that may occur. Note, even in case of error a valid #GThreadPool is returned. @@ -45910,7 +47777,7 @@ Since: 2.32 <function name="g_thread_self"> <description> -This functions returns the #GThread corresponding to the +This function returns the #GThread corresponding to the current thread. Note that this function does not increase the reference count of the returned struct. @@ -46454,8 +48321,10 @@ g_timeout_add_seconds() function; this function allows for more optimizations and more efficient system power usage. This internally creates a main loop source using g_timeout_source_new() -and attaches it to the main loop context using g_source_attach(). You can -do these steps manually if you need greater control. +and attaches it to the global #GMainContext using g_source_attach(), so +the callback will be invoked in whichever thread is running that main +context. You can do these steps manually if you need greater control or to +use a custom main context. The interval given is in terms of monotonic time, not wall clock time. See g_get_monotonic_time(). @@ -46497,8 +48366,10 @@ timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays). This internally creates a main loop source using g_timeout_source_new() -and attaches it to the main loop context using g_source_attach(). You can -do these steps manually if you need greater control. +and attaches it to the global #GMainContext using g_source_attach(), so +the callback will be invoked in whichever thread is running that main +context. You can do these steps manually if you need greater control or to +use a custom main context. The interval given in terms of monotonic time, not wall clock time. See g_get_monotonic_time(). @@ -47447,7 +49318,9 @@ Since: 2.8 <description> Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL on failure. Contrast with g_realloc(), which aborts the program -on failure. If @mem is %NULL, behaves the same as g_try_malloc(). +on failure. + +If @mem is %NULL, behaves the same as g_try_malloc(). </description> @@ -48182,6 +50055,28 @@ or 0 if the type system ran out of fundamental type IDs </return> </function> +<function name="g_type_get_instance_count"> +<description> +Returns the number of instances allocated of the particular type; +this is only available if GLib is built with debugging support and +the instance_count debug flag is set (by setting the GOBJECT_DEBUG +variable to include instance-count). + +Since: 2.44 + +</description> +<parameters> +<parameter name="type"> +<parameter_description> a #GType +</parameter_description> +</parameter> +</parameters> +<return> the number of instances allocated of the given type; +if instance counts are not available, returns 0. + +</return> +</function> + <function name="g_type_get_plugin"> <description> Returns the #GTypePlugin structure for @type. @@ -53777,7 +55672,7 @@ Since: 2.30 Similar to g_variant_get_string() except that instead of returning a constant string, the string is duplicated. -The string will always be utf8 encoded. +The string will always be UTF-8 encoded. The return value must be freed using g_free(). @@ -53794,7 +55689,7 @@ Since: 2.24 </parameter_description> </parameter> </parameters> -<return> a newly allocated string, utf8 encoded +<return> a newly allocated string, UTF-8 encoded </return> </function> @@ -54205,17 +56100,6 @@ the fixed array </return> </function> -<function name="g_variant_get_gtype"> -<description> -Since: 2.24 -Deprecated: 2.26 - -</description> -<parameters> -</parameters> -<return></return> -</function> - <function name="g_variant_get_handle"> <description> Returns the 32-bit signed integer value of @value. @@ -54421,7 +56305,7 @@ Returns the string value of a #GVariant instance with a string type. This includes the types %G_VARIANT_TYPE_STRING, %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE. -The string will always be utf8 encoded. +The string will always be UTF-8 encoded. If @length is non-%NULL then the length of the string (in bytes) is returned there. For trusted values, this information is already @@ -54446,7 +56330,7 @@ to store the length </parameter_description> </parameter> </parameters> -<return> the constant string, utf8 encoded +<return> the constant string, UTF-8 encoded </return> </function> @@ -55388,7 +57272,7 @@ Since: 2.24 <description> Creates an array-of-bytes #GVariant with the contents of @string. This function is just like g_variant_new_string() except that the -string need not be valid utf8. +string need not be valid UTF-8. The nul terminator character at the end of the string is stored in the array. @@ -55908,14 +57792,14 @@ Since: 2.24 <description> Creates a string #GVariant with the contents of @string. -@string must be valid utf8. +@string must be valid UTF-8. Since: 2.24 </description> <parameters> <parameter name="string"> -<parameter_description> a normal utf8 nul-terminated string +<parameter_description> a normal UTF-8 nul-terminated string </parameter_description> </parameter> </parameters> @@ -55953,7 +57837,7 @@ Since: 2.24 <description> Creates a string #GVariant with the contents of @string. -@string must be valid utf8. +@string must be valid UTF-8. This function consumes @string. g_free() will be called on @string when it is no longer required. @@ -55967,7 +57851,7 @@ Since: 2.38 </description> <parameters> <parameter name="string"> -<parameter_description> a normal utf8 nul-terminated string +<parameter_description> a normal UTF-8 nul-terminated string </parameter_description> </parameter> </parameters> @@ -56169,7 +58053,8 @@ errors (in the case that the type would have been ambiguous, such as with empty arrays). In the event that the parsing is successful, the resulting #GVariant -is returned. +is returned. It is never floating, and must be freed with +g_variant_unref(). In case of any error, %NULL will be returned. If @error is non-%NULL then it will be set to reflect the error that occurred. @@ -56201,7 +58086,7 @@ produced by g_variant_print()". </parameter_description> </parameter> </parameters> -<return> a reference to a #GVariant, or %NULL +<return> a non-floating reference to a #GVariant, or %NULL </return> </function> @@ -57578,6 +59463,48 @@ Since: 2.32 <return></return> </function> +<function name="g_win32_check_windows_version"> +<description> +Returns whether the version of the Windows operating system the +code is running on is at least the specified major, minor and +service pack versions. See MSDN documentation for the Operating +System Version. Software that needs even more detailed version and +feature information should use the Win32 API VerifyVersionInfo() +directly. + +Successive calls of this function can be used for enabling or +disabling features at run-time for a range of Windows versions, +as per the VerifyVersionInfo() API documentation. + +Since: 2.44 + +</description> +<parameters> +<parameter name="major"> +<parameter_description> major version of Windows +</parameter_description> +</parameter> +<parameter name="minor"> +<parameter_description> minor version of Windows +</parameter_description> +</parameter> +<parameter name="spver"> +<parameter_description> Windows Service Pack Level, 0 if none +</parameter_description> +</parameter> +<parameter name="os_type"> +<parameter_description> Type of Windows OS +</parameter_description> +</parameter> +</parameters> +<return> %TRUE if the Windows Version is the same or greater than +the specified major, minor and service pack versions, and +whether the running Windows is a workstation or server edition +of Windows, if specifically specified. + +</return> +</function> + <function name="g_win32_error_message"> <description> Translate a Win32 error code (as returned by GetLastError() or @@ -57788,17 +59715,14 @@ freed with g_free() when no longer needed. If something goes wrong, <function name="g_win32_get_windows_version"> <description> -Returns version information for the Windows operating system the -code is running on. See MSDN documentation for the GetVersion() -function. To summarize, the most significant bit is one on Win9x, -and zero on NT-based systems. Since version 2.14, GLib works only -on NT-based systems, so checking whether your are running on Win9x -in your own software is moot. The least significant byte is 4 on -Windows NT 4, and 5 on Windows XP. Software that needs really -detailed version and feature information should use Win32 API like -GetVersionEx() and VerifyVersionInfo(). +This function is deprecated. Use +g_win32_check_windows_version() instead. -Since: 2.6 +Deprecated: 2.44: Be aware that for Windows 8.1 and Windows Server +2012 R2 and later, this will return 62 unless the application is +manifested for Windows 8.1/Windows Server 2012 R2, for example. +MSDN stated that GetVersion(), which is used here, is subject to +further change or removal after Windows 8.1. </description> <parameters> @@ -58274,7 +60198,7 @@ Values of this type can range from #G_MINSSIZE to #G_MAXSSIZE. To print or scan values of this type, use -%G_GSIZE_MODIFIER and/or %G_GSSIZE_FORMAT. +%G_GSSIZE_MODIFIER and/or %G_GSSIZE_FORMAT. </description> <parameters> diff --git a/glib/src/glib_docs_override.xml b/glib/src/glib_docs_override.xml index 77c4d222..9eee1064 100644 --- a/glib/src/glib_docs_override.xml +++ b/glib/src/glib_docs_override.xml @@ -46,6 +46,7 @@ Loads a key file into an empty KeyFile instance. If the file could not be loaded then a FileError or KeyFileError exception is thrown. Since: 2.6 + \throw Glib::FileError \throw Glib::KeyFileError </description> diff --git a/glib/src/glib_enums.defs b/glib/src/glib_enums.defs index 8b6851df..3c93f084 100644 --- a/glib/src/glib_enums.defs +++ b/glib/src/glib_enums.defs @@ -963,23 +963,65 @@ (c-name "GVariantParseError") (values '("failed" "G_VARIANT_PARSE_ERROR_FAILED" "0") - '("basic_type_expected" "G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED" "1") - '("cannot_infer_type" "G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE" "2") - '("definite_type_expected" "G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED" "3") - '("input_not_at_end" "G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END" "4") - '("invalid_character" "G_VARIANT_PARSE_ERROR_INVALID_CHARACTER" "5") - '("invalid_format_string" "G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING" "6") - '("invalid_object_path" "G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH" "7") - '("invalid_signature" "G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE" "8") - '("invalid_type_string" "G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING" "9") - '("no_common_type" "G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE" "10") - '("number_out_of_range" "G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE" "11") - '("number_too_big" "G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG" "12") - '("type_error" "G_VARIANT_PARSE_ERROR_TYPE_ERROR" "13") - '("unexpected_token" "G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN" "14") - '("unknown_keyword" "G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD" "15") - '("unterminated_string_constant" "G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT" "16") - '("value_expected" "G_VARIANT_PARSE_ERROR_VALUE_EXPECTED" "17") + '("basic-type-expected" "G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED" "1") + '("cannot-infer-type" "G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE" "2") + '("definite-type-expected" "G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED" "3") + '("input-not-at-end" "G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END" "4") + '("invalid-character" "G_VARIANT_PARSE_ERROR_INVALID_CHARACTER" "5") + '("invalid-format-string" "G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING" "6") + '("invalid-object-path" "G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH" "7") + '("invalid-signature" "G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE" "8") + '("invalid-type-string" "G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING" "9") + '("no-common-type" "G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE" "10") + '("number-out-of-range" "G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE" "11") + '("number-too-big" "G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG" "12") + '("type-error" "G_VARIANT_PARSE_ERROR_TYPE_ERROR" "13") + '("unexpected-token" "G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN" "14") + '("unknown-keyword" "G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD" "15") + '("unterminated-string-constant" "G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT" "16") + '("value-expected" "G_VARIANT_PARSE_ERROR_VALUE_EXPECTED" "17") + ) +) + +;; From gwin32.h + +;; Original typedef: +;; typedef enum +;; { +;; G_WIN32_OS_ANY, +;; G_WIN32_OS_WORKSTATION, +;; G_WIN32_OS_SERVER, +;; } GWin32OSType; + +(define-enum-extended Win32OSType + (in-module "G") + (c-name "GWin32OSType") + (values + '("any" "G_WIN32_OS_ANY" "0") + '("workstation" "G_WIN32_OS_WORKSTATION" "1") + '("server" "G_WIN32_OS_SERVER" "2") + ) +) + +;; From gthread.h + +;; Original typedef: +;; typedef enum +;; { +;; G_THREAD_PRIORITY_LOW, +;; G_THREAD_PRIORITY_NORMAL, +;; G_THREAD_PRIORITY_HIGH, +;; G_THREAD_PRIORITY_URGENT +;; } GThreadPriority; + +(define-enum-extended ThreadPriority + (in-module "G") + (c-name "GThreadPriority") + (values + '("low" "G_THREAD_PRIORITY_LOW" "0") + '("normal" "G_THREAD_PRIORITY_NORMAL" "1") + '("high" "G_THREAD_PRIORITY_HIGH" "2") + '("urgent" "G_THREAD_PRIORITY_URGENT" "3") ) ) diff --git a/glib/src/glib_enums.defs.patch b/glib/src/glib_enums.defs.patch index feac2c2a..022f3b18 100644 --- a/glib/src/glib_enums.defs.patch +++ b/glib/src/glib_enums.defs.patch @@ -1,6 +1,8 @@ ---- glib_enums.defs 2012-02-28 12:17:21.000000000 -0500 -+++ glib_enums.defs.new 2012-02-28 12:00:52.000000000 -0500 -@@ -386,16 +386,24 @@ +--- ./../../glib/src/glib_enums.defs.orig 2015-07-24 16:56:29.570857821 +0200 ++++ ./../../glib/src/glib_enums.defs 2015-07-24 16:56:29.706864274 +0200 +@@ -464,20 +464,28 @@ + ;; G_IO_ERR GLIB_SYSDEF_POLLERR, + ;; G_IO_HUP GLIB_SYSDEF_POLLHUP, ;; G_IO_NVAL GLIB_SYSDEF_POLLNVAL ;; } GIOCondition; @@ -31,22 +33,5 @@ ) ) -@@ -411,6 +419,10 @@ - ;; G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK, - ;; G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK - ;; } GIOFlags; -+;; Note that we add is-writeable in glibmm to preserve API. -+;; They do that with a #define in glib, though an enum would have been OK: -+;; See http://git.gnome.org/browse/glib/commit/glib/giochannel.h?id=0d1a2eb4bfcd733e0c015c76fb0ca0308b8a61f0 -+;; and https://bugzilla.gnome.org/show_bug.cgi?id=657045#c6 + ;; From gmarkup.h - (define-flags-extended IOFlags - (in-module "G") -@@ -419,6 +431,7 @@ - '("append" "G_IO_FLAG_APPEND" "1 << 0") - '("nonblock" "G_IO_FLAG_NONBLOCK" "1 << 1") - '("is-readable" "G_IO_FLAG_IS_READABLE" "1 << 2") -+ '("is-writeable" "G_IO_FLAG_IS_WRITEABLE" "1 << 3") - '("is-writable" "G_IO_FLAG_IS_WRITABLE" "1 << 3") - '("is-seekable" "G_IO_FLAG_IS_SEEKABLE" "1 << 4") - '("mask" "G_IO_FLAG_MASK" "(1 << 5) - 1") diff --git a/glib/src/glib_functions.defs b/glib/src/glib_functions.defs index 3d55e45d..87445f69 100644 --- a/glib/src/glib_functions.defs +++ b/glib/src/glib_functions.defs @@ -657,10 +657,49 @@ (return-type "none") ) -(define-method unref_to_array - (of-object "GBytes") - (c-name "g_bytes_unref_to_array") - (return-type "const-GByteArray*") +(define-method remove + (of-object "GAsyncQueue") + (c-name "g_async_queue_remove") + (return-type "gboolean") + (parameters + '("gpointer" "item") + ) +) + +(define-method remove_unlocked + (of-object "GAsyncQueue") + (c-name "g_async_queue_remove_unlocked") + (return-type "gboolean") + (parameters + '("gpointer" "item") + ) +) + +(define-method push_front + (of-object "GAsyncQueue") + (c-name "g_async_queue_push_front") + (return-type "none") + (parameters + '("gpointer" "item") + ) +) + +(define-method push_front_unlocked + (of-object "GAsyncQueue") + (c-name "g_async_queue_push_front_unlocked") + (return-type "none") + (parameters + '("gpointer" "item") + ) +) + +(define-method timed_pop + (of-object "GAsyncQueue") + (c-name "g_async_queue_timed_pop") + (return-type "gpointer") + (parameters + '("GTimeVal*" "end_time") + ) ) (define-method unref_to_data @@ -672,9 +711,13 @@ ) ) -(define-function new - (c-name "g_checksum_new") - (return-type "GChecksum*") + + +;; From gatomic.h + +(define-function g_atomic_int_get + (c-name "g_atomic_int_get") + (return-type "gint") (parameters '("GChecksumType" "checksum_type") ) @@ -1474,10 +1517,14 @@ ) ) -(define-method get_hash_table - (of-object "GHashTableIter") - (c-name "g_hash_table_iter_get_hash_table") - (return-type "GHashTable*") + + +;; From gchecksum.h + +(define-method get_length + (of-object "GChecksumType") + (c-name "g_checksum_type_get_length") + (return-type "gssize") ) (define-method init @@ -2058,10 +2105,19 @@ ) ) -(define-method get_locale_string - (of-object "GKeyFile") - (c-name "g_key_file_get_locale_string") - (return-type "gchar*") + + +;; From gdate.h + +(define-function g_date_new + (c-name "g_date_new") + (is-constructor-of "GDate") + (return-type "GDate*") +) + +(define-function g_date_new_dmy + (c-name "g_date_new_dmy") + (return-type "GDate*") (parameters '("const-gchar*" "group_name") '("const-gchar*" "key") @@ -2585,12 +2641,7935 @@ ) ) +(define-function g_date_time_new_from_timeval_local + (c-name "g_date_time_new_from_timeval_local") + (return-type "GDateTime*") + (parameters + '("const-GTimeVal*" "tv") + ) +) + +(define-function g_date_time_new_from_timeval_utc + (c-name "g_date_time_new_from_timeval_utc") + (return-type "GDateTime*") + (parameters + '("const-GTimeVal*" "tv") + ) +) + +(define-function g_date_time_new + (c-name "g_date_time_new") + (is-constructor-of "GDateTime") + (return-type "GDateTime*") + (parameters + '("GTimeZone*" "tz") + '("gint" "year") + '("gint" "month") + '("gint" "day") + '("gint" "hour") + '("gint" "minute") + '("gdouble" "seconds") + ) +) + +(define-function g_date_time_new_local + (c-name "g_date_time_new_local") + (return-type "GDateTime*") + (parameters + '("gint" "year") + '("gint" "month") + '("gint" "day") + '("gint" "hour") + '("gint" "minute") + '("gdouble" "seconds") + ) +) + +(define-function g_date_time_new_utc + (c-name "g_date_time_new_utc") + (return-type "GDateTime*") + (parameters + '("gint" "year") + '("gint" "month") + '("gint" "day") + '("gint" "hour") + '("gint" "minute") + '("gdouble" "seconds") + ) +) + +(define-method add + (of-object "GDateTime") + (c-name "g_date_time_add") + (return-type "GDateTime*") + (parameters + '("GTimeSpan" "timespan") + ) +) + +(define-method add_years + (of-object "GDateTime") + (c-name "g_date_time_add_years") + (return-type "GDateTime*") + (parameters + '("gint" "years") + ) +) + +(define-method add_months + (of-object "GDateTime") + (c-name "g_date_time_add_months") + (return-type "GDateTime*") + (parameters + '("gint" "months") + ) +) + +(define-method add_weeks + (of-object "GDateTime") + (c-name "g_date_time_add_weeks") + (return-type "GDateTime*") + (parameters + '("gint" "weeks") + ) +) + +(define-method add_days + (of-object "GDateTime") + (c-name "g_date_time_add_days") + (return-type "GDateTime*") + (parameters + '("gint" "days") + ) +) + +(define-method add_hours + (of-object "GDateTime") + (c-name "g_date_time_add_hours") + (return-type "GDateTime*") + (parameters + '("gint" "hours") + ) +) + +(define-method add_minutes + (of-object "GDateTime") + (c-name "g_date_time_add_minutes") + (return-type "GDateTime*") + (parameters + '("gint" "minutes") + ) +) + +(define-method add_seconds + (of-object "GDateTime") + (c-name "g_date_time_add_seconds") + (return-type "GDateTime*") + (parameters + '("gdouble" "seconds") + ) +) + +(define-method add_full + (of-object "GDateTime") + (c-name "g_date_time_add_full") + (return-type "GDateTime*") + (parameters + '("gint" "years") + '("gint" "months") + '("gint" "days") + '("gint" "hours") + '("gint" "minutes") + '("gdouble" "seconds") + ) +) + +(define-function g_date_time_compare + (c-name "g_date_time_compare") + (return-type "gint") + (parameters + '("gconstpointer" "dt1") + '("gconstpointer" "dt2") + ) +) + +(define-method difference + (of-object "GDateTime") + (c-name "g_date_time_difference") + (return-type "GTimeSpan") + (parameters + '("GDateTime*" "begin") + ) +) + +(define-function g_date_time_hash + (c-name "g_date_time_hash") + (return-type "guint") + (parameters + '("gconstpointer" "datetime") + ) +) + +(define-function g_date_time_equal + (c-name "g_date_time_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "dt1") + '("gconstpointer" "dt2") + ) +) + +(define-method get_ymd + (of-object "GDateTime") + (c-name "g_date_time_get_ymd") + (return-type "none") + (parameters + '("gint*" "year") + '("gint*" "month") + '("gint*" "day") + ) +) + +(define-method get_year + (of-object "GDateTime") + (c-name "g_date_time_get_year") + (return-type "gint") +) + +(define-method get_month + (of-object "GDateTime") + (c-name "g_date_time_get_month") + (return-type "gint") +) + +(define-method get_day_of_month + (of-object "GDateTime") + (c-name "g_date_time_get_day_of_month") + (return-type "gint") +) + +(define-method get_week_numbering_year + (of-object "GDateTime") + (c-name "g_date_time_get_week_numbering_year") + (return-type "gint") +) + +(define-method get_week_of_year + (of-object "GDateTime") + (c-name "g_date_time_get_week_of_year") + (return-type "gint") +) + +(define-method get_day_of_week + (of-object "GDateTime") + (c-name "g_date_time_get_day_of_week") + (return-type "gint") +) + +(define-method get_day_of_year + (of-object "GDateTime") + (c-name "g_date_time_get_day_of_year") + (return-type "gint") +) + +(define-method get_hour + (of-object "GDateTime") + (c-name "g_date_time_get_hour") + (return-type "gint") +) + +(define-method get_minute + (of-object "GDateTime") + (c-name "g_date_time_get_minute") + (return-type "gint") +) + +(define-method get_second + (of-object "GDateTime") + (c-name "g_date_time_get_second") + (return-type "gint") +) + +(define-method get_microsecond + (of-object "GDateTime") + (c-name "g_date_time_get_microsecond") + (return-type "gint") +) + +(define-method get_seconds + (of-object "GDateTime") + (c-name "g_date_time_get_seconds") + (return-type "gdouble") +) + +(define-method to_unix + (of-object "GDateTime") + (c-name "g_date_time_to_unix") + (return-type "gint64") +) + +(define-method to_timeval + (of-object "GDateTime") + (c-name "g_date_time_to_timeval") + (return-type "gboolean") + (parameters + '("GTimeVal*" "tv") + ) +) + +(define-method get_utc_offset + (of-object "GDateTime") + (c-name "g_date_time_get_utc_offset") + (return-type "GTimeSpan") +) + +(define-method get_timezone_abbreviation + (of-object "GDateTime") + (c-name "g_date_time_get_timezone_abbreviation") + (return-type "const-gchar*") +) + +(define-method is_daylight_savings + (of-object "GDateTime") + (c-name "g_date_time_is_daylight_savings") + (return-type "gboolean") +) + +(define-method to_timezone + (of-object "GDateTime") + (c-name "g_date_time_to_timezone") + (return-type "GDateTime*") + (parameters + '("GTimeZone*" "tz") + ) +) + +(define-method to_local + (of-object "GDateTime") + (c-name "g_date_time_to_local") + (return-type "GDateTime*") +) + +(define-method to_utc + (of-object "GDateTime") + (c-name "g_date_time_to_utc") + (return-type "GDateTime*") +) + +(define-method format + (of-object "GDateTime") + (c-name "g_date_time_format") + (return-type "gchar*") + (parameters + '("const-gchar*" "format") + ) +) + + + +;; From gdir.h + +(define-function g_dir_open + (c-name "g_dir_open") + (return-type "GDir*") + (parameters + '("const-gchar*" "path") + '("guint" "flags") + '("GError**" "error") + ) +) + +(define-method read_name + (of-object "GDir") + (c-name "g_dir_read_name") + (return-type "const-gchar*") +) + +(define-method rewind + (of-object "GDir") + (c-name "g_dir_rewind") + (return-type "none") +) + +(define-method close + (of-object "GDir") + (c-name "g_dir_close") + (return-type "none") +) + +(define-function g_dir_open_utf8 + (c-name "g_dir_open_utf8") + (return-type "GDir*") + (parameters + '("const-gchar*" "path") + '("guint" "flags") + '("GError**" "error") + ) +) + +(define-method read_name_utf8 + (of-object "GDir") + (c-name "g_dir_read_name_utf8") + (return-type "const-gchar*") +) + + + +;; From genviron.h + +(define-function g_getenv + (c-name "g_getenv") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "variable") + ) +) + +(define-function g_setenv + (c-name "g_setenv") + (return-type "gboolean") + (parameters + '("const-gchar*" "variable") + '("const-gchar*" "value") + '("gboolean" "overwrite") + ) +) + +(define-function g_unsetenv + (c-name "g_unsetenv") + (return-type "none") + (parameters + '("const-gchar*" "variable") + ) +) + +(define-function g_listenv + (c-name "g_listenv") + (return-type "gchar**") +) + +(define-function g_get_environ + (c-name "g_get_environ") + (return-type "gchar**") +) + +(define-function g_environ_getenv + (c-name "g_environ_getenv") + (return-type "const-gchar*") + (parameters + '("gchar**" "envp") + '("const-gchar*" "variable") + ) +) + +(define-function g_environ_setenv + (c-name "g_environ_setenv") + (return-type "gchar**") + (parameters + '("gchar**" "envp") + '("const-gchar*" "variable") + '("const-gchar*" "value") + '("gboolean" "overwrite") + ) +) + +(define-function g_environ_unsetenv + (c-name "g_environ_unsetenv") + (return-type "gchar**") + (parameters + '("gchar**" "envp") + '("const-gchar*" "variable") + ) +) + +(define-function g_getenv_utf8 + (c-name "g_getenv_utf8") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "variable") + ) +) + +(define-function g_setenv_utf8 + (c-name "g_setenv_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "variable") + '("const-gchar*" "value") + '("gboolean" "overwrite") + ) +) + +(define-function g_unsetenv_utf8 + (c-name "g_unsetenv_utf8") + (return-type "none") + (parameters + '("const-gchar*" "variable") + ) +) + + + +;; From gerror.h + +(define-function g_error_new + (c-name "g_error_new") + (is-constructor-of "GError") + (return-type "GError*") + (parameters + '("GQuark" "domain") + '("gint" "code") + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_error_new_literal + (c-name "g_error_new_literal") + (return-type "GError*") + (parameters + '("GQuark" "domain") + '("gint" "code") + '("const-gchar*" "message") + ) +) + +(define-function g_error_new_valist + (c-name "g_error_new_valist") + (return-type "GError*") + (parameters + '("GQuark" "domain") + '("gint" "code") + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-method free + (of-object "GError") + (c-name "g_error_free") + (return-type "none") +) + +(define-method copy + (of-object "GError") + (c-name "g_error_copy") + (return-type "GError*") +) + +(define-method matches + (of-object "GError") + (c-name "g_error_matches") + (return-type "gboolean") + (parameters + '("GQuark" "domain") + '("gint" "code") + ) +) + +(define-function g_set_error + (c-name "g_set_error") + (return-type "none") + (parameters + '("GError**" "err") + '("GQuark" "domain") + '("gint" "code") + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_set_error_literal + (c-name "g_set_error_literal") + (return-type "none") + (parameters + '("GError**" "err") + '("GQuark" "domain") + '("gint" "code") + '("const-gchar*" "message") + ) +) + +(define-function g_propagate_error + (c-name "g_propagate_error") + (return-type "none") + (parameters + '("GError**" "dest") + '("GError*" "src") + ) +) + +(define-function g_clear_error + (c-name "g_clear_error") + (return-type "none") + (parameters + '("GError**" "err") + ) +) + +(define-function g_prefix_error + (c-name "g_prefix_error") + (return-type "none") + (parameters + '("GError**" "err") + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_propagate_prefixed_error + (c-name "g_propagate_prefixed_error") + (return-type "none") + (parameters + '("GError**" "dest") + '("GError*" "src") + '("const-gchar*" "format") + ) + (varargs #t) +) + + + +;; From gfileutils.h + +(define-function g_file_error_quark + (c-name "g_file_error_quark") + (return-type "GQuark") +) + +(define-function g_file_error_from_errno + (c-name "g_file_error_from_errno") + (return-type "GFileError") + (parameters + '("gint" "err_no") + ) +) + +(define-function g_file_test + (c-name "g_file_test") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("GFileTest" "test") + ) +) + +(define-function g_file_get_contents + (c-name "g_file_get_contents") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("gchar**" "contents") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-function g_file_set_contents + (c-name "g_file_set_contents") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("const-gchar*" "contents") + '("gssize" "length") + '("GError**" "error") + ) +) + +(define-function g_file_read_link + (c-name "g_file_read_link") + (return-type "gchar*") + (parameters + '("const-gchar*" "filename") + '("GError**" "error") + ) +) + +(define-function g_mkdtemp + (c-name "g_mkdtemp") + (return-type "gchar*") + (parameters + '("gchar*" "tmpl") + ) +) + +(define-function g_mkdtemp_full + (c-name "g_mkdtemp_full") + (return-type "gchar*") + (parameters + '("gchar*" "tmpl") + '("gint" "mode") + ) +) + +(define-function g_mkstemp + (c-name "g_mkstemp") + (return-type "gint") + (parameters + '("gchar*" "tmpl") + ) +) + +(define-function g_mkstemp_full + (c-name "g_mkstemp_full") + (return-type "gint") + (parameters + '("gchar*" "tmpl") + '("gint" "flags") + '("gint" "mode") + ) +) + +(define-function g_file_open_tmp + (c-name "g_file_open_tmp") + (return-type "gint") + (parameters + '("const-gchar*" "tmpl") + '("gchar**" "name_used") + '("GError**" "error") + ) +) + +(define-function g_dir_make_tmp + (c-name "g_dir_make_tmp") + (return-type "gchar*") + (parameters + '("const-gchar*" "tmpl") + '("GError**" "error") + ) +) + +(define-function g_build_path + (c-name "g_build_path") + (return-type "gchar*") + (parameters + '("const-gchar*" "separator") + '("const-gchar*" "first_element") + ) + (varargs #t) +) + +(define-function g_build_pathv + (c-name "g_build_pathv") + (return-type "gchar*") + (parameters + '("const-gchar*" "separator") + '("gchar**" "args") + ) +) + +(define-function g_build_filename + (c-name "g_build_filename") + (return-type "gchar*") + (parameters + '("const-gchar*" "first_element") + ) + (varargs #t) +) + +(define-function g_build_filenamev + (c-name "g_build_filenamev") + (return-type "gchar*") + (parameters + '("gchar**" "args") + ) +) + +(define-function g_mkdir_with_parents + (c-name "g_mkdir_with_parents") + (return-type "gint") + (parameters + '("const-gchar*" "pathname") + '("gint" "mode") + ) +) + +(define-function g_path_is_absolute + (c-name "g_path_is_absolute") + (return-type "gboolean") + (parameters + '("const-gchar*" "file_name") + ) +) + +(define-function g_path_skip_root + (c-name "g_path_skip_root") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "file_name") + ) +) + +(define-function g_basename + (c-name "g_basename") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "file_name") + ) +) + +(define-function g_get_current_dir + (c-name "g_get_current_dir") + (return-type "gchar*") +) + +(define-function g_path_get_basename + (c-name "g_path_get_basename") + (return-type "gchar*") + (parameters + '("const-gchar*" "file_name") + ) +) + +(define-function g_path_get_dirname + (c-name "g_path_get_dirname") + (return-type "gchar*") + (parameters + '("const-gchar*" "file_name") + ) +) + +(define-function g_file_test_utf8 + (c-name "g_file_test_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("GFileTest" "test") + ) +) + +(define-function g_file_get_contents_utf8 + (c-name "g_file_get_contents_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("gchar**" "contents") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-function g_mkstemp_utf8 + (c-name "g_mkstemp_utf8") + (return-type "gint") + (parameters + '("gchar*" "tmpl") + ) +) + +(define-function g_file_open_tmp_utf8 + (c-name "g_file_open_tmp_utf8") + (return-type "gint") + (parameters + '("const-gchar*" "tmpl") + '("gchar**" "name_used") + '("GError**" "error") + ) +) + +(define-function g_get_current_dir_utf8 + (c-name "g_get_current_dir_utf8") + (return-type "gchar*") +) + + + +;; From ggettext.h + +(define-function g_strip_context + (c-name "g_strip_context") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "msgid") + '("const-gchar*" "msgval") + ) +) + +(define-function g_dgettext + (c-name "g_dgettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "msgid") + ) +) + +(define-function g_dcgettext + (c-name "g_dcgettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "msgid") + '("gint" "category") + ) +) + +(define-function g_dngettext + (c-name "g_dngettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "msgid") + '("const-gchar*" "msgid_plural") + '("gulong" "n") + ) +) + +(define-function g_dpgettext + (c-name "g_dpgettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "msgctxtid") + '("gsize" "msgidoffset") + ) +) + +(define-function g_dpgettext2 + (c-name "g_dpgettext2") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "context") + '("const-gchar*" "msgid") + ) +) + + + +;; From ghash.h + +(define-function g_hash_table_new + (c-name "g_hash_table_new") + (is-constructor-of "GHashTable") + (return-type "GHashTable*") + (parameters + '("GHashFunc" "hash_func") + '("GEqualFunc" "key_equal_func") + ) +) + +(define-function g_hash_table_new_full + (c-name "g_hash_table_new_full") + (return-type "GHashTable*") + (parameters + '("GHashFunc" "hash_func") + '("GEqualFunc" "key_equal_func") + '("GDestroyNotify" "key_destroy_func") + '("GDestroyNotify" "value_destroy_func") + ) +) + +(define-method destroy + (of-object "GHashTable") + (c-name "g_hash_table_destroy") + (return-type "none") +) + +(define-method insert + (of-object "GHashTable") + (c-name "g_hash_table_insert") + (return-type "gboolean") + (parameters + '("gpointer" "key") + '("gpointer" "value") + ) +) + +(define-method replace + (of-object "GHashTable") + (c-name "g_hash_table_replace") + (return-type "gboolean") + (parameters + '("gpointer" "key") + '("gpointer" "value") + ) +) + +(define-method add + (of-object "GHashTable") + (c-name "g_hash_table_add") + (return-type "gboolean") + (parameters + '("gpointer" "key") + ) +) + +(define-method remove + (of-object "GHashTable") + (c-name "g_hash_table_remove") + (return-type "gboolean") + (parameters + '("gconstpointer" "key") + ) +) + +(define-method remove_all + (of-object "GHashTable") + (c-name "g_hash_table_remove_all") + (return-type "none") +) + +(define-method steal + (of-object "GHashTable") + (c-name "g_hash_table_steal") + (return-type "gboolean") + (parameters + '("gconstpointer" "key") + ) +) + +(define-method steal_all + (of-object "GHashTable") + (c-name "g_hash_table_steal_all") + (return-type "none") +) + +(define-method lookup + (of-object "GHashTable") + (c-name "g_hash_table_lookup") + (return-type "gpointer") + (parameters + '("gconstpointer" "key") + ) +) + +(define-method contains + (of-object "GHashTable") + (c-name "g_hash_table_contains") + (return-type "gboolean") + (parameters + '("gconstpointer" "key") + ) +) + +(define-method lookup_extended + (of-object "GHashTable") + (c-name "g_hash_table_lookup_extended") + (return-type "gboolean") + (parameters + '("gconstpointer" "lookup_key") + '("gpointer*" "orig_key") + '("gpointer*" "value") + ) +) + +(define-method foreach + (of-object "GHashTable") + (c-name "g_hash_table_foreach") + (return-type "none") + (parameters + '("GHFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method find + (of-object "GHashTable") + (c-name "g_hash_table_find") + (return-type "gpointer") + (parameters + '("GHRFunc" "predicate") + '("gpointer" "user_data") + ) +) + +(define-method foreach_remove + (of-object "GHashTable") + (c-name "g_hash_table_foreach_remove") + (return-type "guint") + (parameters + '("GHRFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method foreach_steal + (of-object "GHashTable") + (c-name "g_hash_table_foreach_steal") + (return-type "guint") + (parameters + '("GHRFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method size + (of-object "GHashTable") + (c-name "g_hash_table_size") + (return-type "guint") +) + +(define-method get_keys + (of-object "GHashTable") + (c-name "g_hash_table_get_keys") + (return-type "GList*") +) + +(define-method get_values + (of-object "GHashTable") + (c-name "g_hash_table_get_values") + (return-type "GList*") +) + +(define-method get_keys_as_array + (of-object "GHashTable") + (c-name "g_hash_table_get_keys_as_array") + (return-type "gpointer*") + (parameters + '("guint*" "length") + ) +) + +(define-method init + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_init") + (return-type "none") + (parameters + '("GHashTable*" "hash_table") + ) +) + +(define-method next + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_next") + (return-type "gboolean") + (parameters + '("gpointer*" "key") + '("gpointer*" "value") + ) +) + +(define-method get_hash_table + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_get_hash_table") + (return-type "GHashTable*") +) + +(define-method remove + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_remove") + (return-type "none") +) + +(define-method replace + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_replace") + (return-type "none") + (parameters + '("gpointer" "value") + ) +) + +(define-method steal + (of-object "GHashTableIter") + (c-name "g_hash_table_iter_steal") + (return-type "none") +) + +(define-method ref + (of-object "GHashTable") + (c-name "g_hash_table_ref") + (return-type "GHashTable*") +) + +(define-method unref + (of-object "GHashTable") + (c-name "g_hash_table_unref") + (return-type "none") +) + +(define-function g_str_equal + (c-name "g_str_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + +(define-function g_str_hash + (c-name "g_str_hash") + (return-type "guint") + (parameters + '("gconstpointer" "v") + ) +) + +(define-function g_int_equal + (c-name "g_int_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + +(define-function g_int_hash + (c-name "g_int_hash") + (return-type "guint") + (parameters + '("gconstpointer" "v") + ) +) + +(define-function g_int64_equal + (c-name "g_int64_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + +(define-function g_int64_hash + (c-name "g_int64_hash") + (return-type "guint") + (parameters + '("gconstpointer" "v") + ) +) + +(define-function g_double_equal + (c-name "g_double_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + +(define-function g_double_hash + (c-name "g_double_hash") + (return-type "guint") + (parameters + '("gconstpointer" "v") + ) +) + +(define-function g_direct_hash + (c-name "g_direct_hash") + (return-type "guint") + (parameters + '("gconstpointer" "v") + ) +) + +(define-function g_direct_equal + (c-name "g_direct_equal") + (return-type "gboolean") + (parameters + '("gconstpointer" "v1") + '("gconstpointer" "v2") + ) +) + + + +;; From ghmac.h + +(define-function g_hmac_new + (c-name "g_hmac_new") + (is-constructor-of "GHmac") + (return-type "GHmac*") + (parameters + '("GChecksumType" "digest_type") + '("const-guchar*" "key") + '("gsize" "key_len") + ) +) + +(define-method copy + (of-object "GHmac") + (c-name "g_hmac_copy") + (return-type "GHmac*") +) + +(define-method ref + (of-object "GHmac") + (c-name "g_hmac_ref") + (return-type "GHmac*") +) + +(define-method unref + (of-object "GHmac") + (c-name "g_hmac_unref") + (return-type "none") +) + +(define-method update + (of-object "GHmac") + (c-name "g_hmac_update") + (return-type "none") + (parameters + '("const-guchar*" "data") + '("gssize" "length") + ) +) + +(define-method get_string + (of-object "GHmac") + (c-name "g_hmac_get_string") + (return-type "const-gchar*") +) + +(define-method get_digest + (of-object "GHmac") + (c-name "g_hmac_get_digest") + (return-type "none") + (parameters + '("guint8*" "buffer") + '("gsize*" "digest_len") + ) +) + +(define-function g_compute_hmac_for_data + (c-name "g_compute_hmac_for_data") + (return-type "gchar*") + (parameters + '("GChecksumType" "digest_type") + '("const-guchar*" "key") + '("gsize" "key_len") + '("const-guchar*" "data") + '("gsize" "length") + ) +) + +(define-function g_compute_hmac_for_string + (c-name "g_compute_hmac_for_string") + (return-type "gchar*") + (parameters + '("GChecksumType" "digest_type") + '("const-guchar*" "key") + '("gsize" "key_len") + '("const-gchar*" "str") + '("gssize" "length") + ) +) + + + +;; From ghook.h + +(define-method init + (of-object "GHookList") + (c-name "g_hook_list_init") + (return-type "none") + (parameters + '("guint" "hook_size") + ) +) + +(define-method clear + (of-object "GHookList") + (c-name "g_hook_list_clear") + (return-type "none") +) + +(define-function g_hook_alloc + (c-name "g_hook_alloc") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + ) +) + +(define-function g_hook_free + (c-name "g_hook_free") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + ) +) + +(define-function g_hook_ref + (c-name "g_hook_ref") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + ) +) + +(define-function g_hook_unref + (c-name "g_hook_unref") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + ) +) + +(define-function g_hook_destroy + (c-name "g_hook_destroy") + (return-type "gboolean") + (parameters + '("GHookList*" "hook_list") + '("gulong" "hook_id") + ) +) + +(define-function g_hook_destroy_link + (c-name "g_hook_destroy_link") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + ) +) + +(define-function g_hook_prepend + (c-name "g_hook_prepend") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + ) +) + +(define-function g_hook_insert_before + (c-name "g_hook_insert_before") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "sibling") + '("GHook*" "hook") + ) +) + +(define-function g_hook_insert_sorted + (c-name "g_hook_insert_sorted") + (return-type "none") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + '("GHookCompareFunc" "func") + ) +) + +(define-function g_hook_get + (c-name "g_hook_get") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gulong" "hook_id") + ) +) + +(define-function g_hook_find + (c-name "g_hook_find") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gboolean" "need_valids") + '("GHookFindFunc" "func") + '("gpointer" "data") + ) +) + +(define-function g_hook_find_data + (c-name "g_hook_find_data") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gboolean" "need_valids") + '("gpointer" "data") + ) +) + +(define-function g_hook_find_func + (c-name "g_hook_find_func") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gboolean" "need_valids") + '("gpointer" "func") + ) +) + +(define-function g_hook_find_func_data + (c-name "g_hook_find_func_data") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gboolean" "need_valids") + '("gpointer" "func") + '("gpointer" "data") + ) +) + +(define-function g_hook_first_valid + (c-name "g_hook_first_valid") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("gboolean" "may_be_in_call") + ) +) + +(define-function g_hook_next_valid + (c-name "g_hook_next_valid") + (return-type "GHook*") + (parameters + '("GHookList*" "hook_list") + '("GHook*" "hook") + '("gboolean" "may_be_in_call") + ) +) + +(define-method compare_ids + (of-object "GHook") + (c-name "g_hook_compare_ids") + (return-type "gint") + (parameters + '("GHook*" "sibling") + ) +) + +(define-method invoke + (of-object "GHookList") + (c-name "g_hook_list_invoke") + (return-type "none") + (parameters + '("gboolean" "may_recurse") + ) +) + +(define-method invoke_check + (of-object "GHookList") + (c-name "g_hook_list_invoke_check") + (return-type "none") + (parameters + '("gboolean" "may_recurse") + ) +) + +(define-method marshal + (of-object "GHookList") + (c-name "g_hook_list_marshal") + (return-type "none") + (parameters + '("gboolean" "may_recurse") + '("GHookMarshaller" "marshaller") + '("gpointer" "marshal_data") + ) +) + +(define-method marshal_check + (of-object "GHookList") + (c-name "g_hook_list_marshal_check") + (return-type "none") + (parameters + '("gboolean" "may_recurse") + '("GHookCheckMarshaller" "marshaller") + '("gpointer" "marshal_data") + ) +) + + + +;; From ghostutils.h + +(define-function g_hostname_is_non_ascii + (c-name "g_hostname_is_non_ascii") + (return-type "gboolean") + (parameters + '("const-gchar*" "hostname") + ) +) + +(define-function g_hostname_is_ascii_encoded + (c-name "g_hostname_is_ascii_encoded") + (return-type "gboolean") + (parameters + '("const-gchar*" "hostname") + ) +) + +(define-function g_hostname_is_ip_address + (c-name "g_hostname_is_ip_address") + (return-type "gboolean") + (parameters + '("const-gchar*" "hostname") + ) +) + +(define-function g_hostname_to_ascii + (c-name "g_hostname_to_ascii") + (return-type "gchar*") + (parameters + '("const-gchar*" "hostname") + ) +) + +(define-function g_hostname_to_unicode + (c-name "g_hostname_to_unicode") + (return-type "gchar*") + (parameters + '("const-gchar*" "hostname") + ) +) + + + +;; From gi18n.h + + + +;; From gi18n-lib.h + + + +;; From giochannel.h + +(define-method init + (of-object "GIOChannel") + (c-name "g_io_channel_init") + (return-type "none") +) + +(define-method ref + (of-object "GIOChannel") + (c-name "g_io_channel_ref") + (return-type "GIOChannel*") +) + +(define-method unref + (of-object "GIOChannel") + (c-name "g_io_channel_unref") + (return-type "none") +) + +(define-method read + (of-object "GIOChannel") + (c-name "g_io_channel_read") + (return-type "GIOError") + (parameters + '("gchar*" "buf") + '("gsize" "count") + '("gsize*" "bytes_read") + ) +) + +(define-method write + (of-object "GIOChannel") + (c-name "g_io_channel_write") + (return-type "GIOError") + (parameters + '("const-gchar*" "buf") + '("gsize" "count") + '("gsize*" "bytes_written") + ) +) + +(define-method seek + (of-object "GIOChannel") + (c-name "g_io_channel_seek") + (return-type "GIOError") + (parameters + '("gint64" "offset") + '("GSeekType" "type") + ) +) + +(define-method close + (of-object "GIOChannel") + (c-name "g_io_channel_close") + (return-type "none") +) + +(define-method shutdown + (of-object "GIOChannel") + (c-name "g_io_channel_shutdown") + (return-type "GIOStatus") + (parameters + '("gboolean" "flush") + '("GError**" "err") + ) +) + +(define-function g_io_add_watch_full + (c-name "g_io_add_watch_full") + (return-type "guint") + (parameters + '("GIOChannel*" "channel") + '("gint" "priority") + '("GIOCondition" "condition") + '("GIOFunc" "func") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_io_create_watch + (c-name "g_io_create_watch") + (return-type "GSource*") + (parameters + '("GIOChannel*" "channel") + '("GIOCondition" "condition") + ) +) + +(define-function g_io_add_watch + (c-name "g_io_add_watch") + (return-type "guint") + (parameters + '("GIOChannel*" "channel") + '("GIOCondition" "condition") + '("GIOFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method set_buffer_size + (of-object "GIOChannel") + (c-name "g_io_channel_set_buffer_size") + (return-type "none") + (parameters + '("gsize" "size") + ) +) + +(define-method get_buffer_size + (of-object "GIOChannel") + (c-name "g_io_channel_get_buffer_size") + (return-type "gsize") +) + +(define-method get_buffer_condition + (of-object "GIOChannel") + (c-name "g_io_channel_get_buffer_condition") + (return-type "GIOCondition") +) + +(define-method set_flags + (of-object "GIOChannel") + (c-name "g_io_channel_set_flags") + (return-type "GIOStatus") + (parameters + '("GIOFlags" "flags") + '("GError**" "error") + ) +) + +(define-method get_flags + (of-object "GIOChannel") + (c-name "g_io_channel_get_flags") + (return-type "GIOFlags") +) + +(define-method set_line_term + (of-object "GIOChannel") + (c-name "g_io_channel_set_line_term") + (return-type "none") + (parameters + '("const-gchar*" "line_term") + '("gint" "length") + ) +) + +(define-method get_line_term + (of-object "GIOChannel") + (c-name "g_io_channel_get_line_term") + (return-type "const-gchar*") + (parameters + '("gint*" "length") + ) +) + +(define-method set_buffered + (of-object "GIOChannel") + (c-name "g_io_channel_set_buffered") + (return-type "none") + (parameters + '("gboolean" "buffered") + ) +) + +(define-method get_buffered + (of-object "GIOChannel") + (c-name "g_io_channel_get_buffered") + (return-type "gboolean") +) + +(define-method set_encoding + (of-object "GIOChannel") + (c-name "g_io_channel_set_encoding") + (return-type "GIOStatus") + (parameters + '("const-gchar*" "encoding") + '("GError**" "error") + ) +) + +(define-method get_encoding + (of-object "GIOChannel") + (c-name "g_io_channel_get_encoding") + (return-type "const-gchar*") +) + +(define-method set_close_on_unref + (of-object "GIOChannel") + (c-name "g_io_channel_set_close_on_unref") + (return-type "none") + (parameters + '("gboolean" "do_close") + ) +) + +(define-method get_close_on_unref + (of-object "GIOChannel") + (c-name "g_io_channel_get_close_on_unref") + (return-type "gboolean") +) + +(define-method flush + (of-object "GIOChannel") + (c-name "g_io_channel_flush") + (return-type "GIOStatus") + (parameters + '("GError**" "error") + ) +) + +(define-method read_line + (of-object "GIOChannel") + (c-name "g_io_channel_read_line") + (return-type "GIOStatus") + (parameters + '("gchar**" "str_return") + '("gsize*" "length") + '("gsize*" "terminator_pos") + '("GError**" "error") + ) +) + +(define-method read_line_string + (of-object "GIOChannel") + (c-name "g_io_channel_read_line_string") + (return-type "GIOStatus") + (parameters + '("GString*" "buffer") + '("gsize*" "terminator_pos") + '("GError**" "error") + ) +) + +(define-method read_to_end + (of-object "GIOChannel") + (c-name "g_io_channel_read_to_end") + (return-type "GIOStatus") + (parameters + '("gchar**" "str_return") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method read_chars + (of-object "GIOChannel") + (c-name "g_io_channel_read_chars") + (return-type "GIOStatus") + (parameters + '("gchar*" "buf") + '("gsize" "count") + '("gsize*" "bytes_read") + '("GError**" "error") + ) +) + +(define-method read_unichar + (of-object "GIOChannel") + (c-name "g_io_channel_read_unichar") + (return-type "GIOStatus") + (parameters + '("gunichar*" "thechar") + '("GError**" "error") + ) +) + +(define-method write_chars + (of-object "GIOChannel") + (c-name "g_io_channel_write_chars") + (return-type "GIOStatus") + (parameters + '("const-gchar*" "buf") + '("gssize" "count") + '("gsize*" "bytes_written") + '("GError**" "error") + ) +) + +(define-method write_unichar + (of-object "GIOChannel") + (c-name "g_io_channel_write_unichar") + (return-type "GIOStatus") + (parameters + '("gunichar" "thechar") + '("GError**" "error") + ) +) + +(define-method seek_position + (of-object "GIOChannel") + (c-name "g_io_channel_seek_position") + (return-type "GIOStatus") + (parameters + '("gint64" "offset") + '("GSeekType" "type") + '("GError**" "error") + ) +) + +(define-function g_io_channel_new_file + (c-name "g_io_channel_new_file") + (return-type "GIOChannel*") + (parameters + '("const-gchar*" "filename") + '("const-gchar*" "mode") + '("GError**" "error") + ) +) + +(define-function g_io_channel_error_quark + (c-name "g_io_channel_error_quark") + (return-type "GQuark") +) + +(define-function g_io_channel_error_from_errno + (c-name "g_io_channel_error_from_errno") + (return-type "GIOChannelError") + (parameters + '("gint" "en") + ) +) + +(define-function g_io_channel_unix_new + (c-name "g_io_channel_unix_new") + (is-constructor-of "GIoChannelUnix") + (return-type "GIOChannel*") + (parameters + '("int" "fd") + ) +) + +(define-method unix_get_fd + (of-object "GIOChannel") + (c-name "g_io_channel_unix_get_fd") + (return-type "gint") +) + +(define-method win32_make_pollfd + (of-object "GIOChannel") + (c-name "g_io_channel_win32_make_pollfd") + (return-type "none") + (parameters + '("GIOCondition" "condition") + '("GPollFD*" "fd") + ) +) + +(define-function g_io_channel_win32_poll + (c-name "g_io_channel_win32_poll") + (return-type "gint") + (parameters + '("GPollFD*" "fds") + '("gint" "n_fds") + '("gint" "timeout_") + ) +) + +(define-function g_io_channel_win32_new_messages + (c-name "g_io_channel_win32_new_messages") + (return-type "GIOChannel*") + (parameters + '("gsize" "hwnd") + ) +) + +(define-function g_io_channel_win32_new_fd + (c-name "g_io_channel_win32_new_fd") + (return-type "GIOChannel*") + (parameters + '("gint" "fd") + ) +) + +(define-method win32_get_fd + (of-object "GIOChannel") + (c-name "g_io_channel_win32_get_fd") + (return-type "gint") +) + +(define-function g_io_channel_win32_new_socket + (c-name "g_io_channel_win32_new_socket") + (return-type "GIOChannel*") + (parameters + '("gint" "socket") + ) +) + +(define-function g_io_channel_win32_new_stream_socket + (c-name "g_io_channel_win32_new_stream_socket") + (return-type "GIOChannel*") + (parameters + '("gint" "socket") + ) +) + +(define-method win32_set_debug + (of-object "GIOChannel") + (c-name "g_io_channel_win32_set_debug") + (return-type "none") + (parameters + '("gboolean" "flag") + ) +) + +(define-function g_io_channel_new_file_utf8 + (c-name "g_io_channel_new_file_utf8") + (return-type "GIOChannel*") + (parameters + '("const-gchar*" "filename") + '("const-gchar*" "mode") + '("GError**" "error") + ) +) + + + +;; From gkeyfile.h + +(define-function g_key_file_error_quark + (c-name "g_key_file_error_quark") + (return-type "GQuark") +) + +(define-function g_key_file_new + (c-name "g_key_file_new") + (is-constructor-of "GKeyFile") + (return-type "GKeyFile*") +) + +(define-method ref + (of-object "GKeyFile") + (c-name "g_key_file_ref") + (return-type "GKeyFile*") +) + +(define-method unref + (of-object "GKeyFile") + (c-name "g_key_file_unref") + (return-type "none") +) + +(define-method free + (of-object "GKeyFile") + (c-name "g_key_file_free") + (return-type "none") +) + +(define-method set_list_separator + (of-object "GKeyFile") + (c-name "g_key_file_set_list_separator") + (return-type "none") + (parameters + '("gchar" "separator") + ) +) + +(define-method load_from_file + (of-object "GKeyFile") + (c-name "g_key_file_load_from_file") + (return-type "gboolean") + (parameters + '("const-gchar*" "file") + '("GKeyFileFlags" "flags") + '("GError**" "error") + ) +) + +(define-method load_from_data + (of-object "GKeyFile") + (c-name "g_key_file_load_from_data") + (return-type "gboolean") + (parameters + '("const-gchar*" "data") + '("gsize" "length") + '("GKeyFileFlags" "flags") + '("GError**" "error") + ) +) + +(define-method load_from_dirs + (of-object "GKeyFile") + (c-name "g_key_file_load_from_dirs") + (return-type "gboolean") + (parameters + '("const-gchar*" "file") + '("const-gchar**" "search_dirs") + '("gchar**" "full_path") + '("GKeyFileFlags" "flags") + '("GError**" "error") + ) +) + +(define-method load_from_data_dirs + (of-object "GKeyFile") + (c-name "g_key_file_load_from_data_dirs") + (return-type "gboolean") + (parameters + '("const-gchar*" "file") + '("gchar**" "full_path") + '("GKeyFileFlags" "flags") + '("GError**" "error") + ) +) + +(define-method to_data + (of-object "GKeyFile") + (c-name "g_key_file_to_data") + (return-type "gchar*") + (parameters + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method save_to_file + (of-object "GKeyFile") + (c-name "g_key_file_save_to_file") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("GError**" "error") + ) +) + +(define-method get_start_group + (of-object "GKeyFile") + (c-name "g_key_file_get_start_group") + (return-type "gchar*") +) + +(define-method get_groups + (of-object "GKeyFile") + (c-name "g_key_file_get_groups") + (return-type "gchar**") + (parameters + '("gsize*" "length") + ) +) + +(define-method get_keys + (of-object "GKeyFile") + (c-name "g_key_file_get_keys") + (return-type "gchar**") + (parameters + '("const-gchar*" "group_name") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method has_group + (of-object "GKeyFile") + (c-name "g_key_file_has_group") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + ) +) + +(define-method has_key + (of-object "GKeyFile") + (c-name "g_key_file_has_key") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method get_value + (of-object "GKeyFile") + (c-name "g_key_file_get_value") + (return-type "gchar*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_value + (of-object "GKeyFile") + (c-name "g_key_file_set_value") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "value") + ) +) + +(define-method get_string + (of-object "GKeyFile") + (c-name "g_key_file_get_string") + (return-type "gchar*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_string + (of-object "GKeyFile") + (c-name "g_key_file_set_string") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "string") + ) +) + +(define-method get_locale_string + (of-object "GKeyFile") + (c-name "g_key_file_get_locale_string") + (return-type "gchar*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "locale") + '("GError**" "error") + ) +) + +(define-method set_locale_string + (of-object "GKeyFile") + (c-name "g_key_file_set_locale_string") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "locale") + '("const-gchar*" "string") + ) +) + +(define-method get_boolean + (of-object "GKeyFile") + (c-name "g_key_file_get_boolean") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_boolean + (of-object "GKeyFile") + (c-name "g_key_file_set_boolean") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gboolean" "value") + ) +) + +(define-method get_integer + (of-object "GKeyFile") + (c-name "g_key_file_get_integer") + (return-type "gint") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_integer + (of-object "GKeyFile") + (c-name "g_key_file_set_integer") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gint" "value") + ) +) + +(define-method get_int64 + (of-object "GKeyFile") + (c-name "g_key_file_get_int64") + (return-type "gint64") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_int64 + (of-object "GKeyFile") + (c-name "g_key_file_set_int64") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gint64" "value") + ) +) + +(define-method get_uint64 + (of-object "GKeyFile") + (c-name "g_key_file_get_uint64") + (return-type "guint64") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_uint64 + (of-object "GKeyFile") + (c-name "g_key_file_set_uint64") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("guint64" "value") + ) +) + +(define-method get_double + (of-object "GKeyFile") + (c-name "g_key_file_get_double") + (return-type "gdouble") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method set_double + (of-object "GKeyFile") + (c-name "g_key_file_set_double") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gdouble" "value") + ) +) + +(define-method get_string_list + (of-object "GKeyFile") + (c-name "g_key_file_get_string_list") + (return-type "gchar**") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method set_string_list + (of-object "GKeyFile") + (c-name "g_key_file_set_string_list") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*-const[]" "list") + '("gsize" "length") + ) +) + +(define-method get_locale_string_list + (of-object "GKeyFile") + (c-name "g_key_file_get_locale_string_list") + (return-type "gchar**") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "locale") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method set_locale_string_list + (of-object "GKeyFile") + (c-name "g_key_file_set_locale_string_list") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "locale") + '("const-gchar*-const[]" "list") + '("gsize" "length") + ) +) + +(define-method get_boolean_list + (of-object "GKeyFile") + (c-name "g_key_file_get_boolean_list") + (return-type "gboolean*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method set_boolean_list + (of-object "GKeyFile") + (c-name "g_key_file_set_boolean_list") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gboolean[]" "list") + '("gsize" "length") + ) +) + +(define-method get_integer_list + (of-object "GKeyFile") + (c-name "g_key_file_get_integer_list") + (return-type "gint*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method set_double_list + (of-object "GKeyFile") + (c-name "g_key_file_set_double_list") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gdouble[]" "list") + '("gsize" "length") + ) +) + +(define-method get_double_list + (of-object "GKeyFile") + (c-name "g_key_file_get_double_list") + (return-type "gdouble*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method set_integer_list + (of-object "GKeyFile") + (c-name "g_key_file_set_integer_list") + (return-type "none") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("gint[]" "list") + '("gsize" "length") + ) +) + +(define-method set_comment + (of-object "GKeyFile") + (c-name "g_key_file_set_comment") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("const-gchar*" "comment") + '("GError**" "error") + ) +) + +(define-method get_comment + (of-object "GKeyFile") + (c-name "g_key_file_get_comment") + (return-type "gchar*") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method remove_comment + (of-object "GKeyFile") + (c-name "g_key_file_remove_comment") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method remove_key + (of-object "GKeyFile") + (c-name "g_key_file_remove_key") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("const-gchar*" "key") + '("GError**" "error") + ) +) + +(define-method remove_group + (of-object "GKeyFile") + (c-name "g_key_file_remove_group") + (return-type "gboolean") + (parameters + '("const-gchar*" "group_name") + '("GError**" "error") + ) +) + + + +;; From glib-autocleanups.h + +(define-function g_autoptr_cleanup_generic_gfree + (c-name "g_autoptr_cleanup_generic_gfree") + (return-type "none") + (parameters + '("void*" "p") + ) +) + + + +;; From glibconfig.h + + + +;; From glib.h + + + +;; From glib-init.h + +(define-function g_thread_win32_thread_detach + (c-name "g_thread_win32_thread_detach") + (return-type "none") +) + +(define-function g_thread_win32_init + (c-name "g_thread_win32_init") + (return-type "none") +) + +(define-function g_clock_win32_init + (c-name "g_clock_win32_init") + (return-type "none") +) + + + +;; From glibintl.h + +(define-function glib_gettext + (c-name "glib_gettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "str") + ) +) + +(define-function glib_pgettext + (c-name "glib_pgettext") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "msgctxtid") + '("gsize" "msgidoffset") + ) +) + + + +;; From glib-object.h + + + +;; From glib_trace.h + + + +;; From glib-unix.h + +(define-function g_unix_error_quark + (c-name "g_unix_error_quark") + (return-type "GQuark") +) + +(define-function g_unix_open_pipe + (c-name "g_unix_open_pipe") + (return-type "gboolean") + (parameters + '("gint*" "fds") + '("gint" "flags") + '("GError**" "error") + ) +) + +(define-function g_unix_set_fd_nonblocking + (c-name "g_unix_set_fd_nonblocking") + (return-type "gboolean") + (parameters + '("gint" "fd") + '("gboolean" "nonblock") + '("GError**" "error") + ) +) + +(define-function g_unix_signal_source_new + (c-name "g_unix_signal_source_new") + (is-constructor-of "GUnixSignalSource") + (return-type "GSource*") + (parameters + '("gint" "signum") + ) +) + +(define-function g_unix_signal_add_full + (c-name "g_unix_signal_add_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("gint" "signum") + '("GSourceFunc" "handler") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_unix_signal_add + (c-name "g_unix_signal_add") + (return-type "guint") + (parameters + '("gint" "signum") + '("GSourceFunc" "handler") + '("gpointer" "user_data") + ) +) + +(define-function g_unix_fd_source_new + (c-name "g_unix_fd_source_new") + (is-constructor-of "GUnixFdSource") + (return-type "GSource*") + (parameters + '("gint" "fd") + '("GIOCondition" "condition") + ) +) + +(define-function g_unix_fd_add_full + (c-name "g_unix_fd_add_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("gint" "fd") + '("GIOCondition" "condition") + '("GUnixFDSourceFunc" "function") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_unix_fd_add + (c-name "g_unix_fd_add") + (return-type "guint") + (parameters + '("gint" "fd") + '("GIOCondition" "condition") + '("GUnixFDSourceFunc" "function") + '("gpointer" "user_data") + ) +) + + + +;; From glist.h + +(define-function g_list_alloc + (c-name "g_list_alloc") + (return-type "GList*") +) + +(define-method free + (of-object "GList") + (c-name "g_list_free") + (return-type "none") +) + +(define-method free_1 + (of-object "GList") + (c-name "g_list_free_1") + (return-type "none") +) + +(define-method free_full + (of-object "GList") + (c-name "g_list_free_full") + (return-type "none") + (parameters + '("GDestroyNotify" "free_func") + ) +) + +(define-method append + (of-object "GList") + (c-name "g_list_append") + (return-type "GList*") + (parameters + '("gpointer" "data") + ) +) + +(define-method prepend + (of-object "GList") + (c-name "g_list_prepend") + (return-type "GList*") + (parameters + '("gpointer" "data") + ) +) + +(define-method insert + (of-object "GList") + (c-name "g_list_insert") + (return-type "GList*") + (parameters + '("gpointer" "data") + '("gint" "position") + ) +) + +(define-method insert_sorted + (of-object "GList") + (c-name "g_list_insert_sorted") + (return-type "GList*") + (parameters + '("gpointer" "data") + '("GCompareFunc" "func") + ) +) + +(define-method insert_sorted_with_data + (of-object "GList") + (c-name "g_list_insert_sorted_with_data") + (return-type "GList*") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method insert_before + (of-object "GList") + (c-name "g_list_insert_before") + (return-type "GList*") + (parameters + '("GList*" "sibling") + '("gpointer" "data") + ) +) + +(define-method concat + (of-object "GList") + (c-name "g_list_concat") + (return-type "GList*") + (parameters + '("GList*" "list2") + ) +) + +(define-method remove + (of-object "GList") + (c-name "g_list_remove") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove_all + (of-object "GList") + (c-name "g_list_remove_all") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove_link + (of-object "GList") + (c-name "g_list_remove_link") + (return-type "GList*") + (parameters + '("GList*" "llink") + ) +) + +(define-method delete_link + (of-object "GList") + (c-name "g_list_delete_link") + (return-type "GList*") + (parameters + '("GList*" "link_") + ) +) + +(define-method reverse + (of-object "GList") + (c-name "g_list_reverse") + (return-type "GList*") +) + +(define-method copy + (of-object "GList") + (c-name "g_list_copy") + (return-type "GList*") +) + +(define-method copy_deep + (of-object "GList") + (c-name "g_list_copy_deep") + (return-type "GList*") + (parameters + '("GCopyFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method nth + (of-object "GList") + (c-name "g_list_nth") + (return-type "GList*") + (parameters + '("guint" "n") + ) +) + +(define-method nth_prev + (of-object "GList") + (c-name "g_list_nth_prev") + (return-type "GList*") + (parameters + '("guint" "n") + ) +) + +(define-method find + (of-object "GList") + (c-name "g_list_find") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method find_custom + (of-object "GList") + (c-name "g_list_find_custom") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + '("GCompareFunc" "func") + ) +) + +(define-method position + (of-object "GList") + (c-name "g_list_position") + (return-type "gint") + (parameters + '("GList*" "llink") + ) +) + +(define-method index + (of-object "GList") + (c-name "g_list_index") + (return-type "gint") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method last + (of-object "GList") + (c-name "g_list_last") + (return-type "GList*") +) + +(define-method first + (of-object "GList") + (c-name "g_list_first") + (return-type "GList*") +) + +(define-method length + (of-object "GList") + (c-name "g_list_length") + (return-type "guint") +) + +(define-method foreach + (of-object "GList") + (c-name "g_list_foreach") + (return-type "none") + (parameters + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method sort + (of-object "GList") + (c-name "g_list_sort") + (return-type "GList*") + (parameters + '("GCompareFunc" "compare_func") + ) +) + +(define-method sort_with_data + (of-object "GList") + (c-name "g_list_sort_with_data") + (return-type "GList*") + (parameters + '("GCompareDataFunc" "compare_func") + '("gpointer" "user_data") + ) +) + +(define-method nth_data + (of-object "GList") + (c-name "g_list_nth_data") + (return-type "gpointer") + (parameters + '("guint" "n") + ) +) + + + +;; From gmacros.h + + + +;; From gmain.h + +(define-function g_main_context_new + (c-name "g_main_context_new") + (is-constructor-of "GMainContext") + (return-type "GMainContext*") +) + (define-method ref (of-object "GMainContext") (c-name "g_main_context_ref") (return-type "GMainContext*") ) +(define-method unref + (of-object "GMainContext") + (c-name "g_main_context_unref") + (return-type "none") +) + +(define-function g_main_context_default + (c-name "g_main_context_default") + (return-type "GMainContext*") +) + +(define-method iteration + (of-object "GMainContext") + (c-name "g_main_context_iteration") + (return-type "gboolean") + (parameters + '("gboolean" "may_block") + ) +) + +(define-method pending + (of-object "GMainContext") + (c-name "g_main_context_pending") + (return-type "gboolean") +) + +(define-method find_source_by_id + (of-object "GMainContext") + (c-name "g_main_context_find_source_by_id") + (return-type "GSource*") + (parameters + '("guint" "source_id") + ) +) + +(define-method find_source_by_user_data + (of-object "GMainContext") + (c-name "g_main_context_find_source_by_user_data") + (return-type "GSource*") + (parameters + '("gpointer" "user_data") + ) +) + +(define-method find_source_by_funcs_user_data + (of-object "GMainContext") + (c-name "g_main_context_find_source_by_funcs_user_data") + (return-type "GSource*") + (parameters + '("GSourceFuncs*" "funcs") + '("gpointer" "user_data") + ) +) + +(define-method wakeup + (of-object "GMainContext") + (c-name "g_main_context_wakeup") + (return-type "none") +) + +(define-method acquire + (of-object "GMainContext") + (c-name "g_main_context_acquire") + (return-type "gboolean") +) + +(define-method release + (of-object "GMainContext") + (c-name "g_main_context_release") + (return-type "none") +) + +(define-method is_owner + (of-object "GMainContext") + (c-name "g_main_context_is_owner") + (return-type "gboolean") +) + +(define-method wait + (of-object "GMainContext") + (c-name "g_main_context_wait") + (return-type "gboolean") + (parameters + '("GCond*" "cond") + '("GMutex*" "mutex") + ) +) + +(define-method prepare + (of-object "GMainContext") + (c-name "g_main_context_prepare") + (return-type "gboolean") + (parameters + '("gint*" "priority") + ) +) + +(define-method query + (of-object "GMainContext") + (c-name "g_main_context_query") + (return-type "gint") + (parameters + '("gint" "max_priority") + '("gint*" "timeout_") + '("GPollFD*" "fds") + '("gint" "n_fds") + ) +) + +(define-method check + (of-object "GMainContext") + (c-name "g_main_context_check") + (return-type "gint") + (parameters + '("gint" "max_priority") + '("GPollFD*" "fds") + '("gint" "n_fds") + ) +) + +(define-method dispatch + (of-object "GMainContext") + (c-name "g_main_context_dispatch") + (return-type "none") +) + +(define-method set_poll_func + (of-object "GMainContext") + (c-name "g_main_context_set_poll_func") + (return-type "none") + (parameters + '("GPollFunc" "func") + ) +) + +(define-method get_poll_func + (of-object "GMainContext") + (c-name "g_main_context_get_poll_func") + (return-type "GPollFunc") +) + +(define-method add_poll + (of-object "GMainContext") + (c-name "g_main_context_add_poll") + (return-type "none") + (parameters + '("GPollFD*" "fd") + '("gint" "priority") + ) +) + +(define-method remove_poll + (of-object "GMainContext") + (c-name "g_main_context_remove_poll") + (return-type "none") + (parameters + '("GPollFD*" "fd") + ) +) + +(define-function g_main_depth + (c-name "g_main_depth") + (return-type "gint") +) + +(define-function g_main_current_source + (c-name "g_main_current_source") + (return-type "GSource*") +) + +(define-method push_thread_default + (of-object "GMainContext") + (c-name "g_main_context_push_thread_default") + (return-type "none") +) + +(define-method pop_thread_default + (of-object "GMainContext") + (c-name "g_main_context_pop_thread_default") + (return-type "none") +) + +(define-function g_main_context_get_thread_default + (c-name "g_main_context_get_thread_default") + (return-type "GMainContext*") +) + +(define-function g_main_context_ref_thread_default + (c-name "g_main_context_ref_thread_default") + (return-type "GMainContext*") +) + +(define-function g_main_loop_new + (c-name "g_main_loop_new") + (is-constructor-of "GMainLoop") + (return-type "GMainLoop*") + (parameters + '("GMainContext*" "context") + '("gboolean" "is_running") + ) +) + +(define-method run + (of-object "GMainLoop") + (c-name "g_main_loop_run") + (return-type "none") +) + +(define-method quit + (of-object "GMainLoop") + (c-name "g_main_loop_quit") + (return-type "none") +) + +(define-method ref + (of-object "GMainLoop") + (c-name "g_main_loop_ref") + (return-type "GMainLoop*") +) + +(define-method unref + (of-object "GMainLoop") + (c-name "g_main_loop_unref") + (return-type "none") +) + +(define-method is_running + (of-object "GMainLoop") + (c-name "g_main_loop_is_running") + (return-type "gboolean") +) + +(define-method get_context + (of-object "GMainLoop") + (c-name "g_main_loop_get_context") + (return-type "GMainContext*") +) + +(define-function g_source_new + (c-name "g_source_new") + (is-constructor-of "GSource") + (return-type "GSource*") + (parameters + '("GSourceFuncs*" "source_funcs") + '("guint" "struct_size") + ) +) + +(define-method ref + (of-object "GSource") + (c-name "g_source_ref") + (return-type "GSource*") +) + +(define-method unref + (of-object "GSource") + (c-name "g_source_unref") + (return-type "none") +) + +(define-method attach + (of-object "GSource") + (c-name "g_source_attach") + (return-type "guint") + (parameters + '("GMainContext*" "context") + ) +) + +(define-method destroy + (of-object "GSource") + (c-name "g_source_destroy") + (return-type "none") +) + +(define-method set_priority + (of-object "GSource") + (c-name "g_source_set_priority") + (return-type "none") + (parameters + '("gint" "priority") + ) +) + +(define-method get_priority + (of-object "GSource") + (c-name "g_source_get_priority") + (return-type "gint") +) + +(define-method set_can_recurse + (of-object "GSource") + (c-name "g_source_set_can_recurse") + (return-type "none") + (parameters + '("gboolean" "can_recurse") + ) +) + +(define-method get_can_recurse + (of-object "GSource") + (c-name "g_source_get_can_recurse") + (return-type "gboolean") +) + +(define-method get_id + (of-object "GSource") + (c-name "g_source_get_id") + (return-type "guint") +) + +(define-method get_context + (of-object "GSource") + (c-name "g_source_get_context") + (return-type "GMainContext*") +) + +(define-method set_callback + (of-object "GSource") + (c-name "g_source_set_callback") + (return-type "none") + (parameters + '("GSourceFunc" "func") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-method set_funcs + (of-object "GSource") + (c-name "g_source_set_funcs") + (return-type "none") + (parameters + '("GSourceFuncs*" "funcs") + ) +) + +(define-method is_destroyed + (of-object "GSource") + (c-name "g_source_is_destroyed") + (return-type "gboolean") +) + +(define-method set_name + (of-object "GSource") + (c-name "g_source_set_name") + (return-type "none") + (parameters + '("const-char*" "name") + ) +) + +(define-method get_name + (of-object "GSource") + (c-name "g_source_get_name") + (return-type "const-char*") +) + +(define-function g_source_set_name_by_id + (c-name "g_source_set_name_by_id") + (return-type "none") + (parameters + '("guint" "tag") + '("const-char*" "name") + ) +) + +(define-method set_ready_time + (of-object "GSource") + (c-name "g_source_set_ready_time") + (return-type "none") + (parameters + '("gint64" "ready_time") + ) +) + +(define-method get_ready_time + (of-object "GSource") + (c-name "g_source_get_ready_time") + (return-type "gint64") +) + +(define-method add_unix_fd + (of-object "GSource") + (c-name "g_source_add_unix_fd") + (return-type "gpointer") + (parameters + '("gint" "fd") + '("GIOCondition" "events") + ) +) + +(define-method modify_unix_fd + (of-object "GSource") + (c-name "g_source_modify_unix_fd") + (return-type "none") + (parameters + '("gpointer" "tag") + '("GIOCondition" "new_events") + ) +) + +(define-method remove_unix_fd + (of-object "GSource") + (c-name "g_source_remove_unix_fd") + (return-type "none") + (parameters + '("gpointer" "tag") + ) +) + +(define-method query_unix_fd + (of-object "GSource") + (c-name "g_source_query_unix_fd") + (return-type "GIOCondition") + (parameters + '("gpointer" "tag") + ) +) + +(define-method set_callback_indirect + (of-object "GSource") + (c-name "g_source_set_callback_indirect") + (return-type "none") + (parameters + '("gpointer" "callback_data") + '("GSourceCallbackFuncs*" "callback_funcs") + ) +) + +(define-method add_poll + (of-object "GSource") + (c-name "g_source_add_poll") + (return-type "none") + (parameters + '("GPollFD*" "fd") + ) +) + +(define-method remove_poll + (of-object "GSource") + (c-name "g_source_remove_poll") + (return-type "none") + (parameters + '("GPollFD*" "fd") + ) +) + +(define-method add_child_source + (of-object "GSource") + (c-name "g_source_add_child_source") + (return-type "none") + (parameters + '("GSource*" "child_source") + ) +) + +(define-method remove_child_source + (of-object "GSource") + (c-name "g_source_remove_child_source") + (return-type "none") + (parameters + '("GSource*" "child_source") + ) +) + +(define-method get_current_time + (of-object "GSource") + (c-name "g_source_get_current_time") + (return-type "none") + (parameters + '("GTimeVal*" "timeval") + ) +) + +(define-method get_time + (of-object "GSource") + (c-name "g_source_get_time") + (return-type "gint64") +) + +(define-function g_idle_source_new + (c-name "g_idle_source_new") + (is-constructor-of "GIdleSource") + (return-type "GSource*") +) + +(define-function g_child_watch_source_new + (c-name "g_child_watch_source_new") + (is-constructor-of "GChildWatchSource") + (return-type "GSource*") + (parameters + '("GPid" "pid") + ) +) + +(define-function g_timeout_source_new + (c-name "g_timeout_source_new") + (is-constructor-of "GTimeoutSource") + (return-type "GSource*") + (parameters + '("guint" "interval") + ) +) + +(define-function g_timeout_source_new_seconds + (c-name "g_timeout_source_new_seconds") + (return-type "GSource*") + (parameters + '("guint" "interval") + ) +) + +(define-function g_get_current_time + (c-name "g_get_current_time") + (return-type "none") + (parameters + '("GTimeVal*" "result") + ) +) + +(define-function g_get_monotonic_time + (c-name "g_get_monotonic_time") + (return-type "gint64") +) + +(define-function g_get_real_time + (c-name "g_get_real_time") + (return-type "gint64") +) + +(define-function g_source_remove + (c-name "g_source_remove") + (return-type "gboolean") + (parameters + '("guint" "tag") + ) +) + +(define-function g_source_remove_by_user_data + (c-name "g_source_remove_by_user_data") + (return-type "gboolean") + (parameters + '("gpointer" "user_data") + ) +) + +(define-function g_source_remove_by_funcs_user_data + (c-name "g_source_remove_by_funcs_user_data") + (return-type "gboolean") + (parameters + '("GSourceFuncs*" "funcs") + '("gpointer" "user_data") + ) +) + +(define-function g_timeout_add_full + (c-name "g_timeout_add_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("guint" "interval") + '("GSourceFunc" "function") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_timeout_add + (c-name "g_timeout_add") + (return-type "guint") + (parameters + '("guint" "interval") + '("GSourceFunc" "function") + '("gpointer" "data") + ) +) + +(define-function g_timeout_add_seconds_full + (c-name "g_timeout_add_seconds_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("guint" "interval") + '("GSourceFunc" "function") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_timeout_add_seconds + (c-name "g_timeout_add_seconds") + (return-type "guint") + (parameters + '("guint" "interval") + '("GSourceFunc" "function") + '("gpointer" "data") + ) +) + +(define-function g_child_watch_add_full + (c-name "g_child_watch_add_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("GPid" "pid") + '("GChildWatchFunc" "function") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_child_watch_add + (c-name "g_child_watch_add") + (return-type "guint") + (parameters + '("GPid" "pid") + '("GChildWatchFunc" "function") + '("gpointer" "data") + ) +) + +(define-function g_idle_add + (c-name "g_idle_add") + (return-type "guint") + (parameters + '("GSourceFunc" "function") + '("gpointer" "data") + ) +) + +(define-function g_idle_add_full + (c-name "g_idle_add_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("GSourceFunc" "function") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_idle_remove_by_data + (c-name "g_idle_remove_by_data") + (return-type "gboolean") + (parameters + '("gpointer" "data") + ) +) + +(define-method invoke_full + (of-object "GMainContext") + (c-name "g_main_context_invoke_full") + (return-type "none") + (parameters + '("gint" "priority") + '("GSourceFunc" "function") + '("gpointer" "data") + '("GDestroyNotify" "notify") + ) +) + +(define-method invoke + (of-object "GMainContext") + (c-name "g_main_context_invoke") + (return-type "none") + (parameters + '("GSourceFunc" "function") + '("gpointer" "data") + ) +) + + + +;; From gmain-internal.h + + + +;; From gmappedfile.h + +(define-function g_mapped_file_new + (c-name "g_mapped_file_new") + (is-constructor-of "GMappedFile") + (return-type "GMappedFile*") + (parameters + '("const-gchar*" "filename") + '("gboolean" "writable") + '("GError**" "error") + ) +) + +(define-function g_mapped_file_new_from_fd + (c-name "g_mapped_file_new_from_fd") + (return-type "GMappedFile*") + (parameters + '("gint" "fd") + '("gboolean" "writable") + '("GError**" "error") + ) +) + +(define-method get_length + (of-object "GMappedFile") + (c-name "g_mapped_file_get_length") + (return-type "gsize") +) + +(define-method get_contents + (of-object "GMappedFile") + (c-name "g_mapped_file_get_contents") + (return-type "gchar*") +) + +(define-method get_bytes + (of-object "GMappedFile") + (c-name "g_mapped_file_get_bytes") + (return-type "GBytes*") +) + +(define-method ref + (of-object "GMappedFile") + (c-name "g_mapped_file_ref") + (return-type "GMappedFile*") +) + +(define-method unref + (of-object "GMappedFile") + (c-name "g_mapped_file_unref") + (return-type "none") +) + +(define-method free + (of-object "GMappedFile") + (c-name "g_mapped_file_free") + (return-type "none") +) + + + +;; From gmarkup.h + +(define-function g_markup_error_quark + (c-name "g_markup_error_quark") + (return-type "GQuark") +) + +(define-function g_markup_parse_context_new + (c-name "g_markup_parse_context_new") + (is-constructor-of "GMarkupParseContext") + (return-type "GMarkupParseContext*") + (parameters + '("const-GMarkupParser*" "parser") + '("GMarkupParseFlags" "flags") + '("gpointer" "user_data") + '("GDestroyNotify" "user_data_dnotify") + ) +) + +(define-method ref + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_ref") + (return-type "GMarkupParseContext*") +) + +(define-method unref + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_unref") + (return-type "none") +) + +(define-method free + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_free") + (return-type "none") +) + +(define-method parse + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_parse") + (return-type "gboolean") + (parameters + '("const-gchar*" "text") + '("gssize" "text_len") + '("GError**" "error") + ) +) + +(define-method push + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_push") + (return-type "none") + (parameters + '("const-GMarkupParser*" "parser") + '("gpointer" "user_data") + ) +) + +(define-method pop + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_pop") + (return-type "gpointer") +) + +(define-method end_parse + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_end_parse") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method get_element + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_get_element") + (return-type "const-gchar*") +) + +(define-method get_element_stack + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_get_element_stack") + (return-type "const-GSList*") +) + +(define-method get_position + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_get_position") + (return-type "none") + (parameters + '("gint*" "line_number") + '("gint*" "char_number") + ) +) + +(define-method get_user_data + (of-object "GMarkupParseContext") + (c-name "g_markup_parse_context_get_user_data") + (return-type "gpointer") +) + +(define-function g_markup_escape_text + (c-name "g_markup_escape_text") + (return-type "gchar*") + (parameters + '("const-gchar*" "text") + '("gssize" "length") + ) +) + +(define-function g_markup_printf_escaped + (c-name "g_markup_printf_escaped") + (return-type "gchar*") + (parameters + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function g_markup_vprintf_escaped + (c-name "g_markup_vprintf_escaped") + (return-type "gchar*") + (parameters + '("const-char*" "format") + '("va_list" "args") + ) +) + +(define-function g_markup_collect_attributes + (c-name "g_markup_collect_attributes") + (return-type "gboolean") + (parameters + '("const-gchar*" "element_name") + '("const-gchar**" "attribute_names") + '("const-gchar**" "attribute_values") + '("GError**" "error") + '("GMarkupCollectType" "first_type") + '("const-gchar*" "first_attr") + ) + (varargs #t) +) + + + +;; From gmem.h + +(define-function g_free + (c-name "g_free") + (return-type "none") + (parameters + '("gpointer" "mem") + ) +) + +(define-function g_clear_pointer + (c-name "g_clear_pointer") + (return-type "none") + (parameters + '("gpointer*" "pp") + '("GDestroyNotify" "destroy") + ) +) + +(define-function g_malloc + (c-name "g_malloc") + (return-type "gpointer") + (parameters + '("gsize" "n_bytes") + ) +) + +(define-function g_malloc0 + (c-name "g_malloc0") + (return-type "gpointer") + (parameters + '("gsize" "n_bytes") + ) +) + +(define-function g_realloc + (c-name "g_realloc") + (return-type "gpointer") + (parameters + '("gpointer" "mem") + '("gsize" "n_bytes") + ) +) + +(define-function g_try_malloc + (c-name "g_try_malloc") + (return-type "gpointer") + (parameters + '("gsize" "n_bytes") + ) +) + +(define-function g_try_malloc0 + (c-name "g_try_malloc0") + (return-type "gpointer") + (parameters + '("gsize" "n_bytes") + ) +) + +(define-function g_try_realloc + (c-name "g_try_realloc") + (return-type "gpointer") + (parameters + '("gpointer" "mem") + '("gsize" "n_bytes") + ) +) + +(define-function g_malloc_n + (c-name "g_malloc_n") + (return-type "gpointer") + (parameters + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_malloc0_n + (c-name "g_malloc0_n") + (return-type "gpointer") + (parameters + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_realloc_n + (c-name "g_realloc_n") + (return-type "gpointer") + (parameters + '("gpointer" "mem") + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_try_malloc_n + (c-name "g_try_malloc_n") + (return-type "gpointer") + (parameters + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_try_malloc0_n + (c-name "g_try_malloc0_n") + (return-type "gpointer") + (parameters + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_try_realloc_n + (c-name "g_try_realloc_n") + (return-type "gpointer") + (parameters + '("gpointer" "mem") + '("gsize" "n_blocks") + '("gsize" "n_block_bytes") + ) +) + +(define-function g_steal_pointer + (c-name "g_steal_pointer") + (return-type "gpointer") + (parameters + '("gpointer" "pp") + ) +) + +(define-function g_mem_set_vtable + (c-name "g_mem_set_vtable") + (return-type "none") + (parameters + '("GMemVTable*" "vtable") + ) +) + +(define-function g_mem_is_system_malloc + (c-name "g_mem_is_system_malloc") + (return-type "gboolean") +) + +(define-function g_mem_profile + (c-name "g_mem_profile") + (return-type "none") +) + + + +;; From gmessages.h + +(define-function g_printf_string_upper_bound + (c-name "g_printf_string_upper_bound") + (return-type "gsize") + (parameters + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-function g_log_set_handler + (c-name "g_log_set_handler") + (return-type "guint") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "log_levels") + '("GLogFunc" "log_func") + '("gpointer" "user_data") + ) +) + +(define-function g_log_set_handler_full + (c-name "g_log_set_handler_full") + (return-type "guint") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "log_levels") + '("GLogFunc" "log_func") + '("gpointer" "user_data") + '("GDestroyNotify" "destroy") + ) +) + +(define-function g_log_remove_handler + (c-name "g_log_remove_handler") + (return-type "none") + (parameters + '("const-gchar*" "log_domain") + '("guint" "handler_id") + ) +) + +(define-function g_log_default_handler + (c-name "g_log_default_handler") + (return-type "none") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "log_level") + '("const-gchar*" "message") + '("gpointer" "unused_data") + ) +) + +(define-function g_log_set_default_handler + (c-name "g_log_set_default_handler") + (return-type "GLogFunc") + (parameters + '("GLogFunc" "log_func") + '("gpointer" "user_data") + ) +) + +(define-function g_log + (c-name "g_log") + (return-type "none") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "log_level") + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_logv + (c-name "g_logv") + (return-type "none") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "log_level") + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-function g_log_set_fatal_mask + (c-name "g_log_set_fatal_mask") + (return-type "GLogLevelFlags") + (parameters + '("const-gchar*" "log_domain") + '("GLogLevelFlags" "fatal_mask") + ) +) + +(define-function g_log_set_always_fatal + (c-name "g_log_set_always_fatal") + (return-type "GLogLevelFlags") + (parameters + '("GLogLevelFlags" "fatal_mask") + ) +) + +(define-function g_return_if_fail_warning + (c-name "g_return_if_fail_warning") + (return-type "none") + (parameters + '("const-char*" "log_domain") + '("const-char*" "pretty_function") + '("const-char*" "expression") + ) +) + +(define-function g_warn_message + (c-name "g_warn_message") + (return-type "none") + (parameters + '("const-char*" "domain") + '("const-char*" "file") + '("int" "line") + '("const-char*" "func") + '("const-char*" "warnexpr") + ) +) + +(define-function g_assert_warning + (c-name "g_assert_warning") + (return-type "none") + (parameters + '("const-char*" "log_domain") + '("const-char*" "file") + '("const-int" "line") + '("const-char*" "pretty_function") + '("const-char*" "expression") + ) +) + +(define-function g_error + (c-name "g_error") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_critical + (c-name "g_critical") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_message + (c-name "g_message") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_warning + (c-name "g_warning") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_info + (c-name "g_info") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_debug + (c-name "g_debug") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_print + (c-name "g_print") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_set_print_handler + (c-name "g_set_print_handler") + (return-type "GPrintFunc") + (parameters + '("GPrintFunc" "func") + ) +) + +(define-function g_printerr + (c-name "g_printerr") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_set_printerr_handler + (c-name "g_set_printerr_handler") + (return-type "GPrintFunc") + (parameters + '("GPrintFunc" "func") + ) +) + + + +;; From gmirroringtable.h + + + +;; From gnode.h + +(define-function g_node_new + (c-name "g_node_new") + (is-constructor-of "GNode") + (return-type "GNode*") + (parameters + '("gpointer" "data") + ) +) + +(define-method destroy + (of-object "GNode") + (c-name "g_node_destroy") + (return-type "none") +) + +(define-method unlink + (of-object "GNode") + (c-name "g_node_unlink") + (return-type "none") +) + +(define-method copy_deep + (of-object "GNode") + (c-name "g_node_copy_deep") + (return-type "GNode*") + (parameters + '("GCopyFunc" "copy_func") + '("gpointer" "data") + ) +) + +(define-method copy + (of-object "GNode") + (c-name "g_node_copy") + (return-type "GNode*") +) + +(define-method insert + (of-object "GNode") + (c-name "g_node_insert") + (return-type "GNode*") + (parameters + '("gint" "position") + '("GNode*" "node") + ) +) + +(define-method insert_before + (of-object "GNode") + (c-name "g_node_insert_before") + (return-type "GNode*") + (parameters + '("GNode*" "sibling") + '("GNode*" "node") + ) +) + +(define-method insert_after + (of-object "GNode") + (c-name "g_node_insert_after") + (return-type "GNode*") + (parameters + '("GNode*" "sibling") + '("GNode*" "node") + ) +) + +(define-method prepend + (of-object "GNode") + (c-name "g_node_prepend") + (return-type "GNode*") + (parameters + '("GNode*" "node") + ) +) + +(define-method n_nodes + (of-object "GNode") + (c-name "g_node_n_nodes") + (return-type "guint") + (parameters + '("GTraverseFlags" "flags") + ) +) + +(define-method get_root + (of-object "GNode") + (c-name "g_node_get_root") + (return-type "GNode*") +) + +(define-method is_ancestor + (of-object "GNode") + (c-name "g_node_is_ancestor") + (return-type "gboolean") + (parameters + '("GNode*" "descendant") + ) +) + +(define-method depth + (of-object "GNode") + (c-name "g_node_depth") + (return-type "guint") +) + +(define-method find + (of-object "GNode") + (c-name "g_node_find") + (return-type "GNode*") + (parameters + '("GTraverseType" "order") + '("GTraverseFlags" "flags") + '("gpointer" "data") + ) +) + +(define-method traverse + (of-object "GNode") + (c-name "g_node_traverse") + (return-type "none") + (parameters + '("GTraverseType" "order") + '("GTraverseFlags" "flags") + '("gint" "max_depth") + '("GNodeTraverseFunc" "func") + '("gpointer" "data") + ) +) + +(define-method max_height + (of-object "GNode") + (c-name "g_node_max_height") + (return-type "guint") +) + +(define-method children_foreach + (of-object "GNode") + (c-name "g_node_children_foreach") + (return-type "none") + (parameters + '("GTraverseFlags" "flags") + '("GNodeForeachFunc" "func") + '("gpointer" "data") + ) +) + +(define-method reverse_children + (of-object "GNode") + (c-name "g_node_reverse_children") + (return-type "none") +) + +(define-method n_children + (of-object "GNode") + (c-name "g_node_n_children") + (return-type "guint") +) + +(define-method nth_child + (of-object "GNode") + (c-name "g_node_nth_child") + (return-type "GNode*") + (parameters + '("guint" "n") + ) +) + +(define-method last_child + (of-object "GNode") + (c-name "g_node_last_child") + (return-type "GNode*") +) + +(define-method find_child + (of-object "GNode") + (c-name "g_node_find_child") + (return-type "GNode*") + (parameters + '("GTraverseFlags" "flags") + '("gpointer" "data") + ) +) + +(define-method child_position + (of-object "GNode") + (c-name "g_node_child_position") + (return-type "gint") + (parameters + '("GNode*" "child") + ) +) + +(define-method child_index + (of-object "GNode") + (c-name "g_node_child_index") + (return-type "gint") + (parameters + '("gpointer" "data") + ) +) + +(define-method first_sibling + (of-object "GNode") + (c-name "g_node_first_sibling") + (return-type "GNode*") +) + +(define-method last_sibling + (of-object "GNode") + (c-name "g_node_last_sibling") + (return-type "GNode*") +) + + + +;; From goption.h + +(define-function g_option_error_quark + (c-name "g_option_error_quark") + (return-type "GQuark") +) + +(define-function g_option_context_new + (c-name "g_option_context_new") + (is-constructor-of "GOptionContext") + (return-type "GOptionContext*") + (parameters + '("const-gchar*" "parameter_string") + ) +) + +(define-method set_summary + (of-object "GOptionContext") + (c-name "g_option_context_set_summary") + (return-type "none") + (parameters + '("const-gchar*" "summary") + ) +) + +(define-method get_summary + (of-object "GOptionContext") + (c-name "g_option_context_get_summary") + (return-type "const-gchar*") +) + +(define-method set_description + (of-object "GOptionContext") + (c-name "g_option_context_set_description") + (return-type "none") + (parameters + '("const-gchar*" "description") + ) +) + +(define-method get_description + (of-object "GOptionContext") + (c-name "g_option_context_get_description") + (return-type "const-gchar*") +) + +(define-method free + (of-object "GOptionContext") + (c-name "g_option_context_free") + (return-type "none") +) + +(define-method set_help_enabled + (of-object "GOptionContext") + (c-name "g_option_context_set_help_enabled") + (return-type "none") + (parameters + '("gboolean" "help_enabled") + ) +) + +(define-method get_help_enabled + (of-object "GOptionContext") + (c-name "g_option_context_get_help_enabled") + (return-type "gboolean") +) + +(define-method set_ignore_unknown_options + (of-object "GOptionContext") + (c-name "g_option_context_set_ignore_unknown_options") + (return-type "none") + (parameters + '("gboolean" "ignore_unknown") + ) +) + +(define-method get_ignore_unknown_options + (of-object "GOptionContext") + (c-name "g_option_context_get_ignore_unknown_options") + (return-type "gboolean") +) + +(define-method set_strict_posix + (of-object "GOptionContext") + (c-name "g_option_context_set_strict_posix") + (return-type "none") + (parameters + '("gboolean" "strict_posix") + ) +) + +(define-method get_strict_posix + (of-object "GOptionContext") + (c-name "g_option_context_get_strict_posix") + (return-type "gboolean") +) + +(define-method add_main_entries + (of-object "GOptionContext") + (c-name "g_option_context_add_main_entries") + (return-type "none") + (parameters + '("const-GOptionEntry*" "entries") + '("const-gchar*" "translation_domain") + ) +) + +(define-method parse + (of-object "GOptionContext") + (c-name "g_option_context_parse") + (return-type "gboolean") + (parameters + '("gint*" "argc") + '("gchar***" "argv") + '("GError**" "error") + ) +) + +(define-method parse_strv + (of-object "GOptionContext") + (c-name "g_option_context_parse_strv") + (return-type "gboolean") + (parameters + '("gchar***" "arguments") + '("GError**" "error") + ) +) + +(define-method set_translate_func + (of-object "GOptionContext") + (c-name "g_option_context_set_translate_func") + (return-type "none") + (parameters + '("GTranslateFunc" "func") + '("gpointer" "data") + '("GDestroyNotify" "destroy_notify") + ) +) + +(define-method set_translation_domain + (of-object "GOptionContext") + (c-name "g_option_context_set_translation_domain") + (return-type "none") + (parameters + '("const-gchar*" "domain") + ) +) + +(define-method add_group + (of-object "GOptionContext") + (c-name "g_option_context_add_group") + (return-type "none") + (parameters + '("GOptionGroup*" "group") + ) +) + +(define-method set_main_group + (of-object "GOptionContext") + (c-name "g_option_context_set_main_group") + (return-type "none") + (parameters + '("GOptionGroup*" "group") + ) +) + +(define-method get_main_group + (of-object "GOptionContext") + (c-name "g_option_context_get_main_group") + (return-type "GOptionGroup*") +) + +(define-method get_help + (of-object "GOptionContext") + (c-name "g_option_context_get_help") + (return-type "gchar*") + (parameters + '("gboolean" "main_help") + '("GOptionGroup*" "group") + ) +) + +(define-function g_option_group_new + (c-name "g_option_group_new") + (is-constructor-of "GOptionGroup") + (return-type "GOptionGroup*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "description") + '("const-gchar*" "help_description") + '("gpointer" "user_data") + '("GDestroyNotify" "destroy") + ) +) + +(define-method set_parse_hooks + (of-object "GOptionGroup") + (c-name "g_option_group_set_parse_hooks") + (return-type "none") + (parameters + '("GOptionParseFunc" "pre_parse_func") + '("GOptionParseFunc" "post_parse_func") + ) +) + +(define-method set_error_hook + (of-object "GOptionGroup") + (c-name "g_option_group_set_error_hook") + (return-type "none") + (parameters + '("GOptionErrorFunc" "error_func") + ) +) + +(define-method free + (of-object "GOptionGroup") + (c-name "g_option_group_free") + (return-type "none") +) + +(define-method ref + (of-object "GOptionGroup") + (c-name "g_option_group_ref") + (return-type "GOptionGroup*") +) + +(define-method unref + (of-object "GOptionGroup") + (c-name "g_option_group_unref") + (return-type "none") +) + +(define-method add_entries + (of-object "GOptionGroup") + (c-name "g_option_group_add_entries") + (return-type "none") + (parameters + '("const-GOptionEntry*" "entries") + ) +) + +(define-method set_translate_func + (of-object "GOptionGroup") + (c-name "g_option_group_set_translate_func") + (return-type "none") + (parameters + '("GTranslateFunc" "func") + '("gpointer" "data") + '("GDestroyNotify" "destroy_notify") + ) +) + +(define-method set_translation_domain + (of-object "GOptionGroup") + (c-name "g_option_group_set_translation_domain") + (return-type "none") + (parameters + '("const-gchar*" "domain") + ) +) + + + +;; From gpattern.h + +(define-function g_pattern_spec_new + (c-name "g_pattern_spec_new") + (is-constructor-of "GPatternSpec") + (return-type "GPatternSpec*") + (parameters + '("const-gchar*" "pattern") + ) +) + +(define-method free + (of-object "GPatternSpec") + (c-name "g_pattern_spec_free") + (return-type "none") +) + +(define-method equal + (of-object "GPatternSpec") + (c-name "g_pattern_spec_equal") + (return-type "gboolean") + (parameters + '("GPatternSpec*" "pspec2") + ) +) + +(define-function g_pattern_match + (c-name "g_pattern_match") + (return-type "gboolean") + (parameters + '("GPatternSpec*" "pspec") + '("guint" "string_length") + '("const-gchar*" "string") + '("const-gchar*" "string_reversed") + ) +) + +(define-function g_pattern_match_string + (c-name "g_pattern_match_string") + (return-type "gboolean") + (parameters + '("GPatternSpec*" "pspec") + '("const-gchar*" "string") + ) +) + +(define-function g_pattern_match_simple + (c-name "g_pattern_match_simple") + (return-type "gboolean") + (parameters + '("const-gchar*" "pattern") + '("const-gchar*" "string") + ) +) + + + +;; From gpoll.h + +(define-function g_poll + (c-name "g_poll") + (return-type "gint") + (parameters + '("GPollFD*" "fds") + '("guint" "nfds") + '("gint" "timeout") + ) +) + + + +;; From gprimes.h + +(define-function g_spaced_primes_closest + (c-name "g_spaced_primes_closest") + (return-type "guint") + (parameters + '("guint" "num") + ) +) + + + +;; From gprintf.h + +(define-function g_printf + (c-name "g_printf") + (return-type "gint") + (parameters + '("gchar-const*" "format") + ) + (varargs #t) +) + +(define-function g_fprintf + (c-name "g_fprintf") + (return-type "gint") + (parameters + '("FILE*" "file") + '("gchar-const*" "format") + ) + (varargs #t) +) + +(define-function g_sprintf + (c-name "g_sprintf") + (return-type "gint") + (parameters + '("gchar*" "string") + '("gchar-const*" "format") + ) + (varargs #t) +) + +(define-function g_vprintf + (c-name "g_vprintf") + (return-type "gint") + (parameters + '("gchar-const*" "format") + '("va_list" "args") + ) +) + +(define-function g_vfprintf + (c-name "g_vfprintf") + (return-type "gint") + (parameters + '("FILE*" "file") + '("gchar-const*" "format") + '("va_list" "args") + ) +) + +(define-function g_vsprintf + (c-name "g_vsprintf") + (return-type "gint") + (parameters + '("gchar*" "string") + '("gchar-const*" "format") + '("va_list" "args") + ) +) + +(define-function g_vasprintf + (c-name "g_vasprintf") + (return-type "gint") + (parameters + '("gchar**" "string") + '("gchar-const*" "format") + '("va_list" "args") + ) +) + + + +;; From gprintfint.h + + + +;; From gqsort.h + +(define-function g_qsort_with_data + (c-name "g_qsort_with_data") + (return-type "none") + (parameters + '("gconstpointer" "pbase") + '("gint" "total_elems") + '("gsize" "size") + '("GCompareDataFunc" "compare_func") + '("gpointer" "user_data") + ) +) + + + +;; From gquark.h + +(define-function g_quark_try_string + (c-name "g_quark_try_string") + (return-type "GQuark") + (parameters + '("const-gchar*" "string") + ) +) + +(define-function g_quark_from_static_string + (c-name "g_quark_from_static_string") + (return-type "GQuark") + (parameters + '("const-gchar*" "string") + ) +) + +(define-function g_quark_from_string + (c-name "g_quark_from_string") + (return-type "GQuark") + (parameters + '("const-gchar*" "string") + ) +) + +(define-method to_string + (of-object "GQuark") + (c-name "g_quark_to_string") + (return-type "const-gchar*") +) + +(define-function g_intern_string + (c-name "g_intern_string") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "string") + ) +) + +(define-function g_intern_static_string + (c-name "g_intern_static_string") + (return-type "const-gchar*") + (parameters + '("const-gchar*" "string") + ) +) + + + +;; From gqueue.h + +(define-function g_queue_new + (c-name "g_queue_new") + (is-constructor-of "GQueue") + (return-type "GQueue*") +) + +(define-method free + (of-object "GQueue") + (c-name "g_queue_free") + (return-type "none") +) + +(define-method free_full + (of-object "GQueue") + (c-name "g_queue_free_full") + (return-type "none") + (parameters + '("GDestroyNotify" "free_func") + ) +) + +(define-method init + (of-object "GQueue") + (c-name "g_queue_init") + (return-type "none") +) + +(define-method clear + (of-object "GQueue") + (c-name "g_queue_clear") + (return-type "none") +) + +(define-method is_empty + (of-object "GQueue") + (c-name "g_queue_is_empty") + (return-type "gboolean") +) + +(define-method get_length + (of-object "GQueue") + (c-name "g_queue_get_length") + (return-type "guint") +) + +(define-method reverse + (of-object "GQueue") + (c-name "g_queue_reverse") + (return-type "none") +) + +(define-method copy + (of-object "GQueue") + (c-name "g_queue_copy") + (return-type "GQueue*") +) + +(define-method foreach + (of-object "GQueue") + (c-name "g_queue_foreach") + (return-type "none") + (parameters + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method find + (of-object "GQueue") + (c-name "g_queue_find") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method find_custom + (of-object "GQueue") + (c-name "g_queue_find_custom") + (return-type "GList*") + (parameters + '("gconstpointer" "data") + '("GCompareFunc" "func") + ) +) + +(define-method sort + (of-object "GQueue") + (c-name "g_queue_sort") + (return-type "none") + (parameters + '("GCompareDataFunc" "compare_func") + '("gpointer" "user_data") + ) +) + +(define-method push_head + (of-object "GQueue") + (c-name "g_queue_push_head") + (return-type "none") + (parameters + '("gpointer" "data") + ) +) + +(define-method push_tail + (of-object "GQueue") + (c-name "g_queue_push_tail") + (return-type "none") + (parameters + '("gpointer" "data") + ) +) + +(define-method push_nth + (of-object "GQueue") + (c-name "g_queue_push_nth") + (return-type "none") + (parameters + '("gpointer" "data") + '("gint" "n") + ) +) + +(define-method pop_head + (of-object "GQueue") + (c-name "g_queue_pop_head") + (return-type "gpointer") +) + +(define-method pop_tail + (of-object "GQueue") + (c-name "g_queue_pop_tail") + (return-type "gpointer") +) + +(define-method pop_nth + (of-object "GQueue") + (c-name "g_queue_pop_nth") + (return-type "gpointer") + (parameters + '("guint" "n") + ) +) + +(define-method peek_head + (of-object "GQueue") + (c-name "g_queue_peek_head") + (return-type "gpointer") +) + +(define-method peek_tail + (of-object "GQueue") + (c-name "g_queue_peek_tail") + (return-type "gpointer") +) + +(define-method peek_nth + (of-object "GQueue") + (c-name "g_queue_peek_nth") + (return-type "gpointer") + (parameters + '("guint" "n") + ) +) + +(define-method index + (of-object "GQueue") + (c-name "g_queue_index") + (return-type "gint") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove + (of-object "GQueue") + (c-name "g_queue_remove") + (return-type "gboolean") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove_all + (of-object "GQueue") + (c-name "g_queue_remove_all") + (return-type "guint") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method insert_before + (of-object "GQueue") + (c-name "g_queue_insert_before") + (return-type "none") + (parameters + '("GList*" "sibling") + '("gpointer" "data") + ) +) + +(define-method insert_after + (of-object "GQueue") + (c-name "g_queue_insert_after") + (return-type "none") + (parameters + '("GList*" "sibling") + '("gpointer" "data") + ) +) + +(define-method insert_sorted + (of-object "GQueue") + (c-name "g_queue_insert_sorted") + (return-type "none") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method push_head_link + (of-object "GQueue") + (c-name "g_queue_push_head_link") + (return-type "none") + (parameters + '("GList*" "link_") + ) +) + +(define-method push_tail_link + (of-object "GQueue") + (c-name "g_queue_push_tail_link") + (return-type "none") + (parameters + '("GList*" "link_") + ) +) + +(define-method push_nth_link + (of-object "GQueue") + (c-name "g_queue_push_nth_link") + (return-type "none") + (parameters + '("gint" "n") + '("GList*" "link_") + ) +) + +(define-method pop_head_link + (of-object "GQueue") + (c-name "g_queue_pop_head_link") + (return-type "GList*") +) + +(define-method pop_tail_link + (of-object "GQueue") + (c-name "g_queue_pop_tail_link") + (return-type "GList*") +) + +(define-method pop_nth_link + (of-object "GQueue") + (c-name "g_queue_pop_nth_link") + (return-type "GList*") + (parameters + '("guint" "n") + ) +) + +(define-method peek_head_link + (of-object "GQueue") + (c-name "g_queue_peek_head_link") + (return-type "GList*") +) + +(define-method peek_tail_link + (of-object "GQueue") + (c-name "g_queue_peek_tail_link") + (return-type "GList*") +) + +(define-method peek_nth_link + (of-object "GQueue") + (c-name "g_queue_peek_nth_link") + (return-type "GList*") + (parameters + '("guint" "n") + ) +) + +(define-method link_index + (of-object "GQueue") + (c-name "g_queue_link_index") + (return-type "gint") + (parameters + '("GList*" "link_") + ) +) + +(define-method unlink + (of-object "GQueue") + (c-name "g_queue_unlink") + (return-type "none") + (parameters + '("GList*" "link_") + ) +) + +(define-method delete_link + (of-object "GQueue") + (c-name "g_queue_delete_link") + (return-type "none") + (parameters + '("GList*" "link_") + ) +) + + + +;; From grand.h + +(define-function g_rand_new_with_seed + (c-name "g_rand_new_with_seed") + (return-type "GRand*") + (parameters + '("guint32" "seed") + ) +) + +(define-function g_rand_new_with_seed_array + (c-name "g_rand_new_with_seed_array") + (return-type "GRand*") + (parameters + '("const-guint32*" "seed") + '("guint" "seed_length") + ) +) + +(define-function g_rand_new + (c-name "g_rand_new") + (is-constructor-of "GRand") + (return-type "GRand*") +) + +(define-method free + (of-object "GRand") + (c-name "g_rand_free") + (return-type "none") +) + +(define-method copy + (of-object "GRand") + (c-name "g_rand_copy") + (return-type "GRand*") +) + +(define-method set_seed + (of-object "GRand") + (c-name "g_rand_set_seed") + (return-type "none") + (parameters + '("guint32" "seed") + ) +) + +(define-method set_seed_array + (of-object "GRand") + (c-name "g_rand_set_seed_array") + (return-type "none") + (parameters + '("const-guint32*" "seed") + '("guint" "seed_length") + ) +) + +(define-method int + (of-object "GRand") + (c-name "g_rand_int") + (return-type "guint32") +) + +(define-method int_range + (of-object "GRand") + (c-name "g_rand_int_range") + (return-type "gint32") + (parameters + '("gint32" "begin") + '("gint32" "end") + ) +) + +(define-method double + (of-object "GRand") + (c-name "g_rand_double") + (return-type "gdouble") +) + +(define-method double_range + (of-object "GRand") + (c-name "g_rand_double_range") + (return-type "gdouble") + (parameters + '("gdouble" "begin") + '("gdouble" "end") + ) +) + +(define-function g_random_set_seed + (c-name "g_random_set_seed") + (return-type "none") + (parameters + '("guint32" "seed") + ) +) + +(define-function g_random_int + (c-name "g_random_int") + (return-type "guint32") +) + +(define-function g_random_int_range + (c-name "g_random_int_range") + (return-type "gint32") + (parameters + '("gint32" "begin") + '("gint32" "end") + ) +) + +(define-function g_random_double + (c-name "g_random_double") + (return-type "gdouble") +) + +(define-function g_random_double_range + (c-name "g_random_double_range") + (return-type "gdouble") + (parameters + '("gdouble" "begin") + '("gdouble" "end") + ) +) + + + +;; From gregex.h + +(define-function g_regex_error_quark + (c-name "g_regex_error_quark") + (return-type "GQuark") +) + +(define-function g_regex_new + (c-name "g_regex_new") + (is-constructor-of "GRegex") + (return-type "GRegex*") + (parameters + '("const-gchar*" "pattern") + '("GRegexCompileFlags" "compile_options") + '("GRegexMatchFlags" "match_options") + '("GError**" "error") + ) +) + +(define-method ref + (of-object "GRegex") + (c-name "g_regex_ref") + (return-type "GRegex*") +) + +(define-method unref + (of-object "GRegex") + (c-name "g_regex_unref") + (return-type "none") +) + +(define-method get_pattern + (of-object "GRegex") + (c-name "g_regex_get_pattern") + (return-type "const-gchar*") +) + +(define-method get_max_backref + (of-object "GRegex") + (c-name "g_regex_get_max_backref") + (return-type "gint") +) + +(define-method get_capture_count + (of-object "GRegex") + (c-name "g_regex_get_capture_count") + (return-type "gint") +) + +(define-method get_has_cr_or_lf + (of-object "GRegex") + (c-name "g_regex_get_has_cr_or_lf") + (return-type "gboolean") +) + +(define-method get_max_lookbehind + (of-object "GRegex") + (c-name "g_regex_get_max_lookbehind") + (return-type "gint") +) + +(define-method get_string_number + (of-object "GRegex") + (c-name "g_regex_get_string_number") + (return-type "gint") + (parameters + '("const-gchar*" "name") + ) +) + +(define-function g_regex_escape_string + (c-name "g_regex_escape_string") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gint" "length") + ) +) + +(define-function g_regex_escape_nul + (c-name "g_regex_escape_nul") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gint" "length") + ) +) + +(define-method get_compile_flags + (of-object "GRegex") + (c-name "g_regex_get_compile_flags") + (return-type "GRegexCompileFlags") +) + +(define-method get_match_flags + (of-object "GRegex") + (c-name "g_regex_get_match_flags") + (return-type "GRegexMatchFlags") +) + +(define-function g_regex_match_simple + (c-name "g_regex_match_simple") + (return-type "gboolean") + (parameters + '("const-gchar*" "pattern") + '("const-gchar*" "string") + '("GRegexCompileFlags" "compile_options") + '("GRegexMatchFlags" "match_options") + ) +) + +(define-method match + (of-object "GRegex") + (c-name "g_regex_match") + (return-type "gboolean") + (parameters + '("const-gchar*" "string") + '("GRegexMatchFlags" "match_options") + '("GMatchInfo**" "match_info") + ) +) + +(define-method match_full + (of-object "GRegex") + (c-name "g_regex_match_full") + (return-type "gboolean") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("GRegexMatchFlags" "match_options") + '("GMatchInfo**" "match_info") + '("GError**" "error") + ) +) + +(define-method match_all + (of-object "GRegex") + (c-name "g_regex_match_all") + (return-type "gboolean") + (parameters + '("const-gchar*" "string") + '("GRegexMatchFlags" "match_options") + '("GMatchInfo**" "match_info") + ) +) + +(define-method match_all_full + (of-object "GRegex") + (c-name "g_regex_match_all_full") + (return-type "gboolean") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("GRegexMatchFlags" "match_options") + '("GMatchInfo**" "match_info") + '("GError**" "error") + ) +) + +(define-function g_regex_split_simple + (c-name "g_regex_split_simple") + (return-type "gchar**") + (parameters + '("const-gchar*" "pattern") + '("const-gchar*" "string") + '("GRegexCompileFlags" "compile_options") + '("GRegexMatchFlags" "match_options") + ) +) + +(define-method split + (of-object "GRegex") + (c-name "g_regex_split") + (return-type "gchar**") + (parameters + '("const-gchar*" "string") + '("GRegexMatchFlags" "match_options") + ) +) + +(define-method split_full + (of-object "GRegex") + (c-name "g_regex_split_full") + (return-type "gchar**") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("GRegexMatchFlags" "match_options") + '("gint" "max_tokens") + '("GError**" "error") + ) +) + +(define-method replace + (of-object "GRegex") + (c-name "g_regex_replace") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("const-gchar*" "replacement") + '("GRegexMatchFlags" "match_options") + '("GError**" "error") + ) +) + +(define-method replace_literal + (of-object "GRegex") + (c-name "g_regex_replace_literal") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("const-gchar*" "replacement") + '("GRegexMatchFlags" "match_options") + '("GError**" "error") + ) +) + +(define-method replace_eval + (of-object "GRegex") + (c-name "g_regex_replace_eval") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gssize" "string_len") + '("gint" "start_position") + '("GRegexMatchFlags" "match_options") + '("GRegexEvalCallback" "eval") + '("gpointer" "user_data") + '("GError**" "error") + ) +) + +(define-function g_regex_check_replacement + (c-name "g_regex_check_replacement") + (return-type "gboolean") + (parameters + '("const-gchar*" "replacement") + '("gboolean*" "has_references") + '("GError**" "error") + ) +) + +(define-method get_regex + (of-object "GMatchInfo") + (c-name "g_match_info_get_regex") + (return-type "GRegex*") +) + +(define-method get_string + (of-object "GMatchInfo") + (c-name "g_match_info_get_string") + (return-type "const-gchar*") +) + +(define-method ref + (of-object "GMatchInfo") + (c-name "g_match_info_ref") + (return-type "GMatchInfo*") +) + +(define-method unref + (of-object "GMatchInfo") + (c-name "g_match_info_unref") + (return-type "none") +) + +(define-method free + (of-object "GMatchInfo") + (c-name "g_match_info_free") + (return-type "none") +) + +(define-method next + (of-object "GMatchInfo") + (c-name "g_match_info_next") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method matches + (of-object "GMatchInfo") + (c-name "g_match_info_matches") + (return-type "gboolean") +) + +(define-method get_match_count + (of-object "GMatchInfo") + (c-name "g_match_info_get_match_count") + (return-type "gint") +) + +(define-method is_partial_match + (of-object "GMatchInfo") + (c-name "g_match_info_is_partial_match") + (return-type "gboolean") +) + +(define-method expand_references + (of-object "GMatchInfo") + (c-name "g_match_info_expand_references") + (return-type "gchar*") + (parameters + '("const-gchar*" "string_to_expand") + '("GError**" "error") + ) +) + +(define-method fetch + (of-object "GMatchInfo") + (c-name "g_match_info_fetch") + (return-type "gchar*") + (parameters + '("gint" "match_num") + ) +) + +(define-method fetch_pos + (of-object "GMatchInfo") + (c-name "g_match_info_fetch_pos") + (return-type "gboolean") + (parameters + '("gint" "match_num") + '("gint*" "start_pos") + '("gint*" "end_pos") + ) +) + +(define-method fetch_named + (of-object "GMatchInfo") + (c-name "g_match_info_fetch_named") + (return-type "gchar*") + (parameters + '("const-gchar*" "name") + ) +) + +(define-method fetch_named_pos + (of-object "GMatchInfo") + (c-name "g_match_info_fetch_named_pos") + (return-type "gboolean") + (parameters + '("const-gchar*" "name") + '("gint*" "start_pos") + '("gint*" "end_pos") + ) +) + +(define-method fetch_all + (of-object "GMatchInfo") + (c-name "g_match_info_fetch_all") + (return-type "gchar**") +) + + + +;; From gscanner.h + +(define-function g_scanner_new + (c-name "g_scanner_new") + (is-constructor-of "GScanner") + (return-type "GScanner*") + (parameters + '("const-GScannerConfig*" "config_templ") + ) +) + +(define-method destroy + (of-object "GScanner") + (c-name "g_scanner_destroy") + (return-type "none") +) + +(define-method input_file + (of-object "GScanner") + (c-name "g_scanner_input_file") + (return-type "none") + (parameters + '("gint" "input_fd") + ) +) + +(define-method sync_file_offset + (of-object "GScanner") + (c-name "g_scanner_sync_file_offset") + (return-type "none") +) + +(define-method input_text + (of-object "GScanner") + (c-name "g_scanner_input_text") + (return-type "none") + (parameters + '("const-gchar*" "text") + '("guint" "text_len") + ) +) + +(define-method get_next_token + (of-object "GScanner") + (c-name "g_scanner_get_next_token") + (return-type "GTokenType") +) + +(define-method peek_next_token + (of-object "GScanner") + (c-name "g_scanner_peek_next_token") + (return-type "GTokenType") +) + +(define-method cur_token + (of-object "GScanner") + (c-name "g_scanner_cur_token") + (return-type "GTokenType") +) + +(define-method cur_value + (of-object "GScanner") + (c-name "g_scanner_cur_value") + (return-type "GTokenValue") +) + +(define-method cur_line + (of-object "GScanner") + (c-name "g_scanner_cur_line") + (return-type "guint") +) + +(define-method cur_position + (of-object "GScanner") + (c-name "g_scanner_cur_position") + (return-type "guint") +) + +(define-method eof + (of-object "GScanner") + (c-name "g_scanner_eof") + (return-type "gboolean") +) + +(define-method set_scope + (of-object "GScanner") + (c-name "g_scanner_set_scope") + (return-type "guint") + (parameters + '("guint" "scope_id") + ) +) + +(define-method scope_add_symbol + (of-object "GScanner") + (c-name "g_scanner_scope_add_symbol") + (return-type "none") + (parameters + '("guint" "scope_id") + '("const-gchar*" "symbol") + '("gpointer" "value") + ) +) + +(define-method scope_remove_symbol + (of-object "GScanner") + (c-name "g_scanner_scope_remove_symbol") + (return-type "none") + (parameters + '("guint" "scope_id") + '("const-gchar*" "symbol") + ) +) + +(define-method scope_lookup_symbol + (of-object "GScanner") + (c-name "g_scanner_scope_lookup_symbol") + (return-type "gpointer") + (parameters + '("guint" "scope_id") + '("const-gchar*" "symbol") + ) +) + +(define-method scope_foreach_symbol + (of-object "GScanner") + (c-name "g_scanner_scope_foreach_symbol") + (return-type "none") + (parameters + '("guint" "scope_id") + '("GHFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method lookup_symbol + (of-object "GScanner") + (c-name "g_scanner_lookup_symbol") + (return-type "gpointer") + (parameters + '("const-gchar*" "symbol") + ) +) + +(define-method unexp_token + (of-object "GScanner") + (c-name "g_scanner_unexp_token") + (return-type "none") + (parameters + '("GTokenType" "expected_token") + '("const-gchar*" "identifier_spec") + '("const-gchar*" "symbol_spec") + '("const-gchar*" "symbol_name") + '("const-gchar*" "message") + '("gint" "is_error") + ) +) + +(define-method error + (of-object "GScanner") + (c-name "g_scanner_error") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-method warn + (of-object "GScanner") + (c-name "g_scanner_warn") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + + + +;; From gscripttable.h + + + +;; From gsequence.h + +(define-function g_sequence_new + (c-name "g_sequence_new") + (is-constructor-of "GSequence") + (return-type "GSequence*") + (parameters + '("GDestroyNotify" "data_destroy") + ) +) + +(define-method free + (of-object "GSequence") + (c-name "g_sequence_free") + (return-type "none") +) + +(define-method get_length + (of-object "GSequence") + (c-name "g_sequence_get_length") + (return-type "gint") +) + +(define-method foreach + (of-object "GSequence") + (c-name "g_sequence_foreach") + (return-type "none") + (parameters + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-function g_sequence_foreach_range + (c-name "g_sequence_foreach_range") + (return-type "none") + (parameters + '("GSequenceIter*" "begin") + '("GSequenceIter*" "end") + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method sort + (of-object "GSequence") + (c-name "g_sequence_sort") + (return-type "none") + (parameters + '("GCompareDataFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-method sort_iter + (of-object "GSequence") + (c-name "g_sequence_sort_iter") + (return-type "none") + (parameters + '("GSequenceIterCompareFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-method get_begin_iter + (of-object "GSequence") + (c-name "g_sequence_get_begin_iter") + (return-type "GSequenceIter*") +) + +(define-method get_end_iter + (of-object "GSequence") + (c-name "g_sequence_get_end_iter") + (return-type "GSequenceIter*") +) + +(define-method get_iter_at_pos + (of-object "GSequence") + (c-name "g_sequence_get_iter_at_pos") + (return-type "GSequenceIter*") + (parameters + '("gint" "pos") + ) +) + +(define-method append + (of-object "GSequence") + (c-name "g_sequence_append") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + ) +) + +(define-method prepend + (of-object "GSequence") + (c-name "g_sequence_prepend") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + ) +) + +(define-function g_sequence_insert_before + (c-name "g_sequence_insert_before") + (return-type "GSequenceIter*") + (parameters + '("GSequenceIter*" "iter") + '("gpointer" "data") + ) +) + +(define-function g_sequence_move + (c-name "g_sequence_move") + (return-type "none") + (parameters + '("GSequenceIter*" "src") + '("GSequenceIter*" "dest") + ) +) + +(define-function g_sequence_swap + (c-name "g_sequence_swap") + (return-type "none") + (parameters + '("GSequenceIter*" "a") + '("GSequenceIter*" "b") + ) +) + +(define-method insert_sorted + (of-object "GSequence") + (c-name "g_sequence_insert_sorted") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-method insert_sorted_iter + (of-object "GSequence") + (c-name "g_sequence_insert_sorted_iter") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GSequenceIterCompareFunc" "iter_cmp") + '("gpointer" "cmp_data") + ) +) + +(define-function g_sequence_sort_changed + (c-name "g_sequence_sort_changed") + (return-type "none") + (parameters + '("GSequenceIter*" "iter") + '("GCompareDataFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-function g_sequence_sort_changed_iter + (c-name "g_sequence_sort_changed_iter") + (return-type "none") + (parameters + '("GSequenceIter*" "iter") + '("GSequenceIterCompareFunc" "iter_cmp") + '("gpointer" "cmp_data") + ) +) + +(define-function g_sequence_remove + (c-name "g_sequence_remove") + (return-type "none") + (parameters + '("GSequenceIter*" "iter") + ) +) + +(define-function g_sequence_remove_range + (c-name "g_sequence_remove_range") + (return-type "none") + (parameters + '("GSequenceIter*" "begin") + '("GSequenceIter*" "end") + ) +) + +(define-function g_sequence_move_range + (c-name "g_sequence_move_range") + (return-type "none") + (parameters + '("GSequenceIter*" "dest") + '("GSequenceIter*" "begin") + '("GSequenceIter*" "end") + ) +) + +(define-method search + (of-object "GSequence") + (c-name "g_sequence_search") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-method search_iter + (of-object "GSequence") + (c-name "g_sequence_search_iter") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GSequenceIterCompareFunc" "iter_cmp") + '("gpointer" "cmp_data") + ) +) + +(define-method lookup + (of-object "GSequence") + (c-name "g_sequence_lookup") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "cmp_func") + '("gpointer" "cmp_data") + ) +) + +(define-method lookup_iter + (of-object "GSequence") + (c-name "g_sequence_lookup_iter") + (return-type "GSequenceIter*") + (parameters + '("gpointer" "data") + '("GSequenceIterCompareFunc" "iter_cmp") + '("gpointer" "cmp_data") + ) +) + +(define-function g_sequence_get + (c-name "g_sequence_get") + (return-type "gpointer") + (parameters + '("GSequenceIter*" "iter") + ) +) + +(define-function g_sequence_set + (c-name "g_sequence_set") + (return-type "none") + (parameters + '("GSequenceIter*" "iter") + '("gpointer" "data") + ) +) + +(define-method is_begin + (of-object "GSequenceIter") + (c-name "g_sequence_iter_is_begin") + (return-type "gboolean") +) + +(define-method is_end + (of-object "GSequenceIter") + (c-name "g_sequence_iter_is_end") + (return-type "gboolean") +) + +(define-method next + (of-object "GSequenceIter") + (c-name "g_sequence_iter_next") + (return-type "GSequenceIter*") +) + +(define-method prev + (of-object "GSequenceIter") + (c-name "g_sequence_iter_prev") + (return-type "GSequenceIter*") +) + +(define-method get_position + (of-object "GSequenceIter") + (c-name "g_sequence_iter_get_position") + (return-type "gint") +) + +(define-method move + (of-object "GSequenceIter") + (c-name "g_sequence_iter_move") + (return-type "GSequenceIter*") + (parameters + '("gint" "delta") + ) +) + +(define-method get_sequence + (of-object "GSequenceIter") + (c-name "g_sequence_iter_get_sequence") + (return-type "GSequence*") +) + +(define-method compare + (of-object "GSequenceIter") + (c-name "g_sequence_iter_compare") + (return-type "gint") + (parameters + '("GSequenceIter*" "b") + ) +) + +(define-function g_sequence_range_get_midpoint + (c-name "g_sequence_range_get_midpoint") + (return-type "GSequenceIter*") + (parameters + '("GSequenceIter*" "begin") + '("GSequenceIter*" "end") + ) +) + + + +;; From gshell.h + +(define-function g_shell_error_quark + (c-name "g_shell_error_quark") + (return-type "GQuark") +) + +(define-function g_shell_quote + (c-name "g_shell_quote") + (return-type "gchar*") + (parameters + '("const-gchar*" "unquoted_string") + ) +) + +(define-function g_shell_unquote + (c-name "g_shell_unquote") + (return-type "gchar*") + (parameters + '("const-gchar*" "quoted_string") + '("GError**" "error") + ) +) + +(define-function g_shell_parse_argv + (c-name "g_shell_parse_argv") + (return-type "gboolean") + (parameters + '("const-gchar*" "command_line") + '("gint*" "argcp") + '("gchar***" "argvp") + '("GError**" "error") + ) +) + + + +;; From gslice.h + +(define-function g_slice_alloc + (c-name "g_slice_alloc") + (return-type "gpointer") + (parameters + '("gsize" "block_size") + ) +) + +(define-function g_slice_alloc0 + (c-name "g_slice_alloc0") + (return-type "gpointer") + (parameters + '("gsize" "block_size") + ) +) + +(define-function g_slice_copy + (c-name "g_slice_copy") + (return-type "gpointer") + (parameters + '("gsize" "block_size") + '("gconstpointer" "mem_block") + ) +) + +(define-function g_slice_free1 + (c-name "g_slice_free1") + (return-type "none") + (parameters + '("gsize" "block_size") + '("gpointer" "mem_block") + ) +) + +(define-function g_slice_free_chain_with_offset + (c-name "g_slice_free_chain_with_offset") + (return-type "none") + (parameters + '("gsize" "block_size") + '("gpointer" "mem_chain") + '("gsize" "next_offset") + ) +) + +(define-function g_slice_set_config + (c-name "g_slice_set_config") + (return-type "none") + (parameters + '("GSliceConfig" "ckey") + '("gint64" "value") + ) +) + +(define-function g_slice_get_config + (c-name "g_slice_get_config") + (return-type "gint64") + (parameters + '("GSliceConfig" "ckey") + ) +) + +(define-function g_slice_get_config_state + (c-name "g_slice_get_config_state") + (return-type "gint64*") + (parameters + '("GSliceConfig" "ckey") + '("gint64" "address") + '("guint*" "n_values") + ) +) + +(define-function g_slice_debug_tree_statistics + (c-name "g_slice_debug_tree_statistics") + (return-type "none") +) + + + +;; From gslist.h + +(define-function g_slist_alloc + (c-name "g_slist_alloc") + (return-type "GSList*") +) + +(define-method free + (of-object "GSList") + (c-name "g_slist_free") + (return-type "none") +) + +(define-method free_1 + (of-object "GSList") + (c-name "g_slist_free_1") + (return-type "none") +) + +(define-method free_full + (of-object "GSList") + (c-name "g_slist_free_full") + (return-type "none") + (parameters + '("GDestroyNotify" "free_func") + ) +) + +(define-method append + (of-object "GSList") + (c-name "g_slist_append") + (return-type "GSList*") + (parameters + '("gpointer" "data") + ) +) + +(define-method prepend + (of-object "GSList") + (c-name "g_slist_prepend") + (return-type "GSList*") + (parameters + '("gpointer" "data") + ) +) + +(define-method insert + (of-object "GSList") + (c-name "g_slist_insert") + (return-type "GSList*") + (parameters + '("gpointer" "data") + '("gint" "position") + ) +) + +(define-method insert_sorted + (of-object "GSList") + (c-name "g_slist_insert_sorted") + (return-type "GSList*") + (parameters + '("gpointer" "data") + '("GCompareFunc" "func") + ) +) + +(define-method insert_sorted_with_data + (of-object "GSList") + (c-name "g_slist_insert_sorted_with_data") + (return-type "GSList*") + (parameters + '("gpointer" "data") + '("GCompareDataFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method insert_before + (of-object "GSList") + (c-name "g_slist_insert_before") + (return-type "GSList*") + (parameters + '("GSList*" "sibling") + '("gpointer" "data") + ) +) + +(define-method concat + (of-object "GSList") + (c-name "g_slist_concat") + (return-type "GSList*") + (parameters + '("GSList*" "list2") + ) +) + +(define-method remove + (of-object "GSList") + (c-name "g_slist_remove") + (return-type "GSList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove_all + (of-object "GSList") + (c-name "g_slist_remove_all") + (return-type "GSList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method remove_link + (of-object "GSList") + (c-name "g_slist_remove_link") + (return-type "GSList*") + (parameters + '("GSList*" "link_") + ) +) + +(define-method delete_link + (of-object "GSList") + (c-name "g_slist_delete_link") + (return-type "GSList*") + (parameters + '("GSList*" "link_") + ) +) + +(define-method reverse + (of-object "GSList") + (c-name "g_slist_reverse") + (return-type "GSList*") +) + +(define-method copy + (of-object "GSList") + (c-name "g_slist_copy") + (return-type "GSList*") +) + +(define-method copy_deep + (of-object "GSList") + (c-name "g_slist_copy_deep") + (return-type "GSList*") + (parameters + '("GCopyFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method nth + (of-object "GSList") + (c-name "g_slist_nth") + (return-type "GSList*") + (parameters + '("guint" "n") + ) +) + +(define-method find + (of-object "GSList") + (c-name "g_slist_find") + (return-type "GSList*") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method find_custom + (of-object "GSList") + (c-name "g_slist_find_custom") + (return-type "GSList*") + (parameters + '("gconstpointer" "data") + '("GCompareFunc" "func") + ) +) + +(define-method position + (of-object "GSList") + (c-name "g_slist_position") + (return-type "gint") + (parameters + '("GSList*" "llink") + ) +) + +(define-method index + (of-object "GSList") + (c-name "g_slist_index") + (return-type "gint") + (parameters + '("gconstpointer" "data") + ) +) + +(define-method last + (of-object "GSList") + (c-name "g_slist_last") + (return-type "GSList*") +) + +(define-method length + (of-object "GSList") + (c-name "g_slist_length") + (return-type "guint") +) + +(define-method foreach + (of-object "GSList") + (c-name "g_slist_foreach") + (return-type "none") + (parameters + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method sort + (of-object "GSList") + (c-name "g_slist_sort") + (return-type "GSList*") + (parameters + '("GCompareFunc" "compare_func") + ) +) + +(define-method sort_with_data + (of-object "GSList") + (c-name "g_slist_sort_with_data") + (return-type "GSList*") + (parameters + '("GCompareDataFunc" "compare_func") + '("gpointer" "user_data") + ) +) + +(define-method nth_data + (of-object "GSList") + (c-name "g_slist_nth_data") + (return-type "gpointer") + (parameters + '("guint" "n") + ) +) + + + +;; From gspawn.h + +(define-function g_spawn_error_quark + (c-name "g_spawn_error_quark") + (return-type "GQuark") +) + +(define-function g_spawn_exit_error_quark + (c-name "g_spawn_exit_error_quark") + (return-type "GQuark") +) + +(define-function g_spawn_async + (c-name "g_spawn_async") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("GPid*" "child_pid") + '("GError**" "error") + ) +) + +(define-function g_spawn_async_with_pipes + (c-name "g_spawn_async_with_pipes") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("GPid*" "child_pid") + '("gint*" "standard_input") + '("gint*" "standard_output") + '("gint*" "standard_error") + '("GError**" "error") + ) +) + +(define-function g_spawn_sync + (c-name "g_spawn_sync") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("gchar**" "standard_output") + '("gchar**" "standard_error") + '("gint*" "exit_status") + '("GError**" "error") + ) +) + +(define-function g_spawn_command_line_sync + (c-name "g_spawn_command_line_sync") + (return-type "gboolean") + (parameters + '("const-gchar*" "command_line") + '("gchar**" "standard_output") + '("gchar**" "standard_error") + '("gint*" "exit_status") + '("GError**" "error") + ) +) + +(define-function g_spawn_command_line_async + (c-name "g_spawn_command_line_async") + (return-type "gboolean") + (parameters + '("const-gchar*" "command_line") + '("GError**" "error") + ) +) + +(define-function g_spawn_check_exit_status + (c-name "g_spawn_check_exit_status") + (return-type "gboolean") + (parameters + '("gint" "exit_status") + '("GError**" "error") + ) +) + +(define-function g_spawn_close_pid + (c-name "g_spawn_close_pid") + (return-type "none") + (parameters + '("GPid" "pid") + ) +) + +(define-function g_spawn_async_utf8 + (c-name "g_spawn_async_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("GPid*" "child_pid") + '("GError**" "error") + ) +) + +(define-function g_spawn_async_with_pipes_utf8 + (c-name "g_spawn_async_with_pipes_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("GPid*" "child_pid") + '("gint*" "standard_input") + '("gint*" "standard_output") + '("gint*" "standard_error") + '("GError**" "error") + ) +) + +(define-function g_spawn_sync_utf8 + (c-name "g_spawn_sync_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "working_directory") + '("gchar**" "argv") + '("gchar**" "envp") + '("GSpawnFlags" "flags") + '("GSpawnChildSetupFunc" "child_setup") + '("gpointer" "user_data") + '("gchar**" "standard_output") + '("gchar**" "standard_error") + '("gint*" "exit_status") + '("GError**" "error") + ) +) + +(define-function g_spawn_command_line_sync_utf8 + (c-name "g_spawn_command_line_sync_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "command_line") + '("gchar**" "standard_output") + '("gchar**" "standard_error") + '("gint*" "exit_status") + '("GError**" "error") + ) +) + +(define-function g_spawn_command_line_async_utf8 + (c-name "g_spawn_command_line_async_utf8") + (return-type "gboolean") + (parameters + '("const-gchar*" "command_line") + '("GError**" "error") + ) +) + + + +;; From gstdio.h + +(define-function g_access + (c-name "g_access") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("int" "mode") + ) +) + +(define-function g_chdir + (c-name "g_chdir") + (return-type "int") + (parameters + '("const-gchar*" "path") + ) +) + +(define-function g_unlink + (c-name "g_unlink") + (return-type "int") + (parameters + '("const-gchar*" "filename") + ) +) + +(define-function g_rmdir + (c-name "g_rmdir") + (return-type "int") + (parameters + '("const-gchar*" "filename") + ) +) + +(define-function g_chmod + (c-name "g_chmod") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("int" "mode") + ) +) + +(define-function g_open + (c-name "g_open") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("int" "flags") + '("int" "mode") + ) +) + +(define-function g_creat + (c-name "g_creat") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("int" "mode") + ) +) + +(define-function g_rename + (c-name "g_rename") + (return-type "int") + (parameters + '("const-gchar*" "oldfilename") + '("const-gchar*" "newfilename") + ) +) + +(define-function g_mkdir + (c-name "g_mkdir") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("int" "mode") + ) +) + +(define-function g_stat + (c-name "g_stat") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("GStatBuf*" "buf") + ) +) + +(define-function g_lstat + (c-name "g_lstat") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("GStatBuf*" "buf") + ) +) + +(define-function g_remove + (c-name "g_remove") + (return-type "int") + (parameters + '("const-gchar*" "filename") + ) +) + +(define-function g_fopen + (c-name "g_fopen") + (return-type "FILE*") + (parameters + '("const-gchar*" "filename") + '("const-gchar*" "mode") + ) +) + +(define-function g_freopen + (c-name "g_freopen") + (return-type "FILE*") + (parameters + '("const-gchar*" "filename") + '("const-gchar*" "mode") + '("FILE*" "stream") + ) +) + +(define-function g_utime + (c-name "g_utime") + (return-type "int") + (parameters + '("const-gchar*" "filename") + '("struct-utimbuf*" "utb") + ) +) + +(define-function g_close + (c-name "g_close") + (return-type "gboolean") + (parameters + '("gint" "fd") + '("GError**" "error") + ) +) + + + +;; From gstrfuncs.h + +(define-function g_ascii_tolower + (c-name "g_ascii_tolower") + (return-type "gchar") + (parameters + '("gchar" "c") + ) +) + +(define-function g_ascii_toupper + (c-name "g_ascii_toupper") + (return-type "gchar") + (parameters + '("gchar" "c") + ) +) + +(define-function g_ascii_digit_value + (c-name "g_ascii_digit_value") + (return-type "gint") + (parameters + '("gchar" "c") + ) +) + +(define-function g_ascii_xdigit_value + (c-name "g_ascii_xdigit_value") + (return-type "gint") + (parameters + '("gchar" "c") + ) +) + +(define-function g_strdelimit + (c-name "g_strdelimit") + (return-type "gchar*") + (parameters + '("gchar*" "string") + '("const-gchar*" "delimiters") + '("gchar" "new_delimiter") + ) +) + +(define-function g_strcanon + (c-name "g_strcanon") + (return-type "gchar*") + (parameters + '("gchar*" "string") + '("const-gchar*" "valid_chars") + '("gchar" "substitutor") + ) +) + +(define-function g_strerror + (c-name "g_strerror") + (return-type "const-gchar*") + (parameters + '("gint" "errnum") + ) +) + +(define-function g_strsignal + (c-name "g_strsignal") + (return-type "const-gchar*") + (parameters + '("gint" "signum") + ) +) + +(define-function g_strreverse + (c-name "g_strreverse") + (return-type "gchar*") + (parameters + '("gchar*" "string") + ) +) + +(define-function g_strlcpy + (c-name "g_strlcpy") + (return-type "gsize") + (parameters + '("gchar*" "dest") + '("const-gchar*" "src") + '("gsize" "dest_size") + ) +) + +(define-function g_strlcat + (c-name "g_strlcat") + (return-type "gsize") + (parameters + '("gchar*" "dest") + '("const-gchar*" "src") + '("gsize" "dest_size") + ) +) + +(define-function g_strstr_len + (c-name "g_strstr_len") + (return-type "gchar*") + (parameters + '("const-gchar*" "haystack") + '("gssize" "haystack_len") + '("const-gchar*" "needle") + ) +) + +(define-function g_strrstr + (c-name "g_strrstr") + (return-type "gchar*") + (parameters + '("const-gchar*" "haystack") + '("const-gchar*" "needle") + ) +) + +(define-function g_strrstr_len + (c-name "g_strrstr_len") + (return-type "gchar*") + (parameters + '("const-gchar*" "haystack") + '("gssize" "haystack_len") + '("const-gchar*" "needle") + ) +) + +(define-function g_str_has_suffix + (c-name "g_str_has_suffix") + (return-type "gboolean") + (parameters + '("const-gchar*" "str") + '("const-gchar*" "suffix") + ) +) + +(define-function g_str_has_prefix + (c-name "g_str_has_prefix") + (return-type "gboolean") + (parameters + '("const-gchar*" "str") + '("const-gchar*" "prefix") + ) +) + +(define-function g_strtod + (c-name "g_strtod") + (return-type "gdouble") + (parameters + '("const-gchar*" "nptr") + '("gchar**" "endptr") + ) +) + +(define-function g_ascii_strtod + (c-name "g_ascii_strtod") + (return-type "gdouble") + (parameters + '("const-gchar*" "nptr") + '("gchar**" "endptr") + ) +) + +(define-function g_ascii_strtoull + (c-name "g_ascii_strtoull") + (return-type "guint64") + (parameters + '("const-gchar*" "nptr") + '("gchar**" "endptr") + '("guint" "base") + ) +) + +(define-function g_ascii_strtoll + (c-name "g_ascii_strtoll") + (return-type "gint64") + (parameters + '("const-gchar*" "nptr") + '("gchar**" "endptr") + '("guint" "base") + ) +) + +(define-function g_ascii_dtostr + (c-name "g_ascii_dtostr") + (return-type "gchar*") + (parameters + '("gchar*" "buffer") + '("gint" "buf_len") + '("gdouble" "d") + ) +) + +(define-function g_ascii_formatd + (c-name "g_ascii_formatd") + (return-type "gchar*") + (parameters + '("gchar*" "buffer") + '("gint" "buf_len") + '("const-gchar*" "format") + '("gdouble" "d") + ) +) + +(define-function g_strchug + (c-name "g_strchug") + (return-type "gchar*") + (parameters + '("gchar*" "string") + ) +) + +(define-function g_strchomp + (c-name "g_strchomp") + (return-type "gchar*") + (parameters + '("gchar*" "string") + ) +) + +(define-function g_ascii_strcasecmp + (c-name "g_ascii_strcasecmp") + (return-type "gint") + (parameters + '("const-gchar*" "s1") + '("const-gchar*" "s2") + ) +) + +(define-function g_ascii_strncasecmp + (c-name "g_ascii_strncasecmp") + (return-type "gint") + (parameters + '("const-gchar*" "s1") + '("const-gchar*" "s2") + '("gsize" "n") + ) +) + +(define-function g_ascii_strdown + (c-name "g_ascii_strdown") + (return-type "gchar*") + (parameters + '("const-gchar*" "str") + '("gssize" "len") + ) +) + +(define-function g_ascii_strup + (c-name "g_ascii_strup") + (return-type "gchar*") + (parameters + '("const-gchar*" "str") + '("gssize" "len") + ) +) + +(define-function g_str_is_ascii + (c-name "g_str_is_ascii") + (return-type "gboolean") + (parameters + '("const-gchar*" "str") + ) +) + +(define-function g_strcasecmp + (c-name "g_strcasecmp") + (return-type "gint") + (parameters + '("const-gchar*" "s1") + '("const-gchar*" "s2") + ) +) + +(define-function g_strncasecmp + (c-name "g_strncasecmp") + (return-type "gint") + (parameters + '("const-gchar*" "s1") + '("const-gchar*" "s2") + '("guint" "n") + ) +) + +(define-function g_strdown + (c-name "g_strdown") + (return-type "gchar*") + (parameters + '("gchar*" "string") + ) +) + +(define-function g_strup + (c-name "g_strup") + (return-type "gchar*") + (parameters + '("gchar*" "string") + ) +) + +(define-function g_strdup + (c-name "g_strdup") + (return-type "gchar*") + (parameters + '("const-gchar*" "str") + ) +) + +(define-function g_strdup_printf + (c-name "g_strdup_printf") + (return-type "gchar*") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-function g_strdup_vprintf + (c-name "g_strdup_vprintf") + (return-type "gchar*") + (parameters + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-function g_strndup + (c-name "g_strndup") + (return-type "gchar*") + (parameters + '("const-gchar*" "str") + '("gsize" "n") + ) +) + +(define-function g_strnfill + (c-name "g_strnfill") + (return-type "gchar*") + (parameters + '("gsize" "length") + '("gchar" "fill_char") + ) +) + +(define-function g_strconcat + (c-name "g_strconcat") + (return-type "gchar*") + (parameters + '("const-gchar*" "string1") + ) + (varargs #t) +) + +(define-function g_strjoin + (c-name "g_strjoin") + (return-type "gchar*") + (parameters + '("const-gchar*" "separator") + ) + (varargs #t) +) + +(define-function g_strcompress + (c-name "g_strcompress") + (return-type "gchar*") + (parameters + '("const-gchar*" "source") + ) +) + +(define-function g_strescape + (c-name "g_strescape") + (return-type "gchar*") + (parameters + '("const-gchar*" "source") + '("const-gchar*" "exceptions") + ) +) + +(define-function g_memdup + (c-name "g_memdup") + (return-type "gpointer") + (parameters + '("gconstpointer" "mem") + '("guint" "byte_size") + ) +) + +(define-function g_strsplit + (c-name "g_strsplit") + (return-type "gchar**") + (parameters + '("const-gchar*" "string") + '("const-gchar*" "delimiter") + '("gint" "max_tokens") + ) +) + +(define-function g_strsplit_set + (c-name "g_strsplit_set") + (return-type "gchar**") + (parameters + '("const-gchar*" "string") + '("const-gchar*" "delimiters") + '("gint" "max_tokens") + ) +) + +(define-function g_strjoinv + (c-name "g_strjoinv") + (return-type "gchar*") + (parameters + '("const-gchar*" "separator") + '("gchar**" "str_array") + ) +) + +(define-function g_strfreev + (c-name "g_strfreev") + (return-type "none") + (parameters + '("gchar**" "str_array") + ) +) + +(define-function g_strdupv + (c-name "g_strdupv") + (return-type "gchar**") + (parameters + '("gchar**" "str_array") + ) +) + +(define-function g_strv_length + (c-name "g_strv_length") + (return-type "guint") + (parameters + '("gchar**" "str_array") + ) +) + +(define-function g_stpcpy + (c-name "g_stpcpy") + (return-type "gchar*") + (parameters + '("gchar*" "dest") + '("const-char*" "src") + ) +) + +(define-function g_str_to_ascii + (c-name "g_str_to_ascii") + (return-type "gchar*") + (parameters + '("const-gchar*" "str") + '("const-gchar*" "from_locale") + ) +) + +(define-function g_str_tokenize_and_fold + (c-name "g_str_tokenize_and_fold") + (return-type "gchar**") + (parameters + '("const-gchar*" "string") + '("const-gchar*" "translit_locale") + '("gchar***" "ascii_alternates") + ) +) + +(define-function g_str_match_string + (c-name "g_str_match_string") + (return-type "gboolean") + (parameters + '("const-gchar*" "search_term") + '("const-gchar*" "potential_hit") + '("gboolean" "accept_alternates") + ) +) + +(define-function g_strv_contains + (c-name "g_strv_contains") + (return-type "gboolean") + (parameters + '("const-gchar*-const*" "strv") + '("const-gchar*" "str") + ) +) + + + +;; From gstringchunk.h + +(define-function g_string_chunk_new + (c-name "g_string_chunk_new") + (is-constructor-of "GStringChunk") + (return-type "GStringChunk*") + (parameters + '("gsize" "size") + ) +) + +(define-method free + (of-object "GStringChunk") + (c-name "g_string_chunk_free") + (return-type "none") +) + +(define-method clear + (of-object "GStringChunk") + (c-name "g_string_chunk_clear") + (return-type "none") +) + +(define-method insert + (of-object "GStringChunk") + (c-name "g_string_chunk_insert") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + ) +) + +(define-method insert_len + (of-object "GStringChunk") + (c-name "g_string_chunk_insert_len") + (return-type "gchar*") + (parameters + '("const-gchar*" "string") + '("gssize" "len") + ) +) + + + +;; From gstring.h + +(define-function g_string_new + (c-name "g_string_new") + (is-constructor-of "GString") + (return-type "GString*") + (parameters + '("const-gchar*" "init") + ) +) + +(define-function g_string_new_len + (c-name "g_string_new_len") + (return-type "GString*") + (parameters + '("const-gchar*" "init") + '("gssize" "len") + ) +) + +(define-function g_string_sized_new + (c-name "g_string_sized_new") + (is-constructor-of "GStringSized") + (return-type "GString*") + (parameters + '("gsize" "dfl_size") + ) +) + +(define-method free + (of-object "GString") + (c-name "g_string_free") + (return-type "gchar*") + (parameters + '("gboolean" "free_segment") + ) +) + +(define-method free_to_bytes + (of-object "GString") + (c-name "g_string_free_to_bytes") + (return-type "GBytes*") +) + +(define-method equal + (of-object "GString") + (c-name "g_string_equal") + (return-type "gboolean") + (parameters + '("const-GString*" "v2") + ) +) + +(define-method hash + (of-object "GString") + (c-name "g_string_hash") + (return-type "guint") +) + +(define-method assign + (of-object "GString") + (c-name "g_string_assign") + (return-type "GString*") + (parameters + '("const-gchar*" "rval") + ) +) + +(define-method truncate + (of-object "GString") + (c-name "g_string_truncate") + (return-type "GString*") + (parameters + '("gsize" "len") + ) +) + +(define-method set_size + (of-object "GString") + (c-name "g_string_set_size") + (return-type "GString*") + (parameters + '("gsize" "len") + ) +) + +(define-method insert_len + (of-object "GString") + (c-name "g_string_insert_len") + (return-type "GString*") + (parameters + '("gssize" "pos") + '("const-gchar*" "val") + '("gssize" "len") + ) +) + +(define-method append + (of-object "GString") + (c-name "g_string_append") + (return-type "GString*") + (parameters + '("const-gchar*" "val") + ) +) + +(define-method append_len + (of-object "GString") + (c-name "g_string_append_len") + (return-type "GString*") + (parameters + '("const-gchar*" "val") + '("gssize" "len") + ) +) + +(define-method append_c + (of-object "GString") + (c-name "g_string_append_c") + (return-type "GString*") + (parameters + '("gchar" "c") + ) +) + +(define-method append_unichar + (of-object "GString") + (c-name "g_string_append_unichar") + (return-type "GString*") + (parameters + '("gunichar" "wc") + ) +) + +(define-method prepend + (of-object "GString") + (c-name "g_string_prepend") + (return-type "GString*") + (parameters + '("const-gchar*" "val") + ) +) + +(define-method prepend_c + (of-object "GString") + (c-name "g_string_prepend_c") + (return-type "GString*") + (parameters + '("gchar" "c") + ) +) + +(define-method prepend_unichar + (of-object "GString") + (c-name "g_string_prepend_unichar") + (return-type "GString*") + (parameters + '("gunichar" "wc") + ) +) + +(define-method prepend_len + (of-object "GString") + (c-name "g_string_prepend_len") + (return-type "GString*") + (parameters + '("const-gchar*" "val") + '("gssize" "len") + ) +) + +(define-method insert + (of-object "GString") + (c-name "g_string_insert") + (return-type "GString*") + (parameters + '("gssize" "pos") + '("const-gchar*" "val") + ) +) + +(define-method insert_c + (of-object "GString") + (c-name "g_string_insert_c") + (return-type "GString*") + (parameters + '("gssize" "pos") + '("gchar" "c") + ) +) + +(define-method insert_unichar + (of-object "GString") + (c-name "g_string_insert_unichar") + (return-type "GString*") + (parameters + '("gssize" "pos") + '("gunichar" "wc") + ) +) + +(define-method overwrite + (of-object "GString") + (c-name "g_string_overwrite") + (return-type "GString*") + (parameters + '("gsize" "pos") + '("const-gchar*" "val") + ) +) + +(define-method overwrite_len + (of-object "GString") + (c-name "g_string_overwrite_len") + (return-type "GString*") + (parameters + '("gsize" "pos") + '("const-gchar*" "val") + '("gssize" "len") + ) +) + +(define-method erase + (of-object "GString") + (c-name "g_string_erase") + (return-type "GString*") + (parameters + '("gssize" "pos") + '("gssize" "len") + ) +) + +(define-method ascii_down + (of-object "GString") + (c-name "g_string_ascii_down") + (return-type "GString*") +) + +(define-method ascii_up + (of-object "GString") + (c-name "g_string_ascii_up") + (return-type "GString*") +) + +(define-method vprintf + (of-object "GString") + (c-name "g_string_vprintf") + (return-type "none") + (parameters + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-method printf + (of-object "GString") + (c-name "g_string_printf") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-method append_vprintf + (of-object "GString") + (c-name "g_string_append_vprintf") + (return-type "none") + (parameters + '("const-gchar*" "format") + '("va_list" "args") + ) +) + +(define-method append_printf + (of-object "GString") + (c-name "g_string_append_printf") + (return-type "none") + (parameters + '("const-gchar*" "format") + ) + (varargs #t) +) + +(define-method append_uri_escaped + (of-object "GString") + (c-name "g_string_append_uri_escaped") + (return-type "GString*") + (parameters + '("const-gchar*" "unescaped") + '("const-gchar*" "reserved_chars_allowed") + '("gboolean" "allow_utf8") + ) +) + +(define-method append_c_inline + (of-object "GString") + (c-name "g_string_append_c_inline") + (return-type "GString*") + (parameters + '("gchar" "c") + ) +) + +(define-method down + (of-object "GString") + (c-name "g_string_down") + (return-type "GString*") +) + +(define-method up + (of-object "GString") + (c-name "g_string_up") + (return-type "GString*") +) + + + +;; From gtestutils.h + +(define-function g_strcmp0 + (c-name "g_strcmp0") + (return-type "int") + (parameters + '("const-char*" "str1") + '("const-char*" "str2") + ) +) + +(define-function g_test_minimized_result + (c-name "g_test_minimized_result") + (return-type "none") + (parameters + '("double" "minimized_quantity") + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function g_test_maximized_result + (c-name "g_test_maximized_result") + (return-type "none") + (parameters + '("double" "maximized_quantity") + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function g_test_init + (c-name "g_test_init") + (return-type "none") + (parameters + '("int*" "argc") + '("char***" "argv") + ) + (varargs #t) +) + +(define-function g_test_subprocess + (c-name "g_test_subprocess") + (return-type "gboolean") +) + +(define-function g_test_run + (c-name "g_test_run") + (return-type "int") +) + +(define-function g_test_add_func + (c-name "g_test_add_func") + (return-type "none") + (parameters + '("const-char*" "testpath") + '("GTestFunc" "test_func") + ) +) + +(define-function g_test_add_data_func + (c-name "g_test_add_data_func") + (return-type "none") + (parameters + '("const-char*" "testpath") + '("gconstpointer" "test_data") + '("GTestDataFunc" "test_func") + ) +) + +(define-function g_test_add_data_func_full + (c-name "g_test_add_data_func_full") + (return-type "none") + (parameters + '("const-char*" "testpath") + '("gpointer" "test_data") + '("GTestDataFunc" "test_func") + '("GDestroyNotify" "data_free_func") + ) +) + +(define-function g_test_fail + (c-name "g_test_fail") + (return-type "none") +) + +(define-function g_test_incomplete + (c-name "g_test_incomplete") + (return-type "none") + (parameters + '("const-gchar*" "msg") + ) +) + +(define-function g_test_skip + (c-name "g_test_skip") + (return-type "none") + (parameters + '("const-gchar*" "msg") + ) +) + +(define-function g_test_failed + (c-name "g_test_failed") + (return-type "gboolean") +) + +(define-function g_test_set_nonfatal_assertions + (c-name "g_test_set_nonfatal_assertions") + (return-type "none") +) + +(define-function g_test_message + (c-name "g_test_message") + (return-type "none") + (parameters + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function g_test_bug_base + (c-name "g_test_bug_base") + (return-type "none") + (parameters + '("const-char*" "uri_pattern") + ) +) + +(define-function g_test_bug + (c-name "g_test_bug") + (return-type "none") + (parameters + '("const-char*" "bug_uri_snippet") + ) +) + (define-method release (of-object "GMainContext") (c-name "g_main_context_release") @@ -3079,12 +11058,19 @@ (return-type "GNode*") ) -(define-method last_sibling - (of-object "GNode") - (c-name "g_node_last_sibling") - (return-type "GNode*") +(define-method locker_new + (of-object "GMutex") + (c-name "g_mutex_locker_new") + (return-type "GMutexLocker*") +) + +(define-method free + (of-object "GMutexLocker") + (c-name "g_mutex_locker_free") + (return-type "none") ) + (define-method max_height (of-object "GNode") (c-name "g_node_max_height") @@ -3168,10 +11154,19 @@ ) ) -(define-method add_main_entries - (of-object "GOptionContext") - (c-name "g_option_context_add_main_entries") - (return-type "none") +(define-method move_to_front + (of-object "GThreadPool") + (c-name "g_thread_pool_move_to_front") + (return-type "gboolean") + (parameters + '("gpointer" "data") + ) +) + +(define-method set_max_threads + (of-object "GThreadPool") + (c-name "g_thread_pool_set_max_threads") + (return-type "gboolean") (parameters '("const-GOptionEntry*" "entries") '("const-gchar*" "translation_domain") @@ -3224,75 +11219,19 @@ (return-type "const-gchar*") ) -(define-method parse - (of-object "GOptionContext") - (c-name "g_option_context_parse") - (return-type "gboolean") - (parameters - '("gint*" "argc") - '("gchar***" "argv") - '("GError**" "error") - ) -) - -(define-method parse_strv - (of-object "GOptionContext") - (c-name "g_option_context_parse_strv") - (return-type "gboolean") - (parameters - '("gchar***" "arguments") - '("GError**" "error") - ) -) - -(define-method set_description - (of-object "GOptionContext") - (c-name "g_option_context_set_description") - (return-type "none") - (parameters - '("const-gchar*" "description") - ) -) -(define-method set_help_enabled - (of-object "GOptionContext") - (c-name "g_option_context_set_help_enabled") - (return-type "none") - (parameters - '("gboolean" "help_enabled") - ) -) - -(define-method set_ignore_unknown_options - (of-object "GOptionContext") - (c-name "g_option_context_set_ignore_unknown_options") - (return-type "none") - (parameters - '("gboolean" "ignore_unknown") - ) -) -(define-method set_main_group - (of-object "GOptionContext") - (c-name "g_option_context_set_main_group") - (return-type "none") - (parameters - '("GOptionGroup*" "group") - ) -) +;; From gtimer.h -(define-method set_summary - (of-object "GOptionContext") - (c-name "g_option_context_set_summary") - (return-type "none") - (parameters - '("const-gchar*" "summary") - ) +(define-function g_timer_new + (c-name "g_timer_new") + (is-constructor-of "GTimer") + (return-type "GTimer*") ) -(define-method set_translate_func - (of-object "GOptionContext") - (c-name "g_option_context_set_translate_func") +(define-method destroy + (of-object "GTimer") + (c-name "g_timer_destroy") (return-type "none") (parameters '("GTranslateFunc" "func") @@ -4095,10 +12034,25 @@ ) ) -(define-method get_next_token - (of-object "GScanner") - (c-name "g_scanner_get_next_token") - (return-type "GTokenType") + + +;; From gunicomp.h + + + +;; From gunidecomp.h + + + +;; From gurifuncs.h + +(define-function g_uri_unescape_string + (c-name "g_uri_unescape_string") + (return-type "char*") + (parameters + '("const-char*" "escaped_string") + '("const-char*" "illegal_characters") + ) ) (define-method input_file @@ -5910,27 +13864,35 @@ (return-type "gboolean") ) -(define-method is_normal_form - (of-object "GVariant") - (c-name "g_variant_is_normal_form") - (return-type "gboolean") +(define-function g_win32_get_package_installation_directory_utf8 + (c-name "g_win32_get_package_installation_directory_utf8") + (return-type "gchar*") + (parameters + '("const-gchar*" "package") + '("const-gchar*" "dll_name") + ) ) -(define-method is_of_type - (of-object "GVariant") - (c-name "g_variant_is_of_type") - (return-type "gboolean") +(define-function g_win32_get_package_installation_subdirectory_utf8 + (c-name "g_win32_get_package_installation_subdirectory_utf8") + (return-type "gchar*") (parameters '("const-GVariantType*" "type") ) ) -(define-method iter_new - (of-object "GVariant") - (c-name "g_variant_iter_new") - (return-type "GVariantIter*") +(define-function g_win32_check_windows_version + (c-name "g_win32_check_windows_version") + (return-type "gboolean") + (parameters + '("const-gint" "major") + '("const-gint" "minor") + '("const-gint" "spver") + '("const-GWin32OSType" "os_type") + ) ) + (define-method lookup (of-object "GVariant") (c-name "g_variant_lookup") diff --git a/glib/src/glib_functions.defs.patch b/glib/src/glib_functions.defs.patch index b36c05a6..c0437518 100644 --- a/glib/src/glib_functions.defs.patch +++ b/glib/src/glib_functions.defs.patch @@ -1,6 +1,6 @@ ---- glib_functions.defs 2012-02-28 10:09:30.000000000 -0500 -+++ glib_functions.defs.new 2012-02-28 10:08:25.000000000 -0500 -@@ -2563,7 +2563,7 @@ +--- glib_functions.defs.orig 2015-02-15 16:49:21.605101660 +0100 ++++ glib_functions.defs 2015-02-15 16:49:21.617101670 +0100 +@@ -2739,7 +2739,7 @@ ) ) @@ -9,7 +9,7 @@ (of-object "GIConv") (c-name "g_iconv") (return-type "gsize") -@@ -12346,13 +12346,9 @@ +@@ -13320,13 +13320,9 @@ (return-type "const-gchar*-const*") ) @@ -24,9 +24,9 @@ +;; has a function pointer parameter and that is not handled correctly by +;; h2def.py. - (define-function g_get_user_runtime_dir - (c-name "g_get_user_runtime_dir") -@@ -12440,13 +12436,8 @@ + (define-function g_get_system_config_dirs + (c-name "g_get_system_config_dirs") +@@ -13419,13 +13415,8 @@ ) ) diff --git a/glib/src/gobject.defs b/glib/src/gobject.defs deleted file mode 100644 index 0c9f4b99..00000000 --- a/glib/src/gobject.defs +++ /dev/null @@ -1,3 +0,0 @@ -(include gobject_functions.defs) -(include gobject_enums.defs) - diff --git a/glib/src/gobject_enums.defs b/glib/src/gobject_enums.defs index fbe784e5..f7bfc795 100644 --- a/glib/src/gobject_enums.defs +++ b/glib/src/gobject_enums.defs @@ -66,14 +66,27 @@ ) ) +;; From gtype.h + +;; Original typedef: +;; typedef enum /*< skip >*/ +;; { +;; G_TYPE_DEBUG_NONE = 0, +;; G_TYPE_DEBUG_OBJECTS = 1 << 0, +;; G_TYPE_DEBUG_SIGNALS = 1 << 1, +;; G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2, +;; G_TYPE_DEBUG_MASK = 0x07 +;; } GTypeDebugFlags; + (define-flags-extended TypeDebugFlags (in-module "G") (c-name "GTypeDebugFlags") (values - '("none" "G_TYPE_DEBUG_NONE" "0") - '("objects" "G_TYPE_DEBUG_OBJECTS" "1") - '("signals" "G_TYPE_DEBUG_SIGNALS" "2") - '("mask" "G_TYPE_DEBUG_MASK" "3") + '("none" "G_TYPE_DEBUG_NONE" "0x0") + '("objects" "G_TYPE_DEBUG_OBJECTS" "1 << 0") + '("signals" "G_TYPE_DEBUG_SIGNALS" "1 << 1") + '("instance-count" "G_TYPE_DEBUG_INSTANCE_COUNT" "1 << 2") + '("mask" "G_TYPE_DEBUG_MASK" "0x07") ) ) diff --git a/glib/src/gobject_functions.defs b/glib/src/gobject_functions.defs index c813b904..f1438208 100644 --- a/glib/src/gobject_functions.defs +++ b/glib/src/gobject_functions.defs @@ -1,5 +1,341 @@ -(define-function new_object - (c-name "g_closure_new_object") +;; -*- scheme -*- +; object definitions ... +(define-object Module + (in-module "GType") + (parent "GObject") + (c-name "GTypeModule") + (gtype-id "G_TYPE_TYPE_MODULE") +) + +(define-object Plugin + (in-module "GType") + (c-name "GTypePlugin") + (gtype-id "G_TYPE_TYPE_PLUGIN") +) + +;; Enumerations and flags ... + +(define-flags Flags + (in-module "GBinding") + (c-name "GBindingFlags") + (gtype-id "G_TYPE_BINDING_FLAGS") + (values + '("default" "G_BINDING_DEFAULT") + '("bidirectional" "G_BINDING_BIDIRECTIONAL") + '("sync-create" "G_BINDING_SYNC_CREATE") + '("invert-boolean" "G_BINDING_INVERT_BOOLEAN") + ) +) + +(define-flags Flags + (in-module "GParam") + (c-name "GParamFlags") + (gtype-id "G_TYPE_PARAM_FLAGS") + (values + '("readable" "G_PARAM_READABLE") + '("writable" "G_PARAM_WRITABLE") + '("readwrite" "G_PARAM_READWRITE") + '("construct" "G_PARAM_CONSTRUCT") + '("construct-only" "G_PARAM_CONSTRUCT_ONLY") + '("lax-validation" "G_PARAM_LAX_VALIDATION") + '("static-name" "G_PARAM_STATIC_NAME") + '("private" "G_PARAM_PRIVATE") + '("static-nick" "G_PARAM_STATIC_NICK") + '("static-blurb" "G_PARAM_STATIC_BLURB") + '("explicit-notify" "G_PARAM_EXPLICIT_NOTIFY") + '("deprecated" "G_PARAM_DEPRECATED") + ) +) + +(define-flags Flags + (in-module "GSignal") + (c-name "GSignalFlags") + (gtype-id "G_TYPE_SIGNAL_FLAGS") + (values + '("run-first" "G_SIGNAL_RUN_FIRST") + '("run-last" "G_SIGNAL_RUN_LAST") + '("run-cleanup" "G_SIGNAL_RUN_CLEANUP") + '("no-recurse" "G_SIGNAL_NO_RECURSE") + '("detailed" "G_SIGNAL_DETAILED") + '("action" "G_SIGNAL_ACTION") + '("no-hooks" "G_SIGNAL_NO_HOOKS") + '("must-collect" "G_SIGNAL_MUST_COLLECT") + '("deprecated" "G_SIGNAL_DEPRECATED") + ) +) + +(define-flags Flags + (in-module "GConnect") + (c-name "GConnectFlags") + (gtype-id "G_TYPE_CONNECT_FLAGS") + (values + '("after" "G_CONNECT_AFTER") + '("swapped" "G_CONNECT_SWAPPED") + ) +) + +(define-flags MatchType + (in-module "GSignal") + (c-name "GSignalMatchType") + (gtype-id "G_TYPE_SIGNAL_MATCH_TYPE") + (values + '("id" "G_SIGNAL_MATCH_ID") + '("detail" "G_SIGNAL_MATCH_DETAIL") + '("closure" "G_SIGNAL_MATCH_CLOSURE") + '("func" "G_SIGNAL_MATCH_FUNC") + '("data" "G_SIGNAL_MATCH_DATA") + '("unblocked" "G_SIGNAL_MATCH_UNBLOCKED") + ) +) + +(define-flags DebugFlags + (in-module "GType") + (c-name "GTypeDebugFlags") + (gtype-id "G_TYPE_TYPE_DEBUG_FLAGS") + (values + '("none" "G_TYPE_DEBUG_NONE") + '("objects" "G_TYPE_DEBUG_OBJECTS") + '("signals" "G_TYPE_DEBUG_SIGNALS") + '("instance-count" "G_TYPE_DEBUG_INSTANCE_COUNT") + '("mask" "G_TYPE_DEBUG_MASK") + ) +) + +(define-flags FundamentalFlags + (in-module "GType") + (c-name "GTypeFundamentalFlags") + (gtype-id "G_TYPE_TYPE_FUNDAMENTAL_FLAGS") + (values + '("classed" "G_TYPE_FLAG_CLASSED") + '("instantiatable" "G_TYPE_FLAG_INSTANTIATABLE") + '("derivable" "G_TYPE_FLAG_DERIVABLE") + '("deep-derivable" "G_TYPE_FLAG_DEEP_DERIVABLE") + ) +) + +(define-flags Flags + (in-module "GType") + (c-name "GTypeFlags") + (gtype-id "G_TYPE_TYPE_FLAGS") + (values + '("abstract" "G_TYPE_FLAG_ABSTRACT") + '("value-abstract" "G_TYPE_FLAG_VALUE_ABSTRACT") + ) +) + + +;; From gatomicarray.h + + + +;; From gbinding.h + +(define-function g_binding_flags_get_type + (c-name "g_binding_flags_get_type") + (return-type "GType") +) + +(define-function g_binding_get_type + (c-name "g_binding_get_type") + (return-type "GType") +) + +(define-method get_flags + (of-object "GBinding") + (c-name "g_binding_get_flags") + (return-type "GBindingFlags") +) + +(define-method get_source + (of-object "GBinding") + (c-name "g_binding_get_source") + (return-type "GObject*") +) + +(define-method get_target + (of-object "GBinding") + (c-name "g_binding_get_target") + (return-type "GObject*") +) + +(define-method get_source_property + (of-object "GBinding") + (c-name "g_binding_get_source_property") + (return-type "const-gchar*") +) + +(define-method get_target_property + (of-object "GBinding") + (c-name "g_binding_get_target_property") + (return-type "const-gchar*") +) + +(define-method unbind + (of-object "GBinding") + (c-name "g_binding_unbind") + (return-type "none") +) + +(define-function g_object_bind_property + (c-name "g_object_bind_property") + (return-type "GBinding*") + (parameters + '("gpointer" "source") + '("const-gchar*" "source_property") + '("gpointer" "target") + '("const-gchar*" "target_property") + '("GBindingFlags" "flags") + ) +) + +(define-function g_object_bind_property_full + (c-name "g_object_bind_property_full") + (return-type "GBinding*") + (parameters + '("gpointer" "source") + '("const-gchar*" "source_property") + '("gpointer" "target") + '("const-gchar*" "target_property") + '("GBindingFlags" "flags") + '("GBindingTransformFunc" "transform_to") + '("GBindingTransformFunc" "transform_from") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-function g_object_bind_property_with_closures + (c-name "g_object_bind_property_with_closures") + (return-type "GBinding*") + (parameters + '("gpointer" "source") + '("const-gchar*" "source_property") + '("gpointer" "target") + '("const-gchar*" "target_property") + '("GBindingFlags" "flags") + '("GClosure*" "transform_to") + '("GClosure*" "transform_from") + ) +) + + + +;; From gboxed.h + +(define-function g_boxed_copy + (c-name "g_boxed_copy") + (return-type "gpointer") + (parameters + '("GType" "boxed_type") + '("gconstpointer" "src_boxed") + ) +) + +(define-function g_boxed_free + (c-name "g_boxed_free") + (return-type "none") + (parameters + '("GType" "boxed_type") + '("gpointer" "boxed") + ) +) + +(define-method set_boxed + (of-object "GValue") + (c-name "g_value_set_boxed") + (return-type "none") + (parameters + '("gconstpointer" "v_boxed") + ) +) + +(define-method set_static_boxed + (of-object "GValue") + (c-name "g_value_set_static_boxed") + (return-type "none") + (parameters + '("gconstpointer" "v_boxed") + ) +) + +(define-method take_boxed + (of-object "GValue") + (c-name "g_value_take_boxed") + (return-type "none") + (parameters + '("gconstpointer" "v_boxed") + ) +) + +(define-method set_boxed_take_ownership + (of-object "GValue") + (c-name "g_value_set_boxed_take_ownership") + (return-type "none") + (parameters + '("gconstpointer" "v_boxed") + ) +) + +(define-method get_boxed + (of-object "GValue") + (c-name "g_value_get_boxed") + (return-type "gpointer") +) + +(define-method dup_boxed + (of-object "GValue") + (c-name "g_value_dup_boxed") + (return-type "gpointer") +) + +(define-function g_boxed_type_register_static + (c-name "g_boxed_type_register_static") + (return-type "GType") + (parameters + '("const-gchar*" "name") + '("GBoxedCopyFunc" "boxed_copy") + '("GBoxedFreeFunc" "boxed_free") + ) +) + +(define-function g_closure_get_type + (c-name "g_closure_get_type") + (return-type "GType") +) + +(define-function g_value_get_type + (c-name "g_value_get_type") + (return-type "GType") +) + + + +;; From gclosure.h + +(define-function g_cclosure_new + (c-name "g_cclosure_new") + (is-constructor-of "GCclosure") + (return-type "GClosure*") + (parameters + '("GCallback" "callback_func") + '("gpointer" "user_data") + '("GClosureNotify" "destroy_data") + ) +) + +(define-function g_cclosure_new_swap + (c-name "g_cclosure_new_swap") + (return-type "GClosure*") + (parameters + '("GCallback" "callback_func") + '("gpointer" "user_data") + '("GClosureNotify" "destroy_data") + ) +) + +(define-function g_signal_type_cclosure_new + (c-name "g_signal_type_cclosure_new") + (is-constructor-of "GSignalTypeCclosure") (return-type "GClosure*") (parameters '("guint" "sizeof_closure") @@ -26,6 +362,16 @@ ) ) +(define-method remove_finalize_notifier + (of-object "GClosure") + (c-name "g_closure_remove_finalize_notifier") + (return-type "none") + (parameters + '("gpointer" "notify_data") + '("GClosureNotify" "notify_func") + ) +) + (define-method add_invalidate_notifier (of-object "GClosure") (c-name "g_closure_add_invalidate_notifier") @@ -36,6 +382,2933 @@ ) ) +(define-method remove_invalidate_notifier + (of-object "GClosure") + (c-name "g_closure_remove_invalidate_notifier") + (return-type "none") + (parameters + '("gpointer" "notify_data") + '("GClosureNotify" "notify_func") + ) +) + +(define-method add_marshal_guards + (of-object "GClosure") + (c-name "g_closure_add_marshal_guards") + (return-type "none") + (parameters + '("gpointer" "pre_marshal_data") + '("GClosureNotify" "pre_marshal_notify") + '("gpointer" "post_marshal_data") + '("GClosureNotify" "post_marshal_notify") + ) +) + +(define-method set_marshal + (of-object "GClosure") + (c-name "g_closure_set_marshal") + (return-type "none") + (parameters + '("GClosureMarshal" "marshal") + ) +) + +(define-method set_meta_marshal + (of-object "GClosure") + (c-name "g_closure_set_meta_marshal") + (return-type "none") + (parameters + '("gpointer" "marshal_data") + '("GClosureMarshal" "meta_marshal") + ) +) + +(define-method invalidate + (of-object "GClosure") + (c-name "g_closure_invalidate") + (return-type "none") +) + +(define-method invoke + (of-object "GClosure") + (c-name "g_closure_invoke") + (return-type "none") + (parameters + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + ) +) + +(define-function g_cclosure_marshal_generic + (c-name "g_cclosure_marshal_generic") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_gvalue") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_generic_va + (c-name "g_cclosure_marshal_generic_va") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args_list") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + + + +;; From genums.h + +(define-function g_enum_get_value + (c-name "g_enum_get_value") + (return-type "GEnumValue*") + (parameters + '("GEnumClass*" "enum_class") + '("gint" "value") + ) +) + +(define-function g_enum_get_value_by_name + (c-name "g_enum_get_value_by_name") + (return-type "GEnumValue*") + (parameters + '("GEnumClass*" "enum_class") + '("const-gchar*" "name") + ) +) + +(define-function g_enum_get_value_by_nick + (c-name "g_enum_get_value_by_nick") + (return-type "GEnumValue*") + (parameters + '("GEnumClass*" "enum_class") + '("const-gchar*" "nick") + ) +) + +(define-function g_flags_get_first_value + (c-name "g_flags_get_first_value") + (return-type "GFlagsValue*") + (parameters + '("GFlagsClass*" "flags_class") + '("guint" "value") + ) +) + +(define-function g_flags_get_value_by_name + (c-name "g_flags_get_value_by_name") + (return-type "GFlagsValue*") + (parameters + '("GFlagsClass*" "flags_class") + '("const-gchar*" "name") + ) +) + +(define-function g_flags_get_value_by_nick + (c-name "g_flags_get_value_by_nick") + (return-type "GFlagsValue*") + (parameters + '("GFlagsClass*" "flags_class") + '("const-gchar*" "nick") + ) +) + +(define-method set_enum + (of-object "GValue") + (c-name "g_value_set_enum") + (return-type "none") + (parameters + '("gint" "v_enum") + ) +) + +(define-method get_enum + (of-object "GValue") + (c-name "g_value_get_enum") + (return-type "gint") +) + +(define-method set_flags + (of-object "GValue") + (c-name "g_value_set_flags") + (return-type "none") + (parameters + '("guint" "v_flags") + ) +) + +(define-method get_flags + (of-object "GValue") + (c-name "g_value_get_flags") + (return-type "guint") +) + +(define-function g_enum_register_static + (c-name "g_enum_register_static") + (return-type "GType") + (parameters + '("const-gchar*" "name") + ) +) + +(define-function g_flags_register_static + (c-name "g_flags_register_static") + (return-type "GType") + (parameters + '("const-gchar*" "name") + ) +) + +(define-function g_enum_complete_type_info + (c-name "g_enum_complete_type_info") + (return-type "none") + (parameters + '("GType" "g_enum_type") + '("GTypeInfo*" "info") + ) +) + +(define-function g_flags_complete_type_info + (c-name "g_flags_complete_type_info") + (return-type "none") + (parameters + '("GType" "g_flags_type") + '("GTypeInfo*" "info") + ) +) + + + +;; From glib-types.h + +(define-function g_date_get_type + (c-name "g_date_get_type") + (return-type "GType") +) + +(define-function g_strv_get_type + (c-name "g_strv_get_type") + (return-type "GType") +) + +(define-function g_gstring_get_type + (c-name "g_gstring_get_type") + (return-type "GType") +) + +(define-function g_hash_table_get_type + (c-name "g_hash_table_get_type") + (return-type "GType") +) + +(define-function g_array_get_type + (c-name "g_array_get_type") + (return-type "GType") +) + +(define-function g_byte_array_get_type + (c-name "g_byte_array_get_type") + (return-type "GType") +) + +(define-function g_ptr_array_get_type + (c-name "g_ptr_array_get_type") + (return-type "GType") +) + +(define-function g_bytes_get_type + (c-name "g_bytes_get_type") + (return-type "GType") +) + +(define-function g_variant_type_get_gtype + (c-name "g_variant_type_get_gtype") + (return-type "GType") +) + +(define-function g_regex_get_type + (c-name "g_regex_get_type") + (return-type "GType") +) + +(define-function g_match_info_get_type + (c-name "g_match_info_get_type") + (return-type "GType") +) + +(define-function g_error_get_type + (c-name "g_error_get_type") + (return-type "GType") +) + +(define-function g_date_time_get_type + (c-name "g_date_time_get_type") + (return-type "GType") +) + +(define-function g_time_zone_get_type + (c-name "g_time_zone_get_type") + (return-type "GType") +) + +(define-function g_io_channel_get_type + (c-name "g_io_channel_get_type") + (return-type "GType") +) + +(define-function g_io_condition_get_type + (c-name "g_io_condition_get_type") + (return-type "GType") +) + +(define-function g_variant_builder_get_type + (c-name "g_variant_builder_get_type") + (return-type "GType") +) + +(define-function g_variant_dict_get_type + (c-name "g_variant_dict_get_type") + (return-type "GType") +) + +(define-function g_key_file_get_type + (c-name "g_key_file_get_type") + (return-type "GType") +) + +(define-function g_main_loop_get_type + (c-name "g_main_loop_get_type") + (return-type "GType") +) + +(define-function g_main_context_get_type + (c-name "g_main_context_get_type") + (return-type "GType") +) + +(define-function g_source_get_type + (c-name "g_source_get_type") + (return-type "GType") +) + +(define-function g_pollfd_get_type + (c-name "g_pollfd_get_type") + (return-type "GType") +) + +(define-function g_thread_get_type + (c-name "g_thread_get_type") + (return-type "GType") +) + +(define-function g_checksum_get_type + (c-name "g_checksum_get_type") + (return-type "GType") +) + +(define-function g_markup_parse_context_get_type + (c-name "g_markup_parse_context_get_type") + (return-type "GType") +) + +(define-function g_mapped_file_get_type + (c-name "g_mapped_file_get_type") + (return-type "GType") +) + +(define-function g_option_group_get_type + (c-name "g_option_group_get_type") + (return-type "GType") +) + +(define-function g_variant_get_gtype + (c-name "g_variant_get_gtype") + (return-type "GType") +) + + + +;; From gmarshal.h + +(define-function g_cclosure_marshal_VOID__VOID + (c-name "g_cclosure_marshal_VOID__VOID") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__VOIDv + (c-name "g_cclosure_marshal_VOID__VOIDv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__BOOLEAN + (c-name "g_cclosure_marshal_VOID__BOOLEAN") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__BOOLEANv + (c-name "g_cclosure_marshal_VOID__BOOLEANv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__CHAR + (c-name "g_cclosure_marshal_VOID__CHAR") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__CHARv + (c-name "g_cclosure_marshal_VOID__CHARv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__UCHAR + (c-name "g_cclosure_marshal_VOID__UCHAR") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__UCHARv + (c-name "g_cclosure_marshal_VOID__UCHARv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__INT + (c-name "g_cclosure_marshal_VOID__INT") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__INTv + (c-name "g_cclosure_marshal_VOID__INTv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__UINT + (c-name "g_cclosure_marshal_VOID__UINT") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__UINTv + (c-name "g_cclosure_marshal_VOID__UINTv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__LONG + (c-name "g_cclosure_marshal_VOID__LONG") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__LONGv + (c-name "g_cclosure_marshal_VOID__LONGv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__ULONG + (c-name "g_cclosure_marshal_VOID__ULONG") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__ULONGv + (c-name "g_cclosure_marshal_VOID__ULONGv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__ENUM + (c-name "g_cclosure_marshal_VOID__ENUM") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__ENUMv + (c-name "g_cclosure_marshal_VOID__ENUMv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__FLAGS + (c-name "g_cclosure_marshal_VOID__FLAGS") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__FLAGSv + (c-name "g_cclosure_marshal_VOID__FLAGSv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__FLOAT + (c-name "g_cclosure_marshal_VOID__FLOAT") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__FLOATv + (c-name "g_cclosure_marshal_VOID__FLOATv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__DOUBLE + (c-name "g_cclosure_marshal_VOID__DOUBLE") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__DOUBLEv + (c-name "g_cclosure_marshal_VOID__DOUBLEv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__STRING + (c-name "g_cclosure_marshal_VOID__STRING") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__STRINGv + (c-name "g_cclosure_marshal_VOID__STRINGv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__PARAM + (c-name "g_cclosure_marshal_VOID__PARAM") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__PARAMv + (c-name "g_cclosure_marshal_VOID__PARAMv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__BOXED + (c-name "g_cclosure_marshal_VOID__BOXED") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__BOXEDv + (c-name "g_cclosure_marshal_VOID__BOXEDv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__POINTER + (c-name "g_cclosure_marshal_VOID__POINTER") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__POINTERv + (c-name "g_cclosure_marshal_VOID__POINTERv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__OBJECT + (c-name "g_cclosure_marshal_VOID__OBJECT") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__OBJECTv + (c-name "g_cclosure_marshal_VOID__OBJECTv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__VARIANT + (c-name "g_cclosure_marshal_VOID__VARIANT") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__VARIANTv + (c-name "g_cclosure_marshal_VOID__VARIANTv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_VOID__UINT_POINTER + (c-name "g_cclosure_marshal_VOID__UINT_POINTER") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_VOID__UINT_POINTERv + (c-name "g_cclosure_marshal_VOID__UINT_POINTERv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_BOOLEAN__FLAGS + (c-name "g_cclosure_marshal_BOOLEAN__FLAGS") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_BOOLEAN__FLAGSv + (c-name "g_cclosure_marshal_BOOLEAN__FLAGSv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_STRING__OBJECT_POINTER + (c-name "g_cclosure_marshal_STRING__OBJECT_POINTER") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_STRING__OBJECT_POINTERv + (c-name "g_cclosure_marshal_STRING__OBJECT_POINTERv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_cclosure_marshal_BOOLEAN__BOXED_BOXED + (c-name "g_cclosure_marshal_BOOLEAN__BOXED_BOXED") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("guint" "n_param_values") + '("const-GValue*" "param_values") + '("gpointer" "invocation_hint") + '("gpointer" "marshal_data") + ) +) + +(define-function g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv + (c-name "g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv") + (return-type "none") + (parameters + '("GClosure*" "closure") + '("GValue*" "return_value") + '("gpointer" "instance") + '("va_list" "args") + '("gpointer" "marshal_data") + '("int" "n_params") + '("GType*" "param_types") + ) +) + + + +;; From gobject-autocleanups.h + + + +;; From gobject.h + +(define-function g_initially_unowned_get_type + (c-name "g_initially_unowned_get_type") + (return-type "GType") +) + +(define-method install_property + (of-object "GObjectClass") + (c-name "g_object_class_install_property") + (return-type "none") + (parameters + '("guint" "property_id") + '("GParamSpec*" "pspec") + ) +) + +(define-method find_property + (of-object "GObjectClass") + (c-name "g_object_class_find_property") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "property_name") + ) +) + +(define-method list_properties + (of-object "GObjectClass") + (c-name "g_object_class_list_properties") + (return-type "GParamSpec**") + (parameters + '("guint*" "n_properties") + ) +) + +(define-method override_property + (of-object "GObjectClass") + (c-name "g_object_class_override_property") + (return-type "none") + (parameters + '("guint" "property_id") + '("const-gchar*" "name") + ) +) + +(define-method install_properties + (of-object "GObjectClass") + (c-name "g_object_class_install_properties") + (return-type "none") + (parameters + '("guint" "n_pspecs") + '("GParamSpec**" "pspecs") + ) +) + +(define-function g_object_interface_install_property + (c-name "g_object_interface_install_property") + (return-type "none") + (parameters + '("gpointer" "g_iface") + '("GParamSpec*" "pspec") + ) +) + +(define-function g_object_interface_find_property + (c-name "g_object_interface_find_property") + (return-type "GParamSpec*") + (parameters + '("gpointer" "g_iface") + '("const-gchar*" "property_name") + ) +) + +(define-function g_object_interface_list_properties + (c-name "g_object_interface_list_properties") + (return-type "GParamSpec**") + (parameters + '("gpointer" "g_iface") + '("guint*" "n_properties_p") + ) +) + +(define-function g_object_get_type + (c-name "g_object_get_type") + (return-type "GType") +) + +(define-function g_object_new + (c-name "g_object_new") + (return-type "gpointer") + (parameters + '("GType" "object_type") + '("const-gchar*" "first_property_name") + ) + (varargs #t) +) + +(define-function g_object_newv + (c-name "g_object_newv") + (return-type "gpointer") + (parameters + '("GType" "object_type") + '("guint" "n_parameters") + '("GParameter*" "parameters") + ) +) + +(define-function g_object_new_valist + (c-name "g_object_new_valist") + (return-type "GObject*") + (parameters + '("GType" "object_type") + '("const-gchar*" "first_property_name") + '("va_list" "var_args") + ) +) + +(define-function g_object_set + (c-name "g_object_set") + (return-type "none") + (parameters + '("gpointer" "object") + '("const-gchar*" "first_property_name") + ) + (varargs #t) +) + +(define-function g_object_get + (c-name "g_object_get") + (return-type "none") + (parameters + '("gpointer" "object") + '("const-gchar*" "first_property_name") + ) + (varargs #t) +) + +(define-function g_object_connect + (c-name "g_object_connect") + (return-type "gpointer") + (parameters + '("gpointer" "object") + '("const-gchar*" "signal_spec") + ) + (varargs #t) +) + +(define-function g_object_disconnect + (c-name "g_object_disconnect") + (return-type "none") + (parameters + '("gpointer" "object") + '("const-gchar*" "signal_spec") + ) + (varargs #t) +) + +(define-method set_valist + (of-object "GObject") + (c-name "g_object_set_valist") + (return-type "none") + (parameters + '("const-gchar*" "first_property_name") + '("va_list" "var_args") + ) +) + +(define-method get_valist + (of-object "GObject") + (c-name "g_object_get_valist") + (return-type "none") + (parameters + '("const-gchar*" "first_property_name") + '("va_list" "var_args") + ) +) + +(define-method set_property + (of-object "GObject") + (c-name "g_object_set_property") + (return-type "none") + (parameters + '("const-gchar*" "property_name") + '("const-GValue*" "value") + ) +) + +(define-method get_property + (of-object "GObject") + (c-name "g_object_get_property") + (return-type "none") + (parameters + '("const-gchar*" "property_name") + '("GValue*" "value") + ) +) + +(define-method freeze_notify + (of-object "GObject") + (c-name "g_object_freeze_notify") + (return-type "none") +) + +(define-method notify + (of-object "GObject") + (c-name "g_object_notify") + (return-type "none") + (parameters + '("const-gchar*" "property_name") + ) +) + +(define-method notify_by_pspec + (of-object "GObject") + (c-name "g_object_notify_by_pspec") + (return-type "none") + (parameters + '("GParamSpec*" "pspec") + ) +) + +(define-method thaw_notify + (of-object "GObject") + (c-name "g_object_thaw_notify") + (return-type "none") +) + +(define-function g_object_is_floating + (c-name "g_object_is_floating") + (return-type "gboolean") + (parameters + '("gpointer" "object") + ) +) + +(define-function g_object_ref_sink + (c-name "g_object_ref_sink") + (return-type "gpointer") + (parameters + '("gpointer" "object") + ) +) + +(define-function g_object_ref + (c-name "g_object_ref") + (return-type "gpointer") + (parameters + '("gpointer" "object") + ) +) + +(define-function g_object_unref + (c-name "g_object_unref") + (return-type "none") + (parameters + '("gpointer" "object") + ) +) + +(define-method weak_ref + (of-object "GObject") + (c-name "g_object_weak_ref") + (return-type "none") + (parameters + '("GWeakNotify" "notify") + '("gpointer" "data") + ) +) + +(define-method weak_unref + (of-object "GObject") + (c-name "g_object_weak_unref") + (return-type "none") + (parameters + '("GWeakNotify" "notify") + '("gpointer" "data") + ) +) + +(define-method add_weak_pointer + (of-object "GObject") + (c-name "g_object_add_weak_pointer") + (return-type "none") + (parameters + '("gpointer*" "weak_pointer_location") + ) +) + +(define-method remove_weak_pointer + (of-object "GObject") + (c-name "g_object_remove_weak_pointer") + (return-type "none") + (parameters + '("gpointer*" "weak_pointer_location") + ) +) + +(define-method add_toggle_ref + (of-object "GObject") + (c-name "g_object_add_toggle_ref") + (return-type "none") + (parameters + '("GToggleNotify" "notify") + '("gpointer" "data") + ) +) + +(define-method remove_toggle_ref + (of-object "GObject") + (c-name "g_object_remove_toggle_ref") + (return-type "none") + (parameters + '("GToggleNotify" "notify") + '("gpointer" "data") + ) +) + +(define-method get_qdata + (of-object "GObject") + (c-name "g_object_get_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + ) +) + +(define-method set_qdata + (of-object "GObject") + (c-name "g_object_set_qdata") + (return-type "none") + (parameters + '("GQuark" "quark") + '("gpointer" "data") + ) +) + +(define-method set_qdata_full + (of-object "GObject") + (c-name "g_object_set_qdata_full") + (return-type "none") + (parameters + '("GQuark" "quark") + '("gpointer" "data") + '("GDestroyNotify" "destroy") + ) +) + +(define-method steal_qdata + (of-object "GObject") + (c-name "g_object_steal_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + ) +) + +(define-method dup_qdata + (of-object "GObject") + (c-name "g_object_dup_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + '("GDuplicateFunc" "dup_func") + '("gpointer" "user_data") + ) +) + +(define-method replace_qdata + (of-object "GObject") + (c-name "g_object_replace_qdata") + (return-type "gboolean") + (parameters + '("GQuark" "quark") + '("gpointer" "oldval") + '("gpointer" "newval") + '("GDestroyNotify" "destroy") + '("GDestroyNotify*" "old_destroy") + ) +) + +(define-method get_data + (of-object "GObject") + (c-name "g_object_get_data") + (return-type "gpointer") + (parameters + '("const-gchar*" "key") + ) +) + +(define-method set_data + (of-object "GObject") + (c-name "g_object_set_data") + (return-type "none") + (parameters + '("const-gchar*" "key") + '("gpointer" "data") + ) +) + +(define-method set_data_full + (of-object "GObject") + (c-name "g_object_set_data_full") + (return-type "none") + (parameters + '("const-gchar*" "key") + '("gpointer" "data") + '("GDestroyNotify" "destroy") + ) +) + +(define-method steal_data + (of-object "GObject") + (c-name "g_object_steal_data") + (return-type "gpointer") + (parameters + '("const-gchar*" "key") + ) +) + +(define-method dup_data + (of-object "GObject") + (c-name "g_object_dup_data") + (return-type "gpointer") + (parameters + '("const-gchar*" "key") + '("GDuplicateFunc" "dup_func") + '("gpointer" "user_data") + ) +) + +(define-method replace_data + (of-object "GObject") + (c-name "g_object_replace_data") + (return-type "gboolean") + (parameters + '("const-gchar*" "key") + '("gpointer" "oldval") + '("gpointer" "newval") + '("GDestroyNotify" "destroy") + '("GDestroyNotify*" "old_destroy") + ) +) + +(define-method watch_closure + (of-object "GObject") + (c-name "g_object_watch_closure") + (return-type "none") + (parameters + '("GClosure*" "closure") + ) +) + +(define-function g_cclosure_new_object + (c-name "g_cclosure_new_object") + (return-type "GClosure*") + (parameters + '("GCallback" "callback_func") + '("GObject*" "object") + ) +) + +(define-function g_cclosure_new_object_swap + (c-name "g_cclosure_new_object_swap") + (return-type "GClosure*") + (parameters + '("GCallback" "callback_func") + '("GObject*" "object") + ) +) + +(define-function g_closure_new_object + (c-name "g_closure_new_object") + (return-type "GClosure*") + (parameters + '("guint" "sizeof_closure") + '("GObject*" "object") + ) +) + +(define-method set_object + (of-object "GValue") + (c-name "g_value_set_object") + (return-type "none") + (parameters + '("gpointer" "v_object") + ) +) + +(define-method get_object + (of-object "GValue") + (c-name "g_value_get_object") + (return-type "gpointer") +) + +(define-method dup_object + (of-object "GValue") + (c-name "g_value_dup_object") + (return-type "gpointer") +) + +(define-function g_signal_connect_object + (c-name "g_signal_connect_object") + (return-type "gulong") + (parameters + '("gpointer" "instance") + '("const-gchar*" "detailed_signal") + '("GCallback" "c_handler") + '("gpointer" "gobject") + '("GConnectFlags" "connect_flags") + ) +) + +(define-method force_floating + (of-object "GObject") + (c-name "g_object_force_floating") + (return-type "none") +) + +(define-method run_dispose + (of-object "GObject") + (c-name "g_object_run_dispose") + (return-type "none") +) + +(define-method take_object + (of-object "GValue") + (c-name "g_value_take_object") + (return-type "none") + (parameters + '("gpointer" "v_object") + ) +) + +(define-method set_object_take_ownership + (of-object "GValue") + (c-name "g_value_set_object_take_ownership") + (return-type "none") + (parameters + '("gpointer" "v_object") + ) +) + +(define-function g_object_compat_control + (c-name "g_object_compat_control") + (return-type "gsize") + (parameters + '("gsize" "what") + '("gpointer" "data") + ) +) + +(define-function g_clear_object + (c-name "g_clear_object") + (return-type "none") + (parameters + '("volatile-GObject**" "object_ptr") + ) +) + +(define-method init + (of-object "GWeakRef") + (c-name "g_weak_ref_init") + (return-type "none") + (parameters + '("gpointer" "object") + ) +) + +(define-method clear + (of-object "GWeakRef") + (c-name "g_weak_ref_clear") + (return-type "none") +) + +(define-method get + (of-object "GWeakRef") + (c-name "g_weak_ref_get") + (return-type "gpointer") +) + +(define-method set + (of-object "GWeakRef") + (c-name "g_weak_ref_set") + (return-type "none") + (parameters + '("gpointer" "object") + ) +) + + + +;; From gobject_trace.h + + + +;; From gparam.h + +(define-method ref + (of-object "GParamSpec") + (c-name "g_param_spec_ref") + (return-type "GParamSpec*") +) + +(define-method unref + (of-object "GParamSpec") + (c-name "g_param_spec_unref") + (return-type "none") +) + +(define-method sink + (of-object "GParamSpec") + (c-name "g_param_spec_sink") + (return-type "none") +) + +(define-method ref_sink + (of-object "GParamSpec") + (c-name "g_param_spec_ref_sink") + (return-type "GParamSpec*") +) + +(define-method get_qdata + (of-object "GParamSpec") + (c-name "g_param_spec_get_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + ) +) + +(define-method set_qdata + (of-object "GParamSpec") + (c-name "g_param_spec_set_qdata") + (return-type "none") + (parameters + '("GQuark" "quark") + '("gpointer" "data") + ) +) + +(define-method set_qdata_full + (of-object "GParamSpec") + (c-name "g_param_spec_set_qdata_full") + (return-type "none") + (parameters + '("GQuark" "quark") + '("gpointer" "data") + '("GDestroyNotify" "destroy") + ) +) + +(define-method steal_qdata + (of-object "GParamSpec") + (c-name "g_param_spec_steal_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + ) +) + +(define-method get_redirect_target + (of-object "GParamSpec") + (c-name "g_param_spec_get_redirect_target") + (return-type "GParamSpec*") +) + +(define-function g_param_value_set_default + (c-name "g_param_value_set_default") + (return-type "none") + (parameters + '("GParamSpec*" "pspec") + '("GValue*" "value") + ) +) + +(define-function g_param_value_defaults + (c-name "g_param_value_defaults") + (return-type "gboolean") + (parameters + '("GParamSpec*" "pspec") + '("GValue*" "value") + ) +) + +(define-function g_param_value_validate + (c-name "g_param_value_validate") + (return-type "gboolean") + (parameters + '("GParamSpec*" "pspec") + '("GValue*" "value") + ) +) + +(define-function g_param_value_convert + (c-name "g_param_value_convert") + (return-type "gboolean") + (parameters + '("GParamSpec*" "pspec") + '("const-GValue*" "src_value") + '("GValue*" "dest_value") + '("gboolean" "strict_validation") + ) +) + +(define-function g_param_values_cmp + (c-name "g_param_values_cmp") + (return-type "gint") + (parameters + '("GParamSpec*" "pspec") + '("const-GValue*" "value1") + '("const-GValue*" "value2") + ) +) + +(define-method get_name + (of-object "GParamSpec") + (c-name "g_param_spec_get_name") + (return-type "const-gchar*") +) + +(define-method get_nick + (of-object "GParamSpec") + (c-name "g_param_spec_get_nick") + (return-type "const-gchar*") +) + +(define-method get_blurb + (of-object "GParamSpec") + (c-name "g_param_spec_get_blurb") + (return-type "const-gchar*") +) + +(define-method set_param + (of-object "GValue") + (c-name "g_value_set_param") + (return-type "none") + (parameters + '("GParamSpec*" "param") + ) +) + +(define-method get_param + (of-object "GValue") + (c-name "g_value_get_param") + (return-type "GParamSpec*") +) + +(define-method dup_param + (of-object "GValue") + (c-name "g_value_dup_param") + (return-type "GParamSpec*") +) + +(define-method take_param + (of-object "GValue") + (c-name "g_value_take_param") + (return-type "none") + (parameters + '("GParamSpec*" "param") + ) +) + +(define-method set_param_take_ownership + (of-object "GValue") + (c-name "g_value_set_param_take_ownership") + (return-type "none") + (parameters + '("GParamSpec*" "param") + ) +) + +(define-method get_default_value + (of-object "GParamSpec") + (c-name "g_param_spec_get_default_value") + (return-type "const-GValue*") +) + +(define-function g_param_type_register_static + (c-name "g_param_type_register_static") + (return-type "GType") + (parameters + '("const-gchar*" "name") + '("const-GParamSpecTypeInfo*" "pspec_info") + ) +) + +(define-function g_param_spec_internal + (c-name "g_param_spec_internal") + (return-type "gpointer") + (parameters + '("GType" "param_type") + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_pool_new + (c-name "g_param_spec_pool_new") + (is-constructor-of "GParamSpecPool") + (return-type "GParamSpecPool*") + (parameters + '("gboolean" "type_prefixing") + ) +) + +(define-method insert + (of-object "GParamSpecPool") + (c-name "g_param_spec_pool_insert") + (return-type "none") + (parameters + '("GParamSpec*" "pspec") + '("GType" "owner_type") + ) +) + +(define-method remove + (of-object "GParamSpecPool") + (c-name "g_param_spec_pool_remove") + (return-type "none") + (parameters + '("GParamSpec*" "pspec") + ) +) + +(define-method lookup + (of-object "GParamSpecPool") + (c-name "g_param_spec_pool_lookup") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "param_name") + '("GType" "owner_type") + '("gboolean" "walk_ancestors") + ) +) + +(define-method list_owned + (of-object "GParamSpecPool") + (c-name "g_param_spec_pool_list_owned") + (return-type "GList*") + (parameters + '("GType" "owner_type") + ) +) + +(define-method list + (of-object "GParamSpecPool") + (c-name "g_param_spec_pool_list") + (return-type "GParamSpec**") + (parameters + '("GType" "owner_type") + '("guint*" "n_pspecs_p") + ) +) + + + +;; From gparamspecs.h + +(define-function g_param_spec_char + (c-name "g_param_spec_char") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gint8" "minimum") + '("gint8" "maximum") + '("gint8" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_uchar + (c-name "g_param_spec_uchar") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("guint8" "minimum") + '("guint8" "maximum") + '("guint8" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_boolean + (c-name "g_param_spec_boolean") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gboolean" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_int + (c-name "g_param_spec_int") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gint" "minimum") + '("gint" "maximum") + '("gint" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_uint + (c-name "g_param_spec_uint") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("guint" "minimum") + '("guint" "maximum") + '("guint" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_long + (c-name "g_param_spec_long") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("glong" "minimum") + '("glong" "maximum") + '("glong" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_ulong + (c-name "g_param_spec_ulong") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gulong" "minimum") + '("gulong" "maximum") + '("gulong" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_int64 + (c-name "g_param_spec_int64") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gint64" "minimum") + '("gint64" "maximum") + '("gint64" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_uint64 + (c-name "g_param_spec_uint64") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("guint64" "minimum") + '("guint64" "maximum") + '("guint64" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_unichar + (c-name "g_param_spec_unichar") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gunichar" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_enum + (c-name "g_param_spec_enum") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "enum_type") + '("gint" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_flags + (c-name "g_param_spec_flags") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "flags_type") + '("guint" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_float + (c-name "g_param_spec_float") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gfloat" "minimum") + '("gfloat" "maximum") + '("gfloat" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_double + (c-name "g_param_spec_double") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("gdouble" "minimum") + '("gdouble" "maximum") + '("gdouble" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_string + (c-name "g_param_spec_string") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("const-gchar*" "default_value") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_param + (c-name "g_param_spec_param") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "param_type") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_boxed + (c-name "g_param_spec_boxed") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "boxed_type") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_pointer + (c-name "g_param_spec_pointer") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_value_array + (c-name "g_param_spec_value_array") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GParamSpec*" "element_spec") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_object + (c-name "g_param_spec_object") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "object_type") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_override + (c-name "g_param_spec_override") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("GParamSpec*" "overridden") + ) +) + +(define-function g_param_spec_gtype + (c-name "g_param_spec_gtype") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("GType" "is_a_type") + '("GParamFlags" "flags") + ) +) + +(define-function g_param_spec_variant + (c-name "g_param_spec_variant") + (return-type "GParamSpec*") + (parameters + '("const-gchar*" "name") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") + '("const-GVariantType*" "type") + '("GVariant*" "default_value") + '("GParamFlags" "flags") + ) +) + + + +;; From gsignal.h + +(define-function g_signal_newv + (c-name "g_signal_newv") + (return-type "guint") + (parameters + '("const-gchar*" "signal_name") + '("GType" "itype") + '("GSignalFlags" "signal_flags") + '("GClosure*" "class_closure") + '("GSignalAccumulator" "accumulator") + '("gpointer" "accu_data") + '("GSignalCMarshaller" "c_marshaller") + '("GType" "return_type") + '("guint" "n_params") + '("GType*" "param_types") + ) +) + +(define-function g_signal_new_valist + (c-name "g_signal_new_valist") + (return-type "guint") + (parameters + '("const-gchar*" "signal_name") + '("GType" "itype") + '("GSignalFlags" "signal_flags") + '("GClosure*" "class_closure") + '("GSignalAccumulator" "accumulator") + '("gpointer" "accu_data") + '("GSignalCMarshaller" "c_marshaller") + '("GType" "return_type") + '("guint" "n_params") + '("va_list" "args") + ) +) + +(define-function g_signal_new + (c-name "g_signal_new") + (return-type "guint") + (parameters + '("const-gchar*" "signal_name") + '("GType" "itype") + '("GSignalFlags" "signal_flags") + '("guint" "class_offset") + '("GSignalAccumulator" "accumulator") + '("gpointer" "accu_data") + '("GSignalCMarshaller" "c_marshaller") + '("GType" "return_type") + '("guint" "n_params") + ) + (varargs #t) +) + +(define-function g_signal_new_class_handler + (c-name "g_signal_new_class_handler") + (return-type "guint") + (parameters + '("const-gchar*" "signal_name") + '("GType" "itype") + '("GSignalFlags" "signal_flags") + '("GCallback" "class_handler") + '("GSignalAccumulator" "accumulator") + '("gpointer" "accu_data") + '("GSignalCMarshaller" "c_marshaller") + '("GType" "return_type") + '("guint" "n_params") + ) + (varargs #t) +) + +(define-function g_signal_set_va_marshaller + (c-name "g_signal_set_va_marshaller") + (return-type "none") + (parameters + '("guint" "signal_id") + '("GType" "instance_type") + '("GSignalCVaMarshaller" "va_marshaller") + ) +) + +(define-function g_signal_emitv + (c-name "g_signal_emitv") + (return-type "none") + (parameters + '("const-GValue*" "instance_and_params") + '("guint" "signal_id") + '("GQuark" "detail") + '("GValue*" "return_value") + ) +) + +(define-function g_signal_emit_valist + (c-name "g_signal_emit_valist") + (return-type "none") + (parameters + '("gpointer" "instance") + '("guint" "signal_id") + '("GQuark" "detail") + '("va_list" "var_args") + ) +) + +(define-function g_signal_emit + (c-name "g_signal_emit") + (return-type "none") + (parameters + '("gpointer" "instance") + '("guint" "signal_id") + '("GQuark" "detail") + ) + (varargs #t) +) + +(define-function g_signal_emit_by_name + (c-name "g_signal_emit_by_name") + (return-type "none") + (parameters + '("gpointer" "instance") + '("const-gchar*" "detailed_signal") + ) + (varargs #t) +) + +(define-function g_signal_lookup + (c-name "g_signal_lookup") + (return-type "guint") + (parameters + '("const-gchar*" "name") + '("GType" "itype") + ) +) + +(define-function g_signal_name + (c-name "g_signal_name") + (return-type "const-gchar*") + (parameters + '("guint" "signal_id") + ) +) + +(define-function g_signal_query + (c-name "g_signal_query") + (return-type "none") + (parameters + '("guint" "signal_id") + '("GSignalQuery*" "query") + ) +) + +(define-function g_signal_list_ids + (c-name "g_signal_list_ids") + (return-type "guint*") + (parameters + '("GType" "itype") + '("guint*" "n_ids") + ) +) + +(define-function g_signal_parse_name + (c-name "g_signal_parse_name") + (return-type "gboolean") + (parameters + '("const-gchar*" "detailed_signal") + '("GType" "itype") + '("guint*" "signal_id_p") + '("GQuark*" "detail_p") + '("gboolean" "force_detail_quark") + ) +) + +(define-function g_signal_get_invocation_hint + (c-name "g_signal_get_invocation_hint") + (return-type "GSignalInvocationHint*") + (parameters + '("gpointer" "instance") + ) +) + +(define-function g_signal_stop_emission + (c-name "g_signal_stop_emission") + (return-type "none") + (parameters + '("gpointer" "instance") + '("guint" "signal_id") + '("GQuark" "detail") + ) +) + +(define-function g_signal_stop_emission_by_name + (c-name "g_signal_stop_emission_by_name") + (return-type "none") + (parameters + '("gpointer" "instance") + '("const-gchar*" "detailed_signal") + ) +) + +(define-function g_signal_add_emission_hook + (c-name "g_signal_add_emission_hook") + (return-type "gulong") + (parameters + '("guint" "signal_id") + '("GQuark" "detail") + '("GSignalEmissionHook" "hook_func") + '("gpointer" "hook_data") + '("GDestroyNotify" "data_destroy") + ) +) + +(define-function g_signal_remove_emission_hook + (c-name "g_signal_remove_emission_hook") + (return-type "none") + (parameters + '("guint" "signal_id") + '("gulong" "hook_id") + ) +) + +(define-function g_signal_has_handler_pending + (c-name "g_signal_has_handler_pending") + (return-type "gboolean") + (parameters + '("gpointer" "instance") + '("guint" "signal_id") + '("GQuark" "detail") + '("gboolean" "may_be_blocked") + ) +) + +(define-function g_signal_connect_closure_by_id + (c-name "g_signal_connect_closure_by_id") + (return-type "gulong") + (parameters + '("gpointer" "instance") + '("guint" "signal_id") + '("GQuark" "detail") + '("GClosure*" "closure") + '("gboolean" "after") + ) +) + +(define-function g_signal_connect_closure + (c-name "g_signal_connect_closure") + (return-type "gulong") + (parameters + '("gpointer" "instance") + '("const-gchar*" "detailed_signal") + '("GClosure*" "closure") + '("gboolean" "after") + ) +) + +(define-function g_signal_connect_data + (c-name "g_signal_connect_data") + (return-type "gulong") + (parameters + '("gpointer" "instance") + '("const-gchar*" "detailed_signal") + '("GCallback" "c_handler") + '("gpointer" "data") + '("GClosureNotify" "destroy_data") + '("GConnectFlags" "connect_flags") + ) +) + +(define-function g_signal_handler_block + (c-name "g_signal_handler_block") + (return-type "none") + (parameters + '("gpointer" "instance") + '("gulong" "handler_id") + ) +) + +(define-function g_signal_handler_unblock + (c-name "g_signal_handler_unblock") + (return-type "none") + (parameters + '("gpointer" "instance") + '("gulong" "handler_id") + ) +) + +(define-function g_signal_handler_disconnect + (c-name "g_signal_handler_disconnect") + (return-type "none") + (parameters + '("gpointer" "instance") + '("gulong" "handler_id") + ) +) + +(define-function g_signal_handler_is_connected + (c-name "g_signal_handler_is_connected") + (return-type "gboolean") + (parameters + '("gpointer" "instance") + '("gulong" "handler_id") + ) +) + +(define-function g_signal_handler_find + (c-name "g_signal_handler_find") + (return-type "gulong") + (parameters + '("gpointer" "instance") + '("GSignalMatchType" "mask") + '("guint" "signal_id") + '("GQuark" "detail") + '("GClosure*" "closure") + '("gpointer" "func") + '("gpointer" "data") + ) +) + +(define-function g_signal_handlers_block_matched + (c-name "g_signal_handlers_block_matched") + (return-type "guint") + (parameters + '("gpointer" "instance") + '("GSignalMatchType" "mask") + '("guint" "signal_id") + '("GQuark" "detail") + '("GClosure*" "closure") + '("gpointer" "func") + '("gpointer" "data") + ) +) + +(define-function g_signal_handlers_unblock_matched + (c-name "g_signal_handlers_unblock_matched") + (return-type "guint") + (parameters + '("gpointer" "instance") + '("GSignalMatchType" "mask") + '("guint" "signal_id") + '("GQuark" "detail") + '("GClosure*" "closure") + '("gpointer" "func") + '("gpointer" "data") + ) +) + +(define-function g_signal_handlers_disconnect_matched + (c-name "g_signal_handlers_disconnect_matched") + (return-type "guint") + (parameters + '("gpointer" "instance") + '("GSignalMatchType" "mask") + '("guint" "signal_id") + '("GQuark" "detail") + '("GClosure*" "closure") + '("gpointer" "func") + '("gpointer" "data") + ) +) + +(define-function g_signal_override_class_closure + (c-name "g_signal_override_class_closure") + (return-type "none") + (parameters + '("guint" "signal_id") + '("GType" "instance_type") + '("GClosure*" "class_closure") + ) +) + +(define-function g_signal_override_class_handler + (c-name "g_signal_override_class_handler") + (return-type "none") + (parameters + '("const-gchar*" "signal_name") + '("GType" "instance_type") + '("GCallback" "class_handler") + ) +) + +(define-function g_signal_chain_from_overridden + (c-name "g_signal_chain_from_overridden") + (return-type "none") + (parameters + '("const-GValue*" "instance_and_params") + '("GValue*" "return_value") + ) +) + +(define-function g_signal_chain_from_overridden_handler + (c-name "g_signal_chain_from_overridden_handler") + (return-type "none") + (parameters + '("gpointer" "instance") + ) + (varargs #t) +) + +(define-function g_signal_accumulator_true_handled + (c-name "g_signal_accumulator_true_handled") + (return-type "gboolean") + (parameters + '("GSignalInvocationHint*" "ihint") + '("GValue*" "return_accu") + '("const-GValue*" "handler_return") + '("gpointer" "dummy") + ) +) + +(define-function g_signal_accumulator_first_wins + (c-name "g_signal_accumulator_first_wins") + (return-type "gboolean") + (parameters + '("GSignalInvocationHint*" "ihint") + '("GValue*" "return_accu") + '("const-GValue*" "handler_return") + '("gpointer" "dummy") + ) +) + +(define-function g_signal_handlers_destroy + (c-name "g_signal_handlers_destroy") + (return-type "none") + (parameters + '("gpointer" "instance") + ) +) + + + +;; From gsourceclosure.h + +(define-method set_closure + (of-object "GSource") + (c-name "g_source_set_closure") + (return-type "none") + (parameters + '("GClosure*" "closure") + ) +) + +(define-method set_dummy_callback + (of-object "GSource") + (c-name "g_source_set_dummy_callback") + (return-type "none") +) + + + +;; From gtype.h + +(define-function g_type_init + (c-name "g_type_init") + (return-type "none") +) + +(define-function g_type_init_with_debug_flags + (c-name "g_type_init_with_debug_flags") + (return-type "none") + (parameters + '("GTypeDebugFlags" "debug_flags") + ) +) + +(define-method name + (of-object "GType") + (c-name "g_type_name") + (return-type "const-gchar*") +) + +(define-method qname + (of-object "GType") + (c-name "g_type_qname") + (return-type "GQuark") +) + +(define-function g_type_from_name + (c-name "g_type_from_name") + (return-type "GType") + (parameters + '("const-gchar*" "name") + ) +) + +(define-method parent + (of-object "GType") + (c-name "g_type_parent") + (return-type "GType") +) + +(define-method depth + (of-object "GType") + (c-name "g_type_depth") + (return-type "guint") +) + +(define-method next_base + (of-object "GType") + (c-name "g_type_next_base") + (return-type "GType") + (parameters + '("GType" "root_type") + ) +) + +(define-method is_a + (of-object "GType") + (c-name "g_type_is_a") + (return-type "gboolean") + (parameters + '("GType" "is_a_type") + ) +) + +(define-method class_ref + (of-object "GType") + (c-name "g_type_class_ref") + (return-type "gpointer") +) + +(define-method class_peek + (of-object "GType") + (c-name "g_type_class_peek") + (return-type "gpointer") +) + +(define-method class_peek_static + (of-object "GType") + (c-name "g_type_class_peek_static") + (return-type "gpointer") +) + +(define-function g_type_class_unref + (c-name "g_type_class_unref") + (return-type "none") + (parameters + '("gpointer" "g_class") + ) +) + +(define-function g_type_class_peek_parent + (c-name "g_type_class_peek_parent") + (return-type "gpointer") + (parameters + '("gpointer" "g_class") + ) +) + +(define-function g_type_interface_peek + (c-name "g_type_interface_peek") + (return-type "gpointer") + (parameters + '("gpointer" "instance_class") + '("GType" "iface_type") + ) +) + +(define-function g_type_interface_peek_parent + (c-name "g_type_interface_peek_parent") + (return-type "gpointer") + (parameters + '("gpointer" "g_iface") + ) +) + +(define-method default_interface_ref + (of-object "GType") + (c-name "g_type_default_interface_ref") + (return-type "gpointer") +) + +(define-method default_interface_peek + (of-object "GType") + (c-name "g_type_default_interface_peek") + (return-type "gpointer") +) + +(define-function g_type_default_interface_unref + (c-name "g_type_default_interface_unref") + (return-type "none") + (parameters + '("gpointer" "g_iface") + ) +) + +(define-method children + (of-object "GType") + (c-name "g_type_children") + (return-type "GType*") + (parameters + '("guint*" "n_children") + ) +) + +(define-method interfaces + (of-object "GType") + (c-name "g_type_interfaces") + (return-type "GType*") + (parameters + '("guint*" "n_interfaces") + ) +) + +(define-method set_qdata + (of-object "GType") + (c-name "g_type_set_qdata") + (return-type "none") + (parameters + '("GQuark" "quark") + '("gpointer" "data") + ) +) + +(define-method get_qdata + (of-object "GType") + (c-name "g_type_get_qdata") + (return-type "gpointer") + (parameters + '("GQuark" "quark") + ) +) + +(define-method query + (of-object "GType") + (c-name "g_type_query") + (return-type "none") + (parameters + '("GTypeQuery*" "query") + ) +) + +(define-method get_instance_count + (of-object "GType") + (c-name "g_type_get_instance_count") + (return-type "int") +) + +(define-method register_static + (of-object "GType") + (c-name "g_type_register_static") + (return-type "GType") + (parameters + '("const-gchar*" "type_name") + '("const-GTypeInfo*" "info") + '("GTypeFlags" "flags") + ) +) + +(define-method register_static_simple + (of-object "GType") + (c-name "g_type_register_static_simple") + (return-type "GType") + (parameters + '("const-gchar*" "type_name") + '("guint" "class_size") + '("GClassInitFunc" "class_init") + '("guint" "instance_size") + '("GInstanceInitFunc" "instance_init") + '("GTypeFlags" "flags") + ) +) + +(define-method register_dynamic + (of-object "GType") + (c-name "g_type_register_dynamic") + (return-type "GType") + (parameters + '("const-gchar*" "type_name") + '("GTypePlugin*" "plugin") + '("GTypeFlags" "flags") + ) +) + +(define-method register_fundamental + (of-object "GType") + (c-name "g_type_register_fundamental") + (return-type "GType") + (parameters + '("const-gchar*" "type_name") + '("const-GTypeInfo*" "info") + '("const-GTypeFundamentalInfo*" "finfo") + '("GTypeFlags" "flags") + ) +) + +(define-method add_interface_static + (of-object "GType") + (c-name "g_type_add_interface_static") + (return-type "none") + (parameters + '("GType" "interface_type") + '("const-GInterfaceInfo*" "info") + ) +) + +(define-method add_interface_dynamic + (of-object "GType") + (c-name "g_type_add_interface_dynamic") + (return-type "none") + (parameters + '("GType" "interface_type") + '("GTypePlugin*" "plugin") + ) +) + +(define-method interface_add_prerequisite + (of-object "GType") + (c-name "g_type_interface_add_prerequisite") + (return-type "none") + (parameters + '("GType" "prerequisite_type") + ) +) + +(define-method interface_prerequisites + (of-object "GType") + (c-name "g_type_interface_prerequisites") + (return-type "GType*") + (parameters + '("guint*" "n_prerequisites") + ) +) + +(define-function g_type_class_add_private + (c-name "g_type_class_add_private") + (return-type "none") + (parameters + '("gpointer" "g_class") + '("gsize" "private_size") + ) +) + +(define-method add_instance_private + (of-object "GType") + (c-name "g_type_add_instance_private") + (return-type "gint") + (parameters + '("gsize" "private_size") + ) +) + +(define-method get_private + (of-object "GTypeInstance") + (c-name "g_type_instance_get_private") + (return-type "gpointer") + (parameters + '("GType" "private_type") + ) +) + +(define-function g_type_class_adjust_private_offset + (c-name "g_type_class_adjust_private_offset") + (return-type "none") + (parameters + '("gpointer" "g_class") + '("gint*" "private_size_or_offset") + ) +) + +(define-method add_class_private + (of-object "GType") + (c-name "g_type_add_class_private") + (return-type "none") + (parameters + '("gsize" "private_size") + ) +) + +(define-method get_private + (of-object "GTypeClass") + (c-name "g_type_class_get_private") + (return-type "gpointer") + (parameters + '("GType" "private_type") + ) +) + +(define-function g_type_class_get_instance_private_offset + (c-name "g_type_class_get_instance_private_offset") + (return-type "gint") + (parameters + '("gpointer" "g_class") + ) +) + +(define-method ensure + (of-object "GType") + (c-name "g_type_ensure") + (return-type "none") +) + +(define-function g_type_get_type_registration_serial + (c-name "g_type_get_type_registration_serial") + (return-type "guint") +) + +(define-method get_plugin + (of-object "GType") + (c-name "g_type_get_plugin") + (return-type "GTypePlugin*") +) + +(define-method interface_get_plugin + (of-object "GType") + (c-name "g_type_interface_get_plugin") + (return-type "GTypePlugin*") + (parameters + '("gpointer" "notify_data") + '("GClosureNotify" "notify_func") + ) +) + (define-method add_marshal_guards (of-object "GClosure") (c-name "g_closure_add_marshal_guards") @@ -325,11 +3598,7 @@ (return-type "gchar") ) -(define-method get_double - (of-object "GValue") - (c-name "g_value_get_double") - (return-type "gdouble") -) +;; From gvaluearray.h (define-method get_enum (of-object "GValue") diff --git a/glib/src/iochannel.ccg b/glib/src/iochannel.ccg index d0a18aae..93faefa7 100644 --- a/glib/src/iochannel.ccg +++ b/glib/src/iochannel.ccg @@ -50,8 +50,8 @@ public: ForeignIOChannel(GIOChannel* gobject, bool take_copy) : Glib::IOChannel(gobject, take_copy), ref_count_(0) {} - virtual void reference() const; - virtual void unreference() const; + void reference() const override; + void unreference() const override; private: mutable int ref_count_; @@ -136,7 +136,7 @@ IOChannel::IOChannel(GIOChannel* gobject, bool take_copy) gobject_ (gobject) { // This ctor should never be called for GlibmmIOChannel instances. - g_assert(gobject != 0); + g_assert(gobject != nullptr); g_assert(gobject->funcs != &GlibmmIOChannel::vfunc_table); if(take_copy) @@ -157,11 +157,11 @@ IOChannel::~IOChannel() if(gobject_->funcs == &GlibmmIOChannel::vfunc_table) { // Disconnect the wrapper object so that it won't be deleted twice. - reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = 0; + reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = nullptr; } - GIOChannel *const tmp_gobject = gobject_; - gobject_ = 0; + const auto tmp_gobject = gobject_; + gobject_ = nullptr; g_io_channel_unref(tmp_gobject); } @@ -169,8 +169,8 @@ IOChannel::~IOChannel() Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode) { - GError* gerror = 0; - GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror); + GError* gerror = nullptr; + const auto channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror); if(gerror) { @@ -208,10 +208,10 @@ IOStatus IOChannel::write(const Glib::ustring& str) IOStatus IOChannel::read_line(Glib::ustring& line) { Glib::ScopedPtr<char> buf; - GError* gerror = 0; + GError* gerror = nullptr; gsize bytes = 0; - const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror); + const auto status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror); if(gerror) { @@ -229,10 +229,10 @@ IOStatus IOChannel::read_line(Glib::ustring& line) IOStatus IOChannel::read_to_end(Glib::ustring& str) { Glib::ScopedPtr<char> buf; - GError* gerror = 0; + GError* gerror = nullptr; gsize bytes = 0; - const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror); + const auto status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror); if(gerror) { @@ -250,10 +250,10 @@ IOStatus IOChannel::read_to_end(Glib::ustring& str) IOStatus IOChannel::read(Glib::ustring& str, gsize count) { Glib::ScopedPtr<char> buf (g_new(char, count)); - GError* gerror = 0; + GError* gerror = nullptr; gsize bytes = 0; - const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror); + const auto status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror); if(gerror) { @@ -270,9 +270,9 @@ IOStatus IOChannel::read(Glib::ustring& str, gsize count) IOStatus IOChannel::set_encoding(const std::string& encoding) { - GError* gerror = 0; + GError* gerror = nullptr; - const GIOStatus status = g_io_channel_set_encoding( + const auto status = g_io_channel_set_encoding( gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &gerror); if(gerror) @@ -367,7 +367,7 @@ void IOChannel::unreference() const Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy) { - IOChannel* cpp_object = 0; + IOChannel* cpp_object = nullptr; if(gobject) { @@ -394,7 +394,7 @@ Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy) GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { @@ -415,7 +415,7 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { @@ -435,7 +435,7 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { @@ -455,7 +455,7 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { @@ -477,11 +477,11 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err) // static GSource* GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { - const Glib::RefPtr<Source> source = wrapper->create_watch_vfunc((IOCondition) condition); + const auto source = wrapper->create_watch_vfunc((IOCondition) condition); return (source) ? source->gobj_copy() : 0; } catch(...) @@ -497,7 +497,7 @@ void GlibmmIOChannel::io_free(GIOChannel* channel) { if(IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper) { - wrapper->gobject_ = 0; + wrapper->gobject_ = nullptr; delete wrapper; } @@ -506,7 +506,7 @@ void GlibmmIOChannel::io_free(GIOChannel* channel) GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { @@ -527,7 +527,7 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr // static GIOFlags GlibmmIOChannel::io_get_flags(GIOChannel* channel) { - IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; + const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper; try { diff --git a/glib/src/iochannel.hg b/glib/src/iochannel.hg index bc0f404d..9c97ce78 100644 --- a/glib/src/iochannel.hg +++ b/glib/src/iochannel.hg @@ -78,15 +78,7 @@ class GlibmmIOChannel; * set_encoding("ISO-8859-15"). To set the channel to no encoding, use * set_encoding() without any arguments. * - * You can create an IOChannel with one of the static create methods, or - * implement one yourself, in which case you have to 1) override all - * _vfunc() members. 2) set the GIOChannel flags in your constructor. - * - * @note This feature of being able to implement a custom Glib::IOChannel is - * deprecated in glibmm 2.2. The vfunc interface has not yet stabilized - * enough to allow that -- the C++ wrapper went in by pure accident. Besides, - * it isn't terribly useful either. Thus please refrain from overriding any - * IOChannel vfuncs. + * You can create an IOChannel with one of the static create methods. */ class IOChannel : public sigc::trackable { @@ -269,11 +261,11 @@ public: * Any pending data to be written will be flushed if @a flush is <tt>true</tt>. * The channel will not be freed until the last reference is dropped. * Accessing the channel after closing it is considered an error. - * @param flush Whether to flush() pending data before closing the channel. + * @param flush_pending Whether to flush() pending data before closing the channel. * @return The status of the operation. * @throw Glib::IOChannelError */ - _WRAP_METHOD(IOStatus close(bool flush = true), g_io_channel_shutdown, errthrow) + _WRAP_METHOD(IOStatus close(bool flush_pending = true), g_io_channel_shutdown, errthrow) /** Get the IOChannel internal buffer size. * @return The buffer size. @@ -413,7 +405,6 @@ public: * @return An IOSource object that can be polled from a MainContext's event loop. */ Glib::RefPtr<IOSource> create_watch(IOCondition condition); - _IGNORE(g_io_channel_create_watch) virtual void reference() const; virtual void unreference() const; @@ -438,12 +429,42 @@ protected: IOChannel(GIOChannel* gobject, bool take_copy); #endif + //We don't put GLIBMM_DISABLE_DEPRECATED around these deprecated methods + //because they are virtual and that would make the ABI dependent on the ifdef. + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOStatus seek_vfunc(gint64 offset, SeekType type); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOStatus close_vfunc(); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOStatus set_flags_vfunc(IOFlags flags); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual IOFlags get_flags_vfunc(); + + /** + * @deprecated Custom Glib::IOChannel implementation was never really supported. + */ virtual Glib::RefPtr<Glib::Source> create_watch_vfunc(IOCondition cond); #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/glib/src/keyfile.ccg b/glib/src/keyfile.ccg index 366b4980..4488e317 100644 --- a/glib/src/keyfile.ccg +++ b/glib/src/keyfile.ccg @@ -40,7 +40,7 @@ KeyFile::~KeyFile() bool KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags) { - GError* gerror = 0; + GError* gerror = nullptr; const gboolean result = g_key_file_load_from_data( gobj(), data.c_str(), data.bytes(), @@ -55,8 +55,8 @@ bool KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags) bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags) { - GError* gerror = 0; - char* full_path_c = 0; + GError* gerror = nullptr; + char* full_path_c = nullptr; const gboolean result = g_key_file_load_from_data_dirs( gobj(), file.c_str(), &full_path_c, @@ -76,8 +76,8 @@ bool KeyFile::load_from_data_dirs(const std::string& file, std::string& full_pat bool KeyFile::load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs, std::string& full_path, KeyFileFlags flags) { - GError* gerror = 0; - char* full_path_c = 0; + GError* gerror = nullptr; + char* full_path_c = nullptr; const gboolean result = g_key_file_load_from_dirs( gobj(), file.c_str(), const_cast<const gchar**>(search_dirs.data()), @@ -103,7 +103,7 @@ bool KeyFile::load_from_dirs(const std::string& file, const Glib::ArrayHandle<st Glib::ustring KeyFile::to_data() { - GError* gerror = 0; + GError* gerror = nullptr; char *const str = g_key_file_to_data(gobj(), 0, &gerror); if(gerror) @@ -123,7 +123,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_groups() const Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_name) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; char** const array = g_key_file_get_keys( const_cast<GKeyFile*>(gobj()), @@ -139,7 +139,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_na Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name, const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; char *const str = g_key_file_get_locale_string( const_cast<GKeyFile*>(gobj()), (group_name.empty()) ? 0 : group_name.c_str(), @@ -153,7 +153,7 @@ Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name, bool KeyFile::get_boolean(const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; const bool value = static_cast<bool>(g_key_file_get_boolean(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &gerror)); @@ -165,7 +165,7 @@ bool KeyFile::get_boolean(const Glib::ustring& key) const int KeyFile::get_integer(const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; const int value = g_key_file_get_integer(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &gerror); if(gerror) @@ -176,7 +176,7 @@ int KeyFile::get_integer(const Glib::ustring& key) const gint64 KeyFile::get_int64(const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; const gint64 value = g_key_file_get_int64(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &gerror); @@ -189,7 +189,7 @@ gint64 KeyFile::get_int64(const Glib::ustring& key) const guint64 KeyFile::get_uint64(const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; const guint64 value = g_key_file_get_uint64(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &gerror); @@ -202,7 +202,7 @@ guint64 KeyFile::get_uint64(const Glib::ustring& key) const double KeyFile::get_double(const Glib::ustring& key) const { - GError* gerror = 0; + GError* gerror = nullptr; double retvalue = g_key_file_get_double(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &(gerror)); if(gerror) @@ -224,7 +224,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_string_list(const Glib::ustring& g GLIBMM_ERROR_ARG) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; char** const array = g_key_file_get_string_list( const_cast<GKeyFile*>(gobj()), @@ -242,7 +242,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_locale_string_list(const Glib::ust GLIBMM_ERROR_ARG) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; char** const array = g_key_file_get_locale_string_list( const_cast<GKeyFile*>(gobj()), @@ -259,7 +259,7 @@ Glib::ArrayHandle<bool> KeyFile::get_boolean_list(const Glib::ustring& group_nam GLIBMM_ERROR_ARG) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; gboolean *const array = g_key_file_get_boolean_list( const_cast<GKeyFile*>(gobj()), @@ -276,7 +276,7 @@ Glib::ArrayHandle<int> KeyFile::get_integer_list(const Glib::ustring& group_name GLIBMM_ERROR_ARG) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; int *const array = g_key_file_get_integer_list( const_cast<GKeyFile*>(gobj()), @@ -293,7 +293,7 @@ Glib::ArrayHandle<double> KeyFile::get_double_list(const Glib::ustring& group_na GLIBMM_ERROR_ARG) const { gsize length = 0; - GError* gerror = 0; + GError* gerror = nullptr; double *const array = g_key_file_get_double_list(const_cast<GKeyFile*>(gobj()), group_name.c_str(), key.c_str(), @@ -341,7 +341,7 @@ void KeyFile::set_boolean_list(const Glib::ustring& group_name, const Glib::ustr Glib::ustring KeyFile::get_comment() const { - GError* gerror = 0; + GError* gerror = nullptr; char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()), 0, 0, &gerror); GLIBMM_THROW(gerror); @@ -351,7 +351,7 @@ Glib::ustring KeyFile::get_comment() const Glib::ustring KeyFile::get_comment(const Glib::ustring& group_name GLIBMM_ERROR_ARG) const { - GError* gerror = 0; + GError* gerror = nullptr; char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()), (group_name.empty()) ? 0 : group_name.c_str(), 0, &gerror); @@ -362,7 +362,7 @@ Glib::ustring KeyFile::get_comment(const Glib::ustring& group_name GLIBMM_ERROR_ void KeyFile::set_comment(const Glib::ustring& comment GLIBMM_ERROR_ARG) { - GError* gerror = 0; + GError* gerror = nullptr; g_key_file_set_comment(gobj(), 0, 0, comment.c_str(), &gerror); GLIBMM_THROW(gerror); @@ -371,7 +371,7 @@ void KeyFile::set_comment(const Glib::ustring& comment GLIBMM_ERROR_ARG) void KeyFile::set_comment(const Glib::ustring& group_name, const Glib::ustring& comment GLIBMM_ERROR_ARG) { - GError* gerror = 0; + GError* gerror = nullptr; g_key_file_set_comment(gobj(), (group_name.empty()) ? 0 : group_name.c_str(), 0, comment.c_str(), &gerror); GLIBMM_THROW(gerror); diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg index 5f7c199f..c976a958 100644 --- a/glib/src/keyfile.hg +++ b/glib/src/keyfile.hg @@ -263,6 +263,7 @@ public: * If @a key cannot be found then it is created. * * @newin{2,12} + * * @param key A key. * @param value An double value. */ diff --git a/glib/src/markup.ccg b/glib/src/markup.ccg index ae3d4d2f..738ce781 100644 --- a/glib/src/markup.ccg +++ b/glib/src/markup.ccg @@ -110,7 +110,7 @@ void ParserCallbacks::start_element(GMarkupParseContext* context, for(; *pname && *pvalue; ++pname, ++pvalue) attributes.insert(Parser::AttributeMap::value_type(*pname, *pvalue)); - g_return_if_fail(*pname == 0 && *pvalue == 0); + g_return_if_fail(*pname == nullptr && *pvalue == nullptr); } cpp_context.get_parser()->on_start_element(cpp_context, element_name, attributes); @@ -249,13 +249,13 @@ ParseContext::ParseContext(Parser& parser, ParseFlags flags) ParseContext::~ParseContext() { - parser_ = 0; + parser_ = nullptr; g_markup_parse_context_free(gobject_); } void ParseContext::parse(const Glib::ustring& text) { - GError* error = 0; + GError* error = nullptr; g_markup_parse_context_parse(gobject_, text.data(), text.bytes(), &error); if(error) @@ -264,7 +264,7 @@ void ParseContext::parse(const Glib::ustring& text) void ParseContext::parse(const char* text_begin, const char* text_end) { - GError* error = 0; + GError* error = nullptr; g_markup_parse_context_parse(gobject_, text_begin, text_end - text_begin, &error); if(error) @@ -273,7 +273,7 @@ void ParseContext::parse(const char* text_begin, const char* text_end) void ParseContext::end_parse() { - GError* error = 0; + GError* error = nullptr; g_markup_parse_context_end_parse(gobject_, &error); if(error) @@ -306,7 +306,7 @@ void ParseContext::destroy_notify_callback(void* data) ParseContext *const self = static_cast<ParseContext*>(data); // Detect premature destruction. - g_return_if_fail(self->parser_ == 0); + g_return_if_fail(self->parser_ == nullptr); } } // namespace Markup diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg new file mode 100644 index 00000000..9d7de8e1 --- /dev/null +++ b/glib/src/miscutils.ccg @@ -0,0 +1,278 @@ +/* Copyright (C) 2002 The gtkmm Development Team + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <cstddef> +#include <cstring> + +#include <glibmm/miscutils.h> +#include <glibmm/utility.h> +#include <glib.h> + + +namespace Glib +{ + +Glib::ustring get_application_name() +{ + return convert_const_gchar_ptr_to_ustring (g_get_application_name()); +} + +void set_application_name(const Glib::ustring& application_name) +{ + g_set_application_name(application_name.c_str()); +} + +std::string get_prgname() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_prgname()); +} + +void set_prgname(const std::string& prgname) +{ + g_set_prgname(prgname.c_str()); +} + +std::string getenv(const std::string& variable, bool& found) +{ + const char *const value = g_getenv(variable.c_str()); + found = (value != nullptr); + return convert_const_gchar_ptr_to_stdstring(value); +} + +std::string getenv(const std::string& variable) +{ + return convert_const_gchar_ptr_to_stdstring(g_getenv(variable.c_str())); +} + +bool setenv(const std::string& variable, const std::string& value, bool overwrite) +{ + return g_setenv(variable.c_str(), value.c_str(), overwrite); +} + +void unsetenv(const std::string& variable) +{ + g_unsetenv(variable.c_str()); +} + +Glib::ArrayHandle<std::string> listenv() +{ + char **value = g_listenv(); + char **end = value; + while(*end){ + ++end; + } + return Glib::ArrayHandle<std::string>(value, end-value, Glib::OWNERSHIP_DEEP); +} + +std::string get_user_name() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_name()); +} + +std::string get_real_name() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_real_name()); +} + +std::string get_home_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_home_dir()); +} + +std::string get_tmp_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_tmp_dir()); +} + +std::string get_current_dir() +{ + return convert_return_gchar_ptr_to_stdstring(g_get_current_dir()); +} + +#ifndef GLIBMM_DISABLE_DEPRECATED +std::string get_user_special_dir(GUserDirectory directory) +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir(directory)); +} +#endif // GLIBMM_DISABLE_DEPRECATED + +std::string get_user_special_dir(UserDirectory directory) +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir((GUserDirectory)directory)); +} + +std::string get_user_data_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_data_dir()); +} + +std::string get_user_config_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_config_dir()); +} + +std::vector<std::string> get_system_data_dirs() +{ + //TODO: Use a utility function: + std::vector<std::string> result; + const char* const * cresult = g_get_system_data_dirs(); + if(!cresult) + return result; + + for(const gchar* const * iter = cresult; *iter != nullptr; ++iter) + { + result.push_back( + convert_const_gchar_ptr_to_stdstring(*iter)); + } + + return result; +} + +std::vector<std::string> get_system_config_dirs() +{ + //TODO: Use a utility function: + std::vector<std::string> result; + const char* const * cresult = g_get_system_config_dirs(); + if(!cresult) + return result; + + for(const gchar* const * iter = cresult; *iter != nullptr; ++iter) + { + result.push_back( + convert_const_gchar_ptr_to_stdstring(*iter)); + } + + return result; +} + +std::string get_user_cache_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_cache_dir()); +} + +bool path_is_absolute(const std::string& filename) +{ + return (g_path_is_absolute(filename.c_str()) != 0); +} + +std::string path_skip_root(const std::string& filename) +{ + // g_path_skip_root() returns a pointer _into_ the argument string, + // or NULL if there was no root component. + return convert_const_gchar_ptr_to_stdstring(g_path_skip_root(filename.c_str())); +} + +std::string path_get_basename(const std::string& filename) +{ + return convert_return_gchar_ptr_to_stdstring(g_path_get_basename(filename.c_str())); +} + +std::string path_get_dirname(const std::string& filename) +{ + return convert_return_gchar_ptr_to_stdstring(g_path_get_dirname(filename.c_str())); +} + +std::string build_filename(const Glib::ArrayHandle<std::string>& elements) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filenamev(const_cast<char**>(elements.data()))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), + static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(), + static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(), + elem7.c_str(), static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7, const std::string& elem8) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(), + elem7.c_str(), elem8.c_str(), static_cast<char*>(0))); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7, const std::string& elem8, + const std::string& elem9) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(), + elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(), + elem7.c_str(), elem8.c_str(), elem9.c_str(), static_cast<char*>(0))); +} + +std::string build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements) +{ + return convert_return_gchar_ptr_to_stdstring(g_build_pathv(separator.c_str(), const_cast<char**>(elements.data()))); +} + +std::string find_program_in_path(const std::string& program) +{ + return convert_return_gchar_ptr_to_stdstring(g_find_program_in_path(program.c_str())); +} + +Glib::ustring format_size(guint64 size, FormatSizeFlags flags) +{ + return convert_return_gchar_ptr_to_ustring(g_format_size_full(size, (GFormatSizeFlags)flags)); +} + +} // namespace Glib diff --git a/glib/src/miscutils.hg b/glib/src/miscutils.hg new file mode 100644 index 00000000..f4833f56 --- /dev/null +++ b/glib/src/miscutils.hg @@ -0,0 +1,501 @@ +/* Copyright (C) 2002 The gtkmm Development Team + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +_DEFS(glibmm,glib) + +#include <glibmm/arrayhandle.h> +#include <glibmm/ustring.h> + +namespace Glib +{ +_WRAP_ENUM(UserDirectory, GUserDirectory, NO_GTYPE) +_WRAP_ENUM(FormatSizeFlags, GFormatSizeFlags, NO_GTYPE) + +/** @defgroup MiscUtils Miscellaneous Utility Functions + * Miscellaneous Utility Functions -- a selection of portable utility functions. + * @{ + */ + +/** Gets a human-readable name for the application, + * as set by Glib::set_application_name(). + * This name should be localized if possible, and is intended for display to + * the user. Contrast with Glib::get_prgname(), which gets a non-localized + * name. If Glib::set_application_name() has not been called, returns the + * result of Glib::get_prgname() (which may be empty if Glib::set_prgname() + * has also not been called). + * + * @return Human-readable application name. May return <tt>""</tt>. + */ +Glib::ustring get_application_name(); + +/** Sets a human-readable name for the application. + * This name should be localized if possible, and is intended for display to + * the user. Contrast with Glib::set_prgname(), which sets a non-localized + * name. Glib::set_prgname() will be called automatically by + * <tt>gtk_init()</tt>, but Glib::set_application_name() will not. + * + * Note that for thread safety reasons, this function can only be called once. + * + * The application name will be used in contexts such as error messages, + * or when displaying an application's name in the task list. + * + * @param application_name Localized name of the application. + */ +void set_application_name(const Glib::ustring& application_name); + +/** Gets the name of the program. + * If you are using GDK or GTK+ the program name is set in <tt>gdk_init()</tt>, + * which is called by <tt>gtk_init()</tt>. The program name is found by taking + * the last component of <tt>argv[0]</tt>. + * @return The name of the program. + */ +std::string get_prgname(); + +/** Sets the name of the program. + * @param prgname The name of the program. + */ +void set_prgname(const std::string& prgname); + +/** Returns the value of an environment variable. The name and value + * are in the GLib file name encoding. On Unix, this means the actual + * bytes which might or might not be in some consistent character set + * and encoding. On Windows, it is in UTF-8. On Windows, in case the + * environment variable's value contains references to other + * environment variables, they are expanded. + * + * @param variable The environment variable to get. + * @param[out] found Whether the environment variable has been found. + * @return The value of the environment variable, or <tt>""</tt> if not found. + */ +std::string getenv(const std::string& variable, bool& found); + +/** Returns the value of an environment variable. The name and value + * are in the GLib file name encoding. On Unix, this means the actual + * bytes which might or might not be in some consistent character set + * and encoding. On Windows, it is in UTF-8. On Windows, in case the + * environment variable's value contains references to other + * environment variables, they are expanded. + * + * @param variable The environment variable to get. + * @return The value of the environment variable, or <tt>""</tt> if not found. + */ +std::string getenv(const std::string& variable); + + +/** Sets an environment variable. Both the variable's name and value + * should be in the GLib file name encoding. On Unix, this means that + * they can be any sequence of bytes. On Windows, they should be in + * UTF-8. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * + * @param variable The environment variable to set. It must not contain '='. + * @param value The value to which the variable should be set. + * @param overwrite Whether to change the variable if it already exists. + * @result false if the environment variable couldn't be set. + */ +bool setenv(const std::string& variable, const std::string& value, bool overwrite = true); + +/** Removes an environment variable from the environment. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * Furthermore, this function can't be guaranteed to operate in a + * threadsafe way. + * + * @param variable: the environment variable to remove. It must not contain '='. + **/ +void unsetenv(const std::string& variable); + +/** Gets the names of all variables set in the environment. + * + * Programs that want to be portable to Windows should typically use this + * function and getenv() instead of using the environ array from the C library + * directly. On Windows, the strings in the environ array are in system + * codepage encoding, while in most of the typical use cases for environment + * variables in GLib-using programs you want the UTF-8 encoding that this + * function and getenv() provide. + * + * @return Array of environment names (The generic ArrayHandle will be + * implicitly converted to any STL compatible container type). + */ +Glib::ArrayHandle<std::string> listenv(); + +/** Gets the user name of the current user. + * @return The name of the current user. + */ +std::string get_user_name(); + +/** Gets the real name of the user. + * This usually comes from the user's entry in the <tt>passwd</tt> file. + * @return The user's real name. + */ +std::string get_real_name(); + +/** Gets the current user's home directory. + * @return The current user's home directory or an empty string if not defined. + */ +std::string get_home_dir(); + +/** Gets the directory to use for temporary files. + * This is found from inspecting the environment variables <tt>TMPDIR</tt>, + * <tt>TMP</tt>, and <tt>TEMP</tt> in that order. If none of those are defined + * <tt>"/tmp"</tt> is returned on UNIX and <tt>"C:\\"</tt> on Windows. + * @return The directory to use for temporary files. + */ +std::string get_tmp_dir(); + +/** Gets the current directory. + * @return The current directory. + */ +std::string get_current_dir(); + +#ifndef GLIBMM_DISABLE_DEPRECATED +/** Returns the full path of a special directory using its logical id. + * + * On Unix this is done using the XDG special user directories. + * For compatibility with existing practise, G_USER_DIRECTORY_DESKTOP + * falls back to `$HOME/Desktop` when XDG special user directories have + * not been set up. + * + * Depending on the platform, the user might be able to change the path + * of the special directory without requiring the session to restart; GLib + * will not reflect any change once the special directories are loaded. + * + * @param directory The logical id of special directory. + * @return The path to the specified special directory, or an empty string + * if the logical id was not found. + * + * @newin{2,14} + * @deprecated Use get_user_special_dir(Glib::UserDirectory directory) instead. + */ +std::string get_user_special_dir(GUserDirectory directory); +#endif // GLIBMM_DISABLE_DEPRECATED + +/** Returns the full path of a special directory using its logical id. + * + * On Unix this is done using the XDG special user directories. + * For compatibility with existing practise, Glib::USER_DIRECTORY_DESKTOP + * falls back to `$HOME/Desktop` when XDG special user directories have + * not been set up. + * + * Depending on the platform, the user might be able to change the path + * of the special directory without requiring the session to restart; GLib + * will not reflect any change once the special directories are loaded. + * + * @param directory The logical id of special directory. + * @return The path to the specified special directory, or an empty string + * if the logical id was not found. + * + * @newin{2,46} + */ +std::string get_user_special_dir(UserDirectory directory); + +/** Returns a base directory in which to access application data such as icons + * that is customized for a particular user. + * + * On UNIX platforms this is determined using the mechanisms described in the + * XDG Base Directory Specification + * + * @newin{2,14} + */ +std::string get_user_data_dir(); + +/** Returns a base directory in which to store user-specific application + * configuration information such as user preferences and settings. + * + * On UNIX platforms this is determined using the mechanisms described in the + * XDG Base Directory Specification + * + * @newin{2,14} + */ +std::string get_user_config_dir(); + +/** Returns an ordered list of base directories in which to access system-wide application data. + * On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification. + * + * @newin{2,18} + */ +std::vector<std::string> get_system_data_dirs(); + +/** Returns an ordered list of base directories in which to access system-wide configuration information. + * On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification. + * + * @newin{2,18} + */ +std::vector<std::string> get_system_config_dirs(); + +/** Returns a base directory in which to store non-essential, cached data + * specific to particular user. + * + * On UNIX platforms this is determined using the mechanisms described in the + * XDG Base Directory Specification + * + * @newin{2,14} + */ +std::string get_user_cache_dir(); + +/** Returns @c true if the given @a filename is an absolute file name, i.e.\ it + * contains a full path from the root directory such as <tt>"/usr/local"</tt> + * on UNIX or <tt>"C:\\windows"</tt> on Windows systems. + * @param filename A file name. + * @return Whether @a filename is an absolute path. + */ +bool path_is_absolute(const std::string& filename); + +/** Returns the remaining part of @a filename after the root component, + * i.e.\ after the <tt>"/"</tt> on UNIX or <tt>"C:\\"</tt> on Windows. + * If @a filename is not an absolute path, <tt>""</tt> will be returned. + * @param filename A file name. + * @return The file name without the root component, or <tt>""</tt>. + */ +std::string path_skip_root(const std::string& filename); + +/** Gets the name of the file without any leading directory components. + * @param filename The name of the file. + * @return The name of the file without any leading directory components. + */ +std::string path_get_basename(const std::string& filename); + +/** Gets the directory components of a file name. + * If the file name has no directory components <tt>"."</tt> is returned. + * @param filename The name of the file. + * @return The directory components of the file. + */ +std::string path_get_dirname(const std::string& filename); + +/** Creates a filename from a series of elements using the correct + * separator for filenames. + * This function behaves identically to Glib::build_path(G_DIR_SEPARATOR_S, + * elements). No attempt is made to force the resulting filename to be an + * absolute path. If the first element is a relative path, the result will + * be a relative path. + * @param elements A container holding the elements of the path to build. + * Any STL compatible container type is accepted. + * @return The resulting path. + */ +std::string build_filename(const Glib::ArrayHandle<std::string>& elements); + +/** Creates a filename from two elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @return The resulting path. + */ +std::string build_filename(const std::string& elem1, const std::string& elem2); + +/** Creates a filename from three elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3); + + +/** Creates a filename from four elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4); + +/** Creates a filename from five elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @param elem5 Fifth path element. + * @return The resulting path. + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5); + +/** Creates a filename from six elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @param elem5 Fifth path element. + * @param elem6 Sixth path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6); + +/** Creates a filename from seven elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @param elem5 Fifth path element. + * @param elem6 Sixth path element. + * @param elem7 Seventh path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7); + +/** Creates a filename from eight elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @param elem5 Fifth path element. + * @param elem6 Sixth path element. + * @param elem7 Seventh path element. + * @param elem8 Eighth path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7, const std::string& elem8); + +/** Creates a filename from nine elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @param elem3 Third path element. + * @param elem4 Fourth path element. + * @param elem5 Fifth path element. + * @param elem6 Sixth path element. + * @param elem7 Seventh path element. + * @param elem8 Eighth path element. + * @param elem9 Ninth path element. + * @return The resulting path. + * + * @newin{2,28} + */ +std::string build_filename(const std::string& elem1, const std::string& elem2, + const std::string& elem3, const std::string& elem4, + const std::string& elem5, const std::string& elem6, + const std::string& elem7, const std::string& elem8, + const std::string& elem9); + +/** Creates a path from a series of elements using @a separator as the + * separator between elements. + * + * At the boundary between two elements, any trailing occurrences of + * @a separator in the first element, or leading occurrences of @a separator + * in the second element are removed and exactly one copy of the separator is + * inserted. + * + * Empty elements are ignored. + * + * The number of leading copies of the separator on the result is + * the same as the number of leading copies of the separator on + * the first non-empty element. + * + * The number of trailing copies of the separator on the result is the same + * as the number of trailing copies of the separator on the last non-empty + * element. (Determination of the number of trailing copies is done without + * stripping leading copies, so if the separator is <tt>"ABA"</tt>, + * <tt>"ABABA"</tt> has 1 trailing copy.) + * + * However, if there is only a single non-empty element, and there + * are no characters in that element not part of the leading or + * trailing separators, then the result is exactly the original value + * of that element. + * + * Other than for determination of the number of leading and trailing + * copies of the separator, elements consisting only of copies + * of the separator are ignored. + * + * @param separator A string used to separate the elements of the path. + * @param elements A container holding the elements of the path to build. + * Any STL compatible container type is accepted. + * @return The resulting path. + */ +std::string build_path(const std::string& separator, + const Glib::ArrayHandle<std::string>& elements); + +/** Locates the first executable named @a program in the user's path, in the + * same way that <tt>execvp()</tt> would locate it. + * Returns a string with the absolute path name, or <tt>""</tt> if the program + * is not found in the path. If @a program is already an absolute path, + * returns a copy of @a program if @a program exists and is executable, and + * <tt>""</tt> otherwise. + * + * On Windows, if @a program does not have a file type suffix, tries to append + * the suffixes in the <tt>PATHEXT</tt> environment variable (if that doesn't + * exist, the suffixes .com, .exe, and .bat) in turn, and then look for the + * resulting file name in the same way as CreateProcess() would. This means + * first in the directory where the program was loaded from, then in the + * current directory, then in the Windows 32-bit system directory, then in the + * Windows directory, and finally in the directories in the <tt>PATH</tt> + * environment variable. If the program is found, the return value contains + * the full name including the type suffix. + * + * @param program A program name. + * @return An absolute path, or <tt>""</tt>. + */ +std::string find_program_in_path(const std::string& program); + +/** Formats a size (for example the size of a file) into a human readable string. + * + * Sizes are rounded to the nearest size prefix (kB, MB, GB) + * and are displayed rounded to the nearest tenth. E.g. the file size + * 3292528 bytes will be converted into the string "3.2 MB". + * + * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes), unless the + * Glib::FORMAT_SIZE_IEC_UNITS flag is set. + * + * @param size A size in bytes. + * @param flags Flags to modify the output. + * @return A formatted string containing a human readable file size. + * + * @newin{2,46} + */ +Glib::ustring format_size(guint64 size, FormatSizeFlags flags = FORMAT_SIZE_DEFAULT); + +/** @} group MiscUtils */ + +} // namespace Glib diff --git a/glib/src/module.ccg b/glib/src/module.ccg index 8afd6d35..4e4666cd 100644 --- a/glib/src/module.ccg +++ b/glib/src/module.ccg @@ -34,7 +34,7 @@ Module::~Module() Module::operator bool() const { - return (gobject_ != 0); + return (gobject_ != nullptr); } } // namespace Glib diff --git a/glib/src/module.hg b/glib/src/module.hg index 65f7f87a..f1caf774 100644 --- a/glib/src/module.hg +++ b/glib/src/module.hg @@ -61,7 +61,7 @@ public: * Glib::Module module("plugins/helloworld"); * if(module) * { - * void* func = 0; + * void* func = nullptr; * bool found = get_symbol("some_function", func); * } * @endcode diff --git a/glib/src/nodetree.hg b/glib/src/nodetree.hg index 5a4a4b79..fb0ff7b5 100644 --- a/glib/src/nodetree.hg +++ b/glib/src/nodetree.hg @@ -185,7 +185,10 @@ public: g_node_append(gobj(), node.gobj()); return node; } - _IGNORE(g_node_append) + dnl// Some glib functions are in fact preprocessor macros. + dnl// h2def.py does not recognize them. _IGNORE()ing them produces + dnl// ugly error messages in the generated nodetree.h file. + dnl// _IGNORE(g_node_append) /** Inserts a NodeTree as the first child. * @@ -212,7 +215,7 @@ public: insert(position, *node); return node; } - _IGNORE(g_node_insert_data) + dnl// _IGNORE(g_node_insert_data) /** Inserts a new NodeTree before the given sibling. * @@ -226,7 +229,7 @@ public: insert_before(sibling, *node); return node; } - _IGNORE(g_node_insert_data_before) + dnl// _IGNORE(g_node_insert_data_before) /** Inserts a new NodeTree as the last child. * @@ -239,7 +242,7 @@ public: append(*node); return node; } - _IGNORE(g_node_append_data) + dnl// _IGNORE(g_node_append_data) /** Inserts a new NodeTree as the first child. * @@ -252,7 +255,7 @@ public: prepend(*node); return node; } - _IGNORE(g_node_prepend_data) + dnl// _IGNORE(g_node_prepend_data) /** Reverses the order of the children. */ @@ -334,7 +337,7 @@ public: { sigc::slot<void, GNode*, const T&, GNode**> real_slot = sigc::ptr_fun(on_compare_child); - GNode* child = 0; + GNode* child = nullptr; typedef sigc::slot<void, GNode*> type_foreach_gnode_slot; type_foreach_gnode_slot bound_slot = sigc::bind(real_slot, the_data, &child); @@ -367,7 +370,7 @@ public: { //We use a sigc::slot for the C callback, so we can bind some extra data. sigc::slot<gboolean, GNode*, const T&, GNode**> real_slot = sigc::ptr_fun(on_compare_node); - GNode* child = 0; + GNode* child = nullptr; typedef sigc::slot<gboolean, GNode*> type_traverse_gnode_slot; type_traverse_gnode_slot bound_slot = sigc::bind(real_slot, the_data, &child); @@ -441,7 +444,7 @@ public: { return const_cast<NodeTree<T>*>(this)->first_child(); } - _IGNORE(g_node_first_child) + dnl// _IGNORE(g_node_first_child) /** Gets the last child. * @@ -515,7 +518,7 @@ public: { return const_cast<NodeTree<T>*>(this)->prev_sibling(); } - _IGNORE(g_node_prev_sibling) + dnl// _IGNORE(g_node_prev_sibling) /** Gets the next sibling * @@ -534,7 +537,7 @@ public: { return const_cast<NodeTree<T>*>(this)->next_sibling(); } - _IGNORE(g_node_next_sibling) + dnl// _IGNORE(g_node_next_sibling) /** Gets the last sibling. * @@ -687,11 +690,11 @@ private: //Free the wrapped object (g_node_free not available) g_slice_free(GNode, gobject_); - gobject_ = 0; + gobject_ = nullptr; } ///Create a new GNode, taking the contents of an existing node if one is specified. - void clone(const NodeTree<T>* node = 0) + void clone(const NodeTree<T>* node = nullptr) { //Store the this pointer in the GNode so we can discover this wrapper later: gobject_ = g_node_new(reinterpret_cast<gpointer>(this)); @@ -699,7 +702,7 @@ private: if(node) { //Prepend the copied children of @node to the constructing node. - for(const NodeTree<T>* i = node->last_child(); i != 0; i = i->prev_sibling()) + for(const NodeTree<T>* i = node->last_child(); i != nullptr; i = i->prev_sibling()) prepend(*(new NodeTree<T>(*i))); } } diff --git a/glib/src/optioncontext.ccg b/glib/src/optioncontext.ccg index 601b928c..56980b49 100644 --- a/glib/src/optioncontext.ccg +++ b/glib/src/optioncontext.ccg @@ -65,7 +65,7 @@ OptionContext::~OptionContext() if(has_ownership_) g_option_context_free(gobj()); - gobject_ = 0; + gobject_ = nullptr; } void OptionContext::add_group(OptionGroup& group) @@ -84,7 +84,7 @@ void OptionContext::set_main_group(OptionGroup& group) /* OptionGroup OptionContext::get_main_group() const { - const GOptionGroup* cobj = g_option_context_get_main_group(const_cast<GOptionContext*>( gobj()) ); + const auto cobj = g_option_context_get_main_group(const_cast<GOptionContext*>( gobj()) ); OptionGroup cppObj(const_cast<GOptionGroup*>(cobj), true); // take_copy return cppObj; } @@ -95,7 +95,7 @@ void OptionContext::set_translate_func (const SlotTranslate& slot) { //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter. //It will be deleted when SignalProxy_translate_gtk_callback_destroy() is called. - SlotTranslate* slot_copy = new SlotTranslate(slot); + auto slot_copy = new SlotTranslate(slot); g_option_context_set_translate_func( gobj(), &OptionContextPrivate::SignalProxy_translate_gtk_callback, slot_copy, diff --git a/glib/src/optioncontext.hg b/glib/src/optioncontext.hg index 60c35497..321bb66c 100644 --- a/glib/src/optioncontext.hg +++ b/glib/src/optioncontext.hg @@ -105,6 +105,9 @@ public: _WRAP_METHOD(void set_ignore_unknown_options(bool ignore_unknown = true), g_option_context_set_ignore_unknown_options) _WRAP_METHOD(bool get_ignore_unknown_options() const, g_option_context_get_ignore_unknown_options) + _WRAP_METHOD(void set_strict_posix(bool strict_posix = true), g_option_context_set_strict_posix) + _WRAP_METHOD(bool get_strict_posix() const, g_option_context_get_strict_posix) + #m4 _CONVERSION(`char**&',`gchar***',`&($3)') _WRAP_METHOD(bool parse(int& argc, char**& argv), g_option_context_parse, errthrow) diff --git a/glib/src/optionentry.ccg b/glib/src/optionentry.ccg index 9a64f102..37641692 100644 --- a/glib/src/optionentry.ccg +++ b/glib/src/optionentry.ccg @@ -75,7 +75,7 @@ void OptionEntry::set_long_name(const Glib::ustring& value) if(gobject_->long_name) { g_free((gchar*)(gobject_->long_name)); - gobject_->long_name = 0; + gobject_->long_name = nullptr; } //Note that we do not use NULL for an empty string, @@ -89,7 +89,7 @@ void OptionEntry::set_description(const Glib::ustring& value) if(gobject_->description) { g_free((gchar*)(gobject_->description)); - gobject_->description = 0; + gobject_->description = nullptr; } gobj()->description = (value).empty() ? 0 : g_strdup((value).c_str()); @@ -100,7 +100,7 @@ void OptionEntry::set_arg_description(const Glib::ustring& value) if(gobject_->arg_description) { g_free((gchar*)(gobject_->arg_description)); - gobject_->arg_description = 0; + gobject_->arg_description = nullptr; } gobj()->arg_description = (value).empty() ? 0 : g_strdup((value).c_str()); diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index 4a875646..4d26a8f7 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -43,7 +43,7 @@ public: { } bool is_filename_option() const - { return slot_filename_ != 0; } + { return slot_filename_ != nullptr; } const OptionGroup::SlotOptionArgString* get_slot_string() const { return slot_string_; } @@ -75,7 +75,7 @@ static gboolean g_callback_pre_parse(GOptionContext* context, { OptionContext cppContext(context, false /* take_ownership */); - OptionGroup* option_group = static_cast<OptionGroup*>(data); + auto option_group = static_cast<OptionGroup*>(data); if(!option_group) { OptionError(OptionError::FAILED, "Glib::OptionGroup: g_callback_pre_parse(): " @@ -108,7 +108,7 @@ static void g_callback_error(GOptionContext* context, OptionContext cppContext(context, false /* take_ownership */); - OptionGroup* option_group = static_cast<OptionGroup*>(data); + auto option_group = static_cast<OptionGroup*>(data); if(option_group) return option_group->on_error(cppContext, *option_group); } @@ -157,10 +157,9 @@ gboolean OptionGroup::post_parse_callback(GOptionContext* context, //The C args have now been given values by g_option_context_parse(). //Convert C values to C++ values: - for(type_map_entries::iterator iter = option_group->map_entries_.begin(); - iter != option_group->map_entries_.end(); ++iter) + for(auto& the_pair : option_group->map_entries_) { - CppOptionEntry& cpp_entry = iter->second; + auto& cpp_entry = the_pair.second; cpp_entry.convert_c_to_cpp(); } @@ -198,17 +197,17 @@ gboolean OptionGroup::option_arg_callback(const gchar* option_name, const gchar* if(option_name[1] == '-') { //Long option name. - const Glib::ustring long_option_name = Glib::ustring(option_name+2); + const auto long_option_name = Glib::ustring(option_name+2); iterFind = option_group->map_entries_.find(long_option_name); } else { //Short option name. - const gchar short_option_name = option_name[1]; + const auto short_option_name = option_name[1]; for(iterFind = option_group->map_entries_.begin(); iterFind != option_group->map_entries_.end(); ++iterFind) { - const OptionGroup::CppOptionEntry& cppOptionEntry = iterFind->second; + const auto& cppOptionEntry = iterFind->second; if (cppOptionEntry.entry_ && cppOptionEntry.entry_->get_short_name() == short_option_name) break; @@ -222,7 +221,7 @@ gboolean OptionGroup::option_arg_callback(const gchar* option_name, const gchar* return false; } - const OptionGroup::CppOptionEntry& cppOptionEntry = iterFind->second; + const auto& cppOptionEntry = iterFind->second; if (cppOptionEntry.carg_type_ != G_OPTION_ARG_CALLBACK) { OptionError(OptionError::FAILED, "Glib::OptionGroup::option_arg_callback() " @@ -230,20 +229,20 @@ gboolean OptionGroup::option_arg_callback(const gchar* option_name, const gchar* return false; } - const bool has_value = (value != 0); + const bool has_value = (value != nullptr); const OptionArgCallback* const option_arg = static_cast<const OptionArgCallback*>(cppOptionEntry.cpparg_); try { if (option_arg->is_filename_option()) { - const OptionGroup::SlotOptionArgFilename* the_slot = option_arg->get_slot_filename(); + const auto the_slot = option_arg->get_slot_filename(); const std::string cpp_value(value ? value : ""); return (*the_slot)(cpp_option_name, cpp_value, has_value); } else { - const OptionGroup::SlotOptionArgString* the_slot = option_arg->get_slot_string(); + const auto the_slot = option_arg->get_slot_string(); const Glib::ustring cpp_value(value ? value : ""); return (*the_slot)(cpp_option_name, cpp_value, has_value); } @@ -286,16 +285,16 @@ OptionGroup::OptionGroup(GOptionGroup* castitem) OptionGroup::~OptionGroup() { //Free any C types that were allocated during add_entry(): - for(type_map_entries::iterator iter = map_entries_.begin(); iter != map_entries_.end(); ++iter) + for(auto& the_pair : map_entries_) { - CppOptionEntry& cpp_entry = iter->second; + auto& cpp_entry = the_pair.second; cpp_entry.release_c_arg(); } if(has_ownership_) { - g_option_group_free(gobj()); - gobject_ = 0; + g_option_group_unref(gobj()); + gobject_ = nullptr; } } @@ -375,35 +374,61 @@ void OptionGroup::add_entry_filename(const OptionEntry& entry, const SlotOptionA void OptionGroup::add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_type, void* cpp_arg) { - const Glib::ustring name = entry.get_long_name(); + const auto name = entry.get_long_name(); type_map_entries::iterator iterFind = map_entries_.find(name); - if( iterFind == map_entries_.end() ) //If we have not added this entry already + if (iterFind == map_entries_.end()) //If we have not added this entry already { CppOptionEntry cppEntry; //g_option_group_add_entry() does not take its own copy, so we must keep the instance alive. cppEntry.entry_ = new OptionEntry(entry); //cppEntry.entry_ is deleted in release_c_arg(), via the destructor. - cppEntry.carg_type_ = arg_type; - cppEntry.allocate_c_arg(); - cppEntry.set_c_arg_default(cpp_arg); + // Several options can refer to the same C++ variable, + // typically a pair of --enable-x / --disable-x options. + // Only one C variable shall be allocated for them. + // See https://bugzilla.gnome.org/show_bug.cgi?id=744854. + bool is_duplicate = false; + void* carg = nullptr; + if (arg_type != G_OPTION_ARG_CALLBACK) + { + for (type_map_entries::iterator iter = map_entries_.begin(); + iter != map_entries_.end(); ++iter) + { + const auto& cpp_entry = iter->second; + if (cpp_entry.cpparg_ == cpp_arg && + cpp_entry.carg_type_ == arg_type && + cpp_entry.carg_) + { + is_duplicate = true; + carg = cpp_entry.carg_; + break; + } + } + } + cppEntry.carg_type_ = arg_type; + if (!is_duplicate) + { + cppEntry.allocate_c_arg(); + cppEntry.set_c_arg_default(cpp_arg); + carg = cppEntry.carg_; + } cppEntry.cpparg_ = cpp_arg; //Give the information to the C API: cppEntry.entry_->gobj()->arg = arg_type; - cppEntry.entry_->gobj()->arg_data = cppEntry.carg_; + cppEntry.entry_->gobj()->arg_data = carg; //Remember the C++/C mapping so that we can use it later: map_entries_[name] = cppEntry; add_entry(*(cppEntry.entry_)); } - else if( arg_type == G_OPTION_ARG_CALLBACK ) + else if (arg_type == G_OPTION_ARG_CALLBACK) { //Delete the OptionArgCallback instance that was allocated by add_entry() //or add_entry_filename(). - OptionArgCallback* option_arg = static_cast<OptionArgCallback*>(cpp_arg); + auto option_arg = static_cast<OptionArgCallback*>(cpp_arg); delete option_arg; } } @@ -428,7 +453,7 @@ void OptionGroup::set_translate_func(const SlotTranslate& slot) // Create a copy of the slot. A pointer to this will be passed through the // callback's data parameter. It will be deleted when // OptionGroup_Translate_glibmm_callback_destroy() is called. - SlotTranslate* slot_copy = new SlotTranslate(slot); + auto slot_copy = new SlotTranslate(slot); g_option_group_set_translate_func(gobj(), &OptionGroup_Translate_glibmm_callback, slot_copy, &OptionGroup_Translate_glibmm_callback_destroy); @@ -448,13 +473,12 @@ void OptionGroup::CppOptionEntry::allocate_c_arg() //defaults based on the C++-typed arguments. switch(carg_type_) { - case G_OPTION_ARG_STRING: //The char* will be for UTF8 strins. - case G_OPTION_ARG_FILENAME: //The char* will be for strings in the current locale's encoding. + case G_OPTION_ARG_STRING: //The char* will be for UTF8 a string. + case G_OPTION_ARG_FILENAME: //The char* will be for a string in the current locale's encoding. { char** typed_arg = new char*; //The C code will allocate a char* and put it here, for us to g_free() later. - //Alternatively, set_c_arg_default() might allocate a char*, and the C code might or might not free and replace that. - *typed_arg = 0; + *typed_arg = nullptr; carg_ = typed_arg; break; @@ -479,15 +503,16 @@ void OptionGroup::CppOptionEntry::allocate_c_arg() case G_OPTION_ARG_FILENAME_ARRAY: { char*** typed_arg = new char**; + //The C code will allocate a char** and put it here, for us to g_strfreev() later. *typed_arg = 0; carg_ = typed_arg; break; } - case G_OPTION_ARG_NONE: /* Actually a boolean. */ + case G_OPTION_ARG_NONE: // Actually a boolean. { gboolean* typed_arg = new gboolean; - *typed_arg = 0; + *typed_arg = false; carg_ = typed_arg; break; @@ -546,63 +571,16 @@ void OptionGroup::CppOptionEntry::set_c_arg_default(void* cpp_arg) break; } case G_OPTION_ARG_STRING: - { - Glib::ustring* typed_cpp_arg = static_cast<Glib::ustring*>(cpp_arg); - if(typed_cpp_arg && !typed_cpp_arg->empty()) - { - const char** typed_c_arg = static_cast<const char**>(carg_); - *typed_c_arg = g_strdup(typed_cpp_arg->c_str()); //Freed in release_c_arg(). - } - break; - } case G_OPTION_ARG_FILENAME: - { - std::string* typed_cpp_arg = static_cast<std::string*>(cpp_arg); - if(typed_cpp_arg && !typed_cpp_arg->empty()) - { - const char** typed_c_arg = static_cast<const char**>(carg_); - *typed_c_arg = g_strdup(typed_cpp_arg->c_str()); //Freed in release_c_arg(). - } - break; - } case G_OPTION_ARG_STRING_ARRAY: - { - std::vector<Glib::ustring>* typed_cpp_arg = static_cast<std::vector<Glib::ustring>*>(cpp_arg); - if(typed_cpp_arg) - { - std::vector<Glib::ustring>& vec = *typed_cpp_arg; - const char** array = static_cast<const char**>( g_malloc(sizeof(gchar*) * (vec.size() + 1)) ); - - for(std::vector<Glib::ustring>::size_type i = 0; i < vec.size(); ++i) - { - array[i] = g_strdup( vec[i].c_str() ); - } - - array[vec.size()] = 0; - - const char*** typed_c_arg = static_cast<const char***>(carg_); - *typed_c_arg = array; - } - break; - } case G_OPTION_ARG_FILENAME_ARRAY: { - std::vector<std::string>* typed_cpp_arg = static_cast<std::vector<std::string>*>(cpp_arg); - if(typed_cpp_arg) - { - std::vector<std::string>& vec = *typed_cpp_arg; - const char** array = static_cast<const char**>( g_malloc(sizeof(gchar*) * (vec.size() + 1)) ); - - for(std::vector<Glib::ustring>::size_type i = 0; i < vec.size(); ++i) - { - array[i] = g_strdup( vec[i].c_str() ); - } - - array[vec.size()] = 0; - - const char*** typed_c_arg = static_cast<const char***>(carg_); - *typed_c_arg = array; - } + // No need to set default values for string-valued options. + // If *carg_ is still 0, when convert_c_to_cpp() is called, just don't + // touch *cpparg_. Besides, setting default values in *carg_ can result + // in memory leaks, because glib would not free the strings before + // the char*'s are overwritten with pointers to newly allocated copies + // of the command option arguments. break; } case G_OPTION_ARG_CALLBACK: @@ -640,8 +618,8 @@ void OptionGroup::CppOptionEntry::release_c_arg() case G_OPTION_ARG_FILENAME: { char** typed_arg = static_cast<char**>(carg_); - g_free(*typed_arg); //Free the char* string at type_arg, which was allocated by the C code. - delete typed_arg; //Delete the char** that we allocated in allocate_c_arg; + g_free(*typed_arg); //Free the char* string at typed_arg, if allocated by the C code. + delete typed_arg; //Delete the char** that we allocated in allocate_c_arg(). break; } @@ -662,10 +640,13 @@ void OptionGroup::CppOptionEntry::release_c_arg() case G_OPTION_ARG_STRING_ARRAY: case G_OPTION_ARG_FILENAME_ARRAY: { - delete (char**)carg_; + char*** typed_arg = static_cast<char***>(carg_); + g_strfreev(*typed_arg); //Free the array of strings and the array at typed_arg, if allocated by the C code. + delete typed_arg; //Delete the char*** that we allocated in allocate_c_arg(). + break; } - case G_OPTION_ARG_NONE: /* Actually a boolean. */ + case G_OPTION_ARG_NONE: // Actually a boolean. { gboolean* typed_arg = static_cast<gboolean*>(carg_); delete typed_arg; @@ -676,9 +657,9 @@ void OptionGroup::CppOptionEntry::release_c_arg() { //Delete the OptionArgCallback instance that was allocated by add_entry() //or add_entry_filename(). - OptionArgCallback* option_arg = static_cast<OptionArgCallback*>(cpparg_); + auto option_arg = static_cast<OptionArgCallback*>(cpparg_); delete option_arg; - cpparg_ = 0; + cpparg_ = nullptr; break; } @@ -688,7 +669,7 @@ void OptionGroup::CppOptionEntry::release_c_arg() } } - carg_ = 0; + carg_ = nullptr; } if(entry_) @@ -697,31 +678,30 @@ void OptionGroup::CppOptionEntry::release_c_arg() void OptionGroup::CppOptionEntry::convert_c_to_cpp() { + if (!carg_) + return; + switch(carg_type_) { case G_OPTION_ARG_STRING: { char** typed_arg = static_cast<char**>(carg_); - Glib::ustring* typed_cpp_arg = static_cast<Glib::ustring*>(cpparg_); - if(typed_arg && typed_cpp_arg) + auto typed_cpp_arg = static_cast<Glib::ustring*>(cpparg_); + if(typed_arg && *typed_arg && typed_cpp_arg) { - char* pch = *typed_arg; - (*typed_cpp_arg) = Glib::convert_const_gchar_ptr_to_ustring(pch); - - break; + *typed_cpp_arg = *typed_arg; } + break; } case G_OPTION_ARG_FILENAME: { char** typed_arg = static_cast<char**>(carg_); - std::string* typed_cpp_arg = static_cast<std::string*>(cpparg_); - if(typed_arg && typed_cpp_arg) + auto typed_cpp_arg = static_cast<std::string*>(cpparg_); + if(typed_arg && *typed_arg && typed_cpp_arg) { - char* pch = *typed_arg; - (*typed_cpp_arg) = Glib::convert_const_gchar_ptr_to_stdstring(pch); - - break; + *typed_cpp_arg = *typed_arg; } + break; } case G_OPTION_ARG_INT: { @@ -736,12 +716,12 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() case G_OPTION_ARG_STRING_ARRAY: { char*** typed_arg = static_cast<char***>(carg_); - vecustrings* typed_cpp_arg = static_cast<vecustrings*>(cpparg_); - if(typed_arg && typed_cpp_arg) + auto typed_cpp_arg = static_cast<vecustrings*>(cpparg_); + if(typed_arg && *typed_arg && typed_cpp_arg) { typed_cpp_arg->clear(); - //The C array seems to be null-terminated. + //The C array is null-terminated. //Glib::StringArrayHandle array_handle(*typed_arg, Glib::OWNERSHIP_NONE); //The SUN Forte compiler complains about this: @@ -765,36 +745,34 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() //So we do this: char** char_array_next = *typed_arg; - while(char_array_next && *char_array_next) + while(*char_array_next) { typed_cpp_arg->push_back(*char_array_next); ++char_array_next; } } - break; } case G_OPTION_ARG_FILENAME_ARRAY: { char*** typed_arg = static_cast<char***>(carg_); - vecustrings* typed_cpp_arg = static_cast<vecustrings*>(cpparg_); - if(typed_arg && typed_cpp_arg) + auto typed_cpp_arg = static_cast<vecstrings*>(cpparg_); + if(typed_arg && *typed_arg && typed_cpp_arg) { typed_cpp_arg->clear(); //See comments above about the SUN Forte and Tru64 compilers. char** char_array_next = *typed_arg; - while(char_array_next && *char_array_next) + while(*char_array_next) { typed_cpp_arg->push_back(*char_array_next); ++char_array_next; } } - break; } - case G_OPTION_ARG_NONE: /* Actually a boolean. */ + case G_OPTION_ARG_NONE: // Actually a boolean. { *(static_cast<bool*>(cpparg_)) = *(static_cast<gboolean*>(carg_)); break; diff --git a/glib/src/optiongroup.hg b/glib/src/optiongroup.hg index 98572080..4afe9c1e 100644 --- a/glib/src/optiongroup.hg +++ b/glib/src/optiongroup.hg @@ -37,6 +37,8 @@ class OptionEntry; class OptionContext; #endif //DOXYGEN_SHOULD_SKIP_THIS +//TODO: GOptionGroup is now refcounted. See https://bugzilla.gnome.org/show_bug.cgi?id=743349 +//When we can break API/ABI, make Glib::OptionGroup refcounted. _CLASS_OPAQUE_REFCOUNTED? /** An OptionGroup defines the options in a single group. * Libraries which need to parse commandline options are expected to provide a function that allows their OptionGroups to * be added to the application's OptionContext. @@ -65,10 +67,10 @@ public: * so it is only useful with C functions that return newly-allocated GOptionGroups. */ explicit OptionGroup(GOptionGroup* castitem); - _IGNORE(g_option_group_new) + _IGNORE(g_option_group_new, g_option_group_ref) virtual ~OptionGroup(); - _IGNORE(g_option_group_free) + _IGNORE(g_option_group_free, g_option_group_unref) virtual bool on_pre_parse(OptionContext& context, OptionGroup& group); diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg index af91d4ab..61408cc6 100644 --- a/glib/src/regex.ccg +++ b/glib/src/regex.ccg @@ -24,8 +24,8 @@ Glib::RefPtr<Glib::Regex> Regex::create(const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options) { - GError* gerror = 0; - GRegex* regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options, + GError* gerror = nullptr; + auto regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options, (GRegexMatchFlags)match_options, &gerror); if(gerror) @@ -47,7 +47,7 @@ bool Regex::match( RegexMatchFlags match_options ) { - GMatchInfo* ginfo = 0; + GMatchInfo* ginfo = nullptr; bool const result = static_cast<bool>(g_regex_match(gobj(), string.c_str(), static_cast<GRegexMatchFlags>(match_options), &ginfo)); match_info.set_gobject(ginfo); @@ -66,8 +66,8 @@ bool Regex::match( RegexMatchFlags match_options ) { - GError* gerror = 0; - GMatchInfo* ginfo = 0; + GError* gerror = nullptr; + GMatchInfo* ginfo = nullptr; bool const result = static_cast<bool>(g_regex_match_full(gobj(), string.c_str(), -1, start_position, @@ -88,8 +88,8 @@ bool Regex::match( RegexMatchFlags match_options ) { - GError* gerror = 0; - GMatchInfo* ginfo = 0; + GError* gerror = nullptr; + GMatchInfo* ginfo = nullptr; bool const result = static_cast<bool>(g_regex_match_full(gobj(), string.c_str(), string_len, start_position, @@ -104,7 +104,7 @@ bool Regex::match( bool Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) { - GError* gerror = 0; + GError* gerror = nullptr; bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -114,7 +114,7 @@ bool Regex::match(const Glib::ustring& string, int start_position, RegexMatchFla bool Regex::match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) { - GError* gerror = 0; + GError* gerror = nullptr; bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -128,7 +128,7 @@ bool Regex::match_all( RegexMatchFlags match_options ) { - GMatchInfo* ginfo = 0; + GMatchInfo* ginfo = nullptr; bool const result = static_cast<bool>(g_regex_match_all(gobj(), string.c_str(), static_cast<GRegexMatchFlags>(match_options), &ginfo)); @@ -148,8 +148,8 @@ bool Regex::match_all( RegexMatchFlags match_options ) { - GError* gerror = 0; - GMatchInfo* ginfo = 0; + GError* gerror = nullptr; + GMatchInfo* ginfo = nullptr; bool const retvalue = static_cast<bool>(g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, @@ -170,8 +170,8 @@ bool Regex::match_all( RegexMatchFlags match_options ) { - GError* gerror = 0; - GMatchInfo* ginfo = 0; + GError* gerror = nullptr; + GMatchInfo* ginfo = nullptr; bool const retvalue = static_cast<bool>(g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, @@ -186,7 +186,7 @@ bool Regex::match_all( bool Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) { - GError* gerror = 0; + GError* gerror = nullptr; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -196,7 +196,7 @@ bool Regex::match_all(const Glib::ustring& string, int start_position, RegexMatc bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) { - GError* gerror = 0; + GError* gerror = nullptr; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -206,8 +206,8 @@ bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_ Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options) { - GError* gerror = 0; - Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror))); + GError* gerror = nullptr; + auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -217,8 +217,8 @@ Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, co Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options) { - GError* gerror = 0; - Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace_literal(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror))); + GError* gerror = nullptr; + auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace_literal(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -227,8 +227,8 @@ Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_posi Glib::StringArrayHandle Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const { - GError* gerror = 0; - Glib::StringArrayHandle retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP); + GError* gerror = nullptr; + auto retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -242,19 +242,19 @@ MatchInfo::MatchInfo() { } -MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_ownership) +MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_the_ownership) : gobject_(castitem), - take_ownership(take_ownership) + take_ownership(take_the_ownership) { } -void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_ownership) +void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_the_ownership) { - if(gobject_ && take_ownership) + if(gobject_ && this->take_ownership) g_match_info_free(gobject_); gobject_ = castitem; - this->take_ownership = take_ownership; + this->take_ownership = take_the_ownership; } MatchInfo::~MatchInfo() diff --git a/glib/src/regex.hg b/glib/src/regex.hg index b6ae1f12..818dada0 100644 --- a/glib/src/regex.hg +++ b/glib/src/regex.hg @@ -223,10 +223,10 @@ public: /** C object constructor. * @param castitem The C object. - * @param take_ownership Whether to destroy the C object with the wrapper or + * @param take_the_ownership Whether to destroy the C object with the wrapper or * not. */ - explicit MatchInfo(GMatchInfo* castitem, bool take_ownership = true); + explicit MatchInfo(GMatchInfo* castitem, bool take_the_ownership = true); //TODO: Rename to take_ownership when we can rename the member variable. /// Destructor. virtual ~MatchInfo(); @@ -273,7 +273,7 @@ public: protected: GMatchInfo* gobject_; // The C object. - bool take_ownership; // Bool signaling ownership. + bool take_ownership; // Bool signaling ownership. //TODO: Give this a _ suffix when we can break API. protected: // So that Glib::Regex::match() can set the C object. diff --git a/glib/src/shell.ccg b/glib/src/shell.ccg index 4950c086..db01f78e 100644 --- a/glib/src/shell.ccg +++ b/glib/src/shell.ccg @@ -25,9 +25,9 @@ namespace Glib Glib::ArrayHandle<std::string> shell_parse_argv(const std::string& command_line) { - char** argv = 0; + char** argv = nullptr; int argc = 0; - GError* error = 0; + GError* error = nullptr; g_shell_parse_argv(command_line.c_str(), &argc, &argv, &error); @@ -45,7 +45,7 @@ std::string shell_quote(const std::string& unquoted_string) std::string shell_unquote(const std::string& quoted_string) { - GError* error = 0; + GError* error = nullptr; char *const buf = g_shell_unquote(quoted_string.c_str(), &error); if(error) diff --git a/glib/src/signalproxy.h.m4 b/glib/src/signalproxy.h.m4 index 69db201d..2f275f99 100644 --- a/glib/src/signalproxy.h.m4 +++ b/glib/src/signalproxy.h.m4 @@ -1,5 +1,3 @@ -// -*- c++ -*- -dnl dnl Glib SignalProxy Templates dnl dnl Copyright 2001 Free Software Foundation @@ -19,7 +17,6 @@ dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl -dnl Ignore the next line /* This is a generated file, do not edit. Generated from __file__ */ include(template.macros.m4) #ifndef __header__ @@ -33,7 +30,7 @@ extern "C" #include <sigc++/sigc++.h> #include <glibmm/signalproxy_connectionnode.h> - +#include <glibmm/ustring.h> namespace Glib { @@ -52,7 +49,7 @@ struct SignalProxyInfo #endif //DOXYGEN_SHOULD_SKIP_THIS -// This base class is used by SignalProxyNormal and SignalProxyProperty. +// This base class is used by SignalProxyNormal, SignalProxyDetailed and SignalProxyProperty. class SignalProxyBase { public: @@ -61,7 +58,7 @@ public: #ifndef DOXYGEN_SHOULD_SKIP_THIS static inline sigc::slot_base* data_to_slot(void* data) { - SignalProxyConnectionNode *const pConnectionNode = static_cast<SignalProxyConnectionNode*>(data); + const auto pConnectionNode = static_cast<SignalProxyConnectionNode*>(data); // Return 0 if the connection is blocked. return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0; @@ -76,7 +73,7 @@ private: }; -// shared portion of a Signal +// Shared portion of a Signal without detail /** The SignalProxy provides an API similar to sigc::signal that can be used to * connect sigc::slots to glib signals. * @@ -84,6 +81,8 @@ private: * which might emit it. Actually, proxies are controlled by * the template derivatives, which serve as gatekeepers for the * types allowed on a particular signal. + * + * For signals with a detailed name (signal_name::detail_name) see SignalProxyDetailed. */ class SignalProxyNormal : public SignalProxyBase { @@ -136,27 +135,77 @@ private: SignalProxyNormal& operator=(const SignalProxyNormal&); }; +// Shared portion of a Signal with detail +/** The SignalProxy provides an API similar to sigc::signal that can be used to + * connect sigc::slots to glib signals. + * + * This holds the name of the glib signal, including the detail name if any, + * and the object which might emit it. Actually, proxies are controlled by + * the template derivatives, which serve as gatekeepers for the + * types allowed on a particular signal. + */ +class SignalProxyDetailed : public SignalProxyBase +{ +public: + ~SignalProxyDetailed(); + + /// Stops the current signal emission (not in libsigc++) + void emission_stop(); + +protected: + + /** Creates a proxy for a signal that can be emitted by @a obj. + * @param obj The object that can emit the signal. + * @param info Information about the signal, including its name + * and the C callbacks that should be called by glib. + * @param detail_name The detail name, if any. + */ + SignalProxyDetailed(Glib::ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name); + + /** Connects a signal handler to a signal. + * This is called by connect() and connect_notify() in derived SignalProxy classes. + * + * @param notify Whether this method is called by connect_notify() or by connect(). + * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::slot_base& connect_impl_(bool notify, const sigc::slot_base& slot, bool after); + +private: + const SignalProxyInfo* info_; // Pointer to statically allocated structure. + const Glib::ustring detailed_name_; // signal_name[[::detail_name]]dnl one pair of [] in the generated .h file + + + // no copy assignment + SignalProxyDetailed& operator=(const SignalProxyDetailed&); +}; + dnl -dnl GLIB_SIGNAL_PROXY([P1, P2, ...],return type) +dnl GLIB_SIGNAL_PROXY([P1, P2, ...], Normal or Detailed) dnl define([GLIB_SIGNAL_PROXY],[dnl LINE(]__line__[)dnl -/**** Glib::[SignalProxy]NUM($1) ***************************************************/ +/**** Glib::[SignalProxy]ifelse($2,Normal,,$2)[]NUM($1) ***************************************************/ -/** Proxy for signals with NUM($1) arguments. +/** Proxy for signals with NUM($1) arguments[]ifelse($2,Normal,,[ and possibly a detailed name]). * Use the connect() or connect_notify() method, with sigc::mem_fun() or sigc::ptr_fun() * to connect signal handlers to signals. */ template <LIST(class R,ARG_CLASS($1))> -class [SignalProxy]NUM($1) : public SignalProxyNormal +class [SignalProxy]ifelse($2,Normal,,$2)[]NUM($1) : public SignalProxy$2 { public: typedef sigc::slot<LIST(R,ARG_TYPE($1))> SlotType; typedef sigc::slot<LIST(void,ARG_TYPE($1))> VoidSlotType; - [SignalProxy]NUM($1)(ObjectBase* obj, const SignalProxyInfo* info) +ifelse($2,Normal,dnl + [SignalProxy]NUM($1)[(ObjectBase* obj, const SignalProxyInfo* info) : SignalProxyNormal(obj, info) {} +],dnl Detailed + [SignalProxyDetailed]NUM($1)[(ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name) + : SignalProxyDetailed(obj, info, detail_name) {} +])dnl /** Connects a signal handler to a signal. * @@ -166,7 +215,7 @@ public: * @param after Whether this signal handler should be called before or after the default signal handler. */ sigc::connection connect(const SlotType& slot, bool after = true) - { return sigc::connection(connect_(slot, after)); } + { return sigc::connection(ifelse($2,Normal,[connect_(slot, after)],[connect_impl_(false, slot, after)])); } /** Connects a signal handler without a return value to a signal. * By default, the signal handler will be called before the default signal handler. @@ -190,20 +239,28 @@ public: * @param after Whether this signal handler should be called before or after the default signal handler. */ sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) - { return sigc::connection(connect_notify_(slot, after)); } + { return sigc::connection(ifelse($2,Normal,[connect_notify_(slot, after)],[connect_impl_(true, slot, after)])); } }; ])dnl - +dnl dnl Template forms of SignalProxy - -GLIB_SIGNAL_PROXY(ARGS(P,0)) -GLIB_SIGNAL_PROXY(ARGS(P,1)) -GLIB_SIGNAL_PROXY(ARGS(P,2)) -GLIB_SIGNAL_PROXY(ARGS(P,3)) -GLIB_SIGNAL_PROXY(ARGS(P,4)) -GLIB_SIGNAL_PROXY(ARGS(P,5)) -GLIB_SIGNAL_PROXY(ARGS(P,6)) - +dnl +GLIB_SIGNAL_PROXY(ARGS(P,0), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,1), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,2), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,3), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,4), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,5), Normal) +GLIB_SIGNAL_PROXY(ARGS(P,6), Normal) +dnl +GLIB_SIGNAL_PROXY(ARGS(P,0), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,1), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,2), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,3), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,4), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,5), Detailed) +GLIB_SIGNAL_PROXY(ARGS(P,6), Detailed) +dnl } // namespace Glib #endif /* __header__ */ diff --git a/glib/src/spawn.ccg b/glib/src/spawn.ccg index 707d5828..5cfbdb7a 100644 --- a/glib/src/spawn.ccg +++ b/glib/src/spawn.ccg @@ -34,7 +34,7 @@ static void child_setup_callback(void* user_data) { try { - (*reinterpret_cast<sigc::slot<void>*>(user_data))(); + (*reinterpret_cast<Glib::SlotSpawnChildSetup*>(user_data))(); } catch(...) { @@ -67,15 +67,15 @@ void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, Pid* child_pid, int* standard_input, int* standard_output, int* standard_error) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; - GError* gerror = 0; + auto child_setup_ = child_setup; + GError* gerror = nullptr; g_spawn_async_with_pipes( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -95,15 +95,15 @@ void spawn_async_with_pipes(const std::string& working_directory, void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, Pid* child_pid, int* standard_input, int* standard_output, int* standard_error) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; - GError* gerror = 0; + auto child_setup_ = child_setup; + GError* gerror = nullptr; g_spawn_async_with_pipes( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -123,12 +123,12 @@ void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, Pid* child_pid) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; - GError* gerror = 0; + auto child_setup_ = child_setup; + GError* gerror = nullptr; g_spawn_async( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -147,12 +147,12 @@ void spawn_async(const std::string& working_directory, void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, Pid* child_pid) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; - GError* gerror = 0; + auto child_setup_ = child_setup; + GError* gerror = nullptr; g_spawn_async( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -171,17 +171,17 @@ void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, std::string* standard_output, std::string* standard_error, int* exit_status) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; + auto child_setup_ = child_setup; Glib::ScopedPtr<char> buf_standard_output; Glib::ScopedPtr<char> buf_standard_error; - GError* gerror = 0; + GError* gerror = nullptr; g_spawn_sync( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -205,17 +205,17 @@ void spawn_sync(const std::string& working_directory, void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags, - const sigc::slot<void>& child_setup, + const SlotSpawnChildSetup& child_setup, std::string* standard_output, std::string* standard_error, int* exit_status) { const bool setup_slot = !child_setup.empty(); - sigc::slot<void> child_setup_ = child_setup; + auto child_setup_ = child_setup; Glib::ScopedPtr<char> buf_standard_output; Glib::ScopedPtr<char> buf_standard_error; - GError* gerror = 0; + GError* gerror = nullptr; g_spawn_sync( (working_directory.empty()) ? 0 : working_directory.c_str(), @@ -237,7 +237,7 @@ void spawn_sync(const std::string& working_directory, void spawn_command_line_async(const std::string& command_line) { - GError* gerror = 0; + GError* gerror = nullptr; g_spawn_command_line_async(command_line.c_str(), &gerror); if(gerror) @@ -251,7 +251,7 @@ void spawn_command_line_sync(const std::string& command_line, { Glib::ScopedPtr<char> buf_standard_output; Glib::ScopedPtr<char> buf_standard_error; - GError* gerror = 0; + GError* gerror = nullptr; g_spawn_command_line_sync( command_line.c_str(), diff --git a/glib/src/spawn.hg b/glib/src/spawn.hg index bb53a087..c10e44bf 100644 --- a/glib/src/spawn.hg +++ b/glib/src/spawn.hg @@ -35,10 +35,15 @@ _WRAP_ENUM(SpawnFlags, GSpawnFlags, NO_GTYPE) * @{ */ -/** Exception class for errors occuring when spawning processes. +/** %Exception class for errors occuring when spawning processes. */ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#) +/** For instance,<br> + * void on_child_setup(); + */ +typedef sigc::slot<void> SlotSpawnChildSetup; + /** Executes a child program asynchronously (your program will not * block waiting for the child to exit). The child program is * specified by the only argument that must be provided, @a argv. @@ -175,7 +180,7 @@ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#) * @param argv Child's argument vector. * @param envp Child's environment. * @param flags Flags from SpawnFlags - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param child_pid Return location for child process ID, or NULL. * @param standard_input Return location for file descriptor to write to child's stdin, or NULL. * @param standard_output Return location for file descriptor to read child's stdout, or NULL. @@ -191,18 +196,18 @@ void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - Pid* child_pid = 0, - int* standard_input = 0, - int* standard_output = 0, - int* standard_error = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + Pid* child_pid = nullptr, + int* standard_input = nullptr, + int* standard_output = nullptr, + int* standard_error = nullptr); /** Like the main spawn_async_with_pipes() method, but inheriting the parent's environment. * * @param working_directory Child's current working directory, or an empty string to inherit the parent's, in the GLib file name encoding. * @param argv Child's argument vector. * @param flags Flags from SpawnFlags - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param child_pid Return location for child process ID, or NULL. * @param standard_input Return location for file descriptor to write to child's stdin, or NULL. * @param standard_output Return location for file descriptor to read child's stdout, or NULL. @@ -217,11 +222,11 @@ void spawn_async_with_pipes(const std::string& working_directory, void spawn_async_with_pipes(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - Pid* child_pid = 0, - int* standard_input = 0, - int* standard_output = 0, - int* standard_error = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + Pid* child_pid = nullptr, + int* standard_input = nullptr, + int* standard_output = nullptr, + int* standard_error = nullptr); /** See spawn_async_with_pipes() for a full description. This function * simply calls the spawn_async_with_pipes() without any pipes. @@ -236,7 +241,7 @@ void spawn_async_with_pipes(const std::string& working_directory, * @param argv Child's argument vector. * @param envp Child's environment. * @param flags Flags from SpawnFlags. - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param child_pid Return location for child process ID, or NULL * * @throws SpawnError Errors are reported even if they occur in the child (for example if the @@ -248,15 +253,15 @@ void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - Pid* child_pid = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + Pid* child_pid = nullptr); /** Like the main spawn_async() method, but inheriting the parent's environment. * * @param working_directory Child's current working directory, or an empty string to inherit parent's. * @param argv Child's argument vector. * @param flags Flags from SpawnFlags. - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param child_pid Return location for child process ID, or NULL * * @throws SpawnError Errors are reported even if they occur in the child (for example if the @@ -267,8 +272,8 @@ void spawn_async(const std::string& working_directory, void spawn_async(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - Pid* child_pid = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + Pid* child_pid = nullptr); /** Executes a child synchronously (waits for the child to exit before returning). * All output from the child is stored in @a standard_output and @a standard_error, @@ -291,7 +296,7 @@ void spawn_async(const std::string& working_directory, * @param argv Child's argument vector. * @param envp Child's environment. * @param flags Flags from SpawnFlags - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param standard_output Return location for file descriptor to read child's stdout, or NULL. * @param standard_error Return location for file descriptor to read child's stderr, or NULL. * @param exit_status Return location for child exit status, as returned by waitpid(), or NULL @@ -306,17 +311,17 @@ void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, const Glib::ArrayHandle<std::string>& envp, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - std::string* standard_output = 0, - std::string* standard_error = 0, - int* exit_status = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + std::string* standard_output = nullptr, + std::string* standard_error = nullptr, + int* exit_status = nullptr); /** Like the main spawn_sync() method, but inheriting the parent's environment. * * @param working_directory Child's current working directory, or an empty string to inherit the parent's, in the GLib file name encoding. * @param argv Child's argument vector. * @param flags Flags from SpawnFlags - * @param child_setup Slot to run in the child just before exec(). + * @param child_setup Slot to run in the child just before exec(), or an empty slot. * @param standard_output Return location for file descriptor to read child's stdout, or NULL. * @param standard_error Return location for file descriptor to read child's stderr, or NULL. * @param exit_status Return location for child exit status, as returned by waitpid(), or NULL @@ -330,10 +335,10 @@ void spawn_sync(const std::string& working_directory, void spawn_sync(const std::string& working_directory, const Glib::ArrayHandle<std::string>& argv, SpawnFlags flags = SPAWN_DEFAULT, - const sigc::slot<void>& child_setup = sigc::slot<void>(), - std::string* standard_output = 0, - std::string* standard_error = 0, - int* exit_status = 0); + const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), + std::string* standard_output = nullptr, + std::string* standard_error = nullptr, + int* exit_status = nullptr); /** A simple version of spawn_async() that parses a command line with * shell_parse_argv() and passes it to spawn_async(). It runs a @@ -388,9 +393,9 @@ void spawn_command_line_async(const std::string& command_line); * @throws ShellError If the command line could not be parsed. */ void spawn_command_line_sync(const std::string& command_line, - std::string* standard_output = 0, - std::string* standard_error = 0, - int* exit_status = 0); + std::string* standard_output = nullptr, + std::string* standard_error = nullptr, + int* exit_status = nullptr); /** On some platforms, notably WIN32, the Pid type represents a resource * which must be closed to prevent resource leaking. close_pid() diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg index cfc38952..cfca2186 100644 --- a/glib/src/thread.ccg +++ b/glib/src/thread.ccg @@ -26,7 +26,7 @@ extern "C" static void* call_thread_entry_slot(void* data) { - sigc::slot_base *const slot = reinterpret_cast<sigc::slot_base*>(data); + const auto slot = reinterpret_cast<sigc::slot_base*>(data); try { @@ -71,11 +71,11 @@ void thread_init_impl() Thread* Thread::create(const sigc::slot<void>& slot, bool /* joinable */) { // Make a copy of slot on the heap - sigc::slot_base *const slot_copy = new sigc::slot<void>(slot); + const auto slot_copy = new sigc::slot<void>(slot); - GError* error = 0; + GError* error = nullptr; - GThread *const thread = g_thread_try_new(NULL, + const auto thread = g_thread_try_new(NULL, &call_thread_entry_slot, slot_copy, &error); if(error) @@ -97,11 +97,11 @@ Thread* Thread::create(const sigc::slot<void>& slot, unsigned long stack_size, bool joinable, bool bound, ThreadPriority priority) { // Make a copy of slot on the heap - sigc::slot_base *const slot_copy = new sigc::slot<void>(slot); + const auto slot_copy = new sigc::slot<void>(slot); - GError* error = 0; + GError* error = nullptr; - GThread *const thread = g_thread_create_full( + const auto thread = g_thread_create_full( &call_thread_entry_slot, slot_copy, stack_size, joinable, bound, (GThreadPriority) priority, &error); diff --git a/glib/src/thread.hg b/glib/src/thread.hg index fb6f19b7..b5efa43b 100644 --- a/glib/src/thread.hg +++ b/glib/src/thread.hg @@ -21,23 +21,16 @@ _CONFIGINCLUDE(glibmmconfig.h) _IS_DEPRECATED // This whole file is deprecated. #m4 _PUSH(SECTION_CC_PRE_INCLUDES) -// Must be included in the .cc file before the generated #ifndef GLIBMM_DISABLE_DEPRECATED, -// or else "configure --disable-deprecated-api" + "make" will fail. -#include <glibmmconfig.h> +//Stop the compiler warnings about using the deprecated API; +#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 #m4 _POP() // We use GThreadFunctions in the (deprecated) API, so we must temporarily undef G_DISABLE_DEPRECATED. // Temporarily undef G_DISABLE_DEPRECATED, redefining it later if appropriate. #if defined(G_DISABLE_DEPRECATED) && !defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) - //Stop the deprecation ifdef guards around the API declarations: #undef G_DISABLE_DEPRECATED - -//Stop the compiler warnings about using the deprecated API; -#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 - #define GLIBMM_G_DISABLE_DEPRECATED_UNDEFED 1 - #endif #include <glib.h> @@ -45,7 +38,6 @@ _IS_DEPRECATED // This whole file is deprecated. // Redefine G_DISABLE_DEPRECATED if it was defined before we temporarily undefed it: #if defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) #define G_DISABLE_DEPRECATED 1 -#undef GLIB_DISABLE_DEPRECATION_WARNINGS #undef GLIBMM_G_DISABLE_DEPRECATED_UNDEFED #endif @@ -114,7 +106,7 @@ _WRAP_ENUM(ThreadPriority, GThreadPriority, NO_GTYPE) /** Initializes the GLib thread system. * @deprecated Calling thread_init() is no longer necessary and no longer has any effect. */ -void thread_init(GThreadFunctions* vtable = 0); +void thread_init(GThreadFunctions* vtable = nullptr); /** Returns whether the thread system is initialized. * @return @c true, if the thread system is initialized. @@ -638,7 +630,7 @@ private: * @code * Glib::Cond data_cond; * Glib::Mutex data_mutex; - * void* current_data = 0; + * void* current_data = nullptr; * * void push_data(void* data) * { @@ -656,7 +648,7 @@ private: * data_cond.wait(data_mutex); * * void *const data = current_data; - * current_data = 0; + * current_data = nullptr; * * return data; * } diff --git a/glib/src/threads.ccg b/glib/src/threads.ccg index d417a982..e507b6d3 100644 --- a/glib/src/threads.ccg +++ b/glib/src/threads.ccg @@ -18,6 +18,19 @@ #include <glibmm/exceptionhandler.h> #include <glib.h> +/* Why reinterpret_cast<Thread*>(gobject) is needed: + * + * A Thread instance is in fact always a GThread instance. + * Unfortunately, GThread cannot be a member of Thread, + * because it is an opaque struct. Also, the C interface does not provide + * any hooks to install a destroy notification handler, thus we cannot + * wrap it dynamically either. + * + * The cast works because Thread does not have any member data, and + * it is impossible to derive from it. This is ensured by not implementing + * the (private) default constructor. + * This trick is used also in classes declared as _CLASS_OPAQUE_REFCOUNTED. + */ namespace { @@ -27,19 +40,19 @@ extern "C" static void* call_thread_entry_slot(void* data) { - sigc::slot_base *const slot = reinterpret_cast<sigc::slot_base*>(data); + const auto slot = reinterpret_cast<sigc::slot_base*>(data); try { - // Recreate the specific slot, and drop the reference obtained by create(). + // Recreate the specific slot. (*static_cast<sigc::slot<void>*>(slot))(); } - catch(Glib::Threads::Thread::Exit&) + catch (Glib::Threads::Thread::Exit&) { // Just exit from the thread. The Threads::Thread::Exit exception // is our sane C++ replacement of g_thread_exit(). } - catch(...) + catch (...) { Glib::exception_handlers_invoke(); } @@ -59,30 +72,27 @@ namespace Glib namespace Threads { -/**** Glib::Thread *********************************************************/ +/**** Glib::Threads::Thread ************************************************/ // static Thread* Thread::create(const sigc::slot<void>& slot, const std::string& name) { - // Make a copy of slot on the heap - sigc::slot_base *const slot_copy = new sigc::slot<void>(slot); - - GError* error = 0; - GThread* thread; + // Make a copy of slot on the heap. + const auto slot_copy = new sigc::slot<void>(slot); - if (name.size() > 0) - thread = g_thread_try_new(name.c_str(), &call_thread_entry_slot, - slot_copy, &error); - else - thread = g_thread_try_new(NULL, &call_thread_entry_slot, - slot_copy, &error); + GError* error = nullptr; + auto thread = g_thread_try_new(name.empty() ? 0 : name.c_str(), + &call_thread_entry_slot, slot_copy, &error); - if(error) + if (error) { delete slot_copy; Glib::Error::throw_exception(error); } - + if (!thread) + { + delete slot_copy; + } return reinterpret_cast<Thread*>(thread); } @@ -100,7 +110,7 @@ Thread* Thread::self() void Thread::join() { - g_thread_join(&gobject_); + g_thread_join(reinterpret_cast<GThread*>(this)); } // static @@ -109,6 +119,15 @@ void Thread::yield() g_thread_yield(); } +GThread* Thread::gobj() +{ + return reinterpret_cast<GThread*>(this); +} + +const GThread* Thread::gobj() const +{ + return reinterpret_cast<const GThread*>(this); +} Thread* wrap(GThread* gobject) { @@ -116,7 +135,7 @@ Thread* wrap(GThread* gobject) } -/**** Glib::Mutex **********************************************************/ +/**** Glib::Threads::Mutex *************************************************/ Mutex::Mutex() { @@ -148,7 +167,7 @@ Mutex* wrap(GMutex* gobject) return reinterpret_cast<Mutex*>(gobject); } -/**** Glib::RecMutex *******************************************************/ +/**** Glib::Threads::RecMutex **********************************************/ RecMutex::RecMutex() { @@ -180,7 +199,7 @@ RecMutex* wrap(GRecMutex* gobject) return reinterpret_cast<RecMutex*>(gobject); } -/**** Glib::RWLock ***************************************************/ +/**** Glib::Threads::RWLock ************************************************/ void RWLock::reader_lock() { @@ -212,8 +231,6 @@ void RWLock::writer_unlock() g_rw_lock_writer_unlock(&gobject_); } -/**** Glib::RWLock *********************************************************/ - RWLock::RWLock() { g_rw_lock_init(&gobject_); @@ -225,7 +242,7 @@ RWLock::~RWLock() } -/**** Glib::Cond ***********************************************************/ +/**** Glib::Threads::Cond **************************************************/ Cond::Cond() { diff --git a/glib/src/threads.hg b/glib/src/threads.hg index 52bb4b41..412d5fb5 100644 --- a/glib/src/threads.hg +++ b/glib/src/threads.hg @@ -18,39 +18,17 @@ _DEFS(glibmm,glib) _CONFIGINCLUDE(glibmmconfig.h) - -// We use the (now deprecated) GThread definition in the API, -// and we cannot stop that without breaking ABI. -// (see the comment below), -// so we must temporarily undef G_DISABLE_DEPRECATED when -// including glib.h. - -// Temporarily undef G_DISABLE_DEPRECATED, redefining it later if appropriate. -#if defined(G_DISABLE_DEPRECATED) && !defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) - -//Stop the deprecation ifdef guards around the API declarations: -#undef G_DISABLE_DEPRECATED - -//Stop the compiler warnings about using the deprecated API; -#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 - -#define GLIBMM_G_DISABLE_DEPRECATED_UNDEFED 1 - -#endif +#m4 _PUSH(SECTION_CC_PRE_INCLUDES) +// Don't let glibmm.h include thread.h. Pretend that it's already included. +// glib.h can then be included with G_DISABLE_DEPRECATED defined, and +// the compiler can react if deprecated glib functions are used. +#define _GLIBMM_THREAD_H +#m4 _POP() #include <glib.h> - -// Redefine G_DISABLE_DEPRECATED if it was defined before we temporarily undefed it: -#if defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) -#define G_DISABLE_DEPRECATED 1 -#undef GLIB_DISABLE_DEPRECATION_WARNINGS -#undef GLIBMM_G_DISABLE_DEPRECATED_UNDEFED -#endif - - #include <glibmm/error.h> #include <sigc++/sigc++.h> - +#include <string> #include <cstddef> namespace Glib @@ -62,7 +40,7 @@ namespace Threads _GMMPROC_EXTRA_NAMESPACE(Threads) /** @defgroup Threads Threads - * Thread abstraction; including threads, different mutexes, + * %Thread abstraction; including threads, different mutexes, * conditions and thread private data. * @{ */ @@ -74,7 +52,7 @@ class Mutex; class RecMutex; class RWLock; -/** Exception class for thread-related errors. +/** %Exception class for thread-related errors. */ _WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE) @@ -90,8 +68,8 @@ _WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE) * a Threads::Thread::Exit exception, which will be caught by the internal thread * entry function. * - * @note You might have noticed that the thread entry slot doesn't have the - * usual void* return value. If you want to return any data from your thread + * @note The thread entry slot doesn't have the void* return value that a + * GThreadFunc has. If you want to return any data from your thread, * you can pass an additional output argument to the thread's entry slot. */ class Thread @@ -169,12 +147,10 @@ public: */ static void yield(); - GThread* gobj() { return &gobject_; } - const GThread* gobj() const { return &gobject_; } + GThread* gobj(); + const GThread* gobj() const; private: - GThread gobject_; - // Glib::Thread can neither be constructed nor deleted. Thread(); void operator delete(void*, std::size_t); @@ -195,7 +171,13 @@ private: class Thread::Exit {}; -/** @relates Glib::Threads::Thread */ +/** A C++ wrapper for the C object. + * + * @param gobject The C instance. + * @return The C++ wrapper. + * + * @relates Glib::Threads::Thread + */ Thread* wrap(GThread* gobject); /** Represents a mutex (mutual exclusion). @@ -203,8 +185,8 @@ Thread* wrap(GThread* gobject); * Mutex::Lock instead of calling lock() and unlock() directly -- * it will make your life much easier. * - * @note Glib::Mutex is not recursive, i.e. a thread will deadlock, if it - * already has locked the mutex while calling lock(). Use Glib::RecMutex + * @note Glib::Threads::Mutex is not recursive, i.e. a thread will deadlock, if it + * already has locked the mutex while calling lock(). Use Glib::Threads::RecMutex * instead, if you need recursive mutexes. */ class Mutex @@ -251,12 +233,12 @@ private: * @par Usage example: * @code * { - * Glib::Mutex::Lock lock (mutex); // calls mutex.lock() + * Glib::Threads::Mutex::Lock lock(mutex); // calls mutex.lock() * do_something(); * } // the destructor calls mutex.unlock() * @endcode * As you can see, the compiler takes care of the unlocking. This is not - * only exception safe but also much less error-prone. You could even + * only exception-safe but also much less error-prone. You could even * <tt>return</tt> while still holding the lock and it will be released * properly. */ @@ -319,10 +301,7 @@ private: RecMutex(const RecMutex&); RecMutex& operator=(const RecMutex&); -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. GRecMutex gobject_; -#endif }; /** Utility class for exception-safe locking of recursive mutexes. @@ -396,10 +375,7 @@ private: RWLock(const RWLock&); RWLock& operator=(const RWLock&); -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. GRWLock gobject_; -#endif }; /** Utility class for exception-safe locking of read/write locks. @@ -456,13 +432,13 @@ private: * they can signal the @a Cond, such that the waiting thread is woken up. * @par Usage example: * @code - * Glib::Cond data_cond; - * Glib::Mutex data_mutex; - * void* current_data = 0; + * Glib::Threads::Cond data_cond; + * Glib::Threads::Mutex data_mutex; + * void* current_data = nullptr; * * void push_data(void* data) * { - * Glib::Mutex::Lock lock (data_mutex); + * Glib::Threads::Mutex::Lock lock(data_mutex); * * current_data = data; * data_cond.signal(); @@ -470,18 +446,18 @@ private: * * void* pop_data() * { - * Glib::Mutex::Lock lock (data_mutex); + * Glib::Threads::Mutex::Lock lock(data_mutex); * * while (!current_data) * data_cond.wait(data_mutex); * - * void *const data = current_data; - * current_data = 0; + * void* const data = current_data; + * current_data = nullptr; * * return data; * } * @endcode -*/ + */ class Cond { public: @@ -491,12 +467,11 @@ public: /** If threads are waiting for this @a Cond, exactly one of them is woken up. * It is good practice to hold the same lock as the waiting thread, while calling * this method, though not required. - * */ void signal(); /** If threads are waiting for this @a Cond, all of them are woken up. - * It is good practice to hold the same lock as the waiting thread, while calling + * It is good practice to hold the same lock as the waiting threads, while calling * this method, though not required. */ void broadcast(); @@ -504,7 +479,7 @@ public: /** Waits until this thread is woken up on this @a Cond. * The mutex is unlocked before falling asleep and locked again before resuming. * - * @param mutex a @a Mutex that is currently locked. + * @param mutex A @a Mutex that is currently locked. * * @note It is important to use the @a wait() and @a wait_until() methods * only inside a loop, which checks for the condition to be true as it is not @@ -515,11 +490,40 @@ public: */ void wait(Mutex& mutex); - /** Waits until this thread is woken up on this @a Cond, but not longer than until the time, that is specified by @a end_time. + /** Waits until this thread is woken up on this @a Cond, but not longer + * than until the time specified by @a end_time. * The mutex is unlocked before falling asleep and locked again before resuming. * - * @param mutex a @a Mutex that is currently locked. - * @param end_time a max time to wait. + * @par Usage example: + * Extending the example presented in the documentation of class Cond. + * @code + * void* pop_data_timed() + * { + * Glib::Threads::Mutex::Lock lock(data_mutex); + * + * // Wait at most 5 seconds. + * const gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND; + * while (!current_data) + * if (!data_cond.wait_until(data_mutex, end_time) + * return 0; // timeout + * + * void* const data = current_data; + * current_data = nullptr; + * + * return data; + * } + * @endcode + * The end time is calculated once, before entering the loop, and reused. + * This is the motivation behind the use of absolute time. If a relative time + * of 5 seconds were passed directly to the call and a spurious wakeup + * occurred, the program would have to start over waiting again, which would + * lead to a total wait time of more than 5 seconds. + * + * @param mutex A @a Mutex that is currently locked. + * @param end_time The monotonic time to wait until, in microseconds. + * See g_get_monotonic_time(). + * @return <tt>true</tt> if the condition variable was signalled (or in the case + * of a spurious wakeup), <tt>false</tt> if @a end_time has passed. * * @note It is important to use the @a wait() and @a wait_until() methods * only inside a loop, which checks for the condition to be true as it is not @@ -544,7 +548,7 @@ private: * * It is recommended that all instances of this class are statically allocated. * The first time an instance is used (get(), set() or replace() is called) - * gtk+ allocates a scarce OS resource that cannot be deallocated. + * glib allocates a scarce OS resource that cannot be deallocated. */ template <class T> class Private @@ -606,8 +610,7 @@ private: /* inline implementation */ /***************************************************************************/ - -/**** Glib::Mutex::Lock ****************************************************/ +/**** Glib::Threads::Mutex::Lock *******************************************/ inline Mutex::Lock::Lock(Mutex& mutex) @@ -667,7 +670,7 @@ bool Mutex::Lock::locked() const } -/**** Glib::RecMutex::Lock *************************************************/ +/**** Glib::Threads::RecMutex::Lock ****************************************/ inline RecMutex::Lock::Lock(RecMutex& mutex) @@ -727,7 +730,7 @@ bool RecMutex::Lock::locked() const } -/**** Glib::RWLock::ReaderLock *********************************************/ +/**** Glib::Threads::RWLock::ReaderLock ************************************/ inline RWLock::ReaderLock::ReaderLock(RWLock& rwlock) @@ -787,7 +790,7 @@ bool RWLock::ReaderLock::locked() const } -/**** Glib::RWLock::WriterLock *********************************************/ +/**** Glib::Threads::RWLock::WriterLock ************************************/ inline RWLock::WriterLock::WriterLock(RWLock& rwlock) @@ -846,7 +849,7 @@ bool RWLock::WriterLock::locked() const return locked_; } -/**** Glib::Private ********************************************************/ +/**** Glib::Threads::Private<T> ********************************************/ // static template <class T> diff --git a/glib/src/value_basictypes.cc.m4 b/glib/src/value_basictypes.cc.m4 index 62cc5474..090b33bc 100644 --- a/glib/src/value_basictypes.cc.m4 +++ b/glib/src/value_basictypes.cc.m4 @@ -1,7 +1,5 @@ divert(-1) -dnl $Id$ - dnl Glib::Value specializations for fundamental types dnl dnl Copyright 2002 The gtkmm Development Team @@ -34,7 +32,7 @@ dnl Please ignore the format stuff. I was just tired and played a little. // static GType Value<$1>::value_type() { - return G_TYPE_[]UPPER($2); + return G_TYPE_[]UPPER(ifelse($2,schar,char,$2)); } void Value<$1>::set($1 data) @@ -49,7 +47,7 @@ $1 Value<$1>::get() const GParamSpec* Value<$1>::create_param_spec(const Glib::ustring& name) const { - return g_param_spec_$2( + return g_param_spec_[]ifelse($2,schar,char,$2)( name.c_str(), 0, 0,ifelse($2,pointer,,[ ifelse($3,,,[$3, $4, ])[]g_value_get_$2(&gobject_),]) GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); @@ -57,7 +55,6 @@ GParamSpec* Value<$1>::create_param_spec(const Glib::ustring& name) const ]) divert[]dnl -// -*- c++ -*- // This is a generated file, do not edit. Generated from __file__ /* So we can use deprecated functions in our deprecated methods */ @@ -73,7 +70,10 @@ G_GNUC_EXTENSION typedef long long long_long; G_GNUC_EXTENSION typedef unsigned long long unsigned_long_long; GLIB_VALUE_BASIC(bool, boolean) +#ifndef GLIBMM_DISABLE_DEPRECATED GLIB_VALUE_BASIC(char, char, -128, 127) +#endif // GLIBMM_DISABLE_DEPRECATED +GLIB_VALUE_BASIC(signed char, schar, -128, 127) GLIB_VALUE_BASIC(unsigned char, uchar, 0, 255) GLIB_VALUE_BASIC(int, int, G_MININT, G_MAXINT) GLIB_VALUE_BASIC(unsigned int, uint, 0, G_MAXUINT) diff --git a/glib/src/value_basictypes.h.m4 b/glib/src/value_basictypes.h.m4 index 11b4c6cd..f9648c09 100644 --- a/glib/src/value_basictypes.h.m4 +++ b/glib/src/value_basictypes.h.m4 @@ -1,7 +1,5 @@ divert(-1) -dnl $Id$ - dnl Glib::Value specializations for fundamental types dnl dnl Copyright 2002 The gtkmm Development Team @@ -50,7 +48,6 @@ public: ]) divert[]dnl -// -*- c++ -*- // This is a generated file, do not edit. Generated from __file__ #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -68,7 +65,12 @@ divert[]dnl namespace Glib { GLIB_VALUE_BASIC(bool, boolean) +#ifndef GLIBMM_DISABLE_DEPRECATED +/// @deprecated Use Value<signed char> instead. GLIB_VALUE_BASIC(char, char) +#endif // GLIBMM_DISABLE_DEPRECATED +/// @newin{2,44} +GLIB_VALUE_BASIC(signed char, int8) GLIB_VALUE_BASIC(unsigned char, uchar) GLIB_VALUE_BASIC(int, int) GLIB_VALUE_BASIC(unsigned int, uint) diff --git a/glib/src/valuearray.ccg b/glib/src/valuearray.ccg index 114e978f..8b82aeda 100644 --- a/glib/src/valuearray.ccg +++ b/glib/src/valuearray.ccg @@ -48,7 +48,7 @@ ValueArray::ValueArray(guint n_preallocated) : bool ValueArray::get_nth(guint index, Glib::ValueBase& value) { - GValue* const g_value = g_value_array_get_nth(gobj(), index); + const auto g_value = g_value_array_get_nth(gobj(), index); if(g_value) { diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index a7c53524..7ab9cb13 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -56,6 +56,60 @@ void VariantBase::byteswap(VariantBase& result) const result.init(g_value); // g_value is already referenced. } +bool VariantBase::is_castable_to(const VariantType& supertype) const +{ + const std::string subtype_string = get_type_string(); + const std::string supertype_string = supertype.get_string(); + + // The following code is similar to g_variant_type_is_subtype_of(), with + // these differences: + // - Both types are assumed to be definite types (no indefinite types, + // no 'r', '?' or '*'). + // - VARIANT_TYPE_OBJECT_PATH (o) and VARIANT_TYPE_SIGNATURE (g) can be cast to + // VARIANT_TYPE_STRING (s), (Variant<Glib::ustring>::variant_type()). + // - VARIANT_TYPE_STRING (s), VARIANT_TYPE_OBJECT_PATH (o) and + // VARIANT_TYPE_SIGNATURE (g) can be cast to VARIANT_TYPE_BYTESTRING (ay), + // (Variant<std::string>::variant_type()). + // - VARIANT_TYPE_HANDLE (h) can be cast to VARIANT_TYPE_INT32 (i), + // (Variant<gint32>::variant_type()). + + std::size_t subtype_index = 0; + std::size_t supertype_index = 0; + const std::size_t supertype_size = supertype_string.size(); + while (supertype_index < supertype_size) + { + const char supertype_char = supertype_string[supertype_index++]; + const char subtype_char = subtype_string[subtype_index++]; + + if (supertype_char == subtype_char) + continue; + + switch (supertype_char) + { + case 's': + if (!(subtype_char == 'o' || subtype_char == 'g')) + return false; + break; + + case 'a': + if (!(supertype_string[supertype_index] == 'y' && + (subtype_char == 's' || subtype_char == 'o' || subtype_char == 'g'))) + return false; + supertype_index++; + break; + + case 'i': + if (!(subtype_char == 'h')) + return false; + break; + + default: + return false; + } + } + return true; +} + VariantStringBase::VariantStringBase() : VariantBase() @@ -71,7 +125,7 @@ VariantStringBase::VariantStringBase(GVariant* castitem, bool take_a_reference) void VariantStringBase::create_object_path(VariantStringBase& output, const std::string& object_path) { - GVariant* result = 0; + GVariant* result = nullptr; result = g_variant_new_object_path(object_path.c_str()); g_variant_ref_sink(result); output.init(result); @@ -81,7 +135,7 @@ void VariantStringBase::create_object_path(VariantStringBase& output, void VariantStringBase::create_signature(VariantStringBase& output, const std::string& signature) { - GVariant* result = 0; + GVariant* result = nullptr; result = g_variant_new_signature(signature.c_str()); g_variant_ref_sink(result); output.init(result); @@ -140,7 +194,7 @@ void VariantContainerBase::get_child(VariantBase& child, gsize index) const { if(index >= g_variant_n_children(gobject_)) throw std::out_of_range( - "VariantContainerBase::get(): Index out of bounds."); + "VariantContainerBase::get_child(): Index out of bounds."); GVariant* const gvariant = g_variant_get_child_value(gobject_, index); child.init(gvariant); @@ -180,6 +234,22 @@ bool VariantContainerBase::get_maybe(VariantBase& maybe) const return false; } +VariantIter VariantContainerBase::get_iter(const VariantType& container_variant_type) const +{ + // Get the GVariantIter. + // If the underlying GVariant can be cast to the type of the container, + // use the actual type (which may differ from container_variant_type, if + // the GVariant contains strings, object paths or DBus type signatures), + // otherwise let g_variant_get() report what's wrong with the type. + GVariantIter* g_iter = nullptr; + g_variant_get(const_cast<GVariant*>(gobj()), + is_castable_to(container_variant_type) ? + get_type_string().c_str() : container_variant_type.get_string().c_str(), + &g_iter); + + return VariantIter(g_iter); +} + /****************** Specializations ***********************************/ VariantBase::operator const void*() const @@ -197,6 +267,7 @@ void VariantBase::init(const GVariant* cobject, bool take_a_reference) g_variant_ref(gobject_); } +/*--------------------Variant<VariantBase>---------------------*/ Variant<VariantBase>::Variant() : VariantContainerBase() @@ -216,7 +287,7 @@ const VariantType& Variant<VariantBase>::variant_type() Variant<VariantBase> Variant<VariantBase>::create(const VariantBase& data) { - Variant<VariantBase> result = Variant<VariantBase>(g_variant_new_variant(const_cast<GVariant*>(data.gobj()))); + auto result = Variant<VariantBase>(g_variant_new_variant(const_cast<GVariant*>(data.gobj()))); return result; } @@ -226,6 +297,7 @@ void Variant<VariantBase>::get(VariantBase& variant) const variant.init(gvariant); } +/*--------------------Variant<Glib::ustring>---------------------*/ Variant<Glib::ustring>::Variant() : VariantStringBase() @@ -246,7 +318,7 @@ const VariantType& Variant<Glib::ustring>::variant_type() Variant<Glib::ustring> Variant<Glib::ustring>::create(const Glib::ustring& data) { - Variant<Glib::ustring> result = + auto result = Variant<Glib::ustring>(g_variant_new_string(data.c_str())); return result; } @@ -281,6 +353,8 @@ throw(std::bad_cast) } } +/*--------------------Variant<std::string>---------------------*/ + Variant<std::string>::Variant() : VariantStringBase() { @@ -300,7 +374,7 @@ const VariantType& Variant<std::string>::variant_type() Variant<std::string> Variant<std::string>::create(const std::string& data) { - Variant<std::string> result = + auto result = Variant<std::string>(g_variant_new_bytestring(data.c_str())); return result; } @@ -335,15 +409,17 @@ std::string Variant<std::string>::get() const { const VariantType vtype = get_type(); - const char* pch = 0; + const char* pch = nullptr; if(vtype.equal(VARIANT_TYPE_BYTESTRING)) pch = g_variant_get_bytestring(gobject_); - else //g_variant_get_string() cna handle strings, object paths, and signatures. + else //g_variant_get_string() can handle strings, object paths, and signatures. pch = g_variant_get_string(gobject_, 0); return convert_const_gchar_ptr_to_stdstring(pch); } +/*--------------------Variant< std::vector<Glib::ustring> >---------------------*/ + typedef std::vector<Glib::ustring> type_vec_ustring; Variant<type_vec_ustring>::Variant() @@ -375,15 +451,14 @@ Variant<type_vec_ustring>::create(const type_vec_ustring& data) GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj()); // Add the elements of the vector into the builder. - for(type_vec_ustring::const_iterator iter = data.begin(); - iter < data.end(); iter++) + for(const auto& str : data) { g_variant_builder_add(builder, - element_variant_type.get_string().c_str(), iter->c_str()); + element_variant_type.get_string().c_str(), str.c_str()); } // Create the variant using the builder. - Variant<type_vec_ustring> result = + auto result = Variant<type_vec_ustring>(g_variant_new( array_variant_type.get_string().c_str(), builder)); @@ -394,48 +469,42 @@ Variant<type_vec_ustring>::create(const type_vec_ustring& data) Glib::ustring Variant<type_vec_ustring>::get_child(gsize index) const { - gsize n_elements = 0; - - const gchar** array = g_variant_get_strv(const_cast<GVariant*>(gobj()), - &n_elements); - - if(index >= n_elements) + if (index >= g_variant_n_children(const_cast<GVariant*>(gobj()))) throw std::out_of_range( - "Variant< std::vector<Glib::ustring> >::get(): Index out of bounds."); + "Variant< std::vector<Glib::ustring> >::get_child(): Index out of bounds."); - Glib::ustring const result(array[index]); - g_free(array); - return result; + GVariant* gvariant = + g_variant_get_child_value(const_cast<GVariant*>(gobj()), index); + + return Glib::Variant<Glib::ustring>(gvariant).get(); } type_vec_ustring Variant<type_vec_ustring>::get() const { - gsize n_elements = 0; + // g_variant_get_strv() can be used only if the type is VARIANT_TYPE_STRING_ARRAY, + // but the Variant can alternatively hold an array of object paths or DBus type signatures. + type_vec_ustring result; + + gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj())); + + for (gsize i = 0; i < n_children; i++) + { + GVariant* gvariant = + g_variant_get_child_value(const_cast<GVariant*>(gobj()), i); - const gchar** array = g_variant_get_strv(const_cast<GVariant*>(gobj()), - &n_elements); + result.push_back(Glib::Variant<Glib::ustring>(gvariant).get()); + } - type_vec_ustring const result(array, array + n_elements); - g_free(array); return result; } VariantIter Variant<type_vec_ustring>::get_iter() const { - // Get the variant type of the elements. - VariantType element_variant_type = Variant<Glib::ustring>::variant_type(); - - // Get the variant type of the array. - VariantType array_variant_type = Variant<type_vec_ustring>::variant_type(); - - // Get the GVariantIter. - GVariantIter* g_iter = 0; - g_variant_get(const_cast<GVariant*>(gobj()), - array_variant_type.get_string().c_str(), &g_iter); - - return VariantIter(g_iter); + return VariantContainerBase::get_iter(variant_type()); } +/*--------------------Variant< std::vector<std::string> >---------------------*/ + typedef std::vector<std::string> type_vec_string; Variant<type_vec_string>::Variant() @@ -471,7 +540,7 @@ Variant<type_vec_string>::create(const type_vec_string& data) // Create the variant using g_variant_new_bytestring_array() (passing the // newly constructed array. - Variant<type_vec_string> result = + auto result = Variant<type_vec_string>(g_variant_new_bytestring_array(str_array, data.size())); @@ -496,7 +565,7 @@ Variant<type_vec_string>::create_from_object_paths(const type_vec_string& data) // Create the variant using g_variant_new_objv() (passing the // newly constructed array. - Variant<type_vec_string> result = + auto result = Variant<type_vec_string>(g_variant_new_objv(str_array, data.size())); g_strfreev(str_array); @@ -505,46 +574,38 @@ Variant<type_vec_string>::create_from_object_paths(const type_vec_string& data) std::string Variant<type_vec_string>::get_child(gsize index) const { - gsize n_elements = 0; - - const gchar** array = - g_variant_get_bytestring_array(const_cast<GVariant*>(gobj()), &n_elements); - - if(index >= n_elements) + if (index >= g_variant_n_children(const_cast<GVariant*>(gobj()))) throw std::out_of_range( - "Variant< std::vector<std::string> >::get(): Index out of bounds."); + "Variant< std::vector<std::string> >::get_child(): Index out of bounds."); - std::string const result(array[index]); - g_free(array); - return result; + GVariant* gvariant = + g_variant_get_child_value(const_cast<GVariant*>(gobj()), index); + + return Glib::Variant<std::string>(gvariant).get(); } type_vec_string Variant<type_vec_string>::get() const { - gsize n_elements = 0; + // g_variant_get_bytestring_array() can be used only if the type is VARIANT_TYPE_BYTESTRING_ARRAY, + // but the Variant can alternatively hold an array of strings, object paths or DBus type signatures. + type_vec_string result; + + gsize n_children = g_variant_n_children(const_cast<GVariant*>(gobj())); - const gchar** array = - g_variant_get_bytestring_array(const_cast<GVariant*>(gobj()), &n_elements); + for (gsize i = 0; i < n_children; i++) + { + GVariant* gvariant = + g_variant_get_child_value(const_cast<GVariant*>(gobj()), i); + + result.push_back(Glib::Variant<std::string>(gvariant).get()); + } - type_vec_string const result(array, array + n_elements); - g_free(array); return result; } VariantIter Variant<type_vec_string>::get_iter() const { - // Get the variant type of the elements. - const VariantType element_variant_type = Variant<std::string>::variant_type(); - - // Get the variant type of the array. - const VariantType array_variant_type = Variant<type_vec_string>::variant_type(); - - // Get the GVariantIter. - GVariantIter* g_iter = 0; - g_variant_get(const_cast<GVariant*>(gobj()), - array_variant_type.get_string().c_str(), &g_iter); - - return VariantIter(g_iter); + return VariantContainerBase::get_iter(variant_type()); } } // namespace Glib diff --git a/glib/src/variant.hg b/glib/src/variant.hg index 0cb1a827..5f9a440e 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -20,6 +20,7 @@ _DEFS(glibmm,glib) #include <glibmmconfig.h> #include <glibmm/varianttype.h> #include <glibmm/variantiter.h> +#include <glibmm/refptr.h> #include <glibmm/ustring.h> #include <glibmm/error.h> #include <utility> @@ -30,6 +31,7 @@ _DEFS(glibmm,glib) namespace Glib { +class Bytes; /** @defgroup Variant Variant Data Types * @@ -38,7 +40,7 @@ namespace Glib * information about the type of that value. The range of possible * values is determined by the type. The type system used is VariantType. * - * See the VariantBase class and it's derived types, such as VariantContainerBase, + * See the VariantBase class and its derived types, such as VariantContainerBase, * and the Variant<> template type. * * Variant instances always have a type and a value (which are given @@ -58,14 +60,14 @@ namespace Glib * * There is a Python-inspired text language for describing Variant * values. Variant includes a printer for this language and a parser - * with type inferencing.</a>. + * with type inferencing. */ //Note: We wrap this because it is thrown by GtkBuilder's functions. // See https://bugzilla.gnome.org/show_bug.cgi?id=708206 // It would also be thrown by parse() if we wrap g_variant_parse(). // Now (2014-01-30) it's also thrown by Gio::Action::parse_detailed_name(). -/** Exception class for Variant parse errors. +/** %Exception class for Variant parse errors. */ _WRAP_GERROR(VariantParseError, GVariantParseError, G_VARIANT_PARSE_ERROR, NO_GTYPE) @@ -132,7 +134,9 @@ public: _WRAP_METHOD(GVariantClass classify() const, g_variant_classify) _WRAP_METHOD(gsize get_size() const, g_variant_get_size) - _WRAP_METHOD(gconstpointer get_data(), g_variant_get_data) + _WRAP_METHOD(gconstpointer get_data(), g_variant_get_data, deprecated "Use the const version instead.") + _WRAP_METHOD(gconstpointer get_data() const, g_variant_get_data, newin "2,46") + _WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> get_data_as_bytes() const, g_variant_get_data_as_bytes, newin "2,46") _WRAP_METHOD(void store(gpointer data) const, g_variant_store) _WRAP_METHOD(Glib::ustring print(bool type_annotate = false) const, g_variant_print) @@ -144,6 +148,7 @@ public: /** Checks if @a *this and @a other have the same type and value. * * @newin{2,24} + * * @param other The Variant to compare with. * @return <tt>true</tt> if @a *this and @a other are equal. */ @@ -212,6 +217,24 @@ public: _IGNORE(g_variant_dict_new) +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + /** Used by cast_dynamic(). + * In addition to an exact match, the following casts are possible: + * - VARIANT_TYPE_OBJECT_PATH and VARIANT_TYPE_SIGNATURE can be cast to + * VARIANT_TYPE_STRING (Glib::ustring). + * - VARIANT_TYPE_STRING, VARIANT_TYPE_OBJECT_PATH and VARIANT_TYPE_SIGNATURE + * can be cast to VARIANT_TYPE_BYTESTRING (std::string). + * - VARIANT_TYPE_HANDLE can be cast to VARIANT_TYPE_INT32. + * + * These casts are possible also when they are parts of a more complicated type. + * E.g. in Variant<std::map<Glib::ustring, std::vector<std::string> > > the map's keys + * can be VARIANT_TYPE_OBJECT_PATH and the vector's elements can be VARIANT_TYPE_SIGNATURE. + * @newin{2,46} + */ + bool is_castable_to(const VariantType& supertype) const; +#endif //DOXYGEN_SHOULD_SKIP_THIS + private: /** Relational operators are deleted to prevent invalid conversion * to const void*. @@ -242,7 +265,7 @@ throw(std::bad_cast) { return V_CastTo(); } - if(v.is_of_type(V_CastTo::variant_type())) + if(v.is_castable_to(V_CastTo::variant_type())) { return V_CastTo(const_cast<GVariant*>(v.gobj()), true); } @@ -258,8 +281,7 @@ throw(std::bad_cast) */ class VariantStringBase : public VariantBase { - // Trick gmmproc into thinking this is derived from GVariant to wrap a - // some methods. + // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(VariantStringBase, GVariant) public: @@ -314,8 +336,7 @@ public: */ class VariantContainerBase : public VariantBase { - // Trick gmmproc into thinking this is derived from GVariant to wrap a - // some methods. + // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(VariantContainerBase, GVariant) public: @@ -379,7 +400,7 @@ public: */ /** If this is a maybe-typed instance, extract its value. If the value is - * Nothing, then this function returns <tt>0</tt>. + * Nothing, then this function returns <tt>false</tt>. * * @param maybe A place in which to return the value (the value may be * <tt>0</tt>). @@ -387,6 +408,14 @@ public: */ bool get_maybe(VariantBase& maybe) const; _IGNORE(g_variant_get_maybe) + +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + /** Used by get_iter() in the subclasses. + * @newin{2,46} + */ + VariantIter get_iter(const VariantType& container_variant_type) const; +#endif //DOXYGEN_SHOULD_SKIP_THIS }; template<> @@ -404,10 +433,6 @@ public: typedef T CppType; }; -// Each specialization has (or should have) a variant_type() method that gets -// the type. So the C g_variant_get_type() function can be ignored. -_IGNORE(g_variant_get_type) - /****************** Specializations ***********************************/ /** Specialization of Variant containing a VariantBase. @@ -417,8 +442,7 @@ _IGNORE(g_variant_get_type) template<> class Variant<VariantBase> : public VariantContainerBase { - // Trick gmmproc into thinking this is derived from GVariant to wrap a - // some methods. + // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(Variant<VariantBase>, GVariant) public: @@ -505,15 +529,14 @@ public: }; /** Specialization of Variant containing a Glib::ustring, for variants of type - * string, bytestring, object path, or signature. + * string, object path, or signature. * @newin{2,28} * @ingroup Variant */ template<> class Variant<Glib::ustring> : public VariantStringBase { - // Trick gmmproc into thinking this is derived from GVariant to wrap a - // some methods. + // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(Variant<Glib::ustring>, GVariant) public: typedef char* CType; @@ -552,12 +575,13 @@ public: _IGNORE(g_variant_get_string, g_variant_dup_string) }; +//TODO: When we can break ABI, remove this template specialization. template<> Variant<Glib::ustring> VariantBase::cast_dynamic< Variant<Glib::ustring> >(const VariantBase& v) throw(std::bad_cast); /** Specialization of Variant containing a std::string, for variants of type - * bytestring, object path, or signature. + * bytestring, string, object path, or signature. * See also Variant<Glib::ustring> for UTF-8 strings. * @newin{2,28} * @ingroup Variant @@ -565,8 +589,7 @@ throw(std::bad_cast); template<> class Variant<std::string> : public VariantStringBase { - // Trick gmmproc into thinking this is derived from GVariant to wrap a - // some methods. + // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(Variant<std::string>, GVariant) public: typedef char* CType; @@ -601,6 +624,7 @@ public: _IGNORE(g_variant_get_bytestring, g_variant_dup_bytestring) }; +//TODO: When we can break ABI, remove this template specialization. template<> Variant<std::string> VariantBase::cast_dynamic< Variant<std::string> >(const VariantBase& v) throw(std::bad_cast); @@ -945,11 +969,12 @@ public: _IGNORE( g_variant_get_boolean, g_variant_get_byte, + g_variant_get_int16, g_variant_get_uint16, - g_variant_get_int64, g_variant_get_int32, - g_variant_get_int16, + g_variant_get_handle, g_variant_get_uint32, + g_variant_get_int64, g_variant_get_uint64, g_variant_get_double, g_variant_iter_new @@ -1029,11 +1054,11 @@ Variant< std::pair<K, V> >::create(const std::pair<K, V>& data) template<class K, class V> std::pair<K, V> Variant< std::pair<K, V> >::get() const { - // Get the key (the first element of the this VariantContainerBase). + // Get the key (the first element of this VariantContainerBase). Variant<K> key; VariantContainerBase::get_child(key, 0); - // Get the value (the second element of the this VariantContainerBase). + // Get the value (the second element of this VariantContainerBase). Variant<V> value; VariantContainerBase::get_child(value, 1); @@ -1058,9 +1083,6 @@ template<class T> Variant< std::vector<T> > Variant< std::vector<T> >::create(const std::vector<T>& data) { - // Get the variant type of the elements. - VariantType element_variant_type = Variant<T>::variant_type(); - // Get the variant type of the array. VariantType array_variant_type = Variant< std::vector<T> >::variant_type(); @@ -1068,17 +1090,16 @@ Variant< std::vector<T> >::create(const std::vector<T>& data) GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj()); // Add the elements of the vector into the builder. - for(typename std::vector<T>::const_iterator iter = data.begin(); - iter < data.end(); iter++) + for(const auto& element : data) { - Glib::Variant<T> variant = Glib::Variant<T>::create(*iter); + Glib::Variant<T> variant = Glib::Variant<T>::create(element); g_variant_builder_add_value(builder, variant.gobj()); } // Create the variant using the builder. Variant< std::vector<T> > result = Variant< std::vector<T> >(g_variant_new( - reinterpret_cast<gchar*>(array_variant_type.gobj()), builder)); + reinterpret_cast<const gchar*>(array_variant_type.gobj()), builder)); g_variant_builder_unref(builder); @@ -1125,18 +1146,7 @@ std::vector<T> Variant< std::vector<T> >::get() const template<class T> VariantIter Variant< std::vector<T> >::get_iter() const { - // Get the variant type of the elements. - VariantType element_variant_type = Variant<T>::variant_type(); - - // Get the variant type of the array. - VariantType array_variant_type = Variant< std::vector<T> >::variant_type(); - - // Get the GVariantIter. - GVariantIter* g_iter = 0; - g_variant_get(const_cast<GVariant*>(gobj()), - reinterpret_cast<gchar*>(array_variant_type.gobj()), &g_iter); - - return VariantIter(g_iter); + return VariantContainerBase::get_iter(variant_type()); } /*---------------------Variant< std::map<K, V> > --------------------*/ @@ -1165,19 +1175,18 @@ Variant< std::map<K, V> >::create(const std::map<K, V>& data) // Create a GVariantBuilder to build the array. GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj()); - // Add the elements of the vector into the builder. - for(typename std::map<K, V>::const_iterator iter = data.begin(); - iter != data.end(); iter++) + // Add the elements of the map into the builder. + for(const auto& element : data) { - Variant< std::pair<K, V> > dict_entry = - Variant< std::pair<K, V> >::create(*iter); + auto dict_entry = + Variant< std::pair<K, V> >::create(element); g_variant_builder_add_value(builder, dict_entry.gobj()); } // Create the variant using the builder. Variant< std::map<K, V> > result = Variant< std::map<K, V> >(g_variant_new( - reinterpret_cast<gchar*>(array_variant_type.gobj()), builder)); + reinterpret_cast<const gchar*>(array_variant_type.gobj()), builder)); g_variant_builder_unref(builder); @@ -1235,19 +1244,7 @@ std::map<K, V> Variant< std::map<K, V> >::get() const template<class K, class V> VariantIter Variant< std::map<K, V> >::get_iter() const { - // Get the variant type of the elements. - VariantType element_variant_type = - Variant< std::pair<K, V> >::variant_type(); - - // Get the variant type of the array. - VariantType array_variant_type = Variant< std::map<K, V> >::variant_type(); - - // Get the GVariantIter. - GVariantIter* g_iter = 0; - g_variant_get(const_cast<GVariant*>(gobj()), - reinterpret_cast<gchar*>(array_variant_type.gobj()), &g_iter); - - return VariantIter(g_iter); + return VariantContainerBase::get_iter(variant_type()); } } // namespace Glib diff --git a/glib/src/variant_basictypes.cc.m4 b/glib/src/variant_basictypes.cc.m4 index ba79a204..4247da88 100644 --- a/glib/src/variant_basictypes.cc.m4 +++ b/glib/src/variant_basictypes.cc.m4 @@ -23,11 +23,14 @@ dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) dnl -dnl For instance, GLIB_VARIANT_BASIC(c++ type, c type, c type name) -dnl parameters: -dnl c++ type: The C++ type for the specialization, such as bool -dnl c type: The C type used by the C API, such as gboolean. -dnl c type name: The text used in the C API functions and macros, such as boolean, in g_variant_get_boolean() and G_VARIANT_TYPE_BOOLEAN. +dnl For instance, GLIB_VARIANT_BASIC(C++ type, C type, C type name [,C type name 2]) +dnl Parameters: +dnl C++ type: The C++ type for the specialization, such as bool. +dnl C type: The C type used by the C API, such as gboolean. +dnl C type name: The text used in the C API functions and macros, such as boolean +dnl in g_variant_get_boolean() and G_VARIANT_TYPE_BOOLEAN. +dnl C type name 2: Optional second text, such as handle in g_variant_get_handle() +dnl and G_VARIANT_TYPE_HANDLE. dnl define([GLIB_VARIANT_BASIC],[dnl LINE(]__line__[)dnl @@ -44,13 +47,27 @@ const VariantType& Variant<$1>::variant_type() Variant<$1> Variant<$1>::create($1 data) { - Variant<$1> result = Variant<$1>(g_variant_new_$3(data)); + auto result = Variant<$1>(g_variant_new_$3(data)); return result; } +ifelse($4,,,[ +Variant<$1> Variant<$1>::create_$4($1 data) +{ + auto result = Variant<$1>(g_variant_new_$4(data)); + return result; +} +])dnl $1 Variant<$1>::get() const { +ifelse($4,,[dnl return g_variant_get_$3(gobject_); +],[dnl + if (get_type().equal(VARIANT_TYPE_[]UPPER($3))) + return g_variant_get_$3(gobject_); + else + return g_variant_get_$4(gobject_); +])dnl } ]) @@ -66,11 +83,10 @@ GLIB_VARIANT_BASIC(bool, gboolean, boolean) GLIB_VARIANT_BASIC(unsigned char, guchar, byte) GLIB_VARIANT_BASIC(gint16, gint16, int16) GLIB_VARIANT_BASIC(guint16, guint16, uint16) -GLIB_VARIANT_BASIC(gint32, gint32, int32) +GLIB_VARIANT_BASIC(gint32, gint32, int32, handle) GLIB_VARIANT_BASIC(guint32, guint32, uint32) GLIB_VARIANT_BASIC(gint64, gint64, int64) GLIB_VARIANT_BASIC(guint64, guint64, uint64) -dnl This would redeclare the <int> GLIB_VARIANT_BASIC(gint32, guint32, handle) GLIB_VARIANT_BASIC(double, gdouble, double) } // namespace Glib diff --git a/glib/src/variant_basictypes.h.m4 b/glib/src/variant_basictypes.h.m4 index 2f11a521..a6b6ec06 100644 --- a/glib/src/variant_basictypes.h.m4 +++ b/glib/src/variant_basictypes.h.m4 @@ -23,11 +23,14 @@ dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) dnl -dnl For instance, GLIB_VARIANT_BASIC(c++ type, c type, c type name) -dnl parameters: -dnl c++ type: The C++ type for the specialization, such as bool -dnl c type: The C type used by the C API, such as gboolean. -dnl c type name: The text used in the C API functions and macros, such as boolean, in g_variant_get_boolean() and G_VARIANT_TYPE_BOOLEAN. +dnl For instance, GLIB_VARIANT_BASIC(C++ type, C type, C type name [,C type name 2]) +dnl Parameters: +dnl C++ type: The C++ type for the specialization, such as bool. +dnl C type: The C type used by the C API, such as gboolean. +dnl C type name: The text used in the C API functions and macros, such as boolean +dnl in g_variant_get_boolean() and G_VARIANT_TYPE_BOOLEAN. +dnl C type name 2: Optional second text, such as handle in g_variant_get_handle() +dnl and G_VARIANT_TYPE_HANDLE. dnl define([GLIB_VARIANT_BASIC],[dnl LINE(]__line__[)dnl @@ -67,7 +70,13 @@ public: * @return The new Glib::Variant<$1>. */ static Variant<$1> create($1 data); - +ifelse($4,,,[ + /** Creates a new Glib::Variant<$1> of type VARIANT_TYPE_[]UPPER($4). + * @param data The value of the new Glib::Variant<$1>. + * @return The new Glib::Variant<$1>. + */ + static Variant<$1> create_$4($1 data); +]) /** Gets the value of the Glib::Variant<$1>. * @return The $1 value of the Glib::Variant<$1>. */ @@ -90,10 +99,9 @@ GLIB_VARIANT_BASIC(bool, gboolean, boolean) GLIB_VARIANT_BASIC(unsigned char, guchar, byte) GLIB_VARIANT_BASIC(gint16, gint16, int16) GLIB_VARIANT_BASIC(guint16, guint16, uint16) -GLIB_VARIANT_BASIC(gint32, gint32, int32) +GLIB_VARIANT_BASIC(gint32, gint32, int32, handle) GLIB_VARIANT_BASIC(guint32, guint32, uint32) GLIB_VARIANT_BASIC(gint64, gint64, int64) GLIB_VARIANT_BASIC(guint64, guint64, uint64) -dnl This would redeclare the <int> specialization: GLIB_VARIANT_BASIC(gint32, guint32, handle) GLIB_VARIANT_BASIC(double, gdouble, double) } // namespace Glib diff --git a/glib/src/varianttype.ccg b/glib/src/varianttype.ccg index 71d34d9a..5a3702f8 100644 --- a/glib/src/varianttype.ccg +++ b/glib/src/varianttype.ccg @@ -27,7 +27,7 @@ VariantType::VariantType(const GVariantType* castitem) if(castitem) gobject_ = g_variant_type_copy(castitem); else - gobject_ = 0; + gobject_ = nullptr; } VariantType::VariantType(const std::string& type_string) @@ -45,7 +45,7 @@ VariantType& VariantType::operator=(const GVariantType* castitem) if(castitem) gobject_ = g_variant_type_copy(castitem); else - gobject_ = 0; + gobject_ = nullptr; return *this; } @@ -54,14 +54,14 @@ VariantType& VariantType::operator=(const GVariantType* castitem) VariantType VariantType::create_tuple(const std::vector<VariantType>& items) { typedef GVariantType* var_ptr; - var_ptr* const var_array = new var_ptr[items.size()]; + const auto var_array = new var_ptr[items.size()]; for(std::vector<VariantType>::size_type i = 0; i < items.size(); i++) { var_array[i] = const_cast<GVariantType*>(items[i].gobj()); } - VariantType result = Glib::wrap(g_variant_type_new_tuple(var_array, items.size())); + auto result = Glib::wrap(g_variant_type_new_tuple(var_array, items.size())); delete[] var_array; return result; } |