72 |
#include "struct.h" |
#include "struct.h" |
73 |
|
|
74 |
/* |
/* |
|
** Type of BeginningLine |
|
|
*/ |
|
|
typedef enum e_char_state |
|
|
{ |
|
|
Normal, |
|
|
Comment, |
|
|
CommentAlt, |
|
|
String0, |
|
|
String1 |
|
|
} t_char_state; |
|
|
|
|
|
|
|
|
typedef struct s_Keywords |
|
|
{ |
|
|
struct |
|
|
{ |
|
|
/* Description of this color + '\0' */ |
|
|
gchar Description[MAXLEN_COL_DESCRIPTION + 1]; |
|
|
/* |
|
|
** Keywords list: ' '+"keyword_0"+' '+...+' '+"keyword_n"+' ' |
|
|
** or NULL if not defined |
|
|
*/ |
|
|
gchar *Keywords; |
|
|
} C[MAX_COL]; |
|
|
/* Keywords hash table */ |
|
|
GHashTable *Hash; |
|
|
gint LargestKeyword; |
|
|
gboolean IsDefined; |
|
|
/* Description of this language + '\0' */ |
|
|
gchar Description[MAXLEN_LANG_DESCRIPTION + 1]; |
|
|
/* ' '+list_of_extensions_separated_by_' '+' ' */ |
|
|
gchar *Extensions; |
|
|
gchar *LineComment; |
|
|
gchar *LineCommentAlt; |
|
|
gchar *BlockCommentOn; |
|
|
gchar *BlockCommentOff; |
|
|
gchar *BlockCommentOnAlt; |
|
|
gchar *BlockCommentOffAlt; |
|
|
gboolean IsCaseSensitive; |
|
|
gboolean HaveString; |
|
|
gchar StringChar0; |
|
|
gchar StringChar1; |
|
|
gchar EscapeChar; |
|
|
gchar *Delimiters; |
|
|
/* The following two variables are used for keyword optimization */ |
|
|
gchar IsADelimiter[256]; /* note: this should be made into a bit field */ |
|
|
gchar KeywordStatus[256]; /* bit 0: in a keyword? |
|
|
bit 1: does it start a keyword? |
|
|
bit 2: does it end a keyword? |
|
|
bit 3: is it in a special string (comment/string marker) |
|
|
*/ |
|
|
gchar *IndentString; |
|
|
gchar *UnindentString; |
|
|
gchar *MarkerChars; |
|
|
gchar *FunctionString; |
|
|
gboolean IsHTML; |
|
|
} t_keywords; |
|
|
|
|
|
/* |
|
|
** Structure representing "preferences" such as visual aspect of |
|
|
** text, keywords to be highlighted, UEdit wordfile, ... |
|
|
*/ |
|
|
struct s_Prefs |
|
|
{ |
|
|
/* Beginning of internal datas */ |
|
|
GdkColormap *ColMap; |
|
|
GdkFont *TheFont; |
|
|
t_keywords L[MAX_LANG]; |
|
|
/* End of internal datas */ |
|
|
struct |
|
|
{ |
|
|
struct |
|
|
{ |
|
|
GdkColor Comment; |
|
|
GdkColor CommentAlt; |
|
|
GdkColor String0; |
|
|
GdkColor String1; |
|
|
GdkColor Number; |
|
|
GdkColor C[MAX_COL]; |
|
|
} L[MAX_LANG]; |
|
|
} Colors; |
|
|
/* Number of chars to syhi. In fact, syhi is the feature of Beaver that |
|
|
require the most of CPU time, so this variable is here to adapt the |
|
|
syhi depth in chars: when this limit is reached, syhi stops after |
|
|
the end of current block of chars of same color */ |
|
|
gint SyhiDepth; |
|
|
gboolean AutoCorrection; |
|
|
gboolean AutoIndentation; |
|
|
/* |
|
|
** NOTE_TODO : In a GtkText, after the 2 first tabulations, the 3rd is only |
|
|
** equivalent to 4 spaces. This causes indentation bugs when there are |
|
|
** spaces mixed with tabulations. To fix. |
|
|
*/ |
|
|
gint TabSize; |
|
|
} Prefs; |
|
|
|
|
|
/* |
|
|
** Struct returned by matching_keyword() |
|
|
*/ |
|
|
typedef struct s_match |
|
|
{ |
|
|
gchar *keyword; |
|
|
gint color; |
|
|
//NOTE_REMARK: Added for optimization of matching_keyword |
|
|
gint length; |
|
|
gboolean good_case; |
|
|
} t_match; |
|
|
|
|
|
/* |
|
75 |
** Macros for use with refresh_editor() |
** Macros for use with refresh_editor() |
76 |
*/ |
*/ |
77 |
#define SYHI_AUTODETECT (-1) |
#define SYHI_AUTODETECT (-1) |
84 |
extern void open_file_in_editor(GtkWidget *Editor, |
extern void open_file_in_editor(GtkWidget *Editor, |
85 |
const gchar *Filename, gint CurrentPage); |
const gchar *Filename, gint CurrentPage); |
86 |
extern void refresh_editor(GtkWidget *Editor, gint tos); |
extern void refresh_editor(GtkWidget *Editor, gint tos); |
|
gint guess_lang(void); |
|
|
extern gint read_uedit_wordfile(const gchar *wf_name); |
|
|
gint parse_language_section(gchar *buffer, |
|
|
gint size, |
|
|
gint *start); |
|
|
gint my_g_strcase_equal (gconstpointer v, gconstpointer v2); |
|
|
guint my_g_strcase_hash (gconstpointer key); |
|
|
gint parse_color_section(gchar *buffer, |
|
|
gint size, |
|
|
gint *start, |
|
|
gint Lg); |
|
|
gint parse_line_of_keywords(gchar *buffer, |
|
|
gint size, |
|
|
gint *start, |
|
|
gint Lg, |
|
|
gint col); |
|
|
void text_has_been_inserted(GtkTextBuffer *Buffer, |
|
|
GtkTextIter iter, |
|
|
gchar *Text, |
|
|
gint length, |
|
|
gpointer data); |
|
|
void text_has_been_deleted(GtkTextBuffer *Buffer, |
|
|
GtkTextIter start, |
|
|
GtkTextIter end, |
|
|
gpointer data); |
|
|
|
|
|
void refresh_syhi_on_insert (GtkTextBuffer *Buffer, GtkTextIter *end, gchar *text, |
|
|
gint size, gpointer data); |
|
|
void refresh_syhi_on_delete (GtkTextBuffer *Buffer, GtkTextIter *start, |
|
|
GtkTextIter *end, gpointer data); |
|
|
|
|
87 |
|
|
88 |
gboolean catch_mult_line_indents (GtkWidget *widget, GdkEventKey *event, gpointer data); |
gboolean catch_mult_line_indents (GtkWidget *widget, GdkEventKey *event, gpointer data); |
89 |
|
|
|
void refresh_syhi_all (GtkTextView *View); |
|
|
void expand_syhi_iters (GtkTextBuffer *Buffer, GtkTextIter *start, GtkTextIter *end, gint Lg); |
|
|
|
|
90 |
void auto_indent_on_insert (GtkTextBuffer *Buffer, GtkTextIter *iter, gchar *text, |
void auto_indent_on_insert (GtkTextBuffer *Buffer, GtkTextIter *iter, gchar *text, |
91 |
gint size, gpointer data); |
gint size, gpointer data); |
92 |
void auto_unindent_on_insert (GtkTextBuffer *Buffer, GtkTextIter *iter, gchar *text, |
void auto_unindent_on_insert (GtkTextBuffer *Buffer, GtkTextIter *iter, gchar *text, |
93 |
gint size, gpointer data); |
gint size, gpointer data); |
94 |
|
|
95 |
|
|
|
void matching_keyword(gint Lg, |
|
|
guchar *str, |
|
|
t_match *match); |
|
|
void matching_keyword_case_ext(gint Lg, |
|
|
const guchar *str, |
|
|
t_match *match); |
|
|
|
|
96 |
#endif /* !__EDITOR_H__ */ |
#endif /* !__EDITOR_H__ */ |