diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-18 13:54:16 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-18 13:54:16 -0800 |
commit | c06bdc151cdca0279836b3a8446b8f0021c8024f (patch) | |
tree | 24ceef507525fdce69028124d8fe86e54ee60c22 /src | |
parent | d662e7ff683941d29c87cf5d64cd15635c0e3973 (diff) | |
download | abc-c06bdc151cdca0279836b3a8446b8f0021c8024f.tar.gz abc-c06bdc151cdca0279836b3a8446b8f0021c8024f.tar.bz2 abc-c06bdc151cdca0279836b3a8446b8f0021c8024f.zip |
Added check if a given command exists.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/cmd/cmd.h | 1 | ||||
-rw-r--r-- | src/base/cmd/cmdApi.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/base/cmd/cmd.h b/src/base/cmd/cmd.h index 55cad6e5..4d412bac 100644 --- a/src/base/cmd/cmd.h +++ b/src/base/cmd/cmd.h @@ -52,6 +52,7 @@ extern void Cmd_Init( Abc_Frame_t * pAbc ); extern void Cmd_End( Abc_Frame_t * pAbc ); /*=== cmdApi.c ========================================================*/ typedef int (*Cmd_CommandFuncType)(Abc_Frame_t*, int, char**); +extern int Cmd_CommandIsDefined( Abc_Frame_t * pAbc, const char * sName ); extern void Cmd_CommandAdd( Abc_Frame_t * pAbc, const char * sGroup, const char * sName, Cmd_CommandFuncType pFunc, int fChanges ); extern ABC_DLL int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * sCommand ); /*=== cmdFlag.c ========================================================*/ diff --git a/src/base/cmd/cmdApi.c b/src/base/cmd/cmdApi.c index 6aa5b845..29e13837 100644 --- a/src/base/cmd/cmdApi.c +++ b/src/base/cmd/cmdApi.c @@ -44,6 +44,22 @@ ABC_NAMESPACE_IMPL_START SeeAlso [] ***********************************************************************/ +int Cmd_CommandIsDefined( Abc_Frame_t * pAbc, const char * sName ) +{ + return st__is_member( pAbc->tCommands, sName ); +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ void Cmd_CommandAdd( Abc_Frame_t * pAbc, const char * sGroup, const char * sName, Cmd_CommandFuncType pFunc, int fChanges ) { const char * key; |