⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgw.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
📖 第 1 页 / 共 2 页
字号:
	{"shtu",	L'ʊ'},	{"sidetri",	L'⊲'},	{"sigma",	L'σ'},	{"since",	L'∵'},	{"slge",	L'≥'},		/* should have slanted line under */	{"slle",	L'≤'},		/* should have slanted line under */	{"sm",		L'ˈ'},	{"smm",		L'ˌ'},	{"spade",	L'♠'},	{"sqrt",	L'√'},	{"square",	L'□'},		/* U+25A1 */	{"ssChi",	L'Χ'},		/* should be sans serif */	{"ssIota",	L'Ι'},	{"ssOmicron",	L'Ο'},	{"ssPi",	L'Π'},	{"ssRho",	L'Ρ'},	{"ssSigma",	L'Σ'},	{"ssTau",	L'Τ'},	{"star",	L'*'},	{"stlig",	MLST},	{"sup2",	L'⁲'},	{"supgt",	L'˃'},	{"suplt",	L'˂'},	{"sur",		L'ʳ'},	{"swing",	L'∼'},	{"tau",		L'τ'},	{"taur",	L'♉'},	{"th",		L'þ'},	{"thbar",	L'þ'},		/* +bar */	{"theta",	L'θ'},	{"thinqm",	L'?'},		/* should be thinner */	{"tilde",	LTIL},	{"times",	L'×'},	{"tri",		L'∆'},	{"trli",	L'‖'},	{"ts",		L' '},	{"uacute",	L'ú'},	{"uasper",	MUAS},	{"ubar",	L'u'},		/* +bar */	{"ubreve",	L'ŭ'},	{"ucirc",	L'û'},	{"udA",		L'∀'},	{"udT",		L'⊥'},	{"uda",		L'ɐ'},	{"udh",		L'ɥ'},	{"udqm",	L'¿'},	{"udpsi",	L'⋔'},	{"udtr",	L'∇'},	{"ugrave",	L'ù'},	{"ulenis",	MULN},	{"umacr",	L'ū'},	{"uml",		LUML},	{"undl",	L'ˍ'},		/* underline accent */	{"union",	L'∪'},	{"upsilon",	L'υ'},	{"uuml",	L'ü'},	{"vavpath",	L'ו'},		/* vav U+05D5 (+patah) */	{"vavsheva",	L'ו'},		/* vav U+05D5 (+sheva) */	{"vb",		L'|'},	{"vddd",	L'⋮'},	{"versicle2",	L'℣'},		/* U+2123 */	{"vinc",	L'¯'},	{"virgo",	L'♍'},	{"vpal",	L'ɟ'},	{"vvf",		L'ɣ'},	{"wasper",	MWAS},	{"wavyeq",	L'≈'},	{"wlenis",	MWLN},	{"wyn",		L'ƿ'},		/* wynn U+01BF */	{"xi",		L'ξ'},	{"yacute",	L'ý'},	{"ycirc",	L'ŷ'},	{"ygh",		L'ʒ'},	{"ymacr",	L'y'},		/* +macron */	{"yuml",	L'ÿ'},	{"zced",	L'z'},		/* +cedilla */	{"zeta",	L'ζ'},	{"zh",		L'ʒ'},	{"zhacek",	L'ž'},};/*   The following special characters don't have close enough   equivalents in Unicode, so aren't in the above table.	22n		2^(2^n) Cf Fermat	2on4		2/4	3on8		3/8	Bantuo		Bantu O. Cf Otshi-herero	Car		C with circular arrow on top	albrtime 	cut-time: C with vertical line	ardal		Cf dental	bantuo		Bantu o. Cf Otshi-herero	bbc1		single chem bond below	bbc2		double chem bond below	bbl1		chem bond like /	bbl2		chem bond like //	bbr1		chem bond like \	bbr2		chem bond \\	bcop1		copper symbol. Cf copper	bcop2		copper symbol. Cf copper	benchm		Cf benchmark	btc1		single chem bond above	btc2		double chem bond above	btl1		chem bond like \	btl2		chem bond like \\	btr1		chem bond like /	btr2		chem bond line //	burman		Cf Burman	devph		sanskrit letter. Cf ph	devrfls		sanskrit letter. Cf cerebral	duplong[12]	musical note	egchi		early form of chi	eggamma[12]	early form of gamma	egiota		early form of iota	egkappa		early form of kappa	eglambda	early form of lambda	egmu[12]	early form of mu	egnu[12]	early form of nu	egpi[123]	early form of pi	egrho[12]	early form of rho	egsampi		early form of sampi	egsan		early form of san	egsigma[12]	early form of sigma	egxi[123]	early form of xi	elatS		early form of S	elatc[12]	early form of C	elatg[12]	early form of G	glagjeri	Slavonic Glagolitic jeri	glagjeru	Slavonic Glagolitic jeru	hypolem		hypolemisk (line with underdot)	lhrbr		lower half }	longmord	long mordent	mbwvow		backwards scretched C. Cf retract.	mord		music symbol.  Cf mordent	mostra		Cf direct	ohgcirc		old form of circumflex	oldbeta		old form of β. Cf perturbate	oldsemibr[12]	old forms of semibreve. Cf prolation	ormg		old form of g. Cf G	para[12345]	form of ¶	pauseo		musical pause sign	pauseu		musical pause sign	pharyng		Cf pharyngal	ragr		Black letter ragged r	repetn		musical repeat. Cf retort	segno		musical segno sign	semain[12]	semitic ain	semhe		semitic he	semheth		semitic heth	semkaph		semitic kaph	semlamed[12]	semitic lamed	semmem		semitic mem	semnum		semitic nun	sempe		semitic pe	semqoph[123]	semitic qoph	semresh		semitic resh	semtav[1234]	semitic tav	semyod		semitic yod	semzayin[123]	semitic zayin	shtlong[12]	U with underbar. Cf glyconic	sigmatau	σ,τ combination	squaver		sixteenth note	sqbreve		square musical breve note	swast		swastika	uhrbr		upper half of big }	versicle1		Cf versicle */static Rune normtab[128] = {	/*0*/	/*1*/	/*2*/	/*3*/	/*4*/	/*5*/	/*6*/	/*7*//*00*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	' ',	NONE,	NONE,	NONE,	NONE,	NONE,/*10*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*20*/	L' ',	L'!',	L'"',	L'#',	L'$',	L'%',	SPCS,	L'\'',	L'(',	L')',	L'*',	L'+',	L',',	L'-',	L'.',	L'/',/*30*/  L'0',	L'1',	L'2',	L'3',	L'4',	L'5',	L'6',	L'7',	L'8',	L'9',	L':',	L';',	TAGS,	L'=',	TAGE,	L'?',/*40*/  L'@',	L'A',	L'B',	L'C',	L'D',	L'E',	L'F',	L'G',	L'H',	L'I',	L'J',	L'K',	L'L',	L'M',	L'N',	L'O',/*50*/	L'P',	L'Q',	L'R',	L'S',	L'T',	L'U',	L'V',	L'W',	L'X',	L'Y',	L'Z',	L'[',	L'\\',	L']',	L'^',	L'_',/*60*/	L'`',	L'a',	L'b',	L'c',	L'd',	L'e',	L'f',	L'g',	L'h',	L'i',	L'j',	L'k',	L'l',	L'm',	L'n',	L'o',/*70*/	L'p',	L'q',	L'r',	L's',	L't',	L'u',	L'v',	L'w',	L'x',	L'y',	L'z',	L'{',	L'|',	L'}',	L'~',	NONE,};static Rune phtab[128] = {	/*0*/	/*1*/	/*2*/	/*3*/	/*4*/	/*5*/	/*6*/	/*7*//*00*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*10*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*20*/	L' ',	L'!',	L'ˈ',	L'#',	L'$',	L'ˌ',	L'æ',	L'\'',	L'(',	L')',	L'*',	L'+',	L',',	L'-',	L'.',	L'/',/*30*/  L'0',	L'1',	L'2',	L'ɜ',	L'4',	L'5',	L'6',	L'7',	L'8',	L'ø',	L'ː',	L';',	TAGS,	L'=',	TAGE,	L'?',/*40*/  L'ə',	L'ɑ',	L'B',	L'C',	L'ð',	L'ɛ',	L'F',	L'G',	L'H',	L'ɪ',	L'J',	L'K',	L'L',	L'M',	L'ŋ',	L'ɔ',/*50*/	L'P',	L'ɒ',	L'R',	L'ʃ',	L'θ',	L'ʊ',	L'ʌ',	L'W',	L'X',	L'Y',	L'ʒ',	L'[',	L'\\',	L']',	L'^',	L'_',/*60*/	L'`',	L'a',	L'b',	L'c',	L'd',	L'e',	L'f',	L'g',	L'h',	L'i',	L'j',	L'k',	L'l',	L'm',	L'n',	L'o',/*70*/	L'p',	L'q',	L'r',	L's',	L't',	L'u',	L'v',	L'w',	L'x',	L'y',	L'z',	L'{',	L'|',	L'}',	L'~',	NONE,};static Rune grtab[128] = {	/*0*/	/*1*/	/*2*/	/*3*/	/*4*/	/*5*/	/*6*/	/*7*//*00*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*10*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*20*/	L' ',	L'!',	L'"',	L'#',	L'$',	L'%',	SPCS,	L'\'',	L'(',	L')',	L'*',	L'+',	L',',	L'-',	L'.',	L'/',/*30*/  L'0',	L'1',	L'2',	L'3',	L'4',	L'5',	L'6',	L'7',	L'8',	L'9',	L':',	L';',	TAGS,	L'=',	TAGE,	L'?',/*40*/  L'@',	L'Α',	L'Β',	L'Ξ',	L'Δ',	L'Ε',	L'Φ',	L'Γ',	L'Η',	L'Ι',	L'Ϛ',	L'Κ',	L'Λ',	L'Μ',	L'Ν',	L'Ο',/*50*/	L'Π',	L'Θ',	L'Ρ',	L'Σ',	L'Τ',	L'Υ',	L'V',	L'Ω',	L'Χ',	L'Ψ',	L'Ζ',	L'[',	L'\\',	L']',	L'^',	L'_',/*60*/	L'`',	L'α',	L'β',	L'ξ',	L'δ',	L'ε',	L'φ',	L'γ',	L'η',	L'ι',	L'ς',	L'κ',	L'λ',	L'μ',	L'ν',	L'ο',/*70*/	L'π',	L'θ',	L'ρ',	L'σ',	L'τ',	L'υ',	L'v',	L'ω',	L'χ',	L'ψ',	L'ζ',	L'{',	L'|',	L'}',	L'~',	NONE,};static Rune subtab[128] = {	/*0*/	/*1*/	/*2*/	/*3*/	/*4*/	/*5*/	/*6*/	/*7*//*00*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*10*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*20*/	L' ',	L'!',	L'"',	L'#',	L'$',	L'%',	SPCS,	L'\'',	L'₍',	L'₎',	L'*',	L'₊',	L',',	L'₋',	L'.',	L'/',/*30*/  L'₀',	L'₁',	L'₂',	L'₃',	L'₄',	L'₅',	L'₆',	L'₇',	L'₈',	L'₉',	L':',	L';',	TAGS,	L'₌',	TAGE,	L'?',/*40*/  L'@',	L'A',	L'B',	L'C',	L'D',	L'E',	L'F',	L'G',	L'H',	L'I',	L'J',	L'K',	L'L',	L'M',	L'N',	L'O',/*50*/	L'P',	L'Q',	L'R',	L'S',	L'T',	L'U',	L'V',	L'W',	L'X',	L'Y',	L'Z',	L'[',	L'\\',	L']',	L'^',	L'_',/*60*/	L'`',	L'a',	L'b',	L'c',	L'd',	L'e',	L'f',	L'g',	L'h',	L'i',	L'j',	L'k',	L'l',	L'm',	L'n',	L'o',/*70*/	L'p',	L'q',	L'r',	L's',	L't',	L'u',	L'v',	L'w',	L'x',	L'y',	L'z',	L'{',	L'|',	L'}',	L'~',	NONE,};static Rune suptab[128] = {	/*0*/	/*1*/	/*2*/	/*3*/	/*4*/	/*5*/	/*6*/	/*7*//*00*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*10*/	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,	NONE,/*20*/	L' ',	L'!',	L'"',	L'#',	L'$',	L'%',	SPCS,	L'\'',	L'⁽',	L'⁾',	L'*',	L'⁺',	L',',	L'⁻',	L'.',	L'/',/*30*/  L'⁰',	L'ⁱ',	L'⁲',	L'⁳',	L'⁴',	L'⁵',	L'⁶',	L'⁷',	L'⁸',	L'⁹',	L':',	L';',	TAGS,	L'⁼',	TAGE,	L'?',/*40*/  L'@',	L'A',	L'B',	L'C',	L'D',	L'E',	L'F',	L'G',	L'H',	L'I',	L'J',	L'K',	L'L',	L'M',	L'N',	L'O',/*50*/	L'P',	L'Q',	L'R',	L'S',	L'T',	L'U',	L'V',	L'W',	L'X',	L'Y',	L'Z',	L'[',	L'\\',	L']',	L'^',	L'_',/*60*/	L'`',	L'a',	L'b',	L'c',	L'd',	L'e',	L'f',	L'g',	L'h',	L'i',	L'j',	L'k',	L'l',	L'm',	L'n',	L'o',/*70*/	L'p',	L'q',	L'r',	L's',	L't',	L'u',	L'v',	L'w',	L'x',	L'y',	L'z',	L'{',	L'|',	L'}',	L'~',	NONE,};static int	tagstarts;static char	tag[Buflen];static char	spec[Buflen];static Entry	curentry;#define cursize (curentry.end-curentry.start)static char	*getspec(char *, char *);static char	*gettag(char *, char *);/* * cmd is one of: *    'p': normal print *    'h': just print headwords *    'P': print raw */voidpgwprintentry(Entry e, int cmd){	char *p, *pe;	int t;	long r, rprev, rlig;	Rune *transtab;	p = e.start;	pe = e.end;	transtab = normtab;	rprev = NONE;	changett(0, 0, 0);	curentry = e;	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 == SPCS) {			/* Start of special character name */			p = getspec(p, pe);			r = lookassoc(spectab, asize(spectab), spec);			if(r == -1) {				if(debug)					err("spec %ld %d %s",						e.doff, cursize, spec);				r = L'�';			}			if(r >= LIGS && r < LIGE) {				/* handle possible ligature */				rlig = liglookup(r, 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(r >= MULTI && r < MULTIE) {				if(rprev != NONE) {					outrune(rprev);					rprev = NONE;				}				outrunes(multitab[r-MULTI]);			} else if(r == PAR) {				if(rprev != NONE) {					outrune(rprev);					rprev = NONE;				}				outnl(1);			} else {				if(rprev != NONE) outrune(rprev);				rprev = r;			}		} else if(r == TAGS) {			/* Start of tag name */			if(rprev != NONE) {				outrune(rprev);				rprev = NONE;			}			p = gettag(p, pe);			t = lookassoc(tagtab, asize(tagtab), tag);			if(t == -1) {				if(debug)					err("tag %ld %d %s",						e.doff, cursize, tag);				continue;			}			switch(t){			case Hw:				if(cmd == 'h') {					if(!tagstarts)						outchar(' ');					outinhibit = !tagstarts;				}				break;			case Sn:				if(tagstarts) {					outnl(2);				}				break;			case P:				outnl(tagstarts);				break;			case Col:			case Br:			case Blockquote:				if(tagstarts)					outnl(1);				break;			case U:				outchar('/');			}		}	}	if(cmd == 'h') {		outinhibit = 0;		outnl(0);	}}/* * Return offset into bdict where next webster entry after fromoff starts. * Webster entries start with <p><hw> */longpgwnextoff(long fromoff){	long a, n;	int c;	a = Bseek(bdict, fromoff, 0);	if(a != fromoff)		return -1;	n = 0;	for(;;) {		c = Bgetc(bdict);		if(c < 0)			break;		if(c == '<' && Bgetc(bdict) == 'p' && Bgetc(bdict) == '>') {			c = Bgetc(bdict);			if(c == '<') {				if (Bgetc(bdict) == 'h' && Bgetc(bdict) == 'w' 					&& Bgetc(bdict) == '>')						n = 7;			}else if (c == '{')				n = 4;			if(n)				break;		}	}	return (Boffset(bdict)-n);}static char *prkey ="KEY TO THE PRONUNCIATION\n""\n""I. CONSONANTS\n""b, d, f, k, l, m, n, p, t, v, z: usual English values\n""\n""g as in go (gəʊ)\n""h  ...  ho! (həʊ)\n""r  ...  run (rʌn), terrier (ˈtɛriə(r))\n""(r)...  her (hɜː(r))\n""s  ...  see (siː), success (səkˈsɜs)\n""w  ...  wear (wɛə(r))\n""hw ...  when (hwɛn)\n""j  ...  yes (jɛs)\n""θ  ...  thin (θin), bath (bɑːθ)\n""ð  ...  then (ðɛn), bathe (beɪð)\n""ʃ  ...  shop (ʃɒp), dish (dɪʃ)\n""tʃ ...  chop (tʃɒp), ditch (dɪtʃ)\n""ʒ  ...  vision (ˈvɪʒən), déjeuner (deʒøne)\n""dʒ ...  judge (dʒʌdʒ)\n""ŋ  ...  singing (ˈsɪŋɪŋ), think (θiŋk)\n""ŋg ...  finger (ˈfiŋgə(r))\n""\n""Foreign\n""ʎ as in It. seraglio (serˈraʎo)\n""ɲ  ...  Fr. cognac (kɔɲak)\n""x  ...  Ger. ach (ax), Sc. loch (lɒx)\n""ç  ...  Ger. ich (ɪç), Sc. nicht (nɪçt)\n""ɣ  ...  North Ger. sagen (ˈzaːɣən)\n""c  ...  Afrikaans baardmannetjie (ˈbaːrtmanəci)\n""ɥ  ...  Fr. cuisine (kɥizin)\n""\n""II. VOWELS AND DIPTHONGS\n""\n""Short\n""ɪ as in pit (pɪt), -ness (-nɪs)\n""ɛ  ...  pet (pɛt), Fr. sept (sɛt)\n""æ  ...  pat (pæt)\n""ʌ  ...  putt (pʌt)\n""ɒ  ...  pot (pɒt)\n""ʊ  ...  put (pʊt)\n""ə  ...  another (əˈnʌðə(r))\n""(ə)...  beaten (ˈbiːt(ə)n)\n""i  ...  Fr. si (si)\n""e  ...  Fr. bébé (bebe)\n""a  ...  Fr. mari (mari)\n""ɑ  ...  Fr. bâtiment (bɑtimã)\n""ɔ  ...  Fr. homme (ɔm)\n""o  ...  Fr. eau (o)\n""ø  ...  Fr. peu (pø)\n""œ  ...  Fr. boeuf (bœf), coeur (kœr)\n""u  ...  Fr. douce (dus)\n""ʏ  ...  Ger. Müller (ˈmʏlər)\n""y  ...  Fr. du (dy)\n""\n""Long\n""iː as in bean (biːn)\n""ɑː ...  barn (bɑːn)\n""ɔː ...  born (bɔːn)\n""uː ...  boon (buːn)\n""ɜː ...  burn (bɜːn)\n""eː ...  Ger. Schnee (ʃneː)\n""ɛː ...  Ger. Fähre (ˈfɛːrə)\n""aː ...  Ger. Tag (taːk)\n""oː ...  Ger. Sohn (zoːn)\n""øː ...  Ger. Goethe (gøːtə)\n""yː ...  Ger. grün (gryːn)\n""\n""Nasal\n""ɛ˜, æ˜ as in Fr. fin (fɛ˜, fæ˜)\n""ã  ...  Fr. franc (frã)\n""ɔ˜ ...  Fr. bon (bɔ˜n)\n""œ˜ ...  Fr. un (œ˜)\n""\n""Dipthongs, etc.\n""eɪ as in bay (beɪ)\n""aɪ ...  buy (baɪ)\n""ɔɪ ...  boy (bɔɪ)\n""əʊ ...  no (nəʊ)\n""aʊ ...  now (naʊ)\n""ɪə ...  peer (pɪə(r))\n""ɛə ...  pair (pɛə(r))\n""ʊə ...  tour (tʊə(r))\n""ɔə ...  boar (bɔə(r))\n""\n""III. STRESS\n""\n""Main stress: ˈ preceding stressed syllable\n""Secondary stress: ˌ preceding stressed syllable\n""\n""E.g.: pronunciation (prəˌnʌnsɪˈeɪʃ(ə)n)\n";/* TODO: find transcriptions of foreign consonents, œ, ʏ, nasals */voidpgwprintkey(void){	Bprint(bout, "%s", prkey);}/* * f points just after a '&', fe points at end of entry. * Accumulate the special name, starting after the & * and continuing until the next ';', in spec[]. * Return pointer to char after ';'. */static char *getspec(char *f, char *fe){	char *t;	int c, i;	t = spec;	i = sizeof spec;	while(--i > 0) {		c = *f++;		if(c == ';' || f == fe)			break;		*t++ = c;	}	*t = 0;	return f;}/* * f points just after '<'; fe points at end of entry. * Expect next characters from bin to match: *  [/][^ >]+( [^>=]+=[^ >]+)*> *      tag   auxname auxval * Accumulate the tag and its auxilliary information in * tag[], auxname[][] and auxval[][]. * Set tagstarts=1 if the tag is 'starting' (has no '/'), else 0. * Set naux to the number of aux pairs found. * Return pointer to after final '>'. */static char *gettag(char *f, char *fe){	char *t;	int c, i;	t = tag;	c = *f++;	if(c == '/')		tagstarts = 0;	else {		tagstarts = 1;		*t++ = c;	}	i = Buflen;	while(--i > 0) {		c = *f++;		if(c == '>' || f == fe)			break;		*t++ = c;	}	*t = 0;	return f;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -