comparison src/syntax.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 /* Synched up with: FSF 19.28. */ 21 /* Synched up with: FSF 19.28. */
22 22
23 #ifndef _XEMACS_SYNTAX_H_ 23 #ifndef INCLUDED_syntax_h_
24 #define _XEMACS_SYNTAX_H_ 24 #define INCLUDED_syntax_h_
25 25
26 #include "chartab.h" 26 #include "chartab.h"
27 27
28 /* A syntax table is a type of char table. 28 /* A syntax table is a type of char table.
29 29
70 /* Return the syntax code for a particular character and mirror table. */ 70 /* Return the syntax code for a particular character and mirror table. */
71 71
72 #define SYNTAX_CODE_UNSAFE(table, c) \ 72 #define SYNTAX_CODE_UNSAFE(table, c) \
73 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c)) 73 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c))
74 74
75 INLINE int SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c); 75 INLINE int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c);
76 INLINE int 76 INLINE int
77 SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c) 77 SYNTAX_CODE (Lisp_Char_Table *table, Emchar c)
78 { 78 {
79 return SYNTAX_CODE_UNSAFE (table, c); 79 return SYNTAX_CODE_UNSAFE (table, c);
80 } 80 }
81 81
82 #define SYNTAX_UNSAFE(table, c) \ 82 #define SYNTAX_UNSAFE(table, c) \
83 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177)) 83 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177))
84 84
85 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177)) 85 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
86 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c)) 86 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
87 87
88 INLINE int WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c); 88 INLINE int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c);
89 INLINE int 89 INLINE int
90 WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c) 90 WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c)
91 { 91 {
92 return SYNTAX (table, c) == Sword; 92 return SYNTAX (table, c) == Sword;
93 } 93 }
94 94
95 /* OK, here's a graphic diagram of the format of the syntax values: 95 /* OK, here's a graphic diagram of the format of the syntax values:
168 #define SYNTAX_FIRST_CHAR 0xcc 168 #define SYNTAX_FIRST_CHAR 0xcc
169 #define SYNTAX_SECOND_CHAR_START 0x30 169 #define SYNTAX_SECOND_CHAR_START 0x30
170 #define SYNTAX_SECOND_CHAR_END 0x03 170 #define SYNTAX_SECOND_CHAR_END 0x03
171 #define SYNTAX_SECOND_CHAR 0x33 171 #define SYNTAX_SECOND_CHAR 0x33
172 172
173 #define SYNTAX_START_P(table, a, b) \ 173
174 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) \ 174 /* #### These are now more or less equivalent to
175 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START)) 175 SYNTAX_COMMENT_MATCH_START ...*/
176 176 /* a and b must be first and second start chars for a common type */
177 #define SYNTAX_END_P(table, a, b) \ 177 #define SYNTAX_START_P(table, a, b) \
178 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) \ 178 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \
179 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END)) 179 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
180
181 /* ... and SYNTAX_COMMENT_MATCH_END */
182 /* a and b must be first and second end chars for a common type */
183 #define SYNTAX_END_P(table, a, b) \
184 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \
185 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
180 186
181 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \ 187 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \
182 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \ 188 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \
183 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask))) 189 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask)))
184 190
230 236
231 /* This array, indexed by a character, contains the syntax code which 237 /* This array, indexed by a character, contains the syntax code which
232 that character signifies (as a char). 238 that character signifies (as a char).
233 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */ 239 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
234 240
235 extern CONST unsigned char syntax_spec_code[0400]; 241 extern const unsigned char syntax_spec_code[0400];
236 242
237 /* Indexed by syntax code, give the letter that describes it. */ 243 /* Indexed by syntax code, give the letter that describes it. */
238 244
239 extern CONST unsigned char syntax_code_spec[]; 245 extern const unsigned char syntax_code_spec[];
240 246
241 Lisp_Object scan_lists (struct buffer *buf, int from, int count, 247 Lisp_Object scan_lists (struct buffer *buf, Bufpos from, int count,
242 int depth, int sexpflag, int no_error); 248 int depth, int sexpflag, int no_error);
243 int char_quoted (struct buffer *buf, int pos); 249 int char_quoted (struct buffer *buf, Bufpos pos);
244 250
245 /* NOTE: This does not refer to the mirror table, but to the 251 /* NOTE: This does not refer to the mirror table, but to the
246 syntax table itself. */ 252 syntax table itself. */
247 Lisp_Object syntax_match (Lisp_Object table, Emchar ch); 253 Lisp_Object syntax_match (Lisp_Object table, Emchar ch);
248 254
249 extern int no_quit_in_re_search; 255 extern int no_quit_in_re_search;
250 extern struct buffer *regex_emacs_buffer; 256 extern struct buffer *regex_emacs_buffer;
251 257
252 void update_syntax_table (struct Lisp_Char_Table *ct); 258 void update_syntax_table (Lisp_Char_Table *ct);
253 259
254 #endif /* _XEMACS_SYNTAX_H_ */ 260 #endif /* INCLUDED_syntax_h_ */