1 //===-- ScriptInterpreter.cpp -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "lldb/Interpreter/ScriptInterpreter.h"
11 
12 #include <string>
13 #include <stdlib.h>
14 #include <stdio.h>
15 
16 #include "lldb/Core/Error.h"
17 #include "lldb/Core/Stream.h"
18 #include "lldb/Core/StringList.h"
19 #include "lldb/Interpreter/CommandReturnObject.h"
20 #include "lldb/Interpreter/ScriptInterpreterPython.h"
21 #include "lldb/Utility/PseudoTerminal.h"
22 
23 using namespace lldb;
24 using namespace lldb_private;
25 
26 ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
27     m_interpreter (interpreter),
28     m_script_lang (script_lang)
29 {
30 }
31 
32 ScriptInterpreter::~ScriptInterpreter ()
33 {
34 }
35 
36 CommandInterpreter &
37 ScriptInterpreter::GetCommandInterpreter ()
38 {
39     return m_interpreter;
40 }
41 
42 void
43 ScriptInterpreter::CollectDataForBreakpointCommandCallback
44 (
45     BreakpointOptions *bp_options,
46     CommandReturnObject &result
47 )
48 {
49     result.SetStatus (eReturnStatusFailed);
50     result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented.");
51 }
52 
53 std::string
54 ScriptInterpreter::LanguageToString (lldb::ScriptLanguage language)
55 {
56     std::string return_value;
57 
58     switch (language)
59     {
60         case eScriptLanguageNone:
61             return_value = "None";
62             break;
63         case eScriptLanguagePython:
64             return_value = "Python";
65             break;
66     }
67 
68     return return_value;
69 }
70 
71 void
72 ScriptInterpreter::InitializeInterpreter (SWIGInitCallback python_swig_init_callback)
73 {
74 #ifndef LLDB_DISABLE_PYTHON
75     ScriptInterpreterPython::InitializeInterpreter (python_swig_init_callback);
76 #endif // #ifndef LLDB_DISABLE_PYTHON
77 }
78 
79 void
80 ScriptInterpreter::TerminateInterpreter ()
81 {
82 #ifndef LLDB_DISABLE_PYTHON
83     ScriptInterpreterPython::TerminateInterpreter ();
84 #endif // #ifndef LLDB_DISABLE_PYTHON
85 }
86 
87