Skip to content

Commit

Permalink
style(integer_vector_ptr, string_ptr): rename parameter 'length' to '…
Browse files Browse the repository at this point in the history
…len', to avoid hiding the function
  • Loading branch information
umarcor committed Apr 25, 2019
1 parent 2a822e7 commit 2a50af8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 62 deletions.
74 changes: 37 additions & 37 deletions vunit/vhdl/data_types/src/integer_vector_ptr_pkg-body-200x.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package body integer_vector_ptr_pkg is
type integer_vector_ptr_storage_t is protected
impure function
new_integer_vector_ptr(
length : natural := 0;
value : val_t := 0
len : natural := 0;
value : val_t := 0
) return natural;

procedure
Expand Down Expand Up @@ -37,17 +37,17 @@ package body integer_vector_ptr_pkg is

procedure
reallocate(
ref : natural;
length : natural;
value : val_t := 0
ref : natural;
len : natural;
value : val_t := 0
);

procedure
resize(
ref : natural;
length : natural;
drop : natural := 0;
value : val_t := 0
ref : natural;
len : natural;
drop : natural := 0;
value : val_t := 0
);
end protected;

Expand All @@ -57,8 +57,8 @@ package body integer_vector_ptr_pkg is

impure function
new_integer_vector_ptr(
length : natural := 0;
value : val_t := 0
len : natural := 0;
value : val_t := 0
) return natural is
variable old_ptrs : vava_t;
variable retval : ptr_t := (ref => current_index);
Expand All @@ -77,7 +77,7 @@ package body integer_vector_ptr_pkg is
deallocate(old_ptrs);
end if;

ptrs(current_index) := new integer_vector_t'(0 to length-1 => value);
ptrs(current_index) := new integer_vector_t'(0 to len-1 => value);
current_index := current_index + 1;
return retval.ref;
end;
Expand Down Expand Up @@ -116,30 +116,30 @@ package body integer_vector_ptr_pkg is

procedure
reallocate(
ref : natural;
length : natural;
value : val_t := 0
ref : natural;
len : natural;
value : val_t := 0
) is begin
deallocate(ptrs(ref));
ptrs(ref) := new integer_vector_t'(0 to length - 1 => value);
ptrs(ref) := new integer_vector_t'(0 to len - 1 => value);
end;

procedure
resize(
ref : natural;
length : natural;
drop : natural := 0;
value : val_t := 0
ref : natural;
len : natural;
drop : natural := 0;
value : val_t := 0
) is
variable old_ptr, new_ptr : integer_vector_access_t;
variable min_length : natural := length;
variable min_len : natural := len;
begin
new_ptr := new integer_vector_t'(0 to length - 1 => value);
new_ptr := new integer_vector_t'(0 to len - 1 => value);
old_ptr := ptrs(ref);
if min_length > old_ptr'length - drop then
min_length := old_ptr'length - drop;
if min_len > old_ptr'length - drop then
min_len := old_ptr'length - drop;
end if;
for i in 0 to min_length-1 loop
for i in 0 to min_len-1 loop
new_ptr(i) := old_ptr(drop + i);
end loop;
ptrs(ref) := new_ptr;
Expand Down Expand Up @@ -167,10 +167,10 @@ package body integer_vector_ptr_pkg is

impure function
new_integer_vector_ptr(
length : natural := 0;
value : val_t := 0
len : natural := 0;
value : val_t := 0
) return ptr_t is begin
return (ref => integer_vector_ptr_storage.new_integer_vector_ptr(length, value));
return (ref => integer_vector_ptr_storage.new_integer_vector_ptr(len, value));
end;

procedure
Expand Down Expand Up @@ -206,21 +206,21 @@ package body integer_vector_ptr_pkg is

procedure
reallocate(
ptr : ptr_t;
length : natural;
value : val_t := 0
ptr : ptr_t;
len : natural;
value : val_t := 0
) is begin
integer_vector_ptr_storage.reallocate(ptr.ref, length, value);
integer_vector_ptr_storage.reallocate(ptr.ref, len, value);
end;

procedure
resize(
ptr : ptr_t;
length : natural;
drop : natural := 0;
value : val_t := 0
ptr : ptr_t;
len : natural;
drop : natural := 0;
value : val_t := 0
) is begin
integer_vector_ptr_storage.resize(ptr.ref, length, drop, value);
integer_vector_ptr_storage.resize(ptr.ref, len, drop, value);
end;

function
Expand Down
32 changes: 16 additions & 16 deletions vunit/vhdl/data_types/src/integer_vector_ptr_pkg-body-93.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package body integer_vector_ptr_pkg is

impure function
new_integer_vector_ptr(
length : natural := 0;
value : val_t := 0
len : natural := 0;
value : val_t := 0
) return ptr_t is
variable old_ptrs : vava_t;
begin
Expand All @@ -29,7 +29,7 @@ package body integer_vector_ptr_pkg is
deallocate(old_ptrs);
end if;

ptrs(current_index) := new integer_vector_t'(0 to length-1 => value);
ptrs(current_index) := new integer_vector_t'(0 to len-1 => value);
current_index := current_index + 1;
return (ref => current_index-1);
end;
Expand Down Expand Up @@ -68,30 +68,30 @@ package body integer_vector_ptr_pkg is

procedure
reallocate(
ptr : ptr_t;
length : natural;
value : val_t := 0
ptr : ptr_t;
len : natural;
value : val_t := 0
) is begin
deallocate(ptrs(ptr.ref));
ptrs(ptr.ref) := new integer_vector_t'(0 to length - 1 => value);
ptrs(ptr.ref) := new integer_vector_t'(0 to len - 1 => value);
end;

procedure
resize(
ptr : ptr_t;
length : natural;
drop : natural := 0;
value : val_t := 0
ptr : ptr_t;
len : natural;
drop : natural := 0;
value : val_t := 0
) is
variable old_ptr, new_ptr : integer_vector_access_t;
variable min_length : natural := length;
variable min_len : natural := len;
begin
new_ptr := new integer_vector_t'(0 to length - 1 => value);
new_ptr := new integer_vector_t'(0 to len - 1 => value);
old_ptr := ptrs(ptr.ref);
if min_length > old_ptr'length - drop then
min_length := old_ptr'length - drop;
if min_len > old_ptr'length - drop then
min_len := old_ptr'length - drop;
end if;
for i in 0 to min_length-1 loop
for i in 0 to min_len-1 loop
new_ptr(i) := old_ptr(drop + i);
end loop;
ptrs(ptr.ref) := new_ptr;
Expand Down
18 changes: 9 additions & 9 deletions vunit/vhdl/data_types/src/integer_vector_ptr_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ package integer_vector_ptr_pkg is

impure function
new_integer_vector_ptr(
length : natural := 0;
value : val_t := 0
len : natural := 0;
value : val_t := 0
) return ptr_t;

procedure
Expand Down Expand Up @@ -70,17 +70,17 @@ package integer_vector_ptr_pkg is

procedure
reallocate(
ptr : ptr_t;
length : natural;
value : val_t := 0
ptr : ptr_t;
len : natural;
value : val_t := 0
);

procedure
resize(
ptr : ptr_t;
length : natural;
drop : natural := 0;
value : val_t := 0
ptr : ptr_t;
len : natural;
drop : natural := 0;
value : val_t := 0
);

function
Expand Down

0 comments on commit 2a50af8

Please sign in to comment.