Integrated code from tclspice, brorson xspice and Vera memleak.

This commit is contained in:
pnenzi
2003-07-23 19:36:39 +00:00
parent 0a0b64d23f
commit 8362dec274
214 changed files with 5388 additions and 1269 deletions
+77 -4
View File
@@ -159,14 +159,86 @@ gettok(char **s)
return (copy(buf));
}
/*-------------------------------------------------------------------------*
* gettok_noparens was added by SDB on 4.21.2003.
* It acts like gettok, except that it stops parsing when it hits a paren
* (i.e. it treats parens like whitespace). It is used in translate (subckt.c)
* while looking for the POLY token.
*-------------------------------------------------------------------------*/
char *
gettok_noparens(char **s)
{
char buf[BSIZE_SP];
int i = 0;
char c;
while (isspace(**s))
(*s)++;
if (!**s)
return (NULL);
while ((c = **s) && !isspace(c) &&
( **s != '(' ) && ( **s != ')' ) ) {
buf[i++] = *(*s)++;
}
buf[i] = '\0';
while (isspace(**s))
(*s)++;
return (copy(buf));
}
/*-------------------------------------------------------------------------*
* get_l_paren iterates the pointer forward in a string until it hits
* the position after the next left paren "(". It returns 0 if it found a left
* paren, and 1 if no left paren is found.
*-------------------------------------------------------------------------*/
int
get_l_paren(char **s)
{
while (**s && ( **s != '(' ) )
(*s)++;
if (!**s)
return (1);
(*s)++;
if (!**s)
return (1);
else
return 0;
}
/*-------------------------------------------------------------------------*
* get_r_paren iterates the pointer forward in a string until it hits
* the position after the next right paren ")". It returns 0 if it found a right
* paren, and 1 if no right paren is found.
*-------------------------------------------------------------------------*/
int
get_r_paren(char **s)
{
while (**s && ( **s != ')' ) )
(*s)++;
if (!**s)
return (1);
(*s)++;
if (!**s)
return (1);
else
return 0;
}
#ifndef HAVE_BCOPY
#ifndef bcopy
void
bcopy(register char *from, register char *to, register int num)
bcopy(const void *vfrom, void *vto, size_t num)
{
register const char *from = vfrom;
register char *to = vto;
while (num-- > 0)
*to++ = *from++;
return;
@@ -176,12 +248,13 @@ bcopy(register char *from, register char *to, register int num)
#ifndef bzero
/* can't declare void here, because we've already used it in this file */
/* and haven't declared it void before the use */
int
bzero(register char *ptr, register int num)
void
bzero(void *vptr, size_t num)
{
register char *ptr=vptr;
while (num-- > 0)
*ptr++ = '\0';
return (0);
return;
}
#endif