-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleditor.h
44 lines (36 loc) · 1.15 KB
/
leditor.h
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
#ifndef LEDITOR_H_
#define LEDITOR_H_
#include "charvector.h"
#include "cmdlexer.h"
struct TextLine
{
size_t start, length;
};
struct LineEditor
{
cv_t buffer;
struct LexerResult lexresult;
struct TextLine* lines;
size_t lines_reserved;
size_t lines_count;
unsigned char bSaveResult;
};
int LineEditor_ProcessInput(struct LineEditor* ple, const char* input, size_t len);
int LineEditor_Init(struct LineEditor* le);
void LineEditor_Destroy(struct LineEditor* le);
struct EditorCommand
{
const char* name;
const char* usage;
const char* desc;
int (*cmdfp)(struct LineEditor*, struct LexerResult*);
};
int EditorCmdFormat(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdDelete(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdInsert(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdPrint(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdQuit(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdSave(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdClear(struct LineEditor* pLE, struct LexerResult* plr);
int EditorCmdHelp(struct LineEditor* pLE, struct LexerResult* plr);
#endif