FDOSTUI
FreeDOS Text User Interface
|
A dynamic text buffer implementing the gap buffer algorithm. More...
Go to the source code of this file.
Classes | |
struct | gapbuf |
Functions | |
void | gapbuf_assign (struct gapbuf *const o_gap) |
initialize gapbuf object More... | |
void | gapbuf_discharge (struct gapbuf *const io_gap) |
release resources held by object More... | |
int | gapbuf_backspace (struct gapbuf *const io_gap, size_t const i_offset) |
perform a backspace operation More... | |
int | gapbuf_insert (struct gapbuf *const io_gap, size_t const i_offset, unsigned char const i_char) |
insert a character More... | |
int | gapbuf_delete (struct gapbuf *const io_gap, size_t const i_offset) |
delete a character More... | |
unsigned char __FAR * | gapbuf_char_next (size_t *io_offset, struct gapbuf const *const i_gap) |
move to next character More... | |
unsigned char __FAR * | gapbuf_char_prev (size_t *io_offset, struct gapbuf const *const i_gap) |
move to previous character More... | |
unsigned char __FAR * | gapbuf_line_next (size_t *io_offset, struct gapbuf const *const i_gap) |
move to next line More... | |
unsigned char __FAR * | gapbuf_line_prev (size_t *io_offset, struct gapbuf const *const i_gap) |
move to previous line More... | |
int | gapbuf_overwrite (struct gapbuf *const io_gap, size_t const i_offset, unsigned char const i_char) |
overwrite character More... | |
unsigned char const __FAR * | gapbuf_text (struct gapbuf *const io_gap) |
get the text buffer More... | |
unsigned char __FAR * | gapbuf_ptr (struct gapbuf const *const i_gap, size_t const i_offset) |
get the text buffer More... | |
A dynamic text buffer implementing the gap buffer algorithm.
A cursor (point) is not provided, it must be maintained externally. Routines taking a cursor expect it to be within normal boundaries of the buffer.
void gapbuf_assign | ( | struct gapbuf *const | o_gap | ) |
initialize gapbuf object
[out] | o_gap | gapbuf object |
Memory is not allocated to the gap buffer until a character is inserted.
int gapbuf_backspace | ( | struct gapbuf *const | io_gap, |
size_t const | i_offset | ||
) |
perform a backspace operation
[in,out] | io_gap | gap buffer object |
[in] | i_offset | cursor location to perform backspace |
unsigned char __FAR * gapbuf_char_next | ( | size_t * | io_offset, |
struct gapbuf const *const | i_gap | ||
) |
move to next character
[in,out] | io_offset | cursor to advance |
[in] | i_gap | gap buffer object |
unsigned char __FAR * gapbuf_char_prev | ( | size_t * | io_offset, |
struct gapbuf const *const | i_gap | ||
) |
move to previous character
[in,out] | io_offset | cursor to decrement |
[in] | i_gap | gap buffer object |
int gapbuf_delete | ( | struct gapbuf *const | io_gap, |
size_t const | i_offset | ||
) |
delete a character
[in,out] | io_gap | gap buffer oject |
[in] | i_offset | cursor location to perform delete |
void gapbuf_discharge | ( | struct gapbuf *const | io_gap | ) |
release resources held by object
[in,out] | io_gap | object to release |
int gapbuf_insert | ( | struct gapbuf *const | io_gap, |
size_t const | i_offset, | ||
unsigned char const | i_char | ||
) |
insert a character
[in,out] | io_gap | gap buffer oject |
[in] | i_offset | cursor location to perform insert |
[in] | i_char | character to insert |
unsigned char __FAR * gapbuf_line_next | ( | size_t * | io_offset, |
struct gapbuf const *const | i_gap | ||
) |
move to next line
[in,out] | io_offset | cursor to advance |
[in] | i_gap | gap buffer object |
unsigned char __FAR * gapbuf_line_prev | ( | size_t * | io_offset, |
struct gapbuf const *const | i_gap | ||
) |
move to previous line
[in,out] | io_offset | cursor to decrement |
[in] | i_gap | gap buffer object |
int gapbuf_overwrite | ( | struct gapbuf *const | io_gap, |
size_t const | i_offset, | ||
unsigned char const | i_char | ||
) |
overwrite character
[in,out] | io_gap | gap buffer object |
[in] | i_offset | cursor location to preform overwrite |
[in] | i_char | character to overwrite |
unsigned char __FAR * gapbuf_ptr | ( | struct gapbuf const *const | i_gap, |
size_t const | i_offset | ||
) |
get the text buffer
[in] | i_gap | gap buffer object |
[in] | i_offset | cursor location |
The routine does not move the gap. The returned address points to either before the start of the gap or after the end of the gap.
unsigned char const __FAR * gapbuf_text | ( | struct gapbuf *const | io_gap | ) |
get the text buffer
[in,out] | io_gap | gap buffer object |
The routine will move the gap so the buffer can be accessed sequentially.
Buffer contents should not be modified.
The returned address is only valid until the next operation that affects the gap.