diff --git a/edit/ChangeLog b/edit/ChangeLog index 1adf6cb92..32dd5eed3 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,5 +1,8 @@ 2002-11-30 Pavel Roskin + * syntax.c: Make structures key_word, context_rule and + _syntax_marker opaque. + * edit.c: Use g_malloc() and g_free() on buffers1 and buffers2. Eliminate CMalloc. (edit_get_buffer_as_text): Remove, it's unused. diff --git a/edit/edit-widget.h b/edit/edit-widget.h index ba9ac9362..10f643213 100644 --- a/edit/edit-widget.h +++ b/edit/edit-widget.h @@ -3,41 +3,32 @@ #include "src/dlg.h" /* Widget */ +#define MAXBUFF 1024 +#define MAX_MACRO_LENGTH 1024 + struct macro { short command; short ch; }; +#define BOOK_MARK_COLOR ((25 << 8) | 5) +#define BOOK_MARK_FOUND_COLOR ((26 << 8) | 4) + +struct _book_mark { + int line; /* line number */ + int c; /* color */ + struct _book_mark *next; + struct _book_mark *prev; +}; + struct syntax_rule { unsigned short keyword; unsigned char end; unsigned char context; unsigned char _context; -#define RULE_ON_LEFT_BORDER 1 -#define RULE_ON_RIGHT_BORDER 2 unsigned char border; }; -/*there are a maximum of ... */ -#define MAXBUFF 1024 -#define MAX_MACRO_LENGTH 1024 - -struct _syntax_marker { - long offset; - struct syntax_rule rule; - struct _syntax_marker *next; -}; - -struct _book_mark { - int line; /* line number */ -/* #define BOOK_MARK_COLOR ((0 << 8) | 26) */ /* black on white */ -#define BOOK_MARK_COLOR ((25 << 8) | 5) -#define BOOK_MARK_FOUND_COLOR ((26 << 8) | 4) - int c; /* colour */ - struct _book_mark *next; - struct _book_mark *prev; -}; - struct WEdit { Widget widget; #define from_here num_widget_lines diff --git a/edit/edit.h b/edit/edit.h index 1ed324786..661f2bafb 100644 --- a/edit/edit.h +++ b/edit/edit.h @@ -116,36 +116,6 @@ struct selection { int len; }; -#define MAX_WORDS_PER_CONTEXT 1024 -#define MAX_CONTEXTS 128 - -struct key_word { - char *keyword; - unsigned char first; - char *whole_word_chars_left; - char *whole_word_chars_right; -#define NO_COLOR 0x7FFFFFFF -#define SPELLING_ERROR 0x7EFEFEFE - int line_start; - int color; -}; - -struct context_rule { - char *left; - unsigned char first_left; - char *right; - unsigned char first_right; - char line_start_left; - char line_start_right; - int between_delimiters; - char *whole_word_chars_left; - char *whole_word_chars_right; - char *keyword_first_chars; - int spelling; -/* first word is word[1] */ - struct key_word **keyword; -}; - struct WEdit; typedef struct WEdit WEdit; diff --git a/edit/syntax.c b/edit/syntax.c index b4c126fb9..8501008cc 100644 --- a/edit/syntax.c +++ b/edit/syntax.c @@ -42,6 +42,43 @@ #define UNKNOWN_FORMAT "unknown" +#define MAX_WORDS_PER_CONTEXT 1024 +#define MAX_CONTEXTS 128 + +#define RULE_ON_LEFT_BORDER 1 +#define RULE_ON_RIGHT_BORDER 2 + +struct key_word { + char *keyword; + unsigned char first; + char *whole_word_chars_left; + char *whole_word_chars_right; + int line_start; + int color; +}; + +struct context_rule { + char *left; + unsigned char first_left; + char *right; + unsigned char first_right; + char line_start_left; + char line_start_right; + int between_delimiters; + char *whole_word_chars_left; + char *whole_word_chars_right; + char *keyword_first_chars; + int spelling; + /* first word is word[1] */ + struct key_word **keyword; +}; + +struct _syntax_marker { + long offset; + struct syntax_rule rule; + struct _syntax_marker *next; +}; + int option_syntax_highlighting = 1; static inline void *syntax_malloc (size_t x)