상속: RubyObject
예제 #1
0
        public static MutableString /*!*/ Inspect(RubyStruct /*!*/ self)
        {
            RubyContext context = self.ImmediateClass.Context;

            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                // #<struct Struct::Foo name=nil, val=nil>
                var result = MutableString.CreateMutable(RubyEncoding.Binary);
                result.Append("#<struct ");
                result.Append(context.Inspect(context.GetClassOf(self)));

                if (handle == null)
                {
                    return(result.Append(":...>"));
                }
                result.Append(' ');

                object[] data    = self.Values;
                var      members = self.GetNames();
                for (int i = 0; i < data.Length; i++)
                {
                    if (i != 0)
                    {
                        result.Append(", ");
                    }
                    // TODO (encoding):
                    result.Append(members[i]);
                    result.Append('=');
                    result.Append(context.Inspect(data[i]));
                }
                result.Append('>');
                return(result);
            }
        }
예제 #2
0
        public static MutableString /*!*/ Inspect(RubyStruct /*!*/ self)
        {
            RubyContext context = self.Class.Context;

            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                // #<struct Struct::Foo name=nil, val=nil>
                MutableString str = MutableString.Create("#<struct ");
                str.Append(RubySites.Inspect(context, context.GetClassOf(self)));

                if (handle == null)
                {
                    return(str.Append(":...>"));
                }
                str.Append(' ');

                object[] data    = self.Values;
                var      members = self.GetNames();
                for (int i = 0; i < data.Length; i++)
                {
                    if (i != 0)
                    {
                        str.Append(", ");
                    }
                    str.Append(members[i]);
                    str.Append("=");
                    str.Append(RubySites.Inspect(context, data[i]));
                }
                str.Append('>');
                return(str);
            }
        }
예제 #3
0
            private RubyStruct /*!*/ ReadStruct()
            {
                RubyStruct obj = (UnmarshalNewObject() as RubyStruct);

                if (obj == null)
                {
                    throw RubyExceptions.CreateArgumentError("non-initialized struct");
                }

                var names = obj.GetNames();
                int count = ReadInt32();

                if (count != names.Count)
                {
                    throw RubyExceptions.CreateArgumentError("struct size differs");
                }

                for (int i = 0; i < count; i++)
                {
                    string name = ReadIdentifier();
                    if (name != names[i])
                    {
                        RubyClass theClass = Context.GetClassOf(obj);
                        throw RubyExceptions.CreateTypeError("struct {0} not compatible ({1} for {2})", theClass.Name, name, names[i]);
                    }
                    obj[i] = ReadAnObject(false);
                }

                return(obj);
            }
예제 #4
0
        private static void FillTimes(RubyStruct /*!*/ result)
        {
            var process = Process.GetCurrentProcess();

            RubyStructOps.TmsSetUserTime(result, process.UserProcessorTime.TotalSeconds);
            RubyStructOps.TmsSetSystemTime(result, process.PrivilegedProcessorTime.TotalSeconds);
            RubyStructOps.TmsSetChildUserTime(result, 0.0);
            RubyStructOps.TmsSetChildSystemTime(result, 0.0);
        }
예제 #5
0
        public static RubyStruct /*!*/ InitializeCopy(RubyStruct /*!*/ self, [NotNull] RubyStruct /*!*/ source)
        {
            if (self.Class != source.Class)
            {
                throw RubyExceptions.CreateTypeError("wrong argument class");
            }

            self.SetValues(source.Values);
            return(self);
        }
예제 #6
0
        /// <summary>
        /// Struct#new
        /// Creates Struct classes with the specified name and members
        /// </summary>
        private static object Create(BlockParam block, RubyClass /*!*/ self, string className, string /*!*/[] /*!*/ attributeNames)
        {
            var result = RubyStruct.DefineStruct(self, className, attributeNames);

            if (block != null)
            {
                return(RubyUtils.EvaluateInModule(result, block, result));
            }

            return(result);
        }
예제 #7
0
        public static RubyStruct /*!*/ InitializeCopy(RubyStruct /*!*/ self, [NotNull] RubyStruct /*!*/ source)
        {
            // TODO: compare non-singleton classes?
            if (self.ImmediateClass.GetNonSingletonClass() != source.ImmediateClass.GetNonSingletonClass())
            {
                throw RubyExceptions.CreateTypeError("wrong argument class");
            }

            self.SetValues(source.Values);
            return(self);
        }
