UNIXworkcode

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