summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2014-03-15 17:59:30 -0400
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-26 18:20:59 +0000
commit2ae9a6206ce4723531147b8fe01c9e885f7f44d4 (patch)
treea68f217c9c135262c4211c558af21170f6159c78
parent9777e093dced3bf5306527c908abe458d8359791 (diff)
Remove unused code from codegen
-rw-r--r--tools/Makefile.am3
-rw-r--r--tools/glib-client-gen.py2
-rw-r--r--tools/glib-client-marshaller-gen.py60
-rw-r--r--tools/libglibcodegen.py75
4 files changed, 1 insertions, 139 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0fd42f89c..fc0d7fa1d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -25,7 +25,6 @@ EXTRA_DIST = \
flymake.mk \
git-which-branch.sh \
glib-client-gen.py \
- glib-client-marshaller-gen.py \
glib-errors-check-gen.py \
glib-errors-str-gen.py \
glib-ginterface-gen.py \
@@ -53,8 +52,6 @@ libglibcodegen.py: libtpcodegen.py
$(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
c-constants-gen.py: libglibcodegen.py
$(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
-glib-client-marshaller-gen.py: libglibcodegen.py
- $(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-errors-enum-body-gen.py: libglibcodegen.py
$(AM_V_GEN)test -e ${srcdir}/$@ && touch ${srcdir}/$@
glib-errors-enum-header-gen.py: libglibcodegen.py
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index 0b7978423..bc117c5d8 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -29,7 +29,7 @@ from getopt import gnu_getopt
from libtpcodegen import file_set_contents, key_by_name, u
from libglibcodegen import (Signature, type_to_gtype,
- get_docstring, xml_escape, get_deprecated, copy_into_gvalue,
+ get_docstring, xml_escape, get_deprecated,
value_getter)
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
deleted file mode 100644
index cd9823bdf..000000000
--- a/tools/glib-client-marshaller-gen.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import xml.dom.minidom
-from string import ascii_letters, digits
-
-
-from libglibcodegen import signal_to_marshal_name
-
-
-NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
-
-class Generator(object):
-
- def __init__(self, dom, prefix):
- self.dom = dom
- self.marshallers = {}
- self.prefix = prefix
-
- def do_signal(self, signal):
- marshaller = signal_to_marshal_name(signal, self.prefix)
-
- assert '__' in marshaller
- rhs = marshaller.split('__', 1)[1].split('_')
-
- self.marshallers[marshaller] = rhs
-
- def __call__(self):
- signals = self.dom.getElementsByTagName('signal')
-
- for signal in signals:
- self.do_signal(signal)
-
- print('void')
- print('%s_register_dbus_glib_marshallers (void)' % self.prefix)
- print('{')
-
- all = list(self.marshallers.keys())
- all.sort()
- for marshaller in all:
- rhs = self.marshallers[marshaller]
-
- print(' dbus_g_object_register_marshaller (')
- print(' g_cclosure_marshal_generic,')
- print(' G_TYPE_NONE, /* return */')
- for type in rhs:
- print(' G_TYPE_%s,' % type.replace('VOID', 'NONE'))
- print(' G_TYPE_INVALID);')
-
- print('}')
-
-
-def types_to_gtypes(types):
- return [type_to_gtype(t)[1] for t in types]
-
-if __name__ == '__main__':
- argv = sys.argv[1:]
- dom = xml.dom.minidom.parse(argv[0])
-
- Generator(dom, argv[1])()
diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py
index eb4f46192..11904a73c 100644
--- a/tools/libglibcodegen.py
+++ b/tools/libglibcodegen.py
@@ -47,59 +47,6 @@ def dbus_gutils_wincaps_to_uscore(s):
ret += c
return ret
-
-def signal_to_marshal_type(signal):
- """
- return a list of strings indicating the marshalling type for this signal.
- """
-
- mtype=[]
- for i in signal.getElementsByTagName("arg"):
- name =i.getAttribute("name")
- type = i.getAttribute("type")
- mtype.append(type_to_gtype(type)[2])
-
- return mtype
-
-
-_glib_marshallers = ['VOID', 'BOOLEAN', 'CHAR', 'UCHAR', 'INT',
- 'STRING', 'UINT', 'LONG', 'ULONG', 'ENUM', 'FLAGS', 'FLOAT',
- 'DOUBLE', 'STRING', 'PARAM', 'BOXED', 'POINTER', 'OBJECT',
- 'UINT_POINTER']
-
-
-def signal_to_marshal_name(signal, prefix):
-
- mtype = signal_to_marshal_type(signal)
- if len(mtype):
- name = '_'.join(mtype)
- else:
- name = 'VOID'
-
- if name in _glib_marshallers:
- return 'g_cclosure_marshal_VOID__' + name
- else:
- return prefix + '_marshal_VOID__' + name
-
-
-def method_to_glue_marshal_name(method, prefix):
-
- mtype = []
- for i in method.getElementsByTagName("arg"):
- if i.getAttribute("direction") != "out":
- type = i.getAttribute("type")
- mtype.append(type_to_gtype(type)[2])
-
- mtype.append('POINTER')
-
- name = '_'.join(mtype)
-
- if name in _glib_marshallers:
- return 'g_cclosure_marshal_VOID__' + name
- else:
- return prefix + '_marshal_VOID__' + name
-
-
def type_to_gtype(s):
if s == 'y': #byte
return ("guchar ", "G_TYPE_UCHAR","UCHAR", False)
@@ -193,28 +140,6 @@ def move_into_gvalue(gvaluep, gtype, marshaller, name):
else:
raise AssertionError("Don't know how to put %s in a GValue" % gtype)
-def copy_into_gvalue(gvaluep, gtype, marshaller, name):
- if gtype == 'G_TYPE_STRING':
- return 'g_value_set_string (%s, %s);' % (gvaluep, name)
- elif marshaller == 'BOXED':
- return 'g_value_set_boxed (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_UCHAR':
- return 'g_value_set_uchar (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_BOOLEAN':
- return 'g_value_set_boolean (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_INT':
- return 'g_value_set_int (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_UINT':
- return 'g_value_set_uint (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_INT64':
- return 'g_value_set_int (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_UINT64':
- return 'g_value_set_uint64 (%s, %s);' % (gvaluep, name)
- elif gtype == 'G_TYPE_DOUBLE':
- return 'g_value_set_double (%s, %s);' % (gvaluep, name)
- else:
- raise AssertionError("Don't know how to put %s in a GValue" % gtype)
-
def value_getter(gtype, marshaller):
if marshaller == 'BOXED':
return 'g_value_get_boxed'