|
|
@@ -918,79 +918,6 @@ static int ph_sorter(char **a, char **b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void PrintPhonemesUsed(FILE *f, const char *dsource, const char *dictname) |
|
|
|
{ |
|
|
|
int ix; |
|
|
|
PHONEME_TAB *ph; |
|
|
|
PHONEME_TAB *ph_tab[N_PHONEME_TAB]; |
|
|
|
int count = 0; |
|
|
|
int n_ph = 0; |
|
|
|
int section = 0; |
|
|
|
time_t mod_time; |
|
|
|
char fname[sizeof(path_home)+45]; |
|
|
|
struct stat statbuf; |
|
|
|
char time_string[20]; |
|
|
|
const char *files[] = {"rules","list","listx"}; |
|
|
|
|
|
|
|
// find the date-stamp of the dictionary source files |
|
|
|
mod_time = 0; |
|
|
|
for(ix=0; ix<3; ix++) |
|
|
|
{ |
|
|
|
sprintf(fname,"%s%s_%s",dsource, dictname, files[ix]); |
|
|
|
if(stat(fname,&statbuf) == 0) |
|
|
|
{ |
|
|
|
if(statbuf.st_mtime > mod_time) |
|
|
|
mod_time = statbuf.st_mtime; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(mod_time > 0) |
|
|
|
{ |
|
|
|
strftime(time_string, sizeof(time_string), "%Y-%m-%d", localtime(&mod_time)); |
|
|
|
fprintf(f,"\n\nDictionary %s_dict %s\n",dictname, time_string); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
fprintf(f,"\n\nDictionary %s_dict\n",dictname); |
|
|
|
} |
|
|
|
fflush(f); |
|
|
|
|
|
|
|
for(ix=0; (ix<N_PHONEME_TAB) && (phoneme_tab[ix] != NULL); ix++) |
|
|
|
{ |
|
|
|
if(phoneme_tab_flags[ix] & 2) |
|
|
|
{ |
|
|
|
ph_tab[n_ph++] = phoneme_tab[ix]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
qsort((void *)ph_tab,n_ph,sizeof(PHONEME_TAB *),(int (*)(const void *,const void *))ph_sorter); |
|
|
|
|
|
|
|
for(ix=0; ix<n_ph; ix++) |
|
|
|
{ |
|
|
|
ph = ph_tab[ix]; |
|
|
|
|
|
|
|
if(ph->phflags & phDONTLIST) // "dontlist" attribute |
|
|
|
continue; |
|
|
|
|
|
|
|
if(ph->type > 1) |
|
|
|
{ |
|
|
|
if((ph->type > phVOWEL) && (section == 0)) |
|
|
|
{ |
|
|
|
section = 1; |
|
|
|
count = 0; |
|
|
|
fputc('\n',f); |
|
|
|
} |
|
|
|
if((count & 0x7) == 0) |
|
|
|
fputc('\n',f); |
|
|
|
fprintf(f,"%-4s ",WordToString(ph->mnemonic)); |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
|
fputc('\n',f); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void error(const char *format, const char *string) |
|
|
|
{ |
|
|
|
if(string==NULL) |