-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.cpp
46 lines (36 loc) · 1000 Bytes
/
init.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "base/main/main.h"
#include "base/main/mainInt.h"
#include <iostream>
namespace
{
// Very simple ABC command: prints a greeting and its command line argumentss
int Hello_Command( Abc_Frame_t * pAbc, int argc, char ** argv )
{
std::cout << "Hello world!" << std::endl;
for(int i=0; i<argc; i++)
{
std::cout << " argv[" << i << "]: " << argv[i] << std::endl;
}
return 0;
}
// called during ABC startup
void init(Abc_Frame_t* pAbc)
{
Cmd_CommandAdd( pAbc, "Hello", "@hello", Hello_Command, 0);
}
// called during ABC termination
void destroy(Abc_Frame_t* pAbc)
{
}
// this object should not be modified after the call to Abc_FrameAddInitializer
Abc_FrameInitializer_t frame_initializer = { init, destroy };
// register the initializer a constructor of a global object
// called before main (and ABC startup)
struct registrar
{
registrar()
{
Abc_FrameAddInitializer(&frame_initializer);
}
} hello_registrar;
} // unnamed namespace