From 279f790f078325582aa62e562a766204034766e4 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Sat, 4 May 2024 16:33:53 +0200 Subject: Try generating C++ code from NeTEx XSDs using CodeSynthesis XSD --- scratch/netex-nl-cxx/.gitignore | 2 ++ scratch/netex-nl-cxx/merge-enums-into-basic.xslt | 23 +++++++++++++++++++ scratch/netex-nl-cxx/process.sh | 29 ++++++++++++++++++++++++ scratch/netex-nl-cxx/remove-enums-include.xslt | 12 ++++++++++ 4 files changed, 66 insertions(+) create mode 100644 scratch/netex-nl-cxx/.gitignore create mode 100644 scratch/netex-nl-cxx/merge-enums-into-basic.xslt create mode 100755 scratch/netex-nl-cxx/process.sh create mode 100644 scratch/netex-nl-cxx/remove-enums-include.xslt diff --git a/scratch/netex-nl-cxx/.gitignore b/scratch/netex-nl-cxx/.gitignore new file mode 100644 index 0000000..f7d74b2 --- /dev/null +++ b/scratch/netex-nl-cxx/.gitignore @@ -0,0 +1,2 @@ +/vendor/ +/gen/ diff --git a/scratch/netex-nl-cxx/merge-enums-into-basic.xslt b/scratch/netex-nl-cxx/merge-enums-into-basic.xslt new file mode 100644 index 0000000..6e3fdad --- /dev/null +++ b/scratch/netex-nl-cxx/merge-enums-into-basic.xslt @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/scratch/netex-nl-cxx/process.sh b/scratch/netex-nl-cxx/process.sh new file mode 100755 index 0000000..8ab7a94 --- /dev/null +++ b/scratch/netex-nl-cxx/process.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + +XSD_TAG="v9.3.0-draft1" + +rm -rf ./gen ./vendor/src +mkdir -p gen vendor/src + +curl -L "https://github.com/BISONNL/NeTEx-NL/archive/refs/tags/$XSD_TAG.tar.gz" -o ./vendor/netex-nl.tar.gz +tar -xzf ./vendor/netex-nl.tar.gz --strip-components 1 -C ./vendor/src/ + +xsltproc -o ./vendor/src/xsd/netex-nl-basic-new.xsd ./merge-enums-into-basic.xslt ./vendor/src/xsd/netex-nl-basic.xsd +xsltproc -o ./vendor/src/xsd/netex-nl-data-new.xsd ./remove-enums-include.xslt ./vendor/src/xsd/netex-nl-data.xsd +xsltproc -o ./vendor/src/xsd/netex-nl-new.xsd ./remove-enums-include.xslt ./vendor/src/xsd/netex-nl.xsd +rm ./vendor/src/xsd/netex-nl-enums.xsd +mv ./vendor/src/xsd/netex-nl-basic-new.xsd ./vendor/src/xsd/netex-nl-basic.xsd +mv ./vendor/src/xsd/netex-nl-data-new.xsd ./vendor/src/xsd/netex-nl-data.xsd +mv ./vendor/src/xsd/netex-nl-new.xsd ./vendor/src/xsd/netex-nl.xsd + +process () { + xsdcxx cxx-tree --output-dir ./gen --namespace-map http://www.opengis.net/gml/3.2=gml "vendor/src/xsd/$1.xsd" +} + +process gml-bison +process netex-nl-basic +process netex-nl-data +process netex-nl diff --git a/scratch/netex-nl-cxx/remove-enums-include.xslt b/scratch/netex-nl-cxx/remove-enums-include.xslt new file mode 100644 index 0000000..170f732 --- /dev/null +++ b/scratch/netex-nl-cxx/remove-enums-include.xslt @@ -0,0 +1,12 @@ + + + + + + + + + + + + -- cgit v1.2.3