From 28ed1351f1dfa8424ce892bc9e2e79e626a4d55c Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 3 Dec 2023 21:33:03 +0100 Subject: [PATCH] spice.awk: do not join user code lines --- src/break.awk | 4 ++-- src/spice.awk | 10 +++++++++- tests/xschemtest.tcl | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/break.awk b/src/break.awk index ec9e6627..e8db5253 100755 --- a/src/break.awk +++ b/src/break.awk @@ -25,7 +25,7 @@ BEGIN{ quote=0 } -/^\*\*\*\* begin user architecture code/ { user_code = 1 } +/^\*\*\*\* begin user (architecture|header) code/ { user_code = 1 } { pos=0 @@ -75,4 +75,4 @@ BEGIN{ quote=0 } } } -/^\*\*\*\* end user architecture code/ { user_code = 0 } +/^\*\*\*\* end user (architecture|header) code/ { user_code = 0 } diff --git a/src/spice.awk b/src/spice.awk index ec516cef..9a14f2ea 100755 --- a/src/spice.awk +++ b/src/spice.awk @@ -38,7 +38,11 @@ BEGIN{ # join split lines { - if($0 ~ /^[+]/) { + + if($0 ~ /^\*\*\*\* begin user (architecture|header) code/) { + user_code = 1 + } + if($0 ~ /^[+]/ && !user_code) { yy = yy " " substr($0,2) next } @@ -52,9 +56,13 @@ BEGIN{ } line[lines++] = $0 } + if($0 ~ /^\*\*\*\* end user (architecture|header) code/) { + user_code = 0 + } } END{ + user_code = 0 $0=yy line[lines++] = $0 diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index 96f89609..52c2da82 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -194,12 +194,12 @@ proc netlist_test {} { greycnt.sch verilog 3032956185 autozero_comp.sch spice 751826850 test_generators.sch spice 49312823 - inst_sch_select.sch spice 2432089114 + inst_sch_select.sch spice 2240134366 test_bus_tap.sch spice 188702715 loading.sch vhdl 2975204502 mos_power_ampli.sch spice 125840804 hierarchical_tedax.sch tedax 998070173 - LCC_instances.sch spice 1646579002 + LCC_instances.sch spice 1888015492 pcb_test1.sch tedax 1925087189 test_doublepin.sch spice 4159808692 simulate_ff.sch spice 574849766