33#define ABC_USE_HISTORY 1
53 int nLastSaved = 10000;
60 if (
Len > 0 && Buffer[
Len-1] ==
'\n' )
68 strncmp(Buffer,
"source abc.rc",13) &&
69 strncmp(Buffer,
"source ..\\abc.rc",16) &&
71 Buffer[
strlen(Buffer)-1] !=
'?' )
74 int i, Start = Abc_MaxInt( 0, Vec_PtrSize(
p->aHistory) - nLastLooked );
77 if ( !
strcmp(pStr, Buffer) )
79 if ( i == Vec_PtrSize(
p->aHistory) )
86 Vec_PtrRemove(
p->aHistory, pStr );
87 Vec_PtrPush(
p->aHistory, pStr );
105#if defined(ABC_USE_HISTORY)
108 assert( Vec_PtrSize(
p->aHistory) == 0 );
109 pFile = fopen(
"abc.history",
"rb" );
112 while ( fgets( Buffer,
ABC_MAX_STR, pFile ) != NULL )
115 if ( Buffer[
Len-1] ==
'\n' )
136#if defined(ABC_USE_HISTORY)
140 pFile = fopen(
"abc.history",
"wb" );
143 Abc_Print( 0,
"Cannot open file \"abc.history\" for writing.\n" );
146 Limit = Abc_MaxInt( 0, Vec_PtrSize(
p->aHistory)-Limit );
148 fprintf( pFile,
"%s\n", pStr );
166#if defined(ABC_USE_HISTORY)
169 Limit = Abc_MaxInt( 0, Vec_PtrSize(
p->aHistory)-Limit );
170 printf(
"================== Command history ==================\n" );
172 printf(
"%s\n", pStr );
173 printf(
"=====================================================\n" );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
void Cmd_HistoryWrite(Abc_Frame_t *p, int Limit)
void Cmd_HistoryPrint(Abc_Frame_t *p, int Limit)
void Cmd_HistoryRead(Abc_Frame_t *p)
void Cmd_HistoryAddCommand(Abc_Frame_t *p, const char *command)
FUNCTION DEFINITIONS ///.
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)