本文整理汇总了C#中Ruby.Runtime.Frame类的典型用法代码示例。如果您正苦于以下问题:C# Frame类的具体用法?C# Frame怎么用?C# Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Frame类属于Ruby.Runtime命名空间,在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
ProcessStatus status = ((ProcessStatus)recv);
System.Text.StringBuilder buf = new System.Text.StringBuilder();
buf.Append(string.Format(CultureInfo.InvariantCulture, "#<{0}: pid={1}", status.my_class._name, status.pid));
if (status.WIFSTOPPED())
{
int stopsig = status.WSTOPSIG();
string signame = Signal.ruby_signal_name(stopsig);
if (signame != null)
buf.Append(string.Format(CultureInfo.InvariantCulture, ",stopped(SIG{0}={1})", signame, stopsig));
else
buf.Append(string.Format(CultureInfo.InvariantCulture, ",stopped({0})", stopsig));
}
if (status.WIFSIGNALED())
{
int termsig = status.WTERMSIG();
string signame = Signal.ruby_signal_name(termsig);
if (signame != null)
buf.Append(string.Format(CultureInfo.InvariantCulture, ",signaled(SIG{0}={1})", signame, termsig));
else
buf.Append(string.Format(CultureInfo.InvariantCulture, ",signaled({0})", termsig));
}
if (status.WIFEXITED())
{
buf.Append(string.Format(CultureInfo.InvariantCulture, ",exited({0})", status.WEXITSTATUS()));
}
buf.Append(">");
return new String(buf.ToString());
}
示例2: const_get
internal override object const_get(string name, bool recurse, Frame caller)
{
if (instance_vars.ContainsKey(name))
return instance_vars[name];
Class c = super;
while (c != null)
{
if (c.instance_vars.ContainsKey(name))
return c.instance_vars[name];
c = c.super;
}
if (Init.rb_cClass.instance_vars.ContainsKey(name))
return Init.rb_cClass.instance_vars[name];
if (Init.rb_cModule.instance_vars.ContainsKey(name))
return Init.rb_cModule.instance_vars[name];
if (Init.rb_cObject.instance_vars.ContainsKey(name))
return Init.rb_cObject.instance_vars[name];
return Eval.CallPrivate(this, caller, "const_missing", null, new Symbol(name));
}
示例3: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
Class klass0 = Class.CLASS_OF(recv);
return klass0.class_real();
}
示例4: Call
public override object Call(Class last_class, object recv, Frame caller, Proc block, Array rest)
{
if ((rest.Count == 0) || ((rest.Count == 0) && (rest.value[0].Equals(recv))))
return recv;
return Eval.CallPrivate(rest.value[0], caller, "new", block, rest);
}
示例5: Compare
internal static int Compare(object a, object b, Frame caller) //status: done
{
object value = Eval.CallPrivate(a, caller, "<=>", null, b);
if (value == null)
{
throw new ArgumentError(string.Format(CultureInfo.InvariantCulture, "comparison of {0} with {1} failed", Class.rb_obj_classname(a), Class.rb_obj_classname(b))).raise(caller);
}
else if (value is int)
{
return (int)value;
}
else if (value is Bignum)
{
return ((Bignum)value).value >= 0 ? 1 : -1;
}
else if ((bool)Eval.CallPrivate(value, caller, ">", null, 0))
{
return 1;
}
else if ((bool)Eval.CallPrivate(value, caller, "<", null, 0))
{
return -1;
}
else
{
return 0;
}
}
示例6: rb_Float
internal static Float rb_Float(object o, Frame caller)
{
if (o is int)
{
return new Float((double)(int)o);
}
else if (o is double)
{
return new Float((double)o);
}
else if (o is Bignum)
{
return new Float((double)((Bignum)o).value);
}
else if (o is String)
{
return new Float(String.rb_str_to_dbl(caller, (String)o, true));
}
else if (o == null)
{
throw new TypeError("cannot convert nil into Float").raise(caller);
}
else
{
Float f = Object.Convert<Float>(o, "to_f", caller);
if (System.Double.IsNaN(f.value))
{
throw new ArgumentError("invalid value for Float()").raise(caller);
}
else
{
return f;
}
}
}
示例7: GETASTER
internal static int GETASTER(ref int t, ref int p, out int n, int end,
string fmtString, ref int posArg, ref int nextArg,
object nextValue, object tmp, Array argv, Frame caller)
{
t = p++;
n = 0;
for (; p < end && char.IsDigit(fmtString[p]); p++)
{
n = 10 * n + (fmtString[p] - '0');
}
if (p >= end)
{
throw new ArgumentError("malformed format string - %*[0-9]").raise(caller);
}
if (fmtString[p] == '$')
{
tmp = GETPOSARG(caller, n, ref posArg, argv);
}
else
{
tmp = GETARG(caller, ref posArg, ref nextArg, nextValue, argv);
p = t;
}
return Numeric.rb_num2long(tmp, caller);
}
示例8: Call
public override object Call(Class last_class, object recv, Frame caller, Proc block, Array rest)
{
object time, t;
long seconds = 0;
long uSeconds = 0;
if (Class.rb_scan_args(caller, rest, 1, 1, false) == 2)
{
time = rest[0];
t = rest[1];
seconds = Numeric.rb_num2long(rest[0], caller);
uSeconds = Numeric.rb_num2long(rest[1], caller);
}
else
{
time = rest[0];
Time.rb_time_timeval(rest[0], out seconds, out uSeconds, caller);
}
if (time is Time)
{
bool gmt = ((Time)time).gmt;
t = Time.time_new_internal(seconds, uSeconds, gmt, caller);
}
else
{
t = Time.time_new_internal(seconds, uSeconds, false, caller);
((Time)t).value = ((Time)t).value.ToLocalTime();
}
return t;
}
示例9: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object param0)
{
if (param0 is bool)
return (bool)param0;
return param0 != null;
}
示例10: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
// this functionality seems to be getting done in another method
// could not find a testing sequence that made this fail. Although
// Eval.getConst only calls it under certain circumstances.
return Init.rb_cObject.get_constants();
}
示例11: chmod_internal
// -------------------------------------------------------------
internal static void chmod_internal(string path, int mode, Frame caller)
{
if (chmod(path, mode) < 0)
{
throw SystemCallError.rb_sys_fail(path, new System.IO.IOException(), caller).raise(caller);
}
}
示例12: Calln
public override object Calln(Class last_class, object recv, Frame caller, ArgList args)
{
if (args.Length == 0)
return Call1(last_class, recv, caller, args.block, 1);
else
return Call1(last_class, recv, caller, args.block, args[0]);
}
示例13: getter
internal override object getter(string id, Frame caller)
{
Match tilde;
switch (aliased)
{
case "$&":
tilde = caller.Tilde;
if (tilde != null)
return tilde.last_match(caller);
else
return null;
case "$`":
tilde = caller.Tilde;
if (tilde != null)
return tilde.match_pre(caller);
else
return null;
case "$'":
tilde = caller.Tilde;
if (tilde != null)
return tilde.match_post(caller);
else
return null;
case "$+":
tilde = caller.Tilde;
if (tilde != null)
return tilde.match_last(caller);
else
return null;
default:
break;
}
return Variables.gvar_get(aliased, caller);
}
示例14: setter
internal override void setter(string id, object val, Frame caller)
{
if ((val != null) && !(val is String))
throw new TypeError(string.Format(CultureInfo.InvariantCulture, "value of {0} must be String", id)).raise(caller);
this.value = val;
}
示例15: Call
public override object Call(Class last_class, object str, Frame caller, Proc block, Array argv)
{
int argc = argv.Count;
object result;
if (argc < 1 || 2 < argc)
{
throw new ArgumentError(string.Format(CultureInfo.InvariantCulture, "wrong number of arguments ({0} for 1)", argc)).raise(caller);
}
Array buf = new Array();
int i;
for (i = 0; i < argc; i++)
{
buf.Add(argv[i]);
}
result = rb_str_aref_m.singleton.Call(last_class, str, caller, null, buf);
if (result != null)
{
buf.Add(new String());
rb_str_aset_m.singleton.Call(last_class, str, caller, null, buf);
}
return result;
}