comparison src/syntax.h @ 91618:400a54e167c9

Use "do...while (0)", not "if (1)..else" in macro definitions.
author Jan Dj?rv <jan.h.d@swipnet.se>
date Thu, 07 Feb 2008 12:46:39 +0000
parents 606f2d163a64
children 29adfc9354e7
comparison
equal deleted inserted replaced
91617:431b8edb4f39 91618:400a54e167c9
254 call. 254 call.
255 Sign of COUNT gives the direction of the search. 255 Sign of COUNT gives the direction of the search.
256 */ 256 */
257 257
258 #define SETUP_SYNTAX_TABLE(FROM, COUNT) \ 258 #define SETUP_SYNTAX_TABLE(FROM, COUNT) \
259 if (1) \ 259 do \
260 { \ 260 { \
261 gl_state.b_property = BEGV; \ 261 gl_state.b_property = BEGV; \
262 gl_state.e_property = ZV + 1; \ 262 gl_state.e_property = ZV + 1; \
263 gl_state.object = Qnil; \ 263 gl_state.object = Qnil; \
264 gl_state.use_global = 0; \ 264 gl_state.use_global = 0; \
267 if (parse_sexp_lookup_properties) \ 267 if (parse_sexp_lookup_properties) \
268 if ((COUNT) > 0 || (FROM) > BEGV) \ 268 if ((COUNT) > 0 || (FROM) > BEGV) \
269 update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\ 269 update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\
270 1, Qnil); \ 270 1, Qnil); \
271 } \ 271 } \
272 else 272 while (0)
273 273
274 /* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. 274 /* Same as above, but in OBJECT. If OBJECT is nil, use current buffer.
275 If it is t, ignore properties altogether. 275 If it is t, ignore properties altogether.
276 276
277 This is meant for regex.c to use. For buffers, regex.c passes arguments 277 This is meant for regex.c to use. For buffers, regex.c passes arguments
278 to the UPDATE_SYNTAX_TABLE macros which are relative to BEGV. 278 to the UPDATE_SYNTAX_TABLE macros which are relative to BEGV.
279 So if it is a buffer, we set the offset field to BEGV. */ 279 So if it is a buffer, we set the offset field to BEGV. */
280 280
281 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \ 281 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \
282 if (1) \ 282 do \
283 { \ 283 { \
284 gl_state.object = (OBJECT); \ 284 gl_state.object = (OBJECT); \
285 if (BUFFERP (gl_state.object)) \ 285 if (BUFFERP (gl_state.object)) \
286 { \ 286 { \
287 struct buffer *buf = XBUFFER (gl_state.object); \ 287 struct buffer *buf = XBUFFER (gl_state.object); \
312 if (parse_sexp_lookup_properties) \ 312 if (parse_sexp_lookup_properties) \
313 update_syntax_table (((FROM) + gl_state.offset \ 313 update_syntax_table (((FROM) + gl_state.offset \
314 + (COUNT > 0 ? 0 : -1)), \ 314 + (COUNT > 0 ? 0 : -1)), \
315 COUNT, 1, gl_state.object); \ 315 COUNT, 1, gl_state.object); \
316 } \ 316 } \
317 else 317 while (0)
318 318
319 struct gl_state_s 319 struct gl_state_s
320 { 320 {
321 Lisp_Object object; /* The object we are scanning. */ 321 Lisp_Object object; /* The object we are scanning. */
322 int start; /* Where to stop. */ 322 int start; /* Where to stop. */