summaryrefslogtreecommitdiff
path: root/english2uryuomoco.c
blob: a7f5cfa0df055e7f5992b76160e6845ff176aaae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <stdio.h>
#include <ctype.h>

// english to uryuomoco
//          abcdefghijklmnopqrstuvwxyz
char trl[]="uvs.ohtf.dprnmekwlcgab.zix";

/*
 * a->u
 * b->v
 * c->s
 * ch->se	h
 * d->ja
 * e->o
 * f->h
 * g->t
 * gr->tul	r
 * h->f
 * i->yu	i?
 * ing ->ot	in
 * j->d
 * k->p
 * l->r
 * ll->ra	l
 * m->n
 * n->m
 * no ->meh
 * o->e
 * p->k
 * qu->w	u
 * r->l
 * s->c		s?
 * sh->us	sh
 * ss->ais	ss
 * t->g 	t?
 * th->ch	th
 * ts->gis	ts
 * u->a
 * v->b
 * w->qu
 * wh->quo	h
 * x->z
 * y->i
 * z->x
 */

int tr(int);

int ing(){ // i
	int c=getchar();
	if(c=='n'){ // in
		c=getchar();
		if(c=='g'){ // ing
			c=getchar();
			if(!islower(c)){ // ing.
				putchar('o');
				putchar('t');
				return putchar(c);
			}else{ // ing-
				putchar('y');
				putchar('u');
				putchar('m');
				putchar('t');
			}
		}else{ //in-
			putchar('y');
			putchar('u');
			putchar('m');
		}
	}else{ // i-
		putchar('y');
		putchar('u');
	}
	return tr(c);
}


int tr(int c){
	int retval;
	static int prev=0;
	if(islower(c)){
		switch(c){
			case 'd': putchar('j'); retval=putchar('a'); break; // d -> ja
			case 'i': retval=ing(); break;
			case 'u': if(prev!='q') retval=putchar('a'); break; // qu -> w, u -> a
			case 'h':
				switch(prev){
					case 'c': retval=putchar('e'); break; // ch -> se
					case 's': putchar('u'); retval=putchar('s'); break; // sh -> us
					case 't': putchar('c'); retval=putchar('h'); break; // th -> ch
					case 'w': retval=putchar('o'); break; // wh -> quo
					default: retval=putchar('f'); // h -> f
				}break;
			case 'l': retval=putchar(prev=='l'?'a':'r'); break; // ll -> ra, l -> r
			case 'r': if(prev=='g') putchar('u'); retval=putchar('l'); break; // gr -> tul
			case 's':
				c=getchar();
				switch(c){
					case 'h': putchar('u'); retval=putchar('s'); break; // sh -> us
					case 's': putchar('a'); putchar('i'); retval=putchar('s'); break; // ss -> ais
					default: putchar('c'); prev='s'; return(tr(c)); // s -> c
				}
				break;
			case 't':
				c=getchar();
				switch(c){
					case 'h': putchar('c'); putchar('h'); break; // th -> ch
					case 's': putchar('g'); putchar('i'); putchar('s'); break; // ts -> gis
					default: putchar('g'); prev='t'; return(tr(c)); // t -> g
				}
				break;
			case 'w': putchar('q'); retval=putchar('u'); break; // w -> qu
			default: retval=putchar(trl[c-'a']); // single to single
		}
	}else{
		if(prev=='o')putchar('h'); // no ->meh 
		retval=putchar(c);
	}
	prev=c;
	return retval;
}

int main(int argc, char** argv){
	int c;
	do{
		c=getchar();
	}while(c!=EOF && tr(c)!=EOF);
	return 0;
}