nextpnr/3rdparty/python-console/test_python_interpreter.cpp

23 lines
517 B
C++
Raw Normal View History

2018-06-28 19:16:53 +08:00
#include <iostream>
#include "Interpreter.h"
int main( int argc, char *argv[] )
{
std::string commands[] = {
"from time import time,ctime\n",
2018-06-28 19:32:06 +08:00
"print('Today is',ctime(time()))\n"
2018-06-28 19:16:53 +08:00
};
Interpreter::Initialize( );
Interpreter* interpreter = new Interpreter;
for ( int i = 0; i < 2; ++i )
{
int err;
std::string res = interpreter->interpret( commands[i], &err );
std::cout << res;
}
delete interpreter;
Interpreter::Finalize( );
return 0;
}