Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
2a7a06b6
Commit
2a7a06b6
authored
Aug 25, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added recording history of used commands into file 'abc.history' (Windows only).
parent
49c57999
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
src/base/cmd/cmd.c
+1
-1
src/base/cmd/cmd.h
+1
-1
src/base/cmd/cmdHist.c
+10
-3
No files found.
src/base/cmd/cmd.c
View file @
2a7a06b6
...
...
@@ -125,7 +125,7 @@ void Cmd_End( Abc_Frame_t * pAbc )
st_generator
*
gen
;
char
*
pKey
,
*
pValue
;
#if defined(WIN32)
Cmd_HistoryWrite
(
pAbc
);
Cmd_HistoryWrite
(
pAbc
,
ABC_INFINITY
);
#endif
// st_free_table( pAbc->tCommands, (void (*)()) 0, CmdCommandFree );
...
...
src/base/cmd/cmd.h
View file @
2a7a06b6
...
...
@@ -61,7 +61,7 @@ extern void Cmd_FlagUpdateValue( Abc_Frame_t * pAbc, const char * key, ch
/*=== cmdHist.c ========================================================*/
extern
void
Cmd_HistoryAddCommand
(
Abc_Frame_t
*
pAbc
,
const
char
*
command
);
extern
void
Cmd_HistoryRead
(
Abc_Frame_t
*
p
);
extern
void
Cmd_HistoryWrite
(
Abc_Frame_t
*
p
);
extern
void
Cmd_HistoryWrite
(
Abc_Frame_t
*
p
,
int
Limit
);
/*=== cmdLoad.c ========================================================*/
extern
int
CmdCommandLoad
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
...
src/base/cmd/cmdHist.c
View file @
2a7a06b6
...
...
@@ -47,6 +47,9 @@ ABC_NAMESPACE_IMPL_START
***********************************************************************/
void
Cmd_HistoryAddCommand
(
Abc_Frame_t
*
p
,
const
char
*
command
)
{
int
nLastLooked
=
10
;
// defines how many entries back are looked
int
nLastSaved
=
100
;
// defines how many last entries are saved
char
Buffer
[
ABC_MAX_STR
];
int
Len
=
strlen
(
command
);
strcpy
(
Buffer
,
command
);
...
...
@@ -60,11 +63,14 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command )
char
*
pStr
;
int
i
;
// do not enter if the same command appears among the last five commands
Vec_PtrForEachEntryStart
(
char
*
,
p
->
aHistory
,
pStr
,
i
,
Abc_MaxInt
(
0
,
Vec_PtrSize
(
p
->
aHistory
)
-
5
)
)
Vec_PtrForEachEntryStart
(
char
*
,
p
->
aHistory
,
pStr
,
i
,
Abc_MaxInt
(
0
,
Vec_PtrSize
(
p
->
aHistory
)
-
nLastLooked
)
)
if
(
!
strcmp
(
pStr
,
Buffer
)
)
break
;
if
(
i
==
Vec_PtrSize
(
p
->
aHistory
)
)
{
Vec_PtrPush
(
p
->
aHistory
,
Extra_UtilStrsav
(
Buffer
)
);
Cmd_HistoryWrite
(
p
,
nLastSaved
);
}
}
}
...
...
@@ -111,7 +117,7 @@ void Cmd_HistoryRead( Abc_Frame_t * p )
SeeAlso []
***********************************************************************/
void
Cmd_HistoryWrite
(
Abc_Frame_t
*
p
)
void
Cmd_HistoryWrite
(
Abc_Frame_t
*
p
,
int
Limit
)
{
FILE
*
pFile
;
char
*
pStr
;
...
...
@@ -122,7 +128,8 @@ void Cmd_HistoryWrite( Abc_Frame_t * p )
Abc_Print
(
0
,
"Cannot open file
\"
abc.history
\"
for writing.
\n
"
);
return
;
}
Vec_PtrForEachEntry
(
char
*
,
p
->
aHistory
,
pStr
,
i
)
Limit
=
Abc_MaxInt
(
0
,
Vec_PtrSize
(
p
->
aHistory
)
-
Limit
);
Vec_PtrForEachEntryStart
(
char
*
,
p
->
aHistory
,
pStr
,
i
,
Limit
)
fprintf
(
pFile
,
"%s
\n
"
,
pStr
);
fclose
(
pFile
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment