diff options
author | Sunil Shetye | 2025-01-02 12:26:45 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-01-02 12:27:17 +0530 |
commit | d4669e5c3497146577e34a117bcb0bcb4bceb0c9 (patch) | |
tree | ac5d3cd5863846795d3e3c4178dedfe57e758db9 | |
parent | 373ba7b8d4d3b821ef74adb58ab3571f09a453be (diff) | |
download | Common-Interface-Project-d4669e5c3497146577e34a117bcb0bcb4bceb0c9.tar.gz Common-Interface-Project-d4669e5c3497146577e34a117bcb0bcb4bceb0c9.tar.bz2 Common-Interface-Project-d4669e5c3497146577e34a117bcb0bcb4bceb0c9.zip |
script to convert xml to xcos
-rwxr-xr-x | blocks/Xcos/XmlToXcos.sh | 62 | ||||
-rw-r--r-- | blocks/eda-frontend/public/geometry.xsl | 12 |
2 files changed, 62 insertions, 12 deletions
diff --git a/blocks/Xcos/XmlToXcos.sh b/blocks/Xcos/XmlToXcos.sh new file mode 100755 index 00000000..e73f611d --- /dev/null +++ b/blocks/Xcos/XmlToXcos.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +usage() { + echo "Usage:" >&2 + echo " $0 input-file.xml" >&2 + exit 101 +} + +if test $# -ne 1; then + usage +fi + +INPUT="$1" +if test ! -f "$INPUT"; then + echo "$INPUT: not found" >&2 + usage +fi +if test "${INPUT%.xml}" != "$INPUT"; then + BASE="${INPUT%.xml}" + INPUT1="$INPUT" +else + echo "$INPUT: not xml" >&2 + usage +fi + +set -e + +TMPFILE2="$(mktemp -t XXXXXX.xml)" +trap "rm -f $TMPFILE2" 0 1 2 15 + +rm -f "$BASE."*.xml + +echo "Running Xcos/XmlParser.py $INPUT1" >&2 +Xcos/XmlParser.py "$INPUT1" >&2 && rv=$? || rv=$? + +while test $rv -gt 0; do + oldrv=$rv + + INPUT1="$BASE.$rv.xml" + echo "Created $INPUT1" >&2 + xmllint --format "$INPUT1" >"$TMPFILE2" + cp -f "$TMPFILE2" "$INPUT1" + echo "Running Xcos/XmlParser.py $INPUT1" >&2 + Xcos/XmlParser.py "$INPUT1" >&2 && rv=$? || rv=$? + + if ((rv >= oldrv)); then + echo "ERROR: $rv >= $oldrv" >&2 + exit 102 + fi +done + +INPUT1="$BASE.$rv.xml" +echo "Created $INPUT1" >&2 +xmllint --format "$INPUT1" >"$TMPFILE2" +cp -f "$TMPFILE2" "$INPUT1" + +echo "Running Xcos/MxGraphParser.py $INPUT1" >&2 +Xcos/MxGraphParser.py "$INPUT1" >&2 +INPUT1="$BASE.$rv.xcos" +echo "Created $INPUT1" >&2 + +exit 0 diff --git a/blocks/eda-frontend/public/geometry.xsl b/blocks/eda-frontend/public/geometry.xsl index 967a35b9..260c64e7 100644 --- a/blocks/eda-frontend/public/geometry.xsl +++ b/blocks/eda-frontend/public/geometry.xsl @@ -129,18 +129,6 @@ <!-- </xsl:when> </xsl:choose> --> </xsl:variable> - <xsl:attribute name="x11"> - <xsl:value-of select="@x"/> - </xsl:attribute> - <xsl:attribute name="width"> - <xsl:value-of select="@width"/> - </xsl:attribute> - <!-- <xsl:attribute name="ordering"> - <xsl:value-of select="$ordering"/> - </xsl:attribute> - <xsl:attribute name="noofport"> - <xsl:value-of select="$noofport"/> - </xsl:attribute> --> <xsl:attribute name="x"> <xsl:choose> <xsl:when test="$newx = ''"> |