-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstruct.h
More file actions
79 lines (74 loc) · 1.35 KB
/
struct.h
File metadata and controls
79 lines (74 loc) · 1.35 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<sys/ioctl.h>
#include<unistd.h>
#include<stdlib.h>
#include<termios.h>
#include<string.h>
#include<stdio.h>
#include<stdarg.h>
#include<time.h>
#define HL_HIGHLIGHT_NMBERS (1<<0)
#define HLDB_ENTRIES (sizeof(HLDB) / sizeof(HLDB[0]))
#define KILO_QUIT_TIMES 3
#define HL_HIGHLIGHT_STRINGS (1<<1)
#define version "0.0.1"
#define str_INIT {NULL,0}
#define ctrl(k) ((k) & 0x1f)
char *HL_extensions[]={".c",".h",".cpp",NULL};
enum editorKey {
BACKSPACE =127,
ARROW_LEFT = 1000,
ARROW_RIGHT,
ARROW_UP,
ARROW_DOWN,
DEL_KEY,
HOME_KEY,
END_KEY,
PAGE_UP,
PAGE_DOWN,
KILLED=0
};
enum editorHighlight{
HL_NORMAL=0,
HL_STRING,
HL_NUMBER,
HL_MATCH
};
struct editorSyntax{
char *file;
char **filematch;
int flags;
};
typedef struct erow {
int size;
int rsize;
char *chars;
char *render;
unsigned char *hl;
} erow;
struct editorSyntax HLDB[]={
{
"c",
HL_extensions,
HL_HIGHLIGHT_NMBERS | HL_HIGHLIGHT_STRINGS
},
};
typedef struct strBuffer{
char *buffer;
int len;
}strBuffer;
typedef struct editorConfig{
int cx,cy;//cx is posn in the line,without indentation
int rx;//actual posn in line
int rowOffset,colOffset;
int screenRows;
int screenColumns;
char *file;
int numRows;
int dirty;
erow *row;
char status[80];
time_t statusTime;
struct editorSyntax *syntax;
struct termios orig_termios;
}editorConfig;
extern struct editorConfig E;