FDOSTUI
FreeDOS Text User Interface
gapbuf.h
Go to the documentation of this file.
1 /*
2  GAPBUF.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __gapbuf_h__
11 
12 #include <stddef.h>
13 
14 #ifndef __FAR
15 # if defined( __FLAT__) || defined(__LARGE__)
16 # define __FAR
17 # else
18 # define __FAR __far
19 # endif
20 #endif
21 
22 struct gapbuf
23 {
24  unsigned char __FAR* m_block;
25  size_t m_block_size;
26  size_t m_start;
27  size_t m_end;
28 };
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 extern void
36  struct gapbuf*const o_gap);
37 
38 extern void
40  struct gapbuf*const io_gap);
41 
42 extern int
44  struct gapbuf*const io_gap,
45  size_t const i_offset);
46 
47 extern int
49  struct gapbuf*const io_gap,
50  size_t const i_offset,
51  unsigned char const i_char);
52 
53 extern int
55  struct gapbuf*const io_gap,
56  size_t const i_offset);
57 
58 extern unsigned char __FAR*
60  size_t* io_offset,
61  struct gapbuf const*const i_gap);
62 
63 extern unsigned char __FAR*
65  size_t* io_offset,
66  struct gapbuf const*const i_gap);
67 
68 extern unsigned char __FAR*
70  size_t* io_offset,
71  struct gapbuf const*const i_gap);
72 
73 extern unsigned char __FAR*
75  size_t* io_offset,
76  struct gapbuf const*const i_gap);
77 
78 extern int
80  struct gapbuf*const io_gap,
81  size_t const i_offset,
82  unsigned char const i_char);
83 
84 extern unsigned char const __FAR*
86  struct gapbuf *const io_gap);
87 
88 extern unsigned char __FAR*
90  struct gapbuf const*const i_gap,
91  size_t const i_offset);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #define __gapbuf_h__
98 #endif
unsigned char __FAR * gapbuf_ptr(struct gapbuf const *const i_gap, size_t const i_offset)
get the text buffer
Definition: gapbuf.c:436
void gapbuf_discharge(struct gapbuf *const io_gap)
release resources held by object
Definition: gapbuf.c:71
size_t m_start
Definition: gapbuf.h:26
int gapbuf_insert(struct gapbuf *const io_gap, size_t const i_offset, unsigned char const i_char)
insert a character
Definition: gapbuf.c:207
unsigned char __FAR * gapbuf_line_next(size_t *io_offset, struct gapbuf const *const i_gap)
move to next line
Definition: gapbuf.c:300
Definition: gapbuf.h:22
unsigned char __FAR * m_block
Definition: gapbuf.h:24
size_t m_end
Definition: gapbuf.h:27
unsigned char __FAR * gapbuf_char_next(size_t *io_offset, struct gapbuf const *const i_gap)
move to next character
Definition: gapbuf.c:265
int gapbuf_overwrite(struct gapbuf *const io_gap, size_t const i_offset, unsigned char const i_char)
overwrite character
Definition: gapbuf.c:357
int gapbuf_backspace(struct gapbuf *const io_gap, size_t const i_offset)
perform a backspace operation
Definition: gapbuf.c:177
unsigned char __FAR * gapbuf_line_prev(size_t *io_offset, struct gapbuf const *const i_gap)
move to previous line
Definition: gapbuf.c:330
int gapbuf_delete(struct gapbuf *const io_gap, size_t const i_offset)
delete a character
Definition: gapbuf.c:245
void gapbuf_assign(struct gapbuf *const o_gap)
initialize gapbuf object
Definition: gapbuf.c:61
size_t m_block_size
Definition: gapbuf.h:25
unsigned char const __FAR * gapbuf_text(struct gapbuf *const io_gap)
get the text buffer
Definition: gapbuf.c:403
unsigned char __FAR * gapbuf_char_prev(size_t *io_offset, struct gapbuf const *const i_gap)
move to previous character
Definition: gapbuf.c:282