예제 #8
0
        public static bool Equals(BinaryOpStorage /*!*/ equals, RubyStruct /*!*/ self, object obj)
        {
            var other = obj as RubyStruct;

            if (!self.StructReferenceEquals(other))
            {
                return(false);
            }
            Debug.Assert(self.ItemCount == other.ItemCount);

            return(IListOps.Equals(equals, self.Values, other.Values));
        }
예제 #9
0
파일: StructOps.cs 프로젝트: TerabyteX/main
        public static object Each(BlockParam block, RubyStruct/*!*/ self)
        {
            if (block == null && self.ItemCount > 0) {
                throw RubyExceptions.NoBlockGiven();
            }

            foreach (var value in self.Values) {
                object result;
                if (block.Yield(value, out result)) {
                    return result;
                }
            }

            return self;
        }
예제 #10
0
        public static RubyStruct /*!*/ GetTimes(RubyModule /*!*/ self)
        {
            var result = RubyStruct.Create(RubyStructOps.GetTmsClass(self.Context));

            try {
                FillTimes(result);
            } catch (SecurityException) {
                RubyStructOps.TmsSetUserTime(result, 0.0);
                RubyStructOps.TmsSetSystemTime(result, 0.0);
                RubyStructOps.TmsSetChildUserTime(result, 0.0);
                RubyStructOps.TmsSetChildSystemTime(result, 0.0);
            }

            return(result);
        }
예제 #11
0
파일: StructOps.cs 프로젝트: TerabyteX/main
        public static object EachPair(BlockParam block, RubyStruct/*!*/ self)
        {
            if (block == null && self.ItemCount > 0) {
                throw RubyExceptions.NoBlockGiven();
            }

            var context = self.ImmediateClass.Context;
            foreach (KeyValuePair<string, object> entry in self.GetItems()) {
                object result;
                if (block.Yield(context.EncodeIdentifier(entry.Key), entry.Value, out result)) {
                    return result;
                }
            }

            return self;
        }
예제 #12
0
        public static object EachPair(BlockParam block, RubyStruct /*!*/ self)
        {
            if (block == null && self.ItemCount > 0)
            {
                throw RubyExceptions.NoBlockGiven();
            }

            foreach (KeyValuePair <string, object> entry in self.GetItems())
            {
                object result;
                if (block.Yield(SymbolTable.StringToId(entry.Key), entry.Value, out result))
                {
                    return(result);
                }
            }

            return(self);
        }
예제 #13
0
        public static object Each(BlockParam block, RubyStruct /*!*/ self)
        {
            if (block == null && self.ItemCount > 0)
            {
                throw RubyExceptions.NoBlockGiven();
            }

            foreach (var value in self.Values)
            {
                object result;
                if (block.Yield(value, out result))
                {
                    return(result);
                }
            }

            return(self);
        }
예제 #14
0
            private void WriteStruct(RubyStruct /*!*/ obj)
            {
                SubclassData instanceWriter = new SubclassData(this, obj, typeof(RubyStruct));

                _writer.Write((byte)'S');
                RubyClass theClass = _context.GetClassOf(obj);

                TestForAnonymous(theClass);
                WriteSymbol(theClass.Name);
                var names = obj.GetNames();

                WriteInt32(names.Count);
                foreach (string name in names)
                {
                    int index = obj.GetIndex(name);
                    WriteSymbol(name);
                    WriteAnObject(obj[index]);
                }
            }
예제 #15
0
            private void WriteStruct(RubyStruct /*!*/ obj)
            {
                WriteSubclassData(obj, typeof(RubyStruct));
                _writer.Write((byte)'S');
                RubyClass theClass = _context.GetClassOf(obj);

                TestForAnonymous(theClass);
                WriteModuleName(theClass);
                var names = obj.GetNames();

                WriteInt32(names.Count);
                foreach (string name in names)
                {
                    int index = obj.GetIndex(name);
                    // TODO (encoding):
                    WriteSymbol(name, _context.GetIdentifierEncoding());
                    WriteAnObject(obj[index]);
                }
            }
