blob: 4d5cac2929700f6cfa721d7b39baa949ebb1a721 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* File: editor.h
* Author: camilstaps
*
* Created on August 18, 2015, 11:25 PM
*/
#ifndef EDITOR_H
#define EDITOR_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
unsigned char* start;
unsigned char* end;
} EditorArea;
typedef struct {
EditorArea front;
EditorArea back;
} Editor;
Editor newEditor(unsigned int size);
inline void freeEditor(Editor editor);
inline unsigned int getFreeSpace(Editor editor);
inline unsigned isFull(Editor editor);
unsigned char* getNearCursor(Editor editor, signed int start, signed int end);
void moveCursor(Editor editor, signed int change);
inline void writeAtCursor(Editor editor, unsigned char character);
void writeStringAtCursor(Editor editor, unsigned char* string);
inline void writeAfterCursor(Editor editor, unsigned char character);
void writeStringAfterCursor(Editor editor, unsigned char* string);
inline void deleteAtCursor(Editor editor);
inline void deleteNAtCursor(Editor editor, unsigned int length);
inline void deleteAfterCursor(Editor editor);
inline void deleteNAfterCursor(Editor editor, unsigned int length);
#ifdef __cplusplus
}
#endif
#endif /* EDITOR_H */
|