diff --git a/ChangeLog b/ChangeLog index 5473aff7d..3a9482f89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-05-11 Holger Vogt + * inpcom.c: new fcn inp_fix_gnd_name: 'gnd' replaced by ' 0 ', if delimiters + are '(' or ' ' or ',' on the left and ')' or ' ' or ',' on the right. + fcn inp_bsource_compat: 'm={m}' replaced by ' ' + 2010-05-10 Holger Vogt * subckt.c:1349: fcn finishLine: add e. and h. to net name inside i(...). diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 39c7adf26..9584d18dd 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -230,6 +230,7 @@ inp_pathopen(char *name, char *mode) /* replace " gnd " by " 0 " and then remove excessive white spaces */ +/* static void inp_fix_gnd_name( struct line *deck ) { struct line *c = deck; @@ -239,7 +240,7 @@ inp_fix_gnd_name( struct line *deck ) { while ( c != NULL ) { gnd = c->li_line; if ( *gnd == '*' ) { c = c->li_next; continue; } - /* replace " gnd " by " 0 " */ + // replace " gnd " by " 0 " while ( (gnd = strstr( gnd, "gnd " ) ) ) { if ( isspace(*(gnd-1)) ) { memcpy( gnd, "0 ", 4 ); @@ -247,13 +248,37 @@ inp_fix_gnd_name( struct line *deck ) { gnd += 4; found_gnd = TRUE; } - /* remove white spaces after replacement, retain " 0 " */ + // remove white spaces after replacement, retain " 0 " if (found_gnd) c->li_line = inp_remove_ws(c->li_line); c = c->li_next; found_gnd = FALSE; } } +*/ + +/* replace "gnd" by " 0 " + Delimiters of gnd may be ' ' or ',' or '(' or ')' */ +static void +inp_fix_gnd_name( struct line *deck ) { + struct line *c = deck; + char *gnd; + + while ( c != NULL ) { + gnd = c->li_line; + if ( *gnd == '*' ) { c = c->li_next; continue; } + // replace "§gnd§" by "§ 0 §", § being a ' ' ',' '(' ')'. + while ( (gnd = strstr( gnd, "gnd" ) ) ) { + if (( isspace(*(gnd-1)) || *(gnd-1) == '(' || *(gnd-1) == ',' ) && + ( isspace(*(gnd+3)) || *(gnd+3) == ')' || *(gnd+3) == ',' )) + { + memcpy( gnd, " 0 ", 3 ); + } + gnd += 3; + } + c = c->li_next; + } +} static struct line* create_new_card( char *card_str, int *line_number ) { @@ -3890,7 +3915,7 @@ static void inp_bsource_compat(struct line *deck) equal_ptr = strstr(curr_line, "="); /* find the m={m} token and remove it */ if(str_ptr = strstr(curr_line, "m={m}")) - *str_ptr = '\0'; + memcpy( str_ptr, " ", 5 ); /* scan the line and remove all '{' and '}' */ str_ptr = curr_line; while (*str_ptr) {