diff -Nur compface-1.5.2-old/compface.1 compface-1.5.2/compface.1 --- compface-1.5.2-old/compface.1 2008-04-14 23:51:54.000000000 +0300 +++ compface-1.5.2/compface.1 2008-04-14 23:52:03.000000000 +0300 @@ -51,8 +51,9 @@ The first line contains 72 characters and following lines contain 79 characters except that the last line may be short. .LP -If the -X option is given to uncompface, it generates XBM format -directly. +This version of compface has been patched to also be able to handle +normal XBM images. uncompface will produce XBM output only if the -X +switch is applied. .LP The amount of compression obtained varies between face image files but the output of diff -Nur compface-1.5.2-old/compface.3 compface-1.5.2/compface.3 --- compface-1.5.2-old/compface.3 2008-04-14 23:51:54.000000000 +0300 +++ compface-1.5.2/compface.3 2008-04-14 23:52:03.000000000 +0300 @@ -39,6 +39,10 @@ The first line contains 72 characters and following lines contain 79 characters except that the last line may be short. .LP +This version of compface has been patched to also be able to handle +normal XBM images. uncompface will produce XBM output only if the -X +switch is applied. +.LP The amount of compression obtained varies between face image files but the output of .I compface diff -Nur compface-1.5.2-old/file.c compface-1.5.2/file.c --- compface-1.5.2-old/file.c 2008-04-14 23:51:54.000000000 +0300 +++ compface-1.5.2/file.c 2008-04-14 23:52:03.000000000 +0300 @@ -77,8 +77,39 @@ { register int c, i; register char *s, *t; + static char table_inv[] = { 0,8,4,12,2,10,6,14,1,9, 5,13, 3,11, 7,15 }; + static char table_nop[] = { 0,1,2, 3,4, 5,6, 7,8,9,10,11,12,13,14,15 }; + char *table = table_nop; /* optionally invert bits in nibble */ + register inc = 0; /* optionally swap nimmles */ + int bits; t = s = fbuf; + + /* Does this look like an X bitmap ? */ + if (sscanf(s, "#define %*s %d", &bits) == 1) { + if (bits == 48) { + char type1[128]; + char type2[128]; + while (*s && *s++ != '\n'); + if (sscanf(s, "#define %*s %d", &bits) == 1) if (bits == 48) { + while (*s && *s++ != '\n'); + if (sscanf(s, "static %s %s", type1,type2)==2 && + (!strcmp(type1, "char") || + !strcmp(type2, "char"))) { + while (*s && *s++ != '\n'); + inc = 1; + table = table_inv; + } + else fprintf(stderr, + "warning: xbitmap line 3 not static [unsigned] short ...\n"); + } + else fprintf(stderr, "warning: xbitmaps must be 48x48\n"); + } + else fprintf(stderr, "warning: xbitmaps must be 48x48\n"); + } + /* Ensure s is reset if it was not an X bitmap ... */ + if (! inc) s = fbuf; + for(i = strlen(s); i > 0; i--) { c = (int)*(s++); @@ -89,7 +120,7 @@ status = ERR_EXCESS; break; } - *(t++) = c - '0'; + (t++)[inc] = table[c - '0']; inc = - inc; } else if ((c >= 'A') && (c <= 'F')) { @@ -98,7 +129,7 @@ status = ERR_EXCESS; break; } - *(t++) = c - 'A' + 10; + (t++)[inc] = table[c - 'A' + 10]; inc = - inc; } else if ((c >= 'a') && (c <= 'f')) { @@ -107,10 +138,10 @@ status = ERR_EXCESS; break; } - *(t++) = c - 'a' + 10; + (t++)[inc] = table[c - 'a' + 10]; inc = - inc; } - else if (((c == 'x') || (c == 'X')) && (t > fbuf) && (*(t-1) == 0)) - t--; + else if (((c == 'x') || (c == 'X')) && (t > fbuf) && + ((t-1)[-inc] == table[0])) { t--; inc = -inc; } } if (t < fbuf + DIGITS) longjmp(comp_env, ERR_INSUFF); diff -Nur compface-1.5.2-old/t2.pbm compface-1.5.2/t2.pbm --- compface-1.5.2-old/t2.pbm 1970-01-01 02:00:00.000000000 +0200 +++ compface-1.5.2/t2.pbm 2008-04-14 23:52:03.000000000 +0300 @@ -0,0 +1,3 @@ +P4 +48 48 +Þþ®ÔïêîH¬Ê®¾õeUW_õº½j­ª«õªµ¥]½zÕÚÚîÕõZ§%[uUY]oÕõuU[Zªú¦©U¯zÚ¢äªÛºJ¡E›Zõ"”ÆÕù¡&ºº¢¤ /çô•QWJµ¹P¤šÎúEUV¥{õYX KGmR¥M*½õ´ÒVï¶ê±Nš¦ú²ª[K]åmU¦ª×¶··[V«{Ú­§[]öµZ”¥WUZUK]ºúÙU$¥_»d š›it¥Z¦¦××U´šª®¸ê©J«U×UUUZßynª½n«¶¢º««fÚ¾ª­f«{U¥VÛvÚÝUm¶ªµjÚ¦ÝßÛ¥»Z®ªåm]¿{·½³åTÝ[êÝ^«o®»këÝU{öÖ¾»î¦ÛµÛÝ[{¶Þ¶ç} diff -Nur compface-1.5.2-old/t2.xbm compface-1.5.2/t2.xbm --- compface-1.5.2-old/t2.xbm 1970-01-01 02:00:00.000000000 +0200 +++ compface-1.5.2/t2.xbm 2008-04-14 23:52:03.000000000 +0300 @@ -0,0 +1,23 @@ +#define noname_width 48 +#define noname_height 48 +static char noname_bits[] = { + 0x7B,0x7F,0x75,0x2B,0xB1,0xF7,0x57,0x77,0x12,0x35,0x53,0x75,0x7D,0xAF,0xA6, + 0xAA,0xEA,0xFA,0xAF,0x5D,0xBD,0x56,0xB5,0x55,0xD5,0xAF,0x55,0xAD,0xA5,0xBA, + 0xBD,0x5E,0xAB,0x5B,0x5B,0x77,0xAB,0xAF,0x5A,0xE5,0xA4,0xDA,0xFE,0xAE,0xAA, + 0x9A,0xBA,0xF6,0xAB,0xAF,0xAE,0xAA,0xDA,0x5A,0x55,0x5F,0x65,0x95,0xAA,0xF5, + 0x5E,0x5B,0x45,0x27,0x58,0x55,0xDB,0x5D,0x52,0x85,0xA2,0xD9,0x5A,0xAF,0x44, + 0x29,0xD8,0x63,0xAB,0x9F,0x48,0x85,0x64,0xB9,0x5D,0x5D,0x45,0x25,0xD0,0xF4, + 0xE7,0x2F,0xA9,0x8A,0xEA,0x52,0xAD,0x9D,0x0A,0x25,0x70,0x59,0x73,0x5F,0xA2, + 0xAA,0x6A,0xA5,0xDE,0xAF,0x9A,0x1A,0xD0,0xD2,0xE2,0xB6,0x4A,0xA5,0xB2,0x54, + 0xBD,0xAF,0x2D,0x4B,0xD8,0x6A,0xF7,0x6D,0x57,0x8D,0x72,0x59,0x65,0x5F,0x4D, + 0x55,0xDA,0xD2,0xBA,0xA7,0xB6,0xAA,0x65,0x55,0xEB,0x6D,0xED,0xED,0xDA,0x6A, + 0xD5,0xDE,0x5B,0xB5,0xE5,0xDA,0xBA,0x6F,0xAD,0x5A,0x29,0xA5,0xEA,0xAA,0x5A, + 0xAA,0xD2,0xBA,0x5D,0x5F,0x9B,0xAA,0x24,0xA5,0xFA,0xDD,0x26,0x05,0x59,0xD9, + 0x96,0x2E,0xA5,0x5A,0x65,0x65,0xEB,0xEB,0xAA,0x2D,0x59,0x55,0x75,0x1D,0x57, + 0x95,0x52,0xD5,0xAA,0xEB,0xAA,0xAA,0xAA,0x5A,0xFB,0x9E,0x76,0x55,0xBD,0x76, + 0xD5,0x6D,0x45,0x5D,0xD5,0xD5,0x66,0x5B,0x7D,0x55,0xB5,0x66,0xD5,0xDE,0xAA, + 0xA5,0x6A,0xDB,0x6E,0x5B,0xBB,0xAA,0xB6,0x6D,0x55,0xAD,0x56,0x5B,0x65,0xBB, + 0xFB,0xDB,0xA5,0xDD,0x5A,0x75,0x55,0xA7,0xB6,0xBA,0xFD,0xDE,0xED,0xBD,0xCD, + 0xA7,0x2A,0xBB,0xDA,0x57,0xBB,0x7A,0xD5,0xF6,0x75,0xDD,0xD6,0xD7,0xBB,0xAA, + 0xDE,0x6F,0x6B,0x7D,0xDD,0x77,0x65,0xDB,0xAD,0xDB,0xBB,0xDA,0xDE,0x6D,0x7B, + 0x6D,0xE7,0xBE}; diff -Nur compface-1.5.2-old/t.pbm compface-1.5.2/t.pbm --- compface-1.5.2-old/t.pbm 1970-01-01 02:00:00.000000000 +0200 +++ compface-1.5.2/t.pbm 2008-04-14 23:52:03.000000000 +0300 @@ -0,0 +1,3 @@ +P4 +48 48 +÷jªª®ÿÚÕkU[UýZÕZªÛ뵺µu·úªUNªí着©k¿úꪪ­UõUV©ZïµUt‚UµÝ%U(š­õJ”‚=¶ú‰TH–ÛÕUTMþ’ª¨.ÕÚ©P—5÷%ªªVêýª©--n«T*KÕûÚ²„­vßvÕ(—UöÕT¥-­{j«ZVµÞÖÞ®­Ví½U[®­ûÖª•Rª®ª¥*­Ûõµ©JRªßmR•méRªUV¶¾®Ú’UU×qU)U­º®ªªªµïiWÕkWÝVÔU]m¶ÕWUkVí­Zª¶í¶µ«jÛVÕjµU¶»¿]Ú­UWuj«ÛïÝÞÛ|ª²«}µ«Wm_×m}½«êý¶Ö×}W¶Ýº½«íݶ×vî»÷oz½»mÝÝ­kê×hej diff -Nur compface-1.5.2-old/t.xbm compface-1.5.2/t.xbm --- compface-1.5.2-old/t.xbm 1970-01-01 02:00:00.000000000 +0200 +++ compface-1.5.2/t.xbm 2008-04-14 23:52:03.000000000 +0300 @@ -0,0 +1,23 @@ +#define noname_width 48 +#define noname_height 48 +static char noname_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x3F,0x00,0x00,0x00,0x00,0xFF, + 0x3F,0x00,0x00,0x00,0x80,0xFF,0xFF,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x03,0x00, + 0x00,0xF0,0xBF,0xFC,0x07,0x00,0x00,0xF8,0x0F,0xE0,0x0F,0x00,0x00,0xF8,0x03, + 0x00,0x0F,0x00,0x00,0xFC,0x01,0x00,0x0E,0x00,0x00,0xFE,0x00,0x00,0x04,0x00, + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x08,0x00,0x00,0x7F,0x00, + 0x00,0x10,0x00,0x80,0x7F,0x00,0x00,0x10,0x00,0x80,0x3F,0x00,0x00,0x20,0x00, + 0x80,0x3F,0x00,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x40,0x00,0xC0,0x3F,0x00, + 0x00,0x40,0x00,0xC0,0x3F,0x00,0x00,0x40,0x00,0xC0,0x3F,0x00,0x3D,0xC0,0x00, + 0x00,0x3F,0x80,0x60,0x60,0x00,0x00,0x7E,0x00,0x2C,0x70,0x00,0x00,0x3C,0x00, + 0x07,0x18,0x00,0x00,0x38,0x00,0x04,0x38,0x00,0x00,0x18,0x00,0x20,0x38,0x00, + 0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x00, + 0x00,0x40,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x21,0x00,0x00,0x40,0x00, + 0x80,0x53,0x00,0x00,0x20,0x00,0x80,0x6F,0x00,0x00,0x20,0x00,0xC0,0x37,0x00, + 0x00,0x1A,0x00,0xC0,0xFF,0x00,0x80,0x0D,0x00,0xC0,0x6F,0x00,0x03,0x1C,0x00, + 0xE0,0xEF,0x81,0x02,0x06,0x00,0xC0,0x7F,0x01,0x80,0x07,0x00,0xE0,0x5F,0x83, + 0x00,0x06,0x00,0xC0,0xDF,0x06,0x00,0x06,0x00,0xE0,0x1F,0x0D,0x00,0x07,0x00, + 0xC0,0x3F,0x5D,0xC1,0x03,0x00,0xE0,0x3B,0xDA,0x00,0x06,0x00,0xC0,0x27,0xF4, + 0x01,0x02,0x00,0xC0,0x11,0xF8,0x0F,0x03,0x00,0x80,0x01,0xF0,0xFF,0x15,0x00, + 0x80,0x11,0xC0,0xFF,0x13,0x00,0x80,0x50,0xD0,0xFF,0x0D,0x00,0x00,0x41,0x80, + 0x3E,0x0B,0x00};