diff --git a/shared/tools/ldf2bgf b/shared/tools/ldf2bgf index c612b790..8d60e859 100755 --- a/shared/tools/ldf2bgf +++ b/shared/tools/ldf2bgf @@ -1,20 +1,24 @@ -#! /bin/sh +#!/bin/sh -# Get our hands on the languedoc basedir LOCAL=${PWD} cd `dirname $0` cd ../.. SLPS=${PWD} cd ${LOCAL} -if [ $# -ne 2 ]; then - echo "This tool transforms Language Document Format to BNF-like Grammar Format" - echo "Usage: ldf2bgf " - exit 1 -elif [ ! -r $1 ]; then +if [ ! -r $1 ]; then echo "Oops: $1 not found or not readable." exit 1 -else +elif [ $# -eq 2 ] +then rm -f $2 xsltproc ${SLPS}/shared/xsl/ldf2bgf.xslt $1 > $2 +elif [ $# -eq 1 ] +then + xsltproc ${SLPS}/shared/xsl/ldf2bgf.xslt $1 > ${LOCAL}/`basename $1 .ldf`.bgf +else + echo "This tool transforms Language Document Format to BNF-like Grammar Format" + echo "Usage: ldf2bgf []" + exit 2 fi + diff --git a/shared/xsd/Makefile b/shared/xsd/Makefile index 687f7d44..2efb265b 100644 --- a/shared/xsd/Makefile +++ b/shared/xsd/Makefile @@ -1,8 +1,12 @@ +validator = ../../download/msv/msv.jar + build: +test: + ls -1 *.xsd | xargs -n1 java -jar ${validator} + clean: - rm -rf bin - rm -rf obj - rm -rf *.user - rm -rf *.suo + rm -rf bin obj + rm -f *.user + rm -f *.suo diff --git a/shared/xsl/Makefile b/shared/xsl/Makefile index f755e634..b01c4ff3 100644 --- a/shared/xsl/Makefile +++ b/shared/xsl/Makefile @@ -3,4 +3,6 @@ build: test: clean: - + rm -rf bin obj + rm -f *.user + rm -f *.suo diff --git a/shared/xsl/ldf2bgf.xslt b/shared/xsl/ldf2bgf.xslt index 48031acb..ca1ccdc3 100644 --- a/shared/xsl/ldf2bgf.xslt +++ b/shared/xsl/ldf2bgf.xslt @@ -11,7 +11,7 @@ - + diff --git a/topics/extraction/ldf2bgf/Makefile b/topics/extraction/ldf2bgf/Makefile new file mode 100644 index 00000000..076eb4aa --- /dev/null +++ b/topics/extraction/ldf2bgf/Makefile @@ -0,0 +1,14 @@ +ldf2bgf = ../../../shared/tools/ldf2bgf +validator = ../../../download/msv/msv.jar +bgfxsd = ../../../shared/xsd/bgf.xsd + +all: + make clean + make test + +test: + find ../../.. -name "*.ldf" | xargs -n1 ${ldf2bgf} + ls -1 *.bgf | xargs java -jar ${validator} ${bgfxsd} + +clean: + rm -f *.bgf