-int main(int argc, char *argv[]) {
+int
+main (int argc, char *argv[])
+{
int i, j, k; /* loop variables */
unsigned char inchar; /* temporary input character */
int tmpsum; /* temporary sum to see if a character is blank */
unsigned char bitmap[17*32][18*32/8]; /* final bitmap */
- char wide[65536]={65536 * 0}; /* 1 = force double width code point */
+ char wide[0x200000]={0x200000 * 0}; /* 1 = force double width code point */
char *infile="", *outfile=""; /* names of input and output files */
FILE *infp, *outfp; /* file pointers of input and output files */
outfile = &argv[i][2];
break;
case 'p': /* specify a Unicode plane */
- sscanf(&argv[i][2], "%x", &uniplane); /* Get Unicode plane */
+ sscanf (&argv[i][2], "%x", &uniplane); /* Get Unicode plane */
planeset = 1; /* Use specified range, not what's in bitmap */
break;
case 'w': /* force wide (16 pixels) for each glyph */
forcewide = 1;
break;
default: /* if unrecognized option, print list and exit */
- fprintf(stderr, "\nSyntax:\n\n");
- fprintf(stderr, " %s -p<Unicode_Page> ", argv[0]);
- fprintf(stderr, "-i<Input_File> -o<Output_File> -w\n\n");
- fprintf(stderr, " -w specifies .wbmp output instead of ");
- fprintf(stderr, "default Windows .bmp output.\n\n");
- fprintf(stderr, " -p is followed by 1 to 6 ");
- fprintf(stderr, "Unicode plane hex digits ");
- fprintf(stderr, "(default is Page 0).\n\n");
- fprintf(stderr, "\nExample:\n\n");
- fprintf(stderr, " %s -p83 -iunifont.hex -ou83.bmp\n\n\n",
+ fprintf (stderr, "\nSyntax:\n\n");
+ fprintf (stderr, " %s -p<Unicode_Page> ", argv[0]);
+ fprintf (stderr, "-i<Input_File> -o<Output_File> -w\n\n");
+ fprintf (stderr, " -w specifies .wbmp output instead of ");
+ fprintf (stderr, "default Windows .bmp output.\n\n");
+ fprintf (stderr, " -p is followed by 1 to 6 ");
+ fprintf (stderr, "Unicode plane hex digits ");
+ fprintf (stderr, "(default is Page 0).\n\n");
+ fprintf (stderr, "\nExample:\n\n");
+ fprintf (stderr, " %s -p83 -iunifont.hex -ou83.bmp\n\n\n",
argv[0]);
- exit(1);
+ exit (1);
}
}
}
Make sure we can open any I/O files that were specified before
doing anything else.
*/
- if (strlen(infile) > 0) {
- if ((infp = fopen(infile, "r")) == NULL) {
- fprintf(stderr, "Error: can't open %s for input.\n", infile);
- exit(1);
+ if (strlen (infile) > 0) {
+ if ((infp = fopen (infile, "r")) == NULL) {
+ fprintf (stderr, "Error: can't open %s for input.\n", infile);
+ exit (1);
}
}
else {
infp = stdin;
}
- if (strlen(outfile) > 0) {
- if ((outfp = fopen(outfile, "w")) == NULL) {
- fprintf(stderr, "Error: can't open %s for output.\n", outfile);
- exit(1);
+ if (strlen (outfile) > 0) {
+ if ((outfp = fopen (outfile, "w")) == NULL) {
+ fprintf (stderr, "Error: can't open %s for output.\n", outfile);
+ exit (1);
}
}
else {
wide[0x303F] = 0; /* CJK half-space fill */
+ /* Supplemental Multilingual Plane (Plane 01) */
+ for (i = 0x010A00; i <= 0x010A5F; i++) wide[i] = 1; /* Kharoshthi */
+ for (i = 0x011000; i <= 0x01107F; i++) wide[i] = 1; /* Brahmi */
+ for (i = 0x011080; i <= 0x0110CF; i++) wide[i] = 1; /* Kaithi */
+ for (i = 0x011100; i <= 0x01114F; i++) wide[i] = 1; /* Chakma */
+ for (i = 0x011180; i <= 0x0111DF; i++) wide[i] = 1; /* Sharada */
+ for (i = 0x011680; i <= 0x0116CF; i++) wide[i] = 1; /* Takri */
+ for (i = 0x016F00; i <= 0x016F9F; i++) wide[i] = 1; /* Mino */
+ for (i = 0x01D100; i <= 0x01D1FF; i++) wide[i] = 1; /* Musical Symbols */
+ for (i = 0x01D200; i <= 0x01D24F; i++) wide[i] = 1; /* Ancient Greek Musical Notation */
+
/*
Determine whether or not the file is a Microsoft Windows Bitmap file.
If it starts with 'B', 'M', assume it's a Windows Bitmap file.
all bets are off.
*/
fatal = 0; /* assume everything is okay with reading input file */
- if ((header[0] = fgetc(infp)) != EOF) {
- if ((header[1] = fgetc(infp)) != EOF) {
+ if ((header[0] = fgetc (infp)) != EOF) {
+ if ((header[1] = fgetc (infp)) != EOF) {
if (header[0] == 'B' && header[1] == 'M') {
wbmp = 0; /* Not a Wireless Bitmap -- it's a Windows Bitmap */
}
fatal = 1;
if (fatal) {
- fprintf(stderr, "Fatal error; end of input file.\n\n");
- exit(1);
+ fprintf (stderr, "Fatal error; end of input file.\n\n");
+ exit (1);
}
/*
If this is a Wireless Bitmap (.wbmp) format file,
*/
if (wbmp) {
for (i=2; i<6; i++)
- header[i] = fgetc(infp);
+ header[i] = fgetc (infp);
/*
Now read the bitmap.
*/
for (i=0; i < 32*17; i++) {
for (j=0; j < 32*18/8; j++) {
- inchar = fgetc(infp);
+ inchar = fgetc (infp);
bitmap[i][j] = ~inchar; /* invert bits for proper color */
}
}
*/
else {
for (i=2; i<0x3e; i++)
- header[i] = fgetc(infp);
+ header[i] = fgetc (infp);
/*
Now read the bitmap.
*/
for (i = 32*17-1; i >= 0; i--) {
for (j=0; j < 32*18/8; j++) {
- inchar = fgetc(infp);
+ inchar = fgetc (infp);
bitmap[i][j] = ~inchar; /* invert bits for proper color */
}
}
/*
We've read the entire file. Now close the input file pointer.
*/
- fclose(infp);
+ fclose (infp);
/*
We now have the header portion in the header[] array,
and have the bitmap portion from top-to-bottom in the bitmap[] array.
the normal Unicode range, but this has not been fully tested.
*/
if (uniplane > 0xff)
- fprintf(outfp, "%04X%X%X:", uniplane, i, j); // 6 digit code pt.
+ fprintf (outfp, "%04X%X%X:", uniplane, i, j); // 6 digit code pt.
else
- fprintf(outfp, "%02X%X%X:", uniplane, i, j); // 4 digit code pt.
+ fprintf (outfp, "%02X%X%X:", uniplane, i, j); // 4 digit code pt.
for (thisrow=0; thisrow<16; thisrow++) {
/*
If second half is empty and we're not forcing this
*/
if (!forcewide &&
empty2 && !wide[(uniplane << 8) | (i << 4) | j])
- fprintf(outfp,
+ fprintf (outfp,
"%02X",
thischar1[thisrow]);
else
- fprintf(outfp,
+ fprintf (outfp,
"%02X%02X",
thischar1[thisrow], thischar2[thisrow]);
}
- fprintf(outfp, "\n");
+ fprintf (outfp, "\n");
}
}
}
- exit(0);
+ exit (0);
}