Skip to content

Commit

Permalink
script to convert xml to xcos
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilshetye committed Jan 2, 2025
1 parent 373ba7b commit d4669e5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
62 changes: 62 additions & 0 deletions blocks/Xcos/XmlToXcos.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions blocks/eda-frontend/public/geometry.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''">
Expand Down

0 comments on commit d4669e5

Please sign in to comment.