Ejemplo n.º 1
0
void
slangprintentry(Entry e, int cmd)
{
	char *p, *pe, *vs, *ve;
	long t;

	p = e.start;
	pe = e.end;
	if(cmd == 'h') {
		t = sget(p, pe, &vs, &ve);
		if(t == ME)
			soutpiece(vs, ve);
		outnl(0);
		return;
	}
	while(p < pe) {
		switch(sget(p, pe, &vs, &ve)) {
		case DF:
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		case DX:
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		case ET:
			outchars("[");
			soutpiece(vs, ve);
			outchars("] ");
			break;
		case EX:
			outchars("E.g., ");
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		case LA:
			outchars("(");
			soutpiece(vs, ve);
			outchars(") ");
			break;
		case ME:
			outnl(0);
			soutpiece(vs, ve);
			outnl(0);
			break;
		case NU:
			outnl(2);
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		case PR:
			outchars("[");
			soutpiece(vs, ve);
			outchars("] ");
			break;
		case PS:
			outnl(1);
			soutpiece(vs, ve);
			outchars(". ");
			break;
		case XR:
			outchars("See ");
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		case XX:
			outchars("See ");
			soutpiece(vs, ve);
			outchars(".  ");
			break;
		default:
			ve = pe;	/* will end loop */
			break;
		}
		p = ve;
	}
	outnl(0);
}
Ejemplo n.º 2
0
void
pcollprintentry(Entry e, int cmd)
{
	char *p, *pe;
	long r, rprev, t, rlig;
	int saveoi;
	Rune *transtab;

	p = e.start;
	pe = e.end;
	transtab = normtab;
	rprev = NONE;
	changett(0, 0, 0);
	curentry = e;
	saveoi = 0;
	if(cmd == 'h')
		outinhibit = 1;
	while(p < pe) {
		if(cmd == 'r') {
			outchar(*p++);
			continue;
		}
		r = transtab[(*p++)&0x7F];
		if(r < NONE) {
			/* Emit the rune, but buffer in case of ligature */
			if(rprev != NONE)
				outrune(rprev);
			rprev = r;
		} else if(r == TAGS) {
			p = gettag(p, pe);
			t = lookassoc(tagtab, asize(tagtab), tag);
			if(t == -1) {
				if(debug && !outinhibit)
					err("tag %ld %d %s",
						e.doff, cursize, tag);
				continue;
			}
			if(t < NONE) {
				if(rprev != NONE)
					outrune(rprev);
				rprev = t;
			} else if(t >= LIGS && t < LIGE) {
				/* handle possible ligature */
				rlig = liglookup(t, rprev);
				if(rlig != NONE)
					rprev = rlig;	/* overwrite rprev */
				else {
					/* could print accent, but let's not */
					if(rprev != NONE) outrune(rprev);
					rprev = NONE;
				}
			} else if(t >= MULTI && t < MULTIE) {
				if(rprev != NONE) {
					outrune(rprev);
					rprev = NONE;
				}
				outrunes(multitab[t-MULTI]);
			} else {
				if(rprev != NONE) {
					outrune(rprev);
					rprev = NONE;
				}
				switch(t){
				case H:
					if(cmd == 'h')
						outinhibit = 0;
					else
						outnl(0);
					break;
				case X:
					if(cmd == 'h')
						outinhibit = 1;
					else
						outchars(".  ");
					break;
				case Ps:
					/* don't know enough of pron. key yet */
					saveoi = outinhibit;
					outinhibit = 1;
					break;
				case Pe:
					outinhibit = saveoi;
					break;
				}
			}
		}
	}
	if(cmd == 'h')
		outinhibit = 0;
	outnl(0);
}
Ejemplo n.º 3
0
void
pcollgprintentry(Entry e, int cmd)
{
	uint8_t *p, *pe;
	int r, rprev = NONE, rx, over = 0, font;
	char buf[16];

	p = (uint8_t *)e.start;
	pe = (uint8_t *)e.end;
	curentry = e;
	if(cmd == 'h')
		outinhibit = 1;
	while(p < pe){
		if(cmd == 'r'){
			outchar(*p++);
			continue;
		}
		switch(r = intab[*p++]){	/* assign = */
		case TAGS:
			if(rprev != NONE){
				outrune(rprev);
				rprev = NONE;
			}
			p = reach(p, 0x06);
			font = tag[0];
			if(cmd == 'h')
				outinhibit = (font != 'h');
			break;

		case TAGE:	/* an extra one */
			break;
	
		case SPCS:
			p = reach(p, 0xba);
			r = looknassoc(numtab, asize(numtab), strtol(tag,0,0));
			if(r < 0){
				if(rprev != NONE){
					outrune(rprev);
					rprev = NONE;
				}
				sprint(buf, "\\N'%s'", tag);
				outchars(buf);
				break;
			}
			/* else fall through */

		default:
			if(over){
				rx = looknassoc(overtab, asize(overtab), r);
				if(rx > 0)
					rx = liglookup(rx, rprev);
				if(rx > 0 && rx != NONE)
					outrune(rx);
				else{
					outrune(rprev);
					if(r == ':')
						outrune(L'¨');
					else{
						outrune(L'^');
						outrune(r);
					}
				}
				over = 0;
				rprev = NONE;
			}else if(r == '^'){
				over = 1;
			}else{
				if(rprev != NONE)
					outrune(rprev);
				rprev = r;
			}
		}
		
	}
	if(rprev != NONE)
		outrune(rprev);
	if(cmd == 'h')
		outinhibit = 0;
	outnl(0);
}