64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#include <unistd.h>
|
|
|
|
#include <a8/a8.h>
|
|
#include <a8/pyengine.h>
|
|
#include <a8/stringlist.h>
|
|
#include <a8/uuid.h>
|
|
#include "websocket_test.h"
|
|
#include "xml_test.h"
|
|
|
|
#include <Python.h>
|
|
|
|
void testpy()
|
|
{
|
|
Py_Initialize();
|
|
|
|
static struct PyModuleDef SWIG_module = {
|
|
PyModuleDef_HEAD_INIT,
|
|
(char *) "_game",
|
|
NULL,
|
|
-1,
|
|
nullptr,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
};
|
|
|
|
auto m = PyModule_Create(&SWIG_module);
|
|
|
|
PyRun_SimpleString("print('hello')");
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
a8::uuid::SnowFlake uuid;
|
|
uuid.SetMachineId(a8::uuid::MAX_MACHINE_ID);
|
|
long long id = uuid.Generate();
|
|
long long time = a8::uuid::SnowFlake::FetchTime(id);
|
|
int mac_id = a8::uuid::SnowFlake::FetchMachineId(id);
|
|
int seq_id = a8::uuid::SnowFlake::FetchSequnceId(id);
|
|
testpy();
|
|
#if 0
|
|
a8::PyEngine pyengine;
|
|
pyengine.Init();
|
|
pyengine.LoadModule("test");
|
|
|
|
a8::XObject xobj;
|
|
a8::StringList sl;
|
|
sl.LoadFromFile("test.json");
|
|
xobj.ReadFromJsonString(sl.Text());
|
|
std::string data;
|
|
xobj.ToJsonStr(data);
|
|
printf("%s\r\n", data.c_str());
|
|
|
|
WebSocket_Test::Instance()->Init();
|
|
XMLTest::Instance()->Init();
|
|
#endif
|
|
while (true) {
|
|
printf("....\n");
|
|
::sleep(1);
|
|
}
|
|
return 0;
|
|
}
|