diff options
author | David Wührer <def@gmx.at> | 2017-02-19 15:23:48 +0100 |
---|---|---|
committer | David Wührer <def@gmx.at> | 2017-02-19 15:23:48 +0100 |
commit | ed28bd25e3055ff9134eb655be37c076f9bf67fe (patch) | |
tree | 9099df56945f4274c21f6a368ab2d431282453eb /english2uryuomoco.c |
initial commit
Diffstat (limited to 'english2uryuomoco.c')
-rw-r--r-- | english2uryuomoco.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/english2uryuomoco.c b/english2uryuomoco.c new file mode 100644 index 0000000..e64725c --- /dev/null +++ b/english2uryuomoco.c @@ -0,0 +1,127 @@ +#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 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){ + char c; + do{ + c=getchar(); + }while(c!=EOF && tr(c)!=EOF); + return 0; +} |