diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-10-23 14:56:04 +1000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-10-25 10:58:06 -0700 |
commit | 05f95c85c8cad07bee233f1d4e205a12538365e1 (patch) | |
tree | e033ce57304caf8b9819533e0c68c38f2bd109df | |
parent | 16b2dab4e48462102d9990520562b0a9de2f9812 (diff) |
protocol: validate the protocol against a dtd
The scanner is not very forgiving if the protocol doesn't match it's
expectations and crashes without much of a notice. Thus, validate the protocol
against a DTD.
Move the protocol subdir forward so we validate first before trying anything
else, and install the DTD so we can validate weston's protocols as well.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | protocol/Makefile.am | 15 | ||||
-rw-r--r-- | protocol/wayland.dtd | 29 |
4 files changed, 47 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index ddf39d1..99607b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ if BUILD_DOCS doc_subdir = doc endif -SUBDIRS = src protocol $(doc_subdir) tests cursor +SUBDIRS = protocol src $(doc_subdir) tests cursor ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} diff --git a/configure.ac b/configure.ac index 59bfe26..f8be456 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,9 @@ fi AC_PATH_PROG(XSLTPROC, xsltproc) AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"]) +AC_PATH_PROG(XMLLINT, xmllint) +AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x"]) + AC_MSG_CHECKING([for docbook manpages stylesheet]) MANPAGES_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc], diff --git a/protocol/Makefile.am b/protocol/Makefile.am index cc9cd1c..e8b6290 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -1 +1,14 @@ -dist_pkgdata_DATA = wayland.xml +dist_pkgdata_DATA = wayland.xml wayland.dtd + +if HAVE_XMLLINT +.PHONY: validate + +.%.xml.valid: %.xml + $(AM_V_GEN)$(XMLLINT) --noout --dtdvalid $(srcdir)/wayland.dtd $^ > $@ + +validate: .wayland.xml.valid + +all-local: validate + +CLEANFILES = .wayland.xml.valid +endif diff --git a/protocol/wayland.dtd b/protocol/wayland.dtd new file mode 100644 index 0000000..b8b1573 --- /dev/null +++ b/protocol/wayland.dtd @@ -0,0 +1,29 @@ +<!ELEMENT protocol (copyright?, interface+)> + <!ATTLIST protocol name CDATA #REQUIRED> +<!ELEMENT copyright (#PCDATA)> +<!ELEMENT interface (description?,(request|event|enum)+)> + <!ATTLIST interface name CDATA #REQUIRED> + <!ATTLIST interface version CDATA #REQUIRED> +<!ELEMENT request (description?,arg*)> + <!ATTLIST request name CDATA #REQUIRED> + <!ATTLIST request type CDATA #IMPLIED> + <!ATTLIST request since CDATA #IMPLIED> +<!ELEMENT event (description?,arg*)> + <!ATTLIST event name CDATA #REQUIRED> + <!ATTLIST event since CDATA #IMPLIED> +<!ELEMENT enum (description?,entry*)> + <!ATTLIST enum name CDATA #REQUIRED> + <!ATTLIST enum since CDATA #IMPLIED> +<!ELEMENT entry (description?)> + <!ATTLIST entry name CDATA #REQUIRED> + <!ATTLIST entry value CDATA #REQUIRED> + <!ATTLIST entry summary CDATA #IMPLIED> + <!ATTLIST entry since CDATA #IMPLIED> +<!ELEMENT arg (description?)> + <!ATTLIST arg name CDATA #REQUIRED> + <!ATTLIST arg type CDATA #REQUIRED> + <!ATTLIST arg summary CDATA #IMPLIED> + <!ATTLIST arg interface CDATA #IMPLIED> + <!ATTLIST arg allow-null CDATA #IMPLIED> +<!ELEMENT description (#PCDATA)> + <!ATTLIST description summary CDATA #REQUIRED> |