sbus_codegen revision 66277b21179d95f6e96abed01a20ccbccf27ce99
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Stef Walter <stefw@redhat.com>
c8175ece69d986ccd0671bc4d2571b247dfae177Automatic Updater# Copyright (C) 2014 Red Hat
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# This program is free software; you can redistribute it and/or modify
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# it under the terms of the GNU General Public License as published by
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# the Free Software Foundation; either version 3 of the License, or
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# (at your option) any later version.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# This program is distributed in the hope that it will be useful,
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# but WITHOUT ANY WARRANTY; without even the implied warranty of
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# GNU General Public License for more details.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# You should have received a copy of the GNU General Public License
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# along with this program. If not, see <http://www.gnu.org/licenses/>.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Some parser code from GLib
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Copyright (C) 2008-2011 Red Hat, Inc.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# This library is free software; you can redistribute it and/or
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# modify it under the terms of the GNU Lesser General Public
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# License as published by the Free Software Foundation; either
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# version 2 of the License, or (at your option) any later version.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# This library is distributed in the hope that it will be useful,
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# but WITHOUT ANY WARRANTY; without even the implied warranty of
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Lesser General Public License for more details.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# You should have received a copy of the GNU Lesser General
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Public License along with this library; if not, write to the
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Boston, MA 02111-1307, USA.
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# Portions by: David Zeuthen <davidz@redhat.com>
0e507dbb816575e6220fe309e8ada68897ffcdbeMark Andrews# DBus interfaces are defined here:
# http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format
# DBus interface. For many examples see /usr/share/dbus-1/interfaces/ on a
elif self.file:
return message
self.type = type
if type in BASIC_TYPES:
return False
return True
self.args = []
return sig
self.methods = []
self.signals = []
self.properties = []
if with_names:
if with_names:
return str
out(" return sbus_request_return_array_as_variant(dbus_req, %s, (uint8_t*)out_val, prop_len, sizeof(%s));", prop.dbus_constant, prop.sssd_type)
if iface.properties:
iface_types = [ p.type for p in iface.properties ]
for prop in iface.properties:
out(" (%s_handler)(dbus_req, dbus_req->intf->handler_data, &%s_prop_val", prop.type, prop.type, new_line=False)
out(" ret = sbus_add_array_as_variant_to_dict(&iter_dict, \"%s\", %s, (uint8_t*)%s_out_val, %s_prop_len, sizeof(%s));", prop.c_name(), prop.dbus_constant, prop.type, prop.type, prop.sssd_type)
out(" ret = sbus_add_variant_to_dict(&iter_dict, \"%s\", %s, &%s_out_val);", prop.c_name(), prop.dbus_constant, prop.type)
for meth in iface.methods:
return invokers
for prop in iface.properties:
return invokers
if prop.readable:
for sig in iface.signals:
if sig.args:
if sig.args:
for prop in properties:
elif prop.readable:
elif prop.writable:
if prop.readable:
if iface.methods:
if iface.signals:
if iface.properties:
if include_header:
if iface.methods:
if iface.signals:
if iface.properties:
for meth in iface.methods:
for prop in iface.properties:
for meth in iface.methods:
for sig in iface.signals:
for prop in iface.properties:
for meth in iface.methods:
self.state_stack = []
try:
if self.state == STATE_IGNORED:
elif self.cur_object and name == STATE_ANNOTATION:
elif self.state == STATE_TOP:
if name == STATE_NODE:
elif self.state == STATE_NODE:
if name == STATE_INTERFACE:
elif self.state == STATE_INTERFACE:
if name == STATE_METHOD:
elif name == STATE_SIGNAL:
elif name == STATE_PROPERTY:
elif self.state == STATE_METHOD:
elif self.state == STATE_SIGNAL:
elif self.state == STATE_PROPERTY:
elif self.state == STATE_ARG:
if options.output:
if options.output:
try: