Lines Matching defs:u8c
576 * u8c : pointer to cursor.
583 int utf8ncursor(struct utf8cursor *u8c, const struct utf8data *data,
590 u8c->data = data;
591 u8c->s = s;
592 u8c->p = NULL;
593 u8c->ss = NULL;
594 u8c->sp = NULL;
595 u8c->len = len;
596 u8c->slen = 0;
597 u8c->ccc = STOPPER;
598 u8c->nccc = STOPPER;
600 if (u8c->len != len)
612 * u8c : pointer to cursor.
618 int utf8cursor(struct utf8cursor *u8c, const struct utf8data *data,
621 return utf8ncursor(u8c, data, s, (unsigned int)-1);
626 * Get one byte from the normalized form of the string described by u8c.
630 * The cursor keeps track of the location in the string in u8c->s.
632 * u8c->p, and u8c->s is set to the start of the decomposition. Note
633 * that bytes from a decomposition do not count against u8c->len.
635 * Characters are emitted if they match the current CCC in u8c->ccc.
636 * Hitting end-of-string while u8c->ccc == STOPPER means we're done,
640 * values of u8c->s and u8c->p are stored in u8c->ss and u8c->sp at
642 * emitted and stores it in u8c->nccc, the second pass emits the
648 * u8c->p != NULL -> a decomposition is being scanned.
649 * u8c->ss != NULL -> this is a repeating scan.
650 * u8c->ccc == -1 -> this is the first scan of a repeating scan.
652 int utf8byte(struct utf8cursor *u8c)
659 if (u8c->p && *u8c->s == '\0') {
660 u8c->s = u8c->p;
661 u8c->p = NULL;
665 if (!u8c->p && (u8c->len == 0 || *u8c->s == '\0')) {
667 if (u8c->ccc == STOPPER)
672 } else if ((*u8c->s & 0xC0) == 0x80) {
674 if (!u8c->p)
675 u8c->len--;
676 return (unsigned char)*u8c->s++;
680 if (u8c->p) {
681 leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
683 leaf = utf8nlookup(u8c->data, u8c->hangul,
684 u8c->s, u8c->len);
693 if (utf8agetab[LEAF_GEN(leaf)] > u8c->data->maxage) {
696 u8c->len -= utf8clen(u8c->s);
697 u8c->p = u8c->s + utf8clen(u8c->s);
698 u8c->s = LEAF_STR(leaf);
700 if (*u8c->s == '\0') {
701 if (u8c->ccc == STOPPER)
707 leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
717 if (ccc != STOPPER && u8c->ccc < ccc && ccc < u8c->nccc)
718 u8c->nccc = ccc;
724 if (ccc == u8c->ccc) {
725 if (!u8c->p)
726 u8c->len--;
727 return (unsigned char)*u8c->s++;
732 if (u8c->nccc == STOPPER) {
738 u8c->ccc = MINCCC - 1;
739 u8c->nccc = ccc;
740 u8c->sp = u8c->p;
741 u8c->ss = u8c->s;
742 u8c->slen = u8c->len;
743 if (!u8c->p)
744 u8c->len -= utf8clen(u8c->s);
745 u8c->s += utf8clen(u8c->s);
748 if (!u8c->p)
749 u8c->len -= utf8clen(u8c->s);
750 u8c->s += utf8clen(u8c->s);
751 } else if (u8c->nccc != MAXCCC + 1) {
753 u8c->ccc = u8c->nccc;
754 u8c->nccc = MAXCCC + 1;
755 u8c->s = u8c->ss;
756 u8c->p = u8c->sp;
757 u8c->len = u8c->slen;
760 u8c->ccc = STOPPER;
761 u8c->nccc = STOPPER;
762 u8c->sp = NULL;
763 u8c->ss = NULL;
764 u8c->slen = 0;