|
| static int | py_sista_raise_from_status (int status_code, const char *fallback_message) |
| |
| static int | py_sista_raise_from_last_error (const char *fallback_message) |
| |
| | PyDoc_STRVAR (py_sista_set_foreground_color_doc, "Set the terminal foreground color using one of the `F_*` constants.\n\n" "### Parameters\n\n" "- `color` (int): One of the `F_*` constants (e.g. `F_RED`).\n") |
| |
| | PyDoc_STRVAR (py_sista_set_background_color_doc, "Set the terminal background color using one of the `B_*` constants.\n\n" "### Parameters\n\n" "- `color` (int): One of the `B_*` constants (e.g. `B_BLUE`).\n") |
| |
| | PyDoc_STRVAR (py_sista_set_attribute_doc, "Enable a terminal text attribute using one of the `A_*` constants.\n\n" "### Parameters\n\n" "- `attribute` (int): One of the `A_*` constants (e.g. `A_UNDERLINE`).\n") |
| |
| | PyDoc_STRVAR (py_sista_reset_attribute_doc, "Disable/reset a terminal text attribute using one of the `A_*` constants.\n\n" "### Parameters\n\n" "- `attribute` (int): One of the `A_*` constants (e.g. `A_RESET`).\n") |
| |
| | PyDoc_STRVAR (py_sista_reset_ansi_doc, "Reset all ANSI text attributes and colors to the terminal defaults.\n\n" "Raises `RuntimeError` if the underlying API reports a failure.\n") |
| |
| | PyDoc_STRVAR (py_sista_clear_screen_doc, "Clear the terminal and reposition the cursor to top-left.\n\n" "### Parameters\n\n" "- `spaces` (bool, optional):\n" " - `True` (default): clear visible content and scrollback buffer.\n" " - `False`: only reposition cursor to top-left.\n\n" "### Raises\n\n" "- `RuntimeError`: if the underlying API reports a failure.\n") |
| |
| | PyDoc_STRVAR (py_sista_print_doc, "Print a message to the terminal using Sista's configured output stream.\n\n" "### Parameters\n\n" "- `message` (str): Message to print (a single text line).\n") |
| |
| | PyDoc_STRVAR (py_sista_create_ansi_settings_doc, "Create an ANSI settings object and return it as a capsule.\n\n" "```py\n" "create_ansi_settings(fgcolor=F_WHITE, bgcolor=B_BLACK, attribute=A_RESET) -> Capsule\n" "```\n\n" "### Parameters\n\n" "- `fgcolor` (int): Foreground color (one of the `F_*` constants).\n" "- `bgcolor` (int): Background color (one of the `B_*` constants).\n" "- `attribute` (int): Text attribute (one of the `A_*` constants).\n\n" "### Returns\n\n" "- Capsule wrapping the ANSISettings handler.\n") |
| |
| | PyDoc_STRVAR (py_sista_create_border_doc, "Create a Border object that uses a single-character symbol and ANSI settings.\n\n" "### Parameters\n\n" "- `symbol` (str): Single character string used to draw border bricks.\n" "- `ansi_settings` (Capsule): Capsule returned by `create_ansi_settings`.\n\n" "### Returns\n\n" "- Capsule wrapping the Border handler.\n") |
| |
| | PyDoc_STRVAR (py_sista_create_coordinates_doc, "Create a Coordinates object and return it as a capsule.\n\n" "### Parameters\n\n" "- `y` (int): Row index.\n" "- `x` (int): Column index.\n\n" "### Returns\n\n" "- Capsule wrapping a Coordinates struct.\n") |
| |
| | PyDoc_STRVAR (py_doc_Field, "Class representing a terminal Field for pawns and borders.\n\n" "Create with `Field(width: int, height: int)`.\n\n" "Provides: `create_pawn`, `move_pawn`, `print_with_border`.\n") |
| |
| | PyDoc_STRVAR (py_doc_SwappableField, "Class representing a terminal SwappableField for pawns and borders.\n\n" "Create with `SwappableField(width: int, height: int)`.\n\n" "Provides: `create_pawn`, `print_with_border`, `add_pawn_to_swap`, `apply_swaps`.\n") |
| |
| | PyDoc_STRVAR (py_doc_Cursor, "Class representing a terminal cursor for movement operations.\n\n" "Create with `Cursor()`.\n\n" "Provides: `move`, `go_to`, `go_to_coordinates`.\n") |
| |
| | PyDoc_STRVAR (py_doc_Pawn, "Class representing a Pawn owned by a Field or SwappableField.\n\n" "Instances are created by `Field.create_pawn(...)` and\n" "`SwappableField.create_pawn(...)`.\n") |
| |
| | PyDoc_STRVAR (py_Field_create_pawn_doc, "Create a Pawn inside this Field and return a Pawn object.\n\n" "### Parameters\n\n" "- `symbol` (str): Single character string representing the pawn.\n" "- `ansi_settings` (Capsule): Capsule returned by `create_ansi_settings`.\n" "- `coords` (Capsule): Capsule returned by `create_coordinates`.\n\n" "### Returns\n\n" "- A `Pawn` object.\n") |
| |
| | PyDoc_STRVAR (py_Field_move_pawn_doc, "Move a pawn inside this Field.\n\n" "### Parameters\n\n" "- `pawn` (Pawn): Pawn object to move.\n" "- `y` (int): Y coordinate of the destination.\n" "- `x` (int): X coordinate of the destination.\n\n" "### Raises\n\n" "- `IndexError`: destination is out of bounds.\n" "- `RuntimeError`: destination is occupied or another API error occurs.\n") |
| |
| | PyDoc_STRVAR (py_Field_print_with_border_doc, "Render this Field to the terminal using the given Border object.\n\n" "### Parameters\n\n" "- `border` (Capsule): Capsule for the Border to draw around the field.\n") |
| |
| | PyDoc_STRVAR (py_SwappableField_create_pawn_doc, "create_pawn(self, symbol: str, ansi_settings: Capsule, coords: Capsule) -> Pawn\n\n" "Create a Pawn inside this SwappableField and return a Pawn object.\n\n" "### Parameters\n\n" "- `symbol` (str): Single character string used to represent the pawn.\n" "- `ansi_settings` (Capsule): Capsule returned by create_ansi_settings().\n" "- `coords` (Capsule): Capsule returned by create_coordinates().\n\n" "### Returns\n\n" "- A `Pawn` object.\n") |
| |
| | PyDoc_STRVAR (py_SwappableField_add_pawn_to_swap_doc, "add_pawn_to_swap(self, pawn: Pawn, coords: Capsule) -> None\n\n" "Schedule a pawn to be swapped to the given coordinates in the next swap operation.\n\n" "### Parameters\n\n" "- `pawn` (Pawn): Pawn object to schedule for swapping.\n" "- `coords` (Capsule): Capsule for the target Coordinates.\n\n" "### Raises\n\n" "- `IndexError`: destination is out of bounds.\n" "- `RuntimeError`: destination is occupied or another API error occurs.\n") |
| |
| | PyDoc_STRVAR (py_SwappableField_apply_swaps_doc, "apply_swaps(self) -> None\n\n" "Execute all scheduled pawn swaps in this SwappableField.\n\n" "### Raises\n\n" "- `RuntimeError`: if applying swaps fails.\n") |
| |
| | PyDoc_STRVAR (py_SwappableField_print_with_border_doc, "print_with_border(self, border: Capsule) -> None\n\n" "Render this SwappableField to the terminal using the given Border object.\n\n" "### Parameters\n\n" "- `border` (Capsule): Capsule for the Border to draw around the field.\n") |
| |
| | PyDoc_STRVAR (py_Cursor_go_to_doc, "Move the cursor to the absolute `(y, x)` position.\n\n" "### Parameters\n\n" "- `y` (int): Row index to move to.\n" "- `x` (int): Column index to move to.\n") |
| |
| | PyDoc_STRVAR (py_Cursor_move_doc, "Move the cursor in the specified direction by the given amount.\n\n" "### Parameters\n\n" "- `direction` (int): One of the `DIRECTION_*` constants.\n" "- `amount` (int): Number of positions to move the cursor.\n") |
| |
| | PyDoc_STRVAR (py_Cursor_go_to_coordinates_doc, "Move the cursor to the position described by a Coordinates capsule.\n\n" "### Parameters\n\n" "- `coords` (Capsule): Capsule returned by `create_coordinates`.\n") |
| |
| static PyObject * | py_sista_set_foreground_color (PyObject *self, PyObject *arg) |
| | Sets the foreground color.
|
| |
| static PyObject * | py_sista_set_background_color (PyObject *self, PyObject *arg) |
| | Sets the background color.
|
| |
| static PyObject * | py_sista_set_attribute (PyObject *self, PyObject *arg) |
| | Sets the text attribute.
|
| |
| static PyObject * | py_sista_reset_attribute (PyObject *self, PyObject *arg) |
| | Resets the text attribute.
|
| |
| static PyObject * | py_sista_print (PyObject *self, PyObject *args) |
| | Prints a message.
|
| |
| static PyObject * | py_sista_reset_ansi (PyObject *self, PyObject *Py_UNUSED(ignored)) |
| | Resets ANSI settings to default.
|
| |
| static PyObject * | py_sista_clear_screen (PyObject *self, PyObject *args, PyObject *kwargs) |
| | Clears the terminal and repositions the cursor.
|
| |
| static void | py_sista_destroy_ansi_settings_capsule_destructor (PyObject *) |
| |
| static PyObject * | py_sista_create_ansi_settings (PyObject *self, PyObject *args, PyObject *kwargs) |
| |
| static void | py_sista_destroy_border_capsule_destructor (PyObject *capsule) |
| | Destructor for BorderHandler_t capsule.
|
| |
| static PyObject * | py_sista_create_border (PyObject *self, PyObject *args) |
| | Creates a Border object.
|
| |
| static void | py_sista_destroy_coordinates_capsule_destructor (PyObject *) |
| |
| static PyObject * | py_sista_create_coordinates (PyObject *self, PyObject *args) |
| | Creates a Coordinates object.
|
| |
| static void | Pawn_dealloc (PyObject *self) |
| |
| static int | Pawn_init (PyObject *self, PyObject *args, PyObject *kwds) |
| |
| static PyObject * | py_sista_create_pawn_object (PawnHandler_t pawn, PyObject *owner) |
| |
| static PawnHandler_t | py_sista_get_pawn_from_object (PyObject *pawn_obj) |
| |
| static void | Cursor_dealloc (PyObject *self) |
| |
| static PyObject * | Cursor_go_to (PyObject *self, PyObject *args) |
| | Cursor.go_to(self, y, x)
|
| |
| static PyObject * | Cursor_go_to_coordinates (PyObject *self, PyObject *args) |
| | Cursor.go_to_coordinates(self, coords_capsule)
|
| |
| static PyObject * | Cursor_move (PyObject *self, PyObject *args) |
| | Cursor.move(self, direction, amount)
|
| |
| static int | Cursor_init (PyObject *self, PyObject *args, PyObject *kwds) |
| |
| static void | SwappableField_dealloc (PyObject *self) |
| |
| static PyObject * | SwappableField_create_pawn (PyObject *self, PyObject *args) |
| |
| static PyObject * | SwappableField_add_pawn_to_swap (PyObject *self, PyObject *args) |
| |
| static PyObject * | SwappableField_apply_swaps (PyObject *self, PyObject *Py_UNUSED(ignored)) |
| |
| static PyObject * | SwappableField_print_with_border (PyObject *self, PyObject *args) |
| |
| static int | SwappableField_init (PyObject *self, PyObject *args, PyObject *kwds) |
| |
| static void | Field_dealloc (PyObject *self) |
| |
| static PyObject * | Field_create_pawn (PyObject *self, PyObject *args) |
| |
| static PyObject * | Field_move_pawn (PyObject *self, PyObject *args) |
| |
| static PyObject * | Field_print_with_border (PyObject *self, PyObject *args) |
| |
| static int | Field_init (PyObject *self, PyObject *args, PyObject *kwds) |
| | Initializes a Field object.
|
| |
| static int | sista_module_exec (PyObject *module) |
| |
| PyMODINIT_FUNC | PyInit__sista (void) |
| | Module initialization function.
|
| |
Python C extension module for Sista C API.
This file defines a Python C extension module that wraps the Sista C API, allowing Python programs to interact with the Sista library functionalities.
- Author
- FLAK-ZOSO
- Date
- 2025
- Version
- 3.0.0
- Copyright
- GNU General Public License v3.0
- See also
- https://peps.python.org/pep-0007/