本文整理汇总了C#中VirtualMachine类的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine类的具体用法?C# VirtualMachine怎么用?C# VirtualMachine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualMachine类属于命名空间,在下文中一共展示了VirtualMachine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: getCommandLineArgs
public HassiumList getCommandLineArgs(VirtualMachine vm, params HassiumObject[] args)
{
HassiumList result = new HassiumList(new HassiumObject[0]);
foreach (string arg in Environment.GetCommandLineArgs())
result.add(vm, new HassiumString(arg));
return result;
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:7,代码来源:HassiumOS.cs
示例2: Emit
public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
{
into.SetPendingAnnotation(this.ToString());
into.AddInstructions("ALLOC_RSO NEXT PUSH", ResultType.Size);
into.AddInstructions("STORE_RSO_M NEXT PEEK NEXT", ResultType.ID, 0); //Store type id
if (Constructor != null)
{
if (Constructor.OwnerContextID == Scope.EnvironmentContext.ID && Constructor.OwnerContextID != 0)
{
into.AddInstructions("CALL NEXT #" + Constructor.DescriptiveHeader, 0);
Constructor.Body.CallPoints.Add(into.Count - 1);
}
else
{
into.AddInstructions("STACK_INVOKE NEXT", Constructor.MakeInvokableFunction());
}
}
if (Initializers != null)
{
foreach (var initializer in Initializers)
initializer.Emit(into, OperationDestination.Discard);
}
if (Destination != OperationDestination.Stack)
into.AddInstructions("MOVE POP " + WriteOperand(Destination));
}
开发者ID:Blecki,项目名称:EtcScript,代码行数:30,代码来源:New.cs
示例3: TestEnvironment
public TestEnvironment( VmWareConfiguration vmWareConfiguration )
{
_vmWareConfiguration = vmWareConfiguration;
_virtualHost = new VimClient();
_virtualHost.Login(
string.Format( "https://{0}/sdk", _vmWareConfiguration.FarmUrl ),
_vmWareConfiguration.FarmLogin,
_vmWareConfiguration.FarmPassword );
_vm = ( VirtualMachine )_virtualHost.FindEntityView(
typeof( VirtualMachine ),
null,
new NameValueCollection
{
{"name", _vmWareConfiguration.VirtualMachineName}
},
null );
_manager = new GuestOperationsManager( _virtualHost, _virtualHost.ServiceContent.GuestOperationsManager );
_authentication = new NamePasswordAuthentication
{
Username = _vmWareConfiguration.User,
Password = _vmWareConfiguration.Password,
InteractiveSession = true
};
}
开发者ID:alex-lucid,项目名称:NAnt.ContinuousIntegration,代码行数:28,代码来源:testenvironment.cs
示例4: Execute
public override void Execute(VirtualMachine vm, IList<string> parameters)
{
int a, b;
bool var1 = Int32.TryParse(parameters[1], out a);
bool var2 = Int32.TryParse(parameters[2], out b);
if(var1 && var2)
{
vm.ReturnValue = (vm.Variables[parameters[1]] == vm.Variables[parameters[1]]).ToString();
}
else
{
if(!var1)
{
vm.ReturnValue = (vm.Variables[parameters[1]] == b.ToString()).ToString();
}
else if (!var2)
{
vm.ReturnValue = (vm.Variables[parameters[2]] == a.ToString()).ToString();
}
else
{
vm.ReturnValue = (parameters[1] == parameters[2]).ToString();
}
}
vm.DebugPrint("Return is now " + vm.ReturnValue);
}
开发者ID:JoepvdBroek,项目名称:DP2_Compiler,代码行数:29,代码来源:EqualsCommand.cs
示例5: Invoke
public override HassiumObject Invoke(VirtualMachine vm, params HassiumObject[] args)
{
vm.StackFrame.Frames.Push(Frame);
var ret = Handler.Invoke(vm, args);
vm.StackFrame.PopFrame();
return ret;
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:7,代码来源:HassiumExceptionHandler.cs
示例6: HardDrive
public HardDrive(RenderWindow window, VirtualMachine virtualMachine, XElement config)
{
vm = virtualMachine;
state = DeviceState.None;
var errorMsg = "";
try
{
errorMsg = "Bad Port";
devPort = short.Parse(Util.ElementValue(config, "Port", null));
errorMsg = "Bad FileName";
var fileName = Util.ElementValue(config, "FileName", null);
if (fileName == null)
throw new Exception();
errorMsg = string.Format("Failed to open '{0}'", fileName);
diskImage = new FileStream(fileName, FileMode.Open);
sectorCount = (ushort)(new FileInfo(fileName).Length / BytesPerSector);
}
catch (Exception e)
{
throw new Exception(string.Format("HardDrive: {0}", errorMsg), e);
}
}
开发者ID:Rohansi,项目名称:VM,代码行数:26,代码来源:HardDrive.cs
示例7: HandleInterrupt
public void HandleInterrupt(VirtualMachine machine)
{
switch (machine.Registers[(int)Register.R0])
{
case 0: // specs
machine.Registers[(int)Register.R0] = _sectorSize;
machine.Registers[(int)Register.R1] = _sectorCount;
break;
case 1: // read sector
ReadSector(machine, machine.Registers[(int)Register.R1], machine.Registers[(int)Register.R2]);
break;
case 2: // write sector
WriteSector(machine, machine.Registers[(int)Register.R1], machine.Registers[(int)Register.R2]);
break;
case 3: // read sectors
while (machine.Registers[(int)Register.R3]-- > 0)
{
ReadSector(machine, machine.Registers[(int)Register.R1], machine.Registers[(int)Register.R2]);
machine.Registers[(int)Register.R1] += _sectorSize;
machine.Registers[(int)Register.R2]++;
}
break;
case 4: // write sectors
while (machine.Registers[(int)Register.R3]-- > 0)
{
WriteSector(machine, machine.Registers[(int)Register.R1], machine.Registers[(int)Register.R2]);
machine.Registers[(int)Register.R1] += _sectorSize;
machine.Registers[(int)Register.R2]++;
}
break;
case 100: // identify
machine.Registers[(int)Register.R0] = 0xB10C;
break;
}
}
开发者ID:Rohansi,项目名称:LoonyVM,代码行数:35,代码来源:HardDrive.cs
示例8: Execute
public void Execute(VirtualMachine machine)
{
byte reg = machine.memory.Read(machine.IP);
machine.IP++;
ushort val = (ushort)machine.GetRegister(reg);
machine.Mmanager.Push(val);
}
开发者ID:Northcode,项目名称:nvm,代码行数:7,代码来源:Push.cs
示例9: Execute
public void Execute(VirtualMachine machine)
{
if (machine.currentBuildingClass != null)
{
Field f = new Field();
f.Name = machine.memory.ReadString(machine.IP);
machine.IP += (uint)f.Name.Length + 1;
string typename = machine.memory.ReadString(machine.IP);
machine.IP += (uint)typename.Length + 1;
if (machine.ContainsClass(typename))
{
f.Type = machine.GetClass(typename);
}
else if (typename == "int32")
{
f.Type = Class.C_INT32;
}
else if (typename == "int16")
{
f.Type = Class.C_INT16;
}
else if (typename == "byte")
{
f.Type = Class.C_BYTE;
}
else if (typename == "string")
{
f.Type = Class.C_STRING;
}
f.Parent = machine.currentBuildingClass;
machine.currentBuildingClass.fields.Add(f);
}
}
开发者ID:Northcode,项目名称:nvm,代码行数:33,代码来源:DEFV.cs
示例10: Emit
public override void Emit(VirtualMachine.InstructionList into, OperationDestination Destination)
{
RHS.Emit(into, OperationDestination.Stack);
LHS.Emit(into, OperationDestination.Stack);
into.AddInstruction(Instruction, VirtualMachine.Operand.POP, VirtualMachine.Operand.POP,
Node.WriteOperand(Destination));
}
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:RawBinaryOperation.cs
示例11: Execute
public void Execute(VirtualMachine machine)
{
byte reg = machine.memory.Read(machine.IP);
machine.IP++;
ushort val = machine.Mmanager.Pop16();
machine.SetRegister(reg, val);
}
开发者ID:Northcode,项目名称:nvm,代码行数:7,代码来源:POP.cs
示例12: EmitUnbox
public static void EmitUnbox(
VirtualMachine.InstructionList into,
OperationDestination Source,
OperationDestination Destination)
{
into.AddInstructions("LOAD_RSO_M " + ReadOperand(Source) + " NEXT " + WriteOperand(Destination), 2);
}
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:Box.cs
示例13: Main
static void Main(string[] args)
{
Tokenizer t = new Tokenizer();
t.Tokenize("if(12 == 2) { 1+45; ~ \"iets\"6;} else {} while(1==2) { show(); }");
//t.Tokenize("var x = 3; var y = x + 3;");
//t.Tokenize("var x = 5; var y = 3 + 6 * x; if ( x < 3 ) { }");
LinkedListNode<Token> to = t.TokenList.First;
while (to != null)
{
Token token = to.Value;
System.Console.WriteLine(token.Text + " : " +token.Description + ", at level: "+token.Level);
to = to.Next;
}
t.ValidateTokens();
Listitem action = BaseCompiler.ActionList.First;
while (action != null)
{
Console.WriteLine(action.GetType());
action = action.Next;
}
VirtualMachine vm = new VirtualMachine();
vm.action = (Actions.Action) BaseCompiler.ActionList.First;
vm.runCode();
System.Console.ReadLine();
}
开发者ID:acdoorn,项目名称:tokenizer,代码行数:32,代码来源:Program.cs
示例14: _new
public HassiumEncoding _new(VirtualMachine vm, params HassiumObject[] args)
{
HassiumEncoding encoding = new HassiumEncoding();
switch (args[0].ToString(vm).String.ToUpper())
{
case "UTF8":
encoding.Encoding = Encoding.UTF8;
break;
case "UTF7":
encoding.Encoding = Encoding.UTF7;
break;
case "UTF32":
encoding.Encoding = Encoding.UTF32;
break;
case "UNICODE":
encoding.Encoding = Encoding.Unicode;
break;
default:
encoding.Encoding = Encoding.ASCII;
break;
}
encoding.AddAttribute("bodyName", new HassiumProperty(encoding.get_bodyName));
encoding.AddAttribute("encodingName", new HassiumProperty(encoding.get_encodingName));
encoding.AddAttribute("getBytes", encoding.getBytes, 1);
encoding.AddAttribute("getString", getString, 1);
encoding.AddAttribute("headerName", new HassiumProperty(encoding.get_headerName));
return encoding;
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:29,代码来源:HassiumEncoding.cs
示例15: MethodExitEventArgs
internal MethodExitEventArgs(VirtualMachine virtualMachine, SuspendPolicy suspendPolicy, EventRequest request, ThreadReference thread, Location location, IValue returnValue)
: base(virtualMachine, suspendPolicy, request, thread, location)
{
Contract.Requires<ArgumentNullException>(returnValue != null, "returnValue");
_returnValue = returnValue;
}
开发者ID:fjnogueira,项目名称:JavaForVS,代码行数:7,代码来源:MethodExitEventArgs.cs
示例16: Iter
public override HassiumObject Iter(VirtualMachine vm, params HassiumObject[] args)
{
HassiumList result = new HassiumList(new HassiumObject[0]);
for (int i = 0; i < BitArray.Length; i++)
result.add(vm, new HassiumBool(BitArray.Get(i)));
return result;
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:7,代码来源:HassiumBitArray.cs
示例17: EmitInstructions
public virtual void EmitInstructions(ParseScope DeclarationScope, VirtualMachine.InstructionList Into)
{
if (Instructions != null) throw new InvalidOperationException("Instructions should not be emitted twice");
CleanupPoint = Into.Count;
if (CleanupCall >= 0)
Into[CleanupCall] = CleanupPoint;
Into.AddInstructions("CLEANUP NEXT #Cleanup " + Name, DeclarationScope.Owner.ActualParameterCount, "RETURN POP");
Instructions = Into;
EntryPoint = Into.Count;
Instructions.AddInstructions("MOVE F PUSH #Enter " + Name, "MARK_STACK F");
Body.Emit(Instructions, Ast.OperationDestination.Discard);
//Instructions.AddInstructions("MOVE NEXT R", 0); //If a function has no return statement, it returns 0.
var returnJumpPoint = Instructions.Count;
Instructions.AddInstructions(
"RESTORE_STACK F",
"MOVE POP F",
"RETURN POP");
System.Diagnostics.Debug.Assert(DeclarationScope.Type == ScopeType.Function);
System.Diagnostics.Debug.Assert(DeclarationScope.ReturnJumpSources != null);
foreach (var point in DeclarationScope.ReturnJumpSources)
Instructions[point] = returnJumpPoint;
}
开发者ID:Blecki,项目名称:EtcScript,代码行数:28,代码来源:LambdaBlock.cs
示例18: get_creationTime
public HassiumDateTime get_creationTime(VirtualMachine vm, params HassiumObject[] args)
{
var ret = new HassiumDateTime();
ret.DateTime = FileInfo.CreationTime;
HassiumDateTime.AddAttributes(ret);
return ret;
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:7,代码来源:HassiumFileInfo.cs
示例19: Attach
public override void Attach(VirtualMachine machine)
{
machine.RegisterPortInHandler(3, () => debugger.DataRequested());
machine.RegisterPortInHandler(9, () => (short)random.Next(short.MinValue, short.MaxValue));
machine.RegisterPortInHandler(10, () => timers[0].DataRequested());
machine.RegisterPortInHandler(11, () => timers[1].DataRequested());
machine.RegisterPortInHandler(12, () => timers[2].DataRequested());
machine.RegisterPortInHandler(13, () => timers[3].DataRequested());
machine.RegisterPortOutHandler(3, s => debugger.DataReceived(s));
machine.RegisterPortOutHandler(9, s => random = new Random(s));
machine.RegisterPortOutHandler(10, s => timers[0].DataReceived(s));
machine.RegisterPortOutHandler(11, s => timers[1].DataReceived(s));
machine.RegisterPortOutHandler(12, s => timers[2].DataReceived(s));
machine.RegisterPortOutHandler(13, s => timers[3].DataReceived(s));
machine.RegisterPortOutHandler(20, data =>
{
if (data == 0)
{
PaletteReset();
return;
}
for (var i = 0; i < 256; i++)
{
var colorOffset = data + (i * 3);
var r = machine.Memory[colorOffset + 0];
var g = machine.Memory[colorOffset + 1];
var b = machine.Memory[colorOffset + 2];
display.PaletteSet((byte)i, new Color(r, g, b));
}
});
}
开发者ID:Rohansi,项目名称:VM,代码行数:34,代码来源:Motherboard.cs
示例20: Index
public override HassiumObject Index(VirtualMachine vm, params HassiumObject[] args)
{
foreach (var pair in Dictionary)
if (pair.Key.EqualTo(vm, args[0]).ToBool(vm).Bool)
return pair.Value;
throw new InternalException(vm, InternalException.VALUE_NOT_FOUND_ERROR, args[0].ToString(vm).String);
}
开发者ID:GruntTheDivine,项目名称:Hassium,代码行数:7,代码来源:HassiumDictionary.cs
注:本文中的VirtualMachine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论