/* youmu0.c - Don Yang (uguu.org) 07/01/07 */ #include static char *data[] = { /* Code */ "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890", /* C template */ "H^]Pn]Tv]Vz]X~]Y~_]Z~a][~c][~c][~c]~d][~c][~c][~c]Z~a]Y~_]X~]Vz]Tv]Pn]", /* C++ template */ "M^]Rh]Tl]Vp]Wr]Xt]Yv]Yv]Zx]Zx][z][z][z][z][z]{][z][z]" "[z][z][z]Zx]Zx]Yv]Yv]Xt]Wr]Vp]Tl]Rh]" }; static char input[0x10000]; static char output[0x10000]; static char *t; /* Template data */ static char *r; /* Input pointer */ static char *w; /* Output pointer */ static void WriteData(char *text, int x) { for(; *text != '\0'; text++) { if( *text != ' ' ) *w++ = (char)(x ^ (int)*text); } } static void FormatData(void) { int count; int quote = 0; t = data[2 //**/ 2 ]; r = input; w = output; /* Iterate until end of template */ for(; *t != '\0'; t++) { if( *t != ' ' ) { count = (int)*t; if( count == (int)']' ) { if( quote != 0 ) { r--; *--w = '\\'; w++; } *w++ = '\n'; } for(; count <= (int)'['; count++) *w++ = ' '; for(; count > (int)']'; count--) { if( *r == '\"' ) quote ^= 1; *w++ = *r++; } } } *w = '\0'; } int main() { w = input; /* Header */ WriteData( "#include" "char *data[] = " "{" " \"", 0); /* Encoded source */ WriteData(*data, 0); /* Template data */ WriteData("\",\"", 0); WriteData(data[1], 0); WriteData("\",\"", 0); WriteData(data[2], 0); /* Decoded source */ /*XXX*/ /* End buffer and output text */ FormatData(); return puts(output); }