Skip to content

Commit

Permalink
CBGF tools made mode useful
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@1135 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Dec 4, 2011
1 parent c689dba commit 1196f9f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
5 changes: 2 additions & 3 deletions shared/tools/cbgf
@@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/sh

# Get our hands on basedir
LOCAL1=${PWD}
Expand All @@ -21,8 +21,7 @@ elif [ ! -r $3 ]; then
echo "Oops: $3 not found or not readable."
exit 1
else
xsltproc ${SHARED}/xsl/cbgf2xbgf-forward.xslt $1 > $1.forward.xbgf
xsltproc ${SHARED}/xsl/cbgf2xbgf-reverse.xslt $1 > $1.reverse.xbgf
${SHARED}/tools/cbgf2xbgf $1 $1.forward.xbgf $1.reverse.xbgf
${SHARED}/tools/xbgf $1.forward.xbgf $2 $2.res
${SHARED}/tools/xbgf $1.reverse.xbgf $3 $3.res
${SHARED}/tools/gdt $2 $3.res
Expand Down
20 changes: 20 additions & 0 deletions shared/tools/cbgf2xbgf
@@ -0,0 +1,20 @@
#!/bin/sh

# Get our hands on basedir
LOCAL1=${PWD}
cd `dirname $0`
cd ..
SHARED=${PWD}
cd ${LOCAL1}

if [ $# -ne 3 ]; then
echo "This tool produces two XBGF transformation chains from the given CBGF scenario"
echo "Usage: cbgf2xbgf <CBGF-input> <XBGF-forward-execution> <XBGF-reverse-execution>"
exit 1
elif [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
else
xsltproc ${SHARED}/xsl/cbgf2xbgf-forward.xslt $1 > $2
xsltproc ${SHARED}/xsl/cbgf2xbgf-reverse.xslt $1 > $3
fi
10 changes: 10 additions & 0 deletions shared/xsl/bgf-reformat.xslt
Expand Up @@ -22,7 +22,13 @@
<xsl:with-param name="expr" select="bgf:expression/choice/bgf:expression[1]"/>
</xsl:call-template>
<xsl:for-each select="./bgf:expression/choice/bgf:expression[position()&gt;1]">
<xsl:if test="not(contains($cfg/definition-separator-symbol,' '))">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="$cfg/definition-separator-symbol"/>
<xsl:if test="not(contains($cfg/definition-separator-symbol,' '))">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="no-parenthesis">
<xsl:with-param name="expr" select="."/>
</xsl:call-template>
Expand All @@ -38,6 +44,10 @@
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="$cfg/terminator-symbol"/>
<xsl:if test="not(contains($cfg/terminator-symbol,'\n'))">
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="bgf:expression">
<xsl:apply-templates select="./*"/>
Expand Down
18 changes: 12 additions & 6 deletions shared/xsl/cbgf2xbgf-reverse.xslt
Expand Up @@ -119,7 +119,8 @@
</xsl:template>
<xsl:template match="cbgf:factor-factor">
<xbgf:factor>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:factor>
</xsl:template>
<xsl:template match="cbgf:fold-unfold">
Expand Down Expand Up @@ -154,22 +155,26 @@
</xsl:template>
<xsl:template match="cbgf:massage-massage">
<xbgf:massage>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:massage>
</xsl:template>
<xsl:template match="cbgf:widen-narrow">
<xbgf:narrow>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:narrow>
</xsl:template>
<xsl:template match="cbgf:narrow-widen">
<xbgf:widen>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:widen>
</xsl:template>
<xsl:template match="cbgf:permute-permute">
<xbgf:permute>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:permute>
</xsl:template>
<xsl:template match="cbgf:rename-rename">
Expand All @@ -192,7 +197,8 @@
</xsl:template>
<xsl:template match="cbgf:replace-replace">
<xbgf:replace>
<xsl:copy-of select="*"/>
<xsl:copy-of select="bgf:expression[2]"/>
<xsl:copy-of select="bgf:expression[1]"/>
</xbgf:replace>
</xsl:template>
<xsl:template match="cbgf:detour-abridge">
Expand Down

0 comments on commit 1196f9f

Please sign in to comment.