;; -*- scheme -*-
; object definitions ...
;; Enumerations and flags ...

(define-enum ConvertError
  (in-module "G")
  (c-name "GConvertError")
  (gtype-id "G_TYPE_CONVERT_ERROR")
  (values
    '("no-conversion" "G_CONVERT_ERROR_NO_CONVERSION")
    '("illegal-sequence" "G_CONVERT_ERROR_ILLEGAL_SEQUENCE")
    '("failed" "G_CONVERT_ERROR_FAILED")
    '("partial-input" "G_CONVERT_ERROR_PARTIAL_INPUT")
    '("bad-uri" "G_CONVERT_ERROR_BAD_URI")
    '("not-absolute-path" "G_CONVERT_ERROR_NOT_ABSOLUTE_PATH")
  )
)

(define-enum DateDMY
  (in-module "G")
  (c-name "GDateDMY")
  (gtype-id "G_TYPE_DATE_DMY")
  (values
    '("day" "G_DATE_DAY")
    '("month" "G_DATE_MONTH")
    '("year" "G_DATE_YEAR")
  )
)

(define-enum DateWeekday
  (in-module "G")
  (c-name "GDateWeekday")
  (gtype-id "G_TYPE_DATE_WEEKDAY")
  (values
    '("bad-weekday" "G_DATE_BAD_WEEKDAY")
    '("monday" "G_DATE_MONDAY")
    '("tuesday" "G_DATE_TUESDAY")
    '("wednesday" "G_DATE_WEDNESDAY")
    '("thursday" "G_DATE_THURSDAY")
    '("friday" "G_DATE_FRIDAY")
    '("saturday" "G_DATE_SATURDAY")
    '("sunday" "G_DATE_SUNDAY")
  )
)

(define-enum DateMonth
  (in-module "G")
  (c-name "GDateMonth")
  (gtype-id "G_TYPE_DATE_MONTH")
  (values
    '("bad-month" "G_DATE_BAD_MONTH")
    '("january" "G_DATE_JANUARY")
    '("february" "G_DATE_FEBRUARY")
    '("march" "G_DATE_MARCH")
    '("april" "G_DATE_APRIL")
    '("may" "G_DATE_MAY")
    '("june" "G_DATE_JUNE")
    '("july" "G_DATE_JULY")
    '("august" "G_DATE_AUGUST")
    '("september" "G_DATE_SEPTEMBER")
    '("october" "G_DATE_OCTOBER")
    '("november" "G_DATE_NOVEMBER")
    '("december" "G_DATE_DECEMBER")
  )
)

(define-enum FileError
  (in-module "G")
  (c-name "GFileError")
  (gtype-id "G_TYPE_FILE_ERROR")
  (values
    '("exist" "G_FILE_ERROR_EXIST")
    '("isdir" "G_FILE_ERROR_ISDIR")
    '("acces" "G_FILE_ERROR_ACCES")
    '("nametoolong" "G_FILE_ERROR_NAMETOOLONG")
    '("noent" "G_FILE_ERROR_NOENT")
    '("notdir" "G_FILE_ERROR_NOTDIR")
    '("nxio" "G_FILE_ERROR_NXIO")
    '("nodev" "G_FILE_ERROR_NODEV")
    '("rofs" "G_FILE_ERROR_ROFS")
    '("txtbsy" "G_FILE_ERROR_TXTBSY")
    '("fault" "G_FILE_ERROR_FAULT")
    '("loop" "G_FILE_ERROR_LOOP")
    '("nospc" "G_FILE_ERROR_NOSPC")
    '("nomem" "G_FILE_ERROR_NOMEM")
    '("mfile" "G_FILE_ERROR_MFILE")
    '("nfile" "G_FILE_ERROR_NFILE")
    '("badf" "G_FILE_ERROR_BADF")
    '("inval" "G_FILE_ERROR_INVAL")
    '("pipe" "G_FILE_ERROR_PIPE")
    '("again" "G_FILE_ERROR_AGAIN")
    '("intr" "G_FILE_ERROR_INTR")
    '("io" "G_FILE_ERROR_IO")
    '("perm" "G_FILE_ERROR_PERM")
    '("failed" "G_FILE_ERROR_FAILED")
  )
)

(define-flags FileTest
  (in-module "G")
  (c-name "GFileTest")
  (gtype-id "G_TYPE_FILE_TEST")
  (values
    '("is-regular" "G_FILE_TEST_IS_REGULAR")
    '("is-symlink" "G_FILE_TEST_IS_SYMLINK")
    '("is-dir" "G_FILE_TEST_IS_DIR")
    '("is-executable" "G_FILE_TEST_IS_EXECUTABLE")
    '("exists" "G_FILE_TEST_EXISTS")
  )
)

(define-flags HookFlagMask
  (in-module "G")
  (c-name "GHookFlagMask")
  (gtype-id "G_TYPE_HOOK_FLAG_MASK")
  (values
    '("active" "G_HOOK_FLAG_ACTIVE")
    '("in-call" "G_HOOK_FLAG_IN_CALL")
    '("mask" "G_HOOK_FLAG_MASK")
  )
)

(define-enum IOError
  (in-module "G")
  (c-name "GIOError")
  (gtype-id "G_TYPE_IO_ERROR")
  (values
    '("none" "G_IO_ERROR_NONE")
    '("again" "G_IO_ERROR_AGAIN")
    '("inval" "G_IO_ERROR_INVAL")
    '("unknown" "G_IO_ERROR_UNKNOWN")
  )
)

(define-enum IOChannelError
  (in-module "G")
  (c-name "GIOChannelError")
  (gtype-id "G_TYPE_IO_CHANNEL_ERROR")
  (values
    '("fbig" "G_IO_CHANNEL_ERROR_FBIG")
    '("inval" "G_IO_CHANNEL_ERROR_INVAL")
    '("io" "G_IO_CHANNEL_ERROR_IO")
    '("isdir" "G_IO_CHANNEL_ERROR_ISDIR")
    '("nospc" "G_IO_CHANNEL_ERROR_NOSPC")
    '("nxio" "G_IO_CHANNEL_ERROR_NXIO")
    '("overflow" "G_IO_CHANNEL_ERROR_OVERFLOW")
    '("pipe" "G_IO_CHANNEL_ERROR_PIPE")
    '("failed" "G_IO_CHANNEL_ERROR_FAILED")
  )
)

(define-enum IOStatus
  (in-module "G")
  (c-name "GIOStatus")
  (gtype-id "G_TYPE_IO_STATUS")
  (values
    '("error" "G_IO_STATUS_ERROR")
    '("normal" "G_IO_STATUS_NORMAL")
    '("eof" "G_IO_STATUS_EOF")
    '("again" "G_IO_STATUS_AGAIN")
  )
)

(define-enum SeekType
  (in-module "G")
  (c-name "GSeekType")
  (gtype-id "G_TYPE_SEEK_TYPE")
  (values
    '("cur" "G_SEEK_CUR")
    '("set" "G_SEEK_SET")
    '("end" "G_SEEK_END")
  )
)

(define-enum IOCondition
  (in-module "G")
  (c-name "GIOCondition")
  (gtype-id "G_TYPE_IO_CONDITION")
  (values
    '("in" "G_IO_IN")
    '("out" "G_IO_OUT")
    '("pri" "G_IO_PRI")
    '("err" "G_IO_ERR")
    '("hup" "G_IO_HUP")
    '("nval" "G_IO_NVAL")
  )
)

(define-flags IOFlags
  (in-module "G")
  (c-name "GIOFlags")
  (gtype-id "G_TYPE_IO_FLAGS")
  (values
    '("append" "G_IO_FLAG_APPEND")
    '("nonblock" "G_IO_FLAG_NONBLOCK")
    '("is-readable" "G_IO_FLAG_IS_READABLE")
    '("is-writeable" "G_IO_FLAG_IS_WRITEABLE")
    '("is-seekable" "G_IO_FLAG_IS_SEEKABLE")
    '("mask" "G_IO_FLAG_MASK")
    '("get-mask" "G_IO_FLAG_GET_MASK")
    '("set-mask" "G_IO_FLAG_SET_MASK")
  )
)

(define-enum MarkupError
  (in-module "G")
  (c-name "GMarkupError")
  (gtype-id "G_TYPE_MARKUP_ERROR")
  (values
    '("bad-utf8" "G_MARKUP_ERROR_BAD_UTF8")
    '("empty" "G_MARKUP_ERROR_EMPTY")
    '("parse" "G_MARKUP_ERROR_PARSE")
    '("unknown-element" "G_MARKUP_ERROR_UNKNOWN_ELEMENT")
    '("unknown-attribute" "G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE")
    '("invalid-content" "G_MARKUP_ERROR_INVALID_CONTENT")
  )
)

(define-flags MarkupParseFlags
  (in-module "G")
  (c-name "GMarkupParseFlags")
  (gtype-id "G_TYPE_MARKUP_PARSE_FLAGS")
  (values
    '("g" "G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG")
  )
)

