root/staslova.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /*
   2  *   Compound Text word statistics and search report
   3  *
   4  *   staslova.c : statistics & matching main
   5  *
   6  *                                       Copyright (c) isao yasuda,1998 
   7  */
   8 static char *rcs_id = "$Id: staslova.c,v 1.2 2007/09/09 11:14:33 isao Exp $";
   9 
  10 #include <stdio.h>
  11 #include <string.h>
  12 #include "staslova.h"
  13 #include "table.h"
  14 
  15 int
  16 main(int argc, char **argv)
  17 {
  18         unsigned char *word;
  19         struct cdent **cdp = cdtbl;
  20         char *pn = *argv;
  21         int i, rtn;
  22 
  23         /* omit `/' from program name */
  24         if ((pn = (char *)strrchr(pn, '/')) != NULL)
  25                 pn++;
  26         else
  27                 pn = *argv;
  28         /* start message */
  29         fprintf(stderr, "%s %s\n", pn, ver);
  30         printf("***** %s %s\n", pn, ver);
  31         /* extend user's option and difinitions */
  32         if (rtn = extender(argc, argv)) {
  33                 print_usage(pn);
  34                 return rtn;
  35         }
  36 
  37         /* while there are words process statistics & matching */
  38         wdcount = 0;
  39         while ((word = fetchword()) != NULL) {
  40                 if (casemode == '0')
  41                         (unsigned char *)mlchrlower(word+2);
  42                 /* if (task & STAT) */
  43                 statisticsctrl(word);
  44                 if (task & MTCT)
  45                         matchingctrl(word);
  46         }
  47 
  48         /* statistics report : print trees of all words by languages */
  49         if (task & STAT) 
  50                 for (i=0; i < 3; i++) {
  51                         printf("***** %s word statistics report <%s>\n", pn, langname[i]);
  52                         wdtotal = wdnum = 0;
  53                         printwdtree(langroot[i], STAT);
  54                         printf("***** %d total statistics of %d words. <%s>\n", 
  55                                    wdtotal, wdnum, langname[i]); 
  56                         printf("\n");
  57                 }
  58 
  59         /* matching test report : print condition table and matched words tree */
  60         if (task & MTCT)
  61                 while (*cdp != NULL) {
  62                         printf("***** %s matching test report\n", pn);
  63                         printcdtable(*cdp);
  64                         if (outmode > '0') {
  65                                 wdtotal = wdnum = 0;
  66                                 printwdtree((*cdp)->mwdroot, MTCT);
  67                                 printf("***** %d total statistics of %d words.\n", 
  68                                            wdtotal, wdnum); 
  69                         }
  70                         printf("\n");
  71                         cdp++;
  72                 }
  73 
  74         /* ending message */
  75         fprintf(stderr,"processed %d lines.\n", --lno);
  76         return 0;
  77 }
  78 
  79 
  80 
  81 

/* [previous][next][first][last][top][bottom][index][help] */