|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 2315 (0x90b)
Types: TextFile
Names: »makelex.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Sonnet/makelex.c«
/*
** MAKELEX
** Build lexical dictionary from the input file.
*/
#include "sonnet.h"
#ifndef lint
static char RCS[] =
"$Header: makelex.c,v 2.0 89/02/08 16:30:16 rsalz Release1 $";
#endif /* lint */
/*
** Process one file.
*/
static void
Process(name, F)
char *name;
register FILE *F;
{
register char *p;
register int i;
char buff[128];
Printf("\t/* Input: %s */\n", name);
while (fgets(buff, sizeof buff, F)) {
/* Blank lines and line beginning with a pound sign are comments. */
if (buff[0] == '\n' || buff[0] == '#')
continue;
/* Make isn't truncated. */
if ((p = IDX(buff, '\n')) == NULL) {
Fprintf(stderr, "Line too long, skipped:\n\t%s\n", buff);
continue;
}
*p = '\0';
/* Make sure it's well-formed. */
for (i = 0, p = buff; *p; p++)
if (*p == ':')
i++;
if (i != 3) {
Fprintf(stderr, "Badly-formed line, skipped:\n\t%s\n", buff);
continue;
}
/* First field is the actual word. */
Printf(" {\t\"");
for (i = 3, p = buff; *p != ':'; p++, i++)
(void)putchar(*p);
/* Second field is the foot type. */
Printf("\",\t%s 0, FT_", i < 8 ? "\t" : "");
while (*++p != ':')
(void)putchar(*p);
/* Third word is the vowel sound. */
Printf(", VS_");
while (*++p != ':')
(void)putchar(*p);
/* Fourth field is the consonant sound. */
Printf(", ");
if (*++p == '\0')
(void)putchar('0');
else if (isdigit(*p))
(void)putchar(*p);
else if (islower(*p))
Printf("'%c'", *p);
else
Printf("CS_%s", p);
Printf("\t},\n");
}
}
main(ac, av)
int ac;
char *av[];
{
register FILE *F;
/* Print prolog. */
Printf("/*\n");
Printf("** DICTIONARY -- DO NOT EDIT THIS FILE!\n");
Printf("** This file is generated by a program. To edit the word\n");
Printf("** list, edit the data files then run make.\n");
Printf("*/\n");
Printf("\n");
Printf("WORDTYPE Words[] = {\n");
/* Munch munch. */
if (ac == 1)
Process("standard input", stdin);
else
while (*++av)
if ((F = fopen(*av, "r")) == NULL)
Fprintf(stderr, "Can't open \"%s\" for input.\n", *av);
else{
Process(*av, F);
(void)fclose(F);
}
/* Epilog. */
Printf(" { NULL }\n");
Printf("};\n");
/* That's all she wrote. */
exit(0);
}