(define-flags LogLevelFlags
  (in-module "G")
  (c-name "GLogLevelFlags")
  (gtype-id "G_TYPE_LOG_LEVEL_FLAGS")
  (values
    '("flag-recursion" "G_LOG_FLAG_RECURSION")
    '("flag-fatal" "G_LOG_FLAG_FATAL")
    '("level-error" "G_LOG_LEVEL_ERROR")
    '("level-critical" "G_LOG_LEVEL_CRITICAL")
    '("level-warning" "G_LOG_LEVEL_WARNING")
    '("level-message" "G_LOG_LEVEL_MESSAGE")
    '("level-info" "G_LOG_LEVEL_INFO")
    '("level-debug" "G_LOG_LEVEL_DEBUG")
    '("level-mask" "G_LOG_LEVEL_MASK")
  )
)

(define-flags TraverseFlags
  (in-module "G")
  (c-name "GTraverseFlags")
  (gtype-id "G_TYPE_TRAVERSE_FLAGS")
  (values
    '("leafs" "G_TRAVERSE_LEAFS")
    '("non-leafs" "G_TRAVERSE_NON_LEAFS")
    '("all" "G_TRAVERSE_ALL")
    '("mask" "G_TRAVERSE_MASK")
  )
)

(define-enum TraverseType
  (in-module "G")
  (c-name "GTraverseType")
  (gtype-id "G_TYPE_TRAVERSE_TYPE")
  (values
    '("in-order" "G_IN_ORDER")
    '("pre-order" "G_PRE_ORDER")
    '("post-order" "G_POST_ORDER")
    '("level-order" "G_LEVEL_ORDER")
  )
)

(define-enum ErrorType
  (in-module "G")
  (c-name "GErrorType")
  (gtype-id "G_TYPE_ERROR_TYPE")
  (values
    '("unknown" "G_ERR_UNKNOWN")
    '("unexp-eof" "G_ERR_UNEXP_EOF")
    '("unexp-eof-in-string" "G_ERR_UNEXP_EOF_IN_STRING")
    '("unexp-eof-in-comment" "G_ERR_UNEXP_EOF_IN_COMMENT")
    '("non-digit-in-const" "G_ERR_NON_DIGIT_IN_CONST")
    '("digit-radix" "G_ERR_DIGIT_RADIX")
    '("float-radix" "G_ERR_FLOAT_RADIX")
    '("float-malformed" "G_ERR_FLOAT_MALFORMED")
  )
)

(define-enum ShellError
  (in-module "G")
  (c-name "GShellError")
  (gtype-id "G_TYPE_SHELL_ERROR")
  (values
    '("bad-quoting" "G_SHELL_ERROR_BAD_QUOTING")
    '("empty-string" "G_SHELL_ERROR_EMPTY_STRING")
    '("failed" "G_SHELL_ERROR_FAILED")
  )
)

(define-enum SpawnError
  (in-module "G")
  (c-name "GSpawnError")
  (gtype-id "G_TYPE_SPAWN_ERROR")
  (values
    '("fork" "G_SPAWN_ERROR_FORK")
    '("read" "G_SPAWN_ERROR_READ")
    '("chdir" "G_SPAWN_ERROR_CHDIR")
    '("acces" "G_SPAWN_ERROR_ACCES")
    '("perm" "G_SPAWN_ERROR_PERM")
    '("2big" "G_SPAWN_ERROR_2BIG")
    '("noexec" "G_SPAWN_ERROR_NOEXEC")
    '("nametoolong" "G_SPAWN_ERROR_NAMETOOLONG")
    '("noent" "G_SPAWN_ERROR_NOENT")
    '("nomem" "G_SPAWN_ERROR_NOMEM")
    '("notdir" "G_SPAWN_ERROR_NOTDIR")
    '("loop" "G_SPAWN_ERROR_LOOP")
    '("txtbusy" "G_SPAWN_ERROR_TXTBUSY")
    '("io" "G_SPAWN_ERROR_IO")
    '("nfile" "G_SPAWN_ERROR_NFILE")
    '("mfile" "G_SPAWN_ERROR_MFILE")
    '("inval" "G_SPAWN_ERROR_INVAL")
    '("isdir" "G_SPAWN_ERROR_ISDIR")
    '("libbad" "G_SPAWN_ERROR_LIBBAD")
    '("failed" "G_SPAWN_ERROR_FAILED")
  )
)

(define-flags SpawnFlags
  (in-module "G")
  (c-name "GSpawnFlags")
  (gtype-id "G_TYPE_SPAWN_FLAGS")
  (values
    '("leave-descriptors-open" "G_SPAWN_LEAVE_DESCRIPTORS_OPEN")
    '("do-not-reap-child" "G_SPAWN_DO_NOT_REAP_CHILD")
    '("search-path" "G_SPAWN_SEARCH_PATH")
    '("stdout-to-dev-null" "G_SPAWN_STDOUT_TO_DEV_NULL")
    '("stderr-to-dev-null" "G_SPAWN_STDERR_TO_DEV_NULL")
    '("child-inherits-stdin" "G_SPAWN_CHILD_INHERITS_STDIN")
    '("file-and-argv-zero" "G_SPAWN_FILE_AND_ARGV_ZERO")
  )
)

(define-flags AsciiType
  (in-module "G")
  (c-name "GAsciiType")
  (gtype-id "G_TYPE_ASCII_TYPE")
  (values
    '("alnum" "G_ASCII_ALNUM")
    '("alpha" "G_ASCII_ALPHA")
    '("cntrl" "G_ASCII_CNTRL")
    '("digit" "G_ASCII_DIGIT")
    '("graph" "G_ASCII_GRAPH")
    '("lower" "G_ASCII_LOWER")
    '("print" "G_ASCII_PRINT")
    '("punct" "G_ASCII_PUNCT")
    '("space" "G_ASCII_SPACE")
    '("upper" "G_ASCII_UPPER")
    '("xdigit" "G_ASCII_XDIGIT")
  )
)

(define-enum ThreadError
  (in-module "G")
  (c-name "GThreadError")
  (gtype-id "G_TYPE_THREAD_ERROR")
  (values
    '("n" "G_THREAD_ERROR_AGAIN")
  )
)

(define-enum ThreadPriority
  (in-module "G")
  (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")
  )
)

(define-enum UnicodeType
  (in-module "G")
  (c-name "GUnicodeType")
  (gtype-id "G_TYPE_UNICODE_TYPE")
  (values
    '("control" "G_UNICODE_CONTROL")
    '("format" "G_UNICODE_FORMAT")
    '("unassigned" "G_UNICODE_UNASSIGNED")
    '("private-use" "G_UNICODE_PRIVATE_USE")
    '("surrogate" "G_UNICODE_SURROGATE")
    '("lowercase-letter" "G_UNICODE_LOWERCASE_LETTER")
    '("modifier-letter" "G_UNICODE_MODIFIER_LETTER")
    '("other-letter" "G_UNICODE_OTHER_LETTER")
    '("titlecase-letter" "G_UNICODE_TITLECASE_LETTER")
    '("uppercase-letter" "G_UNICODE_UPPERCASE_LETTER")
    '("combining-mark" "G_UNICODE_COMBINING_MARK")
    '("enclosing-mark" "G_UNICODE_ENCLOSING_MARK")
    '("non-spacing-mark" "G_UNICODE_NON_SPACING_MARK")
    '("decimal-number" "G_UNICODE_DECIMAL_NUMBER")
    '("letter-number" "G_UNICODE_LETTER_NUMBER")
    '("other-number" "G_UNICODE_OTHER_NUMBER")
    '("connect-punctuation" "G_UNICODE_CONNECT_PUNCTUATION")
    '("dash-punctuation" "G_UNICODE_DASH_PUNCTUATION")
    '("close-punctuation" "G_UNICODE_CLOSE_PUNCTUATION")
    '("final-punctuation" "G_UNICODE_FINAL_PUNCTUATION")
    '("initial-punctuation" "G_UNICODE_INITIAL_PUNCTUATION")
    '("other-punctuation" "G_UNICODE_OTHER_PUNCTUATION")
    '("open-punctuation" "G_UNICODE_OPEN_PUNCTUATION")
    '("currency-symbol" "G_UNICODE_CURRENCY_SYMBOL")
    '("modifier-symbol" "G_UNICODE_MODIFIER_SYMBOL")
    '("math-symbol" "G_UNICODE_MATH_SYMBOL")
    '("other-symbol" "G_UNICODE_OTHER_SYMBOL")
    '("line-separator" "G_UNICODE_LINE_SEPARATOR")
    '("paragraph-separator" "G_UNICODE_PARAGRAPH_SEPARATOR")
    '("space-separator" "G_UNICODE_SPACE_SEPARATOR")
  )
)

