MAJOR=7
MINOR=133
DEVNAME=vcsa5
     �_’I|¥‰ÓMjqØ‚¦ð¬÷ÃÂ      File not found.
  :   ˆl–Ðz¾”Ëm
qA3q¶®21hßÁ„d¾ïa–Ü4ý()¨‰P@ŠWfãm)‹FÿÄ ?÷     #!/usr/bin/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.68.4
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 