Exemplo n.º 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;
 }
Exemplo n.º 2
0
 static private void  iCaseSetter(object val, uint id, GlobalEntry gb, NetRuby rb)
 {
     rb.cRegexp.IsIgnoreCase = RBasic.RTest(val);
 }
Exemplo n.º 3
0
 static private void kCodeSetter(object val, uint id, GlobalEntry gb, NetRuby rb)
 {
 }
Exemplo n.º 4
0
 static private object matchGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     RThread th = rb.GetCurrentContext();
     object o = th.BackRef;
     matchBusy(o);
     return o;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
     }
Exemplo n.º 7
0
 protected RNGAsgn(uint v, GlobalEntry e)
     : base(null, v, null)
 {
     ent = e;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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
     {
     }
     */
 }
Exemplo n.º 10
0
 static private object debugGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.debug;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
        }
Exemplo n.º 14
0
 static private object errInfoGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     RThread th = rb.GetCurrentContext();
     return th.errInfo;
 }
Exemplo n.º 15
0
 internal void DefineVirtualVariable(string name, GlobalEntry.Getter gtr, GlobalEntry.Setter str)
 {
     DefineVariable(name, null, gtr, str);
 }
Exemplo n.º 16
0
 static private object printGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doPrint;
 }
Exemplo n.º 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));
     }
 }
Exemplo n.º 18
0
 static private object splitGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doSplit;
 }
Exemplo n.º 19
0
 internal object GVarGet(GlobalEntry entry)
 {
     return entry.GetValue(this);
 }
Exemplo n.º 20
0
 static private object lineGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.doLine;
 }
Exemplo n.º 21
0
 internal RNGVar(uint v, GlobalEntry ent) :
     base(v, ent)
 {
 }
Exemplo n.º 22
0
 static private object argvGetter(uint i, GlobalEntry gb, NetRuby rb)
 {
     return rb.argv;
 }
Exemplo n.º 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;
 }
Exemplo n.º 24
0
 static private void SetArg0(object val, uint i, GlobalEntry gb, NetRuby rb)
 {
 }
Exemplo n.º 25
0
 static private object iCaseGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     return rb.cRegexp.ignoreCase;
 }
Exemplo n.º 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;
 }
Exemplo n.º 27
0
 static private object kCodeGetter(uint id, GlobalEntry gb, NetRuby rb)
 {
     return "none";
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 29
0
 public void Write(GlobalEntry n)
 {
     Write("<GlobalEntry>");
 }
Exemplo n.º 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);
 }