From e897aa91a2a5c68a2f795f6a0a995600f13a85f8 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov
Date: Wed, 14 May 2014 21:29:29 -0700
Subject: Convert to extension-less headers for API
---
configure.ac | 2 +-
doc/intro.xhtml | 8 +-
examples/hybrid/dom.cxx | 4 +-
examples/hybrid/dom.hxx | 4 +-
examples/hybrid/driver.cxx | 4 +-
examples/hybrid/makefile | 2 +-
examples/inheritance/driver.cxx | 4 +-
examples/inheritance/position.cxx | 4 +-
examples/inheritance/position.hxx | 2 +-
examples/performance/driver.cxx | 2 +-
examples/persistence/driver.cxx | 4 +-
examples/persistence/position.cxx | 4 +-
examples/persistence/position.hxx | 2 +-
examples/processing/driver.cxx | 6 +-
examples/roundtrip/driver.cxx | 4 +-
examples/template/Makefile.am | 6 +
tests/parser/driver.cxx | 2 +-
tests/roundtrip/driver.cxx | 4 +-
tests/serializer/driver.cxx | 2 +-
tests/template/Makefile.am | 6 +
xml/Makefile.am | 7 +
xml/content | 35 +++
xml/content.hxx | 35 ---
xml/exception | 21 ++
xml/exception.hxx | 21 --
xml/forward | 19 ++
xml/forward.hxx | 19 --
xml/makefile | 9 +-
xml/parser | 473 ++++++++++++++++++++++++++++++++++++++
xml/parser.cxx | 2 +-
xml/parser.hxx | 473 --------------------------------------
xml/parser.ixx | 2 +-
xml/parser.txx | 2 +-
xml/qname | 87 +++++++
xml/qname.cxx | 2 +-
xml/qname.hxx | 87 -------
xml/serializer | 227 ++++++++++++++++++
xml/serializer.cxx | 2 +-
xml/serializer.hxx | 227 ------------------
xml/serializer.ixx | 2 +-
xml/value-traits | 53 +++++
xml/value-traits.cxx | 2 +-
xml/value-traits.hxx | 53 -----
xml/value-traits.txx | 4 +-
44 files changed, 984 insertions(+), 956 deletions(-)
create mode 100644 xml/content
delete mode 100644 xml/content.hxx
create mode 100644 xml/exception
delete mode 100644 xml/exception.hxx
create mode 100644 xml/forward
delete mode 100644 xml/forward.hxx
create mode 100644 xml/parser
delete mode 100644 xml/parser.hxx
create mode 100644 xml/qname
delete mode 100644 xml/qname.hxx
create mode 100644 xml/serializer
delete mode 100644 xml/serializer.hxx
create mode 100644 xml/value-traits
delete mode 100644 xml/value-traits.hxx
diff --git a/configure.ac b/configure.ac
index 8a81bde..9354db9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_PREREQ(2.60)
AC_INIT([libstudxml], [__value__(version)], [studxml-users@codesynthesis.com])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_SRCDIR([xml/exception.hxx])
+AC_CONFIG_SRCDIR([xml/exception])
AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc subdir-objects dist-bzip2 dist-zip tar-ustar])
m4_equote()[m4_ifdef]m4_dquote()([AM_PROG_AR], [AM_PROG_AR]) # Required by automake 1.12.
diff --git a/doc/intro.xhtml b/doc/intro.xhtml
index 46eb03a..ea0b8c9 100644
--- a/doc/intro.xhtml
+++ b/doc/intro.xhtml
@@ -278,7 +278,7 @@
and US-ASCII input encodings.
-#include <xml/parser.hxx>
+#include <xml/parser>
namespace xml
{
@@ -287,7 +287,7 @@ namespace xml
-#include <xml/serializer.hxx>
+#include <xml/serializer>
namespace xml
{
@@ -595,7 +595,7 @@ for (parser::event_type e: p)
class to represent such names:
-#include <xml/qname.hxx>
+#include <xml/qname>
namespace xml
{
@@ -993,6 +993,8 @@ cerr << p.next () << endl;
the table:
+#include <xml/content>
+
namespace xml
{
enum class content
diff --git a/examples/hybrid/dom.cxx b/examples/hybrid/dom.cxx
index cd1e0e0..c2ae6fd 100644
--- a/examples/hybrid/dom.cxx
+++ b/examples/hybrid/dom.cxx
@@ -1,8 +1,8 @@
// file : examples/hybrid/dom.cxx
// copyright : not copyrighted - public domain
-#include
-#include
+#include
+#include
#include "dom.hxx"
diff --git a/examples/hybrid/dom.hxx b/examples/hybrid/dom.hxx
index 3e1f8e3..4d99feb 100644
--- a/examples/hybrid/dom.hxx
+++ b/examples/hybrid/dom.hxx
@@ -8,8 +8,8 @@
#include
#include
-#include
-#include
+#include
+#include
// A simple, DOM-like in-memory representation of raw XML. It only supports
// empty, simple, and complex content (no mixed content) and is not
diff --git a/examples/hybrid/driver.cxx b/examples/hybrid/driver.cxx
index ca7421a..c1f5a0e 100644
--- a/examples/hybrid/driver.cxx
+++ b/examples/hybrid/driver.cxx
@@ -4,8 +4,8 @@
#include
#include
-#include
-#include
+#include
+#include
#include "dom.hxx"
diff --git a/examples/hybrid/makefile b/examples/hybrid/makefile
index 8e4a4f8..fe9439b 100644
--- a/examples/hybrid/makefile
+++ b/examples/hybrid/makefile
@@ -32,7 +32,7 @@ $(out_base)/: $(driver)
#
$(dist): name := $(subst $(src_root)/examples/,,$(src_base))
$(dist): sources := $(cxx_tun)
-$(dist): extras := README dom.xml
+$(dist): extras := README position.xml
$(dist): export extra_sources := $(filter-out driver.cxx,$(cxx_tun))
$(dist): export extra_headers := dom.hxx
$(dist): export extra_dist := $(extras) $(name)-vc9.vcproj \
diff --git a/examples/inheritance/driver.cxx b/examples/inheritance/driver.cxx
index d6cd5ea..c07a0ea 100644
--- a/examples/inheritance/driver.cxx
+++ b/examples/inheritance/driver.cxx
@@ -4,8 +4,8 @@
#include
#include
-#include
-#include
+#include
+#include
#include "position.hxx"
diff --git a/examples/inheritance/position.cxx b/examples/inheritance/position.cxx
index 9dde29e..1123efa 100644
--- a/examples/inheritance/position.cxx
+++ b/examples/inheritance/position.cxx
@@ -3,8 +3,8 @@
#include
-#include
-#include
+#include
+#include
#include "position.hxx"
diff --git a/examples/inheritance/position.hxx b/examples/inheritance/position.hxx
index d86995d..d6f3a3f 100644
--- a/examples/inheritance/position.hxx
+++ b/examples/inheritance/position.hxx
@@ -8,7 +8,7 @@
#include
#include
-#include // xml::{parser,serializer} forward declarations.
+#include // xml::{parser,serializer} forward declarations.
class position
{
diff --git a/examples/performance/driver.cxx b/examples/performance/driver.cxx
index 7d096d6..403e821 100644
--- a/examples/performance/driver.cxx
+++ b/examples/performance/driver.cxx
@@ -5,7 +5,7 @@
#include
#include
-#include
+#include
#include "time.hxx"
diff --git a/examples/persistence/driver.cxx b/examples/persistence/driver.cxx
index d62dd3b..8792716 100644
--- a/examples/persistence/driver.cxx
+++ b/examples/persistence/driver.cxx
@@ -4,8 +4,8 @@
#include
#include
-#include
-#include
+#include
+#include
#include "position.hxx"
diff --git a/examples/persistence/position.cxx b/examples/persistence/position.cxx
index 9f4f701..a0430b4 100644
--- a/examples/persistence/position.cxx
+++ b/examples/persistence/position.cxx
@@ -3,8 +3,8 @@
#include
-#include
-#include
+#include
+#include
#include "position.hxx"
diff --git a/examples/persistence/position.hxx b/examples/persistence/position.hxx
index 26b04f5..fb8c897 100644
--- a/examples/persistence/position.hxx
+++ b/examples/persistence/position.hxx
@@ -8,7 +8,7 @@
#include
#include
-#include // xml::{parser,serializer} forward declarations.
+#include // xml::{parser,serializer} forward declarations.
enum object_type {building, mountain};
diff --git a/examples/processing/driver.cxx b/examples/processing/driver.cxx
index 97669c5..18950b2 100644
--- a/examples/processing/driver.cxx
+++ b/examples/processing/driver.cxx
@@ -5,9 +5,9 @@
#include
#include
-#include
-#include
-#include
+#include
+#include
+#include
using namespace std;
using namespace xml;
diff --git a/examples/roundtrip/driver.cxx b/examples/roundtrip/driver.cxx
index b83988b..9b8d512 100644
--- a/examples/roundtrip/driver.cxx
+++ b/examples/roundtrip/driver.cxx
@@ -5,8 +5,8 @@
#include
#include
-#include
-#include
+#include
+#include
using namespace std;
using namespace xml;
diff --git a/examples/template/Makefile.am b/examples/template/Makefile.am
index 64e4d1f..37d9509 100644
--- a/examples/template/Makefile.am
+++ b/examples/template/Makefile.am
@@ -11,3 +11,9 @@ AM_CPPFLAGS = -I'$(top_builddir)' -I'$(top_srcdir)'
TESTS=$(top_builddir)/tester
TESTS_ENVIRONMENT=example=1; export example;
+
+# Make sure make doesn't try to build the no-extension headers
+# thinking that they are executable. Those are pulled in through
+# auto-generated dependencies.
+#
+__foreach_w__(__f,__path__(xml_headers),$(top_srcdir)/xml/__f ): ; @:
diff --git a/tests/parser/driver.cxx b/tests/parser/driver.cxx
index 2afe522..4e0fbae 100644
--- a/tests/parser/driver.cxx
+++ b/tests/parser/driver.cxx
@@ -12,7 +12,7 @@
#include
#include
-#include
+#include
using namespace std;
using namespace xml;
diff --git a/tests/roundtrip/driver.cxx b/tests/roundtrip/driver.cxx
index 48c96b4..e7a07f8 100644
--- a/tests/roundtrip/driver.cxx
+++ b/tests/roundtrip/driver.cxx
@@ -7,8 +7,8 @@
#include
#include
-#include
-#include
+#include
+#include
using namespace std;
using namespace xml;
diff --git a/tests/serializer/driver.cxx b/tests/serializer/driver.cxx
index 0f22107..796a384 100644
--- a/tests/serializer/driver.cxx
+++ b/tests/serializer/driver.cxx
@@ -11,7 +11,7 @@
#include
#include
-#include
+#include
using namespace std;
using namespace xml;
diff --git a/tests/template/Makefile.am b/tests/template/Makefile.am
index 9d198f1..d8b5b50 100644
--- a/tests/template/Makefile.am
+++ b/tests/template/Makefile.am
@@ -13,3 +13,9 @@ TESTS=$(top_builddir)/tester
TESTS_ENVIRONMENT=example=; export example;
CLEANFILES = test.out
+
+# Make sure make doesn't try to build the no-extension headers
+# thinking that they are executable. Those are pulled in through
+# auto-generated dependencies.
+#
+__foreach_w__(__f,__path__(xml_headers),$(top_srcdir)/xml/__f ): ; @:
diff --git a/xml/Makefile.am b/xml/Makefile.am
index ebe357e..46be59f 100644
--- a/xml/Makefile.am
+++ b/xml/Makefile.am
@@ -20,5 +20,12 @@ endif
libstudxml_la_SOURCES += __path__(genx_sources)
nobase_studxmlinclude_HEADERS += __path__(genx_headers)
+nobase_studxmlinclude_HEADERS += __path__(xml_headers)
+
+# Make sure make doesn't try to build the no-extension headers
+# thinking that they are executable.
+#
+__foreach_w__(__f,__path__(xml_headers),__f $(top_srcdir)/xml/__f ): ; @:
+
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -DLIBSTUDXML_DYNAMIC_LIB
AM_LDFLAGS = -release __value__(interface_version) -no-undefined
diff --git a/xml/content b/xml/content
new file mode 100644
index 0000000..e37607f
--- /dev/null
+++ b/xml/content
@@ -0,0 +1,35 @@
+// file : xml/content -*- C++ -*-
+// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef XML_CONTENT
+#define XML_CONTENT
+
+#include
+
+namespace xml
+{
+ // XML content model. C++11 enum class emulated for C++98.
+ //
+ struct content
+ {
+ enum value
+ {
+ // element characters whitespaces notes
+ empty, // no no ignored
+ simple, // no yes preserved content accumulated
+ complex, // yes no ignored
+ mixed // yes yes preserved
+ };
+
+ content (value v): v_ (v) {};
+ operator value () const {return v_;}
+
+ private:
+ value v_;
+ };
+}
+
+#include
+
+#endif // XML_CONTENT
diff --git a/xml/content.hxx b/xml/content.hxx
deleted file mode 100644
index 575ef1d..0000000
--- a/xml/content.hxx
+++ /dev/null
@@ -1,35 +0,0 @@
-// file : xml/content.hxx
-// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
-// license : MIT; see accompanying LICENSE file
-
-#ifndef XML_CONTENT_HXX
-#define XML_CONTENT_HXX
-
-#include
-
-namespace xml
-{
- // XML content model. C++11 enum class emulated for C++98.
- //
- struct content
- {
- enum value
- {
- // element characters whitespaces notes
- empty, // no no ignored
- simple, // no yes preserved content accumulated
- complex, // yes no ignored
- mixed // yes yes preserved
- };
-
- content (value v): v_ (v) {};
- operator value () const {return v_;}
-
- private:
- value v_;
- };
-}
-
-#include
-
-#endif // XML_CONTENT_HXX
diff --git a/xml/exception b/xml/exception
new file mode 100644
index 0000000..1fe1eb2
--- /dev/null
+++ b/xml/exception
@@ -0,0 +1,21 @@
+// file : xml/exception -*- C++ -*-
+// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef XML_EXCEPTION
+#define XML_EXCEPTION
+
+#include
+
+#include
+
+#include
+
+namespace xml
+{
+ struct LIBSTUDXML_EXPORT exception: std::exception {};
+}
+
+#include
+
+#endif // XML_EXCEPTION
diff --git a/xml/exception.hxx b/xml/exception.hxx
deleted file mode 100644
index c9895bb..0000000
--- a/xml/exception.hxx
+++ /dev/null
@@ -1,21 +0,0 @@
-// file : xml/exception.hxx
-// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
-// license : MIT; see accompanying LICENSE file
-
-#ifndef XML_EXCEPTION_HXX
-#define XML_EXCEPTION_HXX
-
-#include
-
-#include
-
-#include
-
-namespace xml
-{
- struct LIBSTUDXML_EXPORT exception: std::exception {};
-}
-
-#include
-
-#endif // XML_EXCEPTION_HXX
diff --git a/xml/forward b/xml/forward
new file mode 100644
index 0000000..8d474c7
--- /dev/null
+++ b/xml/forward
@@ -0,0 +1,19 @@
+// file : xml/forward -*- C++ -*-
+// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef XML_FORWARD
+#define XML_FORWARD
+
+#include
+
+namespace xml
+{
+ class qname;
+ class parser;
+ class serializer;
+}
+
+#include
+
+#endif // XML_FORWARD
diff --git a/xml/forward.hxx b/xml/forward.hxx
deleted file mode 100644
index bacd5f5..0000000
--- a/xml/forward.hxx
+++ /dev/null
@@ -1,19 +0,0 @@
-// file : xml/forward.hxx
-// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
-// license : MIT; see accompanying LICENSE file
-
-#ifndef XML_FORWARD_HXX
-#define XML_FORWARD_HXX
-
-#include
-
-namespace xml
-{
- class qname;
- class parser;
- class serializer;
-}
-
-#include
-
-#endif // XML_FORWARD_HXX
diff --git a/xml/makefile b/xml/makefile
index 6c8f3b9..52203aa 100644
--- a/xml/makefile
+++ b/xml/makefile
@@ -5,6 +5,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
sources := qname.cxx parser.cxx serializer.cxx value-traits.cxx
+xml_headers := content exception forward qname parser serializer value-traits
# Expat.
#
@@ -72,6 +73,12 @@ $(out_base)/: $(studxml.l)
# Dist.
#
+
+# Set it for the out_root so that it is visible in examples/tests. See
+# Makefile.am for why we need it there.
+#
+$(our_root)/%.dist: export xml_headers := $(xml_headers)
+
$(dist): export sources := $(sources)
$(dist): export expat_sources := $(expat_sources)
$(dist): export expat_headers := $(expat_headers)
@@ -89,7 +96,7 @@ $(dist): export interface_version = $(shell sed -e \
$(dist):
$(call dist-data,$(sources) $(expat_sources) $(genx_sources))
- $(call dist-data,$(headers) $(expat_headers) $(genx_headers))
+ $(call dist-data,$(headers) $(xml_headers) $(expat_headers) $(genx_headers))
$(call dist-data,$(data_dist) details/config.h.in)
$(call meta-vc9proj,libstudxml-vc9.vcproj)
$(call meta-vc10proj,libstudxml-vc10.vcxproj)
diff --git a/xml/parser b/xml/parser
new file mode 100644
index 0000000..a1b6250
--- /dev/null
+++ b/xml/parser
@@ -0,0 +1,473 @@
+// file : xml/parser -*- C++ -*-
+// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef XML_PARSER
+#define XML_PARSER
+
+#include
+
+#include