summaryrefslogtreecommitdiffstats
path: root/src/sbus
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-01-10 11:08:16 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-02-24 11:15:02 +0100
commitc2cc119de8eac712c040b3993f41c967ff2278de (patch)
tree78d67aaa9467a1f5cf4ab5fcfe76c3eed7fb50c1 /src/sbus
parent769347ad4d35d43488eb98f980143495b0db415d (diff)
downloadsssd-c2cc119de8eac712c040b3993f41c967ff2278de.tar.gz
sssd-c2cc119de8eac712c040b3993f41c967ff2278de.tar.xz
sssd-c2cc119de8eac712c040b3993f41c967ff2278de.zip
sbus: Generate constants from interface definitions
This is not strictly necessary, but avoids duplicating data in mulitple places, and makes the interface definitions benefit dbus callers (a little). After applying this commit you may need to 'make clean' as the codegen has changed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/sbus')
-rwxr-xr-xsrc/sbus/sbus_codegen21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sbus/sbus_codegen b/src/sbus/sbus_codegen
index 86aeff094..d2fe5073d 100755
--- a/src/sbus/sbus_codegen
+++ b/src/sbus/sbus_codegen
@@ -295,6 +295,17 @@ def header_vtable(iface, methods):
out("};")
+def header_constants(iface):
+ out("")
+ out("/* constants for %s */", iface.name)
+ out("#define %s \"%s\"", iface.c_name().upper(), iface.name)
+ for meth in iface.methods:
+ out("#define %s \"%s\"", meth.fq_c_name().upper(), meth.name)
+ for sig in iface.signals:
+ out("#define %s \"%s\"", sig.fq_c_name().upper(), sig.name)
+ for prop in iface.properties:
+ out("#define %s \"%s\"", prop.fq_c_name().upper(), prop.name)
+
def generate_header(ifaces, filename):
basename = os.path.basename(filename)
guard = "__%s__" % re.sub(r'([^_A-Z0-9])', "_", basename.upper())
@@ -308,6 +319,16 @@ def generate_header(ifaces, filename):
out("")
out("/* ------------------------------------------------------------------------")
+ out(" * DBus Constants")
+ out(" *")
+ out(" * Various constants of interface and method names mostly for use by clients")
+ out(" */")
+
+ for iface in ifaces:
+ header_constants(iface)
+
+ out("")
+ out("/* ------------------------------------------------------------------------")
out(" * DBus Vtable handler structures")
out(" *")
out(" * These structures are filled in by implementors of the different")