Rev 15442 | Rev 15482 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15442 | Rev 15444 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | }; |
49 | }; |
50 | #define allangcnt 8 |
50 | #define allangcnt 8 |
51 | char ignore[MAX_LANGS][MAX_LINELEN+1]; |
51 | char ignore[MAX_LANGS][MAX_LINELEN+1]; |
52 | char mlistfile[MAX_LANGS][256]; |
52 | char mlistfile[MAX_LANGS][256]; |
53 | int langcnt; |
53 | int langcnt; |
54 | FILE *langf, *titf, *descf, *weightf, *robotf, *indf, *listf, *addrf, *serialf, *authorf, *versionf, *remf |
54 | FILE *langf, *titf, *descf, *weightf, *robotf, *indf, *listf, *addrf, *serialf, *authorf, *versionf, *remf; |
55 | 55 | ||
56 | struct cat { |
56 | struct cat { |
57 | char *name; |
57 | char *name; |
58 | char typ; |
58 | char typ; |
59 | } cat[]={ |
59 | } cat[]={ |
Line 311... | Line 311... | ||
311 | void prep(void) |
311 | void prep(void) |
312 | { |
312 | { |
313 | char buf[MAX_LINELEN+1]; |
313 | char buf[MAX_LINELEN+1]; |
314 | char *p1,*p2,*s,*old; |
314 | char *p1,*p2,*s,*old; |
315 | int i,l,thislang,t; |
315 | int i,l,thislang,t; |
316 | modcnt=0; |
316 | modcnt=0; old=""; |
317 | snprintf(buf,sizeof(buf),"%s/addr",outdir); |
317 | snprintf(buf,sizeof(buf),"%s/addr",outdir); |
318 | addrf=fopen(buf,"w"); |
318 | addrf=fopen(buf,"w"); |
319 | if(!addrf) { fprintf(stderr,"modind: error creating output files addr.\n"); exit(1);} |
319 | if(!addrf) { fprintf(stderr,"modind: error creating output files addr.\n"); exit(1);} |
320 | snprintf(buf,sizeof(buf),"%s/serial",outdir); |
320 | snprintf(buf,sizeof(buf),"%s/serial",outdir); |
321 | serialf=fopen(buf,"w"); |
321 | serialf=fopen(buf,"w"); |
322 | if(!serialf) { fprintf(stderr,"modind: error creating output files serial.\n"); exit(1);} |
322 | if(!serialf) { fprintf(stderr,"modind: error creating output files serial.\n"); exit(1);} |
323 | 323 | ||
324 | s=getenv("mlist"); if(s==NULL) exit(1); |
324 | s=getenv("mlist"); if(s==NULL) exit(1); |
325 | l=strlen(s); if(l<0 || l>100*MAX_LINELEN) exit(1); |
325 | l=strlen(s); if(l<0 || l>100*MAX_LINELEN) exit(1); |
326 | mlist=xmalloc(l+16); ovlstrcpy(mlist,s) |
326 | mlist=xmalloc(l+16); ovlstrcpy(mlist,s); |
327 | 327 | ||
328 | for(t=0, p1=find_word_start(mlist); *p1 && modcnt<MAX_MODULES; |
328 | for(t=0, p1=find_word_start(mlist); *p1 && modcnt<MAX_MODULES; |
329 | p1=find_word_start(p2), t++) { |
329 | p1=find_word_start(p2), t++) { |
330 | p2=find_word_end(p1); |
330 | p2=find_word_end(p1); |
331 | l=p2-p1; if(*p2) *p2++=0; |
331 | l=p2-p1; if(*p2) *p2++=0; |
Line 336... | Line 336... | ||
336 | if(l>3 && p1[l-3]=='.') { |
336 | if(l>3 && p1[l-3]=='.') { |
337 | for(i=0;i<langcnt;i++) if(strcasecmp(lang[i],p1+l-2)==0) break; |
337 | for(i=0;i<langcnt;i++) if(strcasecmp(lang[i],p1+l-2)==0) break; |
338 | if(i<langcnt) {p1[l-3]=0; thislang=i;} |
338 | if(i<langcnt) {p1[l-3]=0; thislang=i;} |
339 | else {/* unknown language, not referenced */ |
339 | else {/* unknown language, not referenced */ |
340 | continue; |
340 | continue; |
341 | } |
341 | } |
342 | } |
342 | } |
343 | if(modcnt>0 && strcmp(old,p1)==0 && thislang>=0) { |
343 | if(modcnt>0 && strcmp(old,p1)==0 && thislang>=0) { |
344 | if(mod[modcnt-1].langcnt<langcnt) { |
344 | if(mod[modcnt-1].langcnt<langcnt) { |
345 | mod[modcnt-1].langs[mod[modcnt-1].langcnt]=thislang; |
345 | mod[modcnt-1].langs[mod[modcnt-1].langcnt]=thislang; |
346 | mod[modcnt-1].counts[mod[modcnt-1].langcnt]=t; |
346 | mod[modcnt-1].counts[mod[modcnt-1].langcnt]=t; |
347 | (mod[modcnt-1].langcnt)++; |
347 | (mod[modcnt-1].langcnt)++; |
Line 413... | Line 413... | ||
413 | void gprep(void) |
413 | void gprep(void) |
414 | { |
414 | { |
415 | char buf[MAX_LINELEN+1]; |
415 | char buf[MAX_LINELEN+1]; |
416 | char *p1,*p2,*s,*old; |
416 | char *p1,*p2,*s,*old; |
417 | int l,i,t,thislang; |
417 | int l,i,t,thislang; |
418 | modcnt=0; |
418 | modcnt=0; old=""; |
419 | snprintf(buf,sizeof(buf),"%s/addr",glossaryoutdir); |
419 | snprintf(buf,sizeof(buf),"%s/addr",glossaryoutdir); |
420 | addrf=fopen(buf,"w"); |
420 | addrf=fopen(buf,"w"); |
421 | if(!addrf) { fprintf(stderr,"modind: error creating output files addr.\n"); exit(1);} |
421 | if(!addrf) { fprintf(stderr,"modind: error creating output files addr.\n"); exit(1);} |
422 | snprintf(buf,sizeof(buf),"%s/serial",glossaryoutdir); |
422 | snprintf(buf,sizeof(buf),"%s/serial",glossaryoutdir); |
423 | serialf=fopen(buf,"w"); |
423 | serialf=fopen(buf,"w"); |
Line 983... | Line 983... | ||
983 | if(gentrycount>0) free(gdicbuf); |
983 | if(gentrycount>0) free(gdicbuf); |
984 | if(suffixcnt>0) free(sufbuf); |
984 | if(suffixcnt>0) free(sufbuf); |
985 | if(dentrycount>0) free(ddicbuf); |
985 | if(dentrycount>0) free(ddicbuf); |
986 | fclose(indf); fclose(weightf); |
986 | fclose(indf); fclose(weightf); |
987 | } |
987 | } |
988 | fclose(titf); fclose(descf |
988 | fclose(titf); fclose(descf); fclose(remf); |
989 | } |
989 | } |
990 | 990 | ||
991 | int main() |
991 | int main() |
992 | { |
992 | { |
993 | gentry=xmalloc(entry_size); |
993 | gentry=xmalloc(entry_size); |