mirror of https://github.com/YosysHQ/abc.git
Updating how history is recorded.
This commit is contained in:
parent
6aaca6a1af
commit
d72b93c168
|
|
@ -50,7 +50,7 @@ ABC_NAMESPACE_IMPL_START
|
||||||
void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command )
|
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 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
|
int nLastSaved = 20000; // when saving a file, save no more than this number of last entries
|
||||||
char Buffer[ABC_MAX_STR];
|
char Buffer[ABC_MAX_STR];
|
||||||
int Len;
|
int Len;
|
||||||
if ( p->fBatchMode )
|
if ( p->fBatchMode )
|
||||||
|
|
@ -117,6 +117,7 @@ void Cmd_HistoryRead( Abc_Frame_t * p )
|
||||||
Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) );
|
Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) );
|
||||||
}
|
}
|
||||||
fclose( pFile );
|
fclose( pFile );
|
||||||
|
p->iStartHistory = Vec_PtrSize(p->aHistory);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,16 +138,32 @@ void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit )
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
char * pStr;
|
char * pStr;
|
||||||
int i;
|
int i;
|
||||||
pFile = fopen( "abc.history", "wb" );
|
if ( 1 )
|
||||||
if ( pFile == NULL )
|
|
||||||
{
|
{
|
||||||
Abc_Print( 0, "Cannot open file \"abc.history\" for writing.\n" );
|
pFile = fopen( "abc.history", "ab" );
|
||||||
return;
|
if ( pFile == NULL )
|
||||||
|
{
|
||||||
|
Abc_Print( 0, "Cannot open file \"abc.history\" for writing.\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vec_PtrForEachEntryStart( char *, p->aHistory, pStr, i, p->iStartHistory )
|
||||||
|
fprintf( pFile, "%s\n", pStr );
|
||||||
|
fclose( pFile );
|
||||||
|
p->iStartHistory = Vec_PtrSize(p->aHistory);
|
||||||
|
}
|
||||||
|
if ( Vec_PtrSize(p->aHistory) > Limit + 1000 )
|
||||||
|
{
|
||||||
|
pFile = fopen( "abc.history", "wb" );
|
||||||
|
if ( pFile == NULL )
|
||||||
|
{
|
||||||
|
Abc_Print( 0, "Cannot open file \"abc.history\" for writing.\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Limit = Abc_MaxInt( 0, Vec_PtrSize(p->aHistory)-Limit );
|
||||||
|
Vec_PtrForEachEntryStart( char *, p->aHistory, pStr, i, Limit )
|
||||||
|
fprintf( pFile, "%s\n", pStr );
|
||||||
|
fclose( pFile );
|
||||||
}
|
}
|
||||||
Limit = Abc_MaxInt( 0, Vec_PtrSize(p->aHistory)-Limit );
|
|
||||||
Vec_PtrForEachEntryStart( char *, p->aHistory, pStr, i, Limit )
|
|
||||||
fprintf( pFile, "%s\n", pStr );
|
|
||||||
fclose( pFile );
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ struct Abc_Frame_t_
|
||||||
st__table * tAliases; // the alias table
|
st__table * tAliases; // the alias table
|
||||||
st__table * tFlags; // the flag table
|
st__table * tFlags; // the flag table
|
||||||
Vec_Ptr_t * aHistory; // the command history
|
Vec_Ptr_t * aHistory; // the command history
|
||||||
|
int iStartHistory; // beginning of the new history file
|
||||||
// the functionality
|
// the functionality
|
||||||
Abc_Ntk_t * pNtkCur; // the current network
|
Abc_Ntk_t * pNtkCur; // the current network
|
||||||
Abc_Ntk_t * pNtkBestDelay; // the current network
|
Abc_Ntk_t * pNtkBestDelay; // the current network
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue