home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / GNU / recode-3.4-MIHS / src / txtelat1.l < prev    next >
Encoding:
Text File  |  1994-10-10  |  4.6 KB  |  187 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1989.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful, but
  11.    WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /* Step name: texte_latin1.  */
  21.  
  22. %{
  23.  
  24. void texte_latin1_diaeresis _((void));
  25.  
  26. %}
  27.  
  28. s            (^|[^a-zA-Z])
  29. d            [:"]
  30. l            [a-zA-Z]
  31. %%
  32.  
  33. ``            { output (171); }
  34. ''            { output (187); }
  35.  
  36. A`            { output (192); }
  37. A^            { output (194); }
  38. A{d}/{l}        { if (yytext[1] == diaeresis_char)
  39.                 output (196);
  40.               else
  41.                 ECHO;
  42.             }
  43. a`            { output (224); }
  44. a^            { output (226); }
  45. a{d}/{l}        { if (yytext[1] == diaeresis_char)
  46.                 output (228);
  47.               else
  48.                 ECHO;
  49.             }
  50.  
  51. C\,/[aAoOuU]        { output (199); }
  52. c\,/[aAoOuU]        { output (231); }
  53.  
  54. E`            { output (200); }
  55. E'''            { output (201); output (187); }
  56. E''            { output ('E'); output (187); }
  57. E'            { output (201); }
  58. E^            { output (202); }
  59. E{d}/{l}        { if (yytext[1] == diaeresis_char)
  60.                 output (203);
  61.               else
  62.                 ECHO;
  63.             }
  64. e`            { output (232); }
  65. e'''            { output (233); output (187); }
  66. e''            { output ('e'); output (187); }
  67. e'            { output (233); }
  68. e^            { output (234); }
  69. e{d}/{l}        { if (yytext[1] == diaeresis_char)
  70.                 output (235);
  71.               else
  72.                 ECHO;
  73.             }
  74.  
  75. I`            { output (204); }
  76. I^            { output (206); }
  77. I{d}/{l}        { if (yytext[1] == diaeresis_char)
  78.                 output (207);
  79.               else
  80.                 ECHO;
  81.             }
  82. i`            { output (236); }
  83. i^            { output (238); }
  84. i{d}/{l}        { if (yytext[1] == diaeresis_char)
  85.                 output (239);
  86.               else
  87.                 ECHO;
  88.             }
  89.  
  90. O`            { output (210); }
  91. O^            { output (212); }
  92. O{d}/{l}        { if (yytext[1] == diaeresis_char)
  93.                 output (214);
  94.               else
  95.                 ECHO;
  96.             }
  97. o`            { output (242); }
  98. o^            { output (244); }
  99. o{d}/{l}        { if (yytext[1] == diaeresis_char)
  100.                 output (246);
  101.               else
  102.                 ECHO;
  103.             }
  104.  
  105. U`            { output (217); }
  106. U^            { output (219); }
  107. U{d}/{l}        { if (yytext[1] == diaeresis_char)
  108.                 output (220);
  109.               else
  110.                 ECHO;
  111.             }
  112. u`            { output (249); }
  113. u^            { output (251); }
  114. u{d}/{l}        { if (yytext[1] == diaeresis_char)
  115.                 output (252);
  116.               else
  117.                 ECHO;
  118.             }
  119.  
  120. {s}[Bb]esaigue{d}    { texte_latin1_diaeresis (); }
  121. {s}[Cc]igue{d}        { texte_latin1_diaeresis (); }
  122. {s}[Aa]igue{d}        { texte_latin1_diaeresis (); }
  123. {s}[Aa]mbigue{d}    { texte_latin1_diaeresis (); }
  124. {s}[Cc]ontigue{d}    { texte_latin1_diaeresis (); }
  125. {s}[Ee]xigue{d}        { texte_latin1_diaeresis (); }
  126. {s}[Ss]ubaigue{d}    { texte_latin1_diaeresis (); }
  127. {s}[Ss]uraigue{d}    { texte_latin1_diaeresis (); }
  128. {s}[Aa]i{d}        { texte_latin1_diaeresis (); }
  129. {s}[Cc]ongai{d}        { texte_latin1_diaeresis (); }
  130. {s}[Gg]oi{d}        { texte_latin1_diaeresis (); }
  131. {s}[Hh]ai{d}kai{d}    { if (yytext[4] == diaeresis_char)
  132.                 texte_latin1_diaeresis ();
  133.               else
  134.                 ECHO;
  135.             }
  136. {s}[Ii]noui{d}        { texte_latin1_diaeresis (); }
  137. [JjTtLl]'[Aa][Ii]{d}    { ECHO; }
  138. {s}[Ss]ai{d}        { texte_latin1_diaeresis (); }
  139. {s}[Ss]amurai{d}    { texte_latin1_diaeresis (); }
  140. {s}[Tt]hai{d}        { texte_latin1_diaeresis (); }
  141. {s}[Tt]okai{d}        { texte_latin1_diaeresis (); }
  142. {s}[Cc]anoe{d}        { texte_latin1_diaeresis (); }
  143. {s}Esau{d}        { texte_latin1_diaeresis (); }
  144. %%
  145.  
  146. void
  147. texte_latin1_diaeresis (void)
  148. {
  149.   int counter;
  150.  
  151.   for (counter = 0; counter < yyleng; counter++)
  152.     if (yytext[counter+1] == diaeresis_char)
  153.       {
  154.     switch (yytext[counter])
  155.       {
  156.  
  157.         /* The next "case 'A'" line once triggered a `NULL in input'
  158.            diagnostic in flex.  This astonishing bug has been hard to
  159.            isolate, so I'll leave this comment around for a while.  */
  160.  
  161.       case 'A': output (196); break;
  162.       case 'E': output (203); break;
  163.       case 'I': output (207); break;
  164.       case 'O': output (214); break;
  165.       case 'U': output (220); break;
  166.       case 'a': output (228); break;
  167.       case 'e': output (235); break;
  168.       case 'i': output (239); break;
  169.       case 'o': output (246); break;
  170.       case 'u': output (252); break;
  171.       case 'y': output (255); break;
  172.       default:  output (yytext[counter]);
  173.       }
  174.     counter++;
  175.       }
  176.     else
  177.       output (yytext[counter]);
  178. }
  179.  
  180. void
  181. module_texte_latin1 (void)
  182. {
  183.   declare_step ("Texte", "Latin-1", MANY_TO_ONE, NULL, file_texte_latin1);
  184.  
  185.   declare_alias ("txte", "Texte");
  186. }
  187.