/* gema0.c - Don Yang (uguu.org) 12/01/01 */ #include #include #define SIZE 4452 #define KEY 50 char source[4096] = #include"data.txt" ; char output[4096], *dict = ",.`':\"\nx"; char *p, *q; int shift, pos, length, offset, i, j, k; int GetBit(void) { int r; r = ((int)source[pos / 3] >> shift) & (1 << (pos % 3)); pos++; return r ? 1 : 0; } int main(void) { for(p = q = source; *q; *(p++) = *(q++) - KEY) for(; *q < 33; q++); shift = 4 //**/ 4 -1; pos = offset = 0; while( pos < SIZE ) { j = GetBit(); for(i = length = 0; i < 5; i++) length = (length << 1) | GetBit(); if( j ) { for(i = 0; i < length; i++) { if( GetBit() ) { if( GetBit() ) { for(j = k = 0; j < 3; j++) k = (k << 1) | GetBit(); output[offset++] = dict[k]; } else { output[offset++] = GetBit() ? 'X' : '%'; } } else { output[offset++] = ' '; } } } else { for(i = j = 0; i < 5; i++) j = (j << 1) | GetBit(); for(i = 0; i < length; i++) { output[offset] = output[offset - j]; offset++; } } } output[offset] = 0; puts(output); return 0; }