Fix our use of $em_tab_dist after it was changed to 0 for 'turned of'.
[nedit.git] / source / highlight.h
blobd635c4e650adb60fc7ff53cd51b6056f588cec56
1 /* $Id: highlight.h,v 1.16 2008/01/04 22:11:03 yooden Exp $ */
2 /*******************************************************************************
3 * *
4 * highlight.h -- Nirvana Editor Syntax Highlighting Header File *
5 * *
6 * Copyright 2003 The NEdit Developers *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
17 * more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * July 31, 2001 *
25 * *
26 *******************************************************************************/
28 #ifndef NEDIT_HIGHLIGHT_H_INCLUDED
29 #define NEDIT_HIGHLIGHT_H_INCLUDED
31 #include "nedit.h"
33 #include <X11/Intrinsic.h>
35 /* Pattern flags for modifying pattern matching behavior */
36 #define PARSE_SUBPATS_FROM_START 1
37 #define DEFER_PARSING 2
38 #define COLOR_ONLY 4
40 /* Don't use plain 'A' or 'B' for style indices, it causes problems
41 with EBCDIC coding (possibly negative offsets when subtracting 'A'). */
42 #define ASCII_A ((char)65)
44 /* Pattern specification structure */
45 typedef struct {
46 char *name;
47 char *startRE;
48 char *endRE;
49 char *errorRE;
50 char *style;
51 char *subPatternOf;
52 int flags;
53 } highlightPattern;
55 /* Header for a set of patterns */
56 typedef struct {
57 char *languageMode;
58 int lineContext;
59 int charContext;
60 int nPatterns;
61 highlightPattern *patterns;
62 } patternSet;
64 void SyntaxHighlightModifyCB(int pos, int nInserted, int nDeleted,
65 int nRestyled, const char *deletedText, void *cbArg);
66 void StartHighlighting(WindowInfo *window, int warn);
67 void StopHighlighting(WindowInfo *window);
68 void AttachHighlightToWidget(Widget widget, WindowInfo *window);
69 void FreeHighlightingData(WindowInfo *window);
70 void RemoveWidgetHighlight(Widget widget);
71 void UpdateHighlightStyles(WindowInfo *window);
72 int TestHighlightPatterns(patternSet *patSet);
73 Pixel AllocateColor(Widget w, const char *colorName);
74 Pixel AllocColor(Widget w, const char *colorName, int *r, int *g, int *b);
75 void* GetHighlightInfo(WindowInfo *window, int pos);
76 highlightPattern *FindPatternOfWindow(WindowInfo *window, char *name);
77 int HighlightCodeOfPos(WindowInfo *window, int pos);
78 int HighlightLengthOfCodeFromPos(WindowInfo *window, int pos, int *checkCode);
79 int StyleLengthOfCodeFromPos(WindowInfo *window, int pos, const char **checkStyleName);
80 char *HighlightNameOfCode(WindowInfo *window, int hCode);
81 char *HighlightStyleOfCode(WindowInfo *window, int hCode);
82 Pixel HighlightColorValueOfCode(WindowInfo *window, int hCode,
83 int *r, int *g, int *b);
84 Pixel GetHighlightBGColorOfCode(WindowInfo *window, int hCode,
85 int *r, int *g, int *b);
87 #endif /* NEDIT_HIGHLIGHT_H_INCLUDED */