diff options
author | Sunil Shetye | 2025-01-13 11:22:52 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-01-13 11:22:52 +0530 |
commit | 031e50acc3f42e96deb96972aae28eaa70bb37a0 (patch) | |
tree | 54a19b00537ec41d691d2c6aa5aa2e7aaf3d6a3d | |
parent | f11c6521020c8ae59e047c13413d9e526ab776db (diff) | |
download | Common-Interface-Project-031e50acc3f42e96deb96972aae28eaa70bb37a0.tar.gz Common-Interface-Project-031e50acc3f42e96deb96972aae28eaa70bb37a0.tar.bz2 Common-Interface-Project-031e50acc3f42e96deb96972aae28eaa70bb37a0.zip |
reduce debug
-rwxr-xr-x | blocks/Xcos/MxGraphParser.py | 15 | ||||
-rwxr-xr-x | blocks/Xcos/XmlParser.py | 14 | ||||
-rwxr-xr-x | blocks/Xcos/XmlToXcos.sh | 2 | ||||
-rwxr-xr-x | blocks/xcos2xml/replacesplitblocks.sh | 24 |
4 files changed, 16 insertions, 39 deletions
diff --git a/blocks/Xcos/MxGraphParser.py b/blocks/Xcos/MxGraphParser.py index e2891d9d..a80145ff 100755 --- a/blocks/Xcos/MxGraphParser.py +++ b/blocks/Xcos/MxGraphParser.py @@ -441,19 +441,13 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi print('split_point:', split_point, linkSegments) if attribid2 == sourceVertex: splitpoint = split_point - print('S_P:', splitpoint) else: splitpoint = split_point2 - print('S_P2:', splitpoint) result, i, left_array, right_array = identify_segment(linkSegments, splitpoint) - print('LR:', i, left_array, right_array) - print('waypoints:', split_point, waypoints) if not result: sys.exit(0) (linkid, sourceVertex2, targetVertex2, sourceType2, targetType2, style2, waypoints2, addSplit2, split_point_new, split_point2_new) = linkSegments[i] - print('SP2:', split_point, split_point2) array3 = waypoints - print('ARRAY3:', array3) componentOrdering += 1 geometry = {} @@ -461,16 +455,13 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi geometry['width'] = 7 geometry['x'] = splitpoint['x'] geometry['y'] = splitpoint['y'] - print('geo:', attribid2, splitpoint['x'], splitpoint['y']) if sourceType2 == 'ControlPort' or sourceType2 == 'CommandPort' or sourceType2 == 'CommandControlLink': split_style = 'CLKSPLIT_f' func_name = 'CLKSPLIT_f' else: split_style = 'SPLIT_f;flip=false;mirror=false' func_name = 'SPLIT_f' - print('BEFORE Splitblock:', outroot, nextattribid, componentOrdering, geometry, parentattribid, split_style, func_name) SplitBlock(outroot, nextattribid, componentOrdering, geometry, [], parent=parentattribid, style=split_style, func_name=func_name) - print('AFTER Splitblock:', outroot, nextattribid, componentOrdering, geometry, parentattribid, split_style, func_name) splitblockid = nextattribid nextattribid += 1 @@ -478,13 +469,10 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi outputCount = 0 port1 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort1ForSplit(outroot, splitblockid, sourceVertex2, targetVertex2, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, left_array) - print('nextAttribForSplit1:', nextAttribForSplit) port2 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort2ForSplit(outroot, splitblockid, sourceVertex2, targetVertex2, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, right_array) - print('nextAttribForSplit2:', nextAttribForSplit, sourceVertex, targetVertex) port3 = nextattribid (inputCount, outputCount, nextattribid, nextAttribForSplit) = addPort3ForSplit(outroot, splitblockid, sourceVertex, targetVertex, sourceType, targetType, sourceType2, targetType2, inputCount, outputCount, nextattribid, nextAttribForSplit, array3) - print('nextAttribForSplit3:', nextAttribForSplit, sourceVertex2, targetVertex2, splitblockid) newEdgeDict[attribid2][i] = ((nextAttribForSplit, sourceVertex2, port1, sourceType2, targetType, style2, left_array, addSplit2, split_point, split_point2)) nextAttribForSplit += 1 @@ -497,11 +485,8 @@ for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoi newEdgeDict[attribid] = [(nextAttribForSplit, port3, sourceVertex, sourceType, targetType, style, waypoints, addSplit, split_point, split_point2)] nextAttribForSplit += 1 LINKTOPORT[linkid] = port3 - print('LINKTOPORT', linkid, port3) -print() - for key, newEdges in newEdgeDict.items(): for (attribid, sourceVertex, targetVertex, sourceType, targetType, style, waypoints, addSplit, split_point, split_point2) in newEdges: try: diff --git a/blocks/Xcos/XmlParser.py b/blocks/Xcos/XmlParser.py index 6817c231..ef210bbe 100755 --- a/blocks/Xcos/XmlParser.py +++ b/blocks/Xcos/XmlParser.py @@ -530,15 +530,11 @@ for k, r_link in removable_link.items(): return_value += len(r_link) - 1 r_link_0 = r_link[0] - print(f"removable link: k: {k}, link: {r_link_0}") node = nodeList[r_link_0] link_data = edgeDict[r_link_0] # small removed link - print("#LINKDATA#:", link_data) - print("#NODEATTRIB#:", node.attrib) sourceVertex = link_data[1] # small link targetVertex = link_data[2] # small link - # print("#SV & #TV:", sourceVertex, targetVertex) if sourceVertex in link: node2 = nodeList[sourceVertex] @@ -577,8 +573,6 @@ for k, r_link in removable_link.items(): tar2x = link_data2[9]['x'] tar2y = link_data2[9]['y'] - print("TARX & TARY:", tarx, tary, tar2x, tar2y) - root.remove(node) root.remove(node2) @@ -588,19 +582,12 @@ for k, r_link in removable_link.items(): tType2 = IDLIST[targetVertex2] height = '7.0' width = '7.0' - # print("LINKDATA:", link_data) - # print("LINKDATA2:", link_data2) - # print("#NODEATTRIB2#:", node2.attrib) - # print("@SV & @TV:", sourceVertex2, targetVertex2) waypoints = link_data[6] # small link waypoints2 = link_data2[6] # big link # split_point = link_data[9] biglinkid = link_data2[0] smalllinkid = link_data[0] - print('waypoints2, split_point:', biglinkid, waypoints2, split_point) - print("SV & TV:", sourceVertex, targetVertex, sourceVertex2, targetVertex2) result, left_array, right_array = check_point_on_array(waypoints2, split_point) - print('left_array, right_array:', left_array, right_array) array3 = waypoints port1 = portType1(sType, sType2, tType2) @@ -818,5 +805,4 @@ for i, cell in enumerate(cells): output_path = f'{remove_dot_number(basename)}.{return_value}.xml' tree.write(output_path) -print(f"Modified XML saved to: {output_path}, {return_value}") sys.exit(return_value) diff --git a/blocks/Xcos/XmlToXcos.sh b/blocks/Xcos/XmlToXcos.sh index acceb64f..6b8556f4 100755 --- a/blocks/Xcos/XmlToXcos.sh +++ b/blocks/Xcos/XmlToXcos.sh @@ -44,7 +44,6 @@ 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 @@ -57,7 +56,6 @@ while test $rv -gt 0; do done INPUT1="$BASE.$rv.xml" -echo "Created $INPUT1" >&2 xmllint --format "$INPUT1" >"$TMPFILE2" cp -f "$TMPFILE2" "$INPUT1" diff --git a/blocks/xcos2xml/replacesplitblocks.sh b/blocks/xcos2xml/replacesplitblocks.sh index 784c0caf..5b0422da 100755 --- a/blocks/xcos2xml/replacesplitblocks.sh +++ b/blocks/xcos2xml/replacesplitblocks.sh @@ -105,22 +105,31 @@ INPUT1="$BASE-xcos2xml.xml" echo "Creating $INPUT1" >&2 cp -f "$TMPFILE2" "$INPUT1" +# Change BASE +BASE="$BASE-geometry" + xsltproc "$GEOMETRYXSL" "$INPUT1" >"$TMPFILE1" xmllint --format "$TMPFILE1" >"$TMPFILE2" -INPUT1="$BASE-geometry.xml" +INPUT1="$BASE.xml" echo "Creating $INPUT1" >&2 cp -f "$TMPFILE2" "$INPUT1" -rm -f "$BASE-geometry."*.xml +rm -f "$BASE."*.xml + +oldrv=100 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 + while test $rv -gt 0; do oldrv=$rv - INPUT1="$BASE-geometry.$rv.xml" - echo "Created $INPUT1" >&2 + INPUT1="$BASE.$rv.xml" xmllint --format "$INPUT1" >"$TMPFILE2" cp -f "$TMPFILE2" "$INPUT1" echo "Running Xcos/XmlParser.py $INPUT1" >&2 @@ -128,18 +137,17 @@ while test $rv -gt 0; do if ((rv >= oldrv)); then echo "ERROR: $rv >= $oldrv" >&2 - exit 2 + exit 102 fi done -INPUT1="$BASE-geometry.$rv.xml" -echo "Created $INPUT1" >&2 +INPUT1="$BASE.$rv.xml" xmllint --format "$INPUT1" >"$TMPFILE2" cp -f "$TMPFILE2" "$INPUT1" echo "Running Xcos/MxGraphParser.py $INPUT1" >&2 Xcos/MxGraphParser.py "$INPUT1" >&2 -INPUT1="$BASE-geometry.$rv.xcos" +INPUT1="$BASE.$rv.xcos" echo "Created $INPUT1" >&2 exit 0 |