MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / main

Function main

strings/uca-dump.c:649–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647
648
649int
650main(int ac, char **av)
651{
652 static MY_UCA uca;
653 size_t level, maxchar= MY_UCA_MAXCHAR;
654 static int pageloaded[MY_UCA_NPAGES];
655
656 memset(&uca, 0, sizeof(uca));
657
658 process_options(ac, av, &uca);
659
660 memset(pageloaded, 0, sizeof(pageloaded));
661
662 load_uca_file(&uca, maxchar, pageloaded);
663
664 /* Now set implicit weights */
665 set_implicit_weights(&uca, maxchar);
666
667
668 printf("#include \"my_uca.h\"\n");
669 printf("\n\n");
670 printf("#define MY_UCA_NPAGES %d\n", MY_UCA_NPAGES);
671 printf("#define MY_UCA_NCHARS %d\n", MY_UCA_NCHARS);
672 printf("#define MY_UCA_CMASK %d\n", MY_UCA_CMASK);
673 printf("#define MY_UCA_PSHIFT %d\n", MY_UCA_PSHIFT);
674 printf("\n\n");
675 printf("/* Created from allkeys.txt. Unicode version '%s'. */\n\n", uca.version);
676
677 for (level= 0; level < nlevels; level++)
678 {
679 size_t page;
680 int pagemaxlen[MY_UCA_NPAGES];
681
682 for (page=0; page < MY_UCA_NPAGES; page++)
683 {
684 size_t maxnum= 0;
685 size_t ndefs= 0;
686
687 pagemaxlen[page]= 0;
688
689 /* Skip this page if no weights were loaded */
690 if (!pageloaded[page])
691 continue;
692
693 /*
694 Calculate number of weights per character
695 and number of default weights.
696 */
697 get_page_statistics(&uca, page, level, &maxnum, &ndefs);
698
699
700 maxnum++; /* For zero terminator */
701
702
703 /*
704 If the page have only default weights
705 then no needs to dump it, skip.
706 */

Callers 1

do_ctype.cFile · 0.70

Calls 8

load_uca_fileFunction · 0.85
set_implicit_weightsFunction · 0.85
get_page_statisticsFunction · 0.85
print_one_pageFunction · 0.85
prefix_nameFunction · 0.85
page_nameFunction · 0.85
print_contractionsFunction · 0.85
process_optionsFunction · 0.70

Tested by

no test coverage detected