本文整理汇总了C#中io.IoObject类的典型用法代码示例。如果您正苦于以下问题:C# IoObject类的具体用法?C# IoObject怎么用?C# IoObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IoObject类属于io命名空间,在下文中一共展示了IoObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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)
);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}