1 /*    c_mode.h
2  *
3  *    Copyright (c) 1994-1996, Marko Macek
4  *
5  *    You may distribute under the terms of either the GNU General Public
6  *    License or the Artistic License, as specified in the README file.
7  *
8  */
9 
10 #ifndef C_MODE_H
11 #define C_MODE_H
12 
13 #define CMD_EXT 0x1000  // max 4096 internal commands, check cfte.cpp
14 
15 enum Context_e {
16     CONTEXT_NONE,
17     CONTEXT_FILE,
18     CONTEXT_DIRECTORY,
19     CONTEXT_MESSAGES,
20     CONTEXT_SHELL,
21     CONTEXT_INPUT,
22     CONTEXT_CHOICE,
23     CONTEXT_LIST,
24     CONTEXT_CHAR,
25     CONTEXT_BUFFERS,
26     CONTEXT_ROUTINES, // 10
27     CONTEXT_MAPVIEW,
28     CONTEXT_CVSBASE,
29     CONTEXT_CVS,
30     CONTEXT_CVSDIFF,
31     CONTEXT_SVNBASE,
32     CONTEXT_SVN,
33     CONTEXT_SVNDIFF
34 };
35 
36 typedef unsigned char ChColor;
37 //typedef int ChColor;
38 
39 enum Hilit_e {
40     HILIT_PLAIN,
41     HILIT_C,
42     HILIT_HTML,
43     HILIT_MAKE,
44     HILIT_REXX,
45     HILIT_DIFF,
46     HILIT_IPF,
47     HILIT_PERL,
48     HILIT_MERGE,
49     HILIT_ADA,
50     HILIT_MSG, // 10
51     HILIT_SH,
52     HILIT_PASCAL,
53     HILIT_TEX,
54     HILIT_FTE,
55     HILIT_CATBS,
56     HILIT_SIMPLE // 16
57 };
58 
59 enum Indent_{
60     INDENT_PLAIN,
61     INDENT_C,
62     INDENT_REXX,
63     INDENT_SIMPLE
64 };
65 
66 #define BFI_AutoIndent          0
67 #define BFI_Insert              1
68 #define BFI_DrawOn              2
69 #define BFI_HilitOn             3
70 #define BFI_ExpandTabs          4
71 #define BFI_Trim                5
72 #define BFI_TabSize             6
73 
74 #define BFI_Colorizer           7
75 #define BFI_IndentMode          8
76 
77 #define BFI_ShowTabs            9
78 
79 
80 
81 #define BFI_HardMode           15
82 #define BFI_Undo               16
83 #define BFI_ReadOnly           17
84 #define BFI_AutoSave           18
85 #define BFI_KeepBackups        19
86 #define BFI_MatchCase          22
87 #define BFI_BackSpKillTab      23
88 #define BFI_DeleteKillTab      24
89 #define BFI_BackSpUnindents    25
90 #define BFI_SpaceTabs          26
91 #define BFI_IndentWithTabs     27
92 #define BFI_SeeThruSel         30
93 #define BFI_ShowMarkers        32
94 #define BFI_CursorThroughTabs  33
95 #define BFI_MultiLineHilit     35
96 
97 #define BFI_WordWrap           31
98 #define BFI_LeftMargin         28
99 #define BFI_RightMargin        29
100 
101 
102 #define BFI_LineChar           10
103 #define BFI_StripChar          11
104 #define BFI_AddLF              12
105 #define BFI_AddCR              13
106 #define BFI_ForceNewLine       14
107 #define BFI_LoadMargin         20
108 #define BFI_SaveFolds          34
109 
110 #define BFI_UndoLimit          21
111 
112 #define BFI_AutoHilitParen     36
113 #define BFI_Abbreviations      37
114 #define BFI_BackSpKillBlock    38
115 #define BFI_DeleteKillBlock    39
116 #define BFI_PersistentBlocks   40
117 #define BFI_InsertKillBlock    41
118 #define BFI_EventMap           42
119 #define BFI_UndoMoves          43
120 #define BFI_DetectLineSep      44
121 #define BFI_TrimOnSave         45
122 #define BFI_SaveBookmarks      46
123 #define BFI_HilitTags          47
124 #define BFI_ShowBookmarks      48
125 #define BFI_MakeBackups        49
126 
127 #define BFI_COUNT              50
128 
129 #define BFS_RoutineRegexp       (0 | 256)
130 #define BFS_DefFindOpt          (1 | 256)
131 #define BFS_DefFindReplaceOpt   (2 | 256)
132 #define BFS_CommentStart        (3 | 256)
133 #define BFS_CommentEnd          (4 | 256)
134 #define BFS_FileNameRx          (5 | 256)
135 #define BFS_FirstLineRx         (6 | 256)
136 #define BFS_CompileCommand      (7 | 256)
137 
138 #define BFS_COUNT               8
139 
140 #define BFS_WordChars           (100 | 256) // ext
141 #define BFS_CapitalChars        (101 | 256)
142 
143 #define BFI(y,x) ((y)->Flags.num[(x) & 0xFF])
144 #define BFI_SET(y,x,v) ((y)->Flags.num[(x) & 0xFF]=(v))
145 #define BFS(y,x) ((y)->Flags.str[(x) & 0xFF])
146 
147 #define WSETBIT(x,y,z) \
148     ((x)[(unsigned char)(y) >> 3] = char((z) ? \
149     ((x)[(unsigned char)(y) >> 3] |  (1 << ((unsigned char)(y) & 0x7))) : \
150     ((x)[(unsigned char)(y) >> 3] & ~(1 << ((unsigned char)(y) & 0x7)))))
151 
152 #define WGETBIT(x,y) \
153     (((x)[(unsigned char)(y) / 8] &  (1 << ((unsigned char)(y) % 8))) ? 1 : 0)
154 
155 struct EBufferFlags {
156     int num[BFI_COUNT];
157     char *str[BFS_COUNT];
158     char WordChars[32];
159     char CapitalChars[32];
160 };
161 
162 extern EBufferFlags DefaultBufferFlags;
163 
164 /* globals */
165 #define FLAG_C_Indent            1
166 #define FLAG_C_BraceOfs          2
167 #define FLAG_REXX_Indent         3
168 #define FLAG_ScreenSizeX         6
169 #define FLAG_ScreenSizeY         7
170 #define FLAG_CursorInsertStart   8
171 #define FLAG_CursorInsertEnd     9
172 #define FLAG_CursorOverStart    10
173 #define FLAG_CursorOverEnd      11
174 #define FLAG_SysClipboard       12
175 #define FLAG_ShowHScroll        13
176 #define FLAG_ShowVScroll        14
177 #define FLAG_ScrollBarWidth     15
178 #define FLAG_SelectPathname     16
179 #define FLAG_C_CaseOfs          18
180 #define FLAG_DefaultModeName    19
181 #define FLAG_CompletionFilter   20
182 #define FLAG_ShowMenuBar        22
183 #define FLAG_C_CaseDelta        23
184 #define FLAG_C_ClassOfs         24
185 #define FLAG_C_ClassDelta       25
186 #define FLAG_C_ColonOfs         26
187 #define FLAG_C_CommentOfs       27
188 #define FLAG_C_CommentDelta     28
189 #define FLAG_OpenAfterClose     30
190 #define FLAG_PrintDevice        31
191 #define FLAG_CompileCommand     32
192 #define FLAG_REXX_Do_Offset     33
193 #define FLAG_KeepHistory        34
194 #define FLAG_LoadDesktopOnEntry 35
195 #define FLAG_SaveDesktopOnExit  36
196 #define FLAG_WindowFont         37
197 #define FLAG_KeepMessages       38
198 #define FLAG_ScrollBorderX      39
199 #define FLAG_ScrollBorderY      40
200 #define FLAG_ScrollJumpX        41
201 #define FLAG_ScrollJumpY        42
202 #define FLAG_ShowToolBar        43
203 #define FLAG_GUIDialogs         44
204 #define FLAG_PMDisableAccel     45
205 #define FLAG_SevenBit           46
206 #define FLAG_WeirdScroll        47
207 #define FLAG_LoadDesktopMode    48
208 #define FLAG_HelpCommand        49
209 #define FLAG_C_FirstLevelIndent 50
210 #define FLAG_C_FirstLevelWidth  51
211 #define FLAG_C_Continuation     52
212 #define FLAG_C_ParenDelta       53
213 #define FLAG_FunctionUsesContinuation 54
214 #define FLAG_IgnoreBufferList   55
215 #define FLAG_GUICharacters      56
216 #define FLAG_CvsCommand         57
217 #define FLAG_CvsLogMode         58
218 #define FLAG_ReassignModelIds   59
219 #define FLAG_RecheckReadOnly    60
220 #define FLAG_XShellCommand      61
221 #define FLAG_RGBColor		62
222 #define FLAG_CursorBlink        63
223 #define FLAG_SvnCommand         64
224 #define FLAG_SvnLogMode         65
225 #define FLAG_ShowTildeFilesInDirList 66
226 
227 #define EM_MENUS 2
228 #define EM_MainMenu 0
229 #define EM_LocalMenu 1
230 
231 #define COL_SyntaxParser 1
232 
233 enum Color_e {
234     CLR_Normal,
235     CLR_Keyword,
236     CLR_String,
237     CLR_Comment,
238     CLR_CPreprocessor,
239     CLR_Regexp,
240     CLR_Header,
241     CLR_Quotes,
242     CLR_Number,
243     CLR_HexNumber,
244     CLR_OctalNumber, // 10
245     CLR_FloatNumber,
246     CLR_Function,
247     CLR_Command,
248     CLR_Tag,
249     CLR_Punctuation,
250     CLR_New,
251     CLR_Old,
252     CLR_Changed,
253     CLR_Control,
254     CLR_Separator, // 20
255     CLR_Variable,
256     CLR_Symbol,
257     CLR_Directive,
258     CLR_Label,
259     CLR_Special,
260     CLR_QuoteDelim,
261     CLR_RegexpDelim,
262 
263     COUNT_CLR
264 };
265 
266 #define MATCH_MUST_BOL     0x0001
267 #define MATCH_MUST_BOLW    0x0002
268 #define MATCH_MUST_EOL     0x0004
269 #define MATCH_MUST_EOLW    0x0008
270 #define MATCH_NO_CASE      0x0010
271 #define MATCH_SET          0x0020
272 #define MATCH_NOTSET       0x0040
273 #define MATCH_QUOTECH      0x0100
274 #define MATCH_QUOTEEOL     0x0200
275 #define MATCH_NOGRAB       0x0400
276 #define MATCH_NEGATE       0x0800
277 #define MATCH_TAGASNEXT    0x1000
278 #define MATCH_REGEXP       0x2000
279 
280 #define ACTION_NXSTATE     0x0001
281 
282 #define STATE_NOCASE       0x0001
283 #define STATE_TAGASNEXT    0x0002
284 #define STATE_NOGRAB       0x0004
285 
286 enum MacroVariable {
287     mvFilePath = 1,  /* directory + name + extension */
288     mvFileName,      /* name + extension */
289     mvFileDirectory, /* directory + '/' */
290     mvFileBaseName,  /* without the last extension */
291     mvFileExtension, /* the last one */
292     mvCurDirectory,
293     mvCurRow,
294     mvCurCol,
295     mvChar,
296     mvWord,
297     mvLine,
298     mvFTEVer
299 };
300 
301 #endif // C_MODE_H
302