mirror of
https://github.com/The-OpenROAD-Project/abc.git
synced 2026-03-12 11:26:17 +08:00
Updating how history is recorded.
This commit is contained in:
@@ -50,7 +50,7 @@ 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 = 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];
|
||||
int Len;
|
||||
if ( p->fBatchMode )
|
||||
@@ -117,6 +117,7 @@ void Cmd_HistoryRead( Abc_Frame_t * p )
|
||||
Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) );
|
||||
}
|
||||
fclose( pFile );
|
||||
p->iStartHistory = Vec_PtrSize(p->aHistory);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -137,16 +138,32 @@ void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit )
|
||||
FILE * pFile;
|
||||
char * pStr;
|
||||
int i;
|
||||
pFile = fopen( "abc.history", "wb" );
|
||||
if ( pFile == NULL )
|
||||
if ( 1 )
|
||||
{
|
||||
Abc_Print( 0, "Cannot open file \"abc.history\" for writing.\n" );
|
||||
return;
|
||||
pFile = fopen( "abc.history", "ab" );
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ struct Abc_Frame_t_
|
||||
st__table * tAliases; // the alias table
|
||||
st__table * tFlags; // the flag table
|
||||
Vec_Ptr_t * aHistory; // the command history
|
||||
int iStartHistory; // beginning of the new history file
|
||||
// the functionality
|
||||
Abc_Ntk_t * pNtkCur; // the current network
|
||||
Abc_Ntk_t * pNtkBestDelay; // the current network
|
||||
|
||||
Reference in New Issue
Block a user