Skip to content

Commit

Permalink
Added and fixed C colour support!
Browse files Browse the repository at this point in the history
  • Loading branch information
joseaverde committed Feb 5, 2021
1 parent 7709638 commit cb13823
Show file tree
Hide file tree
Showing 21 changed files with 961 additions and 315 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ gmem.out
build
__pycache__
logs
danger_zone
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.2.3] - 2021-02-05
### Added
- Added complete colour/palette support for C.
### Fixed
- Fixed Malef.h formatting.
- Fixed functions return value.

## [0.2.2] - 2021-01-30
### Added
- Added Surface type for Python3.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
0.2.3
99 changes: 99 additions & 0 deletions ada-malef/src-base/malef-surfaces.adb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with Malef.Systems;

pragma Warnings (Off);
with System;
with System.Address_Image;
with System.Atomic_Counters;
pragma Warnings (On);


package body Malef.Surfaces is
Expand Down Expand Up @@ -212,6 +217,100 @@ package body Malef.Surfaces is

end Unreference;


-- ------- DEBUG -------


-- procedure Put (Operation : String;
-- Reference : not null Shared_Surface_Access) is
-- use type Ada.Text_IO.Count;
-- Is_Null : constant Boolean := Reference = Shared_Null_Surface'Access;
-- Address : constant System.Address := Reference.all'Address;
-- Length : constant := 15;
-- begin

-- Ada.Text_IO.Set_Col (File => Ada.Text_IO.Standard_Error,
-- To => Length - Operation'Length);
-- Ada.Text_IO.Put_Line(File => Ada.Text_IO.Standard_Error,
-- Item =>
-- Operation & ": " &
-- (if Is_Null then
-- ASCII.ESC & "[31m NULL " & ASCII.ESC & "[0m "
-- else
-- ASCII.ESC & "[32mNOT NULL" & ASCII.ESC & "[0m ") &
-- System.Address_Image (Address));

-- end Put;


-- overriding
-- procedure Initialize (Object : in out Surface_Type) is
-- begin

-- Reference (Object.Reference);
-- Put ("Initialize", Object.Reference);

-- end Initialize;


-- overriding
-- procedure Adjust (Object : in out Surface_Type) is
-- begin

-- Reference (Object.Reference);
-- Put ("Adjust", Object.Reference);

-- end Adjust;

--
-- overriding
-- procedure Finalize (Object : in out Surface_Type) is
-- Old_Reference : constant not null Shared_Surface_Access
-- := Object.Reference;
-- begin

-- Put ("Finalize", Object.Reference);
-- if Old_Reference /= Shared_Null_Surface'Access then
-- -- This is used to avoid finalizing the same object twice.
-- Object.Reference := Shared_Null_Surface'Access;
-- Unreference(Old_Reference);
-- end if;

-- end Finalize;



-- procedure Reference (Item : not null Shared_Surface_Access) is
-- begin

-- if Item = Shared_Null_Surface'Access then
-- return;
-- end if;

-- System.Atomic_Counters.Increment (Item.Counter);

-- end Reference;


-- procedure Unreference (Item : not null Shared_Surface_Access) is
-- procedure Free is new Ada.Unchecked_Deallocation (Shared_Surface_Type,
-- Shared_Surface_Access);
-- Old : Shared_Surface_Access := Item;
-- begin

-- if Old = Shared_Null_Surface'Access then
-- return;
-- end if;

-- if System.Atomic_Counters.Decrement (Old.Counter) then
-- Put ("Free", Item);
-- Free(Old);
-- end if;

-- end Unreference;



end Malef.Surfaces;

---=======================-------------------------=========================---
Expand Down
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "Malef is a terminal handling library."
long-description = "Malef is a terminal handling library written in Ada with bindings to other programming languages like C and Python3. It replaces the NCurses library with a more Adaish interface. It uses ANSI Escape Sequences as much as possible, but it can also handle other kinds of terminals/consoles."

# The version of the package.
version = "0.2.2"
version = "0.2.3"

# The authors, maintainer and maintainers' logins.
authors = ["José Antonio Verde Jiménez"]
Expand Down
Loading

0 comments on commit cb13823

Please sign in to comment.