abc-master
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
cmdFlag.c
Go to the documentation of this file.
1
/**CFile****************************************************************
2
3
FileName [cmdFlag.c]
4
5
SystemName [ABC: Logic synthesis and verification system.]
6
7
PackageName [Command processing package.]
8
9
Synopsis [Procedures working with flags.]
10
11
Author [Alan Mishchenko]
12
13
Affiliation [UC Berkeley]
14
15
Date [Ver. 1.0. Started - June 20, 2005.]
16
17
Revision [$Id: cmdFlag.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18
19
***********************************************************************/
20
21
#include "
base/abc/abc.h
"
22
#include "
base/main/mainInt.h
"
23
24
ABC_NAMESPACE_IMPL_START
25
26
27
////////////////////////////////////////////////////////////////////////
28
/// DECLARATIONS ///
29
////////////////////////////////////////////////////////////////////////
30
31
////////////////////////////////////////////////////////////////////////
32
/// FUNCTION DEFINITIONS ///
33
////////////////////////////////////////////////////////////////////////
34
35
36
/**Function********************************************************************
37
38
Synopsis [Looks up value of flag in table of named values.]
39
40
Description [The command parser maintains a table of named values. These
41
are manipulated using the 'set' and 'unset' commands. The value of the
42
named flag is returned, or NULL is returned if the flag has not been set.]
43
44
SideEffects []
45
46
******************************************************************************/
47
char
*
Cmd_FlagReadByName
(
Abc_Frame_t
* pAbc,
char
* flag )
48
{
49
char
*
value
;
50
if
(
st__lookup
(pAbc->tFlags, flag, &value) )
51
return
value
;
52
return
NULL;
53
}
54
55
56
/**Function********************************************************************
57
58
Synopsis [Updates a set value by calling instead of set command.]
59
60
Description [Updates a set value by calling instead of set command.]
61
62
SideEffects []
63
64
******************************************************************************/
65
void
Cmd_FlagUpdateValue
(
Abc_Frame_t
* pAbc,
const
char
*
key
,
char
*
value
)
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
}
79
80
81
/**Function********************************************************************
82
83
Synopsis [Deletes a set value by calling instead of unset command.]
84
85
Description [Deletes a set value by calling instead of unset command.]
86
87
SideEffects []
88
89
******************************************************************************/
90
void
Cmd_FlagDeleteByName
(
Abc_Frame_t
* pAbc,
const
char
*
key
)
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
}
101
102
103
104
////////////////////////////////////////////////////////////////////////
105
/// END OF FILE ///
106
////////////////////////////////////////////////////////////////////////
107
108
109
ABC_NAMESPACE_IMPL_END
110
Cmd_FlagReadByName
ABC_NAMESPACE_IMPL_START char * Cmd_FlagReadByName(Abc_Frame_t *pAbc, char *flag)
DECLARATIONS ///.
Definition:
cmdFlag.c:47
st__delete
int st__delete(st__table *table, const char **keyp, char **value)
Definition:
st.c:375
st__insert
int st__insert(st__table *table, const char *key, char *value)
Definition:
st.c:171
abc.h
Cmd_FlagUpdateValue
void Cmd_FlagUpdateValue(Abc_Frame_t *pAbc, const char *key, char *value)
Definition:
cmdFlag.c:65
Extra_UtilStrsav
char * Extra_UtilStrsav(const char *s)
Definition:
extraUtilUtil.c:169
Abc_Frame_t
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition:
base/main/main.h:39
ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_END
Definition:
abc_global.h:108
mainInt.h
ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_START
Definition:
abc_global.h:107
st__lookup
int st__lookup(st__table *table, const char *key, char **value)
Definition:
st.c:114
ABC_FREE
#define ABC_FREE(obj)
Definition:
abc_global.h:232
key
enum keys key
Definition:
misc/espresso/main.h:25
value
int value
Definition:
misc/espresso/main.h:90
Cmd_FlagDeleteByName
void Cmd_FlagDeleteByName(Abc_Frame_t *pAbc, const char *key)
Definition:
cmdFlag.c:90
src
base
cmd
cmdFlag.c
Generated on Thu Dec 18 2014 16:11:52 for abc-master by
1.8.6