From 8329720848afc1c4369df63295d1b7c9e0df8620 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 20 Mar 2024 10:45:28 +0100 Subject: [PATCH] hash_file(): skip also .include lines if skip_path_lines parameter is set --- src/actions.c | 7 ++++++- tests/xschemtest.tcl | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/actions.c b/src/actions.c index 7f0daeae..6c3c831a 100644 --- a/src/actions.c +++ b/src/actions.c @@ -48,12 +48,17 @@ unsigned int hash_file(const char *f, int skip_path_lines) fd = fopen(f, "r"); /* windows won't return \r in the lines and we chop them out anyway in the code */ if(fd) { while((line = my_fgets(fd, &n))) { - /* skip lines of type: '** sch_path: ...' or '-- sch_path: ...' or '// sym_path: ...' */ + /* skip lines of type: '** sch_path: ...' or '-- sch_path: ...' or '// sym_path: ...' + * skip also .include /path/to/some/file */ if(skip_path_lines && n > 14) { if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) { my_free(_ALLOC_ID_, &line); continue; } + if(!strncmp(line, ".include ", 9) || !strncmp(line, ".INCLUDE ", 9) ) { + my_free(_ALLOC_ID_, &line); + continue; + } } for(i = 0; i < n; ++i) { /* skip CRs so hashes will match on unix / windows */ diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index 4478f06f..e5477907 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -190,20 +190,20 @@ proc test_xschem_simulation {{f simulate_ff.sch}} { proc netlist_test {} { global netlist_dir foreach {f t h} { - rom8k.sch spice 665784374 + rom8k.sch spice 1488716921 greycnt.sch verilog 2899796185 - autozero_comp.sch spice 751826850 + autozero_comp.sch spice 2741955505 test_generators.sch spice 49312823 - inst_sch_select.sch spice 3684652626 + inst_sch_select.sch spice 1539700121 test_bus_tap.sch spice 188702715 loading.sch vhdl 2975204502 - mos_power_ampli.sch spice 125840804 + mos_power_ampli.sch spice 3405708328 hierarchical_tedax.sch tedax 998070173 LCC_instances.sch spice 1888015492 pcb_test1.sch tedax 1925087189 test_doublepin.sch spice 4159808692 simulate_ff.sch spice 574849766 - test_symbolgen.sch spice 2593807370 + test_symbolgen.sch spice 4216484684 test_mosgen.sch spice 2380524013 } { xschem set netlist_type $t