reacc_bdlex2win.c 2.23 KB
/*  Affiche avec les accents  */

#include <stdio.h>

void accent_mot(ch)
 char *ch;
{
char temp[90000];
int i,n;

for(n=0,i=0;ch[n];n++)
 {
 switch (ch[n+1])
  {
  case '1' :
	switch (ch[n])
	 {
	 case 'e' : temp[i++]='é'; n++; break;
	 case 'E' : temp[i++]='É'; n++; break;
	 default  : { if (ch[n]=='\\') n++; temp[i++]=ch[n]; }
	 }
	break;
  case '2' :
	switch (ch[n])
	 {
	 case 'a' : temp[i++]='ŕ'; n++; break;
	 case 'A' : temp[i++]='Ŕ'; n++; break;
	 case 'e' : temp[i++]='č'; n++; break;
	 case 'E' : temp[i++]='Č'; n++; break;
	 case 'u' : temp[i++]='ů'; n++; break;
	 case 'U' : temp[i++]='Ů'; n++; break;
	 default  : { if (ch[n]=='\\') n++; temp[i++]=ch[n]; }
	 }
	break;
  case '3' :
	switch (ch[n])
	 {
	 case 'a' : temp[i++]='â'; n++; break;
	 case 'A' : temp[i++]='Â'; n++; break;
	 case 'e' : temp[i++]='ę'; n++; break;
	 case 'E' : temp[i++]='Ę'; n++; break;
	 case 'i' : temp[i++]='î'; n++; break;
	 case 'I' : temp[i++]='Î'; n++; break;
	 case 'o' : temp[i++]='ô'; n++; break;
	 case 'O' : temp[i++]='Ô'; n++; break;
	 case 'u' : temp[i++]='ű'; n++; break;
	 case 'U' : temp[i++]='Ű'; n++; break;
	 default  : { if (ch[n]=='\\') n++; temp[i++]=ch[n]; }
	 }
	break;
  case '4' :
	switch (ch[n])
	 {
	 case 'a' : temp[i++]='ä'; n++; break;
	 case 'A' : temp[i++]='Ä'; n++; break;
	 case 'e' : temp[i++]='ë'; n++; break;
	 case 'E' : temp[i++]='Ë'; n++; break;
	 case 'i' : temp[i++]='ď'; n++; break;
	 case 'I' : temp[i++]='Ď'; n++; break;
	 case 'o' : temp[i++]='ö'; n++; break;
	 case 'O' : temp[i++]='Ö'; n++; break;
	 case 'u' : temp[i++]='ü'; n++; break;
	 case 'U' : temp[i++]='Ü'; n++; break;
	 default  : { if (ch[n]=='\\') n++; temp[i++]=ch[n]; }
	 }
	break;
  case '5' :
	switch (ch[n])
	 {
	 case 'c' : temp[i++]='ç'; n++; break;
	 case 'C' : temp[i++]='Ç'; n++; break;
	 default  : { if (ch[n]=='\\') n++; temp[i++]=ch[n]; }
	 }
	break;
  case 'Ć' :
        temp[i++]='Ó'; 
	n++;
	break;
  case '°' :
        temp[i++]='ł'; 
	n++;
	break;
  default  :
	{
 	if ((ch[n]=='\\')&&((ch[n+1]=='\\')||((ch[n+1]>='1')&&(ch[n+1]<='5')))) n++;
 	temp[i++]=ch[n];
	}
  }
 }
temp[i]='\0';
strcpy(ch,temp);
}

int main(argc,argv)
 int argc;
 char **argv;
{
char mot[80000];

while (fgets(mot,80000,stdin))
 {
 accent_mot(mot);
 printf("%s",mot);
 }

return 0;
}