Lines Matching defs:u8c
413 * u8c : pointer to cursor.
420 int utf8ncursor(struct utf8cursor *u8c, const struct unicode_map *um,
425 u8c->um = um;
426 u8c->n = n;
427 u8c->s = s;
428 u8c->p = NULL;
429 u8c->ss = NULL;
430 u8c->sp = NULL;
431 u8c->len = len;
432 u8c->slen = 0;
433 u8c->ccc = STOPPER;
434 u8c->nccc = STOPPER;
436 if (u8c->len != len)
445 * Get one byte from the normalized form of the string described by u8c.
449 * The cursor keeps track of the location in the string in u8c->s.
451 * u8c->p, and u8c->s is set to the start of the decomposition. Note
452 * that bytes from a decomposition do not count against u8c->len.
454 * Characters are emitted if they match the current CCC in u8c->ccc.
455 * Hitting end-of-string while u8c->ccc == STOPPER means we're done,
459 * values of u8c->s and u8c->p are stored in u8c->ss and u8c->sp at
461 * emitted and stores it in u8c->nccc, the second pass emits the
467 * u8c->p != NULL -> a decomposition is being scanned.
468 * u8c->ss != NULL -> this is a repeating scan.
469 * u8c->ccc == -1 -> this is the first scan of a repeating scan.
471 int utf8byte(struct utf8cursor *u8c)
478 if (u8c->p && *u8c->s == '\0') {
479 u8c->s = u8c->p;
480 u8c->p = NULL;
484 if (!u8c->p && (u8c->len == 0 || *u8c->s == '\0')) {
486 if (u8c->ccc == STOPPER)
491 } else if ((*u8c->s & 0xC0) == 0x80) {
493 if (!u8c->p)
494 u8c->len--;
495 return (unsigned char)*u8c->s++;
499 if (u8c->p) {
500 leaf = utf8lookup(u8c->um, u8c->n, u8c->hangul, u8c->s);
502 leaf = utf8nlookup(u8c->um, u8c->n, u8c->hangul,
503 u8c->s, u8c->len);
512 if (u8c->um->tables->utf8agetab[LEAF_GEN(leaf)] >
513 u8c->um->ntab[u8c->n]->maxage) {
516 u8c->len -= utf8clen(u8c->s);
517 u8c->p = u8c->s + utf8clen(u8c->s);
518 u8c->s = LEAF_STR(leaf);
520 if (*u8c->s == '\0') {
521 if (u8c->ccc == STOPPER)
527 leaf = utf8lookup(u8c->um, u8c->n, u8c->hangul, u8c->s);
537 if (ccc != STOPPER && u8c->ccc < ccc && ccc < u8c->nccc)
538 u8c->nccc = ccc;
544 if (ccc == u8c->ccc) {
545 if (!u8c->p)
546 u8c->len--;
547 return (unsigned char)*u8c->s++;
552 if (u8c->nccc == STOPPER) {
558 u8c->ccc = MINCCC - 1;
559 u8c->nccc = ccc;
560 u8c->sp = u8c->p;
561 u8c->ss = u8c->s;
562 u8c->slen = u8c->len;
563 if (!u8c->p)
564 u8c->len -= utf8clen(u8c->s);
565 u8c->s += utf8clen(u8c->s);
568 if (!u8c->p)
569 u8c->len -= utf8clen(u8c->s);
570 u8c->s += utf8clen(u8c->s);
571 } else if (u8c->nccc != MAXCCC + 1) {
573 u8c->ccc = u8c->nccc;
574 u8c->nccc = MAXCCC + 1;
575 u8c->s = u8c->ss;
576 u8c->p = u8c->sp;
577 u8c->len = u8c->slen;
580 u8c->ccc = STOPPER;
581 u8c->nccc = STOPPER;
582 u8c->sp = NULL;
583 u8c->ss = NULL;
584 u8c->slen = 0;