Example #1
0
 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;
 }
Example #2
0
 static private void  iCaseSetter(object val, uint id, GlobalEntry gb, NetRuby rb)
 {
     rb.cRegexp.IsIgnoreCase = RBasic.RTest(val);
 }
Example #3
0
 static private void kCodeSetter(object val, uint id, GlobalEntry gb, NetRuby rb)
 {
 }
Example #4
0
 static private object matchGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     RThread th = rb.GetCurrentContext();
     object o = th.BackRef;
     matchBusy(o);
     return o;
 }
Example #5
0
 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;
 }
Example #6
0
     internal object GVarSet(GlobalEntry entry, object o)
     {
         RThread th = GetCurrentContext();
         /*if (th.safeLevel >= 4)
         {
             throw new SecurityException("Insecure: can't change global variable value");
         }*/
         lock (entry)
         {
             entry.SetValue(o, this);
         }
 // trace
         return o;
     }
Example #7
0
 protected RNGAsgn(uint v, GlobalEntry e)
     : base(null, v, null)
 {
     ent = e;
 }
Example #8
0
 static internal object lastLineGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     /*
     RThread th = rb.GetCurrentContext();
     if (th.scope.local_vars != null)
     {
         return th.scope.local_vars[0];
     }
     */
     return null;
 }
Example #9
0
 static private void lastLineSetter(object val, uint i, GlobalEntry gb, NetRuby rb)
 {
     /*
     RThread th = rb.GetCurrentContext();
     if (th.scope.local_vars != null)
     {
         th.scope.local_vars[0] = val.ToString();
     }
     else
     {
     }
     */
 }
Example #10
0
 static private object debugGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.debug;
 }
Example #11
0
 static private void debugSetter(object val, uint i, GlobalEntry gb, NetRuby rb)
 {
     if (val == null) rb.debug = false;
     else if (val is bool) rb.debug = (bool)val;
     else rb.debug = true;
 }
Example #12
0
 static private void verboseSetter(object val, uint i, GlobalEntry gb, NetRuby rb)
 {
     if (val == null) rb.verbose = false;
     else if (val is bool) rb.verbose = (bool)val;
     else rb.verbose = true;
 }
Example #13
0
/*        
        static private object safeGetter(uint i, GlobalEntry gb, NetRuby rb)
        {
            return rb.GetCurrentContext().safeLevel;
        }
        static private void safeSetter(object val, uint i, GlobalEntry gb, NetRuby rb)
        {
            int level = RInteger.ToInt(rb, val);
            RThread th = rb.GetCurrentContext();
            if (level < th.safeLevel)
                throw new SecurityException(String.Format("tried to downgrade safe level from {0} to {1}", th.safeLevel, level));
            th.safeLevel = level;
        }
*/        
        static private object verboseGetter(uint i, GlobalEntry gb, NetRuby rb)
        {
            return rb.verbose;
        }
Example #14
0
 static private object errInfoGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     RThread th = rb.GetCurrentContext();
     return th.errInfo;
 }
Example #15
0
 internal void DefineVirtualVariable(string name, GlobalEntry.Getter gtr, GlobalEntry.Setter str)
 {
     DefineVariable(name, null, gtr, str);
 }
Example #16
0
 static private object printGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doPrint;
 }
Example #17
0
 internal void DefineReadonlyVariable(string name, object obj, GlobalEntry.Getter gtr)
 {
     GlobalEntry ent = global_entry(global_id(name));
     lock (ent)
     {
         ent.data = obj;
         ent.ReplaceGetter(gtr);
         ent.ReplaceSetter(new GlobalEntry.Setter(GlobalEntry.ReadonlySetter));
     }
 }
Example #18
0
 static private object splitGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doSplit;
 }
Example #19
0
 internal object GVarGet(GlobalEntry entry)
 {
     return entry.GetValue(this);
 }
Example #20
0
 static private object lineGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doLine;
 }
Example #21
0
 internal RNGVar(uint v, GlobalEntry ent) :
     base(v, ent)
 {
 }
Example #22
0
 static private object argvGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.argv;
 }
Example #23
0
 static private void matchSetter(object val, uint id, GlobalEntry gb, NetRuby rb)
 {
     rb.CheckType(val, typeof(RMatchData));
     RThread th = rb.GetCurrentContext();
     th.BackRef = val;
 }
Example #24
0
 static private void SetArg0(object val, uint i, GlobalEntry gb, NetRuby rb)
 {
 }
Example #25
0
 static private object iCaseGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     return rb.cRegexp.ignoreCase;
 }
Example #26
0
 internal GlobalEntry global_entry(uint id)
 {
     object o;
     GlobalEntry ret = null;
     lock (global_tbl.SyncRoot)
     {
         if (global_tbl.lookup(id, out o))
             ret = (GlobalEntry)o;
         else
         {
             ret = new GlobalEntry(id);
             global_tbl.Add(id, ret);
         }
     }
     return ret;
 }
Example #27
0
 static private object kCodeGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     return "none";
 }
Example #28
0
 /*
 internal void CloneGenericIVar(RBasic clone, RBasic obj)
 {
     if (generic_iv_tbl == null) return;
     lock (generic_iv_tbl.SyncRoot)
     {
         if (generic_iv_tbl.ContainsKey(obj))
         {
             st_table tbl = (st_table)generic_iv_tbl[obj];
             generic_iv_tbl[clone] = tbl.Clone();
         }
     }
 }
 internal bool IsGenericIVarDefined(RBasic obj, uint id)
 {
     if (generic_iv_tbl == null) return false;
     st_table tbl = null;
     if (generic_iv_tbl.lookup(obj, out tbl) == false) return false;
     object val;
     return tbl.lookup(id, out val);
 }
 internal object GenericIVarGet(RBasic obj, uint id)
 {
     if (generic_iv_tbl == null) return null;
     st_table tbl = null;
     if (generic_iv_tbl.lookup(obj, out tbl) == false) return null;
     object val;
     if (tbl.lookup(id, out val)) return val;
     return null;
 }
 internal void GenericIVarSet(RBasic obj, uint id, object val)
 {
     if (generic_iv_tbl == null)
     {
         lock (this)
         {
             if (generic_iv_tbl == null)
             {
                 generic_iv_tbl = new st_table();
             }
         }
     }
     st_table tbl = null;
     lock (generic_iv_tbl.SyncRoot)
     {
         if (generic_iv_tbl.lookup(obj, out tbl) == false)
         {
             tbl = new st_table();
             generic_iv_tbl[obj] = tbl;
         }
         tbl[id] = val;
     }
 }
 internal object GenericIVarRemove(RBasic obj, uint id)
 {
     if (generic_iv_tbl == null) return null;
     st_table tbl;
     if (generic_iv_tbl.lookup(obj, out tbl) == false) return null;
     object val = tbl[id];
     lock (tbl.SyncRoot)
     {
         tbl.Remove(id);
         if (tbl.Count == 0)
         {
             generic_iv_tbl.Remove(obj);
         }
     }
     return val;
 }
 */
 public void DefineVariable(string name, object obj, GlobalEntry.Getter gtr, GlobalEntry.Setter str)
 {
     GlobalEntry ent = global_entry(global_id(name));
     lock (ent)
     {
         ent.data = obj;
         ent.ReplaceGetter(gtr);
         ent.ReplaceSetter(str);
     }
 }
Example #29
0
 public void Write(GlobalEntry n)
 {
     Write("<GlobalEntry>");
 }
Example #30
0
 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);
 }