summaryrefslogtreecommitdiff
path: root/tools/glib-errors-check-gen.py
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-04 12:33:32 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-04 12:33:32 +0000
commitdc2881155320bf12b3da69f72fe7ee44696602ff (patch)
tree6f7108876f456a196eea1ff37f30d6e01716e3cc /tools/glib-errors-check-gen.py
parentc455172a97b0b49418fd2fa1e7bd5c6e0a118541 (diff)
downloadtelepathy-logger-next.tar.gz
This branch has been merged into telepathy-glibnext
Replace the entire source tree with a message indicating where to go.
Diffstat (limited to 'tools/glib-errors-check-gen.py')
-rw-r--r--tools/glib-errors-check-gen.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/tools/glib-errors-check-gen.py b/tools/glib-errors-check-gen.py
deleted file mode 100644
index fad261e..0000000
--- a/tools/glib-errors-check-gen.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import xml.dom.minidom
-
-from libglibcodegen import NS_TP, get_docstring, get_descendant_text
-
-class Generator(object):
- def __init__(self, dom):
- self.dom = dom
- self.errors = self.dom.getElementsByTagNameNS(NS_TP, 'errors')[0]
-
- def __call__(self):
-
- print('{')
- print(' GEnumClass *klass;')
- print(' GEnumValue *value_by_name;')
- print(' GEnumValue *value_by_nick;')
- print('')
- print(' g_type_init ();')
- print(' klass = g_type_class_ref (TP_TYPE_ERROR);')
-
- for error in self.errors.getElementsByTagNameNS(NS_TP, 'error'):
- ns = error.parentNode.getAttribute('namespace')
- nick = error.getAttribute('name').replace(' ', '')
- enum = ('TP_ERROR_' +
- error.getAttribute('name').replace(' ', '_').replace('.', '_').upper())
- s = ('TP_ERROR_STR_' +
- error.getAttribute('name').replace(' ', '_').replace('.', '_').upper())
-
- print('')
- print(' /* %s.%s */' % (ns, nick))
- print(' value_by_name = g_enum_get_value_by_name (klass, "%s");'
- % enum)
- print(' value_by_nick = g_enum_get_value_by_nick (klass, "%s");'
- % nick)
- print(' g_assert (value_by_name != NULL);')
- print(' g_assert (value_by_nick != NULL);')
- print(' g_assert_cmpint (value_by_name->value, ==, %s);'
- % enum)
- print(' g_assert_cmpint (value_by_nick->value, ==, %s);'
- % enum)
- print(' g_assert_cmpstr (value_by_name->value_name, ==, "%s");'
- % enum)
- print(' g_assert_cmpstr (value_by_nick->value_name, ==, "%s");'
- % enum)
- print(' g_assert_cmpstr (value_by_name->value_nick, ==, "%s");'
- % nick)
- print(' g_assert_cmpstr (value_by_nick->value_nick, ==, "%s");'
- % nick)
- print(' g_assert_cmpstr (%s, ==, TP_ERROR_PREFIX ".%s");'
- % (s, nick))
-
- print('}')
-
-if __name__ == '__main__':
- argv = sys.argv[1:]
- Generator(xml.dom.minidom.parse(argv[0]))()