protected override void DoGetArrayBounds(TargetMemoryAccess target)
        {
            TargetBinaryReader reader = Location.ReadMemory(target, type.Size).GetReader();

            reader.Position = 3 * reader.TargetMemoryInfo.TargetAddressSize;
            int length = reader.ReadInt32();

            if (Rank == 1)
            {
                bounds = TargetArrayBounds.MakeSimpleArray(length);
                return;
            }

            reader.Position = 2 * reader.TargetMemoryInfo.TargetAddressSize;
            TargetAddress bounds_address = new TargetAddress(
                target.AddressDomain, reader.ReadAddress());
            TargetBinaryReader breader = target.ReadMemory(
                bounds_address, 8 * Rank).GetReader();

            int[] lower = new int [Rank];
            int[] upper = new int [Rank];

            for (int i = 0; i < Rank; i++)
            {
                int b_length = breader.ReadInt32();
                int b_lower  = breader.ReadInt32();

                lower [i] = b_lower;
                upper [i] = b_lower + b_length - 1;
            }

            bounds = TargetArrayBounds.MakeMultiArray(lower, upper);
        }
Example #2
0
        public NativeArrayType(Language language, string name, TargetType element_type,
					TargetArrayBounds bounds, int size)
            : base(element_type, bounds.Rank)
        {
            this.name = name;
            this.size = size;
            this.bounds = bounds;
        }
Example #3
0
 public NativeArrayType(Language language, string name, TargetType element_type,
                        TargetArrayBounds bounds, int size)
     : base(element_type, bounds.Rank)
 {
     this.name   = name;
     this.size   = size;
     this.bounds = bounds;
 }
Example #4
0
        protected void FormatArray(Thread target, TargetArrayObject aobj)
        {
            TargetArrayBounds bounds = aobj.GetArrayBounds(target);

            if (bounds.IsUnbound)
            {
                Append("[ ]");
            }
            else
            {
                FormatArray(target, aobj, bounds, 0, new int [0]);
            }
        }
Example #5
0
        protected void FormatArray(Thread target, TargetArrayObject aobj,
                                   TargetArrayBounds bounds, int dimension,
                                   int[] indices)
        {
            Append("[ ");
            indent_level += 3;

            bool first = true;

            int[] new_indices = new int [dimension + 1];
            indices.CopyTo(new_indices, 0);

            int lower, upper;

            if (!bounds.IsMultiDimensional)
            {
                lower = 0;
                upper = bounds.Length - 1;
            }
            else
            {
                lower = bounds.LowerBounds [dimension];
                upper = bounds.UpperBounds [dimension];
            }

            for (int i = lower; i <= upper; i++)
            {
                if (!first)
                {
                    Append(", ");
                    CheckLineWrap();
                }
                first = false;

                new_indices [dimension] = i;
                if (dimension + 1 < bounds.Rank)
                {
                    FormatArray(target, aobj, bounds, dimension + 1, new_indices);
                }
                else
                {
                    TargetObject eobj = aobj.GetElement(target, new_indices);
                    FormatObjectRecursed(target, eobj, false);
                }
            }

            Append(first ? "]" : " ]");
            indent_level -= 3;
        }
Example #6
0
        public int[] GetDimensions()
        {
            TargetArrayBounds bounds = array.GetArrayBounds(ctx.Thread);

            if (bounds.IsMultiDimensional)
            {
                int[] dims = new int [bounds.LowerBounds.Length];
                for (int n = 0; n < bounds.Rank; n++)
                {
                    dims [n] = bounds.UpperBounds [n] - bounds.LowerBounds [n] + 1;
                }
                return(dims);
            }
            else if (!bounds.IsUnbound)
            {
                return new int[] { bounds.Length }
            }
            ;
            else
            {
                return(new int [0]);
            }
        }
Example #7
0
        public NativeArrayObject(NativeArrayType type, TargetLocation location,
					  TargetArrayBounds bounds)
            : base(type, location)
        {
            this.bounds = bounds;
        }
 public NativeArrayObject(NativeArrayType type, TargetLocation location,
                          TargetArrayBounds bounds)
     : base(type, location)
 {
     this.bounds = bounds;
 }