*** cmain.c.dist	Thu Oct 24 03:28:07 1991
--- cmain.c	Thu Dec 22 11:55:53 1994
***************
*** 28,33 ****
--- 28,35 ----
  int outfile   = 1;
  char *outname = "<stdout>";
  
+ int xbitmap=0;
+ 
  /* basename of executable */
  char *cmdname;
  
*** file.c.dist	Wed Jun 19 07:29:13 1991
--- file.c	Mon Mar 20 18:11:00 1995
***************
*** 14,19 ****
--- 14,22 ----
   */
  
  #include "compface.h"
+ #ifndef	stderr
+ #include <stdio.h>
+ #endif
  
  void
  BigRead(fbuf)
***************
*** 70,77 ****
--- 73,111 ----
  {
  	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++);
***************
*** 82,88 ****
  				status = ERR_EXCESS;
  				break;
  			}
! 			*(t++) = c - '0';
  		}
  		else if ((c >= 'A') && (c <= 'F'))
  		{
--- 116,122 ----
  				status = ERR_EXCESS;
  				break;
  			}
! 			(t++)[inc] = table[c - '0']; inc = - inc;
  		}
  		else if ((c >= 'A') && (c <= 'F'))
  		{
***************
*** 91,97 ****
  				status = ERR_EXCESS;
  				break;
  			}
! 			*(t++) = c - 'A' + 10;
  		}
  		else if ((c >= 'a') && (c <= 'f'))
  		{
--- 125,131 ----
  				status = ERR_EXCESS;
  				break;
  			}
! 			(t++)[inc] = table[c - 'A' + 10]; inc = - inc;
  		}
  		else if ((c >= 'a') && (c <= 'f'))
  		{
***************
*** 100,109 ****
  				status = ERR_EXCESS;
  				break;
  			}
! 			*(t++) = c - 'a' + 10;
  		}
! 		else if (((c == 'x') || (c == 'X')) && (t > fbuf) && (*(t-1) == 0))
! 			t--;
  	}
  	if (t < fbuf + DIGITS)
  		longjmp(comp_env, ERR_INSUFF);
--- 134,143 ----
  				status = ERR_EXCESS;
  				break;
  			}
! 			(t++)[inc] = table[c - 'a' + 10]; inc = - inc;
  		}
! 		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);
***************
*** 127,136 ****
--- 161,179 ----
  {
  	register char *s, *t;
  	register int i, bits, digits, words;
+ 	extern int xbitmap;
+ 	int digsperword = DIGSPERWORD;
+ 	int wordsperline = WORDSPERLINE;
  
  	s = F;
  	t = fbuf;
  	bits = digits = words = i = 0;
+ 	if (xbitmap) {
+ 		sprintf(t,"#define noname_width 48\n#define noname_height 48\nstatic char noname_bits[] = {\n ");
+ 		while (*t) t++;
+ 		digsperword = 2;
+ 		wordsperline = 15;
+ 	}
  	while (s < F + PIXELS)
  	{
  		if ((bits == 0) && (digits == 0))
***************
*** 138,162 ****
  			*(t++) = '0';
  			*(t++) = 'x';
  		}
! 		if (*(s++))
! 			i = i * 2 + 1;
! 		else
! 			i *= 2;
  		if (++bits == BITSPERDIG)
  		{
! 			*(t++) = *(i + HexDigits);
  			bits = i = 0;
! 			if (++digits == DIGSPERWORD)
  			{
  				*(t++) = ',';
  				digits = 0;
! 				if (++words == WORDSPERLINE)
  				{
  					*(t++) = '\n';
  					words = 0;
  				}
  			}
  		}
  	}
  	*(t++) = '\0';
  }
--- 181,223 ----
  			*(t++) = '0';
  			*(t++) = 'x';
  		}
! 		if (xbitmap) {
! 			if (*(s++))
! 				i = (i >> 1) | 0x8;
! 			else
! 				i >>= 1;
! 		}
! 		else {
! 			if (*(s++))
! 				i = i * 2 + 1;
! 			else
! 				i *= 2;
! 		}
  		if (++bits == BITSPERDIG)
  		{
! 			if (xbitmap) {
! 				t++;
! 				t[-(digits & 1) * 2] = *(i + HexDigits);
! 			}
! 			else *(t++) = *(i + HexDigits);
  			bits = i = 0;
! 			if (++digits == digsperword)
  			{
+ 				if (xbitmap && (s >= F + PIXELS)) break;
  				*(t++) = ',';
  				digits = 0;
! 				if (++words == wordsperline)
  				{
  					*(t++) = '\n';
+ 					if (xbitmap) *(t++) = ' ';
  					words = 0;
  				}
  			}
  		}
+ 	}
+ 	if (xbitmap) {
+ 		sprintf(t, "}\n");
+ 		while (*t) t++;
  	}
  	*(t++) = '\0';
  }
*** uncmain.c.dist	Thu Oct 24 03:28:07 1991
--- uncmain.c	Thu Dec 22 09:58:34 1994
***************
*** 28,33 ****
--- 28,35 ----
  int outfile   = 1;
  char *outname = "<stdout>";
  
+ int xbitmap=0;
+ 
  /* basename of executable */
  char *cmdname;
  
***************
*** 59,64 ****
--- 61,73 ----
    while (**argv)
      if (*((*argv)++) == '/')
        cmdname = *argv;               /* find the command's basename */
+ 
+   if (argc > 1 && !strcmp(argv[1], "-X"))
+     {
+       xbitmap++;
+       argc--;
+       argv++;
+     }
  
    if (argc > 3)
      {
