home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume8 / cz / part01 / 78diff.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-01  |  1.9 KB  |  75 lines

  1. /*
  2.  * 78diff - compute trigram score for words
  3.  */
  4.  
  5. #ifndef lint
  6. static char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  7. #endif lint
  8.  
  9. /*
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License version 1,
  12.  * as published by the Free Software Foundation.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  */
  23.  
  24. #include <stdio.h>
  25. #include <howard/port.h>
  26. #include <howard/version.h>
  27. #include <howard/usage.h>
  28.  
  29. MAINVER ("@(#)$Header: 78diff.c,v 1.7 89/08/25 11:45:50 howard Exp $");
  30. USAGE ("encodings trigram-difference-table < word-list");
  31.  
  32. #include <limits.h>
  33. #include <string.h>
  34. #include <howard/a2.h>
  35. #include <howard/malf.h>
  36. #include <howard/registers.i>
  37. #include "cz.h"
  38. #include "78.h"
  39. #include "78code.h"
  40. #include "78common.h"
  41.  
  42. PRIVATE triDifT diftab[TRIMAX + 1]; /* Trigram difference table.*/
  43.  
  44. /* main - main function                            */
  45.  
  46. PUBLIC int main (argc, argv)
  47. int    argc; /* Number of arguments.*/
  48. bStrT *argv; /* Points to array of argument strings.*/
  49.  
  50. /* Function:
  51.  *    
  52.  * Algorithm:
  53.  *    Read each word. Call dif78().
  54.  * Notes:
  55.  *    
  56.  */
  57.  
  58. {
  59. unsigned ln = 0;    /* Input line number.*/
  60. byteT    wb[MLINE]; /* Word buffer.*/
  61.  
  62. if (3 != argc) usage();
  63. ipath();
  64. rdcode (argv[1]);
  65. mrdtri (argv[2], diftab);
  66. while (NULBSTR != getlin (wb, MLINE, stdin, S("Standard input"), &ln, 0))
  67.    PRINTF ("%11d %s\n", dif78 (wb, NULBSTR, diftab), wb);
  68. mfflush (stdout, S("Standard Output"));
  69. exit (SUCCESS);
  70.  
  71. #ifdef lint
  72. return (SUCCESS);
  73. #endif
  74. }
  75.