MCPcopy Create free account
hub / github.com/YosysHQ/nextpnr / interpret

Method interpret

3rdparty/python-console/Interpreter.cpp:69–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69std::string
70Interpreter::interpret( const std::string& command, int* errorCode )
71{
72 PyEval_AcquireThread( m_threadState );
73 *errorCode = 0;
74
75 PyObject* py_result;
76 PyObject* dum;
77 std::string res;
78 py_result = Py_CompileString(command.c_str(), "<stdin>", Py_single_input);
79 if ( py_result == 0 )
80 {
81 if ( PyErr_Occurred( ) )
82 {
83 *errorCode = 1;
84 PyErr_Print( );
85 res = GetResultString( m_threadState );
86 GetResultString( m_threadState ) = "";
87 }
88
89 PyEval_ReleaseThread( m_threadState );
90 return res;
91 }
92 dum = PyEval_EvalCode (py_result, glb, loc);
93 Py_XDECREF (dum);
94 Py_XDECREF (py_result);
95 if ( PyErr_Occurred( ) )
96 {
97 *errorCode = 1;
98 PyErr_Print( );
99 }
100
101 res = GetResultString( m_threadState );
102 GetResultString( m_threadState ) = "";
103
104 PyEval_ReleaseThread( m_threadState );
105 return res;
106}
107
108const std::list<std::string>& Interpreter::suggest( const std::string& hint )
109{

Callers 3

mainFunction · 0.80
parseEventMethod · 0.80
parseEventMethod · 0.80

Calls 1

c_strMethod · 0.45

Tested by 2

mainFunction · 0.64
parseEventMethod · 0.64