Opened 2 years ago

Closed 2 years ago

#494 closed defect (fixed)

construction of array with array_buffer storage

Reported by: vadim.godunko Owned by: Maxim Reznik
Priority: major Milestone:
Component: Matreshka - a2js Version:
Keywords: Cc:

Description

with Interfaces;

package Test4 is

   type Real is new Interfaces.IEEE_Float_64;

   type Matrix_4x4 is
     array (Positive range 1 .. 4, Positive range 1 .. 4) of Real;

   type GLfloat is new Interfaces.IEEE_Float_32;

   type GLfloat_Matrix_4x4 is
     array (Positive range 1 .. 4, Positive range 1 .. 4) of GLfloat
       with Convention => Fortran;
   pragma JavaScript_Array_Buffer (GLfloat_Matrix_4x4);

   function Convert (Item : Matrix_4x4) return GLfloat_Matrix_4x4;

   procedure Test;

end Test4;
package body Test4 is

   function Convert (Item : Matrix_4x4) return GLfloat_Matrix_4x4 is
   begin
      return
       (1 =>
          (1 => GLfloat (Item (1, 1)),
           2 => GLfloat (Item (1, 2)),
           3 => GLfloat (Item (1, 3)),
           4 => GLfloat (Item (1, 4))),
        2 =>
          (1 => GLfloat (Item (2, 1)),
           2 => GLfloat (Item (2, 2)),
           3 => GLfloat (Item (2, 3)),
           4 => GLfloat (Item (2, 4))),
        3 =>
          (1 => GLfloat (Item (3, 1)),
           2 => GLfloat (Item (3, 2)),
           3 => GLfloat (Item (3, 3)),
           4 => GLfloat (Item (3, 4))),
        4 =>
          (1 => GLfloat (Item (4, 1)),
           2 => GLfloat (Item (4, 2)),
           3 => GLfloat (Item (4, 3)),
           4 => GLfloat (Item (4, 4))));
   end Convert;

   procedure Test is
      S : constant Matrix_4x4
        := (1 => (0.1, 0.2, 0.3, 0.4),
            2 => (0.5, 0.6, 0.7, 0.8),
            3 => (0.9, 1.0, 1.1, 1.2),
            4 => (1.3, 1.4, 1.5, 1.6));
      E : constant GLfloat_Matrix_4x4
        := (1 => (0.1, 0.2, 0.3, 0.4),
            2 => (0.5, 0.6, 0.7, 0.8),
            3 => (0.9, 1.0, 1.1, 1.2),
            4 => (1.3, 1.4, 1.5, 1.6));
      R : constant GLfloat_Matrix_4x4 := Convert (S);

   begin
      if E /= R then
         raise Program_Error;
      end if;
   end Test;

end Test4;

Change History (1)

comment:1 by Maxim Reznik, 2 years ago

Owner: set to Maxim Reznik
Resolution: fixed
Status: newclosed

In 5841:

a2js. Unroll multidimentional array aggregate

Fix #494

Note: See TracTickets for help on using tickets.