clean up ugly bignum code a bit, do range checks, support colon display
This commit is contained in:
+61
-54
@@ -382,57 +382,62 @@ driver_alt_num( Driver * drv, int x, int num )
|
|||||||
{
|
{
|
||||||
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
|
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
|
||||||
/* Moved to driver.c by Joris Robijn */
|
/* Moved to driver.c by Joris Robijn */
|
||||||
static char num_map [10][4][3] = {
|
static char num_map[][4][4] = {
|
||||||
{
|
{ /* 0 */
|
||||||
{' ','_',' '}, /*0*/
|
" _ ",
|
||||||
{'|',' ','|'},
|
"| |",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 1 */
|
||||||
{' ',' ',' '},/*1*/
|
" ",
|
||||||
{' ',' ','|'},
|
" |",
|
||||||
{' ',' ','|'},
|
" |",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 2 */
|
||||||
{' ','_',' '},/*2*/
|
" _ ",
|
||||||
{' ','_','|'},
|
" _|",
|
||||||
{'|','_',' '},
|
"|_ ",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 3 */
|
||||||
{' ','_',' '},/*3*/
|
" _ ",
|
||||||
{' ','_','|'},
|
" _|",
|
||||||
{' ','_','|'},
|
" _|",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 4 */
|
||||||
{' ',' ',' '},/*4*/
|
" ",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{' ',' ','|'},
|
" |",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 5 */
|
||||||
{' ','_',' '},/*5*/
|
" _ ",
|
||||||
{'|','_',' '},
|
"|_ ",
|
||||||
{' ','_','|'},
|
" _|",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 6 */
|
||||||
{' ','_',' '},/*6*/
|
" _ ",
|
||||||
{'|','_',' '},
|
"|_ ",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 7 */
|
||||||
{' ','_',' '},/*7*/
|
" _ ",
|
||||||
{' ',' ','|'},
|
" |",
|
||||||
{' ',' ','|'},
|
" |",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 8 */
|
||||||
{' ','_',' '},/*8*/
|
" _ ",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{' ',' ',' '}},
|
" " },
|
||||||
{
|
{ /* 9 */
|
||||||
{' ','_',' '},/*9*/
|
" _ ",
|
||||||
{'|','_','|'},
|
"|_|",
|
||||||
{' ','_','|'},
|
" _|",
|
||||||
{' ',' ',' '}}
|
" " },
|
||||||
|
{ /* colon */
|
||||||
|
" ",
|
||||||
|
".",
|
||||||
|
".",
|
||||||
|
" " }
|
||||||
};
|
};
|
||||||
/* End of ugly code ;) by Rene Wagner */
|
/* End of ugly code ;) by Rene Wagner */
|
||||||
/* I like this code ! Joris */
|
/* I like this code ! Joris */
|
||||||
@@ -441,12 +446,14 @@ driver_alt_num( Driver * drv, int x, int num )
|
|||||||
|
|
||||||
debug (RPT_DEBUG, "%s( drv=[%.40s], x=%d, num=%d )", __FUNCTION__, drv->name, x, num);
|
debug (RPT_DEBUG, "%s( drv=[%.40s], x=%d, num=%d )", __FUNCTION__, drv->name, x, num);
|
||||||
|
|
||||||
|
if ((num < 0) || (num > 10))
|
||||||
|
return;
|
||||||
if (!drv->chr)
|
if (!drv->chr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (y = 1; y < 5; y++)
|
for (y = 0; y < 4; y++)
|
||||||
for (dx = 0; dx < 3; dx++)
|
for (dx = 0; num_map[num][y][dx] != '\0'; dx++)
|
||||||
drv->chr (drv, x + dx, y, num_map[num][y-1][dx]);
|
drv->chr (drv, x + dx, y+1, num_map[num][y][dx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user