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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void CmdCommandAliasAdd (Abc_Frame_t *pAbc, char *sName, int argc, char **argv)
 DECLARATIONS ///. More...
 
void CmdCommandAliasPrint (Abc_Frame_t *pAbc, Abc_Alias *pAlias)
 
char * CmdCommandAliasLookup (Abc_Frame_t *pAbc, char *sCommand)
 
void CmdCommandAliasFree (Abc_Alias *pAlias)
 

Function Documentation

ABC_NAMESPACE_IMPL_START void CmdCommandAliasAdd ( Abc_Frame_t pAbc,
char *  sName,
int  argc,
char **  argv 
)

DECLARATIONS ///.

MACRO DEFINITIONS ///.

CFile****************************************************************

FileName [cmdAlias.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Procedures dealing with aliases in the command package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cmdAlias.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file cmdAlias.c.

47 {
48  Abc_Alias * pAlias;
49  int fStatus, i;
50 
51  pAlias = ABC_ALLOC(Abc_Alias, 1);
52  pAlias->sName = Extra_UtilStrsav(sName);
53  pAlias->argc = argc;
54  pAlias->argv = ABC_ALLOC(char *, pAlias->argc);
55  for(i = 0; i < argc; i++)
56  pAlias->argv[i] = Extra_UtilStrsav(argv[i]);
57  fStatus = st__insert( pAbc->tAliases, pAlias->sName, (char *) pAlias );
58  assert(!fStatus);
59 }
char ** argv
Definition: cmdInt.h:55
int argc
Definition: cmdInt.h:54
int st__insert(st__table *table, const char *key, char *value)
Definition: st.c:171
Definition: cmdInt.h:51
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_UtilStrsav(const char *s)
char * sName
Definition: cmdInt.h:53
#define assert(ex)
Definition: util_old.h:213
void CmdCommandAliasFree ( Abc_Alias pAlias)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file cmdAlias.c.

114 {
115  CmdFreeArgv( pAlias->argc, pAlias->argv );
116  ABC_FREE(pAlias->sName);
117  ABC_FREE(pAlias);
118 }
char ** argv
Definition: cmdInt.h:55
int argc
Definition: cmdInt.h:54
void CmdFreeArgv(int argc, char **argv)
Definition: cmdUtils.c:485
char * sName
Definition: cmdInt.h:53
#define ABC_FREE(obj)
Definition: abc_global.h:232
char* CmdCommandAliasLookup ( Abc_Frame_t pAbc,
char *  sCommand 
)

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

Synopsis [required]

Description [optional]

SideEffects [required]

SeeAlso [optional]

Definition at line 92 of file cmdAlias.c.

93 {
94  Abc_Alias * pAlias;
95  char * value;
96  if (! st__lookup( pAbc->tAliases, sCommand, &value))
97  return sCommand;
98  pAlias = (Abc_Alias *) value;
99  return pAlias->argv[0];
100 }
char ** argv
Definition: cmdInt.h:55
Definition: cmdInt.h:51
int st__lookup(st__table *table, const char *key, char **value)
Definition: st.c:114
int value
void CmdCommandAliasPrint ( Abc_Frame_t pAbc,
Abc_Alias pAlias 
)

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

Synopsis [required]

Description [optional]

SideEffects [required]

SeeAlso [optional]

Definition at line 72 of file cmdAlias.c.

73 {
74  int i;
75  fprintf(pAbc->Out, "%-15s", pAlias->sName);
76  for(i = 0; i < pAlias->argc; i++)
77  fprintf( pAbc->Out, " %s", pAlias->argv[i] );
78  fprintf( pAbc->Out, "\n" );
79 }
char ** argv
Definition: cmdInt.h:55
int argc
Definition: cmdInt.h:54
char * sName
Definition: cmdInt.h:53