mirror of https://github.com/YosysHQ/abc.git
Updates to history printing.
This commit is contained in:
parent
b25d9c482a
commit
43426f0a94
|
|
@ -436,7 +436,7 @@ int CmdCommandAbcrc( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
******************************************************************************/
|
||||
int CmdCommandHistory( Abc_Frame_t * pAbc, int argc, char **argv )
|
||||
{
|
||||
char * pName;
|
||||
char * pName, * pStr = NULL;
|
||||
int i, c;
|
||||
int nPrints = 20;
|
||||
Extra_UtilGetoptReset();
|
||||
|
|
@ -453,11 +453,19 @@ int CmdCommandHistory( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
if ( argc > globalUtilOptind + 1 )
|
||||
goto usage;
|
||||
// get the number from the command line
|
||||
if ( argc == globalUtilOptind + 1 )
|
||||
nPrints = atoi(argv[globalUtilOptind]);
|
||||
pStr = argc == globalUtilOptind+1 ? argv[globalUtilOptind] : NULL;
|
||||
if ( pStr && pStr[0] >= '1' && pStr[0] <= '9' )
|
||||
nPrints = atoi(pStr), pStr = NULL;
|
||||
// print the commands
|
||||
Vec_PtrForEachEntryStart( char *, pAbc->aHistory, pName, i, Abc_MaxInt(0, Vec_PtrSize(pAbc->aHistory)-nPrints) )
|
||||
fprintf( pAbc->Out, "%2d : %s\n", Vec_PtrSize(pAbc->aHistory)-i, pName );
|
||||
if ( pStr == NULL ) {
|
||||
Vec_PtrForEachEntryStart( char *, pAbc->aHistory, pName, i, Abc_MaxInt(0, Vec_PtrSize(pAbc->aHistory)-nPrints) )
|
||||
fprintf( pAbc->Out, "%2d : %s\n", Vec_PtrSize(pAbc->aHistory)-i, pName );
|
||||
}
|
||||
else {
|
||||
Vec_PtrForEachEntry( char *, pAbc->aHistory, pName, i )
|
||||
if ( strstr(pName, pStr) )
|
||||
fprintf( pAbc->Out, "%2d : %s\n", Vec_PtrSize(pAbc->aHistory)-i, pName );
|
||||
}
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ ABC_NAMESPACE_IMPL_START
|
|||
***********************************************************************/
|
||||
void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command )
|
||||
{
|
||||
int nLastLooked = 10; // do not add history if the same entry appears among the last entries
|
||||
int nLastSaved = 1000; // when saving a file, save no more than this number of last entries
|
||||
int nLastLooked = 10; // do not add history if the same entry appears among the last entries
|
||||
int nLastSaved = 10000; // when saving a file, save no more than this number of last entries
|
||||
char Buffer[ABC_MAX_STR];
|
||||
int Len;
|
||||
if ( p->fBatchMode )
|
||||
|
|
|
|||
Loading…
Reference in New Issue