Here you can find the release notes for each version of Sista since v0.1.0, with changelog since v0.7.0; these are listed in a bottom-up order.
Major release.
-
Changed
sista::Fieldto usestd::shared_ptr<sista::Pawn>instead of raw pointers for memory safety and easier memory management- Removed
Field::resetmethod as it is redundant withField::clearin this context
- Removed
-
Updated demos to use
std::shared_ptr<sista::Pawn>andstd::make_shared<sista::Pawn>for creating and managing pawns -
Updated documentation to reflect changes in
sista::Fieldandsista::Pawnusage -
Removed
ANSInamespace and moved all ANSI-related functionality tosista::, among whichANSI::Settings->sista::ANSISettings -
Wrapped former
_EFFECTconstants into a scopedenum class Effectinside thesistanamespace -
Changed
enumtypes toenum classfor better type safety and to avoid name clashes- Fixed
Cursor::moveoverload usingMoveCursorSCO, which was incorrectly usingintinstead ofchar
- Fixed
-
Renamed
ANSI-Settings.hppandANSI-Settings.cpptoansi.hppandansi.cpprespectively for consistency with other filenames -
Removed overloads with non-const reference parameters and replaced them with overloads taking parameters by value or const reference
-
Improved internal implementation of
sista::ANSISettings::apply()for better readability and semantics withstd::variant::holds_alternative -
Removed
sista::Coordtype alias ofstd::pair<unsigned short, unsigned short>to minimize the public surface area of the library- Removed all functions taking
sista::Coordas parameter - Created static methods in
sista::Coordinatesto convert from and tostd::pair<unsigned short, unsigned short>
- Removed all functions taking
-
Removed
yandxattributes fromsista::Cursor, as they were not used outside the struct nor necessary for its functionality -
Renamed
sista::Coordinates::settogoTofor better clarity (it moves the cursor to the coordinates) -
Using
constqualifier for references where appropriate for better performance and semantics -
Added
constqualifier to methods that do not modify the state of the object for better semantics and to allow calling them onconstinstances -
Moving
sista::SwappableField::movingByCoordinatestosista::Fieldas it does not depend onSwappableFieldfunctionality -
Minimized includes in header files to reduce compilation dependencies and improve build times
-
Added
std::hashspecialization forsista::Coordinatesto allow its use in hash-based containers likestd::unordered_mapandstd::unordered_set -
Optimized
sista::SwappableFieldinternal logic for better performance -
Improved encapsulation of
sista::SwappableFieldby making internal methods private and exposing only necessary public methods -
Exposed C API for stable ABI that allows FFI bindings and easier integration with other programming languages
- Added
api.hheader file with C API declarations - Added
api.cppimplementation file with C API definitions - Updated
Makefileto build the C API and link it with the C++ library
- Added
-
Updated CI workflows to build and test the C API
-
Added Python C extension module
sista._sistaloaded in thesistaPython module- Added
python/directory with the C extension source code andsetup.pyfor building and installing the Python module - Updated CI workflows to build and test the Python module
- Added
-
Updated
Makefilefor hardcoding the rpath of the MacOS shared library to avoid issues withDYLD_LIBRARY_PATH -
Updated
Makefileto reflect the new filenames and ensure correct compilation and linking -
Added files for
.debpackaging underpackageroot -
Testing on memory safety with
valgrind, detected no memory leaks or invalid accesses -
Constructor and destructor of
sista::Cursoronly hide/show the cursor, but do not alter the ANSI settings nor clear the screen anymore
- Improved Python exception behavior in the C extension:
- API failures now raise clearer Python exceptions with better diagnostic messages.
- Stub/type hint synchronization:
__init__.pyinow matches the effective runtime API and class methods.
- Documentation consistency:
- extension docstrings and public type hints now reflect the class-oriented API.
- Swapped
(x, y)pairs fixed - Some bounds checks added to
Field'sPawngetters
Patch release.
- Adapted
Makefilefor MacOS install
Minor release.
Sistanow available as a shared library on Windows viaMinGW,MSYS2or alternative toolchains
The previous state was that Sista was only available in source format on Windows, but now it can be installed on the system as a shared library.
MSVC support is not available, and it won't for the foreseeable future unless there is a demand for it and a volunteer to test it.
- Added new demo
shared-test-staticto test static linking against theSistalibrary - Updated
demo/Makefileto include the new demo and to build it correctly - Updated Makefile CI workflow to build all demos, including the new
shared-test-staticdemo
- Fixed the
Makefileto correctly build the demos without the need forSistato be installed - Added documentation in the
demo/README.mdfile - Updated and refreshed the documentation on ReadTheDocs, under
docs/
Minor release.
- Changed path of the
libSista.soshared library from{PREFIX}/lib64/libSista.soto{PREFIX}/lib/libSista.soforldto find it correctly on most systems - Added
uninstalltarget to theMakefileto remove the installed files - Added
demo/shared-test.cppand relatedMakefiletarget to test the shared library installation
Major release.
- Sista now available as a shared library,
libSista.so, which can be installed in the system library path
Bug fix release.
- Fixed
sista::Coordinatesoperator overload<to be a strict weak ordering relation
bool Coordinates::operator<(const Coordinates& other) const {
- return (y + x) < (other.y + other.x);
+ if (y != other.y)
+ return y < other.y;
+ return x < other.x;
}This change is necessary to ensure that constructs such as std::set<sista::Coordinates> work correctly, as it requires a strict weak ordering relation.
We don't plan to implement an hash function for sista::Coordinates at the moment as the direct comparison is more efficient and straightforward for the intended use cases.
- Allow
ANSI::Settingsto be initialized with mixedForegroundColorandRGBColororRGBColorandBackgroundColor
This change has the purpose to allow more flexibility, especially when using a custom foreground color with a coded background color.
ANSI::Settings settings = {
ANSI::RGBColor(42, 42, 42),
ANSI::BackgroundColor::B_BLACK,
ANSI::Attribute::BRIGHT
};- Added
<comparison operator tosista::Coordinates
The purpose is to allow std::set<sista::Coordinates>. It is based solely on the distance from the origin.
bool Coordinates::operator<(const Coordinates& other) const {
return (y + x) < (other.y + other.x);
}- Added
RGBColorand support for it in theANSI::Settingsstruct
It is now possible to initialize ANSI::Settings instances as follows. Even if in general using the constructor could be a bless for backwards compatibility of your code.
ANSI::Settings settings = {
ANSI::RGBColor(42, 42, 42),
ANSI::RGBColor(69, 69, 69),
ANSI::Attribute::BRIGHT
};The library does not enforce consistency across foreground and background indications, as in one of the two can be an RGBColor and the other one a ForegroundColor, for instance.
This change is backwards compatible, so the ForegroundColor/BackgroundColor based initialization is still functional and will always be supported.
- Added
sista::Field::removePawn(sista::Coordinates&)to remove a pawn from the field by coordinates without the need of a pointer to the pawn
void Field::removePawn(Coordinates& coordinates) { // Remove a pawn from the matrix
pawns[coordinates.y][coordinates.x] = nullptr; // Set the pawn to nullptr
}- Added
sista::Field::erasePawn(sista::Coordinates&)to erase a pawn from the field by coordinates without the need of a pointer to the pawn
void Field::erasePawn(Coordinates& coordinates) { // Erase a pawn from the matrix
removePawn(coordinates); // Remove the pawn from the matrix
cursor.set(coordinates); // Set the cursor to the pawn's coordinates
ANSI::reset(); // Reset the settings for that cell
std::cout << ' '; // Print a space to clear the cell
}- Added
sista::Field::rePrintPawn() - Added operator for scalar multiplication for
sista::Coordinatesstruct
void Field::rePrintPawn(Pawn* pawn) { // Print a pawn
cursor.set(pawn->getCoordinates()); // Set the cursor to the pawn's coordinates
pawn->print(); // Print the pawn
}Coordinates operator*(const unsigned short int) const;- Added more operators for
sista::Coordinatesstruct
Coordinates operator-(const Coordinates&) const;
Coordinates operator+=(const Coordinates&);
Coordinates operator-=(const Coordinates&);- Added
sista::Field::erasePawn()to remove and erase Pawn from the screen
void Field::erasePawn(Pawn* pawn) { // Erase a pawn from the matrix
removePawn(pawn); // Remove the pawn from the matrix
cursor.set(pawn->getCoordinates()); // Set the cursor to the pawn's coordinates
ANSI::reset(); // Reset the settings for that cell
std::cout << ' '; // Print a space to clear the cell
}- Divided Sista in
.hppheaders and.cppsources
This should make it possible to use Sista in projects with multiple source files.
- Added
sista::Field::addPrintPawn()to add and print Pawn without reprint
void addPrintPawn(Pawn* pawn) { // Add a pawn to the matrix and print it
addPawn(pawn); // Add the pawn to the matrix
this->cursor.set(pawn->getCoordinates()); // Set the cursor to the pawn's coordinates
pawn->print(); // Print the pawn
}- Fixed
sista::Field::reset()which was resizing the field to 0x0
void reset() {
for (auto& row: pawns) { // For each row
for (auto& pawn: row) {
if (pawn != nullptr) // If the pawn is not nullptr
delete pawn; // Delete the pawn
pawn = nullptr; // Set the pawn to nullptr
}
}
}- Added ScreenMode management
enum ScreenMode {
MONOCROME_TEXT_40_25 = 0,
COLOR_TEXT_40_25 = 1,
MONOCROME_TEXT_80_25 = 2,
COLOR_TEXT_80_25 = 3,
FOUR_COLORS_GRAPHICS_320_200 = 4,
MONOCROME_GRAPHICS_320_200 = 5,
MONOCROME_GRAPHICS_640_200 = 6,
LINE_WRAPPING = 7,
COLOR_GRAPHICS_320_200 = 13,
COLOR_16_COLORS_GRAPHICS_640_200 = 14,
MONOCROME_2_COLORS_GRAPHICS_640_350 = 15,
COLOR_16_COLORS_GRAPHICS_640_350 = 16,
MONOCROME_2_COLORS_GRAPHICS_640_480 = 17,
COLOR_16_COLORS_GRAPHICS_640_480 = 18,
COLOR_256_COLORS_GRAPHICS_320_200 = 19
};
void setScreenMode(ScreenMode mode) {
std::cout << CSI << '=' << mode << 'h';
}
void unsetScreenMode(ScreenMode mode) {
std::cout << CSI << '=' << mode << 'l';
}- Added resetter for
sista::Fieldinstances, to empty the field from thesista::Pawns
void reset() {
for (auto& row: pawns) // For each row
for (auto& pawn: row) // For each pawn
if (pawn != nullptr) // If the pawn is not nullptr
delete pawn; // Delete the pawn
pawns.clear(); // Clear the pawns
}- Added 256 color support
void setForegroundColor(unsigned short int color) {
std::cout << CSI << "38;5;" << color << "m";
}
void setBackgroundColor(unsigned short int color) {
std::cout << CSI << "48;5;" << color << "m";
}- Added 24-biit RGB color support
void setForegroundColor(unsigned short int red, unsigned short int green, unsigned short int blue) {
std::cout << CSI << "38;2;" << red << ";" << green << ";" << blue << "m";
}
void setBackgroundColor(unsigned short int red, unsigned short int green, unsigned short int blue) {
std::cout << CSI << "48;2;" << red << ";" << green << ";" << blue << "m";
}enum EraseScreen {
FROM_CURSOR_TO_END = 0,
FROM_CURSOR_TO_BEGINNING = 1,
ENTIRE_SCREEN = 2,
ERASE_SAVED_LINES = 3,
};
enum EraseLine {
LINE_FROM_CURSOR_TO_END = 0,
LINE_FROM_CURSOR_TO_BEGINNING = 1,
ENTIRE_LINE = 2,
};
enum MoveCursor {
UP = (int)'A',
DOWN = (int)'B',
RIGHT = (int)'C',
LEFT = (int)'D',
BEGINNING_OF_NEXT_LINE = (int)'E',
BEGINNING_OF_PREVIOUS_LINE = (int)'F',
HORIZONTAL_ABSOLUTE = (int)'G'
};
enum MoveCursorDEC {
SAVE_CURSOR_POSITION = 7,
RESTORE_CURSOR_POSITION = 8
};
enum MoveCursorSCO {
SCO_SAVE_CURSOR_POSITION = (int)'s',
SCO_RESTORE_CURSOR_POSITION = (int)'u'
};
// In Cursor struct
void eraseScreen(EraseScreen eraseScreen_) {
std::cout << CSI << eraseScreen_ << "J";
}
void eraseLine(EraseLine eraseLine_, bool moveCursor=true) {
std::cout << CSI << eraseLine_ << "K";
if (moveCursor) {
this->set(this->y, 0);
std::cout << '\r';
}
}
void move(MoveCursor moveCursor_, unsigned short int n=1) {
std::cout << CSI << n << (char)moveCursor_;
}
void move(MoveCursorDEC moveCursorDEC_) {
std::cout << ESC << ' ' << moveCursorDEC_;
}
void move(MoveCursorSCO moveCursorSCO_) {
std::cout << ESC << ' ' << moveCursorSCO_;
}- Added
ESCconstant toANSI-Settings.hpp
- Added condition over the attribute reset function
void resetAttribute(Attribute attribute) {
if (attribute == Attribute::BRIGHT) {
std::cout << CSI << attribute + 21 << "m";
return;
}
std::cout << CSI << attribute + 20 << "m";
}I added the if statement to check if the attribute is BRIGHT or not, because the BRIGHT reset code is +21 (from set code) and the rest are +20.
This is the first version of Sista and it is still in development.