add /*notnull*/ comments in header, use NotNull for parameters
This commit is contained in:
parent
bb90af3a57
commit
40fed5ba04
13 changed files with 299 additions and 385 deletions
|
@ -239,7 +239,7 @@ typedef struct {
|
|||
/**
|
||||
* The start address of the memory
|
||||
*/
|
||||
uint8_t *start;
|
||||
uint8_t */*notnull*/ start;
|
||||
/**
|
||||
* The amount of memory in bytes
|
||||
*/
|
||||
|
@ -351,7 +351,7 @@ extern "C" {
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_bitmap_free`.
|
||||
*/
|
||||
Bitmap *sp_bitmap_clone(const Bitmap *bitmap);
|
||||
Bitmap */*notnull*/ sp_bitmap_clone(Bitmap */*notnull*/ bitmap);
|
||||
|
||||
/**
|
||||
* Sets the state of all pixels in the [SPBitmap].
|
||||
|
@ -372,7 +372,7 @@ Bitmap *sp_bitmap_clone(const Bitmap *bitmap);
|
|||
* - `bitmap` points to a valid [SPBitmap]
|
||||
* - `bitmap` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_bitmap_fill(Bitmap *bitmap, bool value);
|
||||
void sp_bitmap_fill(Bitmap */*notnull*/ bitmap, bool value);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPBitmap].
|
||||
|
@ -386,12 +386,10 @@ void sp_bitmap_fill(Bitmap *bitmap, bool value);
|
|||
* The caller has to make sure that:
|
||||
*
|
||||
* - `bitmap` points to a valid [SPBitmap]
|
||||
* - `bitmap` is not used concurrently or after bitmap call
|
||||
* - `bitmap` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||||
*
|
||||
* [SPCommand]: [crate::SPCommand]
|
||||
*/
|
||||
void sp_bitmap_free(Bitmap *bitmap);
|
||||
void sp_bitmap_free(Bitmap */*notnull*/ bitmap);
|
||||
|
||||
/**
|
||||
* Gets the current value at the specified position in the [SPBitmap].
|
||||
|
@ -413,7 +411,7 @@ void sp_bitmap_free(Bitmap *bitmap);
|
|||
* - `bitmap` points to a valid [SPBitmap]
|
||||
* - `bitmap` is not written to concurrently
|
||||
*/
|
||||
bool sp_bitmap_get(const Bitmap *bitmap, size_t x, size_t y);
|
||||
bool sp_bitmap_get(Bitmap */*notnull*/ bitmap, size_t x, size_t y);
|
||||
|
||||
/**
|
||||
* Gets the height in pixels of the [SPBitmap] instance.
|
||||
|
@ -432,7 +430,7 @@ bool sp_bitmap_get(const Bitmap *bitmap, size_t x, size_t y);
|
|||
*
|
||||
* - `bitmap` points to a valid [SPBitmap]
|
||||
*/
|
||||
size_t sp_bitmap_height(const Bitmap *bitmap);
|
||||
size_t sp_bitmap_height(Bitmap */*notnull*/ bitmap);
|
||||
|
||||
/**
|
||||
* Loads a [SPBitmap] with the specified dimensions from the provided data.
|
||||
|
@ -465,8 +463,7 @@ size_t sp_bitmap_height(const Bitmap *bitmap);
|
|||
*/
|
||||
Bitmap *sp_bitmap_load(size_t width,
|
||||
size_t height,
|
||||
const uint8_t *data,
|
||||
size_t data_length);
|
||||
SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Creates a new [SPBitmap] with the specified dimensions.
|
||||
|
@ -506,7 +503,7 @@ Bitmap *sp_bitmap_new(size_t width,
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling [sp_bitmap_free].
|
||||
*/
|
||||
Bitmap *sp_bitmap_new_screen_sized(void);
|
||||
Bitmap */*notnull*/ sp_bitmap_new_screen_sized(void);
|
||||
|
||||
/**
|
||||
* Sets the value of the specified position in the [SPBitmap].
|
||||
|
@ -531,7 +528,7 @@ Bitmap *sp_bitmap_new_screen_sized(void);
|
|||
* - `bitmap` points to a valid [SPBitmap]
|
||||
* - `bitmap` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_bitmap_set(Bitmap *bitmap, size_t x, size_t y, bool value);
|
||||
void sp_bitmap_set(Bitmap */*notnull*/ bitmap, size_t x, size_t y, bool value);
|
||||
|
||||
/**
|
||||
* Gets an unsafe reference to the data of the [SPBitmap] instance.
|
||||
|
@ -548,7 +545,7 @@ void sp_bitmap_set(Bitmap *bitmap, size_t x, size_t y, bool value);
|
|||
* - the returned memory range is never accessed after the passed [SPBitmap] has been freed
|
||||
* - the returned memory range is never accessed concurrently, either via the [SPBitmap] or directly
|
||||
*/
|
||||
SPByteSlice sp_bitmap_unsafe_data_ref(Bitmap *bitmap);
|
||||
SPByteSlice sp_bitmap_unsafe_data_ref(Bitmap */*notnull*/ bitmap);
|
||||
|
||||
/**
|
||||
* Gets the width in pixels of the [SPBitmap] instance.
|
||||
|
@ -567,7 +564,7 @@ SPByteSlice sp_bitmap_unsafe_data_ref(Bitmap *bitmap);
|
|||
*
|
||||
* - `bitmap` points to a valid [SPBitmap]
|
||||
*/
|
||||
size_t sp_bitmap_width(const Bitmap *bitmap);
|
||||
size_t sp_bitmap_width(Bitmap */*notnull*/ bitmap);
|
||||
|
||||
/**
|
||||
* Clones a [SPBitVec].
|
||||
|
@ -587,7 +584,7 @@ size_t sp_bitmap_width(const Bitmap *bitmap);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_bitvec_free`.
|
||||
*/
|
||||
SPBitVec *sp_bitvec_clone(const SPBitVec *bit_vec);
|
||||
SPBitVec */*notnull*/ sp_bitvec_clone(SPBitVec */*notnull*/ bit_vec);
|
||||
|
||||
/**
|
||||
* Sets the value of all bits in the [SPBitVec].
|
||||
|
@ -608,7 +605,7 @@ SPBitVec *sp_bitvec_clone(const SPBitVec *bit_vec);
|
|||
* - `bit_vec` points to a valid [SPBitVec]
|
||||
* - `bit_vec` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_bitvec_fill(SPBitVec *bit_vec, bool value);
|
||||
void sp_bitvec_fill(SPBitVec */*notnull*/ bit_vec, bool value);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPBitVec].
|
||||
|
@ -627,7 +624,7 @@ void sp_bitvec_fill(SPBitVec *bit_vec, bool value);
|
|||
*
|
||||
* [SPCommand]: [crate::SPCommand]
|
||||
*/
|
||||
void sp_bitvec_free(SPBitVec *bit_vec);
|
||||
void sp_bitvec_free(SPBitVec */*notnull*/ bit_vec);
|
||||
|
||||
/**
|
||||
* Gets the value of a bit from the [SPBitVec].
|
||||
|
@ -651,7 +648,7 @@ void sp_bitvec_free(SPBitVec *bit_vec);
|
|||
* - `bit_vec` points to a valid [SPBitVec]
|
||||
* - `bit_vec` is not written to concurrently
|
||||
*/
|
||||
bool sp_bitvec_get(const SPBitVec *bit_vec, size_t index);
|
||||
bool sp_bitvec_get(SPBitVec */*notnull*/ bit_vec, size_t index);
|
||||
|
||||
/**
|
||||
* Returns true if length is 0.
|
||||
|
@ -670,7 +667,7 @@ bool sp_bitvec_get(const SPBitVec *bit_vec, size_t index);
|
|||
*
|
||||
* - `bit_vec` points to a valid [SPBitVec]
|
||||
*/
|
||||
bool sp_bitvec_is_empty(const SPBitVec *bit_vec);
|
||||
bool sp_bitvec_is_empty(SPBitVec */*notnull*/ bit_vec);
|
||||
|
||||
/**
|
||||
* Gets the length of the [SPBitVec] in bits.
|
||||
|
@ -689,7 +686,7 @@ bool sp_bitvec_is_empty(const SPBitVec *bit_vec);
|
|||
*
|
||||
* - `bit_vec` points to a valid [SPBitVec]
|
||||
*/
|
||||
size_t sp_bitvec_len(const SPBitVec *bit_vec);
|
||||
size_t sp_bitvec_len(SPBitVec */*notnull*/ bit_vec);
|
||||
|
||||
/**
|
||||
* Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
|
||||
|
@ -709,8 +706,7 @@ size_t sp_bitvec_len(const SPBitVec *bit_vec);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_bitvec_free`.
|
||||
*/
|
||||
SPBitVec *sp_bitvec_load(const uint8_t *data,
|
||||
size_t data_length);
|
||||
SPBitVec */*notnull*/ sp_bitvec_load(SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Creates a new [SPBitVec] instance.
|
||||
|
@ -732,7 +728,7 @@ SPBitVec *sp_bitvec_load(const uint8_t *data,
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_bitvec_free`.
|
||||
*/
|
||||
SPBitVec *sp_bitvec_new(size_t size);
|
||||
SPBitVec */*notnull*/ sp_bitvec_new(size_t size);
|
||||
|
||||
/**
|
||||
* Sets the value of a bit in the [SPBitVec].
|
||||
|
@ -755,7 +751,7 @@ SPBitVec *sp_bitvec_new(size_t size);
|
|||
* - `bit_vec` points to a valid [SPBitVec]
|
||||
* - `bit_vec` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_bitvec_set(SPBitVec *bit_vec, size_t index, bool value);
|
||||
void sp_bitvec_set(SPBitVec */*notnull*/ bit_vec, size_t index, bool value);
|
||||
|
||||
/**
|
||||
* Gets an unsafe reference to the data of the [SPBitVec] instance.
|
||||
|
@ -776,7 +772,7 @@ void sp_bitvec_set(SPBitVec *bit_vec, size_t index, bool value);
|
|||
* - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
||||
* - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
||||
*/
|
||||
SPByteSlice sp_bitvec_unsafe_data_ref(SPBitVec *bit_vec);
|
||||
SPByteSlice sp_bitvec_unsafe_data_ref(SPBitVec */*notnull*/ bit_vec);
|
||||
|
||||
/**
|
||||
* Clones a [SPBrightnessGrid].
|
||||
|
@ -800,7 +796,7 @@ SPByteSlice sp_bitvec_unsafe_data_ref(SPBitVec *bit_vec);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_brightness_grid_free`.
|
||||
*/
|
||||
BrightnessGrid *sp_brightness_grid_clone(const BrightnessGrid *brightness_grid);
|
||||
BrightnessGrid */*notnull*/ sp_brightness_grid_clone(BrightnessGrid */*notnull*/ brightness_grid);
|
||||
|
||||
/**
|
||||
* Sets the value of all cells in the [SPBrightnessGrid].
|
||||
|
@ -822,7 +818,8 @@ BrightnessGrid *sp_brightness_grid_clone(const BrightnessGrid *brightness_grid);
|
|||
* - `brightness_grid` points to a valid [SPBrightnessGrid]
|
||||
* - `brightness_grid` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_brightness_grid_fill(BrightnessGrid *brightness_grid, uint8_t value);
|
||||
void sp_brightness_grid_fill(BrightnessGrid */*notnull*/ brightness_grid,
|
||||
uint8_t value);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPBrightnessGrid].
|
||||
|
@ -845,7 +842,7 @@ void sp_brightness_grid_fill(BrightnessGrid *brightness_grid, uint8_t value);
|
|||
*
|
||||
* [SPCommand]: [crate::SPCommand]
|
||||
*/
|
||||
void sp_brightness_grid_free(BrightnessGrid *brightness_grid);
|
||||
void sp_brightness_grid_free(BrightnessGrid */*notnull*/ brightness_grid);
|
||||
|
||||
/**
|
||||
* Gets the current value at the specified position.
|
||||
|
@ -869,7 +866,7 @@ void sp_brightness_grid_free(BrightnessGrid *brightness_grid);
|
|||
* - `brightness_grid` points to a valid [SPBrightnessGrid]
|
||||
* - `brightness_grid` is not written to concurrently
|
||||
*/
|
||||
uint8_t sp_brightness_grid_get(const BrightnessGrid *brightness_grid,
|
||||
uint8_t sp_brightness_grid_get(BrightnessGrid */*notnull*/ brightness_grid,
|
||||
size_t x,
|
||||
size_t y);
|
||||
|
||||
|
@ -892,7 +889,7 @@ uint8_t sp_brightness_grid_get(const BrightnessGrid *brightness_grid,
|
|||
*
|
||||
* - `brightness_grid` points to a valid [SPBrightnessGrid]
|
||||
*/
|
||||
size_t sp_brightness_grid_height(const BrightnessGrid *brightness_grid);
|
||||
size_t sp_brightness_grid_height(BrightnessGrid */*notnull*/ brightness_grid);
|
||||
|
||||
/**
|
||||
* Loads a [SPBrightnessGrid] with the specified dimensions from the provided data.
|
||||
|
@ -915,8 +912,7 @@ size_t sp_brightness_grid_height(const BrightnessGrid *brightness_grid);
|
|||
*/
|
||||
BrightnessGrid *sp_brightness_grid_load(size_t width,
|
||||
size_t height,
|
||||
const uint8_t *data,
|
||||
size_t data_length);
|
||||
SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Creates a new [SPBrightnessGrid] with the specified dimensions.
|
||||
|
@ -930,8 +926,8 @@ BrightnessGrid *sp_brightness_grid_load(size_t width,
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_brightness_grid_free`.
|
||||
*/
|
||||
BrightnessGrid *sp_brightness_grid_new(size_t width,
|
||||
size_t height);
|
||||
BrightnessGrid */*notnull*/ sp_brightness_grid_new(size_t width,
|
||||
size_t height);
|
||||
|
||||
/**
|
||||
* Sets the value of the specified position in the [SPBrightnessGrid].
|
||||
|
@ -957,7 +953,7 @@ BrightnessGrid *sp_brightness_grid_new(size_t width,
|
|||
* - `brightness_grid` points to a valid [SPBrightnessGrid]
|
||||
* - `brightness_grid` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_brightness_grid_set(BrightnessGrid *brightness_grid,
|
||||
void sp_brightness_grid_set(BrightnessGrid */*notnull*/ brightness_grid,
|
||||
size_t x,
|
||||
size_t y,
|
||||
uint8_t value);
|
||||
|
@ -983,7 +979,7 @@ void sp_brightness_grid_set(BrightnessGrid *brightness_grid,
|
|||
* - the returned memory range is never accessed after the passed [SPBrightnessGrid] has been freed
|
||||
* - the returned memory range is never accessed concurrently, either via the [SPBrightnessGrid] or directly
|
||||
*/
|
||||
SPByteSlice sp_brightness_grid_unsafe_data_ref(BrightnessGrid *brightness_grid);
|
||||
SPByteSlice sp_brightness_grid_unsafe_data_ref(BrightnessGrid */*notnull*/ brightness_grid);
|
||||
|
||||
/**
|
||||
* Gets the width of the [SPBrightnessGrid] instance.
|
||||
|
@ -1004,7 +1000,7 @@ SPByteSlice sp_brightness_grid_unsafe_data_ref(BrightnessGrid *brightness_grid);
|
|||
*
|
||||
* - `brightness_grid` points to a valid [SPBrightnessGrid]
|
||||
*/
|
||||
size_t sp_brightness_grid_width(const BrightnessGrid *brightness_grid);
|
||||
size_t sp_brightness_grid_width(BrightnessGrid */*notnull*/ brightness_grid);
|
||||
|
||||
/**
|
||||
* Clones a [SPCharGrid].
|
||||
|
@ -1024,7 +1020,7 @@ size_t sp_brightness_grid_width(const BrightnessGrid *brightness_grid);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_char_grid_free`.
|
||||
*/
|
||||
CharGrid *sp_char_grid_clone(const CharGrid *char_grid);
|
||||
CharGrid */*notnull*/ sp_char_grid_clone(CharGrid */*notnull*/ char_grid);
|
||||
|
||||
/**
|
||||
* Sets the value of all cells in the [SPCharGrid].
|
||||
|
@ -1045,7 +1041,7 @@ CharGrid *sp_char_grid_clone(const CharGrid *char_grid);
|
|||
* - `char_grid` points to a valid [SPCharGrid]
|
||||
* - `char_grid` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_char_grid_fill(CharGrid *char_grid, uint32_t value);
|
||||
void sp_char_grid_fill(CharGrid */*notnull*/ char_grid, uint32_t value);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPCharGrid].
|
||||
|
@ -1064,7 +1060,7 @@ void sp_char_grid_fill(CharGrid *char_grid, uint32_t value);
|
|||
*
|
||||
* [SPCommand]: [crate::SPCommand]
|
||||
*/
|
||||
void sp_char_grid_free(CharGrid *char_grid);
|
||||
void sp_char_grid_free(CharGrid */*notnull*/ char_grid);
|
||||
|
||||
/**
|
||||
* Gets the current value at the specified position.
|
||||
|
@ -1086,7 +1082,7 @@ void sp_char_grid_free(CharGrid *char_grid);
|
|||
* - `char_grid` points to a valid [SPCharGrid]
|
||||
* - `char_grid` is not written to concurrently
|
||||
*/
|
||||
uint32_t sp_char_grid_get(const CharGrid *char_grid, size_t x, size_t y);
|
||||
uint32_t sp_char_grid_get(CharGrid */*notnull*/ char_grid, size_t x, size_t y);
|
||||
|
||||
/**
|
||||
* Gets the height of the [SPCharGrid] instance.
|
||||
|
@ -1105,7 +1101,7 @@ uint32_t sp_char_grid_get(const CharGrid *char_grid, size_t x, size_t y);
|
|||
*
|
||||
* - `char_grid` points to a valid [SPCharGrid]
|
||||
*/
|
||||
size_t sp_char_grid_height(const CharGrid *char_grid);
|
||||
size_t sp_char_grid_height(CharGrid */*notnull*/ char_grid);
|
||||
|
||||
/**
|
||||
* Loads a [SPCharGrid] with the specified dimensions from the provided data.
|
||||
|
@ -1127,10 +1123,9 @@ size_t sp_char_grid_height(const CharGrid *char_grid);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_char_grid_free`.
|
||||
*/
|
||||
CharGrid *sp_char_grid_load(size_t width,
|
||||
size_t height,
|
||||
const uint8_t *data,
|
||||
size_t data_length);
|
||||
CharGrid */*notnull*/ sp_char_grid_load(size_t width,
|
||||
size_t height,
|
||||
SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Creates a new [SPCharGrid] with the specified dimensions.
|
||||
|
@ -1144,8 +1139,8 @@ CharGrid *sp_char_grid_load(size_t width,
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_char_grid_free`.
|
||||
*/
|
||||
CharGrid *sp_char_grid_new(size_t width,
|
||||
size_t height);
|
||||
CharGrid */*notnull*/ sp_char_grid_new(size_t width,
|
||||
size_t height);
|
||||
|
||||
/**
|
||||
* Sets the value of the specified position in the [SPCharGrid].
|
||||
|
@ -1172,7 +1167,10 @@ CharGrid *sp_char_grid_new(size_t width,
|
|||
*
|
||||
* [SPBitVec]: [crate::SPBitVec]
|
||||
*/
|
||||
void sp_char_grid_set(CharGrid *char_grid, size_t x, size_t y, uint32_t value);
|
||||
void sp_char_grid_set(CharGrid */*notnull*/ char_grid,
|
||||
size_t x,
|
||||
size_t y,
|
||||
uint32_t value);
|
||||
|
||||
/**
|
||||
* Gets the width of the [SPCharGrid] instance.
|
||||
|
@ -1191,7 +1189,7 @@ void sp_char_grid_set(CharGrid *char_grid, size_t x, size_t y, uint32_t value);
|
|||
*
|
||||
* - `char_grid` points to a valid [SPCharGrid]
|
||||
*/
|
||||
size_t sp_char_grid_width(const CharGrid *char_grid);
|
||||
size_t sp_char_grid_width(CharGrid */*notnull*/ char_grid);
|
||||
|
||||
/**
|
||||
* Set pixel data starting at the pixel offset on screen.
|
||||
|
@ -1221,7 +1219,7 @@ size_t sp_char_grid_width(const CharGrid *char_grid);
|
|||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_bitmap_linear(size_t offset,
|
||||
SPBitVec *bit_vec,
|
||||
SPBitVec */*notnull*/ bit_vec,
|
||||
CompressionCode compression);
|
||||
|
||||
/**
|
||||
|
@ -1252,7 +1250,7 @@ Command *sp_command_bitmap_linear(size_t offset,
|
|||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_bitmap_linear_and(size_t offset,
|
||||
SPBitVec *bit_vec,
|
||||
SPBitVec */*notnull*/ bit_vec,
|
||||
CompressionCode compression);
|
||||
|
||||
/**
|
||||
|
@ -1283,7 +1281,7 @@ Command *sp_command_bitmap_linear_and(size_t offset,
|
|||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_bitmap_linear_or(size_t offset,
|
||||
SPBitVec *bit_vec,
|
||||
SPBitVec */*notnull*/ bit_vec,
|
||||
CompressionCode compression);
|
||||
|
||||
/**
|
||||
|
@ -1310,7 +1308,7 @@ Command *sp_command_bitmap_linear_or(size_t offset,
|
|||
*/
|
||||
Command *sp_command_bitmap_linear_win(size_t x,
|
||||
size_t y,
|
||||
Bitmap *bitmap,
|
||||
Bitmap */*notnull*/ bitmap,
|
||||
CompressionCode compression);
|
||||
|
||||
/**
|
||||
|
@ -1341,7 +1339,7 @@ Command *sp_command_bitmap_linear_win(size_t x,
|
|||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_bitmap_linear_xor(size_t offset,
|
||||
SPBitVec *bit_vec,
|
||||
SPBitVec */*notnull*/ bit_vec,
|
||||
CompressionCode compression);
|
||||
|
||||
/**
|
||||
|
@ -1360,7 +1358,7 @@ Command *sp_command_bitmap_linear_xor(size_t offset,
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_brightness(uint8_t brightness);
|
||||
Command */*notnull*/ sp_command_brightness(uint8_t brightness);
|
||||
|
||||
/**
|
||||
* Set the brightness of individual tiles in a rectangular area of the display.
|
||||
|
@ -1382,9 +1380,9 @@ Command *sp_command_brightness(uint8_t brightness);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_char_brightness(size_t x,
|
||||
size_t y,
|
||||
BrightnessGrid *grid);
|
||||
Command */*notnull*/ sp_command_char_brightness(size_t x,
|
||||
size_t y,
|
||||
BrightnessGrid */*notnull*/ grid);
|
||||
|
||||
/**
|
||||
* Set all pixels to the off state.
|
||||
|
@ -1406,7 +1404,7 @@ Command *sp_command_char_brightness(size_t x,
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_clear(void);
|
||||
Command */*notnull*/ sp_command_clear(void);
|
||||
|
||||
/**
|
||||
* Clones a [SPCommand] instance.
|
||||
|
@ -1426,7 +1424,7 @@ Command *sp_command_clear(void);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_clone(const Command *command);
|
||||
Command */*notnull*/ sp_command_clone(Command */*notnull*/ command);
|
||||
|
||||
/**
|
||||
* Show codepage 437 encoded text on the screen.
|
||||
|
@ -1448,9 +1446,9 @@ Command *sp_command_clone(const Command *command);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_cp437_data(size_t x,
|
||||
size_t y,
|
||||
Cp437Grid *grid);
|
||||
Command */*notnull*/ sp_command_cp437_data(size_t x,
|
||||
size_t y,
|
||||
Cp437Grid */*notnull*/ grid);
|
||||
|
||||
/**
|
||||
* A yet-to-be-tested command.
|
||||
|
@ -1464,7 +1462,7 @@ Command *sp_command_cp437_data(size_t x,
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_fade_out(void);
|
||||
Command */*notnull*/ sp_command_fade_out(void);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPCommand].
|
||||
|
@ -1488,7 +1486,7 @@ Command *sp_command_fade_out(void);
|
|||
* - `command` is not used concurrently or after this call
|
||||
* - `command` was not passed to another consuming function, e.g. to create a [SPPacket]
|
||||
*/
|
||||
void sp_command_free(Command *command);
|
||||
void sp_command_free(Command */*notnull*/ command);
|
||||
|
||||
/**
|
||||
* Kills the udp daemon on the display, which usually results in a restart.
|
||||
|
@ -1504,7 +1502,7 @@ void sp_command_free(Command *command);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_hard_reset(void);
|
||||
Command */*notnull*/ sp_command_hard_reset(void);
|
||||
|
||||
/**
|
||||
* A low-level display command.
|
||||
|
@ -1541,7 +1539,7 @@ Command *sp_command_hard_reset(void);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_try_from_packet(Packet *packet);
|
||||
Command *sp_command_try_from_packet(Packet */*notnull*/ packet);
|
||||
|
||||
/**
|
||||
* Show UTF-8 encoded text on the screen.
|
||||
|
@ -1563,9 +1561,9 @@ Command *sp_command_try_from_packet(Packet *packet);
|
|||
* - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_command_free`.
|
||||
*/
|
||||
Command *sp_command_utf8_data(size_t x,
|
||||
size_t y,
|
||||
CharGrid *grid);
|
||||
Command */*notnull*/ sp_command_utf8_data(size_t x,
|
||||
size_t y,
|
||||
CharGrid */*notnull*/ grid);
|
||||
|
||||
/**
|
||||
* Closes and deallocates a [SPConnection].
|
||||
|
@ -1581,7 +1579,7 @@ Command *sp_command_utf8_data(size_t x,
|
|||
* - `connection` points to a valid [SPConnection]
|
||||
* - `connection` is not used concurrently or after this call
|
||||
*/
|
||||
void sp_connection_free(UdpConnection *connection);
|
||||
void sp_connection_free(UdpConnection */*notnull*/ connection);
|
||||
|
||||
/**
|
||||
* Creates a new instance of [SPConnection].
|
||||
|
@ -1599,7 +1597,7 @@ void sp_connection_free(UdpConnection *connection);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_connection_free`.
|
||||
*/
|
||||
UdpConnection *sp_connection_open(const char *host);
|
||||
UdpConnection *sp_connection_open(char */*notnull*/ host);
|
||||
|
||||
/**
|
||||
* Sends a [SPCommand] to the display using the [SPConnection].
|
||||
|
@ -1621,8 +1619,8 @@ UdpConnection *sp_connection_open(const char *host);
|
|||
* - `command` points to a valid instance of [SPPacket]
|
||||
* - `command` is not used concurrently or after this call
|
||||
*/
|
||||
bool sp_connection_send_command(const UdpConnection *connection,
|
||||
Command *command);
|
||||
bool sp_connection_send_command(UdpConnection */*notnull*/ connection,
|
||||
Command */*notnull*/ command);
|
||||
|
||||
/**
|
||||
* Sends a [SPPacket] to the display using the [SPConnection].
|
||||
|
@ -1644,7 +1642,8 @@ bool sp_connection_send_command(const UdpConnection *connection,
|
|||
* - `packet` points to a valid instance of [SPPacket]
|
||||
* - `packet` is not used concurrently or after this call
|
||||
*/
|
||||
bool sp_connection_send_packet(const UdpConnection *connection, Packet *packet);
|
||||
bool sp_connection_send_packet(UdpConnection */*notnull*/ connection,
|
||||
Packet */*notnull*/ packet);
|
||||
|
||||
/**
|
||||
* Clones a [SPCp437Grid].
|
||||
|
@ -1664,7 +1663,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`.
|
||||
*/
|
||||
Cp437Grid *sp_cp437_grid_clone(const Cp437Grid *cp437_grid);
|
||||
Cp437Grid */*notnull*/ sp_cp437_grid_clone(Cp437Grid */*notnull*/ cp437_grid);
|
||||
|
||||
/**
|
||||
* Sets the value of all cells in the [SPCp437Grid].
|
||||
|
@ -1685,7 +1684,7 @@ Cp437Grid *sp_cp437_grid_clone(const Cp437Grid *cp437_grid);
|
|||
* - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
* - `cp437_grid` is not written to or read from concurrently
|
||||
*/
|
||||
void sp_cp437_grid_fill(Cp437Grid *cp437_grid, uint8_t value);
|
||||
void sp_cp437_grid_fill(Cp437Grid */*notnull*/ cp437_grid, uint8_t value);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPCp437Grid].
|
||||
|
@ -1704,7 +1703,7 @@ void sp_cp437_grid_fill(Cp437Grid *cp437_grid, uint8_t value);
|
|||
*
|
||||
* [SPCommand]: [crate::SPCommand]
|
||||
*/
|
||||
void sp_cp437_grid_free(Cp437Grid *cp437_grid);
|
||||
void sp_cp437_grid_free(Cp437Grid */*notnull*/ cp437_grid);
|
||||
|
||||
/**
|
||||
* Gets the current value at the specified position.
|
||||
|
@ -1726,7 +1725,9 @@ void sp_cp437_grid_free(Cp437Grid *cp437_grid);
|
|||
* - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
* - `cp437_grid` is not written to concurrently
|
||||
*/
|
||||
uint8_t sp_cp437_grid_get(const Cp437Grid *cp437_grid, size_t x, size_t y);
|
||||
uint8_t sp_cp437_grid_get(Cp437Grid */*notnull*/ cp437_grid,
|
||||
size_t x,
|
||||
size_t y);
|
||||
|
||||
/**
|
||||
* Gets the height of the [SPCp437Grid] instance.
|
||||
|
@ -1745,7 +1746,7 @@ uint8_t sp_cp437_grid_get(const Cp437Grid *cp437_grid, size_t x, size_t y);
|
|||
*
|
||||
* - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
*/
|
||||
size_t sp_cp437_grid_height(const Cp437Grid *cp437_grid);
|
||||
size_t sp_cp437_grid_height(Cp437Grid */*notnull*/ cp437_grid);
|
||||
|
||||
/**
|
||||
* Loads a [SPCp437Grid] with the specified dimensions from the provided data.
|
||||
|
@ -1768,8 +1769,7 @@ size_t sp_cp437_grid_height(const Cp437Grid *cp437_grid);
|
|||
*/
|
||||
Cp437Grid *sp_cp437_grid_load(size_t width,
|
||||
size_t height,
|
||||
const uint8_t *data,
|
||||
size_t data_length);
|
||||
SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Creates a new [SPCp437Grid] with the specified dimensions.
|
||||
|
@ -1783,8 +1783,8 @@ Cp437Grid *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`.
|
||||
*/
|
||||
Cp437Grid *sp_cp437_grid_new(size_t width,
|
||||
size_t height);
|
||||
Cp437Grid */*notnull*/ sp_cp437_grid_new(size_t width,
|
||||
size_t height);
|
||||
|
||||
/**
|
||||
* Sets the value of the specified position in the [SPCp437Grid].
|
||||
|
@ -1811,7 +1811,7 @@ Cp437Grid *sp_cp437_grid_new(size_t width,
|
|||
*
|
||||
* [SPBitVec]: [crate::SPBitVec]
|
||||
*/
|
||||
void sp_cp437_grid_set(Cp437Grid *cp437_grid,
|
||||
void sp_cp437_grid_set(Cp437Grid */*notnull*/ cp437_grid,
|
||||
size_t x,
|
||||
size_t y,
|
||||
uint8_t value);
|
||||
|
@ -1833,7 +1833,7 @@ void sp_cp437_grid_set(Cp437Grid *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(Cp437Grid *cp437_grid);
|
||||
SPByteSlice sp_cp437_grid_unsafe_data_ref(Cp437Grid */*notnull*/ cp437_grid);
|
||||
|
||||
/**
|
||||
* Gets the width of the [SPCp437Grid] instance.
|
||||
|
@ -1852,7 +1852,7 @@ SPByteSlice sp_cp437_grid_unsafe_data_ref(Cp437Grid *cp437_grid);
|
|||
*
|
||||
* - `cp437_grid` points to a valid [SPCp437Grid]
|
||||
*/
|
||||
size_t sp_cp437_grid_width(const Cp437Grid *cp437_grid);
|
||||
size_t sp_cp437_grid_width(Cp437Grid */*notnull*/ cp437_grid);
|
||||
|
||||
/**
|
||||
* Clones a [SPPacket].
|
||||
|
@ -1872,7 +1872,7 @@ size_t sp_cp437_grid_width(const Cp437Grid *cp437_grid);
|
|||
* - the returned instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_packet_free`.
|
||||
*/
|
||||
Packet *sp_packet_clone(const Packet *packet);
|
||||
Packet */*notnull*/ sp_packet_clone(Packet */*notnull*/ packet);
|
||||
|
||||
/**
|
||||
* Deallocates a [SPPacket].
|
||||
|
@ -1888,7 +1888,7 @@ Packet *sp_packet_clone(const Packet *packet);
|
|||
* - `packet` points to a valid [SPPacket]
|
||||
* - `packet` is not used concurrently or after this call
|
||||
*/
|
||||
void sp_packet_free(Packet *packet);
|
||||
void sp_packet_free(Packet */*notnull*/ packet);
|
||||
|
||||
/**
|
||||
* Turns a [SPCommand] into a [SPPacket].
|
||||
|
@ -1909,7 +1909,7 @@ void sp_packet_free(Packet *packet);
|
|||
* - the returned [SPPacket] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_packet_free`.
|
||||
*/
|
||||
Packet *sp_packet_from_command(Command *command);
|
||||
Packet *sp_packet_from_command(Command */*notnull*/ command);
|
||||
|
||||
/**
|
||||
* Creates a raw [SPPacket] from parts.
|
||||
|
@ -1937,15 +1937,14 @@ Packet *sp_packet_from_command(Command *command);
|
|||
* - the returned [SPPacket] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling [sp_packet_free].
|
||||
*/
|
||||
Packet *sp_packet_from_parts(Header header,
|
||||
const uint8_t *payload,
|
||||
size_t payload_len);
|
||||
Packet */*notnull*/ sp_packet_from_parts(Header header,
|
||||
const SPByteSlice *payload);
|
||||
|
||||
Header *sp_packet_get_header(Packet *packet);
|
||||
Header */*notnull*/ sp_packet_get_header(Packet */*notnull*/ packet);
|
||||
|
||||
SPByteSlice sp_packet_get_payload(Packet *packet);
|
||||
SPByteSlice sp_packet_get_payload(Packet */*notnull*/ packet);
|
||||
|
||||
void sp_packet_set_payload(Packet *packet, SPByteSlice data);
|
||||
void sp_packet_set_payload(Packet */*notnull*/ packet, SPByteSlice data);
|
||||
|
||||
/**
|
||||
* Tries to load a [SPPacket] from the passed array with the specified length.
|
||||
|
@ -1965,10 +1964,9 @@ void sp_packet_set_payload(Packet *packet, SPByteSlice data);
|
|||
* - the returned [SPPacket] instance is freed in some way, either by using a consuming function or
|
||||
* by explicitly calling `sp_packet_free`.
|
||||
*/
|
||||
Packet *sp_packet_try_load(const uint8_t *data,
|
||||
size_t length);
|
||||
Packet *sp_packet_try_load(SPByteSlice data);
|
||||
|
||||
void sp_packet_write_to(const Packet *packet, SPByteSlice buffer);
|
||||
void sp_packet_write_to(Packet */*notnull*/ packet, SPByteSlice buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue