-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
446 changed files
with
9,242 additions
and
30,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gprbuild -p -P gid -XBuild_Mode=Debug to_bmp | ||
copy test\to_bmp.exe test\tb.exe | ||
gprbuild -p -P gid -XBuild_Mode=Fast | ||
gprbuild -p -P gid -XBuild_Mode=Smallest mini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pragma Initialize_Scalars; | ||
-- pragma Normalize_Scalars; -- For all units! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
with Ada.IO_Exceptions; | ||
|
||
package body GID.Buffering is | ||
|
||
procedure Fill_Buffer(b: in out Input_buffer); | ||
-- ^ Spec here to avoid warning by 'Get_Byte' below (GNAT 2009): | ||
-- warning: call to subprogram with no separate spec prevents inlining | ||
|
||
procedure Fill_Buffer(b: in out Input_buffer) | ||
is | ||
-- | ||
procedure BlockRead( | ||
buffer : out Byte_array; | ||
actually_read: out Natural | ||
) | ||
is | ||
use Ada.Streams; | ||
Last_Read: Stream_Element_Offset; | ||
begin | ||
if is_mapping_possible then | ||
declare | ||
SE_Buffer_mapped: Stream_Element_Array (1 .. buffer'Length); | ||
-- direct mapping: buffer = SE_Buffer_mapped | ||
for SE_Buffer_mapped'Address use buffer'Address; | ||
pragma Import (Ada, SE_Buffer_mapped); | ||
begin | ||
Read(b.stream.all, SE_Buffer_mapped, Last_Read); | ||
end; | ||
else | ||
declare | ||
SE_Buffer: Stream_Element_Array (1 .. buffer'Length); | ||
-- need to copy array (slightly slower) | ||
begin | ||
Read(b.stream.all, SE_Buffer, Last_Read); | ||
for i in buffer'Range loop | ||
buffer(i):= U8(SE_Buffer(Stream_Element_Offset(i-buffer'First)+SE_Buffer'First)); | ||
end loop; | ||
end; | ||
end if; | ||
actually_read:= Natural(Last_Read); | ||
end BlockRead; | ||
-- | ||
begin | ||
BlockRead( | ||
buffer => b.data, | ||
actually_read => b.MaxInBufIdx | ||
); | ||
b.InputEoF:= b.MaxInBufIdx = 0; | ||
b.InBufIdx := 1; | ||
end Fill_Buffer; | ||
|
||
procedure Attach_Stream( | ||
b : out Input_buffer; | ||
stm : in Stream_Access | ||
) | ||
is | ||
begin | ||
b.stream:= stm; | ||
-- Fill_Buffer(b) will be performed on first call of Get_Byte | ||
end Attach_Stream; | ||
|
||
function Is_stream_attached(b: Input_buffer) return Boolean is | ||
begin | ||
return b.stream /= null; | ||
end Is_stream_attached; | ||
|
||
procedure Get_Byte(b: in out Input_buffer; byte: out U8) is | ||
begin | ||
if b.InBufIdx > b.MaxInBufIdx then | ||
Fill_Buffer(b); | ||
if b.InputEoF then | ||
raise Ada.IO_Exceptions.End_Error; | ||
end if; | ||
end if; | ||
byte:= b.data(b.InBufIdx); | ||
b.InBufIdx:= b.InBufIdx + 1; | ||
end Get_Byte; | ||
|
||
end GID.Buffering; |
Oops, something went wrong.