blob: 1a352fa1987fd5d38396f8905fa3735614a10f11 [file] [log] [blame]
Zachary Turner2c1f46d2015-07-30 20:28:07 +00001//===-- ScriptInterpreterNone.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 "ScriptInterpreterNone.h"
11#include "lldb/Core/Debugger.h"
12#include "lldb/Core/PluginManager.h"
13#include "lldb/Core/Stream.h"
14#include "lldb/Core/StreamFile.h"
15#include "lldb/Core/StringList.h"
16#include "lldb/Interpreter/CommandInterpreter.h"
17
18#include <mutex>
19
20using namespace lldb;
21using namespace lldb_private;
22
23ScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter)
24 : ScriptInterpreter(interpreter, eScriptLanguageNone)
25{
26}
27
28ScriptInterpreterNone::~ScriptInterpreterNone()
29{
30}
31
32bool
33ScriptInterpreterNone::ExecuteOneLine(const char *command, CommandReturnObject *, const ExecuteScriptOptions &)
34{
35 m_interpreter.GetDebugger().GetErrorFile()->PutCString(
36 "error: there is no embedded script interpreter in this mode.\n");
37 return false;
38}
39
40void
41ScriptInterpreterNone::ExecuteInterpreterLoop()
42{
43 m_interpreter.GetDebugger().GetErrorFile()->PutCString(
44 "error: there is no embedded script interpreter in this mode.\n");
45}
46
47void
48ScriptInterpreterNone::Initialize()
49{
50 static std::once_flag g_once_flag;
51
52 std::call_once(g_once_flag, []()
53 {
54 PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(),
55 lldb::eScriptLanguageNone, CreateInstance);
56 });
57}
58
59void
60ScriptInterpreterNone::Terminate()
61{
62}
63
64lldb::ScriptInterpreterSP
65ScriptInterpreterNone::CreateInstance(CommandInterpreter &interpreter)
66{
67 return std::make_shared<ScriptInterpreterNone>(interpreter);
68}
69
70lldb_private::ConstString
71ScriptInterpreterNone::GetPluginNameStatic()
72{
73 static ConstString g_name("script-none");
74 return g_name;
75}
76
77const char *
78ScriptInterpreterNone::GetPluginDescriptionStatic()
79{
80 return "Null script interpreter";
81}
82
83lldb_private::ConstString
84ScriptInterpreterNone::GetPluginName()
85{
86 return GetPluginNameStatic();
87}
88
89uint32_t
90ScriptInterpreterNone::GetPluginVersion()
91{
92 return 1;
93}