/*
 *	banner.c
 *
 *	Build the large character set.
 */

/***
 ***	Include files
 ***/
#include <ctype.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "pragmas.h"
#include "pinewood.h"

/***
 ***	Character table
 ***/

struct ctab
    {
    char	ch;		/* Character being mapped		*/
    int		width;		/* Width of character			*/
    char	*map[8];	/* Map of character			*/
    };

/*lint -e785 */
struct ctab Ctab[] =
    {
	{ '0', 6,
		{  " XXX ",
		   "X   X",
		   "X   X",
		   "X   X",
		   " XXX "
		} },
	{ '1', 6,
		{  " XX  ",
		   "  X  ",
		   "  X  ",
		   "  X  ",
		   " XXX "
		} },
	{ '2', 6,
		{  "XXXX ",
		   "    X",
		   " XXX ",
		   "X    ",
		   "XXXXX"
		} },
	{ '3', 6,
		{  "XXXX ",
		   "    X",
		   "  XXX",
		   "    X",
		   "XXXX "
		} },
	{ '4', 6,
		{  "X   X",
		   "X   X",
		   "XXXXX",
		   "    X",
		   "    X"
		} },
	{ '5', 6,
		{  "XXXXX",
		   "X    ",
		   "XXXX ",
		   "    X",
		   "XXXX "
		} },
	{ '6', 6,
		{  " XXX ",
		   "X    ",
		   "XXXX ",
		   "X   X",
		   " XXX "
		} },
	{ '7', 6,
		{  "XXXXX",
		   "    X",
		   "   X ",
		   "  X  ",
		   "  X  "
		} },
	{ '8', 6,
		{  " XXX ",
		   "X   X",
		   " XXX ",
		   "X   X",
		   " XXX "
		} },
	{ '9', 6,
		{  " XXX ",
		   "X   X",
		   " XXXX",
		   "    X",
		   " XXX "
		} },
	{ ' ', 6,
		{  "",
		} },
	{ '-', 6,
		{  "     ",
		   "     ",
		   "XXXXX",
		   "     ",
		   "     "
		} },
	{ '.', 3,
		{  "  ",
		   "  ",
		   "  ",
		   "oo",
		   "oo"
		} },

	{ '\0', 0 }		/* End sentinal */
    };
/*lint +e785 */
/*
 *	big_display
 *
 *	Display a string in large (5x5) characters.
 */
void
big_display(int x, int y, char *str)
    {
    char		buffer[20];
    int			row;
    struct ctab		*scan;

    for (; *str != '\0'; str++)
	{
	for (scan = Ctab; scan->ch != '\0'; scan++)
	    {
	    if (scan->ch == *str)
		break;
	    }
	if (scan->ch == '\0')
	    {
	    scan->width = 1;
	    scan->map[0] = buffer;
	    buffer[0] = *str;
	    buffer[1] = '\0';
	    }
	for (row = 0; scan->map[row] != NULL; row++)
	    {
	    gotoxy(x, y + row);
	    cputs(scan->map[row]);
	    }
	x += scan->width;
	}
    }


/*
 *	big_modify
 *
 *	Change X in tables to a block character.
 */
void
big_modify(void)
    {
    char		*cptr;
    int			row;
    struct ctab		*scan;

    for (scan = Ctab; scan->ch != '\0'; scan++)
	{
	for (row = 0; scan->map[row] != NULL; row++)
	    {
	    for (cptr = scan->map[row]; *cptr != '\0'; cptr++)
		{
		if (*cptr == 'X')
		    *cptr = '\xDB';
		}
	    }
	}
    }


