From 1e74b21c498e2573a25e821b36ccb6acb6070a7e Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 10 May 2023 04:08:47 +0200 Subject: [PATCH] get_trailing_path(): do not confuse generator extension with schematic/symbol extension --- src/token.c | 8 ++++++-- xschem_library/generators/test_symbolgen.sch | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/token.c b/src/token.c index 7f497920..d794a146 100644 --- a/src/token.c +++ b/src/token.c @@ -1132,7 +1132,7 @@ const char *get_trailing_path(const char *str, int no_of_dir, int skip_ext) static char s[PATH_MAX]; /* safe to keep even with multiple schematic windows */ size_t len; size_t ext_pos, dir_pos; - int n_ext, n_dir, c, i; + int n_ext, n_dir, c, i, generator = 0; if(str == NULL) return NULL; my_strncpy(s, str, S(s)); @@ -1140,8 +1140,12 @@ const char *get_trailing_path(const char *str, int no_of_dir, int skip_ext) for(ext_pos=len, dir_pos=len, n_ext=0, n_dir=0, i=(int)len; i>=0; i--) { c = s[i]; - if(c=='.' && ++n_ext==1) ext_pos = i; + if(c=='.' && ++n_ext == 1) { + if(!generator) ext_pos = i; + if(generator) s[i] = '_'; + } if(c=='/' && ++n_dir==no_of_dir+1) dir_pos = i; + if(c=='(') generator = 1; } if(skip_ext) s[ext_pos] = '\0'; diff --git a/xschem_library/generators/test_symbolgen.sch b/xschem_library/generators/test_symbolgen.sch index a6add1f0..6056cf85 100644 --- a/xschem_library/generators/test_symbolgen.sch +++ b/xschem_library/generators/test_symbolgen.sch @@ -73,11 +73,11 @@ N 470 -640 520 -640 { lab=IN} N 600 -640 660 -640 { lab=IN_BUF3} -C {symbolgen.tcl(inv, @ROUT )} 150 -460 0 0 {name=x1 +C {symbolgen.tcl(inv,@ROUT\\)} 150 -460 0 0 {name=x1 tclcommand="edit_file [abs_sym_path symbolgen.tcl]" ROUT=1200} C {lab_pin.sym} 30 -520 0 0 {name=p1 lab=IN} -C {symbolgen.tcl(buf, @ROUT )} 150 -560 0 0 {name=x3 +C {symbolgen.tcl(buf,@ROUT\\)} 150 -560 0 0 {name=x3 tclcommand="edit_file [abs_sym_path symbolgen.tcl]" ROUT=1200} C {lab_pin.sym} 310 -560 0 1 {name=p2 lab=IN_BUF}