예제 #16
0
        public static RubyArray /*!*/ ValuesAt(RubyStruct /*!*/ self, [NotNull] params object[] values)
        {
            RubyArray result = new RubyArray();

            object[] data = self.Values;

            for (int i = 0; i < values.Length; ++i)
            {
                Range range = values[i] as Range;
                if (range != null)
                {
                    bool excludeEnd;
                    int  begin, end;
                    Protocols.ConvertToIntegerRange(self.Class.Context, range, out begin, out end, out excludeEnd);

                    if (excludeEnd)
                    {
                        end -= 1;
                    }

                    begin = NormalizeIndex(data.Length, begin);
                    end   = NormalizeIndex(data.Length, end);
                    Debug.Assert(end - begin <= data.Length); // because we normalized the indicies

                    if (end - begin > 0)
                    {
                        result.Capacity += (end - begin);
                        for (int j = begin; j <= end; j++)
                        {
                            result.Add(data[j]);
                        }
                    }
                }
                else
                {
                    int index = NormalizeIndex(data.Length, Protocols.CastToFixnum(self.Class.Context, values[i]));
                    result.Add(data[index]);
                }
            }

            return(result);
        }
예제 #17
0
        public static object EachPair(BlockParam block, RubyStruct /*!*/ self)
        {
            if (block == null && self.ItemCount > 0)
            {
                throw RubyExceptions.NoBlockGiven();
            }

            var context = self.ImmediateClass.Context;

            foreach (KeyValuePair <string, object> entry in self.GetItems())
            {
                object result;
                if (block.Yield(context.EncodeIdentifier(entry.Key), entry.Value, out result))
                {
                    return(result);
                }
            }

            return(self);
        }
