home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / GRECODE / TXTELAT1.L < prev    next >
Text File  |  1993-12-10  |  4KB  |  149 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990, 1993 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}        { output (196); }
  39. a`            { output (224); }
  40. a^            { output (226); }
  41. a{d}/{l}        { output (228); }
  42.  
  43. C\,/[aAoOuU]        { output (199); }
  44. c\,/[aAoOuU]        { output (231); }
  45.  
  46. E`            { output (200); }
  47. E'''            { output (201); output (187); }
  48. E''            { output ('E'); output (187); }
  49. E'            { output (201); }
  50. E^            { output (202); }
  51. E{d}/{l}        { output (203); }
  52. e`            { output (232); }
  53. e'''            { output (233); output (187); }
  54. e''            { output ('e'); output (187); }
  55. e'            { output (233); }
  56. e^            { output (234); }
  57. e{d}/{l}        { output (235); }
  58.  
  59. I`            { output (204); }
  60. I^            { output (206); }
  61. I{d}/{l}        { output (207); }
  62. i`            { output (236); }
  63. i^            { output (238); }
  64. i{d}/{l}        { output (239); }
  65.  
  66. O`            { output (210); }
  67. O^            { output (212); }
  68. O{d}/{l}        { output (214); }
  69. o`            { output (242); }
  70. o^            { output (244); }
  71. o{d}/{l}        { output (246); }
  72.  
  73. U`            { output (217); }
  74. U^            { output (219); }
  75. U{d}/{l}        { output (220); }
  76. u`            { output (249); }
  77. u^            { output (251); }
  78. u{d}/{l}        { output (252); }
  79.  
  80. Y{d}/{l}        { output ('Y'); }
  81. y{d}/{l}        { output (223); }
  82.  
  83. {s}[Bb]esaigue{d}    { texte_latin1_diaeresis (); }
  84. {s}[Cc]igue{d}        { texte_latin1_diaeresis (); }
  85. {s}[Aa]igue{d}        { texte_latin1_diaeresis (); }
  86. {s}[Aa]mbigue{d}    { texte_latin1_diaeresis (); }
  87. {s}[Cc]ontigue{d}    { texte_latin1_diaeresis (); }
  88. {s}[Ee]xigue{d}        { texte_latin1_diaeresis (); }
  89. {s}[Ss]ubaigue{d}    { texte_latin1_diaeresis (); }
  90. {s}[Ss]uraigue{d}    { texte_latin1_diaeresis (); }
  91. {s}[Aa]i{d}        { texte_latin1_diaeresis (); }
  92. {s}[Cc]ongai{d}        { texte_latin1_diaeresis (); }
  93. {s}[Gg]oi{d}        { texte_latin1_diaeresis (); }
  94. {s}[Hh]ai{d}kai{d}    { if (yytext[4] == diaeresis_char)
  95.                 texte_latin1_diaeresis ();
  96.               else
  97.                 ECHO;
  98.             }
  99. {s}[Ii]noui{d}        { texte_latin1_diaeresis (); }
  100. [JjTtLl]'[Aa][Ii]{d}    { ECHO; }
  101. {s}[Ss]ai{d}        { texte_latin1_diaeresis (); }
  102. {s}[Ss]amurai{d}    { texte_latin1_diaeresis (); }
  103. {s}[Tt]hai{d}        { texte_latin1_diaeresis (); }
  104. {s}[Tt]okai{d}        { texte_latin1_diaeresis (); }
  105. {s}[Cc]anoe{d}        { texte_latin1_diaeresis (); }
  106. {s}Esau{d}        { texte_latin1_diaeresis (); }
  107. %%
  108.  
  109. void
  110. texte_latin1_diaeresis (void)
  111. {
  112.   int counter;
  113.  
  114.   for (counter = 0; counter < yyleng; counter++)
  115.     if (yytext[counter+1] == diaeresis_char)
  116.       {
  117.     switch (yytext[counter])
  118.       {
  119.         /* The following #ifdef removes the case 'A': this seemingly
  120.            unrelated line triggers a `NULL in input' diagnostic in flex.
  121.            Would you believe?  */
  122. #if 0
  123.       case 'A': output (196); break;
  124. #endif
  125.       case 'E': output (203); break;
  126.       case 'I': output (207); break;
  127.       case 'O': output (214); break;
  128.       case 'U': output (220); break;
  129.       case 'a': output (228); break;
  130.       case 'e': output (235); break;
  131.       case 'i': output (239); break;
  132.       case 'o': output (246); break;
  133.       case 'u': output (252); break;
  134.       case 'y': output (255); break;
  135.       default:  output (yytext[counter]);
  136.       }
  137.     counter++;
  138.       }
  139.     else
  140.       output (yytext[counter]);
  141. }
  142.  
  143. void
  144. module_texte_latin1 (void)
  145. {
  146.   declare_alias ("txte", "texte");
  147.   declare_step ("texte", "latin1", MANY_TO_ONE, NULL, file_texte_latin1);
  148. }
  149.