bitblt_table_gen.c

Wed, 19 Feb 2003 10:14:49 +0000

author
eric
date
Wed, 19 Feb 2003 10:14:49 +0000
changeset 53
bb180150e603
child 56
425e8c46d318
permissions
-rw-r--r--

rename br.c to bitblt_table_gen.c, and integrate use of it into build process

     1 /*
     2  * t2p: Create a PDF file from the contents of one or more TIFF
     3  *      bilevel image files.  The images in the resulting PDF file
     4  *      will be compressed using ITU-T T.6 (G4) fax encoding.
     5  *
     6  * bitblt table generator
     7  * $Id: bitblt_table_gen.c,v 1.1 2003/02/19 02:14:44 eric Exp $
     8  * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
     9  *
    10  * This program is free software; you can redistribute it and/or modify
    11  * it under the terms of the GNU General Public License version 2 as
    12  * published by the Free Software Foundation.  Note that permission is
    13  * not granted to redistribute this program under the terms of any
    14  * other version of the General Public License.
    15  *
    16  * This program is distributed in the hope that it will be useful,
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with this program; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
    24  */
    27 #include <stdio.h>
    29 int main (int argc, char *argv[])
    30 {
    31   int i, j;
    33   printf ("/* This file is automatically generated; do not edit */\n");
    34   printf ("\n");
    35   printf ("static const uint8_t bit_reverse_byte [0x100] =\n");
    36   printf ("{\n");
    37   for (i = 0; i < 0x100; i++)
    38     {
    39       if ((i & 7) == 0)
    40 	printf ("  ");
    41       j = (((i & 0x01) << 7) |
    42 	   ((i & 0x02) << 5) |
    43 	   ((i & 0x04) << 3) |
    44 	   ((i & 0x08) << 1) |
    45 	   ((i & 0x10) >> 1) |
    46 	   ((i & 0x20) >> 3) |
    47 	   ((i & 0x40) >> 5) |
    48 	   ((i & 0x80) >> 7));
    49       printf ("0x%02x", j);
    50       if (i != 0xff)
    51 	printf (",");
    52       if ((i & 7) == 7)
    53 	printf ("\n");
    54       else
    55 	printf (" ");
    56     }
    57   printf ("};\n");
    58   return (0);
    59 }