public Parser(NetRuby rb) { evalTree = null; ruby = rb; thread = rb.GetCurrentContext(); compile_for_eval = false; }
internal static void Init(NetRuby rb) { RThreadGroupClass t = new RThreadGroupClass(rb); t.DefineClass("ThreadGroup", rb.cObject); rb.cThreadGroup = t; t.DefineSingletonMethod("new", new RMethod(tg_new), -1); t.DefineMethod("list", new RMethod(list), 0); t.DefineMethod("add", new RMethod(add), 1); RThreadGroup rg = (RThreadGroup)tg_new(t); t.ConstSet(rb.intern("Default"), rg); rg.Add(rb.GetCurrentContext()); }
static internal RThread Start(NetRuby ruby, object[] args) { RThread parent = ruby.GetCurrentContext(); RThread thrd = (RThread)parent.Clone(); return thrd.Start(args); }
static private void matchSetter(object val, uint id, GlobalEntry gb, NetRuby rb) { rb.CheckType(val, typeof(RMatchData)); RThread th = rb.GetCurrentContext(); th.BackRef = val; }
static private object lastParenGetter(uint id, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); RMatchData m = (RMatchData)th.BackRef; if (m == null) return null; string s = m.Last; if (m.IsTainted) return new RString(rb, s, true); return s; }
static private object matchGetter(uint id, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); object o = th.BackRef; matchBusy(o); return o; }
static private object errInfoGetter(uint i, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); return th.errInfo; }
static private void errInfoSetter(object val, uint id, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); if (val != null) { RBasic b = rb.InstanceOf(val); if (b.IsKindOf(rb.eException) == false) throw new eTypeError("assigning non-exception to $!"); } th.errInfo = (RException)val; }
static private void errAtSetter(object val, uint id, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); if (th.errInfo == null) { throw new ArgumentException("$! not set"); } RException.exc_set_backtrace(th.errInfo, val); }
static private object errAtGetter(uint id, GlobalEntry gb, NetRuby rb) { RThread th = rb.GetCurrentContext(); if (th.errInfo != null) { return th.errInfo.Backtrace; } return null; }