コード例 #1
0
            private void CreateSwappedType(CodeContext /*!*/ context, string name, PythonTuple bases, PythonDictionary dict)
            {
                SimpleType swapped = new SimpleType(context, name + (BitConverter.IsLittleEndian ? "_be" : "_le"), bases, dict, !BitConverter.IsLittleEndian);

                if (BitConverter.IsLittleEndian)
                {
                    AddSlot("__ctype_be__", new PythonTypeUserDescriptorSlot(swapped));
                    AddSlot("__ctype_le__", new PythonTypeUserDescriptorSlot(this));
                    swapped.AddSlot("__ctype_le__", new PythonTypeUserDescriptorSlot(this));
                    swapped.AddSlot("__ctype_be__", new PythonTypeUserDescriptorSlot(swapped));
                }
                else
                {
                    AddSlot("__ctype_le__", new PythonTypeUserDescriptorSlot(swapped));
                    AddSlot("__ctype_be__", new PythonTypeUserDescriptorSlot(this));
                    swapped.AddSlot("__ctype_le__", new PythonTypeUserDescriptorSlot(swapped));
                    swapped.AddSlot("__ctype_be__", new PythonTypeUserDescriptorSlot(this));
                }
            }