(define-enum UnicodeBreakType
  (in-module "G")
  (c-name "GUnicodeBreakType")
  (gtype-id "G_TYPE_UNICODE_BREAK_TYPE")
  (values
    '("mandatory" "G_UNICODE_BREAK_MANDATORY")
    '("carriage-return" "G_UNICODE_BREAK_CARRIAGE_RETURN")
    '("line-feed" "G_UNICODE_BREAK_LINE_FEED")
    '("combining-mark" "G_UNICODE_BREAK_COMBINING_MARK")
    '("surrogate" "G_UNICODE_BREAK_SURROGATE")
    '("zero-width-space" "G_UNICODE_BREAK_ZERO_WIDTH_SPACE")
    '("inseparable" "G_UNICODE_BREAK_INSEPARABLE")
    '("non-breaking-glue" "G_UNICODE_BREAK_NON_BREAKING_GLUE")
    '("contingent" "G_UNICODE_BREAK_CONTINGENT")
    '("space" "G_UNICODE_BREAK_SPACE")
    '("after" "G_UNICODE_BREAK_AFTER")
    '("before" "G_UNICODE_BREAK_BEFORE")
    '("before-and-after" "G_UNICODE_BREAK_BEFORE_AND_AFTER")
    '("hyphen" "G_UNICODE_BREAK_HYPHEN")
    '("non-starter" "G_UNICODE_BREAK_NON_STARTER")
    '("open-punctuation" "G_UNICODE_BREAK_OPEN_PUNCTUATION")
    '("close-punctuation" "G_UNICODE_BREAK_CLOSE_PUNCTUATION")
    '("quotation" "G_UNICODE_BREAK_QUOTATION")
    '("exclamation" "G_UNICODE_BREAK_EXCLAMATION")
    '("ideographic" "G_UNICODE_BREAK_IDEOGRAPHIC")
    '("numeric" "G_UNICODE_BREAK_NUMERIC")
    '("infix-separator" "G_UNICODE_BREAK_INFIX_SEPARATOR")
    '("symbol" "G_UNICODE_BREAK_SYMBOL")
    '("alphabetic" "G_UNICODE_BREAK_ALPHABETIC")
    '("prefix" "G_UNICODE_BREAK_PREFIX")
    '("postfix" "G_UNICODE_BREAK_POSTFIX")
    '("complex-context" "G_UNICODE_BREAK_COMPLEX_CONTEXT")
    '("ambiguous" "G_UNICODE_BREAK_AMBIGUOUS")
    '("unknown" "G_UNICODE_BREAK_UNKNOWN")
  )
)

(define-enum NormalizeMode
  (in-module "G")
  (c-name "GNormalizeMode")
  (gtype-id "G_TYPE_NORMALIZE_MODE")
  (values
    '("default" "G_NORMALIZE_DEFAULT")
    '("nfd" "G_NORMALIZE_NFD")
    '("default-compose" "G_NORMALIZE_DEFAULT_COMPOSE")
    '("nfc" "G_NORMALIZE_NFC")
    '("all" "G_NORMALIZE_ALL")
    '("nfkd" "G_NORMALIZE_NFKD")
    '("all-compose" "G_NORMALIZE_ALL_COMPOSE")
    '("nfkc" "G_NORMALIZE_NFKC")
  )
)


;; From glib/galloca.h



;; From glib/garray.h

(define-function g_array_new
  (c-name "g_array_new")
  (return-type "GArray*")
  (parameters
    '("gboolean" "zero_terminated")
    '("gboolean" "clear")
    '("guint" "element_size")
  )
)

(define-function g_array_sized_new
  (c-name "g_array_sized_new")
  (return-type "GArray*")
  (parameters
    '("gboolean" "zero_terminated")
    '("gboolean" "clear")
    '("guint" "element_size")
    '("guint" "reserved_size")
  )
)

(define-method free
  (of-object "GArray")
  (c-name "g_array_free")
  (return-type "gchar*")
  (parameters
    '("gboolean" "free_segment")
  )
)

(define-method append_vals
  (of-object "GArray")
  (c-name "g_array_append_vals")
  (return-type "GArray*")
  (parameters
    '("gconstpointer" "data")
    '("guint" "len")
  )
)

(define-method prepend_vals
  (of-object "GArray")
  (c-name "g_array_prepend_vals")
  (return-type "GArray*")
  (parameters
    '("gconstpointer" "data")
    '("guint" "len")
  )
)

(define-method insert_vals
  (of-object "GArray")
  (c-name "g_array_insert_vals")
  (return-type "GArray*")
  (parameters
    '("guint" "index")
    '("gconstpointer" "data")
    '("guint" "len")
  )
)

(define-method set_size
  (of-object "GArray")
  (c-name "g_array_set_size")
  (return-type "GArray*")
  (parameters
    '("guint" "length")
  )
)

(define-method remove_index
  (of-object "GArray")
  (c-name "g_array_remove_index")
  (return-type "GArray*")
  (parameters
    '("guint" "index")
  )
)

(define-method remove_index_fast
  (of-object "GArray")
  (c-name "g_array_remove_index_fast")
  (return-type "GArray*")
  (parameters
    '("guint" "index")
  )
)

(define-method sort
  (of-object "GArray")
  (c-name "g_array_sort")
  (return-type "none")
  (parameters
    '("GCompareFunc" "compare_func")
  )
)

(define-method sort_with_data
  (of-object "GArray")
  (c-name "g_array_sort_with_data")
  (return-type "none")
  (parameters
    '("GCompareDataFunc" "compare_func")
    '("gpointer" "user_data")
  )
)

(define-function g_ptr_array_new
  (c-name "g_ptr_array_new")
  (return-type "GPtrArray*")
)

(define-function g_ptr_array_sized_new
  (c-name "g_ptr_array_sized_new")
  (return-type "GPtrArray*")
  (parameters
    '("guint" "reserved_size")
  )
)

(define-method free
  (of-object "GPtrArray")
  (c-name "g_ptr_array_free")
  (return-type "gpointer*")
  (parameters
    '("gboolean" "free_seg")
  )
)

(define-method set_size
  (of-object "GPtrArray")
  (c-name "g_ptr_array_set_size")
  (return-type "none")
  (parameters
    '("gint" "length")
  )
)

(define-method remove_index
  (of-object "GPtrArray")
  (c-name "g_ptr_array_remove_index")
  (return-type "gpointer")
  (parameters
    '("guint" "index")
  )
)

(define-method remove_index_fast
  (of-object "GPtrArray")
  (c-name "g_ptr_array_remove_index_fast")
  (return-type "gpointer")
  (parameters
    '("guint" "index")
  )
)

(define-method remove
  (of-object "GPtrArray")
  (c-name "g_ptr_array_remove")
  (return-type "gboolean")
  (parameters
    '("gpointer" "data")
  )
)

(define-method remove_fast
  (of-object "GPtrArray")
  (c-name "g_ptr_array_remove_fast")
  (return-type "gboolean")
  (parameters
    '("gpointer" "data")
  )
)

(define-method add
  (of-object "GPtrArray")
  (c-name "g_ptr_array_add")
  (return-type "none")
  (parameters
    '("gpointer" "data")
  )
)

(define-method sort
  (of-object "GPtrArray")
  (c-name "g_ptr_array_sort")
  (return-type "none")
  (parameters
    '("GCompareFunc" "compare_func")
  )
)

(define-method sort_with_data
  (of-object "GPtrArray")
  (c-name "g_ptr_array_sort_with_data")
  (return-type "none")
  (parameters
    '("GCompareDataFunc" "compare_func")
    '("gpointer" "user_data")
  )
)

(define-function g_byte_array_new
  (c-name "g_byte_array_new")
  (return-type "GByteArray*")
)

(define-function g_byte_array_sized_new
  (c-name "g_byte_array_sized_new")
  (return-type "GByteArray*")
  (parameters
    '("guint" "reserved_size")
  )
)

(define-method free
  (of-object "GByteArray")
  (c-name "g_byte_array_free")
  (return-type "guint8*")
  (parameters
    '("gboolean" "free_segment")
  )
)

(define-method append
  (of-object "GByteArray")
  (c-name "g_byte_array_append")
  (return-type "GByteArray*")
  (parameters
    '("const-guint8*" "data")
    '("guint" "len")
  )
)

(define-method prepend
  (of-object "GByteArray")
  (c-name "g_byte_array_prepend")
  (return-type "GByteArray*")
  (parameters
    '("const-guint8*" "data")
    '("guint" "len")
  )
)

(define-method set_size
  (of-object "GByteArray")
  (c-name "g_byte_array_set_size")
  (return-type "GByteArray*")
  (parameters
    '("guint" "length")
  )
)

(define-method remove_index
  (of-object "GByteArray")
  (c-name "g_byte_array_remove_index")
  (return-type "GByteArray*")
  (parameters
    '("guint" "index")
  )
)

(define-method remove_index_fast
  (of-object "GByteArray")
  (c-name "g_byte_array_remove_index_fast")
  (return-type "GByteArray*")
  (parameters
    '("guint" "index")
  )
)

(define-method sort
  (of-object "GByteArray")
  (c-name "g_byte_array_sort")
  (return-type "none")
  (parameters
    '("GCompareFunc" "compare_func")
  )
)

(define-method sort_with_data
  (of-object "GByteArray")
  (c-name "g_byte_array_sort_with_data")
  (return-type "none")
  (parameters
    '("GCompareDataFunc" "compare_func")
    '("gpointer" "user_data")
  )
)



;; From glib/gasyncqueue.h

(define-method lock
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_lock")
  (return-type "none")
)

(define-method unlock
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_unlock")
  (return-type "none")
)

(define-method ref
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_ref")
  (return-type "none")
)

(define-method ref_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_ref_unlocked")
  (return-type "none")
)

(define-method unref
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_unref")
  (return-type "none")
)

