-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
129 lines (102 loc) · 1.92 KB
/
types.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include <curses.h>
#define QTYPE TCmd
#define TTYPE char
#define STYPE TDLListT
#define LTYPE TTape
#define INFILE "tema1.in"
#define OUTFILE "tema1.out"
// #define debug
// only used for encoding the update commands
enum Commands{
UNDEFINED,
MOVE_LEFT,
MOVE_RIGHT,
SHOW_CURRENT,
SHOW,
UNDO,
REDO,
EXECUTE,
// the ones below have an argument
MOVE_LEFT_CHAR,
MOVE_RIGHT_CHAR,
WRITE,
INSERT_LEFT,
INSERT_RIGHT
};
enum States {
NONE,
INSERT
};
typedef struct cmd {
enum Commands command;
char arg1;
}TCmd;
typedef struct dllq {
struct dllq *prev, *next;
QTYPE value;
} *TDLListQ, TDLCellQ;
typedef struct queue {
TDLListQ head;
TDLListQ tail;
} *TQueue;
typedef struct dllt {
struct dllt *prev, *next;
TTYPE value;
} *TDLListT, TDLCellT;
typedef struct tape {
TDLListT sentry;
} *TTape;
typedef struct dlll {
struct dlll *prev, *next;
LTYPE value;
} *TDLListL, TDLCellL;
typedef struct line {
// for lines
TDLListL sentry;
// for line finger
TDLListL finger;
// for cursor
TDLListT cursor;
TDLListL linepos;
// for the current position
int posx;
int posy;
// for the position where it should be after going down or up
int posline;
} *TLine;
typedef struct lls {
struct lls *next;
STYPE value;
} *TLListS, TLCellS;
typedef struct stack {
TLListS head;
}*TStack;
// used for holding both the undo and redo stacks
// in the same place
typedef struct undoredo {
TStack undo;
TStack redo;
}*TUR;
typedef struct filewindow {
WINDOW *filewin;
WINDOW *linewin;
WINDOW *contentwin;
WINDOW *statewin;
int yMax, xMax;
int yBeg, xBeg;
} FileWindowT;
typedef struct openfile {
FileWindowT FW;
char *filename;
char modified;
char exit;
char focused;
TLine content;
int linepos;
int colpos;
} OpenedFileT;
// typedef struct settings{
// background color
// foreground color
//}