Browse Source

new replacement of gnd by 0

pre-master-46
h_vogt 16 years ago
parent
commit
0bebd1e9e0
  1. 5
      ChangeLog
  2. 31
      src/frontend/inpcom.c

5
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(...).

31
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) {

Loading…
Cancel
Save