(define-method unref_and_unlock
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_unref_and_unlock")
  (return-type "none")
)

(define-method push
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_push")
  (return-type "none")
  (parameters
    '("gpointer" "data")
  )
)

(define-method push_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_push_unlocked")
  (return-type "none")
  (parameters
    '("gpointer" "data")
  )
)

(define-method pop
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_pop")
  (return-type "gpointer")
)

(define-method pop_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_pop_unlocked")
  (return-type "gpointer")
)

(define-method try_pop
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_try_pop")
  (return-type "gpointer")
)

(define-method try_pop_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_try_pop_unlocked")
  (return-type "gpointer")
)

(define-method timed_pop
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_timed_pop")
  (return-type "gpointer")
  (parameters
    '("GTimeVal*" "end_time")
  )
)

(define-method timed_pop_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_timed_pop_unlocked")
  (return-type "gpointer")
  (parameters
    '("GTimeVal*" "end_time")
  )
)

(define-method length
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_length")
  (return-type "gint")
)

(define-method length_unlocked
  (of-object "GAsyncQueue")
  (c-name "g_async_queue_length_unlocked")
  (return-type "gint")
)



;; From glib/gbacktrace.h

(define-function g_on_error_stack_trace
  (c-name "g_on_error_stack_trace")
  (return-type "none")
  (parameters
    '("const-gchar*" "prg_name")
  )
)



;; From glib/gcache.h

(define-method destroy
  (of-object "GCache")
  (c-name "g_cache_destroy")
  (return-type "none")
)

(define-method insert
  (of-object "GCache")
  (c-name "g_cache_insert")
  (return-type "gpointer")
  (parameters
    '("gpointer" "key")
  )
)

(define-method remove
  (of-object "GCache")
  (c-name "g_cache_remove")
  (return-type "none")
  (parameters
    '("gconstpointer" "value")
  )
)

(define-method key_foreach
  (of-object "GCache")
  (c-name "g_cache_key_foreach")
  (return-type "none")
  (parameters
    '("GHFunc" "func")
    '("gpointer" "user_data")
  )
)

(define-method value_foreach
  (of-object "GCache")
  (c-name "g_cache_value_foreach")
  (return-type "none")
  (parameters
    '("GHFunc" "func")
    '("gpointer" "user_data")
  )
)



;; From glib/gcompletion.h

(define-function g_completion_new
  (c-name "g_completion_new")
  (return-type "GCompletion*")
  (parameters
    '("GCompletionFunc" "func")
  )
)

(define-method add_items
  (of-object "GCompletion")
  (c-name "g_completion_add_items")
  (return-type "none")
  (parameters
    '("GList*" "items")
  )
)

(define-method remove_items
  (of-object "GCompletion")
  (c-name "g_completion_remove_items")
  (return-type "none")
  (parameters
    '("GList*" "items")
  )
)

(define-method clear_items
  (of-object "GCompletion")
  (c-name "g_completion_clear_items")
  (return-type "none")
)

(define-method complete
  (of-object "GCompletion")
  (c-name "g_completion_complete")
  (return-type "GList*")
  (parameters
    '("gchar*" "prefix")
    '("gchar**" "new_prefix")
  )
)

(define-method set_compare
  (of-object "GCompletion")
  (c-name "g_completion_set_compare")
  (return-type "none")
  (parameters
    '("GCompletionStrncmpFunc" "strncmp_func")
  )
)

(define-method free
  (of-object "GCompletion")
  (c-name "g_completion_free")
  (return-type "none")
)



;; From glib/gconvert.h

(define-function g_iconv_open
  (c-name "g_iconv_open")
  (return-type "GIConv")
  (parameters
    '("const-gchar*" "to_codeset")
    '("const-gchar*" "from_codeset")
  )
)

(define-method iconv
  (of-object "GIConv")
  (c-name "g_iconv")
  (return-type "size_t")
  (parameters
    '("gchar**" "inbuf")
    '("gsize*" "inbytes_left")
    '("gchar**" "outbuf")
    '("gsize*" "outbytes_left")
  )
)

(define-method close
  (of-object "GIConv")
  (c-name "g_iconv_close")
  (return-type "gint")
)

