summaryrefslogtreecommitdiffstats
path: root/src/map/mio
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-06-10 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-06-10 08:01:00 -0700
commit9d09f583b6ea1181ebd5af1654acd3432c427445 (patch)
tree2ea6fb1cc6f70871f861dd0ccbe7f8522c34c765 /src/map/mio
parent9604ecb1745da3bde720cd7be5ee8f89dc6bd5ff (diff)
downloadabc-9d09f583b6ea1181ebd5af1654acd3432c427445.tar.gz
abc-9d09f583b6ea1181ebd5af1654acd3432c427445.tar.bz2
abc-9d09f583b6ea1181ebd5af1654acd3432c427445.zip
Version abc80610
Diffstat (limited to 'src/map/mio')
-rw-r--r--src/map/mio/mioFunc.c9
-rw-r--r--src/map/mio/mioRead.c28
2 files changed, 23 insertions, 14 deletions
diff --git a/src/map/mio/mioFunc.c b/src/map/mio/mioFunc.c
index 21a078f9..1fca5764 100644
--- a/src/map/mio/mioFunc.c
+++ b/src/map/mio/mioFunc.c
@@ -25,7 +25,9 @@
// these symbols (and no other) can appear in the formulas
#define MIO_SYMB_AND '*'
-#define MIO_SYMB_OR '+'
+#define MIO_SYMB_OR1 '+'
+#define MIO_SYMB_OR2 '|'
+#define MIO_SYMB_XOR '^'
#define MIO_SYMB_NOT '!'
#define MIO_SYMB_AFTNOT '\''
#define MIO_SYMB_OPEN '('
@@ -239,8 +241,9 @@ int Mio_GateCollectNames( char * pFormula, char * pPinNames[] )
// remove the non-name symbols
for ( pTemp = Buffer; *pTemp; pTemp++ )
- if ( *pTemp == MIO_SYMB_AND || *pTemp == MIO_SYMB_OR || *pTemp == MIO_SYMB_NOT
- || *pTemp == MIO_SYMB_OPEN || *pTemp == MIO_SYMB_CLOSE || *pTemp == MIO_SYMB_AFTNOT )
+ if ( *pTemp == MIO_SYMB_AND || *pTemp == MIO_SYMB_OR1 || *pTemp == MIO_SYMB_OR2
+ || *pTemp == MIO_SYMB_XOR || *pTemp == MIO_SYMB_NOT || *pTemp == MIO_SYMB_OPEN
+ || *pTemp == MIO_SYMB_CLOSE || *pTemp == MIO_SYMB_AFTNOT )
*pTemp = ' ';
// save the names
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c
index 13c2cdcd..dc665050 100644
--- a/src/map/mio/mioRead.c
+++ b/src/map/mio/mioRead.c
@@ -265,7 +265,7 @@ Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, bool fExtendedFormat )
// then rest of the expression
pToken = strtok( NULL, ";" );
- pGate->pForm = Extra_UtilStrsav( pToken );
+ pGate->pForm = chomp( pToken );
// read the pin info
// start the linked list of pins
@@ -392,21 +392,27 @@ Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, bool fExtendedFormat )
SeeAlso []
***********************************************************************/
-char *chomp( char *s )
+char * chomp( char *s )
{
- char *b = ALLOC(char, strlen(s)+1), *c = b;
- while (*s && isspace(*s))
- ++s;
- while (*s && !isspace(*s))
- *c++ = *s++;
- *c = 0;
- return b;
+ char *a, *b, *c;
+ // remove leading spaces
+ for ( b = s; *b; b++ )
+ if ( !isspace(*b) )
+ break;
+ // strsav the string
+ a = strcpy( ALLOC(char, strlen(b)+1), b );
+ // remove trailing spaces
+ for ( c = a+strlen(a); c > a; c-- )
+ if ( *c == 0 || isspace(*c) )
+ *c = 0;
+ else
+ break;
+ return a;
}
/**Function*************************************************************
- Synopsis [Duplicates string and returns it with leading and
- trailing spaces removed.]
+ Synopsis []
Description []