diff options
author | Camil Staps | 2015-08-20 22:37:23 +0200 |
---|---|---|
committer | Camil Staps | 2015-08-20 22:46:47 +0200 |
commit | 3056e083d78b6edec6bab1ebac3fa9e3708644d7 (patch) | |
tree | 80dd8334e7a598d4d5080778ed5dcf3b5769392e /firmware/src/editor.h |
Initial commit
Diffstat (limited to 'firmware/src/editor.h')
-rw-r--r-- | firmware/src/editor.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/firmware/src/editor.h b/firmware/src/editor.h new file mode 100644 index 0000000..4d5cac2 --- /dev/null +++ b/firmware/src/editor.h @@ -0,0 +1,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 */ + |