src/base/cmd/cmdApi.c File Reference

#include "mainInt.h"
#include "cmdInt.h"
#include "abc.h"
Include dependency graph for cmdApi.c:

Go to the source code of this file.

Functions

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

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 }


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