Browse Source

update fcn inp_bsource_compat

pre-master-46
h_vogt 16 years ago
parent
commit
63c6260696
  1. 3
      ChangeLog
  2. 34
      src/frontend/inpcom.c

3
ChangeLog

@ -1,7 +1,8 @@
2010-05-14 Holger Vogt 2010-05-14 Holger Vogt
* dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c: * dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c:
tmalloc patch by R Larice tmalloc patch by R Larice
vngspice.sln, vngspice.proj: 64 bit support
vngspice.sln, vngspice.proj: 64 bit support
inpcom.c: exclude .control ... .endc lines from fcn inp_bsource_compat
2010-05-11 Holger Vogt 2010-05-11 Holger Vogt
* inpcom.c: new fcn inp_fix_gnd_name: 'gnd' replaced by ' 0 ', if delimiters * inpcom.c: new fcn inp_fix_gnd_name: 'gnd' replaced by ' 0 ', if delimiters

34
src/frontend/inpcom.c

@ -3878,16 +3878,29 @@ static void inp_compat(struct line *deck)
static void inp_bsource_compat(struct line *deck) static void inp_bsource_compat(struct line *deck)
{ {
char *curr_line, *equal_ptr, *str_ptr, *tmp_char, *new_str, *final_str;
char *equal_ptr, *str_ptr, *tmp_char, *new_str, *final_str;
char actchar, prevchar = ' '; char actchar, prevchar = ' ';
struct line *card = deck, *new_line, *tmp_ptr;
struct line *card, *new_line, *tmp_ptr;
wordlist *wl = NULL, *wlist = NULL, *cwl; wordlist *wl = NULL, *wlist = NULL, *cwl;
char buf[512]; char buf[512];
size_t i, xlen, ustate = 0; size_t i, xlen, ustate = 0;
int skip_control = 0;
for (card = deck; card; card = card->li_next) {
char *curr_line = card->li_line;
/* exclude any command inside .control ... .endc */
if ( ciprefix(".control", curr_line) ) {
skip_control ++;
continue;
} else if( ciprefix(".endc", curr_line) ) {
skip_control --;
continue;
} else if(skip_control > 0) {
continue;
}
while ( card != NULL )
{
curr_line = card->li_line;
if ( *curr_line == 'b' ) { if ( *curr_line == 'b' ) {
/* store starting point for later parsing, beginning of {expression} */ /* store starting point for later parsing, beginning of {expression} */
equal_ptr = strstr(curr_line, "="); equal_ptr = strstr(curr_line, "=");
@ -3990,11 +4003,14 @@ static void inp_bsource_compat(struct line *deck)
str_ptr++; str_ptr++;
} }
buf[i] = '\0'; buf[i] = '\0';
/* no parens {} around time, hertz, temper and the constants
pi and e which are defined in inpptree.c */
if ((*str_ptr == '(') || cieq(buf, "hertz") || cieq(buf, "temper") if ((*str_ptr == '(') || cieq(buf, "hertz") || cieq(buf, "temper")
|| cieq(buf, "time"))
|| cieq(buf, "time") || cieq(buf, "pi") || cieq(buf, "e"))
{ {
cwl->wl_word = copy(buf); cwl->wl_word = copy(buf);
} }
/* {} around all other tokens */
else { else {
xlen = strlen(buf); xlen = strlen(buf);
tmp_char = tmalloc(xlen + 3); tmp_char = tmalloc(xlen + 3);
@ -4055,7 +4071,7 @@ static void inp_bsource_compat(struct line *deck)
new_line->li_actual = NULL; new_line->li_actual = NULL;
new_line->li_line = final_str; new_line->li_line = final_str;
new_line->li_linenum = 0; new_line->li_linenum = 0;
// comment out current old R line
// comment out current old B line
*(card->li_line) = '*'; *(card->li_line) = '*';
// insert new B source line immediately after current line // insert new B source line immediately after current line
tmp_ptr = card->li_next; tmp_ptr = card->li_next;
@ -4067,7 +4083,5 @@ static void inp_bsource_compat(struct line *deck)
tfree(new_str); tfree(new_str);
tfree(tmp_char); tfree(tmp_char);
} /* end of if 'b' */ } /* end of if 'b' */
card = card->li_next;
}
} /* end of for loop */
} }
Loading…
Cancel
Save