本文整理汇总了C#中io.IoObject类的典型用法代码示例。如果您正苦于以下问题:C# IoObject类的具体用法?C# IoObject怎么用?C# IoObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IoObject类属于io命名空间,在下文中一共展示了IoObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: activate
public override IoObject activate(IoObject self, IoObject target, IoObject locals, IoMessage m, IoObject slotContext)
{
IoCLRFunction method = self as IoCLRFunction;
IoCLRObject obj = target as IoCLRObject;
object result = null;
object[] parameters = new object[method.evaluatedParameters.Count];
for (int i = 0; i < method.evaluatedParameters.Count; i++)
{
IoObject ep = method.evaluatedParameters[i] as IoObject;
switch (ep.name)
{
case "Object": parameters[i] = ep; break;
case "Number":
{
IoNumber num = ep as IoNumber;
if (num.isInteger)
{
parameters[i] = num.longValue;
}
else
{
parameters[i] = num.doubleValue;
}
}
break;
case "Sequence": parameters[i] = (ep as IoSeq).value; break;
case "CLRObject": parameters[i] = (ep as IoCLRObject).clrInstance; break;
}
}
IoCLRObject clr = IoCLRObject.createObject(self.state);
try
{
if (method.methodInfo is ConstructorInfo)
{
ConstructorInfo ci = method.methodInfo as ConstructorInfo;
result = ci.Invoke(parameters);
}
else if (method.methodInfo is MethodInfo)
{
MethodInfo mi = method.methodInfo as MethodInfo;
result = mi.Invoke(obj.clrInstance, parameters);
}
clr.clrType = result != null ? result.GetType() : null;
clr.clrInstance = result;
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
clr.clrType = null;
clr.clrInstance = null;
}
return clr;
}
开发者ID:devaspot,项目名称:io,代码行数:59,代码来源:IoCLRFunction.cs
示例2: slotAt
public static IoObject slotAt(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoNumber ind = m.localsNumberArgAt(locals, 0);
IoList o = target as IoList;
IoObject v = o.list[ind.asInt()] as IoObject;
return v == null ? target.state.ioNil : v;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:8,代码来源:IoList.cs
示例3: slotGetType
public static IoObject slotGetType(IoObject target, IoObject locals, IoObject message)
{
IoCLR self = target as IoCLR;
IoMessage m = message as IoMessage;
IoString typeName = m.localsSymbolArgAt(locals, 0);
IoObject obj = self.getType(target.state, typeName.value);
return obj == null ? target.state.ioNil : obj;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:8,代码来源:IoCLR.cs
示例4: cloneSpecific
public override void cloneSpecific(IoObject _from, IoObject _to)
{
IoCFunction from = _from as IoCFunction;
IoCFunction to = _to as IoCFunction;
to.isActivatable = true;
to.funcName = from.funcName;
to.func = from.func;
}
开发者ID:devaspot,项目名称:io,代码行数:8,代码来源:IoCFunction.cs
示例5: slotBlock
public static new IoObject slotBlock(IoObject target, IoObject locals, IoObject m)
{
IoBlock self = target as IoBlock;
self = IoBlock.slotMethod(target, locals, m) as IoBlock;
self.scope = locals;
self.isActivatable = false;
return self;
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:8,代码来源:IoBlock.cs
示例6: slotAtPut
public static IoObject slotAtPut(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoObject key = m.localsValueArgAt(locals, 0);
IoObject value = m.localsValueArgAt(locals, 1);
IoMap dict = target as IoMap;
dict.map[key.ToString()] = value;
return target;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:9,代码来源:IoMap.cs
示例7: slotAdd
public static IoObject slotAdd(IoObject target, IoObject locals, IoObject message)
{
IoNumber other = (message as IoMessage).localsNumberArgAt(locals, 0);
IoNumber self = target as IoNumber;
if (other == null) return self;
return IoNumber.newWithDouble(target.state,
(self.isInteger ? self.longValue : self.doubleValue) +
(other.isInteger ? other.longValue : other.doubleValue)
);
}
开发者ID:ChadSki,项目名称:research-io,代码行数:10,代码来源:IoNumber.cs
示例8: slotNamespaces
// published slots
public static IoObject slotNamespaces(IoObject target, IoObject locals, IoObject message)
{
IoCLRAssembly self = target as IoCLRAssembly;
IoMessage m = message as IoMessage;
foreach (string s in self.assemblyNamespaces.Keys)
{
Console.Write(s + " ");
}
Console.WriteLine();
return self;
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:12,代码来源:IoCLRAssembly.cs
示例9: slotHasKey
public static IoObject slotHasKey(IoObject target, IoObject locals, IoObject message)
{
IoMap dict = target as IoMap;
IoMessage m = message as IoMessage;
IoObject key = m.localsValueArgAt(locals, 0);
if (dict.lookupMap(key) == null)
{
return dict.tag.state.ioFalse;
}
return dict.tag.state.ioTrue;
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:11,代码来源:IoBDB.cs
示例10: slotHasValue
public static IoObject slotHasValue(IoObject target, IoObject locals, IoObject message)
{
IoMap dict = target as IoMap;
IoMessage m = message as IoMessage;
IoObject val = m.localsValueArgAt(locals, 0);
if (dict.lookupMapValues(val) == null)
{
return dict.state.ioFalse;
}
return dict.state.ioTrue;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:11,代码来源:IoMap.cs
示例11: slotMain
public static IoObject slotMain(IoObject target, IoObject locals, IoObject message)
{
IoCoroutine self = target as IoCoroutine;
//IoObject runTarget = self.rawRunTarget();
//IoObject runLocals = self.rawRunLocals();
//IoMessage runMessage = self.rawRunMessage() as IoMessage;
//if (runLocals != null && runMessage != null && runTarget != null)
// runMessage.localsPerformOn(runTarget, runLocals);
//else
// Console.WriteLine("Coroutine 'main' missed needed parameters");
return self.tag.state.ioNil;
}
开发者ID:devaspot,项目名称:io,代码行数:12,代码来源:IoCoroutine.cs
示例12: slotAt
public static IoObject slotAt(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoObject result = null;
IoObject symbol = m.localsValueArgAt(locals, 0);
IoMap dict = target as IoMap;
result = dict.lookupMap(symbol) as IoObject;
if (result == null && m.args.Count > 1) {
result = m.localsValueArgAt(locals, 1);
}
return result == null ? dict.state.ioNil : result;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:12,代码来源:IoMap.cs
示例13: slotAppend
public static IoObject slotAppend(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoList o = target as IoList;
for (int i = 0; i < m.args.Count; i++)
{
IoObject obj = m.localsValueArgAt(locals, i);
o.list.Add(obj);
}
return o;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:12,代码来源:IoList.cs
示例14: slotAppendStr
public static IoObject slotAppendStr(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoList o = target as IoList;
for (int i = 0; i < m.args.Count; i++)
{
IoList obj = m.localsValueArgAt(locals, i) as IoList;
for (int j = 0; j < obj.list.Count; j++)
{
IoObject v = obj.list[j] as IoObject;
o.list.Add(v);
}
}
return o;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:16,代码来源:IoList.cs
示例15: slotLoadAssembly
public static IoObject slotLoadAssembly(IoObject target, IoObject locals, IoObject message)
{
IoCLR self = target as IoCLR;
IoMessage m = message as IoMessage;
IoString assemblyName = m.localsSymbolArgAt(locals, 0);
IoCLRAssembly asm = self.loadedAssemblies[assemblyName.value] as IoCLRAssembly;
if (asm != null)
{
return asm;
}
asm = IoCLRAssembly.createObject(target.state);
asm.assembly = Assembly.LoadWithPartialName(assemblyName.value);
if (asm.assembly == null) return self;
self.loadedAssemblies[assemblyName.value] = asm;
asm.assemblyTypes = asm.assembly.GetTypes();
asm.assemblyNamespaces = new Hashtable();
foreach (Type t in asm.assemblyTypes)
{
string theNameSpace = t.FullName.LastIndexOf(".") == -1 ? "-" : t.FullName.Substring(0, t.FullName.LastIndexOf("."));
string theClass = t.FullName.LastIndexOf(".") == -1 ? t.FullName : t.FullName.Substring(t.FullName.LastIndexOf(".") + 1);
//if (theClass.Equals("Form"))
//{
// int i = 0;
//}
if (asm.assemblyNamespaces.ContainsKey(theNameSpace))
{
Hashtable a = asm.assemblyNamespaces[theNameSpace] as Hashtable;
a[theClass] = t;
}
else
{
Hashtable classes = new Hashtable();
classes[theClass] = t;
asm.assemblyNamespaces[theNameSpace] = classes;
}
}
return asm;
}
开发者ID:ChadSki,项目名称:research-io,代码行数:44,代码来源:IoCLR.cs
示例16: asyncCall
public static IEnumerator asyncCall(IoContext ctx, IoObject future)
{
IoObject target = ctx.target;
IoObject locals = ctx.locals;
IoObject result = target;
IoObject cachedTarget = target;
IoMessage msg = ctx.message;
IoObject savedPrevResultAsYieldResult = null;
do
{
if (msg.messageName.Equals(msg.state.semicolonSymbol))
{
target = cachedTarget;
}
else
{
result = msg.cachedResult;
if (result == null)
{
if (msg.messageName.value.Equals("yield"))
{
yield return result;
}
else
{
result = target.perform(target, locals, msg);
}
}
if (result == null)
{
result = savedPrevResultAsYieldResult;
}
target = result;
savedPrevResultAsYieldResult = result;
}
} while ((msg = msg.next) != null);
future.slots["future"] = result;
yield return null;
//yield return result;
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:41,代码来源:IoMessage.cs
示例17: slotCode
public static IoObject slotCode(IoObject target, IoObject locals, IoObject m)
{
string s = "";
IoBlock self = target as IoBlock;
if (self.scope != null)
s += "block(";
else
s += "method(";
int nargs = self.argNames.Count;
for (int i = 0; i < nargs; i++)
{
IoSeq name = self.argNames[i] as IoSeq;
s += name.value + ", ";
}
IoMessage msg = self.containedMessage;
IoSeq seq = IoMessage.slotCode(msg, locals, m) as IoSeq;
s += seq.value + ")";
return IoSeq.createObject(target.state, s);
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:21,代码来源:IoBlock.cs
示例18: slotMethod
// Published Slots
public static new IoObject slotMethod(IoObject target, IoObject locals, IoObject message)
{
IoState state = target.state;
IoBlock self = IoBlock.createObject(state);
IoMessage m = message as IoMessage;
int nargs = m.args.Count;
IoMessage lastArgAsMessage = (nargs > 0) ? m.rawArgAt(nargs - 1) : state.nilMessage;
int i;
self.containedMessage = lastArgAsMessage;
self.isActivatable = true;
for (i = 0; i < nargs - 1; i ++)
{
IoMessage argMessage = m.rawArgAt(i);
IoSeq name = argMessage.messageName;
self.argNames.Add(name);
}
return self;
}
开发者ID:stangelandcl,项目名称:io-clr,代码行数:22,代码来源:IoBlock.cs
示例19: localsUpdateSlot
public static IoObject localsUpdateSlot(IoObject target, IoObject locals, IoObject message)
{
IoMessage m = message as IoMessage;
IoSeq slotName = m.localsSymbolArgAt(locals, 0);
if (slotName == null) return target;
IoObject obj = target.rawGetSlot(slotName);
if (obj != null)
{
IoObject slotValue = m.localsValueArgAt(locals, 1);
target.slots[slotName] = slotValue;
return slotValue;
}
else
{
IoObject theSelf = target.rawGetSlot(target.state.selfMessage.messageName);
if (theSelf != null)
{
return theSelf.perform(theSelf, locals, m);
}
}
return target.state.ioNil;
}
开发者ID:devaspot,项目名称:io,代码行数:22,代码来源:IoObject.cs
示例20: slotResume
//public object Yield()
//{
// yield return null;
//}
public static IoObject slotResume(IoObject target, IoObject locals, IoObject message)
{
IoCoroutine self = target as IoCoroutine;
//object ret = null;
//if (self.fiber != null)
//{
// IoCoroutine current = target.tag.state.currentCoroutine;
// target.tag.state.currentCoroutine = self;
// ret = self.fiber.Resume();
// //if (ret == null)
// //{
// // Console.WriteLine("Fiber Exceeds on " + self.fiber.uniqueId);
// // throw new Exception("Can't resume Fiber");
// //}
//}
//else
//{
// IoCoroutine.slotRun(self, null, null);
//}
return self;
}
开发者ID:devaspot,项目名称:io,代码行数:27,代码来源:IoCoroutine.cs
注:本文中的io.IoObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论