1 ///////////////////////////////////////////////////////////////////////////
2 /*
3   Copyright 2001 Ronald S. Burkey
4 
5   This file is part of GutenMark.
6 
7   GutenMark is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2 of the License, or
10   (at your option) any later version.
11 
12   GutenMark is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16 
17   You should have received a copy of the GNU General Public License
18   along with GutenMark; if not, write to the Free Software
19   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 
21   Filename:	norsk.c
22   Purpose:	Converts Rune Kleveland's Norwegian ispell dictionary to
23   		the single-word-per-line wordlist format required by
24 		GutenMark.  Refer to folk.uio.no/runekl/dictionary.html.
25 		The original wordlist is GPL'd, and is Copyright 2000 by
26 		Rune Kleveland.  Contact runekl@math.uio.no.
27   Mods:		11/09/01 RSB	Began.
28 */
29 ///////////////////////////////////////////////////////////////////////////
30 
31 /*
32   This wordlist has the novel feature that it includes not only diacritical
33   marks, but also soft-hyphens for automatic hyphenation.
34 */
35 
36 #include <stdio.h>
37 #include <string.h>
38 
39 char s[1000], ss[1000], *sss;
40 int i;
41 
42 int
main(int argc,char * argv[])43 main (int argc, char *argv[])
44 {
45   while (NULL != fgets (s, sizeof (s) - 1, stdin))
46     {
47       if (s[0] == '#')
48 	continue;
49       if (1 == sscanf (s, "%s", ss))
50 	{
51 	  for (;;)
52 	    {
53 	      // Replace all hyphens by soft hyphens.
54 	      sss = strstr (ss, "-");
55 	      if (sss == NULL)
56 		break;
57 	      //strcpy (sss, sss + 1);
58 	      *sss = 173;
59 	    }
60 	  for (;;)
61 	    {
62 	      sss = strstr (ss, "\"");
63 	      if (sss == NULL)
64 		break;
65 	      strcpy (sss, sss + 1);
66 	    }
67 	  i = strlen (ss);
68 	  if (i > 4
69 	      && (!strcmp (&ss[i - 4], "xxxx")
70 		  || !strcmp (&ss[i - 4], "yyyy")))
71 	    ss[i - 4] = '\0';
72 	  if (i > 6 && !strcmp (&ss[i - 6], "zyzyzy"))
73 	    ss[i - 6] = '\0';
74 	  puts (ss);
75 	}
76     }
77   return (0);
78 }
79