wip remove newtypes

This commit is contained in:
Vinzenz Schroeter 2025-04-12 12:08:49 +02:00
parent 38633f0b6b
commit 69014dff38
3 changed files with 54 additions and 78 deletions

View file

@ -245,22 +245,6 @@ typedef ValueGrid_char CharGrid;
*/
typedef ValueGrid_u8 Cp437Grid;
/**
* A C-wrapper for grid containing codepage 437 characters.
*
* The encoding is currently not enforced.
*
* # Examples
*
* ```C
* Cp437Grid grid = sp_cp437_grid_new(4, 3);
* sp_cp437_grid_fill(grid, '?');
* sp_cp437_grid_set(grid, 0, 0, '!');
* sp_cp437_grid_free(grid);
* ```
*/
typedef Cp437Grid SPCp437Grid;
/**
* A raw header.
*
@ -1417,7 +1401,7 @@ Command *sp_command_clone(const Command *command);
*/
Command *sp_command_cp437_data(size_t x,
size_t y,
SPCp437Grid *grid);
Cp437Grid *grid);
/**
* A yet-to-be-tested command.
@ -1631,7 +1615,7 @@ bool sp_connection_send_packet(const UdpConnection *connection, Packet *packet);
* - the returned instance is freed in some way, either by using a consuming function or
* by explicitly calling `sp_cp437_grid_free`.
*/
SPCp437Grid *sp_cp437_grid_clone(const SPCp437Grid *cp437_grid);
Cp437Grid *sp_cp437_grid_clone(const Cp437Grid *cp437_grid);
/**
* Sets the value of all cells in the [SPCp437Grid].
@ -1652,7 +1636,7 @@ SPCp437Grid *sp_cp437_grid_clone(const SPCp437Grid *cp437_grid);
* - `cp437_grid` points to a valid [SPCp437Grid]
* - `cp437_grid` is not written to or read from concurrently
*/
void sp_cp437_grid_fill(SPCp437Grid *cp437_grid, uint8_t value);
void sp_cp437_grid_fill(Cp437Grid *cp437_grid, uint8_t value);
/**
* Deallocates a [SPCp437Grid].
@ -1671,7 +1655,7 @@ void sp_cp437_grid_fill(SPCp437Grid *cp437_grid, uint8_t value);
*
* [SPCommand]: [crate::SPCommand]
*/
void sp_cp437_grid_free(SPCp437Grid *cp437_grid);
void sp_cp437_grid_free(Cp437Grid *cp437_grid);
/**
* Gets the current value at the specified position.
@ -1693,7 +1677,7 @@ void sp_cp437_grid_free(SPCp437Grid *cp437_grid);
* - `cp437_grid` points to a valid [SPCp437Grid]
* - `cp437_grid` is not written to concurrently
*/
uint8_t sp_cp437_grid_get(const SPCp437Grid *cp437_grid, size_t x, size_t y);
uint8_t sp_cp437_grid_get(const Cp437Grid *cp437_grid, size_t x, size_t y);
/**
* Gets the height of the [SPCp437Grid] instance.
@ -1712,7 +1696,7 @@ uint8_t sp_cp437_grid_get(const SPCp437Grid *cp437_grid, size_t x, size_t y);
*
* - `cp437_grid` points to a valid [SPCp437Grid]
*/
size_t sp_cp437_grid_height(const SPCp437Grid *cp437_grid);
size_t sp_cp437_grid_height(const Cp437Grid *cp437_grid);
/**
* Loads a [SPCp437Grid] with the specified dimensions from the provided data.
@ -1733,10 +1717,10 @@ size_t sp_cp437_grid_height(const SPCp437Grid *cp437_grid);
* - the returned instance is freed in some way, either by using a consuming function or
* by explicitly calling `sp_cp437_grid_free`.
*/
SPCp437Grid *sp_cp437_grid_load(size_t width,
size_t height,
const uint8_t *data,
size_t data_length);
Cp437Grid *sp_cp437_grid_load(size_t width,
size_t height,
const uint8_t *data,
size_t data_length);
/**
* Creates a new [SPCp437Grid] with the specified dimensions.
@ -1750,8 +1734,8 @@ SPCp437Grid *sp_cp437_grid_load(size_t width,
* - the returned instance is freed in some way, either by using a consuming function or
* by explicitly calling `sp_cp437_grid_free`.
*/
SPCp437Grid *sp_cp437_grid_new(size_t width,
size_t height);
Cp437Grid *sp_cp437_grid_new(size_t width,
size_t height);
/**
* Sets the value of the specified position in the [SPCp437Grid].
@ -1778,7 +1762,7 @@ SPCp437Grid *sp_cp437_grid_new(size_t width,
*
* [SPBitVec]: [crate::SPBitVec]
*/
void sp_cp437_grid_set(SPCp437Grid *cp437_grid,
void sp_cp437_grid_set(Cp437Grid *cp437_grid,
size_t x,
size_t y,
uint8_t value);
@ -1800,7 +1784,7 @@ void sp_cp437_grid_set(SPCp437Grid *cp437_grid,
* - the returned memory range is never accessed after the passed [SPCp437Grid] has been freed
* - the returned memory range is never accessed concurrently, either via the [SPCp437Grid] or directly
*/
SPByteSlice sp_cp437_grid_unsafe_data_ref(SPCp437Grid *cp437_grid);
SPByteSlice sp_cp437_grid_unsafe_data_ref(Cp437Grid *cp437_grid);
/**
* Gets the width of the [SPCp437Grid] instance.
@ -1819,7 +1803,7 @@ SPByteSlice sp_cp437_grid_unsafe_data_ref(SPCp437Grid *cp437_grid);
*
* - `cp437_grid` points to a valid [SPCp437Grid]
*/
size_t sp_cp437_grid_width(const SPCp437Grid *cp437_grid);
size_t sp_cp437_grid_width(const Cp437Grid *cp437_grid);
/**
* Clones a [SPPacket].