Rev 6806 | Rev 6819 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6806 | Rev 6818 | ||
---|---|---|---|
Line 85... | Line 85... | ||
85 | } |
85 | } |
86 | 86 | ||
87 | char *acctab="çéèêëúùûüáàâäãóòôöõíìïîñýÇÉÈÊËÚÙÛÜÁÀÂÃÄÓÒÔÖÕÍÌÏÎÑÝ", |
87 | char *acctab="çéèêëúùûüáàâäãóòôöõíìïîñýÇÉÈÊËÚÙÛÜÁÀÂÃÄÓÒÔÖÕÍÌÏÎÑÝ", |
88 | *deatab="ceeeeuuuuaaaaaoooooiiiinyCEEEEUUUUAAAAAOOOOOIIIINY"; |
88 | *deatab="ceeeeuuuuaaaaaoooooiiiinyCEEEEUUUUAAAAAOOOOOIIIINY"; |
89 | 89 | ||
90 | /* fold accented |
90 | /* fold known accented letters to unaccented, other strange characters to space */ |
91 | void deaccent(char *p) |
91 | void deaccent(char *p) |
92 | { |
92 | { |
93 | char *sp; |
93 | char *sp; |
94 | char *v; |
94 | char *v; |
95 | for(sp=p;*sp;sp++) { |
95 | for(sp=p;*sp;sp++) { |
Line 505... | Line 505... | ||
505 | char *p1, *p2, *pp, *q, buf[MAX_LINELEN+1], lbuf[16]; |
505 | char *p1, *p2, *pp, *q, buf[MAX_LINELEN+1], lbuf[16]; |
506 | FILE *f; |
506 | FILE *f; |
507 | 507 | ||
508 | if(module_index(name)) return; |
508 | if(module_index(name)) return; |
509 | towords(indbuf[i_category]); |
509 | towords(indbuf[i_category]); |
- | 510 | /* list the categories (among A=all,X=eXercise,O,D,...) corresponding to this module */ |
|
510 | for(i=catcnt=0;i<catno && catcnt<16;i++) { |
511 | for(i=catcnt=0;i<catno && catcnt<16;i++) { |
511 | if(wordchr(indbuf[i_category],cat[i].name)!=NULL) |
512 | if(wordchr(indbuf[i_category],cat[i].name)!=NULL) |
512 | categories[catcnt++]=cat[i].typ; |
513 | categories[catcnt++]=cat[i].typ; |
513 | } |
514 | } |
514 | if(catcnt==0) return; |
515 | if(catcnt==0) return; |
515 | if(categories[0]!=cat[0].typ) |
516 | if(categories[0]!=cat[0].typ) |
516 | categories[catcnt++]=cat[0].typ; |
517 | categories[catcnt++]=cat[0].typ; |
- | 518 | /* write module's name in the category.language files, for instance lists/X.fr for french exercises */ |
|
517 | for(i=0;i<catcnt;i++) { |
519 | for(i=0;i<catcnt;i++) { |
518 | snprintf(buf,sizeof(buf),"%s/lists/%c.%s", |
520 | snprintf(buf,sizeof(buf),"%s/lists/%c.%s", |
519 | outdir,categories[i],lang[lind]); |
521 | outdir,categories[i],lang[lind]); |
520 | f=fopen(buf,"a"); |
522 | f=fopen(buf,"a"); |
521 | if(f!=NULL) {fprintf(f,"%s\n",name); fclose(f);} |
523 | if(f!=NULL) {fprintf(f,"%s\n",name); fclose(f);} |
522 | } |
524 | } |
- | 525 | /* add serial number and language (resp.title, ...) to corresponding file */ |
|
523 | fprintf(langf,"%d:%s\n",serial,module_language); |
526 | fprintf(langf,"%d:%s\n",serial,module_language); |
524 | fprintf(titf,"%d:%s\n",serial,indbuf[i_title]); |
527 | fprintf(titf,"%d:%s\n",serial,indbuf[i_title]); |
525 | fprintf(descf,"%d:%s\n",serial,indbuf[i_description]); |
528 | fprintf(descf,"%d:%s\n",serial,indbuf[i_description]); |
526 | fprintf(authorf,"%d:%s\n",serial,indbuf[i_author]); |
529 | fprintf(authorf,"%d:%s\n",serial,indbuf[i_author]); |
527 | fprintf(versionf,"%d:%s\n",serial,indbuf[i_version]); |
530 | fprintf(versionf,"%d:%s\n",serial,indbuf[i_version]); |
- | 531 | /* add module's information in html page for robots */ |
|
528 | snprintf(buf,sizeof(buf),"%s",indbuf[i_description]); |
532 | snprintf(buf,sizeof(buf),"%s",indbuf[i_description]); |
529 | for(pp=strchr(buf,','); pp; pp=strchr(pp,',')) |
533 | for(pp=strchr(buf,','); pp; pp=strchr(pp,',')) |
530 | string_modify(buf,pp,pp+1,","); |
534 | string_modify(buf,pp,pp+1,","); |
531 | if(strcmp(module_language,lang[lind])==0) |
535 | if(strcmp(module_language,lang[lind])==0) |
532 | fprintf(robotf,"%s ,%s,%s,%s,%s\n",name,module_language,name, |
536 | fprintf(robotf,"%s ,%s,%s,%s,%s\n",name,module_language,name, |
533 | indbuf[i_title], buf); |
537 | indbuf[i_title], buf); |
- | 538 | /* Normalize the information, using main dictionary bases/sys/words.xx */ |
|
534 | entrycount=mentrycount; dicbuf=mdicbuf; |
539 | entrycount=mentrycount; dicbuf=mdicbuf; |
535 | memmove(entry,mentry,mentrycount*sizeof(entry[0])); |
540 | memmove(entry,mentry,mentrycount*sizeof(entry[0])); |
536 | unknown_type=unk_leave; |
541 | unknown_type=unk_leave; |
537 | for(i=0;i<trcnt;i++) { |
542 | for(i=0;i<trcnt;i++) { |
538 | detag(indbuf[trlist[i]]); |
543 | detag(indbuf[trlist[i]]); |
539 | deaccent(indbuf[trlist[i]]); |
544 | deaccent(indbuf[trlist[i]]); |
540 | singlespace(indbuf[trlist[i]]); |
545 | singlespace(indbuf[trlist[i]]); |
541 | suffix_translate(indbuf[trlist[i]]); |
546 | suffix_translate(indbuf[trlist[i]]); |
542 | translate(indbuf[trlist[i]]); |
547 | translate(indbuf[trlist[i]]); |
543 | } |
548 | } |
- | 549 | /* append words of title */ |
|
544 | taken[0]=0; takenlen=tweight=0; |
550 | taken[0]=0; takenlen=tweight=0; |
545 | ovlstrcpy(buf,indbuf[i_title]); towords(buf); |
551 | ovlstrcpy(buf,indbuf[i_title]); towords(buf); |
546 | for(p1=find_word_start(buf);*p1; |
552 | for(p1=find_word_start(buf);*p1; |
547 | p1=find_word_start(p2)) { |
553 | p1=find_word_start(p2)) { |
548 | p2=find_word_end(p1); if(*p2) *p2++=0; |
554 | p2=find_word_end(p1); if(*p2) *p2++=0; |
549 | appenditem(p1,lind,serial,4,module_language); |
555 | appenditem(p1,lind,serial,4,module_language); |
550 | } |
556 | } |
- | 557 | /* append words of every other information except level */ |
|
551 | snprintf(buf,sizeof(buf),"%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", |
558 | snprintf(buf,sizeof(buf),"%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", |
552 | indbuf[i_description],indbuf[i_keywords], |
559 | indbuf[i_description],indbuf[i_keywords], |
553 | indbuf[i_keywords_ca],indbuf[i_keywords_en],indbuf[i_keywords_fr], |
560 | indbuf[i_keywords_ca],indbuf[i_keywords_en],indbuf[i_keywords_fr], |
554 | indbuf[i_keywords_it],indbuf[i_keywords_nl], |
561 | indbuf[i_keywords_it],indbuf[i_keywords_nl], |
555 | indbuf[i_title_ca],indbuf[i_title_en],indbuf[i_title_fr], |
562 | indbuf[i_title_ca],indbuf[i_title_en],indbuf[i_title_fr], |
Line 559... | Line 566... | ||
559 | for(p1=find_word_start(buf);*p1; |
566 | for(p1=find_word_start(buf);*p1; |
560 | p1=find_word_start(p2)) { |
567 | p1=find_word_start(p2)) { |
561 | p2=find_word_end(p1); if(*p2) *p2++=0; |
568 | p2=find_word_end(p1); if(*p2) *p2++=0; |
562 | appenditem(p1,lind,serial,2,module_language); |
569 | appenditem(p1,lind,serial,2,module_language); |
563 | } |
570 | } |
- | 571 | /* this time the dictionary is the group dictionary sys/wgrp/wgrpwith a g (=global ? general ?), not an m . see below main,suffix,group. |
|
- | 572 | and delete unknown ?? and translate */ |
|
564 | entrycount=gentrycount; dicbuf=gdicbuf; |
573 | entrycount=gentrycount; dicbuf=gdicbuf; |
565 | memmove(entry,gentry,gentrycount*sizeof(entry[0])); |
574 | memmove(entry,gentry,gentrycount*sizeof(entry[0])); |
566 | unknown_type=unk_delete; |
575 | unknown_type=unk_delete; |
- | 576 | /* append words (?) of every other information except level */ |
|
567 | ovlstrcpy(buf,indbuf[i_title]); translate(buf); |
577 | ovlstrcpy(buf,indbuf[i_title]); translate(buf); |
568 | for(p1=find_word_start(buf); *p1; |
578 | for(p1=find_word_start(buf); *p1; |
569 | p1=find_word_start(p2)) { |
579 | p1=find_word_start(p2)) { |
570 | p2=strchr(p1,','); |
580 | p2=strchr(p1,','); |
571 | if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1); |
581 | if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1); |
572 | if(strlen(p1)<=0) continue; |
582 | if(strlen(p1)<=0) continue; |
573 | appenditem(p1,lind,serial,4,module_language); |
583 | appenditem(p1,lind,serial,4,module_language); |
574 | } |
584 | } |
- | 585 | /* append words (?) of every other information except level */ |
|
575 | snprintf(buf,sizeof(buf),"%s, %s, %s, %s, %s, %s, %s, %s", |
586 | snprintf(buf,sizeof(buf),"%s, %s, %s, %s, %s, %s, %s, %s", |
576 | indbuf[i_description],indbuf[i_keywords], |
587 | indbuf[i_description],indbuf[i_keywords], |
577 | indbuf[i_keywords_ca], indbuf[i_keywords_en],indbuf[i_keywords_fr], |
588 | indbuf[i_keywords_ca], indbuf[i_keywords_en],indbuf[i_keywords_fr], |
578 | indbuf[i_keywords_it], indbuf[i_keywords_nl], |
589 | indbuf[i_keywords_it], indbuf[i_keywords_nl], |
579 | indbuf[i_domain]); |
590 | indbuf[i_domain]); |
Line 583... | Line 594... | ||
583 | p2=strchr(p1,','); |
594 | p2=strchr(p1,','); |
584 | if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1); |
595 | if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1); |
585 | if(strlen(p1)<=0) continue; |
596 | if(strlen(p1)<=0) continue; |
586 | appenditem(p1,lind,serial,2,module_language); |
597 | appenditem(p1,lind,serial,2,module_language); |
587 | } |
598 | } |
- | 599 | /* append level information, with weight 2 */ |
|
588 | snprintf(buf,sizeof(buf),"%s",indbuf[i_level]); |
600 | snprintf(buf,sizeof(buf),"%s",indbuf[i_level]); |
589 | ovlstrcpy(lbuf,"level"); |
601 | ovlstrcpy(lbuf,"level"); |
590 | for(p1=buf; *p1; p1++) if(!isalnum(*p1)) *p1=' '; |
602 | for(p1=buf; *p1; p1++) if(!isalnum(*p1)) *p1=' '; |
591 | q=buf+strlen(buf); |
603 | q=buf+strlen(buf); |
592 | for(p1=find_word_start(buf); (*p1) && (p1 < q) ; |
604 | for(p1=find_word_start(buf); (*p1) && (p1 < q) ; |
Line 599... | Line 611... | ||
599 | continue; |
611 | continue; |
600 | *p1=tolower(*p1); |
612 | *p1=tolower(*p1); |
601 | ovlstrcpy(lbuf+strlen("level"),p1); |
613 | ovlstrcpy(lbuf+strlen("level"),p1); |
602 | appenditem(lbuf,lind,serial,2,module_language); |
614 | appenditem(lbuf,lind,serial,2,module_language); |
603 | } |
615 | } |
- | 616 | /* append total weight of module to weight file site2/weight.xx */ |
|
604 | fprintf(weightf,"%d:%d\n",serial,tweight); |
617 | fprintf(weightf,"%d:%d\n",serial,tweight); |
605 | } |
618 | } |
606 | 619 | ||
607 | void modules(void) |
620 | void modules(void) |
608 | { |
621 | { |