Home | History | Annotate | Download | only in libintl

Lines Matching defs:mo

206  * the code reads in *.mo files generated by GNU gettext.  *.mo is a host-
338 int rv = snprintf(buf, len, "%s/%s/%s/%s.mo", dir, p,
457 mohandle->mo.mo_sysdep_segs[str->segs[i].ref].len;
471 memcpy(dst, mohandle->mo.mo_sysdep_segs[str->segs[i].ref].str,
472 mohandle->mo.mo_sysdep_segs[str->segs[i].ref].len);
473 dst += mohandle->mo.mo_sysdep_segs[str->segs[i].ref].len;
496 setup_sysdep_stuffs(struct mo *mo, struct mohandle *mohandle, char *base)
505 magic = mo->mo_magic;
507 mohandle->mo.mo_sysdep_nsegs = flip(mo->mo_sysdep_nsegs, magic);
508 mohandle->mo.mo_sysdep_nstring = flip(mo->mo_sysdep_nstring, magic);
510 if (mohandle->mo.mo_sysdep_nstring == 0)
514 if (mohandle->mo.mo_hsize <= 2 ||
515 mohandle->mo.mo_hsize <
516 (mohandle->mo.mo_nstring + mohandle->mo.mo_sysdep_nstring))
520 l = sizeof(struct mosysdepsegs_h) * mohandle->mo.mo_sysdep_nsegs;
521 mohandle->mo.mo_sysdep_segs = (struct mosysdepsegs_h *)malloc(l);
522 if (!mohandle->mo.mo_sysdep_segs)
525 stable = (struct moentry *)(base + flip(mo->mo_sysdep_segoff, magic));
526 for (i=0; i<mohandle->mo.mo_sysdep_nsegs; i++) {
528 mohandle->mo.mo_sysdep_segs[i].str =
531 &mohandle->mo.mo_sysdep_segs[i].len);
535 mohandle->mo.mo_sysdep_otable =
536 (struct mosysdepstr_h **)calloc(mohandle->mo.mo_sysdep_nstring,
538 if (!mohandle->mo.mo_sysdep_otable)
541 ofstable = (uint32_t *)(base + flip(mo->mo_sysdep_otable, magic));
542 if (get_sysdep_string_table(mohandle->mo.mo_sysdep_otable, ofstable,
543 mohandle->mo.mo_sysdep_nstring, magic,
546 mohandle->mo.mo_sysdep_ttable =
547 (struct mosysdepstr_h **)calloc(mohandle->mo.mo_sysdep_nstring,
549 if (!mohandle->mo.mo_sysdep_ttable)
552 ofstable = (uint32_t *)(base + flip(mo->mo_sysdep_ttable, magic));
553 if (get_sysdep_string_table(mohandle->mo.mo_sysdep_ttable, ofstable,
554 mohandle->mo.mo_sysdep_nstring, magic,
559 for (i=0; i<mohandle->mo.mo_sysdep_nstring; i++) {
560 if (expand_sysdep(mohandle, mohandle->mo.mo_sysdep_otable[i]))
562 insert_to_hash(mohandle->mo.mo_htable,
563 mohandle->mo.mo_hsize,
564 mohandle->mo.mo_sysdep_otable[i]->expanded,
581 struct mo *mo;
588 mohandle->mo.mo_magic)
634 mo = (struct mo *)mohandle->addr;
637 mohandle->mo.mo_magic = mo->mo_magic;
638 mohandle->mo.mo_revision = flip(mo->mo_revision, magic);
639 mohandle->mo.mo_nstring = flip(mo->mo_nstring, magic);
640 mohandle->mo.mo_hsize = flip(mo->mo_hsize, magic);
641 mohandle->mo.mo_flags = flags;
645 otable = (struct moentry *)(base + flip(mo->mo_otable, magic));
647 ttable = (struct moentry *)(base + flip(mo->mo_ttable, magic));
649 !validate(&otable[mohandle->mo.mo_nstring], mohandle)) {
654 !validate(&ttable[mohandle->mo.mo_nstring], mohandle)) {
660 l = sizeof(struct moentry_h) * mohandle->mo.mo_nstring;
661 mohandle->mo.mo_otable = (struct moentry_h *)malloc(l);
662 if (!mohandle->mo.mo_otable) {
666 mohandle->mo.mo_ttable = (struct moentry_h *)malloc(l);
667 if (!mohandle->mo.mo_ttable) {
671 p = mohandle->mo.mo_otable;
672 for (i = 0; i < mohandle->mo.mo_nstring; i++) {
682 p = mohandle->mo.mo_ttable;
683 for (i = 0; i < mohandle->mo.mo_nstring; i++) {
694 if (mohandle->mo.mo_hsize > 2) {
695 l = sizeof(uint32_t) * mohandle->mo.mo_hsize;
696 mohandle->mo.mo_htable = (uint32_t *)malloc(l);
697 if (!mohandle->mo.mo_htable) {
702 htable = (const uint32_t *)(base+flip(mo->mo_hoffset, magic));
703 for (i=0; i < mohandle->mo.mo_hsize; i++) {
704 mohandle->mo.mo_htable[i] = flip(htable[i], magic);
705 if (mohandle->mo.mo_htable[i] >=
706 mohandle->mo.mo_nstring+1) {
714 mohandle->mo.mo_header = lookup("", db, &headerlen);
715 if (mohandle->mo.mo_header)
716 value = strstr(mohandle->mo.mo_header, "charset=");
720 mohandle->mo.mo_charset = strdup(value + 8);
721 if (!mohandle->mo.mo_charset)
723 char *newline = strchr(mohandle->mo.mo_charset, '\n');
727 if (!mohandle->mo.mo_header ||
728 _gettext_parse_plural(&mohandle->mo.mo_plural,
729 &mohandle->mo.mo_nplurals,
730 mohandle->mo.mo_header, headerlen))
731 mohandle->mo.mo_plural = NULL;
737 * *.mo file encoded by euc-kr (charset=euc-kr), we should reject
738 * the *.mo file as we cannot support it.
742 if ((mohandle->mo.mo_flags & MO_F_SYSDEP) != 0) {
743 if (setup_sysdep_stuffs(mo, mohandle, base)) {
780 free(mohandle->mo.mo_otable);
781 free(mohandle->mo.mo_ttable);
782 free(mohandle->mo.mo_charset);
783 free(mohandle->mo.mo_htable);
784 free(mohandle->mo.mo_sysdep_segs);
785 free_sysdep_table(mohandle->mo.mo_sysdep_otable,
786 mohandle->mo.mo_sysdep_nstring);
787 free_sysdep_table(mohandle->mo.mo_sysdep_ttable,
788 mohandle->mo.mo_sysdep_nstring);
789 _gettext_free_plural(mohandle->mo.mo_plural);
790 memset(&mohandle->mo, 0, sizeof(mohandle->mo));
803 if (mohandle->mo.mo_hsize <= 2 || mohandle->mo.mo_htable == NULL)
807 step = calc_collision_step(hashval, mohandle->mo.mo_hsize);
808 idx = hashval % mohandle->mo.mo_hsize;
811 strno = mohandle->mo.mo_htable[idx];
819 if (len <= mohandle->mo.mo_otable[strno].len &&
820 !strcmp(msgid, mohandle->mo.mo_otable[strno].off)) {
824 mohandle->mo.mo_ttable[strno].len;
825 return mohandle->mo.mo_ttable[strno].off;
830 sysdep_otable = mohandle->mo.mo_sysdep_otable[strno];
831 sysdep_ttable = mohandle->mo.mo_sysdep_ttable[strno];
843 idx = calc_next_index(idx, mohandle->mo.mo_hsize, step);
856 bottom = mohandle->mo.mo_nstring;
866 if ((size_t)middle >= mohandle->mo.mo_nstring)
869 n = strcmp(msgid, mohandle->mo.mo_otable[middle].off);
872 *rlen = mohandle->mo.mo_ttable[middle].len;
873 return (const char *)mohandle->mo.mo_ttable[middle].off;
1000 db->mohandle.mo.mo_magic)
1023 if (db->mohandle.mo.mo_plural) {
1025 _gettext_calculate_plural(db->mohandle.mo.mo_plural, n);
1026 if (plural_index >= db->mohandle.mo.mo_nplurals)
1037 if (db->mohandle.mo.mo_plural)