/* emblock() -- walk a blocklist, attempting to match emphasis */ static void emblock(MMIOT *f, int first, int last) { int i; for ( i = first; i <= last; i++ ) if ( T(f->Q)[i].b_type != bTEXT ) emmatch(f, i, last); emclose(f, first, last); } /* emblock */
/* emmatch() */ static void emmatch(MMIOT *f, int go) { block *start = &T(f->Q)[go], *end; int e, e2, i, match; while ( start->b_count ) { switch (start->b_count) { case 2: e = empair(f,go,match=2); if ( e != EOF ) break; case 1: e = empair(f,go,match=1); break; default: e = empair(f,go,1); e2= empair(f,go,2); if ( e == EOF || ((e2 != EOF) && (e2 >= e)) ) { e = e2; match = 2; } else match = 1; } if ( e != EOF ) { end = &T(f->Q)[go+e]; emclose(&end->b_post, match); emopen(&start->b_text, match); end->b_count -= match; } else { for (i=0; i < match; i++) EXPAND(start->b_text) = start->b_char; } start->b_count -= match; } }