src/base/cmd/cmd.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct MvCommand Abc_Command
typedef struct MvAlias Abc_Alias

Functions

void Cmd_Init ()
void Cmd_End ()
void Cmd_CommandAdd (Abc_Frame_t *pAbc, char *sGroup, char *sName, void *pFunc, int fChanges)
int Cmd_CommandExecute (Abc_Frame_t *pAbc, char *sCommand)
char * Cmd_FlagReadByName (Abc_Frame_t *pAbc, char *flag)
void Cmd_FlagDeleteByName (Abc_Frame_t *pAbc, char *key)
void Cmd_FlagUpdateValue (Abc_Frame_t *pAbc, char *key, char *value)
void Cmd_HistoryAddCommand (Abc_Frame_t *pAbc, char *command)

Typedef Documentation

typedef struct MvAlias Abc_Alias

Definition at line 41 of file cmd.h.

typedef struct MvCommand Abc_Command

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

FileName [cmd.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [External declarations of the command package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
cmd.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] INCLUDES /// PARAMETERS /// STRUCTURE DEFINITIONS ///

Definition at line 40 of file cmd.h.


Function Documentation

void Cmd_CommandAdd ( Abc_Frame_t pAbc,
char *  sGroup,
char *  sName,
void *  pFunc,
int  fChanges 
)

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

FileName [cmdApi.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [External procedures of the command package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file cmdApi.c.

00045 {
00046     char * key, * value;
00047     Abc_Command * pCommand;
00048     int fStatus;
00049 
00050     key = sName;
00051     if ( st_delete( pAbc->tCommands, &key, &value ) ) 
00052     {
00053         // delete existing definition for this command 
00054         fprintf( pAbc->Err, "Cmd warning: redefining '%s'\n", sName );
00055         CmdCommandFree( (Abc_Command *)value );
00056     }
00057 
00058     // create the new command
00059     pCommand = ALLOC( Abc_Command, 1 );
00060     pCommand->sName   = Extra_UtilStrsav( sName );
00061     pCommand->sGroup  = Extra_UtilStrsav( sGroup );
00062     pCommand->pFunc   = pFunc;
00063     pCommand->fChange = fChanges;
00064     fStatus = st_insert( pAbc->tCommands, sName, (char *)pCommand );
00065     assert( !fStatus );  // the command should not be in the table
00066 }

int Cmd_CommandExecute ( Abc_Frame_t pAbc,
char *  sCommand 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file cmdApi.c.

00080 {
00081     int fStatus = 0, argc, loop;
00082     char * sCommandNext, **argv;
00083 
00084     if ( !pAbc->fAutoexac ) 
00085             Cmd_HistoryAddCommand(pAbc, sCommand);
00086     sCommandNext = sCommand;
00087     do 
00088     {
00089         sCommandNext = CmdSplitLine( pAbc, sCommandNext, &argc, &argv );
00090                 loop = 0;
00091                 fStatus = CmdApplyAlias( pAbc, &argc, &argv, &loop );
00092                 if ( fStatus == 0 ) 
00093                         fStatus = CmdCommandDispatch( pAbc, argc, argv );
00094         CmdFreeArgv( argc, argv );
00095     } 
00096     while ( fStatus == 0 && *sCommandNext != '\0' );
00097     return fStatus;
00098 }

void Cmd_End (  ) 
void Cmd_FlagDeleteByName ( Abc_Frame_t pAbc,
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 86 of file cmdFlag.c.

00087 {
00088     char *value;
00089     if ( !key )
00090         return;
00091     if ( st_delete( pAbc->tFlags, &key, &value ) ) 
00092     {
00093         FREE(key);
00094         FREE(value);
00095     }
00096 }

char* Cmd_FlagReadByName ( Abc_Frame_t pAbc,
char *  flag 
)

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

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

Definition at line 43 of file cmdFlag.c.

00044 {
00045     char * value;
00046     if ( st_lookup(pAbc->tFlags, flag, &value) )
00047         return value;
00048     return NULL;
00049 }

void Cmd_FlagUpdateValue ( Abc_Frame_t pAbc,
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 61 of file cmdFlag.c.

00062 {
00063     char * oldValue, * newValue;
00064     if ( !key )
00065         return;
00066     if ( value )
00067         newValue = Extra_UtilStrsav(value);
00068     else
00069         newValue = Extra_UtilStrsav("");
00070 //        newValue = NULL;
00071     if ( st_delete(pAbc->tFlags, &key, &oldValue) )
00072         FREE(oldValue);
00073     st_insert( pAbc->tFlags, key, newValue );
00074 }

void Cmd_HistoryAddCommand ( Abc_Frame_t p,
char *  command 
)

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

FileName [cmdHist.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Procedures working with history.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file cmdHist.c.

00045 {
00046     static char Buffer[MAX_STR];
00047     strcpy( Buffer, command );
00048     if ( command[strlen(command)-1] != '\n' )
00049         strcat( Buffer, "\n" );
00050     Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) );
00051 }

void Cmd_Init (  ) 

MACRO DEFINITIONS /// FUNCTION DEFINITIONS ///


Generated on Tue Jan 5 12:18:43 2010 for abc70930 by  doxygen 1.6.1