comparison src/gui.h @ 836:5a7843c57316 v7.0e02

updated for version 7.0e02
author vimboss
date Tue, 18 Apr 2006 21:55:01 +0000
parents 23f82b5d2814
children 9f279ebda751
comparison
equal deleted inserted replaced
835:8bebcabccc2c 836:5a7843c57316
502 # define FRD_TYPE_MASK 7 /* Mask for the callback type */ 502 # define FRD_TYPE_MASK 7 /* Mask for the callback type */
503 /* Flags which change the way searching is done. */ 503 /* Flags which change the way searching is done. */
504 # define FRD_WHOLE_WORD 0x08 /* match whole word only */ 504 # define FRD_WHOLE_WORD 0x08 /* match whole word only */
505 # define FRD_MATCH_CASE 0x10 /* match case */ 505 # define FRD_MATCH_CASE 0x10 /* match case */
506 #endif 506 #endif
507
508 #ifdef HAVE_GTK2
509 /*
510 * Convenience macros to convert from 'encoding' to 'termencoding' and
511 * vice versa. If no conversion is necessary the passed-in pointer is
512 * returned as is, without allocating any memory. Thus additional _FREE()
513 * macros are provided. The _FREE() macros also set the pointer to NULL,
514 * in order to avoid bugs due to illegal memory access only happening if
515 * 'encoding' != utf-8...
516 *
517 * Defining these macros as pure expressions looks a bit tricky but
518 * avoids depending on the context of the macro expansion. One of the
519 * rare occasions where the comma operator comes in handy :)
520 *
521 * Note: Do NOT keep the result around when handling control back to
522 * the main Vim! The user could change 'encoding' at any time.
523 */
524 # define CONVERT_TO_UTF8(String) \
525 ((output_conv.vc_type == CONV_NONE || (String) == NULL) \
526 ? (String) \
527 : string_convert(&output_conv, (String), NULL))
528
529 # define CONVERT_TO_UTF8_FREE(String) \
530 ((String) = ((output_conv.vc_type == CONV_NONE) \
531 ? (char_u *)NULL \
532 : (vim_free(String), (char_u *)NULL)))
533
534 # define CONVERT_FROM_UTF8(String) \
535 ((input_conv.vc_type == CONV_NONE || (String) == NULL) \
536 ? (String) \
537 : string_convert(&input_conv, (String), NULL))
538
539 # define CONVERT_FROM_UTF8_FREE(String) \
540 ((String) = ((input_conv.vc_type == CONV_NONE) \
541 ? (char_u *)NULL \
542 : (vim_free(String), (char_u *)NULL)))
543
544 #else
545 # define CONVERT_TO_UTF8(String) (String)
546 # define CONVERT_TO_UTF8_FREE(String) ((String) = (char_u *)NULL)
547 # define CONVERT_FROM_UTF8(String) (String)
548 # define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL)
549 #endif /* HAVE_GTK2 */