comparison src/os_macosx.m @ 2314:233eb4412f5d vim73

Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
author Bram Moolenaar <bram@vim.org>
date Wed, 14 Jul 2010 19:53:30 +0200
parents 3e4574a4b627
children 2e6dbc2fccd4
comparison
equal deleted inserted replaced
2313:e382b66b936d 2314:233eb4412f5d
542 { 542 {
543 return &last_errno; 543 return &last_errno;
544 } 544 }
545 #endif /* MACOS_X_ICONVEMU */ 545 #endif /* MACOS_X_ICONVEMU */
546 546
547 #ifdef USE_MCH_GETTEXT
548
549 #define GETTEXT_BUFNUM 64
550 #define GETTEXT_BUFSIZE 256
551
552 char *
553 mch_gettext(const char *msgid)
554 {
555 static char buf[GETTEXT_BUFNUM][GETTEXT_BUFSIZE];
556 static int bufnum = 0;
557 const char *msg = NULL;
558 CFStringRef strkey = NULL, strmsg = NULL;
559 CFStringEncoding enc;
560
561 if (!msgid)
562 goto MCH_GETTEXT_FINISH;
563 enc = CFStringGetSystemEncoding();
564 TRACE("mch_gettext(%s)\n", msgid);
565
566 strkey = CFStringCreateWithCString(NULL, msgid, enc);
567 if (!strkey)
568 {
569 TRACE(" Can't create a CFString for msgid.\n");
570 goto MCH_GETTEXT_FINISH;
571 }
572
573 strmsg = CFCopyLocalizedString(strkey, NULL);
574 if (!strmsg)
575 {
576 TRACE(" No localized strings for msgid.\n");
577 goto MCH_GETTEXT_FINISH;
578 }
579
580 msg = CFStringGetCStringPtr(strmsg, enc);
581 if (!msg)
582 {
583 /* This is as backup when CFStringGetCStringPtr was failed */
584 CFStringGetCString(strmsg, buf[bufnum], GETTEXT_BUFSIZE, enc);
585 msg = buf[bufnum];
586 if (++bufnum >= GETTEXT_BUFNUM)
587 bufnum = 0;
588 }
589 TRACE(" Localized to: %s\n", msg);
590
591 MCH_GETTEXT_FINISH:
592 if (strkey)
593 CFRelease(strkey);
594 if (strmsg)
595 CFRelease(strmsg);
596 return (char *)(msg ? msg : msgid);
597 }
598
599 char *
600 mch_bindtextdomain(const char *domain, const char *dirname)
601 {
602 TRACE("mch_bindtextdomain(%s, %s)\n", domain, dirname);
603 return (char*)dirname;
604 }
605
606 char *
607 mch_textdomain(const char *domain)
608 {
609 TRACE("mch_textdomain(%s)\n", domain);
610 return (char*)domain;
611 }
612 #endif
613
614
615
616 #ifdef FEAT_CLIPBOARD 547 #ifdef FEAT_CLIPBOARD
617 548
618 void 549 void
619 clip_mch_lose_selection(VimClipboard *cbd) 550 clip_mch_lose_selection(VimClipboard *cbd)
620 { 551 {