File: test_python_interpreter.cpp

package info (click to toggle)
nextpnr 0.0~git20210102.9b96280-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,268 kB
  • sloc: cpp: 158,711; python: 16,582; ansic: 9,715; sh: 573; makefile: 477; objc: 42; tcl: 21
file content (22 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include "Interpreter.h"

int main( int argc, char *argv[] )
{
    std::string commands[] = {
        "from time import time,ctime\n",
        "print('Today is',ctime(time()))\n"
    };
    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;
}