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
392390d2
Commit
392390d2
authored
Oct 22, 2014
by
Baruch Sterin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make it easy to add intialization functions to Abc_FrameInit()/Abc_FrameEnd()
parent
51bf1210
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
src/base/main/mainInit.c
+30
-0
src/base/main/mainInt.h
+15
-0
No files found.
src/base/main/mainInit.c
View file @
392390d2
...
...
@@ -59,6 +59,24 @@ extern void Abc2_End ( Abc_Frame_t * pAbc );
extern
void
Abc85_Init
(
Abc_Frame_t
*
pAbc
);
extern
void
Abc85_End
(
Abc_Frame_t
*
pAbc
);
static
Abc_FrameInitializer_t
*
s_InitializerStart
=
NULL
;
static
Abc_FrameInitializer_t
*
s_InitializerEnd
=
NULL
;
void
Abc_FrameAddInitializer
(
Abc_FrameInitializer_t
*
p
)
{
if
(
!
s_InitializerStart
)
s_InitializerStart
=
p
;
p
->
next
=
NULL
;
p
->
prev
=
s_InitializerEnd
;
if
(
s_InitializerEnd
)
s_InitializerEnd
->
next
=
p
;
s_InitializerEnd
=
p
;
}
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -76,6 +94,8 @@ extern void Abc85_End( Abc_Frame_t * pAbc );
***********************************************************************/
void
Abc_FrameInit
(
Abc_Frame_t
*
pAbc
)
{
Abc_FrameInitializer_t
*
p
;
Cmd_Init
(
pAbc
);
Cmd_CommandExecute
(
pAbc
,
"set checkread"
);
Io_Init
(
pAbc
);
...
...
@@ -96,6 +116,10 @@ void Abc_FrameInit( Abc_Frame_t * pAbc )
Abc85_Init
(
pAbc
);
#endif
EXT_ABC_INIT
(
pAbc
)
// plugin for external functionality
for
(
p
=
s_InitializerStart
;
p
;
p
=
p
->
next
)
if
(
p
->
init
)
p
->
init
(
pAbc
);
}
...
...
@@ -112,6 +136,12 @@ void Abc_FrameInit( Abc_Frame_t * pAbc )
***********************************************************************/
void
Abc_FrameEnd
(
Abc_Frame_t
*
pAbc
)
{
Abc_FrameInitializer_t
*
p
;
for
(
p
=
s_InitializerEnd
;
p
;
p
=
p
->
prev
)
if
(
p
->
destroy
)
p
->
destroy
(
pAbc
);
Abc_End
(
pAbc
);
Io_End
(
pAbc
);
Cmd_End
(
pAbc
);
...
...
src/base/main/mainInt.h
View file @
392390d2
...
...
@@ -132,6 +132,20 @@ struct Abc_Frame_t_
EXT_ABC_FRAME
// plugin for external functionality
};
typedef
void
(
*
Abc_Frame_Initialization_Func
)(
Abc_Frame_t
*
pAbc
);
struct
Abc_FrameInitializer_t_
;
typedef
struct
Abc_FrameInitializer_t_
Abc_FrameInitializer_t
;
struct
Abc_FrameInitializer_t_
{
Abc_Frame_Initialization_Func
init
;
Abc_Frame_Initialization_Func
destroy
;
Abc_FrameInitializer_t
*
next
;
Abc_FrameInitializer_t
*
prev
;
};
////////////////////////////////////////////////////////////////////////
/// GLOBAL VARIABLES ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -150,6 +164,7 @@ extern ABC_DLL int main( int argc, char * argv[] );
/*=== mvInit.c ===================================================*/
extern
ABC_DLL
void
Abc_FrameInit
(
Abc_Frame_t
*
pAbc
);
extern
ABC_DLL
void
Abc_FrameEnd
(
Abc_Frame_t
*
pAbc
);
extern
ABC_DLL
void
Abc_FrameAddInitializer
(
Abc_FrameInitializer_t
*
p
);
/*=== mvFrame.c =====================================================*/
extern
ABC_DLL
Abc_Frame_t
*
Abc_FrameAllocate
();
extern
ABC_DLL
void
Abc_FrameDeallocate
(
Abc_Frame_t
*
p
);
...
...
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