Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1596 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
16 changed files with 444 additions and 102 deletions
@ -0,0 +1,11 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<MyCopyItem Include="$(MSBuildProjectDirectory)\*.addin" /> |
||||||
|
</ItemGroup> |
||||||
|
<Target Name="MyPostBuildTarget"> |
||||||
|
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" /> |
||||||
|
</Target> |
||||||
|
</Project> |
@ -0,0 +1,38 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Debugger.BooInterpreter")] |
||||||
|
[assembly: AssemblyDescription("Boo Interpreter for debugger")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("Debugger.BooInterpreter")] |
||||||
|
[assembly: AssemblyCopyright("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
@ -0,0 +1,25 @@ |
|||||||
|
<AddIn name = "Debugger Boo Interpreter" |
||||||
|
author = "David Srbecký" |
||||||
|
copyright = "prj:///doc/copyright.txt" |
||||||
|
description = "Interactive boo interpreter run in debugee"> |
||||||
|
|
||||||
|
<Manifest> |
||||||
|
<Identity name = "ICSharpCode.DebuggerBooInterpreter"/> |
||||||
|
<Dependency addin = "ICSharpCode.BooInterpreter"/> |
||||||
|
<Dependency addin = "ICSharpCode.Debugger"/> |
||||||
|
</Manifest> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly = "Debugger.BooInterpreter.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.Compiler.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.Lang.Interpreter.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.BooInterpreter/Boo.InterpreterAddIn.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.Debugger/Debugger.AddIn.dll"/> |
||||||
|
<Import assembly = "$ICSharpCode.Debugger/Debugger.Core.dll"/> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<Path name="/AddIns/InterpreterAddIn/InterpreterContexts"> |
||||||
|
<Class id="Debugee" class="Debugger.DebugeeInterpreterContext"/> |
||||||
|
</Path> |
||||||
|
</AddIn> |
@ -0,0 +1,87 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>Debugger</RootNamespace> |
||||||
|
<AssemblyName>Debugger.BooInterpreter</AssemblyName> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProjectGuid>{B45B39B9-620C-4F84-A555-1833790517AB}</ProjectGuid> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger</OutputPath> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<RunPostBuildEvent>Always</RunPostBuildEvent> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="Boo.Lang.Interpreter"> |
||||||
|
<HintPath>..\..\..\..\BackendBindings\Boo\RequiredLibraries\Boo.Lang.Interpreter.dll</HintPath> |
||||||
|
<SpecificVersion>False</SpecificVersion> |
||||||
|
<Private>True</Private> |
||||||
|
</Reference> |
||||||
|
<Reference Include="Boo.Lang"> |
||||||
|
<HintPath>..\..\..\..\BackendBindings\Boo\RequiredLibraries\Boo.Lang.dll</HintPath> |
||||||
|
<SpecificVersion>False</SpecificVersion> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="Src\DebugeeInterpreterContext.cs" /> |
||||||
|
<Compile Include="Src\DebugeeInteractiveInterpreter.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Folder Include="Src" /> |
||||||
|
<Folder Include="Configuration" /> |
||||||
|
<Content Include="Debugger.BooInterpreter.addin"> |
||||||
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory> |
||||||
|
</Content> |
||||||
|
<ProjectReference Include="..\..\Debugger.Core\Project\Debugger.Core.csproj"> |
||||||
|
<Project>{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}</Project> |
||||||
|
<Name>Debugger.Core</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\BackendBindings\Boo\Boo.InterpreterAddIn\Project\Boo.InterpreterAddIn.booproj"> |
||||||
|
<Project>{928E34B2-5E46-4A4D-8E4D-2CA2CCDB905A}</Project> |
||||||
|
<Name>Boo.InterpreterAddIn</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\Debugger.AddIn\Project\Debugger.AddIn.csproj"> |
||||||
|
<Project>{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}</Project> |
||||||
|
<Name>Debugger.AddIn</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<Content Include="PostBuildEvent.proj" /> |
||||||
|
<ProjectReference Include="..\..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
<Import Project="PostBuildEvent.proj" /> |
||||||
|
</Project> |
@ -0,0 +1,11 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<MyCopyItem Include="$(MSBuildProjectDirectory)\*.addin" /> |
||||||
|
</ItemGroup> |
||||||
|
<Target Name="MyPostBuildTarget"> |
||||||
|
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" /> |
||||||
|
</Target> |
||||||
|
</Project> |
@ -0,0 +1,58 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
using Boo.Lang.Interpreter; |
||||||
|
|
||||||
|
namespace Debugger |
||||||
|
{ |
||||||
|
public class DebugeeInteractiveInterpreter: InteractiveInterpreter |
||||||
|
{ |
||||||
|
public DebugeeInteractiveInterpreter() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public override void Declare(string name, Type type) |
||||||
|
{ |
||||||
|
base.Declare(name, type); |
||||||
|
} |
||||||
|
|
||||||
|
public override object GetValue(string name) |
||||||
|
{ |
||||||
|
System.Diagnostics.Debugger.Log(0xB00, "DebugeeInterpreterContext.BeforeGetValue", name); |
||||||
|
return base.GetValue(name); |
||||||
|
} |
||||||
|
|
||||||
|
public object GetValueInternal(string name) |
||||||
|
{ |
||||||
|
return base.GetValue(name); |
||||||
|
} |
||||||
|
|
||||||
|
public override Type Lookup(string name) |
||||||
|
{ |
||||||
|
return base.Lookup(name); |
||||||
|
} |
||||||
|
|
||||||
|
public override void SetLastValue(object val) |
||||||
|
{ |
||||||
|
base.SetLastValue(val); |
||||||
|
} |
||||||
|
|
||||||
|
public override object SetValue(string name, object val) |
||||||
|
{ |
||||||
|
object ret = base.SetValue(name, val); |
||||||
|
System.Diagnostics.Debugger.Log(0xB00, "DebugeeInterpreterContext.AfterSetValue", name); |
||||||
|
return ret; |
||||||
|
} |
||||||
|
|
||||||
|
public object SetValueInternal(string name, object val) |
||||||
|
{ |
||||||
|
return base.SetValue(name, val); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,157 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Reflection; |
||||||
|
|
||||||
|
using Boo.Lang.Interpreter; |
||||||
|
using Boo.InterpreterAddIn; |
||||||
|
|
||||||
|
using Debugger.Wrappers.CorDebug; |
||||||
|
using Debugger.Wrappers.MetaData; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Services; |
||||||
|
|
||||||
|
namespace Debugger |
||||||
|
{ |
||||||
|
public class DebugeeInterpreterContext: InterpreterContext |
||||||
|
{ |
||||||
|
NDebugger debugger; |
||||||
|
Variable interpreter; |
||||||
|
|
||||||
|
public DebugeeInterpreterContext() |
||||||
|
{ |
||||||
|
this.Title = "Debuggee"; |
||||||
|
this.ToolTipText = "Runs commands in the debugged progam"; |
||||||
|
this.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon"); |
||||||
|
} |
||||||
|
|
||||||
|
bool CanLoadInterpreter { |
||||||
|
get { |
||||||
|
return interpreter != null || InjectInterpreter(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
bool InjectInterpreter() |
||||||
|
{ |
||||||
|
if (!DebuggerService.IsDebuggerLoaded) { |
||||||
|
PrintLine("Error: 'Debugger is not loaded'"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; |
||||||
|
if (winDebugger == null) { |
||||||
|
PrintLine("Error: 'Incompatible debugger'"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (!winDebugger.IsDebugging) { |
||||||
|
PrintLine("Error: 'No program is debugged'"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
debugger = winDebugger.DebuggerCore; |
||||||
|
debugger.SelectedProcess.Expired += delegate { interpreter = null; }; |
||||||
|
debugger.LogMessage -= OnDebuggerLogMessage; |
||||||
|
debugger.LogMessage += OnDebuggerLogMessage; |
||||||
|
|
||||||
|
Variable assembly; |
||||||
|
// Boo.Lang.Interpreter.dll
|
||||||
|
string path = Path.Combine(Path.GetDirectoryName(typeof(InterpreterContext).Assembly.Location), "Boo.Lang.Interpreter.dll"); |
||||||
|
assembly = LoadAssembly(path); |
||||||
|
// Debugger.BooInterpreter.dll
|
||||||
|
assembly = LoadAssembly(typeof(DebugeeInteractiveInterpreter).Assembly.Location); |
||||||
|
Variable interpreterType = Eval.NewString(debugger, typeof(DebugeeInteractiveInterpreter).FullName).EvaluateNow(); |
||||||
|
interpreter = Eval.CallFunction(debugger, typeof(Assembly), "CreateInstance", false, assembly, new Variable[] {interpreterType}).EvaluateNow(); |
||||||
|
RunCommand( |
||||||
|
"import System\n" + |
||||||
|
"import System.IO\n" + |
||||||
|
"import System.Text\n" + |
||||||
|
"interpreter.RememberLastValue = true\n" + |
||||||
|
"interpreter.Print = def(msg): System.Diagnostics.Debugger.Log(0xB00, \"DebugeeInterpreterContext.PrintLine\", msg)"); |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
Variable LoadAssembly(string path) |
||||||
|
{ |
||||||
|
Variable assemblyPath = Eval.NewString(debugger, path).EvaluateNow(); |
||||||
|
Variable assembly = Eval.CallFunction(debugger, typeof(Assembly), "LoadFrom", false, null, new Variable[] {assemblyPath}).EvaluateNow(); |
||||||
|
return assembly; |
||||||
|
} |
||||||
|
|
||||||
|
public override void RunCommand(string code) |
||||||
|
{ |
||||||
|
if (CanLoadInterpreter) { |
||||||
|
Variable cmd = Eval.NewString(debugger, code).EvaluateNow(); |
||||||
|
Eval.CallFunction(debugger, typeof(InteractiveInterpreter), "LoopEval", false, interpreter, new Variable[] {cmd}).EvaluateNow(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string[] GetGlobals() |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public override string[] SuggestCodeCompletion(string code) |
||||||
|
{ |
||||||
|
if (CanLoadInterpreter) { |
||||||
|
Variable cmd = Eval.NewString(debugger, code).EvaluateNow(); |
||||||
|
Eval.CallFunction(debugger, typeof(AbstractInterpreter), "SuggestCodeCompletion", false, interpreter, new Variable[] {cmd}).EvaluateNow(); |
||||||
|
return null; |
||||||
|
} else { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OnDebuggerLogMessage(object sender, MessageEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Level == 0xB00 && interpreter != null) { |
||||||
|
switch (e.Category) { |
||||||
|
case "DebugeeInterpreterContext.PrintLine": |
||||||
|
PrintLine(e.Message); |
||||||
|
break; |
||||||
|
case "DebugeeInterpreterContext.BeforeGetValue": |
||||||
|
BeforeGetValue(e.Message); |
||||||
|
break; |
||||||
|
case "DebugeeInterpreterContext.AfterSetValue": |
||||||
|
AfterSetValue(e.Message); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void BeforeGetValue(string name) |
||||||
|
{ |
||||||
|
// PrintLine("BeforeGetValue: " + name);
|
||||||
|
Variable localVar = debugger.LocalVariables[name]; |
||||||
|
if (localVar != null) { |
||||||
|
PrintLine("Warning: 'Getting of local variables not implemented'"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void AfterSetValue(string name) |
||||||
|
{ |
||||||
|
//PrintLine("AfterSetValue: " + name);
|
||||||
|
Variable localVar = debugger.LocalVariables[name]; |
||||||
|
if (localVar != null) { |
||||||
|
PrintLine("Warning: 'Setting of local variables not implemented'"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void SetValueInternal(string valueName, Variable newValue) |
||||||
|
{ |
||||||
|
Variable name = Eval.NewString(debugger, valueName).Result; |
||||||
|
Eval.CallFunction(debugger, typeof(DebugeeInteractiveInterpreter), "SetValueInternal", false, interpreter, new Variable[] {name, newValue}).ScheduleEvaluation(); |
||||||
|
} |
||||||
|
|
||||||
|
Variable GetValueInternal(string valueName) |
||||||
|
{ |
||||||
|
Variable name = Eval.NewString(debugger, valueName).EvaluateNow(); |
||||||
|
return Eval.CallFunction(debugger, typeof(DebugeeInteractiveInterpreter), "GetValueInternal", false, interpreter, new Variable[] {name}).EvaluateNow(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,84 +0,0 @@ |
|||||||
/* |
|
||||||
* Created by SharpDevelop. |
|
||||||
* User: User |
|
||||||
* Date: 10/07/2006 |
|
||||||
* Time: 01:47 |
|
||||||
* |
|
||||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
|
||||||
*/ |
|
||||||
|
|
||||||
using System; |
|
||||||
|
|
||||||
using Debugger.Wrappers.CorDebug; |
|
||||||
using Debugger.Wrappers.MetaData; |
|
||||||
|
|
||||||
namespace Debugger |
|
||||||
{ |
|
||||||
public class InterpreterWrapper |
|
||||||
{ |
|
||||||
const string booDll = "Boo.Lang.Interpreter.dll"; |
|
||||||
|
|
||||||
NDebugger debugger; |
|
||||||
Variable interpreter; |
|
||||||
|
|
||||||
public NDebugger Debugger { |
|
||||||
get { |
|
||||||
return debugger; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static InterpreterWrapper InjectBooInterpreter(NDebugger debugger, string booPath) |
|
||||||
{ |
|
||||||
return new InterpreterWrapper(debugger, booPath); |
|
||||||
} |
|
||||||
|
|
||||||
private InterpreterWrapper(NDebugger debugger, string booInterpreterPath) |
|
||||||
{ |
|
||||||
this.debugger = debugger; |
|
||||||
|
|
||||||
Variable assemblyPath = Eval.NewString(debugger, booInterpreterPath).EvaluateNow(); |
|
||||||
Variable assembly = Eval.CallFunction(debugger, "mscorlib.dll", "System.Reflection.Assembly", "LoadFrom", false, null, new Variable[] {assemblyPath}).EvaluateNow(); |
|
||||||
Variable interpreterType = Eval.NewString(debugger, "Boo.Lang.Interpreter.InteractiveInterpreter").EvaluateNow(); |
|
||||||
interpreter = Eval.CallFunction(debugger, "mscorlib.dll", "System.Reflection.Assembly", "CreateInstance", false, assembly, new Variable[] {interpreterType}).EvaluateNow(); |
|
||||||
RunCommand("interpreter.RememberLastValue = true"); |
|
||||||
|
|
||||||
// Testing:
|
|
||||||
RunCommand("1 + 2"); |
|
||||||
Variable res = GetLastValue(); |
|
||||||
SetValue("a", res); |
|
||||||
RunCommand("a = a + 100"); |
|
||||||
Variable a = GetValue("a"); |
|
||||||
Variable sug = SuggestCodeCompletion("interpreter.__codecomplete__"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void RunCommand(string code) |
|
||||||
{ |
|
||||||
Variable cmd = Eval.NewString(debugger, code).EvaluateNow(); |
|
||||||
Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "LoopEval", false, interpreter, new Variable[] {cmd}).EvaluateNow(); |
|
||||||
} |
|
||||||
|
|
||||||
public void SetValue(string valueName, Variable newValue) |
|
||||||
{ |
|
||||||
Variable name = Eval.NewString(debugger, valueName).EvaluateNow(); |
|
||||||
Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "SetValue", false, interpreter, new Variable[] {name, newValue}).EvaluateNow(); |
|
||||||
} |
|
||||||
|
|
||||||
public Variable GetValue(string valueName) |
|
||||||
{ |
|
||||||
Variable name = Eval.NewString(debugger, valueName).EvaluateNow(); |
|
||||||
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "GetValue", false, interpreter, new Variable[] {name}).EvaluateNow(); |
|
||||||
} |
|
||||||
|
|
||||||
public Variable GetLastValue() |
|
||||||
{ |
|
||||||
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.InteractiveInterpreter", "get_LastValue", false, interpreter, new Variable[] {}).EvaluateNow(); |
|
||||||
} |
|
||||||
|
|
||||||
public Variable SuggestCodeCompletion(string code) |
|
||||||
{ |
|
||||||
Variable cmd = Eval.NewString(debugger, code).EvaluateNow(); |
|
||||||
return Eval.CallFunction(debugger, booDll, "Boo.Lang.Interpreter.AbstractInterpreter", "SuggestCodeCompletion", false, interpreter, new Variable[] {cmd}).EvaluateNow(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue