diff --git a/deps/glib/bin/glib-genmarshal b/deps/glib/bin/glib-genmarshal new file mode 100755 index 00000000..670540cc --- /dev/null +++ b/deps/glib/bin/glib-genmarshal @@ -0,0 +1,1069 @@ +#!/usr/bin/env python3 + +# pylint: disable=too-many-lines, missing-docstring, invalid-name + +# This file is part of GLib +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +import argparse +import os +import re +import sys + +VERSION_STR = '''glib-genmarshal version 2.66.3 +glib-genmarshal comes with ABSOLUTELY NO WARRANTY. +You may redistribute copies of glib-genmarshal under the terms of +the GNU General Public License which can be found in the +GLib source package. Sources, examples and contact +information are available at http://www.gtk.org''' + +GETTERS_STR = '''#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_schar (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */''' + +DEPRECATED_MSG_STR = 'The token "{}" is deprecated; use "{}" instead' + +VA_ARG_STR = \ + ' arg{:d} = ({:s}) va_arg (args_copy, {:s});' +STATIC_CHECK_STR = \ + '(param_types[{:d}] & G_SIGNAL_TYPE_STATIC_SCOPE) == 0 && ' +BOX_TYPED_STR = \ + ' arg{idx:d} = {box_func} (param_types[{idx:d}] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg{idx:d});' +BOX_UNTYPED_STR = \ + ' arg{idx:d} = {box_func} (arg{idx:d});' +UNBOX_TYPED_STR = \ + ' {unbox_func} (param_types[{idx:d}] & ~G_SIGNAL_TYPE_STATIC_SCOPE, arg{idx:d});' +UNBOX_UNTYPED_STR = \ + ' {unbox_func} (arg{idx:d});' + +STD_PREFIX = 'g_cclosure_marshal' + +# These are part of our ABI; keep this in sync with gmarshal.h +GOBJECT_MARSHALLERS = { + 'g_cclosure_marshal_VOID__VOID', + 'g_cclosure_marshal_VOID__BOOLEAN', + 'g_cclosure_marshal_VOID__CHAR', + 'g_cclosure_marshal_VOID__UCHAR', + 'g_cclosure_marshal_VOID__INT', + 'g_cclosure_marshal_VOID__UINT', + 'g_cclosure_marshal_VOID__LONG', + 'g_cclosure_marshal_VOID__ULONG', + 'g_cclosure_marshal_VOID__ENUM', + 'g_cclosure_marshal_VOID__FLAGS', + 'g_cclosure_marshal_VOID__FLOAT', + 'g_cclosure_marshal_VOID__DOUBLE', + 'g_cclosure_marshal_VOID__STRING', + 'g_cclosure_marshal_VOID__PARAM', + 'g_cclosure_marshal_VOID__BOXED', + 'g_cclosure_marshal_VOID__POINTER', + 'g_cclosure_marshal_VOID__OBJECT', + 'g_cclosure_marshal_VOID__VARIANT', + 'g_cclosure_marshal_VOID__UINT_POINTER', + 'g_cclosure_marshal_BOOLEAN__FLAGS', + 'g_cclosure_marshal_STRING__OBJECT_POINTER', + 'g_cclosure_marshal_BOOLEAN__BOXED_BOXED', +} + + +# pylint: disable=too-few-public-methods +class Color: + '''ANSI Terminal colors''' + GREEN = '\033[1;32m' + BLUE = '\033[1;34m' + YELLOW = '\033[1;33m' + RED = '\033[1;31m' + END = '\033[0m' + + +def print_color(msg, color=Color.END, prefix='MESSAGE'): + '''Print a string with a color prefix''' + if os.isatty(sys.stderr.fileno()): + real_prefix = '{start}{prefix}{end}'.format(start=color, prefix=prefix, end=Color.END) + else: + real_prefix = prefix + sys.stderr.write('{prefix}: {msg}\n'.format(prefix=real_prefix, msg=msg)) + + +def print_error(msg): + '''Print an error, and terminate''' + print_color(msg, color=Color.RED, prefix='ERROR') + sys.exit(1) + + +def print_warning(msg, fatal=False): + '''Print a warning, and optionally terminate''' + if fatal: + color = Color.RED + prefix = 'ERROR' + else: + color = Color.YELLOW + prefix = 'WARNING' + print_color(msg, color, prefix) + if fatal: + sys.exit(1) + + +def print_info(msg): + '''Print a message''' + print_color(msg, color=Color.GREEN, prefix='INFO') + + +def generate_licensing_comment(outfile): + outfile.write('/* This file is generated by glib-genmarshal, do not ' + 'modify it. This code is licensed under the same license as ' + 'the containing project. Note that it links to GLib, so ' + 'must comply with the LGPL linking clauses. */\n') + + +def generate_header_preamble(outfile, prefix='', std_includes=True, use_pragma=False): + '''Generate the preamble for the marshallers header file''' + generate_licensing_comment(outfile) + + if use_pragma: + outfile.write('#pragma once\n') + outfile.write('\n') + else: + outfile.write('#ifndef __{}_MARSHAL_H__\n'.format(prefix.upper())) + outfile.write('#define __{}_MARSHAL_H__\n'.format(prefix.upper())) + outfile.write('\n') + # Maintain compatibility with the old C-based tool + if std_includes: + outfile.write('#include \n') + outfile.write('\n') + + outfile.write('G_BEGIN_DECLS\n') + outfile.write('\n') + + +def generate_header_postamble(outfile, prefix='', use_pragma=False): + '''Generate the postamble for the marshallers header file''' + outfile.write('\n') + outfile.write('G_END_DECLS\n') + + if not use_pragma: + outfile.write('\n') + outfile.write('#endif /* __{}_MARSHAL_H__ */\n'.format(prefix.upper())) + + +def generate_body_preamble(outfile, std_includes=True, include_headers=None, cpp_defines=None, cpp_undefines=None): + '''Generate the preamble for the marshallers source file''' + generate_licensing_comment(outfile) + + for header in (include_headers or []): + outfile.write('#include "{}"\n'.format(header)) + if include_headers: + outfile.write('\n') + + for define in (cpp_defines or []): + s = define.split('=') + symbol = s[0] + value = s[1] if len(s) > 1 else '1' + outfile.write('#define {} {}\n'.format(symbol, value)) + if cpp_defines: + outfile.write('\n') + + for undefine in (cpp_undefines or []): + outfile.write('#undef {}\n'.format(undefine)) + if cpp_undefines: + outfile.write('\n') + + if std_includes: + outfile.write('#include \n') + outfile.write('\n') + + outfile.write(GETTERS_STR) + outfile.write('\n\n') + + +# Marshaller arguments, as a dictionary where the key is the token used in +# the source file, and the value is another dictionary with the following +# keys: +# +# - signal: the token used in the marshaller prototype (mandatory) +# - ctype: the C type for the marshaller argument (mandatory) +# - getter: the function used to retrieve the argument from the GValue +# array when invoking the callback (optional) +# - promoted: the C type used by va_arg() to retrieve the argument from +# the va_list when invoking the callback (optional, only used when +# generating va_list marshallers) +# - box: an array of two elements, containing the boxing and unboxing +# functions for the given type (optional, only used when generating +# va_list marshallers) +# - static-check: a boolean value, if the given type should perform +# a static type check before boxing or unboxing the argument (optional, +# only used when generating va_list marshallers) +# - takes-type: a boolean value, if the boxing and unboxing functions +# for the given type require the type (optional, only used when +# generating va_list marshallers) +# - deprecated: whether the token has been deprecated (optional) +# - replaced-by: the token used to replace a deprecated token (optional, +# only used if deprecated is True) +IN_ARGS = { + 'VOID': { + 'signal': 'VOID', + 'ctype': 'void', + }, + 'BOOLEAN': { + 'signal': 'BOOLEAN', + 'ctype': 'gboolean', + 'getter': 'g_marshal_value_peek_boolean', + }, + 'CHAR': { + 'signal': 'CHAR', + 'ctype': 'gchar', + 'promoted': 'gint', + 'getter': 'g_marshal_value_peek_char', + }, + 'UCHAR': { + 'signal': 'UCHAR', + 'ctype': 'guchar', + 'promoted': 'guint', + 'getter': 'g_marshal_value_peek_uchar', + }, + 'INT': { + 'signal': 'INT', + 'ctype': 'gint', + 'getter': 'g_marshal_value_peek_int', + }, + 'UINT': { + 'signal': 'UINT', + 'ctype': 'guint', + 'getter': 'g_marshal_value_peek_uint', + }, + 'LONG': { + 'signal': 'LONG', + 'ctype': 'glong', + 'getter': 'g_marshal_value_peek_long', + }, + 'ULONG': { + 'signal': 'ULONG', + 'ctype': 'gulong', + 'getter': 'g_marshal_value_peek_ulong', + }, + 'INT64': { + 'signal': 'INT64', + 'ctype': 'gint64', + 'getter': 'g_marshal_value_peek_int64', + }, + 'UINT64': { + 'signal': 'UINT64', + 'ctype': 'guint64', + 'getter': 'g_marshal_value_peek_uint64', + }, + 'ENUM': { + 'signal': 'ENUM', + 'ctype': 'gint', + 'getter': 'g_marshal_value_peek_enum', + }, + 'FLAGS': { + 'signal': 'FLAGS', + 'ctype': 'guint', + 'getter': 'g_marshal_value_peek_flags', + }, + 'FLOAT': { + 'signal': 'FLOAT', + 'ctype': 'gfloat', + 'promoted': 'gdouble', + 'getter': 'g_marshal_value_peek_float', + }, + 'DOUBLE': { + 'signal': 'DOUBLE', + 'ctype': 'gdouble', + 'getter': 'g_marshal_value_peek_double', + }, + 'STRING': { + 'signal': 'STRING', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_string', + 'box': ['g_strdup', 'g_free'], + 'static-check': True, + }, + 'PARAM': { + 'signal': 'PARAM', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_param', + 'box': ['g_param_spec_ref', 'g_param_spec_unref'], + 'static-check': True, + }, + 'BOXED': { + 'signal': 'BOXED', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_boxed', + 'box': ['g_boxed_copy', 'g_boxed_free'], + 'static-check': True, + 'takes-type': True, + }, + 'POINTER': { + 'signal': 'POINTER', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_pointer', + }, + 'OBJECT': { + 'signal': 'OBJECT', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_object', + 'box': ['g_object_ref', 'g_object_unref'], + }, + 'VARIANT': { + 'signal': 'VARIANT', + 'ctype': 'gpointer', + 'getter': 'g_marshal_value_peek_variant', + 'box': ['g_variant_ref_sink', 'g_variant_unref'], + 'static-check': True, + 'takes-type': False, + }, + + # Deprecated tokens + 'NONE': { + 'signal': 'VOID', + 'ctype': 'void', + 'deprecated': True, + 'replaced_by': 'VOID' + }, + 'BOOL': { + 'signal': 'BOOLEAN', + 'ctype': 'gboolean', + 'getter': 'g_marshal_value_peek_boolean', + 'deprecated': True, + 'replaced_by': 'BOOLEAN' + } +} + + +# Marshaller return values, as a dictionary where the key is the token used +# in the source file, and the value is another dictionary with the following +# keys: +# +# - signal: the token used in the marshaller prototype (mandatory) +# - ctype: the C type for the marshaller argument (mandatory) +# - setter: the function used to set the return value of the callback +# into a GValue (optional) +# - deprecated: whether the token has been deprecated (optional) +# - replaced-by: the token used to replace a deprecated token (optional, +# only used if deprecated is True) +OUT_ARGS = { + 'VOID': { + 'signal': 'VOID', + 'ctype': 'void', + }, + 'BOOLEAN': { + 'signal': 'BOOLEAN', + 'ctype': 'gboolean', + 'setter': 'g_value_set_boolean', + }, + 'CHAR': { + 'signal': 'CHAR', + 'ctype': 'gchar', + 'setter': 'g_value_set_char', + }, + 'UCHAR': { + 'signal': 'UCHAR', + 'ctype': 'guchar', + 'setter': 'g_value_set_uchar', + }, + 'INT': { + 'signal': 'INT', + 'ctype': 'gint', + 'setter': 'g_value_set_int', + }, + 'UINT': { + 'signal': 'UINT', + 'ctype': 'guint', + 'setter': 'g_value_set_uint', + }, + 'LONG': { + 'signal': 'LONG', + 'ctype': 'glong', + 'setter': 'g_value_set_long', + }, + 'ULONG': { + 'signal': 'ULONG', + 'ctype': 'gulong', + 'setter': 'g_value_set_ulong', + }, + 'INT64': { + 'signal': 'INT64', + 'ctype': 'gint64', + 'setter': 'g_value_set_int64', + }, + 'UINT64': { + 'signal': 'UINT64', + 'ctype': 'guint64', + 'setter': 'g_value_set_uint64', + }, + 'ENUM': { + 'signal': 'ENUM', + 'ctype': 'gint', + 'setter': 'g_value_set_enum', + }, + 'FLAGS': { + 'signal': 'FLAGS', + 'ctype': 'guint', + 'setter': 'g_value_set_flags', + }, + 'FLOAT': { + 'signal': 'FLOAT', + 'ctype': 'gfloat', + 'setter': 'g_value_set_float', + }, + 'DOUBLE': { + 'signal': 'DOUBLE', + 'ctype': 'gdouble', + 'setter': 'g_value_set_double', + }, + 'STRING': { + 'signal': 'STRING', + 'ctype': 'gchar*', + 'setter': 'g_value_take_string', + }, + 'PARAM': { + 'signal': 'PARAM', + 'ctype': 'GParamSpec*', + 'setter': 'g_value_take_param', + }, + 'BOXED': { + 'signal': 'BOXED', + 'ctype': 'gpointer', + 'setter': 'g_value_take_boxed', + }, + 'POINTER': { + 'signal': 'POINTER', + 'ctype': 'gpointer', + 'setter': 'g_value_set_pointer', + }, + 'OBJECT': { + 'signal': 'OBJECT', + 'ctype': 'GObject*', + 'setter': 'g_value_take_object', + }, + 'VARIANT': { + 'signal': 'VARIANT', + 'ctype': 'GVariant*', + 'setter': 'g_value_take_variant', + }, + + # Deprecated tokens + 'NONE': { + 'signal': 'VOID', + 'ctype': 'void', + 'setter': None, + 'deprecated': True, + 'replaced_by': 'VOID', + }, + 'BOOL': { + 'signal': 'BOOLEAN', + 'ctype': 'gboolean', + 'setter': 'g_value_set_boolean', + 'deprecated': True, + 'replaced_by': 'BOOLEAN', + }, +} + + +def check_args(retval, params, fatal_warnings=False): + '''Check the @retval and @params tokens for invalid and deprecated symbols.''' + if retval not in OUT_ARGS: + print_error('Unknown return value type "{}"'.format(retval)) + + if OUT_ARGS[retval].get('deprecated', False): + replaced_by = OUT_ARGS[retval]['replaced_by'] + print_warning(DEPRECATED_MSG_STR.format(retval, replaced_by), fatal_warnings) + + for param in params: + if param not in IN_ARGS: + print_error('Unknown parameter type "{}"'.format(param)) + else: + if IN_ARGS[param].get('deprecated', False): + replaced_by = IN_ARGS[param]['replaced_by'] + print_warning(DEPRECATED_MSG_STR.format(param, replaced_by), fatal_warnings) + + +def indent(text, level=0, fill=' '): + '''Indent @text by @level columns, using the @fill character''' + return ''.join([fill for x in range(level)]) + text + + +# pylint: disable=too-few-public-methods +class Visibility: + '''Symbol visibility options''' + NONE = 0 + INTERNAL = 1 + EXTERN = 2 + + +def generate_marshaller_name(prefix, retval, params, replace_deprecated=True): + '''Generate a marshaller name for the given @prefix, @retval, and @params. + If @replace_deprecated is True, the generated name will replace deprecated + tokens.''' + if replace_deprecated: + real_retval = OUT_ARGS[retval]['signal'] + real_params = [] + for param in params: + real_params.append(IN_ARGS[param]['signal']) + else: + real_retval = retval + real_params = params + return '{prefix}_{retval}__{args}'.format(prefix=prefix, + retval=real_retval, + args='_'.join(real_params)) + + +def generate_prototype(retval, params, + prefix='g_cclosure_user_marshal', + visibility=Visibility.NONE, + va_marshal=False): + '''Generate a marshaller declaration with the given @visibility. If @va_marshal + is True, the marshaller will use variadic arguments in place of a GValue array.''' + signature = [] + + if visibility == Visibility.INTERNAL: + signature += ['G_GNUC_INTERNAL'] + elif visibility == Visibility.EXTERN: + signature += ['extern'] + + function_name = generate_marshaller_name(prefix, retval, params) + + if not va_marshal: + signature += ['void ' + function_name + ' (GClosure *closure,'] + width = len('void ') + len(function_name) + 2 + + signature += [indent('GValue *return_value,', level=width, fill=' ')] + signature += [indent('guint n_param_values,', level=width, fill=' ')] + signature += [indent('const GValue *param_values,', level=width, fill=' ')] + signature += [indent('gpointer invocation_hint,', level=width, fill=' ')] + signature += [indent('gpointer marshal_data);', level=width, fill=' ')] + else: + signature += ['void ' + function_name + 'v (GClosure *closure,'] + width = len('void ') + len(function_name) + 3 + + signature += [indent('GValue *return_value,', level=width, fill=' ')] + signature += [indent('gpointer instance,', level=width, fill=' ')] + signature += [indent('va_list args,', level=width, fill=' ')] + signature += [indent('gpointer marshal_data,', level=width, fill=' ')] + signature += [indent('int n_params,', level=width, fill=' ')] + signature += [indent('GType *param_types);', level=width, fill=' ')] + + return signature + + +# pylint: disable=too-many-statements, too-many-locals, too-many-branches +def generate_body(retval, params, prefix, va_marshal=False): + '''Generate a marshaller definition. If @va_marshal is True, the marshaller + will use va_list and variadic arguments in place of a GValue array.''' + retval_setter = OUT_ARGS[retval].get('setter', None) + # If there's no return value then we can mark the retval argument as unused + # and get a minor optimisation, as well as avoid a compiler warning + if not retval_setter: + unused = ' G_GNUC_UNUSED' + else: + unused = '' + + body = ['void'] + + function_name = generate_marshaller_name(prefix, retval, params) + + if not va_marshal: + body += [function_name + ' (GClosure *closure,'] + width = len(function_name) + 2 + + body += [indent('GValue *return_value{},'.format(unused), level=width, fill=' ')] + body += [indent('guint n_param_values,', level=width, fill=' ')] + body += [indent('const GValue *param_values,', level=width, fill=' ')] + body += [indent('gpointer invocation_hint G_GNUC_UNUSED,', level=width, fill=' ')] + body += [indent('gpointer marshal_data)', level=width, fill=' ')] + else: + body += [function_name + 'v (GClosure *closure,'] + width = len(function_name) + 3 + + body += [indent('GValue *return_value{},'.format(unused), level=width, fill=' ')] + body += [indent('gpointer instance,', level=width, fill=' ')] + body += [indent('va_list args,', level=width, fill=' ')] + body += [indent('gpointer marshal_data,', level=width, fill=' ')] + body += [indent('int n_params,', level=width, fill=' ')] + body += [indent('GType *param_types)', level=width, fill=' ')] + + # Filter the arguments that have a getter + get_args = [x for x in params if IN_ARGS[x].get('getter', None) is not None] + + body += ['{'] + + # Generate the type of the marshaller function + typedef_marshal = generate_marshaller_name('GMarshalFunc', retval, params) + + typedef = ' typedef {ctype} (*{func_name}) ('.format(ctype=OUT_ARGS[retval]['ctype'], + func_name=typedef_marshal) + pad = len(typedef) + typedef += 'gpointer data1,' + body += [typedef] + + for idx, in_arg in enumerate(get_args): + body += [indent('{} arg{:d},'.format(IN_ARGS[in_arg]['ctype'], idx + 1), level=pad)] + + body += [indent('gpointer data2);', level=pad)] + + # Variable declarations + body += [' GCClosure *cc = (GCClosure *) closure;'] + body += [' gpointer data1, data2;'] + body += [' {} callback;'.format(typedef_marshal)] + + if retval_setter: + body += [' {} v_return;'.format(OUT_ARGS[retval]['ctype'])] + + if va_marshal: + for idx, arg in enumerate(get_args): + body += [' {} arg{:d};'.format(IN_ARGS[arg]['ctype'], idx)] + + if get_args: + body += [' va_list args_copy;'] + body += [''] + + body += [' G_VA_COPY (args_copy, args);'] + + for idx, arg in enumerate(get_args): + ctype = IN_ARGS[arg]['ctype'] + promoted_ctype = IN_ARGS[arg].get('promoted', ctype) + body += [VA_ARG_STR.format(idx, ctype, promoted_ctype)] + if IN_ARGS[arg].get('box', None): + box_func = IN_ARGS[arg]['box'][0] + if IN_ARGS[arg].get('static-check', False): + static_check = STATIC_CHECK_STR.format(idx) + else: + static_check = '' + arg_check = 'arg{:d} != NULL'.format(idx) + body += [' if ({}{})'.format(static_check, arg_check)] + if IN_ARGS[arg].get('takes-type', False): + body += [BOX_TYPED_STR.format(idx=idx, box_func=box_func)] + else: + body += [BOX_UNTYPED_STR.format(idx=idx, box_func=box_func)] + + body += [' va_end (args_copy);'] + + body += [''] + + # Preconditions check + if retval_setter: + body += [' g_return_if_fail (return_value != NULL);'] + + if not va_marshal: + body += [' g_return_if_fail (n_param_values == {:d});'.format(len(get_args) + 1)] + + body += [''] + + # Marshal instance, data, and callback set up + body += [' if (G_CCLOSURE_SWAP_DATA (closure))'] + body += [' {'] + body += [' data1 = closure->data;'] + if va_marshal: + body += [' data2 = instance;'] + else: + body += [' data2 = g_value_peek_pointer (param_values + 0);'] + body += [' }'] + body += [' else'] + body += [' {'] + if va_marshal: + body += [' data1 = instance;'] + else: + body += [' data1 = g_value_peek_pointer (param_values + 0);'] + body += [' data2 = closure->data;'] + body += [' }'] + # pylint: disable=line-too-long + body += [' callback = ({}) (marshal_data ? marshal_data : cc->callback);'.format(typedef_marshal)] + body += [''] + + # Marshal callback action + if retval_setter: + callback = ' {} callback ('.format(' v_return =') + else: + callback = ' callback (' + + pad = len(callback) + body += [callback + 'data1,'] + + if va_marshal: + for idx, arg in enumerate(get_args): + body += [indent('arg{:d},'.format(idx), level=pad)] + else: + for idx, arg in enumerate(get_args): + arg_getter = IN_ARGS[arg]['getter'] + body += [indent('{} (param_values + {:d}),'.format(arg_getter, idx + 1), level=pad)] + + body += [indent('data2);', level=pad)] + + if va_marshal: + boxed_args = [x for x in get_args if IN_ARGS[x].get('box', None) is not None] + if not boxed_args: + body += [''] + else: + for idx, arg in enumerate(get_args): + if not IN_ARGS[arg].get('box', None): + continue + unbox_func = IN_ARGS[arg]['box'][1] + if IN_ARGS[arg].get('static-check', False): + static_check = STATIC_CHECK_STR.format(idx) + else: + static_check = '' + arg_check = 'arg{:d} != NULL'.format(idx) + body += [' if ({}{})'.format(static_check, arg_check)] + if IN_ARGS[arg].get('takes-type', False): + body += [UNBOX_TYPED_STR.format(idx=idx, unbox_func=unbox_func)] + else: + body += [UNBOX_UNTYPED_STR.format(idx=idx, unbox_func=unbox_func)] + + if retval_setter: + body += [''] + body += [' {} (return_value, v_return);'.format(retval_setter)] + + body += ['}'] + + return body + + +def generate_marshaller_alias(outfile, marshaller, real_marshaller, + include_va=False, + source_location=None): + '''Generate an alias between @marshaller and @real_marshaller, including + an optional alias for va_list marshallers''' + if source_location: + outfile.write('/* {} */\n'.format(source_location)) + + outfile.write('#define {}\t{}\n'.format(marshaller, real_marshaller)) + + if include_va: + outfile.write('#define {}v\t{}v\n'.format(marshaller, real_marshaller)) + + outfile.write('\n') + + +def generate_marshallers_header(outfile, retval, params, + prefix='g_cclosure_user_marshal', + internal=False, + include_va=False, source_location=None): + '''Generate a declaration for a marshaller function, to be used in the header, + with the given @retval, @params, and @prefix. An optional va_list marshaller + for the same arguments is also generated. The generated buffer is written to + the @outfile stream object.''' + if source_location: + outfile.write('/* {} */\n'.format(source_location)) + + if internal: + visibility = Visibility.INTERNAL + else: + visibility = Visibility.EXTERN + + signature = generate_prototype(retval, params, prefix, visibility, False) + if include_va: + signature += generate_prototype(retval, params, prefix, visibility, True) + signature += [''] + + outfile.write('\n'.join(signature)) + outfile.write('\n') + + +def generate_marshallers_body(outfile, retval, params, + prefix='g_cclosure_user_marshal', + include_prototype=True, + internal=False, + include_va=False, source_location=None): + '''Generate a definition for a marshaller function, to be used in the source, + with the given @retval, @params, and @prefix. An optional va_list marshaller + for the same arguments is also generated. The generated buffer is written to + the @outfile stream object.''' + if source_location: + outfile.write('/* {} */\n'.format(source_location)) + + if include_prototype: + # Declaration visibility + if internal: + decl_visibility = Visibility.INTERNAL + else: + decl_visibility = Visibility.EXTERN + proto = ['/* Prototype for -Wmissing-prototypes */'] + # Add C++ guards in case somebody compiles the generated code + # with a C++ compiler + proto += ['G_BEGIN_DECLS'] + proto += generate_prototype(retval, params, prefix, decl_visibility, False) + proto += ['G_END_DECLS'] + outfile.write('\n'.join(proto)) + outfile.write('\n') + + body = generate_body(retval, params, prefix, False) + outfile.write('\n'.join(body)) + outfile.write('\n\n') + + if include_va: + if include_prototype: + # Declaration visibility + if internal: + decl_visibility = Visibility.INTERNAL + else: + decl_visibility = Visibility.EXTERN + proto = ['/* Prototype for -Wmissing-prototypes */'] + # Add C++ guards here as well + proto += ['G_BEGIN_DECLS'] + proto += generate_prototype(retval, params, prefix, decl_visibility, True) + proto += ['G_END_DECLS'] + outfile.write('\n'.join(proto)) + outfile.write('\n') + + body = generate_body(retval, params, prefix, True) + outfile.write('\n'.join(body)) + outfile.write('\n\n') + + +if __name__ == '__main__': + arg_parser = argparse.ArgumentParser(description='Generate signal marshallers for GObject') + arg_parser.add_argument('--prefix', metavar='STRING', + default='g_cclosure_user_marshal', + help='Specify marshaller prefix') + arg_parser.add_argument('--output', metavar='FILE', + type=argparse.FileType('w'), + default=sys.stdout, + help='Write output into the specified file') + arg_parser.add_argument('--skip-source', + action='store_true', + help='Skip source location comments') + arg_parser.add_argument('--internal', + action='store_true', + help='Mark generated functions as internal') + arg_parser.add_argument('--valist-marshallers', + action='store_true', + help='Generate va_list marshallers') + arg_parser.add_argument('-v', '--version', + action='store_true', + dest='show_version', + help='Print version information, and exit') + arg_parser.add_argument('--g-fatal-warnings', + action='store_true', + dest='fatal_warnings', + help='Make warnings fatal') + arg_parser.add_argument('--include-header', metavar='HEADER', nargs='?', + action='append', + dest='include_headers', + help='Include the specified header in the body') + arg_parser.add_argument('--pragma-once', + action='store_true', + help='Use "pragma once" as the inclusion guard') + arg_parser.add_argument('-D', + action='append', + dest='cpp_defines', + default=[], + help='Pre-processor define') + arg_parser.add_argument('-U', + action='append', + dest='cpp_undefines', + default=[], + help='Pre-processor undefine') + arg_parser.add_argument('files', metavar='FILE', nargs='*', + type=argparse.FileType('r'), + help='Files with lists of marshallers to generate, ' + + 'or "-" for standard input') + arg_parser.add_argument('--prototypes', + action='store_true', + help='Generate the marshallers prototype in the C code') + arg_parser.add_argument('--header', + action='store_true', + help='Generate C headers') + arg_parser.add_argument('--body', + action='store_true', + help='Generate C code') + + group = arg_parser.add_mutually_exclusive_group() + group.add_argument('--stdinc', + action='store_true', + dest='stdinc', default=True, + help='Include standard marshallers') + group.add_argument('--nostdinc', + action='store_false', + dest='stdinc', default=True, + help='Use standard marshallers') + + group = arg_parser.add_mutually_exclusive_group() + group.add_argument('--quiet', + action='store_true', + help='Only print warnings and errors') + group.add_argument('--verbose', + action='store_true', + help='Be verbose, and include debugging information') + + args = arg_parser.parse_args() + + if args.show_version: + print(VERSION_STR) + sys.exit(0) + + # Backward compatibility hack; some projects use both arguments to + # generate the marshallers prototype in the C source, even though + # it's not really a supported use case. We keep this behaviour by + # forcing the --prototypes and --body arguments instead. We make this + # warning non-fatal even with --g-fatal-warnings, as it's a deprecation + compatibility_mode = False + if args.header and args.body: + print_warning('Using --header and --body at the same time is deprecated; ' + + 'use --body --prototypes instead', False) + args.prototypes = True + args.header = False + compatibility_mode = True + + if args.header: + generate_header_preamble(args.output, + prefix=args.prefix, + std_includes=args.stdinc, + use_pragma=args.pragma_once) + elif args.body: + generate_body_preamble(args.output, + std_includes=args.stdinc, + include_headers=args.include_headers, + cpp_defines=args.cpp_defines, + cpp_undefines=args.cpp_undefines) + + seen_marshallers = set() + + for infile in args.files: + if not args.quiet: + print_info('Reading {}...'.format(infile.name)) + + line_count = 0 + for line in infile: + line_count += 1 + + if line == '\n' or line.startswith('#'): + continue + + matches = re.match(r'^([A-Z0-9]+)\s?:\s?([A-Z0-9,\s]+)$', line.strip()) + if not matches or len(matches.groups()) != 2: + print_warning('Invalid entry: "{}"'.format(line.strip()), args.fatal_warnings) + continue + + if not args.skip_source: + location = '{} ({}:{:d})'.format(line.strip(), infile.name, line_count) + else: + location = None + + retval = matches.group(1).strip() + params = [x.strip() for x in matches.group(2).split(',')] + check_args(retval, params, args.fatal_warnings) + + raw_marshaller = generate_marshaller_name(args.prefix, retval, params, False) + if raw_marshaller in seen_marshallers: + if args.verbose: + print_info('Skipping repeated marshaller {}'.format(line.strip())) + continue + + if args.header: + if args.verbose: + print_info('Generating declaration for {}'.format(line.strip())) + generate_std_alias = False + if args.stdinc: + std_marshaller = generate_marshaller_name(STD_PREFIX, retval, params) + if std_marshaller in GOBJECT_MARSHALLERS: + if args.verbose: + print_info('Skipping default marshaller {}'.format(line.strip())) + generate_std_alias = True + + marshaller = generate_marshaller_name(args.prefix, retval, params) + if generate_std_alias: + generate_marshaller_alias(args.output, marshaller, std_marshaller, + source_location=location, + include_va=args.valist_marshallers) + else: + generate_marshallers_header(args.output, retval, params, + prefix=args.prefix, + internal=args.internal, + include_va=args.valist_marshallers, + source_location=location) + # If the marshaller is defined using a deprecated token, we want to maintain + # compatibility and generate an alias for the old name pointing to the new + # one + if marshaller != raw_marshaller: + if args.verbose: + print_info('Generating alias for deprecated tokens') + generate_marshaller_alias(args.output, raw_marshaller, marshaller, + include_va=args.valist_marshallers) + elif args.body: + if args.verbose: + print_info('Generating definition for {}'.format(line.strip())) + generate_std_alias = False + if args.stdinc: + std_marshaller = generate_marshaller_name(STD_PREFIX, retval, params) + if std_marshaller in GOBJECT_MARSHALLERS: + if args.verbose: + print_info('Skipping default marshaller {}'.format(line.strip())) + generate_std_alias = True + marshaller = generate_marshaller_name(args.prefix, retval, params) + if generate_std_alias: + # We need to generate the alias if we are in compatibility mode + if compatibility_mode: + generate_marshaller_alias(args.output, marshaller, std_marshaller, + source_location=location, + include_va=args.valist_marshallers) + else: + generate_marshallers_body(args.output, retval, params, + prefix=args.prefix, + internal=args.internal, + include_prototype=args.prototypes, + include_va=args.valist_marshallers, + source_location=location) + if compatibility_mode and marshaller != raw_marshaller: + if args.verbose: + print_info('Generating alias for deprecated tokens') + generate_marshaller_alias(args.output, raw_marshaller, marshaller, + include_va=args.valist_marshallers) + + seen_marshallers.add(raw_marshaller) + + if args.header: + generate_header_postamble(args.output, prefix=args.prefix, use_pragma=args.pragma_once) diff --git a/deps/glib/bin/glib-gettextize b/deps/glib/bin/glib-gettextize new file mode 100755 index 00000000..e140dbdf --- /dev/null +++ b/deps/glib/bin/glib-gettextize @@ -0,0 +1,187 @@ +#! /bin/sh +# +# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# + +# - Modified in October 2001 by jacob berkman to +# work with glib's Makefile.in.in and po2tbl.sed.in, to not copy in +# intl/, and to not add ChangeLog entries to po/ChangeLog + +# This file is meant for authors or maintainers which want to +# internationalize their package with the help of GNU gettext. For +# further information how to use it consult the GNU gettext manual. + +echo=echo +progname=$0 +force=0 +configstatus=0 +origdir=`pwd` +usage="\ +Usage: glib-gettextize [OPTION]... [package-dir] + --help print this help and exit + --version print version information and exit + -c, --copy copy files instead of making symlinks + -f, --force force writing of new files even if old exist +Report bugs to https://gitlab.gnome.org/GNOME/glib/issues/new." +package=glib +version=2.66.3 +try_ln_s=: + +# Directory where the sources are stored. +prefix=/Volumes/ramdisk/zdoom-macos-deps/deps/glib +case `uname` in +MINGW32*) + prefix="`dirname $0`/.." + ;; +esac + +datarootdir=/Volumes/ramdisk/zdoom-macos-deps/deps/glib/share +datadir=/Volumes/ramdisk/zdoom-macos-deps/deps/glib/share + +gettext_dir=$datadir/glib-2.0/gettext + +while test $# -gt 0; do + case "$1" in + -c | --copy | --c* ) + shift + try_ln_s=false ;; + -f | --force | --f* ) + shift + force=1 ;; + -r | --run | --r* ) + shift + configstatus=1 ;; + --help | --h* ) + $echo "$usage"; exit 0 ;; + --version | --v* ) + echo "$progname (GNU $package) $version" + $echo "Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + $echo "Written by" "Ulrich Drepper" + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + $echo "glib-gettextize: unknown option $1" + $echo "Try \`glib-gettextize --help' for more information."; exit 1 ;; + * ) + break ;; + esac +done + +if test $# -gt 1; then + $echo "$usage" + exit 1 +fi + +# Fill in the command line options value. +if test $# -eq 1; then + srcdir=$1 + if cd "$srcdir"; then + srcdir=`pwd` + else + $echo "Cannot change directory to \`$srcdir'" + exit 1 + fi +else + srcdir=$origdir +fi + +test -f configure.in || test -f configure.ac || { + $echo "Missing configure.in or configure.ac, please cd to your package first." + exit 1 +} + +configure_in=NONE +if test -f configure.in; then + configure_in=configure.in +else + if test -f configure.ac; then + configure_in=configure.ac + fi +fi +# Check in which directory config.rpath, mkinstalldirs etc. belong. +auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q` +if test -n "$auxdir"; then + auxdir="$auxdir/" +fi + +if test -f po/Makefile.in.in && test $force -eq 0; then + $echo "\ +po/Makefile.in.in exists: use option -f if you really want to delete it." + exit 1 +fi + +test -d po || { + $echo "Creating po/ subdirectory" + mkdir po || { + $echo "failed to create po/ subdirectory" + exit 1 + } +} + +# For simplicity we changed to the gettext source directory. +cd $gettext_dir || { + $echo "gettext source directory '${gettext_dir}' doesn't exist" + exit 1 +} + +# Now copy all files. Take care for the destination directories. +for file in *; do + case $file in + intl | po) + ;; + mkinstalldirs) + rm -f "$srcdir/$auxdir$file" + ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$auxdir$file" && $echo "Symlinking file $file") 2>/dev/null || + { $echo "Copying file $file"; cp $file "$srcdir/$auxdir$file"; } + ;; + *) + rm -f "$srcdir/$file" + ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$file" && $echo "Symlinking file $file") 2>/dev/null || + { $echo "Copying file $file"; cp $file "$srcdir/$file"; } + ;; + esac +done + +# Copy files to po/ subdirectory. +cd po +for file in *; do + rm -f "$srcdir/po/$file" + ($try_ln_s && ln -s $gettext_dir/po/$file "$srcdir/po/$file" && $echo "Symlinking file po/$file") 2>/dev/null || + { $echo "Copying file po/$file"; cp $file "$srcdir/po/$file"; } +done +if test -f "$srcdir/po/cat-id-tbl.c"; then + $echo "Removing po/cat-id-tbl.c" + rm -f "$srcdir/po/cat-id-tbl.c" +fi +if test -f "$srcdir/po/stamp-cat-id"; then + $echo "Removing po/stamp-cat-id" + rm -f "$srcdir/po/stamp-cat-id" +fi + +echo +echo "Please add the files" +echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4" +echo " progtest.m4" +echo "from the $datadir/aclocal directory to your autoconf macro directory" +echo "or directly to your aclocal.m4 file." +echo "You will also need config.guess and config.sub, which you can get from" +echo "ftp://ftp.gnu.org/pub/gnu/config/." +echo + +exit 0 diff --git a/deps/glib/bin/glib-mkenums b/deps/glib/bin/glib-mkenums new file mode 100755 index 00000000..1763d9ea --- /dev/null +++ b/deps/glib/bin/glib-mkenums @@ -0,0 +1,783 @@ +#!/usr/bin/env python3 + +# If the code below looks horrible and unpythonic, do not panic. +# +# It is. +# +# This is a manual conversion from the original Perl script to +# Python. Improvements are welcome. +# +from __future__ import print_function, unicode_literals + +import argparse +import os +import re +import sys +import tempfile +import io +import errno +import codecs +import locale + +VERSION_STR = '''glib-mkenums version 2.66.3 +glib-mkenums comes with ABSOLUTELY NO WARRANTY. +You may redistribute copies of glib-mkenums under the terms of +the GNU General Public License which can be found in the +GLib source package. Sources, examples and contact +information are available at http://www.gtk.org''' + +# pylint: disable=too-few-public-methods +class Color: + '''ANSI Terminal colors''' + GREEN = '\033[1;32m' + BLUE = '\033[1;34m' + YELLOW = '\033[1;33m' + RED = '\033[1;31m' + END = '\033[0m' + + +def print_color(msg, color=Color.END, prefix='MESSAGE'): + '''Print a string with a color prefix''' + if os.isatty(sys.stderr.fileno()): + real_prefix = '{start}{prefix}{end}'.format(start=color, prefix=prefix, end=Color.END) + else: + real_prefix = prefix + print('{prefix}: {msg}'.format(prefix=real_prefix, msg=msg), file=sys.stderr) + + +def print_error(msg): + '''Print an error, and terminate''' + print_color(msg, color=Color.RED, prefix='ERROR') + sys.exit(1) + + +def print_warning(msg, fatal=False): + '''Print a warning, and optionally terminate''' + if fatal: + color = Color.RED + prefix = 'ERROR' + else: + color = Color.YELLOW + prefix = 'WARNING' + print_color(msg, color, prefix) + if fatal: + sys.exit(1) + + +def print_info(msg): + '''Print a message''' + print_color(msg, color=Color.GREEN, prefix='INFO') + + +def get_rspfile_args(rspfile): + ''' + Response files are useful on Windows where there is a command-line character + limit of 8191 because when passing sources as arguments to glib-mkenums this + limit can be exceeded in large codebases. + + There is no specification for response files and each tool that supports it + generally writes them out in slightly different ways, but some sources are: + https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-response-files + https://docs.microsoft.com/en-us/windows/desktop/midl/the-response-file-command + ''' + import shlex + if not os.path.isfile(rspfile): + sys.exit('Response file {!r} does not exist'.format(rspfile)) + try: + with open(rspfile, 'r') as f: + cmdline = f.read() + except OSError as e: + sys.exit('Response file {!r} could not be read: {}' + .format(rspfile, e.strerror)) + return shlex.split(cmdline) + + +def write_output(output): + global output_stream + print(output, file=output_stream) + + +# Python 2 defaults to ASCII in case stdout is redirected. +# This should make it match Python 3, which uses the locale encoding. +if sys.stdout.encoding is None: + output_stream = codecs.getwriter( + locale.getpreferredencoding())(sys.stdout) +else: + output_stream = sys.stdout + + +# Some source files aren't UTF-8 and the old perl version didn't care. +# Replace invalid data with a replacement character to keep things working. +# https://bugzilla.gnome.org/show_bug.cgi?id=785113#c20 +def replace_and_warn(err): + # 7 characters of context either side of the offending character + print_warning('UnicodeWarning: {} at {} ({})'.format( + err.reason, err.start, + err.object[err.start - 7:err.end + 7])) + return ('?', err.end) + +codecs.register_error('replace_and_warn', replace_and_warn) + + +# glib-mkenums.py +# Information about the current enumeration +flags = None # Is enumeration a bitmask? +option_underscore_name = '' # Overridden underscore variant of the enum name + # for example to fix the cases we don't get the + # mixed-case -> underscorized transform right. +option_lowercase_name = '' # DEPRECATED. A lower case name to use as part + # of the *_get_type() function, instead of the + # one that we guess. For instance, when an enum + # uses abnormal capitalization and we can not + # guess where to put the underscores. +option_since = '' # User provided version info for the enum. +seenbitshift = 0 # Have we seen bitshift operators? +enum_prefix = None # Prefix for this enumeration +enumname = '' # Name for this enumeration +enumshort = '' # $enumname without prefix +enumname_prefix = '' # prefix of $enumname +enumindex = 0 # Global enum counter +firstenum = 1 # Is this the first enumeration per file? +entries = [] # [ name, val ] for each entry +sandbox = None # sandbox for safe evaluation of expressions + +output = '' # Filename to write result into + +def parse_trigraph(opts): + result = {} + + for opt in re.split(r'\s*,\s*', opts): + opt = re.sub(r'^\s*', '', opt) + opt = re.sub(r'\s*$', '', opt) + m = re.search(r'(\w+)(?:=(.+))?', opt) + assert m is not None + groups = m.groups() + key = groups[0] + if len(groups) > 1: + val = groups[1] + else: + val = 1 + result[key] = val + return result + +def parse_entries(file, file_name): + global entries, enumindex, enumname, seenbitshift, flags + looking_for_name = False + + while True: + line = file.readline() + if not line: + break + + line = line.strip() + + # read lines until we have no open comments + while re.search(r'/\*([^*]|\*(?!/))*$', line): + line += file.readline() + + # strip comments w/o options + line = re.sub(r'''/\*(?!<) + ([^*]+|\*(?!/))* + \*/''', '', line, flags=re.X) + + line = line.rstrip() + + # skip empty lines + if len(line.strip()) == 0: + continue + + if looking_for_name: + m = re.match(r'\s*(\w+)', line) + if m: + enumname = m.group(1) + return True + + # Handle include files + m = re.match(r'\#include\s*<([^>]*)>', line) + if m: + newfilename = os.path.join("..", m.group(1)) + newfile = io.open(newfilename, encoding="utf-8", + errors="replace_and_warn") + + if not parse_entries(newfile, newfilename): + return False + else: + continue + + m = re.match(r'\s*\}\s*(\w+)', line) + if m: + enumname = m.group(1) + enumindex += 1 + return 1 + + m = re.match(r'\s*\}', line) + if m: + enumindex += 1 + looking_for_name = True + continue + + m = re.match(r'''\s* + (\w+)\s* # name + (?:=( # value + \s*\w+\s*\(.*\)\s* # macro with multiple args + | # OR + (?:[^,/]|/(?!\*))* # anything but a comma or comment + ))?,?\s* + (?:/\*< # options + (([^*]|\*(?!/))*) + >\s*\*/)?,? + \s*$''', line, flags=re.X) + if m: + groups = m.groups() + name = groups[0] + value = None + options = None + if len(groups) > 1: + value = groups[1] + if len(groups) > 2: + options = groups[2] + if flags is None and value is not None and '<<' in value: + seenbitshift = 1 + + if options is not None: + options = parse_trigraph(options) + if 'skip' not in options: + entries.append((name, value, options.get('nick'))) + else: + entries.append((name, value)) + elif re.match(r's*\#', line): + pass + else: + print_warning('Failed to parse "{}" in {}'.format(line, file_name)) + return False + +help_epilog = '''Production text substitutions: + \u0040EnumName\u0040 PrefixTheXEnum + \u0040enum_name\u0040 prefix_the_xenum + \u0040ENUMNAME\u0040 PREFIX_THE_XENUM + \u0040ENUMSHORT\u0040 THE_XENUM + \u0040ENUMPREFIX\u0040 PREFIX + \u0040enumsince\u0040 the user-provided since value given + \u0040VALUENAME\u0040 PREFIX_THE_XVALUE + \u0040valuenick\u0040 the-xvalue + \u0040valuenum\u0040 the integer value (limited support, Since: 2.26) + \u0040type\u0040 either enum or flags + \u0040Type\u0040 either Enum or Flags + \u0040TYPE\u0040 either ENUM or FLAGS + \u0040filename\u0040 name of current input file + \u0040basename\u0040 base name of the current input file (Since: 2.22) +''' + + +# production variables: +idprefix = "" # "G", "Gtk", etc +symprefix = "" # "g", "gtk", etc, if not just lc($idprefix) +fhead = "" # output file header +fprod = "" # per input file production +ftail = "" # output file trailer +eprod = "" # per enum text (produced prior to value itarations) +vhead = "" # value header, produced before iterating over enum values +vprod = "" # value text, produced for each enum value +vtail = "" # value tail, produced after iterating over enum values +comment_tmpl = "" # comment template + +def read_template_file(file): + global idprefix, symprefix, fhead, fprod, ftail, eprod, vhead, vprod, vtail, comment_tmpl + tmpl = {'file-header': fhead, + 'file-production': fprod, + 'file-tail': ftail, + 'enumeration-production': eprod, + 'value-header': vhead, + 'value-production': vprod, + 'value-tail': vtail, + 'comment': comment_tmpl, + } + in_ = 'junk' + + ifile = io.open(file, encoding="utf-8", errors="replace_and_warn") + for line in ifile: + m = re.match(r'\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\/', line) + if m: + if in_ == 'junk' and m.group(1) == 'BEGIN' and m.group(2) in tmpl: + in_ = m.group(2) + continue + elif in_ == m.group(2) and m.group(1) == 'END' and m.group(2) in tmpl: + in_ = 'junk' + continue + else: + sys.exit("Malformed template file " + file) + + if in_ != 'junk': + tmpl[in_] += line + + if in_ != 'junk': + sys.exit("Malformed template file " + file) + + fhead = tmpl['file-header'] + fprod = tmpl['file-production'] + ftail = tmpl['file-tail'] + eprod = tmpl['enumeration-production'] + vhead = tmpl['value-header'] + vprod = tmpl['value-production'] + vtail = tmpl['value-tail'] + comment_tmpl = tmpl['comment'] + +parser = argparse.ArgumentParser(epilog=help_epilog, + formatter_class=argparse.RawDescriptionHelpFormatter) + +parser.add_argument('--identifier-prefix', default='', dest='idprefix', + help='Identifier prefix') +parser.add_argument('--symbol-prefix', default='', dest='symprefix', + help='Symbol prefix') +parser.add_argument('--fhead', default=[], dest='fhead', action='append', + help='Output file header') +parser.add_argument('--ftail', default=[], dest='ftail', action='append', + help='Output file footer') +parser.add_argument('--fprod', default=[], dest='fprod', action='append', + help='Put out TEXT every time a new input file is being processed.') +parser.add_argument('--eprod', default=[], dest='eprod', action='append', + help='Per enum text, produced prior to value iterations') +parser.add_argument('--vhead', default=[], dest='vhead', action='append', + help='Value header, produced before iterating over enum values') +parser.add_argument('--vprod', default=[], dest='vprod', action='append', + help='Value text, produced for each enum value.') +parser.add_argument('--vtail', default=[], dest='vtail', action='append', + help='Value tail, produced after iterating over enum values') +parser.add_argument('--comments', default='', dest='comment_tmpl', + help='Comment structure') +parser.add_argument('--template', default='', dest='template', + help='Template file') +parser.add_argument('--output', default=None, dest='output') +parser.add_argument('--version', '-v', default=False, action='store_true', dest='version', + help='Print version information') +parser.add_argument('args', nargs='*', + help='One or more input files, or a single argument @rspfile_path ' + 'pointing to a file that contains the actual arguments') + +# Support reading an rspfile of the form @filename which contains the args +# to be parsed +if len(sys.argv) == 2 and sys.argv[1].startswith('@'): + args = get_rspfile_args(sys.argv[1][1:]) +else: + args = sys.argv[1:] + +options = parser.parse_args(args) + +if options.version: + print(VERSION_STR) + sys.exit(0) + +def unescape_cmdline_args(arg): + arg = arg.replace('\\n', '\n') + arg = arg.replace('\\r', '\r') + return arg.replace('\\t', '\t') + +if options.template != '': + read_template_file(options.template) + +idprefix += options.idprefix +symprefix += options.symprefix + +# This is a hack to maintain some semblance of backward compatibility with +# the old, Perl-based glib-mkenums. The old tool had an implicit ordering +# on the arguments and templates; each argument was parsed in order, and +# all the strings appended. This allowed developers to write: +# +# glib-mkenums \ +# --fhead ... \ +# --template a-template-file.c.in \ +# --ftail ... +# +# And have the fhead be prepended to the file-head stanza in the template, +# as well as the ftail be appended to the file-tail stanza in the template. +# Short of throwing away ArgumentParser and going over sys.argv[] element +# by element, we can simulate that behaviour by ensuring some ordering in +# how we build the template strings: +# +# - the head stanzas are always prepended to the template +# - the prod stanzas are always appended to the template +# - the tail stanzas are always appended to the template +# +# Within each instance of the command line argument, we append each value +# to the array in the order in which it appears on the command line. +fhead = ''.join([unescape_cmdline_args(x) for x in options.fhead]) + fhead +vhead = ''.join([unescape_cmdline_args(x) for x in options.vhead]) + vhead + +fprod += ''.join([unescape_cmdline_args(x) for x in options.fprod]) +eprod += ''.join([unescape_cmdline_args(x) for x in options.eprod]) +vprod += ''.join([unescape_cmdline_args(x) for x in options.vprod]) + +ftail = ftail + ''.join([unescape_cmdline_args(x) for x in options.ftail]) +vtail = vtail + ''.join([unescape_cmdline_args(x) for x in options.vtail]) + +if options.comment_tmpl != '': + comment_tmpl = unescape_cmdline_args(options.comment_tmpl) +elif comment_tmpl == "": + # default to C-style comments + comment_tmpl = "/* \u0040comment\u0040 */" + +output = options.output + +if output is not None: + (out_dir, out_fn) = os.path.split(options.output) + out_suffix = '_' + os.path.splitext(out_fn)[1] + if out_dir == '': + out_dir = '.' + fd, filename = tempfile.mkstemp(dir=out_dir) + os.close(fd) + tmpfile = io.open(filename, "w", encoding="utf-8") + output_stream = tmpfile +else: + tmpfile = None + +# put auto-generation comment +comment = comment_tmpl.replace('\u0040comment\u0040', + 'This file is generated by glib-mkenums, do ' + 'not modify it. This code is licensed under ' + 'the same license as the containing project. ' + 'Note that it links to GLib, so must comply ' + 'with the LGPL linking clauses.') +write_output("\n" + comment + '\n') + +def replace_specials(prod): + prod = prod.replace(r'\\a', r'\a') + prod = prod.replace(r'\\b', r'\b') + prod = prod.replace(r'\\t', r'\t') + prod = prod.replace(r'\\n', r'\n') + prod = prod.replace(r'\\f', r'\f') + prod = prod.replace(r'\\r', r'\r') + prod = prod.rstrip() + return prod + + +def warn_if_filename_basename_used(section, prod): + for substitution in ('\u0040filename\u0040', + '\u0040basename\u0040'): + if substitution in prod: + print_warning('{} used in {} section.'.format(substitution, + section)) + +if len(fhead) > 0: + prod = fhead + warn_if_filename_basename_used('file-header', prod) + prod = replace_specials(prod) + write_output(prod) + +def process_file(curfilename): + global entries, flags, seenbitshift, enum_prefix + firstenum = True + + try: + curfile = io.open(curfilename, encoding="utf-8", + errors="replace_and_warn") + except IOError as e: + if e.errno == errno.ENOENT: + print_warning('No file "{}" found.'.format(curfilename)) + return + raise + + while True: + line = curfile.readline() + if not line: + break + + line = line.strip() + + # read lines until we have no open comments + while re.search(r'/\*([^*]|\*(?!/))*$', line): + line += curfile.readline() + + # strip comments w/o options + line = re.sub(r'''/\*(?!<) + ([^*]+|\*(?!/))* + \*/''', '', line) + + # ignore forward declarations + if re.match(r'\s*typedef\s+enum.*;', line): + continue + + m = re.match(r'''\s*typedef\s+enum\s*[_A-Za-z]*[_A-Za-z0-9]*\s* + ({)?\s* + (?:/\*< + (([^*]|\*(?!/))*) + >\s*\*/)? + \s*({)?''', line, flags=re.X) + if m: + groups = m.groups() + if len(groups) >= 2 and groups[1] is not None: + options = parse_trigraph(groups[1]) + if 'skip' in options: + continue + enum_prefix = options.get('prefix', None) + flags = options.get('flags', None) + if 'flags' in options: + if flags is None: + flags = 1 + else: + flags = int(flags) + option_lowercase_name = options.get('lowercase_name', None) + option_underscore_name = options.get('underscore_name', None) + option_since = options.get('since', None) + else: + enum_prefix = None + flags = None + option_lowercase_name = None + option_underscore_name = None + option_since = None + + if option_lowercase_name is not None: + if option_underscore_name is not None: + print_warning("lowercase_name overridden with underscore_name") + option_lowercase_name = None + else: + print_warning("lowercase_name is deprecated, use underscore_name") + + # Didn't have trailing '{' look on next lines + if groups[0] is None and (len(groups) < 4 or groups[3] is None): + while True: + line = curfile.readline() + if not line: + print_error("Syntax error when looking for opening { in enum") + if re.match(r'\s*\{', line): + break + + seenbitshift = 0 + entries = [] + + # Now parse the entries + parse_entries(curfile, curfilename) + + # figure out if this was a flags or enums enumeration + if flags is None: + flags = seenbitshift + + # Autogenerate a prefix + if enum_prefix is None: + for entry in entries: + if len(entry) < 3 or entry[2] is None: + name = entry[0] + if enum_prefix is not None: + enum_prefix = os.path.commonprefix([name, enum_prefix]) + else: + enum_prefix = name + if enum_prefix is None: + enum_prefix = "" + else: + # Trim so that it ends in an underscore + enum_prefix = re.sub(r'_[^_]*$', '_', enum_prefix) + else: + # canonicalize user defined prefixes + enum_prefix = enum_prefix.upper() + enum_prefix = enum_prefix.replace('-', '_') + enum_prefix = re.sub(r'(.*)([^_])$', r'\1\2_', enum_prefix) + + fixed_entries = [] + for e in entries: + name = e[0] + num = e[1] + if len(e) < 3 or e[2] is None: + nick = re.sub(r'^' + enum_prefix, '', name) + nick = nick.replace('_', '-').lower() + e = (name, num, nick) + fixed_entries.append(e) + entries = fixed_entries + + # Spit out the output + if option_underscore_name is not None: + enumlong = option_underscore_name.upper() + enumsym = option_underscore_name.lower() + enumshort = re.sub(r'^[A-Z][A-Z0-9]*_', '', enumlong) + + enumname_prefix = re.sub('_' + enumshort + '$', '', enumlong) + elif symprefix == '' and idprefix == '': + # enumname is e.g. GMatchType + enspace = re.sub(r'^([A-Z][a-z]*).*$', r'\1', enumname) + + enumshort = re.sub(r'^[A-Z][a-z]*', '', enumname) + enumshort = re.sub(r'([^A-Z])([A-Z])', r'\1_\2', enumshort) + enumshort = re.sub(r'([A-Z][A-Z])([A-Z][0-9a-z])', r'\1_\2', enumshort) + enumshort = enumshort.upper() + + enumname_prefix = re.sub(r'^([A-Z][a-z]*).*$', r'\1', enumname).upper() + + enumlong = enspace.upper() + "_" + enumshort + enumsym = enspace.lower() + "_" + enumshort.lower() + + if option_lowercase_name is not None: + enumsym = option_lowercase_name + else: + enumshort = enumname + if idprefix: + enumshort = re.sub(r'^' + idprefix, '', enumshort) + else: + enumshort = re.sub(r'/^[A-Z][a-z]*', '', enumshort) + + enumshort = re.sub(r'([^A-Z])([A-Z])', r'\1_\2', enumshort) + enumshort = re.sub(r'([A-Z][A-Z])([A-Z][0-9a-z])', r'\1_\2', enumshort) + enumshort = enumshort.upper() + + if symprefix: + enumname_prefix = symprefix.upper() + else: + enumname_prefix = idprefix.upper() + + enumlong = enumname_prefix + "_" + enumshort + enumsym = enumlong.lower() + + if option_since is not None: + enumsince = option_since + else: + enumsince = "" + + if firstenum: + firstenum = False + + if len(fprod) > 0: + prod = fprod + base = os.path.basename(curfilename) + + prod = prod.replace('\u0040filename\u0040', curfilename) + prod = prod.replace('\u0040basename\u0040', base) + prod = replace_specials(prod) + + write_output(prod) + + if len(eprod) > 0: + prod = eprod + + prod = prod.replace('\u0040enum_name\u0040', enumsym) + prod = prod.replace('\u0040EnumName\u0040', enumname) + prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort) + prod = prod.replace('\u0040ENUMNAME\u0040', enumlong) + prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix) + prod = prod.replace('\u0040enumsince\u0040', enumsince) + if flags: + prod = prod.replace('\u0040type\u0040', 'flags') + else: + prod = prod.replace('\u0040type\u0040', 'enum') + if flags: + prod = prod.replace('\u0040Type\u0040', 'Flags') + else: + prod = prod.replace('\u0040Type\u0040', 'Enum') + if flags: + prod = prod.replace('\u0040TYPE\u0040', 'FLAGS') + else: + prod = prod.replace('\u0040TYPE\u0040', 'ENUM') + prod = replace_specials(prod) + write_output(prod) + + if len(vhead) > 0: + prod = vhead + prod = prod.replace('\u0040enum_name\u0040', enumsym) + prod = prod.replace('\u0040EnumName\u0040', enumname) + prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort) + prod = prod.replace('\u0040ENUMNAME\u0040', enumlong) + prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix) + prod = prod.replace('\u0040enumsince\u0040', enumsince) + if flags: + prod = prod.replace('\u0040type\u0040', 'flags') + else: + prod = prod.replace('\u0040type\u0040', 'enum') + if flags: + prod = prod.replace('\u0040Type\u0040', 'Flags') + else: + prod = prod.replace('\u0040Type\u0040', 'Enum') + if flags: + prod = prod.replace('\u0040TYPE\u0040', 'FLAGS') + else: + prod = prod.replace('\u0040TYPE\u0040', 'ENUM') + prod = replace_specials(prod) + write_output(prod) + + if len(vprod) > 0: + prod = vprod + next_num = 0 + + prod = replace_specials(prod) + for name, num, nick in entries: + tmp_prod = prod + + if '\u0040valuenum\u0040' in prod: + # only attempt to eval the value if it is requested + # this prevents us from throwing errors otherwise + if num is not None: + # use sandboxed evaluation as a reasonable + # approximation to C constant folding + inum = eval(num, {}, {}) + + # make sure it parsed to an integer + if not isinstance(inum, int): + sys.exit("Unable to parse enum value '%s'" % num) + num = inum + else: + num = next_num + + tmp_prod = tmp_prod.replace('\u0040valuenum\u0040', str(num)) + next_num = int(num) + 1 + + tmp_prod = tmp_prod.replace('\u0040VALUENAME\u0040', name) + tmp_prod = tmp_prod.replace('\u0040valuenick\u0040', nick) + if flags: + tmp_prod = tmp_prod.replace('\u0040type\u0040', 'flags') + else: + tmp_prod = tmp_prod.replace('\u0040type\u0040', 'enum') + if flags: + tmp_prod = tmp_prod.replace('\u0040Type\u0040', 'Flags') + else: + tmp_prod = tmp_prod.replace('\u0040Type\u0040', 'Enum') + if flags: + tmp_prod = tmp_prod.replace('\u0040TYPE\u0040', 'FLAGS') + else: + tmp_prod = tmp_prod.replace('\u0040TYPE\u0040', 'ENUM') + tmp_prod = tmp_prod.rstrip() + + write_output(tmp_prod) + + if len(vtail) > 0: + prod = vtail + prod = prod.replace('\u0040enum_name\u0040', enumsym) + prod = prod.replace('\u0040EnumName\u0040', enumname) + prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort) + prod = prod.replace('\u0040ENUMNAME\u0040', enumlong) + prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix) + prod = prod.replace('\u0040enumsince\u0040', enumsince) + if flags: + prod = prod.replace('\u0040type\u0040', 'flags') + else: + prod = prod.replace('\u0040type\u0040', 'enum') + if flags: + prod = prod.replace('\u0040Type\u0040', 'Flags') + else: + prod = prod.replace('\u0040Type\u0040', 'Enum') + if flags: + prod = prod.replace('\u0040TYPE\u0040', 'FLAGS') + else: + prod = prod.replace('\u0040TYPE\u0040', 'ENUM') + prod = replace_specials(prod) + write_output(prod) + +for fname in sorted(options.args): + process_file(fname) + +if len(ftail) > 0: + prod = ftail + warn_if_filename_basename_used('file-tail', prod) + prod = replace_specials(prod) + write_output(prod) + +# put auto-generation comment +comment = comment_tmpl +comment = comment.replace('\u0040comment\u0040', 'Generated data ends here') +write_output("\n" + comment + "\n") + +if tmpfile is not None: + tmpfilename = tmpfile.name + tmpfile.close() + + try: + os.unlink(options.output) + except OSError as error: + if error.errno != errno.ENOENT: + raise error + + os.rename(tmpfilename, options.output) diff --git a/deps/glib/include/glib-object.h b/deps/glib/include/glib-2.0/glib-object.h similarity index 100% rename from deps/glib/include/glib-object.h rename to deps/glib/include/glib-2.0/glib-object.h diff --git a/deps/glib/include/glib-unix.h b/deps/glib/include/glib-2.0/glib-unix.h similarity index 100% rename from deps/glib/include/glib-unix.h rename to deps/glib/include/glib-2.0/glib-unix.h diff --git a/deps/glib/include/glib.h b/deps/glib/include/glib-2.0/glib.h similarity index 99% rename from deps/glib/include/glib.h rename to deps/glib/include/glib-2.0/glib.h index e3b30558..fe8ce88d 100644 --- a/deps/glib/include/glib.h +++ b/deps/glib/include/glib-2.0/glib.h @@ -91,7 +91,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/deps/glib/include/glib/deprecated/gallocator.h b/deps/glib/include/glib-2.0/glib/deprecated/gallocator.h similarity index 100% rename from deps/glib/include/glib/deprecated/gallocator.h rename to deps/glib/include/glib-2.0/glib/deprecated/gallocator.h diff --git a/deps/glib/include/glib/deprecated/gcache.h b/deps/glib/include/glib-2.0/glib/deprecated/gcache.h similarity index 100% rename from deps/glib/include/glib/deprecated/gcache.h rename to deps/glib/include/glib-2.0/glib/deprecated/gcache.h diff --git a/deps/glib/include/glib/deprecated/gcompletion.h b/deps/glib/include/glib-2.0/glib/deprecated/gcompletion.h similarity index 100% rename from deps/glib/include/glib/deprecated/gcompletion.h rename to deps/glib/include/glib-2.0/glib/deprecated/gcompletion.h diff --git a/deps/glib/include/glib/deprecated/gmain.h b/deps/glib/include/glib-2.0/glib/deprecated/gmain.h similarity index 98% rename from deps/glib/include/glib/deprecated/gmain.h rename to deps/glib/include/glib-2.0/glib/deprecated/gmain.h index 2199328f..5d08eb6b 100644 --- a/deps/glib/include/glib/deprecated/gmain.h +++ b/deps/glib/include/glib-2.0/glib/deprecated/gmain.h @@ -115,7 +115,7 @@ G_BEGIN_DECLS * * Returns: %TRUE if any events are pending. * - * Deprected: 2.2: Use g_main_context_pending() instead. + * Deprecated: 2.2: Use g_main_context_pending() instead. */ #define g_main_pending() g_main_context_pending (NULL) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_pending) diff --git a/deps/glib/include/glib/deprecated/grel.h b/deps/glib/include/glib-2.0/glib/deprecated/grel.h similarity index 100% rename from deps/glib/include/glib/deprecated/grel.h rename to deps/glib/include/glib-2.0/glib/deprecated/grel.h diff --git a/deps/glib/include/glib/deprecated/gthread.h b/deps/glib/include/glib-2.0/glib/deprecated/gthread.h similarity index 100% rename from deps/glib/include/glib/deprecated/gthread.h rename to deps/glib/include/glib-2.0/glib/deprecated/gthread.h diff --git a/deps/glib/include/glib/galloca.h b/deps/glib/include/glib-2.0/glib/galloca.h similarity index 100% rename from deps/glib/include/glib/galloca.h rename to deps/glib/include/glib-2.0/glib/galloca.h diff --git a/deps/glib/include/glib/garray.h b/deps/glib/include/glib-2.0/glib/garray.h similarity index 100% rename from deps/glib/include/glib/garray.h rename to deps/glib/include/glib-2.0/glib/garray.h diff --git a/deps/glib/include/glib/gasyncqueue.h b/deps/glib/include/glib-2.0/glib/gasyncqueue.h similarity index 100% rename from deps/glib/include/glib/gasyncqueue.h rename to deps/glib/include/glib-2.0/glib/gasyncqueue.h diff --git a/deps/glib/include/glib/gatomic.h b/deps/glib/include/glib-2.0/glib/gatomic.h similarity index 100% rename from deps/glib/include/glib/gatomic.h rename to deps/glib/include/glib-2.0/glib/gatomic.h diff --git a/deps/glib/include/glib/gbacktrace.h b/deps/glib/include/glib-2.0/glib/gbacktrace.h similarity index 96% rename from deps/glib/include/glib/gbacktrace.h rename to deps/glib/include/glib-2.0/glib/gbacktrace.h index 9e9cba15..09b8ccbd 100644 --- a/deps/glib/include/glib/gbacktrace.h +++ b/deps/glib/include/glib-2.0/glib/gbacktrace.h @@ -61,7 +61,7 @@ void g_on_error_stack_trace (const gchar *prg_name); # define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END #elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 # define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END -#elif defined (__APPLE__) +#elif defined (__APPLE__) || (defined(_WIN32) && (defined(__clang__) || defined(__GNUC__))) # define G_BREAKPOINT() G_STMT_START{ __builtin_trap(); }G_STMT_END #else /* !__i386__ && !__alpha__ */ # define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END diff --git a/deps/glib/include/glib/gbase64.h b/deps/glib/include/glib-2.0/glib/gbase64.h similarity index 100% rename from deps/glib/include/glib/gbase64.h rename to deps/glib/include/glib-2.0/glib/gbase64.h diff --git a/deps/glib/include/glib/gbitlock.h b/deps/glib/include/glib-2.0/glib/gbitlock.h similarity index 100% rename from deps/glib/include/glib/gbitlock.h rename to deps/glib/include/glib-2.0/glib/gbitlock.h diff --git a/deps/glib/include/glib/gbookmarkfile.h b/deps/glib/include/glib-2.0/glib/gbookmarkfile.h similarity index 74% rename from deps/glib/include/glib/gbookmarkfile.h rename to deps/glib/include/glib-2.0/glib/gbookmarkfile.h index 8dd93a1d..e9cfbf12 100644 --- a/deps/glib/include/glib/gbookmarkfile.h +++ b/deps/glib/include/glib-2.0/glib/gbookmarkfile.h @@ -23,6 +23,7 @@ #error "Only can be included directly." #endif +#include #include #include @@ -162,7 +163,7 @@ gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark, const gchar *uri, gsize *length, GError **error); -GLIB_AVAILABLE_IN_ALL +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_application_info) gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, @@ -170,7 +171,15 @@ gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, gint count, time_t stamp, GError **error); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +gboolean g_bookmark_file_set_application_info (GBookmarkFile *bookmark, + const char *uri, + const char *name, + const char *exec, + int count, + GDateTime *stamp, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_application_info) gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, @@ -178,6 +187,14 @@ gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark, guint *count, time_t *stamp, GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_bookmark_file_get_application_info (GBookmarkFile *bookmark, + const char *uri, + const char *name, + char **exec, + unsigned int *count, + GDateTime **stamp, + GError **error); GLIB_AVAILABLE_IN_ALL void g_bookmark_file_set_is_private (GBookmarkFile *bookmark, const gchar *uri, @@ -197,30 +214,54 @@ gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark, gchar **href, gchar **mime_type, GError **error); -GLIB_AVAILABLE_IN_ALL +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_added_date_time) void g_bookmark_file_set_added (GBookmarkFile *bookmark, const gchar *uri, time_t added); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_added_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *added); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_added_date_time) time_t g_bookmark_file_get_added (GBookmarkFile *bookmark, const gchar *uri, GError **error); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_added_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_modified_date_time) void g_bookmark_file_set_modified (GBookmarkFile *bookmark, const gchar *uri, time_t modified); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_modified_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *modified); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_modified_date_time) time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark, const gchar *uri, GError **error); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_modified_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_visited_date_time) void g_bookmark_file_set_visited (GBookmarkFile *bookmark, const gchar *uri, time_t visited); -GLIB_AVAILABLE_IN_ALL +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_visited_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *visited); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_visited_date_time) time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark, const gchar *uri, GError **error); +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_visited_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark, const gchar *uri); diff --git a/deps/glib/include/glib/gbytes.h b/deps/glib/include/glib-2.0/glib/gbytes.h similarity index 100% rename from deps/glib/include/glib/gbytes.h rename to deps/glib/include/glib-2.0/glib/gbytes.h diff --git a/deps/glib/include/glib/gcharset.h b/deps/glib/include/glib-2.0/glib/gcharset.h similarity index 100% rename from deps/glib/include/glib/gcharset.h rename to deps/glib/include/glib-2.0/glib/gcharset.h diff --git a/deps/glib/include/glib/gchecksum.h b/deps/glib/include/glib-2.0/glib/gchecksum.h similarity index 100% rename from deps/glib/include/glib/gchecksum.h rename to deps/glib/include/glib-2.0/glib/gchecksum.h diff --git a/deps/glib/include/glib/gconvert.h b/deps/glib/include/glib-2.0/glib/gconvert.h similarity index 100% rename from deps/glib/include/glib/gconvert.h rename to deps/glib/include/glib-2.0/glib/gconvert.h diff --git a/deps/glib/include/glib/gdataset.h b/deps/glib/include/glib-2.0/glib/gdataset.h similarity index 100% rename from deps/glib/include/glib/gdataset.h rename to deps/glib/include/glib-2.0/glib/gdataset.h diff --git a/deps/glib/include/glib/gdate.h b/deps/glib/include/glib-2.0/glib/gdate.h similarity index 100% rename from deps/glib/include/glib/gdate.h rename to deps/glib/include/glib-2.0/glib/gdate.h diff --git a/deps/glib/include/glib/gdatetime.h b/deps/glib/include/glib-2.0/glib/gdatetime.h similarity index 100% rename from deps/glib/include/glib/gdatetime.h rename to deps/glib/include/glib-2.0/glib/gdatetime.h diff --git a/deps/glib/include/glib/gdir.h b/deps/glib/include/glib-2.0/glib/gdir.h similarity index 100% rename from deps/glib/include/glib/gdir.h rename to deps/glib/include/glib-2.0/glib/gdir.h diff --git a/deps/glib/include/glib/genviron.h b/deps/glib/include/glib-2.0/glib/genviron.h similarity index 100% rename from deps/glib/include/glib/genviron.h rename to deps/glib/include/glib-2.0/glib/genviron.h diff --git a/deps/glib/include/glib/gerror.h b/deps/glib/include/glib-2.0/glib/gerror.h similarity index 100% rename from deps/glib/include/glib/gerror.h rename to deps/glib/include/glib-2.0/glib/gerror.h diff --git a/deps/glib/include/glib/gfileutils.h b/deps/glib/include/glib-2.0/glib/gfileutils.h similarity index 73% rename from deps/glib/include/glib/gfileutils.h rename to deps/glib/include/glib-2.0/glib/gfileutils.h index f60fad85..d6b1d9ee 100644 --- a/deps/glib/include/glib/gfileutils.h +++ b/deps/glib/include/glib-2.0/glib/gfileutils.h @@ -72,6 +72,39 @@ typedef enum G_FILE_TEST_EXISTS = 1 << 4 } GFileTest; +/** + * GFileSetContentsFlags: + * @G_FILE_SET_CONTENTS_NONE: No guarantees about file consistency or durability. + * The most dangerous setting, which is slightly faster than other settings. + * @G_FILE_SET_CONTENTS_CONSISTENT: Guarantee file consistency: after a crash, + * either the old version of the file or the new version of the file will be + * available, but not a mixture. On Unix systems this equates to an `fsync()` + * on the file and use of an atomic `rename()` of the new version of the file + * over the old. + * @G_FILE_SET_CONTENTS_DURABLE: Guarantee file durability: after a crash, the + * new version of the file will be available. On Unix systems this equates to + * an `fsync()` on the file (if %G_FILE_SET_CONTENTS_CONSISTENT is unset), or + * the effects of %G_FILE_SET_CONTENTS_CONSISTENT plus an `fsync()` on the + * directory containing the file after calling `rename()`. + * @G_FILE_SET_CONTENTS_ONLY_EXISTING: Only apply consistency and durability + * guarantees if the file already exists. This may speed up file operations + * if the file doesn’t currently exist, but may result in a corrupted version + * of the new file if the system crashes while writing it. + * + * Flags to pass to g_file_set_contents_full() to affect its safety and + * performance. + * + * Since: 2.66 + */ +typedef enum +{ + G_FILE_SET_CONTENTS_NONE = 0, + G_FILE_SET_CONTENTS_CONSISTENT = 1 << 0, + G_FILE_SET_CONTENTS_DURABLE = 1 << 1, + G_FILE_SET_CONTENTS_ONLY_EXISTING = 1 << 2 +} GFileSetContentsFlags +GLIB_AVAILABLE_ENUMERATOR_IN_2_66; + GLIB_AVAILABLE_IN_ALL GQuark g_file_error_quark (void); /* So other code can generate a GFileError */ @@ -91,6 +124,15 @@ gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_2_66 +gboolean g_file_set_contents_full (const gchar *filename, + const gchar *contents, + gssize length, + GFileSetContentsFlags flags, + int mode, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gchar *g_file_read_link (const gchar *filename, GError **error); diff --git a/deps/glib/include/glib/ggettext.h b/deps/glib/include/glib-2.0/glib/ggettext.h similarity index 100% rename from deps/glib/include/glib/ggettext.h rename to deps/glib/include/glib-2.0/glib/ggettext.h diff --git a/deps/glib/include/glib/ghash.h b/deps/glib/include/glib-2.0/glib/ghash.h similarity index 100% rename from deps/glib/include/glib/ghash.h rename to deps/glib/include/glib-2.0/glib/ghash.h diff --git a/deps/glib/include/glib/ghmac.h b/deps/glib/include/glib-2.0/glib/ghmac.h similarity index 100% rename from deps/glib/include/glib/ghmac.h rename to deps/glib/include/glib-2.0/glib/ghmac.h diff --git a/deps/glib/include/glib/ghook.h b/deps/glib/include/glib-2.0/glib/ghook.h similarity index 100% rename from deps/glib/include/glib/ghook.h rename to deps/glib/include/glib-2.0/glib/ghook.h diff --git a/deps/glib/include/glib/ghostutils.h b/deps/glib/include/glib-2.0/glib/ghostutils.h similarity index 100% rename from deps/glib/include/glib/ghostutils.h rename to deps/glib/include/glib-2.0/glib/ghostutils.h diff --git a/deps/glib/include/glib/gi18n-lib.h b/deps/glib/include/glib-2.0/glib/gi18n-lib.h similarity index 100% rename from deps/glib/include/glib/gi18n-lib.h rename to deps/glib/include/glib-2.0/glib/gi18n-lib.h diff --git a/deps/glib/include/glib/gi18n.h b/deps/glib/include/glib-2.0/glib/gi18n.h similarity index 100% rename from deps/glib/include/glib/gi18n.h rename to deps/glib/include/glib-2.0/glib/gi18n.h diff --git a/deps/glib/include/glib/giochannel.h b/deps/glib/include/glib-2.0/glib/giochannel.h similarity index 100% rename from deps/glib/include/glib/giochannel.h rename to deps/glib/include/glib-2.0/glib/giochannel.h diff --git a/deps/glib/include/glib/gkeyfile.h b/deps/glib/include/glib-2.0/glib/gkeyfile.h similarity index 100% rename from deps/glib/include/glib/gkeyfile.h rename to deps/glib/include/glib-2.0/glib/gkeyfile.h diff --git a/deps/glib/include/glib/glib-autocleanups.h b/deps/glib/include/glib-2.0/glib/glib-autocleanups.h similarity index 97% rename from deps/glib/include/glib/glib-autocleanups.h rename to deps/glib/include/glib-2.0/glib/glib-autocleanups.h index acd38a7a..2fa4b969 100644 --- a/deps/glib/include/glib/glib-autocleanups.h +++ b/deps/glib/include/glib-2.0/glib/glib-autocleanups.h @@ -96,6 +96,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (GRefString, g_ref_string_release) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/deps/glib/include/glib/glist.h b/deps/glib/include/glib-2.0/glib/glist.h similarity index 100% rename from deps/glib/include/glib/glist.h rename to deps/glib/include/glib-2.0/glib/glist.h diff --git a/deps/glib/include/glib/gmacros.h b/deps/glib/include/glib-2.0/glib/gmacros.h similarity index 99% rename from deps/glib/include/glib/gmacros.h rename to deps/glib/include/glib-2.0/glib/gmacros.h index a770ac73..d953de4c 100644 --- a/deps/glib/include/glib/gmacros.h +++ b/deps/glib/include/glib-2.0/glib/gmacros.h @@ -89,7 +89,7 @@ * in a compatible way before this feature was supported in all * compilers. These days, GLib requires inlining support from the * compiler, so your GLib-using programs can safely assume that the - * "inline" keywork works properly. + * "inline" keyword works properly. * * Never use this macro anymore. Just say "static inline". * @@ -532,7 +532,7 @@ /** * G_GNUC_FALLTHROUGH: * - * Expands to the GNU C `fallthrough` statement attribute if the compiler is gcc. + * Expands to the GNU C `fallthrough` statement attribute if the compiler supports it. * This allows declaring case statement to explicitly fall through in switch * statements. To enable this feature, use `-Wimplicit-fallthrough` during * compilation. @@ -559,6 +559,8 @@ */ #if __GNUC__ > 6 #define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) +#elif g_macro__has_attribute (fallthrough) +#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) #else #define G_GNUC_FALLTHROUGH #endif /* __GNUC__ */ @@ -976,10 +978,12 @@ #define GLIB_DEPRECATED _GLIB_EXTERN #define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN #define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN +#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) #else #define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN #define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN #define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN +#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) #endif #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ diff --git a/deps/glib/include/glib/gmain.h b/deps/glib/include/glib-2.0/glib/gmain.h similarity index 99% rename from deps/glib/include/glib/gmain.h rename to deps/glib/include/glib-2.0/glib/gmain.h index d4776c19..5c0e524c 100644 --- a/deps/glib/include/glib/gmain.h +++ b/deps/glib/include/glib-2.0/glib/gmain.h @@ -499,6 +499,7 @@ typedef void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64; * Since: 2.64 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 static inline GMainContextPusher * g_main_context_pusher_new (GMainContext *main_context) { @@ -520,6 +521,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS * Since: 2.64 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 static inline void g_main_context_pusher_free (GMainContextPusher *pusher) { diff --git a/deps/glib/include/glib/gmappedfile.h b/deps/glib/include/glib-2.0/glib/gmappedfile.h similarity index 100% rename from deps/glib/include/glib/gmappedfile.h rename to deps/glib/include/glib-2.0/glib/gmappedfile.h diff --git a/deps/glib/include/glib/gmarkup.h b/deps/glib/include/glib-2.0/glib/gmarkup.h similarity index 100% rename from deps/glib/include/glib/gmarkup.h rename to deps/glib/include/glib-2.0/glib/gmarkup.h diff --git a/deps/glib/include/glib/gmem.h b/deps/glib/include/glib-2.0/glib/gmem.h similarity index 99% rename from deps/glib/include/glib/gmem.h rename to deps/glib/include/glib-2.0/glib/gmem.h index 953a0182..45671073 100644 --- a/deps/glib/include/glib/gmem.h +++ b/deps/glib/include/glib-2.0/glib/gmem.h @@ -197,6 +197,7 @@ gpointer g_try_realloc_n (gpointer mem, * * Since: 2.44 */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 static inline gpointer g_steal_pointer (gpointer pp) { diff --git a/deps/glib/include/glib/gmessages.h b/deps/glib/include/glib-2.0/glib/gmessages.h similarity index 100% rename from deps/glib/include/glib/gmessages.h rename to deps/glib/include/glib-2.0/glib/gmessages.h diff --git a/deps/glib/include/glib/gnode.h b/deps/glib/include/glib-2.0/glib/gnode.h similarity index 100% rename from deps/glib/include/glib/gnode.h rename to deps/glib/include/glib-2.0/glib/gnode.h diff --git a/deps/glib/include/glib/goption.h b/deps/glib/include/glib-2.0/glib/goption.h similarity index 100% rename from deps/glib/include/glib/goption.h rename to deps/glib/include/glib-2.0/glib/goption.h diff --git a/deps/glib/include/glib/gpattern.h b/deps/glib/include/glib-2.0/glib/gpattern.h similarity index 100% rename from deps/glib/include/glib/gpattern.h rename to deps/glib/include/glib-2.0/glib/gpattern.h diff --git a/deps/glib/include/glib/gpoll.h b/deps/glib/include/glib-2.0/glib/gpoll.h similarity index 100% rename from deps/glib/include/glib/gpoll.h rename to deps/glib/include/glib-2.0/glib/gpoll.h diff --git a/deps/glib/include/glib/gprimes.h b/deps/glib/include/glib-2.0/glib/gprimes.h similarity index 100% rename from deps/glib/include/glib/gprimes.h rename to deps/glib/include/glib-2.0/glib/gprimes.h diff --git a/deps/glib/include/glib/gprintf.h b/deps/glib/include/glib-2.0/glib/gprintf.h similarity index 100% rename from deps/glib/include/glib/gprintf.h rename to deps/glib/include/glib-2.0/glib/gprintf.h diff --git a/deps/glib/include/glib/gqsort.h b/deps/glib/include/glib-2.0/glib/gqsort.h similarity index 100% rename from deps/glib/include/glib/gqsort.h rename to deps/glib/include/glib-2.0/glib/gqsort.h diff --git a/deps/glib/include/glib/gquark.h b/deps/glib/include/glib-2.0/glib/gquark.h similarity index 100% rename from deps/glib/include/glib/gquark.h rename to deps/glib/include/glib-2.0/glib/gquark.h diff --git a/deps/glib/include/glib/gqueue.h b/deps/glib/include/glib-2.0/glib/gqueue.h similarity index 100% rename from deps/glib/include/glib/gqueue.h rename to deps/glib/include/glib-2.0/glib/gqueue.h diff --git a/deps/glib/include/glib/grand.h b/deps/glib/include/glib-2.0/glib/grand.h similarity index 97% rename from deps/glib/include/glib/grand.h rename to deps/glib/include/glib-2.0/glib/grand.h index 82528c77..d64e5025 100644 --- a/deps/glib/include/glib/grand.h +++ b/deps/glib/include/glib-2.0/glib/grand.h @@ -37,7 +37,7 @@ typedef struct _GRand GRand; /* GRand - a good and fast random number generator: Mersenne Twister * see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for more info. - * The range functions return a value in the intervall [begin, end). + * The range functions return a value in the interval [begin, end). * int -> [0..2^32-1] * int_range -> [begin..end-1] * double -> [0..1) diff --git a/deps/glib/include/glib/grcbox.h b/deps/glib/include/glib-2.0/glib/grcbox.h similarity index 100% rename from deps/glib/include/glib/grcbox.h rename to deps/glib/include/glib-2.0/glib/grcbox.h diff --git a/deps/glib/include/glib/grefcount.h b/deps/glib/include/glib-2.0/glib/grefcount.h similarity index 100% rename from deps/glib/include/glib/grefcount.h rename to deps/glib/include/glib-2.0/glib/grefcount.h diff --git a/deps/glib/include/glib/grefstring.h b/deps/glib/include/glib-2.0/glib/grefstring.h similarity index 100% rename from deps/glib/include/glib/grefstring.h rename to deps/glib/include/glib-2.0/glib/grefstring.h diff --git a/deps/glib/include/glib/gregex.h b/deps/glib/include/glib-2.0/glib/gregex.h similarity index 100% rename from deps/glib/include/glib/gregex.h rename to deps/glib/include/glib-2.0/glib/gregex.h diff --git a/deps/glib/include/glib/gscanner.h b/deps/glib/include/glib-2.0/glib/gscanner.h similarity index 100% rename from deps/glib/include/glib/gscanner.h rename to deps/glib/include/glib-2.0/glib/gscanner.h diff --git a/deps/glib/include/glib/gsequence.h b/deps/glib/include/glib-2.0/glib/gsequence.h similarity index 100% rename from deps/glib/include/glib/gsequence.h rename to deps/glib/include/glib-2.0/glib/gsequence.h diff --git a/deps/glib/include/glib/gshell.h b/deps/glib/include/glib-2.0/glib/gshell.h similarity index 100% rename from deps/glib/include/glib/gshell.h rename to deps/glib/include/glib-2.0/glib/gshell.h diff --git a/deps/glib/include/glib/gslice.h b/deps/glib/include/glib-2.0/glib/gslice.h similarity index 83% rename from deps/glib/include/glib/gslice.h rename to deps/glib/include/glib-2.0/glib/gslice.h index ff8b02a6..00241063 100644 --- a/deps/glib/include/glib/gslice.h +++ b/deps/glib/include/glib-2.0/glib/gslice.h @@ -23,6 +23,7 @@ #endif #include +#include G_BEGIN_DECLS @@ -43,7 +44,22 @@ void g_slice_free_chain_with_offset (gsize block_size, gpointer mem_chain, gsize next_offset); #define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type))) -#define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) + +/* Allow the compiler to inline memset(). Since the size is a constant, this + * can significantly improve performance. */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# define g_slice_new0(type) \ + (type *) (G_GNUC_EXTENSION ({ \ + gsize __s = sizeof (type); \ + gpointer __p; \ + __p = g_slice_alloc (__s); \ + memset (__p, 0, __s); \ + __p; \ + })) +#else +# define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) +#endif + /* MemoryBlockType * * g_slice_dup (MemoryBlockType, * MemoryBlockType *mem_block); diff --git a/deps/glib/include/glib/gslist.h b/deps/glib/include/glib-2.0/glib/gslist.h similarity index 100% rename from deps/glib/include/glib/gslist.h rename to deps/glib/include/glib-2.0/glib/gslist.h diff --git a/deps/glib/include/glib/gspawn.h b/deps/glib/include/glib-2.0/glib/gspawn.h similarity index 99% rename from deps/glib/include/glib/gspawn.h rename to deps/glib/include/glib-2.0/glib/gspawn.h index 240aae76..f91453a3 100644 --- a/deps/glib/include/glib/gspawn.h +++ b/deps/glib/include/glib-2.0/glib/gspawn.h @@ -157,7 +157,7 @@ typedef void (* GSpawnChildSetupFunc) (gpointer user_data); * execute, while the remaining elements are the actual argument vector * to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]` * as the file to execute, and passes all of `argv` to the child. - * @G_SPAWN_SEARCH_PATH_FROM_ENVP: if `argv[0]` is not an abolute path, + * @G_SPAWN_SEARCH_PATH_FROM_ENVP: if `argv[0]` is not an absolute path, * it will be looked for in the `PATH` from the passed child environment. * Since: 2.34 * @G_SPAWN_CLOEXEC_PIPES: create all pipes with the `O_CLOEXEC` flag set. diff --git a/deps/glib/include/glib/gstdio.h b/deps/glib/include/glib-2.0/glib/gstdio.h similarity index 100% rename from deps/glib/include/glib/gstdio.h rename to deps/glib/include/glib-2.0/glib/gstdio.h diff --git a/deps/glib/include/glib/gstrfuncs.h b/deps/glib/include/glib-2.0/glib/gstrfuncs.h similarity index 100% rename from deps/glib/include/glib/gstrfuncs.h rename to deps/glib/include/glib-2.0/glib/gstrfuncs.h diff --git a/deps/glib/include/glib/gstring.h b/deps/glib/include/glib-2.0/glib/gstring.h similarity index 100% rename from deps/glib/include/glib/gstring.h rename to deps/glib/include/glib-2.0/glib/gstring.h diff --git a/deps/glib/include/glib/gstringchunk.h b/deps/glib/include/glib-2.0/glib/gstringchunk.h similarity index 100% rename from deps/glib/include/glib/gstringchunk.h rename to deps/glib/include/glib-2.0/glib/gstringchunk.h diff --git a/deps/glib/include/glib/gtestutils.h b/deps/glib/include/glib-2.0/glib/gtestutils.h similarity index 96% rename from deps/glib/include/glib/gtestutils.h rename to deps/glib/include/glib-2.0/glib/gtestutils.h index 66b7ef3b..10b65c16 100644 --- a/deps/glib/include/glib/gtestutils.h +++ b/deps/glib/include/glib-2.0/glib/gtestutils.h @@ -27,6 +27,7 @@ #include #include #include +#include #include G_BEGIN_DECLS @@ -110,6 +111,20 @@ typedef void (*GTestFixtureFunc) (gpointer fixture, } \ } \ G_STMT_END +#define g_assert_no_errno(expr) G_STMT_START { \ + int __ret, __errsv; \ + errno = 0; \ + __ret = expr; \ + __errsv = errno; \ + if (__ret < 0) \ + { \ + gchar *__msg; \ + __msg = g_strdup_printf ("assertion failed (" #expr " >= 0): errno %i: %s", __errsv, g_strerror (__errsv)); \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ + g_free (__msg); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_66 #define g_assert_no_error(err) G_STMT_START { \ if (err) \ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ @@ -452,7 +467,7 @@ void g_assertion_message (const char *domain, const char *file, int line, const char *func, - const char *message); + const char *message) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_expr (const char *domain, const char *file, @@ -467,7 +482,7 @@ void g_assertion_message_cmpstr (const char *domain, const char *expr, const char *arg1, const char *cmp, - const char *arg2); + const char *arg2) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_cmpnum (const char *domain, const char *file, @@ -477,7 +492,7 @@ void g_assertion_message_cmpnum (const char *domain, long double arg1, const char *cmp, long double arg2, - char numtype); + char numtype) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_assertion_message_error (const char *domain, const char *file, @@ -486,7 +501,7 @@ void g_assertion_message_error (const char *domain, const char *expr, const GError *error, GQuark error_domain, - int error_code); + int error_code) G_ANALYZER_NORETURN; GLIB_AVAILABLE_IN_ALL void g_test_add_vtable (const char *testpath, gsize data_size, diff --git a/deps/glib/include/glib/gthread.h b/deps/glib/include/glib-2.0/glib/gthread.h similarity index 94% rename from deps/glib/include/glib/gthread.h rename to deps/glib/include/glib-2.0/glib/gthread.h index 980522bb..a30815eb 100644 --- a/deps/glib/include/glib/gthread.h +++ b/deps/glib/include/glib-2.0/glib/gthread.h @@ -234,14 +234,23 @@ GLIB_AVAILABLE_IN_ALL void g_once_init_leave (volatile void *location, gsize result); -#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED -# define g_once(once, func, arg) g_once_impl ((once), (func), (arg)) -#else /* !G_ATOMIC_OP_MEMORY_BARRIER_NEEDED*/ +/* Use C11-style atomic extensions to check the fast path for status=ready. If + * they are not available, fall back to using a mutex and condition variable in + * g_once_impl(). + * + * On the C11-style codepath, only the load of once->status needs to be atomic, + * as the writes to it and once->retval in g_once_impl() are related by a + * happens-before relation. Release-acquire semantics are defined such that any + * atomic/non-atomic write which happens-before a store/release is guaranteed to + * be seen by the load/acquire of the same atomic variable. */ +#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && defined(__ATOMIC_SEQ_CST) # define g_once(once, func, arg) \ - (((once)->status == G_ONCE_STATUS_READY) ? \ + ((__atomic_load_n (&(once)->status, __ATOMIC_ACQUIRE) == G_ONCE_STATUS_READY) ? \ (once)->retval : \ g_once_impl ((once), (func), (arg))) -#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */ +#else +# define g_once(once, func, arg) g_once_impl ((once), (func), (arg)) +#endif #ifdef __GNUC__ # define g_once_init_enter(location) \ @@ -317,6 +326,7 @@ typedef void GMutexLocker; * Returns: a #GMutexLocker * Since: 2.44 */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 static inline GMutexLocker * g_mutex_locker_new (GMutex *mutex) { @@ -334,6 +344,7 @@ g_mutex_locker_new (GMutex *mutex) * * Since: 2.44 */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 static inline void g_mutex_locker_free (GMutexLocker *locker) { @@ -391,6 +402,7 @@ typedef void GRecMutexLocker; * Since: 2.60 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 static inline GRecMutexLocker * g_rec_mutex_locker_new (GRecMutex *rec_mutex) { @@ -410,6 +422,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS * Since: 2.60 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 static inline void g_rec_mutex_locker_free (GRecMutexLocker *locker) { @@ -499,6 +512,7 @@ typedef void GRWLockWriterLocker; * Since: 2.62 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 static inline GRWLockWriterLocker * g_rw_lock_writer_locker_new (GRWLock *rw_lock) { @@ -519,6 +533,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS * Since: 2.62 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 static inline void g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker) { @@ -552,6 +567,7 @@ typedef void GRWLockReaderLocker; * Since: 2.62 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 static inline GRWLockReaderLocker * g_rw_lock_reader_locker_new (GRWLock *rw_lock) { @@ -572,6 +588,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS * Since: 2.62 */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 static inline void g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker) { diff --git a/deps/glib/include/glib/gthreadpool.h b/deps/glib/include/glib-2.0/glib/gthreadpool.h similarity index 100% rename from deps/glib/include/glib/gthreadpool.h rename to deps/glib/include/glib-2.0/glib/gthreadpool.h diff --git a/deps/glib/include/glib/gtimer.h b/deps/glib/include/glib-2.0/glib/gtimer.h similarity index 100% rename from deps/glib/include/glib/gtimer.h rename to deps/glib/include/glib-2.0/glib/gtimer.h diff --git a/deps/glib/include/glib/gtimezone.h b/deps/glib/include/glib-2.0/glib/gtimezone.h similarity index 100% rename from deps/glib/include/glib/gtimezone.h rename to deps/glib/include/glib-2.0/glib/gtimezone.h diff --git a/deps/glib/include/glib/gtrashstack.h b/deps/glib/include/glib-2.0/glib/gtrashstack.h similarity index 100% rename from deps/glib/include/glib/gtrashstack.h rename to deps/glib/include/glib-2.0/glib/gtrashstack.h diff --git a/deps/glib/include/glib/gtree.h b/deps/glib/include/glib-2.0/glib/gtree.h similarity index 100% rename from deps/glib/include/glib/gtree.h rename to deps/glib/include/glib-2.0/glib/gtree.h diff --git a/deps/glib/include/glib/gtypes.h b/deps/glib/include/glib-2.0/glib/gtypes.h similarity index 100% rename from deps/glib/include/glib/gtypes.h rename to deps/glib/include/glib-2.0/glib/gtypes.h diff --git a/deps/glib/include/glib/gunicode.h b/deps/glib/include/glib-2.0/glib/gunicode.h similarity index 98% rename from deps/glib/include/glib/gunicode.h rename to deps/glib/include/glib-2.0/glib/gunicode.h index 5663aec7..d7298038 100644 --- a/deps/glib/include/glib/gunicode.h +++ b/deps/glib/include/glib-2.0/glib/gunicode.h @@ -424,6 +424,10 @@ typedef enum * @G_UNICODE_SCRIPT_NANDINAGARI: Nand. Since: 2.62 * @G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG: Rohg. Since: 2.62 * @G_UNICODE_SCRIPT_WANCHO: Wcho. Since: 2.62 + * @G_UNICODE_SCRIPT_CHORASMIAN: Chorasmian. Since: 2.66 + * @G_UNICODE_SCRIPT_DIVES_AKURU: Dives Akuru. Since: 2.66 + * @G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT: Khitan small script. Since: 2.66 + * @G_UNICODE_SCRIPT_YEZIDI: Yezidi. Since: 2.66 * * The #GUnicodeScript enumeration identifies different writing * systems. The values correspond to the names as defined in the @@ -615,7 +619,13 @@ typedef enum G_UNICODE_SCRIPT_ELYMAIC, /* Elym */ G_UNICODE_SCRIPT_NANDINAGARI, /* Nand */ G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG, /* Rohg */ - G_UNICODE_SCRIPT_WANCHO /* Wcho */ + G_UNICODE_SCRIPT_WANCHO, /* Wcho */ + + /* Unicode 13.0 additions */ + G_UNICODE_SCRIPT_CHORASMIAN, /* Chrs */ + G_UNICODE_SCRIPT_DIVES_AKURU, /* Diak */ + G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT, /* Kits */ + G_UNICODE_SCRIPT_YEZIDI /* Yezi */ } GUnicodeScript; GLIB_AVAILABLE_IN_ALL diff --git a/deps/glib/include/glib-2.0/glib/guri.h b/deps/glib/include/glib-2.0/glib/guri.h new file mode 100644 index 00000000..3a7bb5c0 --- /dev/null +++ b/deps/glib/include/glib-2.0/glib/guri.h @@ -0,0 +1,413 @@ +/* GLIB - Library of useful routines for C programming + * Copyright © 2020 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see + * . + */ + +#pragma once + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +typedef struct _GUri GUri; + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_ref (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +void g_uri_unref (GUri *uri); + +/** + * GUriFlags: + * @G_URI_FLAGS_NONE: No flags set. + * @G_URI_FLAGS_PARSE_RELAXED: Parse the URI more relaxedly than the + * [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies, + * fixing up or ignoring common mistakes in URIs coming from external + * sources. This is also needed for some obscure URI schemes where `;` + * separates the host from the path. Don’t use this flag unless you need to. + * @G_URI_FLAGS_HAS_PASSWORD: The userinfo field may contain a password, + * which will be separated from the username by `:`. + * @G_URI_FLAGS_HAS_AUTH_PARAMS: The userinfo may contain additional + * authentication-related parameters, which will be separated from + * the username and/or password by `;`. + * @G_URI_FLAGS_NON_DNS: The host component should not be assumed to be a + * DNS hostname or IP address (for example, for `smb` URIs with NetBIOS + * hostnames). + * @G_URI_FLAGS_ENCODED: When parsing a URI, this indicates that `%`-encoded + * characters in the userinfo, path, query, and fragment fields + * should not be decoded. (And likewise the host field if + * %G_URI_FLAGS_NON_DNS is also set.) When building a URI, it indicates + * that you have already `%`-encoded the components, and so #GUri + * should not do any encoding itself. + * @G_URI_FLAGS_ENCODED_QUERY: Same as %G_URI_FLAGS_ENCODED, for the query + * field only. + * @G_URI_FLAGS_ENCODED_PATH: Same as %G_URI_FLAGS_ENCODED, for the path only. + * @G_URI_FLAGS_ENCODED_FRAGMENT: Same as %G_URI_FLAGS_ENCODED, for the + * fragment only. + * + * Flags that describe a URI. + * + * When parsing a URI, if you need to choose different flags based on + * the type of URI, you can use g_uri_peek_scheme() on the URI string + * to check the scheme first, and use that to decide what flags to + * parse it with. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_FLAGS_NONE = 0, + G_URI_FLAGS_PARSE_RELAXED = 1 << 0, + G_URI_FLAGS_HAS_PASSWORD = 1 << 1, + G_URI_FLAGS_HAS_AUTH_PARAMS = 1 << 2, + G_URI_FLAGS_ENCODED = 1 << 3, + G_URI_FLAGS_NON_DNS = 1 << 4, + G_URI_FLAGS_ENCODED_QUERY = 1 << 5, + G_URI_FLAGS_ENCODED_PATH = 1 << 6, + G_URI_FLAGS_ENCODED_FRAGMENT = 1 << 7, +} GUriFlags; + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split (const gchar *uri_ref, + GUriFlags flags, + gchar **scheme, + gchar **userinfo, + gchar **host, + gint *port, + gchar **path, + gchar **query, + gchar **fragment, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split_with_user (const gchar *uri_ref, + GUriFlags flags, + gchar **scheme, + gchar **user, + gchar **password, + gchar **auth_params, + gchar **host, + gint *port, + gchar **path, + gchar **query, + gchar **fragment, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split_network (const gchar *uri_string, + GUriFlags flags, + gchar **scheme, + gchar **host, + gint *port, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_is_valid (const gchar *uri_string, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_join (GUriFlags flags, + const gchar *scheme, + const gchar *userinfo, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_join_with_user (GUriFlags flags, + const gchar *scheme, + const gchar *user, + const gchar *password, + const gchar *auth_params, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_parse (const gchar *uri_string, + GUriFlags flags, + GError **error); +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_parse_relative (GUri *base_uri, + const gchar *uri_ref, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_resolve_relative (const gchar *base_uri_string, + const gchar *uri_ref, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_build (GUriFlags flags, + const gchar *scheme, + const gchar *userinfo, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_build_with_user (GUriFlags flags, + const gchar *scheme, + const gchar *user, + const gchar *password, + const gchar *auth_params, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); + +/** + * GUriHideFlags: + * @G_URI_HIDE_NONE: No flags set. + * @G_URI_HIDE_USERINFO: Hide the userinfo. + * @G_URI_HIDE_PASSWORD: Hide the password. + * @G_URI_HIDE_AUTH_PARAMS: Hide the auth_params. + * @G_URI_HIDE_QUERY: Hide the query. + * @G_URI_HIDE_FRAGMENT: Hide the fragment. + * + * Flags describing what parts of the URI to hide in + * g_uri_to_string_partial(). Note that %G_URI_HIDE_PASSWORD and + * %G_URI_HIDE_AUTH_PARAMS will only work if the #GUri was parsed with + * the corresponding flags. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_HIDE_NONE = 0, + G_URI_HIDE_USERINFO = 1 << 0, + G_URI_HIDE_PASSWORD = 1 << 1, + G_URI_HIDE_AUTH_PARAMS = 1 << 2, + G_URI_HIDE_QUERY = 1 << 3, + G_URI_HIDE_FRAGMENT = 1 << 4, +} GUriHideFlags; + +GLIB_AVAILABLE_IN_2_66 +char * g_uri_to_string (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +char * g_uri_to_string_partial (GUri *uri, + GUriHideFlags flags); + +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_scheme (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_userinfo (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_user (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_password (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_auth_params (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_host (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +gint g_uri_get_port (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_path (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_query (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_fragment (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +GUriFlags g_uri_get_flags (GUri *uri); + +/** + * GUriParamsFlags: + * @G_URI_PARAMS_NONE: No flags set. + * @G_URI_PARAMS_CASE_INSENSITIVE: Parameter names are case insensitive. + * @G_URI_PARAMS_WWW_FORM: Replace `+` with space character. Only useful for + * URLs on the web, using the `https` or `http` schemas. + * @G_URI_PARAMS_PARSE_RELAXED: See %G_URI_FLAGS_PARSE_RELAXED. + * + * Flags modifying the way parameters are handled by g_uri_parse_params() and + * #GUriParamsIter. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_PARAMS_NONE = 0, + G_URI_PARAMS_CASE_INSENSITIVE = 1 << 0, + G_URI_PARAMS_WWW_FORM = 1 << 1, + G_URI_PARAMS_PARSE_RELAXED = 1 << 2, +} GUriParamsFlags; + +GLIB_AVAILABLE_IN_2_66 +GHashTable *g_uri_parse_params (const gchar *params, + gssize length, + const gchar *separators, + GUriParamsFlags flags, + GError **error); + +typedef struct _GUriParamsIter GUriParamsIter; + +struct _GUriParamsIter +{ + /*< private >*/ + gint dummy0; + gpointer dummy1; + gpointer dummy2; + guint8 dummy3[256]; +}; + +GLIB_AVAILABLE_IN_2_66 +void g_uri_params_iter_init (GUriParamsIter *iter, + const gchar *params, + gssize length, + const gchar *separators, + GUriParamsFlags flags); + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_params_iter_next (GUriParamsIter *iter, + gchar **attribute, + gchar **value, + GError **error); + +/** + * G_URI_ERROR: + * + * Error domain for URI methods. Errors in this domain will be from + * the #GUriError enumeration. See #GError for information on error + * domains. + * + * Since: 2.66 + */ +#define G_URI_ERROR (g_uri_error_quark ()) GLIB_AVAILABLE_MACRO_IN_2_66 +GLIB_AVAILABLE_IN_2_66 +GQuark g_uri_error_quark (void); + +/** + * GUriError: + * @G_URI_ERROR_FAILED: Generic error if no more specific error is available. + * See the error message for details. + * @G_URI_ERROR_BAD_SCHEME: The scheme of a URI could not be parsed. + * @G_URI_ERROR_BAD_USER: The user/userinfo of a URI could not be parsed. + * @G_URI_ERROR_BAD_PASSWORD: The password of a URI could not be parsed. + * @G_URI_ERROR_BAD_AUTH_PARAMS: The authentication parameters of a URI could not be parsed. + * @G_URI_ERROR_BAD_HOST: The host of a URI could not be parsed. + * @G_URI_ERROR_BAD_PORT: The port of a URI could not be parsed. + * @G_URI_ERROR_BAD_PATH: The path of a URI could not be parsed. + * @G_URI_ERROR_BAD_QUERY: The query of a URI could not be parsed. + * @G_URI_ERROR_BAD_FRAGMENT: The fragment of a URI could not be parsed. + * + * Error codes returned by #GUri methods. + * + * Since: 2.66 + */ +typedef enum { + G_URI_ERROR_FAILED, + G_URI_ERROR_BAD_SCHEME, + G_URI_ERROR_BAD_USER, + G_URI_ERROR_BAD_PASSWORD, + G_URI_ERROR_BAD_AUTH_PARAMS, + G_URI_ERROR_BAD_HOST, + G_URI_ERROR_BAD_PORT, + G_URI_ERROR_BAD_PATH, + G_URI_ERROR_BAD_QUERY, + G_URI_ERROR_BAD_FRAGMENT, +} GUriError; + +/** + * G_URI_RESERVED_CHARS_GENERIC_DELIMITERS: + * + * Generic delimiters characters as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `:/?#[]@`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@" + +/** + * G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS: + * + * Subcomponent delimiter characters as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;=" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT: + * + * Allowed characters in path elements. Includes `!$&'()*+,;=:@`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH: + * + * Allowed characters in a path. Includes `!$&'()*+,;=:@/`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO: + * + * Allowed characters in userinfo as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=:`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":" + +GLIB_AVAILABLE_IN_ALL +char * g_uri_unescape_string (const char *escaped_string, + const char *illegal_characters); +GLIB_AVAILABLE_IN_ALL +char * g_uri_unescape_segment (const char *escaped_string, + const char *escaped_string_end, + const char *illegal_characters); + +GLIB_AVAILABLE_IN_ALL +char * g_uri_parse_scheme (const char *uri); +GLIB_AVAILABLE_IN_2_66 +const char *g_uri_peek_scheme (const char *uri); + +GLIB_AVAILABLE_IN_ALL +char * g_uri_escape_string (const char *unescaped, + const char *reserved_chars_allowed, + gboolean allow_utf8); + +GLIB_AVAILABLE_IN_2_66 +GBytes * g_uri_unescape_bytes (const char *escaped_string, + gssize length, + const char *illegal_characters, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +char * g_uri_escape_bytes (const guint8 *unescaped, + gsize length, + const char *reserved_chars_allowed); + +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS diff --git a/deps/glib/include/glib/gutils.h b/deps/glib/include/glib-2.0/glib/gutils.h similarity index 100% rename from deps/glib/include/glib/gutils.h rename to deps/glib/include/glib-2.0/glib/gutils.h diff --git a/deps/glib/include/glib/guuid.h b/deps/glib/include/glib-2.0/glib/guuid.h similarity index 100% rename from deps/glib/include/glib/guuid.h rename to deps/glib/include/glib-2.0/glib/guuid.h diff --git a/deps/glib/include/glib/gvariant.h b/deps/glib/include/glib-2.0/glib/gvariant.h similarity index 100% rename from deps/glib/include/glib/gvariant.h rename to deps/glib/include/glib-2.0/glib/gvariant.h diff --git a/deps/glib/include/glib/gvarianttype.h b/deps/glib/include/glib-2.0/glib/gvarianttype.h similarity index 100% rename from deps/glib/include/glib/gvarianttype.h rename to deps/glib/include/glib-2.0/glib/gvarianttype.h diff --git a/deps/glib/include/glib/gversion.h b/deps/glib/include/glib-2.0/glib/gversion.h similarity index 100% rename from deps/glib/include/glib/gversion.h rename to deps/glib/include/glib-2.0/glib/gversion.h diff --git a/deps/glib/include/glib/gversionmacros.h b/deps/glib/include/glib-2.0/glib/gversionmacros.h similarity index 94% rename from deps/glib/include/glib/gversionmacros.h rename to deps/glib/include/glib-2.0/glib/gversionmacros.h index 07ce7630..08bf7d04 100644 --- a/deps/glib/include/glib/gversionmacros.h +++ b/deps/glib/include/glib-2.0/glib/gversionmacros.h @@ -235,6 +235,16 @@ */ #define GLIB_VERSION_2_64 (G_ENCODE_VERSION (2, 64)) +/** + * GLIB_VERSION_2_66: + * + * A macro that evaluates to the 2.66 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.66 + */ +#define GLIB_VERSION_2_66 (G_ENCODE_VERSION (2, 66)) + /* evaluates to the current stable version; for development cycles, * this means the next stable target */ @@ -636,11 +646,13 @@ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44 # define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE(2, 44) # define GLIB_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO(2, 44) # define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR(2, 44) # define GLIB_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE(2, 44) #else # define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 # define GLIB_AVAILABLE_MACRO_IN_2_44 # define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 # define GLIB_AVAILABLE_TYPE_IN_2_44 @@ -888,11 +900,13 @@ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60 # define GLIB_AVAILABLE_IN_2_60 GLIB_UNAVAILABLE(2, 60) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE(2, 60) # define GLIB_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO(2, 60) # define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR(2, 60) # define GLIB_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE(2, 60) #else # define GLIB_AVAILABLE_IN_2_60 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 # define GLIB_AVAILABLE_MACRO_IN_2_60 # define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 # define GLIB_AVAILABLE_TYPE_IN_2_60 @@ -920,11 +934,13 @@ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62 # define GLIB_AVAILABLE_IN_2_62 GLIB_UNAVAILABLE(2, 62) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE(2, 62) # define GLIB_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO(2, 62) # define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR(2, 62) # define GLIB_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE(2, 62) #else # define GLIB_AVAILABLE_IN_2_62 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 # define GLIB_AVAILABLE_MACRO_IN_2_62 # define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 # define GLIB_AVAILABLE_TYPE_IN_2_62 @@ -952,14 +968,50 @@ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64 # define GLIB_AVAILABLE_IN_2_64 GLIB_UNAVAILABLE(2, 64) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE(2, 64) # define GLIB_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO(2, 64) # define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR(2, 64) # define GLIB_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE(2, 64) #else # define GLIB_AVAILABLE_IN_2_64 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 # define GLIB_AVAILABLE_MACRO_IN_2_64 # define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 # define GLIB_AVAILABLE_TYPE_IN_2_64 #endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66 +# define GLIB_DEPRECATED_IN_2_66 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_66_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_66 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_66_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_66 +# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_66 +# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 +# define GLIB_AVAILABLE_IN_2_66 GLIB_UNAVAILABLE(2, 66) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE(2, 66) +# define GLIB_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO(2, 66) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR(2, 66) +# define GLIB_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE(2, 66) +#else +# define GLIB_AVAILABLE_IN_2_66 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 +# define GLIB_AVAILABLE_MACRO_IN_2_66 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 +# define GLIB_AVAILABLE_TYPE_IN_2_66 +#endif + #endif /* __G_VERSION_MACROS_H__ */ diff --git a/deps/glib/include/glib/gwin32.h b/deps/glib/include/glib-2.0/glib/gwin32.h similarity index 100% rename from deps/glib/include/glib/gwin32.h rename to deps/glib/include/glib-2.0/glib/gwin32.h diff --git a/deps/glib/include/gobject/gbinding.h b/deps/glib/include/glib-2.0/gobject/gbinding.h similarity index 100% rename from deps/glib/include/gobject/gbinding.h rename to deps/glib/include/glib-2.0/gobject/gbinding.h diff --git a/deps/glib/include/gobject/gboxed.h b/deps/glib/include/glib-2.0/gobject/gboxed.h similarity index 100% rename from deps/glib/include/gobject/gboxed.h rename to deps/glib/include/glib-2.0/gobject/gboxed.h diff --git a/deps/glib/include/gobject/gclosure.h b/deps/glib/include/glib-2.0/gobject/gclosure.h similarity index 99% rename from deps/glib/include/gobject/gclosure.h rename to deps/glib/include/glib-2.0/gobject/gclosure.h index a5c1c3fc..a0f91f53 100644 --- a/deps/glib/include/gobject/gclosure.h +++ b/deps/glib/include/glib-2.0/gobject/gclosure.h @@ -202,7 +202,7 @@ struct _GClosure /* invariants/constraints: * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE - * - invocation of all inotifiers occours prior to fnotifiers + * - invocation of all inotifiers occurs prior to fnotifiers * - order of inotifiers is random * inotifiers may _not_ free/invalidate parameter values (e.g. ->data) * - order of fnotifiers is random diff --git a/deps/glib/include/gobject/genums.h b/deps/glib/include/glib-2.0/gobject/genums.h similarity index 100% rename from deps/glib/include/gobject/genums.h rename to deps/glib/include/glib-2.0/gobject/genums.h diff --git a/deps/glib/include/gobject/glib-enumtypes.h b/deps/glib/include/glib-2.0/gobject/glib-enumtypes.h similarity index 91% rename from deps/glib/include/gobject/glib-enumtypes.h rename to deps/glib/include/glib-2.0/gobject/glib-enumtypes.h index 98449549..d5d2854a 100644 --- a/deps/glib/include/gobject/glib-enumtypes.h +++ b/deps/glib/include/glib-2.0/gobject/glib-enumtypes.h @@ -8,7 +8,7 @@ G_BEGIN_DECLS -/* enumerations from "../gobject/../glib/gunicode.h" */ +/* enumerations from "../../../../source/glib/glib-2.66.3/gobject/../glib/gunicode.h" */ GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void) G_GNUC_CONST; #define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type ()) GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void) G_GNUC_CONST; diff --git a/deps/glib/include/gobject/glib-types.h b/deps/glib/include/glib-2.0/gobject/glib-types.h similarity index 97% rename from deps/glib/include/gobject/glib-types.h rename to deps/glib/include/glib-2.0/gobject/glib-types.h index 78a199d1..b24e76bf 100644 --- a/deps/glib/include/gobject/glib-types.h +++ b/deps/glib/include/glib-2.0/gobject/glib-types.h @@ -297,6 +297,15 @@ typedef gsize GType; */ #define G_TYPE_OPTION_GROUP (g_option_group_get_type ()) +/** + * G_TYPE_URI: + * + * The #GType for a boxed type holding a #GUri. + * + * Since: 2.66 + */ +#define G_TYPE_URI (g_uri_get_type ()) + GLIB_AVAILABLE_IN_ALL GType g_date_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL @@ -353,6 +362,8 @@ GLIB_AVAILABLE_IN_2_40 GType g_mapped_file_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_44 GType g_option_group_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_66 +GType g_uri_get_type (void) G_GNUC_CONST; GLIB_DEPRECATED_FOR('G_TYPE_VARIANT') GType g_variant_get_gtype (void) G_GNUC_CONST; diff --git a/deps/glib/include/gobject/gmarshal.h b/deps/glib/include/glib-2.0/gobject/gmarshal.h similarity index 100% rename from deps/glib/include/gobject/gmarshal.h rename to deps/glib/include/glib-2.0/gobject/gmarshal.h diff --git a/deps/glib/include/gobject/gobject-autocleanups.h b/deps/glib/include/glib-2.0/gobject/gobject-autocleanups.h similarity index 100% rename from deps/glib/include/gobject/gobject-autocleanups.h rename to deps/glib/include/glib-2.0/gobject/gobject-autocleanups.h diff --git a/deps/glib/include/gobject/gobject.h b/deps/glib/include/glib-2.0/gobject/gobject.h similarity index 99% rename from deps/glib/include/gobject/gobject.h rename to deps/glib/include/glib-2.0/gobject/gobject.h index 2e07fa72..499329af 100644 --- a/deps/glib/include/gobject/gobject.h +++ b/deps/glib/include/glib-2.0/gobject/gobject.h @@ -320,7 +320,7 @@ struct _GObjectClass GSList *construct_properties; /*< public >*/ - /* seldom overidden */ + /* seldom overridden */ GObject* (*constructor) (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties); @@ -335,7 +335,7 @@ struct _GObjectClass GParamSpec *pspec); void (*dispose) (GObject *object); void (*finalize) (GObject *object); - /* seldom overidden */ + /* seldom overridden */ void (*dispatch_properties_changed) (GObject *object, guint n_pspecs, GParamSpec **pspecs); @@ -838,7 +838,7 @@ static inline void * * Updates a pointer to weakly refer to @new_object. It assigns @new_object * to @weak_pointer_location and ensures that @weak_pointer_location will - * automaticaly be set to %NULL if @new_object gets destroyed. The assignment + * automatically be set to %NULL if @new_object gets destroyed. The assignment * is not atomic. The weak reference is not thread-safe, see * g_object_add_weak_pointer() for details. * diff --git a/deps/glib/include/gobject/gobjectnotifyqueue.c b/deps/glib/include/glib-2.0/gobject/gobjectnotifyqueue.c similarity index 100% rename from deps/glib/include/gobject/gobjectnotifyqueue.c rename to deps/glib/include/glib-2.0/gobject/gobjectnotifyqueue.c diff --git a/deps/glib/include/gobject/gparam.h b/deps/glib/include/glib-2.0/gobject/gparam.h similarity index 99% rename from deps/glib/include/gobject/gparam.h rename to deps/glib/include/glib-2.0/gobject/gparam.h index b6a55465..7294ed51 100644 --- a/deps/glib/include/gobject/gparam.h +++ b/deps/glib/include/glib-2.0/gobject/gparam.h @@ -395,6 +395,9 @@ GLIB_AVAILABLE_IN_ALL GType g_param_type_register_static (const gchar *name, const GParamSpecTypeInfo *pspec_info); +GLIB_AVAILABLE_IN_2_66 +gboolean g_param_spec_is_valid_name (const gchar *name); + /* For registering builting types */ GType _g_param_type_register_static_constant (const gchar *name, const GParamSpecTypeInfo *pspec_info, diff --git a/deps/glib/include/gobject/gparamspecs.h b/deps/glib/include/glib-2.0/gobject/gparamspecs.h similarity index 99% rename from deps/glib/include/gobject/gparamspecs.h rename to deps/glib/include/glib-2.0/gobject/gparamspecs.h index d0e4d595..9aac2c42 100644 --- a/deps/glib/include/gobject/gparamspecs.h +++ b/deps/glib/include/glib-2.0/gobject/gparamspecs.h @@ -927,7 +927,7 @@ struct _GParamSpecObject * another paramspec. All operations other than getting or * setting the value are redirected, including accessing the nick and * blurb, validating a value, and so forth. See - * g_param_spec_get_redirect_target() for retrieving the overidden + * g_param_spec_get_redirect_target() for retrieving the overridden * property. #GParamSpecOverride is used in implementing * g_object_class_override_property(), and will not be directly useful * unless you are implementing a new base type similar to GObject. diff --git a/deps/glib/include/gobject/gsignal.h b/deps/glib/include/glib-2.0/gobject/gsignal.h similarity index 99% rename from deps/glib/include/gobject/gsignal.h rename to deps/glib/include/glib-2.0/gobject/gsignal.h index 59f94d59..5cc2b6df 100644 --- a/deps/glib/include/gobject/gsignal.h +++ b/deps/glib/include/glib-2.0/gobject/gsignal.h @@ -338,6 +338,8 @@ void g_signal_query (guint signal_id, GLIB_AVAILABLE_IN_ALL guint* g_signal_list_ids (GType itype, guint *n_ids); +GLIB_AVAILABLE_IN_2_66 +gboolean g_signal_is_valid_name (const gchar *name); GLIB_AVAILABLE_IN_ALL gboolean g_signal_parse_name (const gchar *detailed_signal, GType itype, diff --git a/deps/glib/include/gobject/gsourceclosure.h b/deps/glib/include/glib-2.0/gobject/gsourceclosure.h similarity index 100% rename from deps/glib/include/gobject/gsourceclosure.h rename to deps/glib/include/glib-2.0/gobject/gsourceclosure.h diff --git a/deps/glib/include/gobject/gtype.h b/deps/glib/include/glib-2.0/gobject/gtype.h similarity index 99% rename from deps/glib/include/gobject/gtype.h rename to deps/glib/include/glib-2.0/gobject/gtype.h index 479b405e..89178411 100644 --- a/deps/glib/include/gobject/gtype.h +++ b/deps/glib/include/glib-2.0/gobject/gtype.h @@ -1178,17 +1178,13 @@ struct _GInterfaceInfo * array. To deviate from our string example for a moment, and taking * a look at an exemplary implementation for collect_value() of * #GObject: - * |[ - * if (collect_values[0].v_pointer) - * { + * |[ * GObject *object = G_OBJECT (collect_values[0].v_pointer); + * g_return_val_if_fail (object != NULL, + * g_strdup_printf ("Object passed as invalid NULL pointer")); * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types * value->data[0].v_pointer = g_object_ref (object); * return NULL; - * } - * else - * return g_strdup_printf ("Object passed as invalid NULL pointer"); - * } * ]| * The reference count for valid objects is always incremented, * regardless of @collect_flags. For invalid objects, the example @@ -1220,8 +1216,8 @@ struct _GInterfaceInfo * To complete the string example: * |[ * gchar **string_p = collect_values[0].v_pointer; - * if (!string_p) - * return g_strdup_printf ("string location passed as NULL"); + * g_return_val_if_fail (string_p != NULL, + * g_strdup_printf ("string location passed as NULL")); * if (collect_flags & G_VALUE_NOCOPY_CONTENTS) * *string_p = value->data[0].v_pointer; * else @@ -1231,8 +1227,8 @@ struct _GInterfaceInfo * reference-counted types: * |[ * GObject **object_p = collect_values[0].v_pointer; - * if (!object_p) - * return g_strdup_printf ("object location passed as NULL"); + * g_return_val_if_fail (object_p != NULL, + * g_strdup_printf ("object location passed as NULL")); * if (!value->data[0].v_pointer) * *object_p = NULL; * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour diff --git a/deps/glib/include/gobject/gtypemodule.h b/deps/glib/include/glib-2.0/gobject/gtypemodule.h similarity index 100% rename from deps/glib/include/gobject/gtypemodule.h rename to deps/glib/include/glib-2.0/gobject/gtypemodule.h diff --git a/deps/glib/include/gobject/gtypeplugin.h b/deps/glib/include/glib-2.0/gobject/gtypeplugin.h similarity index 100% rename from deps/glib/include/gobject/gtypeplugin.h rename to deps/glib/include/glib-2.0/gobject/gtypeplugin.h diff --git a/deps/glib/include/gobject/gvalue.h b/deps/glib/include/glib-2.0/gobject/gvalue.h similarity index 93% rename from deps/glib/include/gobject/gvalue.h rename to deps/glib/include/glib-2.0/gobject/gvalue.h index 9d8f0348..dc6e5ac3 100644 --- a/deps/glib/include/gobject/gvalue.h +++ b/deps/glib/include/glib-2.0/gobject/gvalue.h @@ -171,10 +171,21 @@ void g_value_register_transform_func (GType src_type, * * If passed to G_VALUE_COLLECT(), allocated data won't be copied * but used verbatim. This does not affect ref-counted types like - * objects. + * objects. This does not affect usage of g_value_copy(), the data will + * be copied if it is not ref-counted. */ #define G_VALUE_NOCOPY_CONTENTS (1 << 27) +/** + * G_VALUE_INTERNED_STRING: + * + * For string values, indicates that the string contained is canonical and will + * exist for the duration of the process. See g_value_set_interned_string(). + * + * Since: 2.66 + */ +#define G_VALUE_INTERNED_STRING (1 << 28) GLIB_AVAILABLE_MACRO_IN_2_66 + /** * G_VALUE_INIT: * diff --git a/deps/glib/include/gobject/gvaluearray.h b/deps/glib/include/glib-2.0/gobject/gvaluearray.h similarity index 100% rename from deps/glib/include/gobject/gvaluearray.h rename to deps/glib/include/glib-2.0/gobject/gvaluearray.h diff --git a/deps/glib/include/gobject/gvaluecollector.h b/deps/glib/include/glib-2.0/gobject/gvaluecollector.h similarity index 99% rename from deps/glib/include/gobject/gvaluecollector.h rename to deps/glib/include/glib-2.0/gobject/gvaluecollector.h index 177aa3df..b1304595 100644 --- a/deps/glib/include/gobject/gvaluecollector.h +++ b/deps/glib/include/glib-2.0/gobject/gvaluecollector.h @@ -141,7 +141,7 @@ G_STMT_START { \ * va_list variables cannot be passed by reference. * * Note: If you are creating the @value argument just before calling this macro, - * you should use the #G_VALUE_COLLECT_INIT variant and pass the unitialized + * you should use the #G_VALUE_COLLECT_INIT variant and pass the uninitialized * #GValue. That variant is faster than #G_VALUE_COLLECT. */ #define G_VALUE_COLLECT(value, var_args, flags, __error) G_STMT_START { \ diff --git a/deps/glib/include/gobject/gvaluetypes.h b/deps/glib/include/glib-2.0/gobject/gvaluetypes.h similarity index 94% rename from deps/glib/include/gobject/gvaluetypes.h rename to deps/glib/include/glib-2.0/gobject/gvaluetypes.h index 92744353..df2f0aa9 100644 --- a/deps/glib/include/gobject/gvaluetypes.h +++ b/deps/glib/include/glib-2.0/gobject/gvaluetypes.h @@ -136,6 +136,19 @@ G_BEGIN_DECLS * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) +/** + * G_VALUE_IS_INTERNED_STRING: + * @value: a valid #GValue structure + * + * Checks whether @value contains a string which is canonical. + * + * Returns: %TRUE if the value contains a string in its canonical + * representation, as returned by g_intern_string(). See also + * g_value_set_interned_string(). + * + * Since: 2.66 + */ +#define G_VALUE_IS_INTERNED_STRING(value) (G_VALUE_HOLDS_STRING (value) && ((value)->data[1].v_uint & G_VALUE_INTERNED_STRING)) GLIB_AVAILABLE_MACRO_IN_2_66 /** * G_VALUE_HOLDS_POINTER: * @value: a valid #GValue structure @@ -241,6 +254,9 @@ void g_value_set_string (GValue *value, GLIB_AVAILABLE_IN_ALL void g_value_set_static_string (GValue *value, const gchar *v_string); +GLIB_AVAILABLE_IN_2_66 +void g_value_set_interned_string (GValue *value, + const gchar *v_string); GLIB_AVAILABLE_IN_ALL const gchar * g_value_get_string (const GValue *value); GLIB_AVAILABLE_IN_ALL diff --git a/deps/glib/include/glib/gurifuncs.h b/deps/glib/include/glib/gurifuncs.h deleted file mode 100644 index e59a43c8..00000000 --- a/deps/glib/include/glib/gurifuncs.h +++ /dev/null @@ -1,83 +0,0 @@ -/* GIO - GLib Input, Output and Streaming Library - * - * Copyright (C) 2006-2007 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * Author: Alexander Larsson - */ - -#ifndef __G_URI_FUNCS_H__ -#define __G_URI_FUNCS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -G_BEGIN_DECLS - -/** - * G_URI_RESERVED_CHARS_GENERIC_DELIMITERS: - * - * Generic delimiters characters as defined in RFC 3986. Includes ":/?#[]@". - **/ -#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@" - -/** - * G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS: - * - * Subcomponent delimiter characters as defined in RFC 3986. Includes "!$&'()*+,;=". - **/ -#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;=" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT: - * - * Allowed characters in path elements. Includes "!$&'()*+,;=:@". - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH: - * - * Allowed characters in a path. Includes "!$&'()*+,;=:@/". - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO: - * - * Allowed characters in userinfo as defined in RFC 3986. Includes "!$&'()*+,;=:". - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":" - -GLIB_AVAILABLE_IN_ALL -char * g_uri_unescape_string (const char *escaped_string, - const char *illegal_characters); -GLIB_AVAILABLE_IN_ALL -char * g_uri_unescape_segment (const char *escaped_string, - const char *escaped_string_end, - const char *illegal_characters); -GLIB_AVAILABLE_IN_ALL -char * g_uri_parse_scheme (const char *uri); -GLIB_AVAILABLE_IN_ALL -char * g_uri_escape_string (const char *unescaped, - const char *reserved_chars_allowed, - gboolean allow_utf8); - -G_END_DECLS - -#endif /* __G_URI_FUNCS_H__ */ diff --git a/deps/glib/include/glib/glibconfig.h b/deps/glib/lib/glib-2.0/include/glibconfig.h similarity index 97% rename from deps/glib/include/glib/glibconfig.h rename to deps/glib/lib/glib-2.0/include/glibconfig.h index 1746cb28..2ebf4e64 100644 --- a/deps/glib/include/glib/glibconfig.h +++ b/deps/glib/lib/glib-2.0/include/glibconfig.h @@ -16,7 +16,7 @@ * system printf functions. This is useful to know, for example, * when using glibc's register_printf_function(). */ -#define GLIB_USING_SYSTEM_PRINTF +#undef GLIB_USING_SYSTEM_PRINTF #define GLIB_STATIC_COMPILATION 1 #define GOBJECT_STATIC_COMPILATION 1 @@ -109,8 +109,8 @@ typedef unsigned long guintptr; #define G_GUINTPTR_FORMAT "lu" #define GLIB_MAJOR_VERSION 2 -#define GLIB_MINOR_VERSION 64 -#define GLIB_MICRO_VERSION 4 +#define GLIB_MINOR_VERSION 66 +#define GLIB_MICRO_VERSION 3 #define G_OS_UNIX @@ -154,7 +154,6 @@ typedef unsigned long guintptr; #define G_THREADS_ENABLED #define G_THREADS_IMPL_POSIX -#undef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED #define G_ATOMIC_LOCK_FREE #define GINT16_TO_LE(val) ((gint16) (val)) diff --git a/deps/glib/lib/libglib-2.0.a b/deps/glib/lib/libglib-2.0.a index f59098bc..6c3d4f12 100644 Binary files a/deps/glib/lib/libglib-2.0.a and b/deps/glib/lib/libglib-2.0.a differ diff --git a/deps/glib/lib/libgobject-2.0.a b/deps/glib/lib/libgobject-2.0.a index c852bede..18919bf4 100644 Binary files a/deps/glib/lib/libgobject-2.0.a and b/deps/glib/lib/libgobject-2.0.a differ diff --git a/deps/glib/lib/libgthread-2.0.a b/deps/glib/lib/libgthread-2.0.a new file mode 100644 index 00000000..7d8dffef Binary files /dev/null and b/deps/glib/lib/libgthread-2.0.a differ diff --git a/deps/glib/lib/pkgconfig/glib-2.0.pc b/deps/glib/lib/pkgconfig/glib-2.0.pc new file mode 100644 index 00000000..c8b86176 --- /dev/null +++ b/deps/glib/lib/pkgconfig/glib-2.0.pc @@ -0,0 +1,16 @@ +prefix= +libdir=${prefix}/lib +includedir=${prefix}/include + +bindir=${prefix}/bin +glib_genmarshal=${bindir}/glib-genmarshal +gobject_query=${bindir}/gobject-query +glib_mkenums=${bindir}/glib-mkenums + +Name: GLib +Description: C Utility Library +Version: 2.66.3 +Requires.private: libpcre >= 8.31 +Libs: -L${libdir} -lglib-2.0 -lintl -liconv -lffi -lpcre -framework CoreFoundation -framework Foundation +Libs.private: -Wl,-framework,CoreFoundation -Wl,-framework,Carbon -Wl,-framework,Foundation -Wl,-framework,AppKit -lm +Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include diff --git a/deps/glib/lib/pkgconfig/gobject-2.0.pc b/deps/glib/lib/pkgconfig/gobject-2.0.pc new file mode 100644 index 00000000..16f7d004 --- /dev/null +++ b/deps/glib/lib/pkgconfig/gobject-2.0.pc @@ -0,0 +1,12 @@ +prefix= +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: GObject +Description: GLib Type, Object, Parameter and Signal Library +Version: 2.66.3 +Requires: glib-2.0 +Requires.private: libffi >= 3.0.0 +Libs: -L${libdir} -lgobject-2.0 +Libs.private: -lintl -liconv -lffi +Cflags: -I${includedir} diff --git a/deps/glib/lib/pkgconfig/gthread-2.0.pc b/deps/glib/lib/pkgconfig/gthread-2.0.pc new file mode 100644 index 00000000..d0fdc1c4 --- /dev/null +++ b/deps/glib/lib/pkgconfig/gthread-2.0.pc @@ -0,0 +1,11 @@ +prefix= +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: GThread +Description: Thread support for GLib +Version: 2.66.3 +Requires: glib-2.0 +Libs: -L${libdir} -lgthread-2.0 +Libs.private: -lintl -liconv +Cflags: -I${includedir}