abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cmdFlag.c File Reference
#include "base/abc/abc.h"
#include "base/main/mainInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START char * Cmd_FlagReadByName (Abc_Frame_t *pAbc, char *flag)
 DECLARATIONS ///. More...
 
void Cmd_FlagUpdateValue (Abc_Frame_t *pAbc, const char *key, char *value)
 
void Cmd_FlagDeleteByName (Abc_Frame_t *pAbc, const char *key)
 

Function Documentation

void Cmd_FlagDeleteByName ( Abc_Frame_t pAbc,
const char *  key 
)

Function********************************************************************

Synopsis [Deletes a set value by calling instead of unset command.]

Description [Deletes a set value by calling instead of unset command.]

SideEffects []

Definition at line 90 of file cmdFlag.c.

91 {
92  char *value;
93  if ( !key )
94  return;
95  if ( st__delete( pAbc->tFlags, &key, &value ) )
96  {
97  ABC_FREE(key);
98  ABC_FREE(value);
99  }
100 }
int st__delete(st__table *table, const char **keyp, char **value)
Definition: st.c:375
#define ABC_FREE(obj)
Definition: abc_global.h:232
enum keys key
int value
ABC_NAMESPACE_IMPL_START char* Cmd_FlagReadByName ( Abc_Frame_t pAbc,
char *  flag 
)

DECLARATIONS ///.

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

]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 []

Definition at line 47 of file cmdFlag.c.

48 {
49  char * value;
50  if ( st__lookup(pAbc->tFlags, flag, &value) )
51  return value;
52  return NULL;
53 }
int st__lookup(st__table *table, const char *key, char **value)
Definition: st.c:114
int value
void Cmd_FlagUpdateValue ( Abc_Frame_t pAbc,
const char *  key,
char *  value 
)

Function********************************************************************

Synopsis [Updates a set value by calling instead of set command.]

Description [Updates a set value by calling instead of set command.]

SideEffects []

Definition at line 65 of file cmdFlag.c.

66 {
67  char * oldValue, * newValue;
68  if ( !key )
69  return;
70  if ( value )
71  newValue = Extra_UtilStrsav(value);
72  else
73  newValue = Extra_UtilStrsav("");
74 // newValue = NULL;
75  if ( st__delete(pAbc->tFlags, &key, &oldValue) )
76  ABC_FREE(oldValue);
77  st__insert( pAbc->tFlags, key, newValue );
78 }
int st__delete(st__table *table, const char **keyp, char **value)
Definition: st.c:375
int st__insert(st__table *table, const char *key, char *value)
Definition: st.c:171
char * Extra_UtilStrsav(const char *s)
#define ABC_FREE(obj)
Definition: abc_global.h:232
enum keys key
int value