Generate introspection data from XML file

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-01-11 21:48:41 +01:00
parent 8d2e331b1a
commit 7e2c0f2e1e
4 changed files with 54 additions and 17 deletions

1
.gitignore vendored
View file

@ -18,3 +18,4 @@ doc/
zathura.1
zathurarc.5
.version-checks/
dbus-interface-definitions.c

View file

@ -4,7 +4,7 @@ include config.mk
include common.mk
PROJECT = zathura
OSOURCE = $(wildcard *.c)
OSOURCE = $(filter-out dbus-interface-definitions.c, $(wildcard *.c))
HEADER = $(wildcard *.h)
HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h
@ -37,8 +37,8 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
all: options ${PROJECT} po build-manpages
@ -64,7 +64,14 @@ version.h: version.h.in config.mk
-e 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' \
-e 's/ZVREV/${ZATHURA_VERSION_REV}/' \
-e 's/ZVAPI/${ZATHURA_API_VERSION}/' \
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h.tmp
$(QUIET)mv version.h.tmp version.h
dbus-interface-definitions.c: data/org.pwmt.zathura.xml
$(QUIET)echo "const char* DBUS_INTERFACE_XML =" > dbus-interface-definitions.c.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> dbus-interface-definitions.c.tmp
$(QUIET)echo ";" >> dbus-interface-definitions.c.tmp
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
%.o: %.c
$(ECHO) CC $<
@ -84,8 +91,18 @@ ${PROJECT}: ${OBJECTS}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
$(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
$(QUIET)rm -rf ${PROJECT} \
${OBJECTS} \
${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} \
${PROJECT}-debug \
.depend \
${PROJECT}.pc \
doc \
version.h \
version.h.tmp \
dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
@ -188,7 +205,7 @@ install-headers: ${PROJECT}.pc
install-dbus:
$(ECHO) installing D-Bus interface definitions
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.synctex.xml $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install-vimftplugin:
$(ECHO) installing Vim filetype plugin

View file

@ -1,10 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name='org.pwmt.zathura.synctex'>
<method name='View'>
<arg type='s' name='position' direction='in' />
<arg type='b' name='return' direction='out' />
</method>
<property type='s' name='filename' access='read' />
</interface>
</node>

29
data/org.pwmt.zathura.xml Normal file
View file

@ -0,0 +1,29 @@
<!DOCTYPE node PUBLIC '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
<node>
<interface name='org.pwmt.zathura'>
<!-- Open a document in a running zathura instance. -->
<method name='OpenDocument'>
<arg type='s' name='path' direction='in' />
<arg type='s' name='password' direction='in' />
<arg type='i' name='page' direction='in' />
<arg type='b' name='return' direction='out' />
</method>
<!-- Close open document. -->
<method name='CloseDocument'>
<arg type='b' name='return' direction='out' />
</method>
<!-- Go to a specific page . -->
<method name='GotoPage'>
<arg type='i' name='page' direction='in' />
<arg type='b' name='return' direction='out' />
</method>
<!-- Go to a page and highlight rectangles there. -->
<method name='HighlightRects'>
<arg type='i' name='page' direction='in' />
<arg type='a(dddd)' name='rectangles' direction='out' />
<arg type='b' name='return' direction='out' />
</method>
<property type='s' name='filename' access='read' />
</interface>
</node>