예제 #18
0
        public static bool Equals(RubyStruct /*!*/ self, object obj)
        {
            var other = obj as RubyStruct;

            if (!self.StructReferenceEquals(other))
            {
                return(false);
            }

            Debug.Assert(self.ItemCount == other.ItemCount);
            for (int i = 0; i < self.Values.Length; i++)
            {
                if (!RubySites.Equal(self.Class.Context, self.Values[i], other.Values[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #19
0
        public static bool Equals(BinaryOpStorage /*!*/ equals, RubyStruct /*!*/ self, object obj)
        {
            var other = obj as RubyStruct;

            if (!self.StructReferenceEquals(other))
            {
                return(false);
            }
            Debug.Assert(self.ItemCount == other.ItemCount);

            if (self.Values.Length > 0)
            {
                var site = equals.GetCallSite("==");
                for (int i = 0; i < self.Values.Length; i++)
                {
                    if (RubyOps.IsFalse(site.Target(site, self.Values[i], other.Values[i])))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #20
0
 public static void TmsSetChildUserTime(RubyStruct /*!*/ tms, double value)
 {
     tms[2] = value;
 }
예제 #21
0
 public static object GetValue(RubyStruct /*!*/ self, int index)
 {
     return(self._data[index]);
 }
예제 #22
0
 private void WriteStruct(RubyStruct/*!*/ obj) {
     WriteSubclassData(obj, typeof(RubyStruct));
     _writer.Write((byte)'S');
     RubyClass theClass = _context.GetClassOf(obj);
     TestForAnonymous(theClass);
     WriteModuleName(theClass);
     var names = obj.GetNames();
     WriteInt32(names.Count);
     foreach (string name in names) {
         int index = obj.GetIndex(name);
         // TODO (encoding):
         WriteSymbol(name, _context.GetIdentifierEncoding());
         WriteAnObject(obj[index]);
     }
 }
예제 #23
0
 public static RubyArray /*!*/ Values(RubyStruct /*!*/ self)
 {
     return(new RubyArray(self.Values));
 }
예제 #24
0
 public static object Select(CallSiteStorage<EachSite>/*!*/ each, BlockParam predicate, RubyStruct/*!*/ self) {
     return Enumerable.Select(each, predicate, self);
 }
예제 #25
0
 public static void Reinitialize(RubyStruct/*!*/ self, params object[]/*!*/ items) {
     self.SetValues(items);
 }
예제 #26
0
 public static int Hash(UnaryOpStorage/*!*/ hashStorage, ConversionStorage<int>/*!*/ fixnumCast, RubyStruct/*!*/ self) {
     return self.GetHashCode(hashStorage, fixnumCast);
 }
예제 #27
0
        public static bool Equals(BinaryOpStorage/*!*/ equals, RubyStruct/*!*/ self, object obj) {
            var other = obj as RubyStruct;
            if (!self.StructReferenceEquals(other)) {
                return false;
            }
            Debug.Assert(self.ItemCount == other.ItemCount);

            return IListOps.Equals(equals, self.Values, other.Values);
        }
예제 #28
0
 public static bool Equal(RubyStruct /*!*/ self, object other)
 {
     return(self.Equals(other));
 }
예제 #29
0
 public bool StructReferenceEquals(RubyStruct other)
 {
     // TODO: compare non-singleton classes?
     return(ReferenceEquals(this, other) || (other != null && ImmediateClass.GetNonSingletonClass() == other.ImmediateClass.GetNonSingletonClass()));
 }
예제 #30
0
 public static RubyArray /*!*/ GetMembers(RubyStruct /*!*/ self)
 {
     Debug.Assert(self.StructInfo != null);
     return(self.StructInfo.GetMembers(self.ImmediateClass.Context));
 }
예제 #31
0
 public static object SetValue(RubyStruct /*!*/ self, object index, object value)
 {
     return(self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(self.Class.Context, index))] = value);
 }
예제 #32
0
 public static RubyArray /*!*/ Select(BlockParam predicate, RubyStruct /*!*/ self)
 {
     return(Enumerable.Select(self.Class.Context, predicate, self));
 }
예제 #33
0
 public static RubyArray/*!*/ Values(RubyStruct/*!*/ self) {
     return new RubyArray(self.Values);
 }
예제 #34
0
 public static object SetValue(RubyStruct /*!*/ self, int index, object value)
 {
     return(self._data[index] = value);
 }
예제 #35
0
 public static bool Equal(BinaryOpStorage/*!*/ eqlStorage, RubyStruct/*!*/ self, object other) {
     return self.Equals(eqlStorage, other);
 }
예제 #36
0
 public static Node ToYamlNode(RubyStruct/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep) {
     var fieldNames = self.GetNames();
     var map = new Dictionary<MutableString, object>(fieldNames.Count);
     for (int i = 0; i < fieldNames.Count; i++) {
         map[MutableString.Create(fieldNames[i])] = self.GetValue(i);
     }
     rep.AddYamlProperties(self, map);
     return rep.Map(self, map);
 }
예제 #37
0
        public static MutableString/*!*/ Inspect(RubyStruct/*!*/ self) {
            RubyContext context = self.ImmediateClass.Context;

            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                // #<struct Struct::Foo name=nil, val=nil>
                var result = MutableString.CreateMutable(RubyEncoding.Binary);
                result.Append("#<struct ");
                result.Append(context.Inspect(context.GetClassOf(self)));

                if (handle == null) {
                    return result.Append(":...>");
                }
                result.Append(' ');

                object[] data = self.Values;
                var members = self.GetNames();
                for (int i = 0; i < data.Length; i++) {
                    if (i != 0) {
                        result.Append(", ");
                    }
                    // TODO (encoding):
                    result.Append(members[i]);
                    result.Append('=');
                    result.Append(context.Inspect(data[i]));
                }
                result.Append('>');
                return result;
            }
        }
예제 #38
0
        public static Node ToYamlNode(RubyStruct/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep) {
            RubyContext context = self.Class.Context;
            RubyArray members = _Members.Target(_Members, context, self);
            RubyArray values = _Values.Target(_Values, context, self);

            if (members.Count != values.Count) {
                throw new ArgumentException("Struct values and members returned arrays of different lengths");
            }

            Hash map = new Hash(self.Class.Context);
            for (int i = 0; i < members.Count; i++) {
                IDictionaryOps.SetElement(context, map, members[i], values[i]);
            }
            RubyRepresenter.AddYamlProperties(context, self, map);
            return rep.Map(self, map);
        }
예제 #39
0
        public static RubyArray/*!*/ ValuesAt(ConversionStorage<int>/*!*/ fixnumCast, RubyStruct/*!*/ self, params object[]/*!*/ values) {
            RubyArray result = new RubyArray();
            object[] data = self.Values;

            for (int i = 0; i < values.Length; ++i) {
                Range range = values[i] as Range;
                if (range != null) {
                    int begin = Protocols.CastToFixnum(fixnumCast, range.Begin);
                    int end = Protocols.CastToFixnum(fixnumCast, range.End);

                    if (range.ExcludeEnd) {
                        end -= 1;
                    }

                    begin = NormalizeIndex(data.Length, begin);
                    end = NormalizeIndex(data.Length, end);
                    Debug.Assert(end - begin <= data.Length); // because we normalized the indicies

                    if (end - begin > 0) {
                        result.AddCapacity(end - begin);
                        for (int j = begin; j <= end; j++) {
                            result.Add(data[j]);
                        }
                    }
                } else {
                    int index = NormalizeIndex(data.Length, Protocols.CastToFixnum(fixnumCast, values[i]));
                    result.Add(data[index]);
                }
            }

            return result;
        }
예제 #40
0
파일: RubyClass.cs 프로젝트: kashano/main
        // friend: RubyContext
        // tracker: non-null => show members declared on the tracker
        internal RubyClass(RubyContext/*!*/ context, string name, Type type, object singletonClassOf,
            Action<RubyModule> methodsInitializer, Action<RubyModule> constantsInitializer, Delegate/*!*/[] factories, RubyClass superClass, 
            RubyModule/*!*/[] expandedMixins, TypeTracker tracker, RubyStruct.Info structInfo,
            bool isRubyClass, bool isSingletonClass, ModuleRestrictions restrictions)
            : base(context, name, methodsInitializer, constantsInitializer, expandedMixins,
                type != typeof(object) ? null : context.Namespaces, tracker, restrictions) {

            Debug.Assert(context.Namespaces != null, "Namespaces should be initialized");
            Debug.Assert(superClass != null || structInfo == null, "BasicObject is not a struct");
            Debug.Assert(!isRubyClass || tracker == null, "Ruby class cannot have a tracker");
            Debug.Assert(singletonClassOf != null || !isSingletonClass, "Singleton classes don't have a type");
            Debug.Assert(superClass != this);

            _underlyingSystemType = type;
            _superClass = superClass;
            _isSingletonClass = isSingletonClass;
            _isRubyClass = isRubyClass;
            _singletonClassOf = singletonClassOf;
            _factories = factories ?? Utils.EmptyDelegates;

            if (superClass != null) {
                _level = superClass.Level + 1;
                _structInfo = structInfo ?? superClass._structInfo;
            } else {
                _level = 0;
            }
        }
예제 #41
0
        public static RubyStruct/*!*/ InitializeCopy(RubyStruct/*!*/ self, [NotNull]RubyStruct/*!*/ source) {
            // TODO: compare non-singleton classes?
            if (self.ImmediateClass.GetNonSingletonClass() != source.ImmediateClass.GetNonSingletonClass()) {
                throw RubyExceptions.CreateTypeError("wrong argument class");
            }

            self.SetValues(source.Values);
            return self;
        }
예제 #42
0
 public static void TmsSetChildUserTime(RubyStruct/*!*/ tms, double value) {
     tms[2] = value;
 }
예제 #43
0
 public static RubyArray/*!*/ GetMembers(RubyStruct/*!*/ self) {
     Debug.Assert(self.Class.StructInfo != null);
     return self.Class.StructInfo.GetMembers();
 }
예제 #44
0
 public static object SetValue(RubyStruct /*!*/ self, MutableString /*!*/ name, object value)
 {
     return(self[name.ConvertToString()] = value);
 }
예제 #45
0
 internal static RubyClass /*!*/ CreateTmsClass(RubyModule /*!*/ module)
 {
     // class is available for the library even if the constant is removed => store it on the context:
     return((RubyClass)module.Context.GetOrCreateLibraryData(TmsStructClassKey, () => RubyStruct.DefineStruct(
                                                                 (RubyClass)module,
                                                                 "Tms",
                                                                 new[] { "utime", "stime", "cutime", "cstime" }
                                                                 )));
 }
예제 #46
0
 public static object SetValue(RubyStruct/*!*/ self, [NotNull]MutableString/*!*/ name, object value) {
     return self[name.ConvertToString()] = value;
 }
예제 #47
0
 public static void TmsSetChildSystemTime(RubyStruct /*!*/ tms, double value)
 {
     tms[3] = value;
 }
예제 #48
0
 public static object SetValue(ConversionStorage<int>/*!*/ conversionStorage, RubyStruct/*!*/ self, object index, object value) {
     return self[NormalizeIndex(self.ItemCount, Protocols.CastToFixnum(conversionStorage, index))] = value;
 }
예제 #49
0
        public static bool Equals(BinaryOpStorage/*!*/ equals, RubyStruct/*!*/ self, object obj) {
            var other = obj as RubyStruct;
            if (!self.StructReferenceEquals(other)) {
                return false;
            }
            Debug.Assert(self.ItemCount == other.ItemCount);

            if (self.Values.Length > 0) {
                var site = equals.GetCallSite("==");
                for (int i = 0; i < self.Values.Length; i++) {
                    if (RubyOps.IsFalse(site.Target(site, self.Values[i], other.Values[i]))) {
                        return false;
                    }
                }
            }

            return true;
        }
예제 #50
0
 public static int Hash(RubyStruct /*!*/ self)
 {
     return(self.GetHashCode());
 }
예제 #51
0
        // friend: RubyContext
        // tracker: non-null => show members declared on the tracker
        internal RubyClass(RubyContext/*!*/ context, string name, Type type, object singletonClassOf,
            Action<RubyModule> methodsInitializer, Action<RubyModule> constantsInitializer, Delegate/*!*/[] factories, RubyClass superClass, 
            RubyModule/*!*/[] expandedMixins, TypeTracker tracker, RubyStruct.Info structInfo,
            bool isRubyClass, bool isSingletonClass, ModuleRestrictions restrictions)
            : base(context, name, methodsInitializer, constantsInitializer, expandedMixins, null, tracker, restrictions) {

            Debug.Assert((superClass == null) == (type == typeof(object)), "All classes have a superclass, except for Object");
            Debug.Assert(superClass != null || structInfo == null, "Object is not a struct");
            Debug.Assert(!isRubyClass || tracker == null, "Ruby class cannot have a tracker");
            Debug.Assert(singletonClassOf != null || !isSingletonClass, "Singleton classes don't have a type");
            Debug.Assert(superClass != this);

            _underlyingSystemType = type;
            _superClass = superClass;
            _isSingletonClass = isSingletonClass;
            _isRubyClass = isRubyClass;
            _singletonClassOf = singletonClassOf;
            _factories = factories ?? Utils.EmptyDelegates;

            if (superClass != null) {
                _level = superClass.Level + 1;
                _structInfo = structInfo ?? superClass._structInfo;
            } else {
                _level = 0;
            }

            _weakSelf = new WeakReference(this);
            Version = new VersionHandle(Interlocked.Increment(ref _globalVersion));
            Version.SetName(name);
        }
예제 #52
0
 private void WriteStruct(RubyStruct/*!*/ obj) {
     SubclassData instanceWriter = new SubclassData(this, obj, typeof(RubyStruct));
     _writer.Write((byte)'S');
     RubyClass theClass = _context.GetClassOf(obj);
     TestForAnonymous(theClass);
     WriteSymbol(theClass.Name);
     var names = obj.GetNames();
     WriteInt32(names.Count);
     foreach (string name in names) {
         int index = obj.GetIndex(name);
         WriteSymbol(name);
         WriteAnObject(obj[index]);
     }
 }
예제 #53
0
 public static MutableString TagUri(RubyStruct/*!*/ self) {
     MutableString str = MutableString.Create("tag:ruby.yaml.org,2002:struct:");
     string name = self.Class.Name;
     string structPrefix = "Struct::";
     if (name.StartsWith(structPrefix)) {
         name = name.Substring(structPrefix.Length);
     }
     return str.Append(name);
 }
예제 #54
0
 public static RubyArray/*!*/ GetMembers(RubyStruct/*!*/ self) {
     return RubyStruct.GetMembers(self);
 }
예제 #55
0
 private static void FillTimes(RubyStruct/*!*/ result) {
     var process = Process.GetCurrentProcess();
     RubyStructOps.TmsSetUserTime(result, process.UserProcessorTime.TotalSeconds);
     RubyStructOps.TmsSetSystemTime(result, process.PrivilegedProcessorTime.TotalSeconds);
     RubyStructOps.TmsSetChildUserTime(result, 0.0);
     RubyStructOps.TmsSetChildSystemTime(result, 0.0);
 }
예제 #56
0
 public static int GetSize(RubyStruct/*!*/ self) {
     return self.ItemCount;
 }
예제 #57
0
 public static void TmsSetChildSystemTime(RubyStruct/*!*/ tms, double value) {
     tms[3] = value;
 }
예제 #58
0
 public static object SetValue(RubyStruct/*!*/ self, int index, object value) {
     return self[NormalizeIndex(self.ItemCount, index)] = value;
 }
예제 #59
0
 public bool StructReferenceEquals(RubyStruct other) {
     return ReferenceEquals(this, other) || (other != null && Class == other.Class);
 }
예제 #60
0
 public static object SetValue(RubyStruct/*!*/ self, [NotNull]RubySymbol/*!*/ name, object value) {
     return self[name.ToString()] = value;
 }