(define-function g_convert
  (c-name "g_convert")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
    '("const-gchar*" "to_codeset")
    '("const-gchar*" "from_codeset")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_convert_with_iconv
  (c-name "g_convert_with_iconv")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
    '("GIConv" "converter")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_convert_with_fallback
  (c-name "g_convert_with_fallback")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
    '("const-gchar*" "to_codeset")
    '("const-gchar*" "from_codeset")
    '("gchar*" "fallback")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_locale_to_utf8
  (c-name "g_locale_to_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "opsysstring")
    '("gssize" "len")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_locale_from_utf8
  (c-name "g_locale_from_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "utf8string")
    '("gssize" "len")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_filename_to_utf8
  (c-name "g_filename_to_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "opsysstring")
    '("gssize" "len")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_filename_from_utf8
  (c-name "g_filename_from_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "utf8string")
    '("gssize" "len")
    '("gsize*" "bytes_read")
    '("gsize*" "bytes_written")
    '("GError**" "error")
  )
)

(define-function g_filename_from_uri
  (c-name "g_filename_from_uri")
  (return-type "gchar*")
  (parameters
    '("const-char*" "uri")
    '("char**" "hostname")
    '("GError**" "error")
  )
)

(define-function g_filename_to_uri
  (c-name "g_filename_to_uri")
  (return-type "gchar*")
  (parameters
    '("const-char*" "filename")
    '("const-char*" "hostname")
    '("GError**" "error")
  )
)



;; From glib/gdataset.h

(define-function g_datalist_clear
  (c-name "g_datalist_clear")
  (return-type "none")
  (parameters
    '("GData**" "datalist")
  )
)

(define-function g_datalist_id_get_data
  (c-name "g_datalist_id_get_data")
  (return-type "gpointer")
  (parameters
    '("GData**" "datalist")
    '("GQuark" "key_id")
  )
)

(define-function g_datalist_id_set_data_full
  (c-name "g_datalist_id_set_data_full")
  (return-type "none")
  (parameters
    '("GData**" "datalist")
    '("GQuark" "key_id")
    '("gpointer" "data")
    '("GDestroyNotify" "destroy_func")
  )
)

(define-function g_datalist_id_remove_no_notify
  (c-name "g_datalist_id_remove_no_notify")
  (return-type "gpointer")
  (parameters
    '("GData**" "datalist")
    '("GQuark" "key_id")
  )
)

(define-function g_datalist_foreach
  (c-name "g_datalist_foreach")
  (return-type "none")
  (parameters
    '("GData**" "datalist")
    '("GDataForeachFunc" "func")
    '("gpointer" "user_data")
  )
)

(define-function g_dataset_id_get_data
  (c-name "g_dataset_id_get_data")
  (return-type "gpointer")
  (parameters
    '("gconstpointer" "dataset_location")
    '("GQuark" "key_id")
  )
)

(define-function g_dataset_id_set_data_full
  (c-name "g_dataset_id_set_data_full")
  (return-type "none")
  (parameters
    '("gconstpointer" "dataset_location")
    '("GQuark" "key_id")
    '("gpointer" "data")
    '("GDestroyNotify" "destroy_func")
  )
)

(define-function g_dataset_id_remove_no_notify
  (c-name "g_dataset_id_remove_no_notify")
  (return-type "gpointer")
  (parameters
    '("gconstpointer" "dataset_location")
    '("GQuark" "key_id")
  )
)

(define-function g_dataset_foreach
  (c-name "g_dataset_foreach")
  (return-type "none")
  (parameters
    '("gconstpointer" "dataset_location")
    '("GDataForeachFunc" "func")
    '("gpointer" "user_data")
  )
)



;; From glib/gdate.h

(define-function g_date_new
  (c-name "g_date_new")
  (return-type "GDate*")
)

(define-function g_date_new_dmy
  (c-name "g_date_new_dmy")
  (return-type "GDate*")
  (parameters
    '("GDateDay" "day")
    '("GDateMonth" "month")
    '("GDateYear" "year")
  )
)

(define-function g_date_new_julian
  (c-name "g_date_new_julian")
  (return-type "GDate*")
  (parameters
    '("guint32" "julian_day")
  )
)

(define-method free
  (of-object "GDate")
  (c-name "g_date_free")
  (return-type "none")
)

(define-method valid
  (of-object "GDate")
  (c-name "g_date_valid")
  (return-type "gboolean")
)

(define-function g_date_valid_day
  (c-name "g_date_valid_day")
  (return-type "gboolean")
  (parameters
    '("GDateDay" "day")
  )
)

(define-function g_date_valid_month
  (c-name "g_date_valid_month")
  (return-type "gboolean")
  (parameters
    '("GDateMonth" "month")
  )
)

(define-function g_date_valid_year
  (c-name "g_date_valid_year")
  (return-type "gboolean")
  (parameters
    '("GDateYear" "year")
  )
)

(define-function g_date_valid_weekday
  (c-name "g_date_valid_weekday")
  (return-type "gboolean")
  (parameters
    '("GDateWeekday" "weekday")
  )
)

(define-function g_date_valid_julian
  (c-name "g_date_valid_julian")
  (return-type "gboolean")
  (parameters
    '("guint32" "julian_date")
  )
)

(define-function g_date_valid_dmy
  (c-name "g_date_valid_dmy")
  (return-type "gboolean")
  (parameters
    '("GDateDay" "day")
    '("GDateMonth" "month")
    '("GDateYear" "year")
  )
)

(define-method get_weekday
  (of-object "GDate")
  (c-name "g_date_get_weekday")
  (return-type "GDateWeekday")
)

(define-method get_month
  (of-object "GDate")
  (c-name "g_date_get_month")
  (return-type "GDateMonth")
)

(define-method get_year
  (of-object "GDate")
  (c-name "g_date_get_year")
  (return-type "GDateYear")
)

(define-method get_day
  (of-object "GDate")
  (c-name "g_date_get_day")
  (return-type "GDateDay")
)

(define-method get_julian
  (of-object "GDate")
  (c-name "g_date_get_julian")
  (return-type "guint32")
)

(define-method get_day_of_year
  (of-object "GDate")
  (c-name "g_date_get_day_of_year")
  (return-type "guint")
)

(define-method get_monday_week_of_year
  (of-object "GDate")
  (c-name "g_date_get_monday_week_of_year")
  (return-type "guint")
)

(define-method get_sunday_week_of_year
  (of-object "GDate")
  (c-name "g_date_get_sunday_week_of_year")
  (return-type "guint")
)

(define-method clear
  (of-object "GDate")
  (c-name "g_date_clear")
  (return-type "none")
  (parameters
    '("guint" "n_dates")
  )
)

(define-method set_parse
  (of-object "GDate")
  (c-name "g_date_set_parse")
  (return-type "none")
  (parameters
    '("const-gchar*" "str")
  )
)

(define-method set_time
  (of-object "GDate")
  (c-name "g_date_set_time")
  (return-type "none")
  (parameters
    '("GTime" "time")
  )
)

(define-method set_month
  (of-object "GDate")
  (c-name "g_date_set_month")
  (return-type "none")
  (parameters
    '("GDateMonth" "month")
  )
)

(define-method set_day
  (of-object "GDate")
  (c-name "g_date_set_day")
  (return-type "none")
  (parameters
    '("GDateDay" "day")
  )
)

(define-method set_year
  (of-object "GDate")
  (c-name "g_date_set_year")
  (return-type "none")
  (parameters
    '("GDateYear" "year")
  )
)

(define-method set_dmy
  (of-object "GDate")
  (c-name "g_date_set_dmy")
  (return-type "none")
  (parameters
    '("GDateDay" "day")
    '("GDateMonth" "month")
    '("GDateYear" "y")
  )
)

(define-method set_julian
  (of-object "GDate")
  (c-name "g_date_set_julian")
  (return-type "none")
  (parameters
    '("guint32" "julian_date")
  )
)

(define-method is_first_of_month
  (of-object "GDate")
  (c-name "g_date_is_first_of_month")
  (return-type "gboolean")
)

(define-method is_last_of_month
  (of-object "GDate")
  (c-name "g_date_is_last_of_month")
  (return-type "gboolean")
)

(define-method add_days
  (of-object "GDate")
  (c-name "g_date_add_days")
  (return-type "none")
  (parameters
    '("guint" "n_days")
  )
)

(define-method subtract_days
  (of-object "GDate")
  (c-name "g_date_subtract_days")
  (return-type "none")
  (parameters
    '("guint" "n_days")
  )
)

(define-method add_months
  (of-object "GDate")
  (c-name "g_date_add_months")
  (return-type "none")
  (parameters
    '("guint" "n_months")
  )
)

(define-method subtract_months
  (of-object "GDate")
  (c-name "g_date_subtract_months")
  (return-type "none")
  (parameters
    '("guint" "n_months")
  )
)

(define-method add_years
  (of-object "GDate")
  (c-name "g_date_add_years")
  (return-type "none")
  (parameters
    '("guint" "n_years")
  )
)

(define-method subtract_years
  (of-object "GDate")
  (c-name "g_date_subtract_years")
  (return-type "none")
  (parameters
    '("guint" "n_years")
  )
)

(define-function g_date_is_leap_year
  (c-name "g_date_is_leap_year")
  (return-type "gboolean")
  (parameters
    '("GDateYear" "year")
  )
)

(define-function g_date_get_days_in_month
  (c-name "g_date_get_days_in_month")
  (return-type "guint8")
  (parameters
    '("GDateMonth" "month")
    '("GDateYear" "year")
  )
)

(define-function g_date_get_monday_weeks_in_year
  (c-name "g_date_get_monday_weeks_in_year")
  (return-type "guint8")
  (parameters
    '("GDateYear" "year")
  )
)

(define-function g_date_get_sunday_weeks_in_year
  (c-name "g_date_get_sunday_weeks_in_year")
  (return-type "guint8")
  (parameters
    '("GDateYear" "year")
  )
)

(define-method days_between
  (of-object "GDate")
  (c-name "g_date_days_between")
  (return-type "gint")
  (parameters
    '("const-GDate*" "date2")
  )
)

(define-method compare
  (of-object "GDate")
  (c-name "g_date_compare")
  (return-type "gint")
  (parameters
    '("const-GDate*" "rhs")
  )
)

(define-method to_struct_tm
  (of-object "GDate")
  (c-name "g_date_to_struct_tm")
  (return-type "none")
  (parameters
    '("struct-tm*" "tm")
  )
)

(define-method clamp
  (of-object "GDate")
  (c-name "g_date_clamp")
  (return-type "none")
  (parameters
    '("const-GDate*" "min_date")
    '("const-GDate*" "max_date")
  )
)

(define-method order
  (of-object "GDate")
  (c-name "g_date_order")
  (return-type "none")
  (parameters
    '("GDate*" "date2")
  )
)

(define-function g_date_strftime
  (c-name "g_date_strftime")
  (return-type "gsize")
  (parameters
    '("gchar*" "s")
    '("gsize" "slen")
    '("const-gchar*" "format")
    '("const-GDate*" "date")
  )
)



;; From glib/gdir.h

(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")
)



;; From glib/gerror.h

(define-function g_error_new
  (c-name "g_error_new")
  (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-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_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")
  )
)



;; From glib/gfileutils.h

(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_mkstemp
  (c-name "g_mkstemp")
  (return-type "int")
  (parameters
    '("char*" "tmpl")
  )
)

(define-function g_file_open_tmp
  (c-name "g_file_open_tmp")
  (return-type "int")
  (parameters
    '("const-char*" "tmpl")
    '("char**" "name_used")
    '("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_filename
  (c-name "g_build_filename")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "first_element")
  )
  (varargs #t)
)



;; From glib/ghash.h

(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 "none")
  (parameters
    '("gpointer" "key")
    '("gpointer" "value")
  )
)

(define-method replace
  (of-object "GHashTable")
  (c-name "g_hash_table_replace")
  (return-type "none")
  (parameters
    '("gpointer" "key")
    '("gpointer" "value")
  )
)

(define-method remove
  (of-object "GHashTable")
  (c-name "g_hash_table_remove")
  (return-type "gboolean")
  (parameters
    '("gconstpointer" "key")
  )
)

(define-method steal
  (of-object "GHashTable")
  (c-name "g_hash_table_steal")
  (return-type "gboolean")
  (parameters
    '("gconstpointer" "key")
  )
)

(define-method lookup
  (of-object "GHashTable")
  (c-name "g_hash_table_lookup")
  (return-type "gpointer")
  (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 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-function g_str_equal
  (c-name "g_str_equal")
  (return-type "gboolean")
  (parameters
    '("gconstpointer" "v")
    '("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" "v")
    '("gconstpointer" "v2")
  )
)

(define-function g_int_hash
  (c-name "g_int_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" "v")
    '("gconstpointer" "v2")
  )
)



;; From glib/ghook.h

(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 "none")
  (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_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 glib/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 "none")
)

(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")
  (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_main_poll_win32_msg_add
  (c-name "g_main_poll_win32_msg_add")
  (return-type "none")
  (parameters
    '("gint" "priority")
    '("GPollFD*" "fd")
    '("guint" "hwnd")
  )
)

(define-function g_io_channel_win32_new_messages
  (c-name "g_io_channel_win32_new_messages")
  (return-type "GIOChannel*")
  (parameters
    '("guint" "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")
  )
)



;; From glib/glist.h

(define-function g_list_push_allocator
  (c-name "g_list_push_allocator")
  (return-type "none")
  (parameters
    '("GAllocator*" "allocator")
  )
)

(define-function g_list_pop_allocator
  (c-name "g_list_pop_allocator")
  (return-type "none")
)

(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 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_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 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 glib/gmacros.h



;; From glib/gmain.h

(define-function g_main_context_new
  (c-name "g_main_context_new")
  (return-type "GMainContext*")
)

(define-method ref
  (of-object "GMainContext")
  (c-name "g_main_context_ref")
  (return-type "none")
)

(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 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_loop_new
  (c-name "g_main_loop_new")
  (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")
  (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_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 get_current_time
  (of-object "GSource")
  (c-name "g_source_get_current_time")
  (return-type "none")
  (parameters
    '("GTimeVal*" "timeval")
  )
)

(define-function g_idle_source_new
  (c-name "g_idle_source_new")
  (return-type "GSource*")
)

(define-function g_timeout_source_new
  (c-name "g_timeout_source_new")
  (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_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_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-function g_main_poll_win32_msg_add
  (c-name "g_main_poll_win32_msg_add")
  (return-type "none")
  (parameters
    '("gint" "priority")
    '("GPollFD*" "fd")
    '("guint" "hwnd")
  )
)



;; From glib/gmarkup.h

(define-function g_markup_parse_context_new
  (c-name "g_markup_parse_context_new")
  (return-type "GMarkupParseContext*")
  (parameters
    '("const-GMarkupParser*" "parser")
    '("GMarkupParseFlags" "flags")
    '("gpointer" "user_data")
    '("GDestroyNotify" "user_data_dnotify")
  )
)

(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 end_parse
  (of-object "GMarkupParseContext")
  (c-name "g_markup_parse_context_end_parse")
  (return-type "gboolean")
  (parameters
    '("GError**" "error")
  )
)

(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-function g_markup_escape_text
  (c-name "g_markup_escape_text")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "text")
    '("gssize" "length")
  )
)



;; From glib/gmem.h

(define-function g_malloc0
  (c-name "g_malloc0")
  (return-type "gpointer")
  (parameters
    '("gulong" "n_bytes")
  )
)

(define-function g_realloc
  (c-name "g_realloc")
  (return-type "gpointer")
  (parameters
    '("gpointer" "mem")
    '("gulong" "n_bytes")
  )
)

(define-function g_free
  (c-name "g_free")
  (return-type "none")
  (parameters
    '("gpointer" "mem")
  )
)

(define-function g_try_malloc
  (c-name "g_try_malloc")
  (return-type "gpointer")
  (parameters
    '("gulong" "n_bytes")
  )
)

(define-function g_try_realloc
  (c-name "g_try_realloc")
  (return-type "gpointer")
  (parameters
    '("gpointer" "mem")
    '("gulong" "n_bytes")
  )
)

(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")
)

(define-method destroy
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_destroy")
  (return-type "none")
)

(define-method alloc
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_alloc")
  (return-type "gpointer")
)

(define-method alloc0
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_alloc0")
  (return-type "gpointer")
)

(define-method free
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_free")
  (return-type "none")
  (parameters
    '("gpointer" "mem")
  )
)

(define-method clean
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_clean")
  (return-type "none")
)

(define-method reset
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_reset")
  (return-type "none")
)

(define-method print
  (of-object "GMemChunk")
  (c-name "g_mem_chunk_print")
  (return-type "none")
)

(define-function g_mem_chunk_info
  (c-name "g_mem_chunk_info")
  (return-type "none")
)

(define-function g_blow_chunks
  (c-name "g_blow_chunks")
  (return-type "none")
)

(define-function g_allocator_new
  (c-name "g_allocator_new")
  (return-type "GAllocator*")
  (parameters
    '("const-gchar*" "name")
    '("guint" "n_preallocs")
  )
)

(define-method free
  (of-object "GAllocator")
  (c-name "g_allocator_free")
  (return-type "none")
)



;; From glib/gmessages.h

(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_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
  (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_log_fallback_handler
  (c-name "_g_log_fallback_handler")
  (return-type "none")
  (parameters
    '("const-gchar*" "log_domain")
    '("GLogLevelFlags" "log_level")
    '("const-gchar*" "message")
    '("gpointer" "unused_data")
  )
)

(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 glib/gnode.h

(define-function g_node_pop_allocator
  (c-name "g_node_pop_allocator")
  (return-type "none")
)

(define-function g_node_new
  (c-name "g_node_new")
  (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
  (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 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 glib/gpattern.h

(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 glib/gprimes.h



;; From glib/gqsort.h



;; From glib/gquark.h

(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*")
)



;; From glib/gqueue.h

(define-function g_queue_new
  (c-name "g_queue_new")
  (return-type "GQueue*")
)

(define-method free
  (of-object "GQueue")
  (c-name "g_queue_free")
  (return-type "none")
)

(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 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 is_empty
  (of-object "GQueue")
  (c-name "g_queue_is_empty")
  (return-type "gboolean")
)

(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 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 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*")
)



;; From glib/grand.h

(define-function g_rand_new
  (c-name "g_rand_new")
  (return-type "GRand*")
)

(define-method free
  (of-object "GRand")
  (c-name "g_rand_free")
  (return-type "none")
)

(define-method set_seed
  (of-object "GRand")
  (c-name "g_rand_set_seed")
  (return-type "none")
  (parameters
    '("guint32" "seed")
  )
)

(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 glib/grel.h

(define-function g_relation_new
  (c-name "g_relation_new")
  (return-type "GRelation*")
  (parameters
    '("gint" "fields")
  )
)

(define-method destroy
  (of-object "GRelation")
  (c-name "g_relation_destroy")
  (return-type "none")
)

(define-method index
  (of-object "GRelation")
  (c-name "g_relation_index")
  (return-type "none")
  (parameters
    '("gint" "field")
    '("GHashFunc" "hash_func")
    '("GEqualFunc" "key_equal_func")
  )
)

(define-method insert
  (of-object "GRelation")
  (c-name "g_relation_insert")
  (return-type "none")
  (parameters
  )
  (varargs #t)
)

(define-method delete
  (of-object "GRelation")
  (c-name "g_relation_delete")
  (return-type "gint")
  (parameters
    '("gconstpointer" "key")
    '("gint" "field")
  )
)

(define-method select
  (of-object "GRelation")
  (c-name "g_relation_select")
  (return-type "GTuples*")
  (parameters
    '("gconstpointer" "key")
    '("gint" "field")
  )
)

(define-method count
  (of-object "GRelation")
  (c-name "g_relation_count")
  (return-type "gint")
  (parameters
    '("gconstpointer" "key")
    '("gint" "field")
  )
)

(define-method exists
  (of-object "GRelation")
  (c-name "g_relation_exists")
  (return-type "gboolean")
  (parameters
  )
  (varargs #t)
)

(define-method print
  (of-object "GRelation")
  (c-name "g_relation_print")
  (return-type "none")
)

(define-method destroy
  (of-object "GTuples")
  (c-name "g_tuples_destroy")
  (return-type "none")
)

(define-method index
  (of-object "GTuples")
  (c-name "g_tuples_index")
  (return-type "gpointer")
  (parameters
    '("gint" "index")
    '("gint" "field")
  )
)



;; From glib/gscanner.h

(define-function g_scanner_new
  (c-name "g_scanner_new")
  (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 glib/gshell.h

(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 glib/gslist.h

(define-function g_slist_push_allocator
  (c-name "g_slist_push_allocator")
  (return-type "none")
  (parameters
    '("GAllocator*" "allocator")
  )
)

(define-function g_slist_pop_allocator
  (c-name "g_slist_pop_allocator")
  (return-type "none")
)

(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 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_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 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 glib/gspawn.h

(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")
    '("gint*" "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")
    '("gint*" "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")
  )
)



;; From glib/gstrfuncs.h

(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_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_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_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_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_stpcpy
  (c-name "g_stpcpy")
  (return-type "gchar*")
  (parameters
    '("gchar*" "dest")
    '("const-char*" "src")
  )
)



;; From glib/gstring.h

(define-function g_string_chunk_new
  (c-name "g_string_chunk_new")
  (return-type "GStringChunk*")
  (parameters
    '("gsize" "size")
  )
)

(define-method free
  (of-object "GStringChunk")
  (c-name "g_string_chunk_free")
  (return-type "none")
)

(define-method insert
  (of-object "GStringChunk")
  (c-name "g_string_chunk_insert")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "string")
  )
)

(define-function g_string_new
  (c-name "g_string_new")
  (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")
  (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 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 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 printf
  (of-object "GString")
  (c-name "g_string_printf")
  (return-type "none")
  (parameters
    '("const-gchar*" "format")
  )
  (varargs #t)
)

(define-method append_printf
  (of-object "GString")
  (c-name "g_string_append_printf")
  (return-type "none")
  (parameters
    '("const-gchar*" "format")
  )
  (varargs #t)
)

(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 glib/gthread.h

(define-function g_thread_init
  (c-name "g_thread_init")
  (return-type "none")
  (parameters
    '("GThreadFunctions*" "vtable")
  )
)

(define-function g_thread_init_with_errorcheck_mutexes
  (c-name "g_thread_init_with_errorcheck_mutexes")
  (return-type "none")
  (parameters
    '("GThreadFunctions*" "vtable")
  )
)

(define-function g_static_mutex_get_mutex_impl
  (c-name "g_static_mutex_get_mutex_impl")
  (return-type "GMutex*")
  (parameters
    '("GMutex**" "mutex")
  )
)

(define-function g_thread_self
  (c-name "g_thread_self")
  (return-type "GThread*")
)

(define-function g_thread_exit
  (c-name "g_thread_exit")
  (return-type "none")
  (parameters
    '("gpointer" "retval")
  )
)

(define-method join
  (of-object "GThread")
  (c-name "g_thread_join")
  (return-type "gpointer")
)

(define-method set_priority
  (of-object "GThread")
  (c-name "g_thread_set_priority")
  (return-type "none")
  (parameters
    '("GThreadPriority" "priority")
  )
)

(define-method free
  (of-object "GStaticMutex")
  (c-name "g_static_mutex_free")
  (return-type "none")
)

(define-method init
  (of-object "GStaticPrivate")
  (c-name "g_static_private_init")
  (return-type "none")
)

(define-method get
  (of-object "GStaticPrivate")
  (c-name "g_static_private_get")
  (return-type "gpointer")
)

(define-method set
  (of-object "GStaticPrivate")
  (c-name "g_static_private_set")
  (return-type "none")
  (parameters
    '("gpointer" "data")
    '("GDestroyNotify" "notify")
  )
)

(define-method free
  (of-object "GStaticPrivate")
  (c-name "g_static_private_free")
  (return-type "none")
)

(define-method init
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_init")
  (return-type "none")
)

(define-method lock
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_lock")
  (return-type "none")
)

(define-method trylock
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_trylock")
  (return-type "gboolean")
)

(define-method unlock
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_unlock")
  (return-type "none")
)

(define-method lock_full
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_lock_full")
  (return-type "none")
  (parameters
    '("guint" "depth")
  )
)

(define-method unlock_full
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_unlock_full")
  (return-type "guint")
)

(define-method free
  (of-object "GStaticRecMutex")
  (c-name "g_static_rec_mutex_free")
  (return-type "none")
)

(define-method init
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_init")
  (return-type "none")
)

(define-method reader_lock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_reader_lock")
  (return-type "none")
)

(define-method reader_trylock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_reader_trylock")
  (return-type "gboolean")
)

(define-method reader_unlock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_reader_unlock")
  (return-type "none")
)

(define-method writer_lock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_writer_lock")
  (return-type "none")
)

(define-method writer_trylock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_writer_trylock")
  (return-type "gboolean")
)

(define-method writer_unlock
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_writer_unlock")
  (return-type "none")
)

(define-method free
  (of-object "GStaticRWLock")
  (c-name "g_static_rw_lock_free")
  (return-type "none")
)

(define-function G_LOCK_NAME
  (c-name "G_LOCK_NAME")
  (return-type "GStaticMutex")
  (parameters
  )
)



;; From glib/gthreadpool.h

(define-function g_thread_pool_new
  (c-name "g_thread_pool_new")
  (return-type "GThreadPool*")
  (parameters
    '("GFunc" "func")
    '("gpointer" "user_data")
    '("gint" "max_threads")
    '("gboolean" "exclusive")
    '("GError**" "error")
  )
)

(define-method push
  (of-object "GThreadPool")
  (c-name "g_thread_pool_push")
  (return-type "none")
  (parameters
    '("gpointer" "data")
    '("GError**" "error")
  )
)

(define-method set_max_threads
  (of-object "GThreadPool")
  (c-name "g_thread_pool_set_max_threads")
  (return-type "none")
  (parameters
    '("gint" "max_threads")
    '("GError**" "error")
  )
)

(define-method get_max_threads
  (of-object "GThreadPool")
  (c-name "g_thread_pool_get_max_threads")
  (return-type "gint")
)

(define-method get_num_threads
  (of-object "GThreadPool")
  (c-name "g_thread_pool_get_num_threads")
  (return-type "guint")
)

(define-method unprocessed
  (of-object "GThreadPool")
  (c-name "g_thread_pool_unprocessed")
  (return-type "guint")
)

(define-method free
  (of-object "GThreadPool")
  (c-name "g_thread_pool_free")
  (return-type "none")
  (parameters
    '("gboolean" "immediate")
    '("gboolean" "wait")
  )
)

(define-function g_thread_pool_set_max_unused_threads
  (c-name "g_thread_pool_set_max_unused_threads")
  (return-type "none")
  (parameters
    '("gint" "max_threads")
  )
)

(define-function g_thread_pool_get_max_unused_threads
  (c-name "g_thread_pool_get_max_unused_threads")
  (return-type "gint")
)

(define-function g_thread_pool_get_num_unused_threads
  (c-name "g_thread_pool_get_num_unused_threads")
  (return-type "guint")
)

(define-function g_thread_pool_stop_unused_threads
  (c-name "g_thread_pool_stop_unused_threads")
  (return-type "none")
)



;; From glib/gtimer.h

(define-method destroy
  (of-object "GTimer")
  (c-name "g_timer_destroy")
  (return-type "none")
)

(define-method start
  (of-object "GTimer")
  (c-name "g_timer_start")
  (return-type "none")
)

(define-method stop
  (of-object "GTimer")
  (c-name "g_timer_stop")
  (return-type "none")
)

(define-method reset
  (of-object "GTimer")
  (c-name "g_timer_reset")
  (return-type "none")
)

(define-method elapsed
  (of-object "GTimer")
  (c-name "g_timer_elapsed")
  (return-type "gdouble")
  (parameters
    '("gulong*" "microseconds")
  )
)

(define-function g_usleep
  (c-name "g_usleep")
  (return-type "none")
  (parameters
    '("gulong" "microseconds")
  )
)

(define-method add
  (of-object "GTimeVal")
  (c-name "g_time_val_add")
  (return-type "none")
  (parameters
    '("glong" "microseconds")
  )
)



;; From glib/gtree.h

(define-function g_tree_new_with_data
  (c-name "g_tree_new_with_data")
  (return-type "GTree*")
  (parameters
    '("GCompareDataFunc" "key_compare_func")
    '("gpointer" "key_compare_data")
  )
)

(define-function g_tree_new_full
  (c-name "g_tree_new_full")
  (return-type "GTree*")
  (parameters
    '("GCompareDataFunc" "key_compare_func")
    '("gpointer" "key_compare_data")
    '("GDestroyNotify" "key_destroy_func")
    '("GDestroyNotify" "value_destroy_func")
  )
)

(define-method destroy
  (of-object "GTree")
  (c-name "g_tree_destroy")
  (return-type "none")
)

(define-method insert
  (of-object "GTree")
  (c-name "g_tree_insert")
  (return-type "none")
  (parameters
    '("gpointer" "key")
    '("gpointer" "value")
  )
)

(define-method replace
  (of-object "GTree")
  (c-name "g_tree_replace")
  (return-type "none")
  (parameters
    '("gpointer" "key")
    '("gpointer" "value")
  )
)

(define-method remove
  (of-object "GTree")
  (c-name "g_tree_remove")
  (return-type "none")
  (parameters
    '("gconstpointer" "key")
  )
)

(define-method steal
  (of-object "GTree")
  (c-name "g_tree_steal")
  (return-type "none")
  (parameters
    '("gconstpointer" "key")
  )
)

(define-method lookup
  (of-object "GTree")
  (c-name "g_tree_lookup")
  (return-type "gpointer")
  (parameters
    '("gconstpointer" "key")
  )
)

(define-method lookup_extended
  (of-object "GTree")
  (c-name "g_tree_lookup_extended")
  (return-type "gboolean")
  (parameters
    '("gconstpointer" "lookup_key")
    '("gpointer*" "orig_key")
    '("gpointer*" "value")
  )
)

(define-method foreach
  (of-object "GTree")
  (c-name "g_tree_foreach")
  (return-type "none")
  (parameters
    '("GTraverseFunc" "func")
    '("gpointer" "user_data")
  )
)

(define-method traverse
  (of-object "GTree")
  (c-name "g_tree_traverse")
  (return-type "none")
  (parameters
    '("GTraverseFunc" "traverse_func")
    '("GTraverseType" "traverse_type")
    '("gpointer" "user_data")
  )
)

(define-method search
  (of-object "GTree")
  (c-name "g_tree_search")
  (return-type "gpointer")
  (parameters
    '("GCompareFunc" "search_func")
    '("gconstpointer" "user_data")
  )
)

(define-method height
  (of-object "GTree")
  (c-name "g_tree_height")
  (return-type "gint")
)

(define-method nnodes
  (of-object "GTree")
  (c-name "g_tree_nnodes")
  (return-type "gint")
)



;; From glib/gtypes.h



;; From glib/gunicode.h

(define-method isalnum
  (of-object "gunichar")
  (c-name "g_unichar_isalnum")
  (return-type "gboolean")
)

(define-method isalpha
  (of-object "gunichar")
  (c-name "g_unichar_isalpha")
  (return-type "gboolean")
)

(define-method iscntrl
  (of-object "gunichar")
  (c-name "g_unichar_iscntrl")
  (return-type "gboolean")
)

(define-method isdigit
  (of-object "gunichar")
  (c-name "g_unichar_isdigit")
  (return-type "gboolean")
)

(define-method isgraph
  (of-object "gunichar")
  (c-name "g_unichar_isgraph")
  (return-type "gboolean")
)

(define-method islower
  (of-object "gunichar")
  (c-name "g_unichar_islower")
  (return-type "gboolean")
)

(define-method isprint
  (of-object "gunichar")
  (c-name "g_unichar_isprint")
  (return-type "gboolean")
)

(define-method ispunct
  (of-object "gunichar")
  (c-name "g_unichar_ispunct")
  (return-type "gboolean")
)

(define-method isspace
  (of-object "gunichar")
  (c-name "g_unichar_isspace")
  (return-type "gboolean")
)

(define-method isupper
  (of-object "gunichar")
  (c-name "g_unichar_isupper")
  (return-type "gboolean")
)

(define-method isxdigit
  (of-object "gunichar")
  (c-name "g_unichar_isxdigit")
  (return-type "gboolean")
)

(define-method istitle
  (of-object "gunichar")
  (c-name "g_unichar_istitle")
  (return-type "gboolean")
)

(define-method isdefined
  (of-object "gunichar")
  (c-name "g_unichar_isdefined")
  (return-type "gboolean")
)

(define-method iswide
  (of-object "gunichar")
  (c-name "g_unichar_iswide")
  (return-type "gboolean")
)

(define-method toupper
  (of-object "gunichar")
  (c-name "g_unichar_toupper")
  (return-type "gunichar")
)

(define-method tolower
  (of-object "gunichar")
  (c-name "g_unichar_tolower")
  (return-type "gunichar")
)

(define-method totitle
  (of-object "gunichar")
  (c-name "g_unichar_totitle")
  (return-type "gunichar")
)

(define-method digit_value
  (of-object "gunichar")
  (c-name "g_unichar_digit_value")
  (return-type "gint")
)

(define-method xdigit_value
  (of-object "gunichar")
  (c-name "g_unichar_xdigit_value")
  (return-type "gint")
)

(define-method type
  (of-object "gunichar")
  (c-name "g_unichar_type")
  (return-type "GUnicodeType")
)

(define-method break_type
  (of-object "gunichar")
  (c-name "g_unichar_break_type")
  (return-type "GUnicodeBreakType")
)

(define-function g_unicode_canonical_ordering
  (c-name "g_unicode_canonical_ordering")
  (return-type "none")
  (parameters
    '("gunichar*" "string")
    '("gsize" "len")
  )
)

(define-function g_unicode_canonical_decomposition
  (c-name "g_unicode_canonical_decomposition")
  (return-type "gunichar*")
  (parameters
    '("gunichar" "ch")
    '("gsize*" "result_len")
  )
)

(define-function g_utf8_get_char
  (c-name "g_utf8_get_char")
  (return-type "gunichar")
  (parameters
    '("const-gchar*" "p")
  )
)

(define-function g_utf8_get_char_validated
  (c-name "g_utf8_get_char_validated")
  (return-type "gunichar")
  (parameters
    '("const-gchar*" "p")
    '("gssize" "max_len")
  )
)

(define-function g_utf8_offset_to_pointer
  (c-name "g_utf8_offset_to_pointer")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("glong" "offset")
  )
)

(define-function g_utf8_pointer_to_offset
  (c-name "g_utf8_pointer_to_offset")
  (return-type "glong")
  (parameters
    '("const-gchar*" "str")
    '("const-gchar*" "pos")
  )
)

(define-function g_utf8_prev_char
  (c-name "g_utf8_prev_char")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "p")
  )
)

(define-function g_utf8_find_next_char
  (c-name "g_utf8_find_next_char")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "p")
    '("const-gchar*" "end")
  )
)

(define-function g_utf8_find_prev_char
  (c-name "g_utf8_find_prev_char")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("const-gchar*" "p")
  )
)

(define-function g_utf8_strlen
  (c-name "g_utf8_strlen")
  (return-type "glong")
  (parameters
    '("const-gchar*" "p")
    '("gssize" "max")
  )
)

(define-function g_utf8_strncpy
  (c-name "g_utf8_strncpy")
  (return-type "gchar*")
  (parameters
    '("gchar*" "dest")
    '("const-gchar*" "src")
    '("gsize" "n")
  )
)

(define-function g_utf8_strchr
  (c-name "g_utf8_strchr")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "p")
    '("gssize" "len")
    '("gunichar" "c")
  )
)

(define-function g_utf8_strrchr
  (c-name "g_utf8_strrchr")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "p")
    '("gssize" "len")
    '("gunichar" "c")
  )
)

(define-function g_utf8_to_utf16
  (c-name "g_utf8_to_utf16")
  (return-type "gunichar2*")
  (parameters
    '("const-gchar*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-function g_utf8_to_ucs4
  (c-name "g_utf8_to_ucs4")
  (return-type "gunichar*")
  (parameters
    '("const-gchar*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-function g_utf8_to_ucs4_fast
  (c-name "g_utf8_to_ucs4_fast")
  (return-type "gunichar*")
  (parameters
    '("const-gchar*" "str")
    '("glong" "len")
    '("glong*" "items_written")
  )
)

(define-function g_utf16_to_ucs4
  (c-name "g_utf16_to_ucs4")
  (return-type "gunichar*")
  (parameters
    '("const-gunichar2*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-function g_utf16_to_utf8
  (c-name "g_utf16_to_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gunichar2*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-function g_ucs4_to_utf16
  (c-name "g_ucs4_to_utf16")
  (return-type "gunichar2*")
  (parameters
    '("const-gunichar*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-function g_ucs4_to_utf8
  (c-name "g_ucs4_to_utf8")
  (return-type "gchar*")
  (parameters
    '("const-gunichar*" "str")
    '("glong" "len")
    '("glong*" "items_read")
    '("glong*" "items_written")
    '("GError**" "error")
  )
)

(define-method to_utf8
  (of-object "gunichar")
  (c-name "g_unichar_to_utf8")
  (return-type "gint")
  (parameters
    '("gchar*" "outbuf")
  )
)

(define-function g_utf8_validate
  (c-name "g_utf8_validate")
  (return-type "gboolean")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "max_len")
    '("const-gchar**" "end")
  )
)

(define-method validate
  (of-object "gunichar")
  (c-name "g_unichar_validate")
  (return-type "gboolean")
)

(define-function g_utf8_strup
  (c-name "g_utf8_strup")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
  )
)

(define-function g_utf8_strdown
  (c-name "g_utf8_strdown")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
  )
)

(define-function g_utf8_casefold
  (c-name "g_utf8_casefold")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
  )
)

(define-function g_utf8_normalize
  (c-name "g_utf8_normalize")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
    '("GNormalizeMode" "mode")
  )
)

(define-function g_utf8_collate
  (c-name "g_utf8_collate")
  (return-type "gint")
  (parameters
    '("const-gchar*" "str1")
    '("const-gchar*" "str2")
  )
)

(define-function g_utf8_collate_key
  (c-name "g_utf8_collate_key")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "str")
    '("gssize" "len")
  )
)



;; From glib/gutils.h

(define-function g_get_real_name
  (c-name "g_get_real_name")
  (return-type "const-gchar*")
)

(define-function g_get_home_dir
  (c-name "g_get_home_dir")
  (return-type "const-gchar*")
)

(define-function g_get_tmp_dir
  (c-name "g_get_tmp_dir")
  (return-type "const-gchar*")
)

(define-function g_get_prgname
  (c-name "g_get_prgname")
  (return-type "gchar*")
)

(define-function g_set_prgname
  (c-name "g_set_prgname")
  (return-type "none")
  (parameters
    '("const-gchar*" "prgname")
  )
)

(define-function g_parse_debug_string
  (c-name "g_parse_debug_string")
  (return-type "guint")
  (parameters
    '("const-gchar*" "string")
    '("const-GDebugKey*" "keys")
    '("guint" "nkeys")
  )
)

(define-function g_snprintf
  (c-name "g_snprintf")
  (return-type "gint")
  (parameters
    '("gchar*" "string")
    '("gulong" "n")
    '("gchar-const*" "format")
  )
  (varargs #t)
)

(define-function g_vsnprintf
  (c-name "g_vsnprintf")
  (return-type "gint")
  (parameters
    '("gchar*" "string")
    '("gulong" "n")
    '("gchar-const*" "format")
    '("va_list" "args")
  )
)

(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_nullify_pointer
  (c-name "g_nullify_pointer")
  (return-type "none")
  (parameters
    '("gpointer*" "nullify_location")
  )
)

(define-function g_getenv
  (c-name "g_getenv")
  (return-type "const-gchar*")
  (parameters
    '("const-gchar*" "variable")
  )
)

(define-function g_atexit
  (c-name "g_atexit")
  (return-type "none")
  (parameters
    '("GVoidFunc" "func")
  )
)

(define-function g_find_program_in_path
  (c-name "g_find_program_in_path")
  (return-type "gchar*")
  (parameters
    '("const-gchar*" "program")
  )
)



;; From glib/gwin32.h

(define-function g_win32_getlocale
  (c-name "g_win32_getlocale")
  (return-type "gchar*")
)

(define-function g_win32_error_message
  (c-name "g_win32_error_message")
  (return-type "gchar*")
  (parameters
    '("gint" "error")
  )
)

(define-function g_win32_get_package_installation_directory
  (c-name "g_win32_get_package_installation_directory")
  (return-type "gchar*")
  (parameters
    '("gchar*" "package")
    '("gchar*" "dll_name")
  )
)

(define-function g_win32_get_package_installation_subdirectory
  (c-name "g_win32_get_package_installation_subdirectory")
  (return-type "gchar*")
  (parameters
    '("gchar*" "package")
    '("gchar*" "dll_name")
    '("gchar*" "subdir")
  )
)


