summaryrefslogtreecommitdiffstats
path: root/abc70930/src/base/cmd/cmdFlag.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-09-30 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-09-30 08:01:00 -0700
commite54d9691616b9a0326e2fdb3156bb4eeb8abfcd7 (patch)
treede3ffe87c3e17950351e3b7d97fa18318bd5ea9a /abc70930/src/base/cmd/cmdFlag.c
parent7d7e60f2dc84393cd4c5db22d2eaf7b1fb1a79b2 (diff)
downloadabc-e54d9691616b9a0326e2fdb3156bb4eeb8abfcd7.tar.gz
abc-e54d9691616b9a0326e2fdb3156bb4eeb8abfcd7.tar.bz2
abc-e54d9691616b9a0326e2fdb3156bb4eeb8abfcd7.zip
Version abc70930
Diffstat (limited to 'abc70930/src/base/cmd/cmdFlag.c')
-rw-r--r--abc70930/src/base/cmd/cmdFlag.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/abc70930/src/base/cmd/cmdFlag.c b/abc70930/src/base/cmd/cmdFlag.c
new file mode 100644
index 00000000..993f2a49
--- /dev/null
+++ b/abc70930/src/base/cmd/cmdFlag.c
@@ -0,0 +1,104 @@
+/**CFile****************************************************************
+
+ FileName [cmdFlag.c]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [Command processing package.]
+
+ Synopsis [Procedures working with flags.]
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - June 20, 2005.]
+
+ Revision [$Id: cmdFlag.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+#include "mainInt.h"
+
+////////////////////////////////////////////////////////////////////////
+/// DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+
+/**Function********************************************************************
+
+ Synopsis [Looks up value of flag in table of named values.]
+
+ Description [The command parser maintains a table of named values. These
+ are manipulated using the 'set' and 'unset' commands. The value of the
+ named flag is returned, or NULL is returned if the flag has not been set.]
+
+ SideEffects []
+
+******************************************************************************/
+char * Cmd_FlagReadByName( Abc_Frame_t * pAbc, char * flag )
+{
+ char * value;
+ if ( st_lookup(pAbc->tFlags, flag, &value) )
+ return value;
+ return NULL;
+}
+
+
+/**Function********************************************************************
+
+ Synopsis [Updates a set value by calling instead of set command.]
+
+ Description [Updates a set value by calling instead of set command.]
+
+ SideEffects []
+
+******************************************************************************/
+void Cmd_FlagUpdateValue( Abc_Frame_t * pAbc, char * key, char * value )
+{
+ char * oldValue, * newValue;
+ if ( !key )
+ return;
+ if ( value )
+ newValue = Extra_UtilStrsav(value);
+ else
+ newValue = Extra_UtilStrsav("");
+// newValue = NULL;
+ if ( st_delete(pAbc->tFlags, &key, &oldValue) )
+ FREE(oldValue);
+ st_insert( pAbc->tFlags, key, newValue );
+}
+
+
+/**Function********************************************************************
+
+ Synopsis [Deletes a set value by calling instead of unset command.]
+
+ Description [Deletes a set value by calling instead of unset command.]
+
+ SideEffects []
+
+******************************************************************************/
+void Cmd_FlagDeleteByName( Abc_Frame_t * pAbc, char * key )
+{
+ char *value;
+ if ( !key )
+ return;
+ if ( st_delete( pAbc->tFlags, &key, &value ) )
+ {
+ FREE(key);
+ FREE(value);
+ }
+}
+
+
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
+