7 /* Roget's Thesaurus from project Gutenberg */
9 /* static long Last = 0; */
12 rogetprintentry(Entry e, int cmd)
21 while(!isspace((uchar)*p) && p < e.end)
23 while(strncmp(p, " -- ", 4) != 0 && p < e.end){
24 while(isspace((uchar)*p) && p < e.end)
26 if (*p == '[' || *p == '{'){
27 c = (*p == '[')? ']': '}';
28 while(*p != c && p < e.end)
33 if (isdigit((uchar)*p) || ispunct((uchar)*p)){
34 while(!isspace((uchar)*p) && p < e.end)
40 if (isspace((uchar)*p))
48 while(!isspace((uchar)*p) && p < e.end)
54 while(p < e.end && !isspace((uchar)*p))
56 while(p < e.end && isspace((uchar)*p))
60 if (p < e.end -4 && strncmp(p, " -- ", 4) == 0){ /* first line */
66 if (p < e.end -2 && strncmp(p, "[ ", 4) == 0){ /* twiddle layout */
71 if (p < e.end -4 && strncmp(p, "&c (", 4) == 0){ /* usefull xref */
75 while(p < e.end && *p != '(')
78 while(p < e.end && *p != ')')
81 while(p < e.end && isspace((uchar)*p))
83 while(p < e.end && isdigit((uchar)*p))
89 if (p < e.end -3 && strncmp(p, "&c ", 3) == 0){ /* less usefull xref */
90 while(p < e.end && !isdigit((uchar)*p))
92 while(p < e.end && isdigit((uchar)*p))
97 if (*p == '\n' && p < (e.end -1)){ /* their newlines */
100 if (isspace((uchar)*p)){ /* their continuation line */
101 while (isspace((uchar)*p))
109 if (spc && *p != ';' && *p != '.' &&
110 *p != ',' && !isspace((uchar)*p)){ /* drop spaces before punct */
114 if (isspace((uchar)*p))
124 rogetnextoff(long fromoff)
130 Bseek(bdict, fromoff, 0);
131 Brdline(bdict, '\n');
132 while ((p = Brdline(bdict, '\n')) != nil){
134 if (!isdigit((uchar)*p))
136 for (i = 0; i < l-4; i++)
137 if (strncmp(p+i, " -- ", 4) == 0)
138 return Boffset(bdict)-l;
140 return Boffset(bdict);
146 Bprint(bout, "No pronunciation key.\n");