|
|
1.1 root 1: /* suftabmake.c - make suftab data file for nroff */
2:
3:
4: #include "suftab.c"
5: #include "stdio.h"
6: #define yes 1
7: #define no 0
8:
9:
10: #define deftoc(table, exists) if (exists) {suftoc[suflet++] = filepos; \
11: filepos += sizeof(table); } \
12: else suftoc[suflet++] = 0;
13:
14: #define puttab(table) if (!fwrite(table,sizeof(table),1,fp)) \
15: error("? error writting suftab\n");
16:
17:
18: int suftoc[26]; /* table of contents for all letters */
19: int filepos = 26*sizeof(int); /* current position in suftab */
20: int suflet = 0; /* current letter offset */
21: int nothing;
22:
23:
24: main()
25: { FILE *fp; /* file descriptor */
26:
27: deftoc(sufa, yes)
28: deftoc(nothing, no) /* no b */
29: deftoc(sufc, yes)
30: deftoc(sufd, yes)
31: deftoc(sufe, yes)
32: deftoc(suff, yes)
33: deftoc(sufg, yes)
34: deftoc(sufh, yes)
35: deftoc(sufi, yes)
36: deftoc(nothing, no) /* no j */
37: deftoc(sufk, yes)
38: deftoc(sufl, yes)
39: deftoc(sufm, yes)
40: deftoc(sufn, yes)
41: deftoc(sufo, yes)
42: deftoc(sufp, yes)
43: deftoc(nothing, no) /* no q */
44: deftoc(sufr, yes)
45: deftoc(sufs, yes)
46: deftoc(suft, yes)
47: deftoc(nothing, no) /* no u */
48: deftoc(nothing, no) /* no v */
49: deftoc(nothing, no) /* no w */
50: deftoc(nothing, no) /* no x */
51: deftoc(sufy, yes)
52: deftoc(nothing, no) /* no z */
53:
54:
55: /* produce output file */
56:
57:
58: #ifdef unix
59: if ((fp = fopen("suftab","w")) == NULL)
60: #endif
61: #ifdef ibm
62: if ((fp = fopen("suftab","w,BINARY")) == NULL)
63: #endif
64: error("? can't create suftab\n");
65:
66: if (!fwrite(suftoc,sizeof(suftoc),1,fp))
67: error("? can't write suftab\n");
68:
69: puttab(sufa);
70: puttab(sufc);
71: puttab(sufd);
72: puttab(sufe);
73: puttab(suff);
74: puttab(sufg);
75: puttab(sufh);
76: puttab(sufi);
77: puttab(sufk);
78: puttab(sufl);
79: puttab(sufm);
80: puttab(sufn);
81: puttab(sufo);
82: puttab(sufp);
83: puttab(sufr);
84: puttab(sufs);
85: puttab(suft);
86: puttab(sufy);
87:
88: fclose(fp);
89: }
90:
91: error(spt)
92: char *spt;
93: { register char *p;
94: for (p=spt; (*p && putc(*p,stderr)); p++) ;
95: exit(-1);
96: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.