📄 char16x8.c
字号:
/*
* Released under the GNU GPL. See http://www.gnu.org/licenses/gpl.txt
*
* This program is part of TinyPLC
*
* TinyPLC is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundatation; version 2 of the License.
*
* TinyPLC is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/*
* My thanks to my employer, Athena Controls (www.athenacontrols.com)
* for allowing me to open source this project.
*/
/*
* TinyPLC kernel
* Processor: Atmel MEGA1281 or Atmel MEGA2561
* Compiler: Codevision AVR C compiler, 1.24.8e
*
* TinyPLC editor/compiler
* Processor: PC-clone, VESA video (mode 0x105, 1024x768x256)
* Compiler: DeSmet C, version 2.51 (PCC version 1.2)
*
* Revision history:
* Programmer Date Comments
* ---------------- --------- ---------------------------------------------
* William Couture 3/19/2006 Original code
* William Couture 9/13/2006 Modify for GPL release
*/
/* This program is a "helper" program for the TinyPLC editor/compiler.
* It takes a character set from CHEDIT.EXE and turns it into
* initialization statements for data within PLC.EXE
*/
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef long DWORD; /* unsigned would be nice, but... */
#define TRUE 1
#define FALSE 0
BYTE charset[1024];
int filein;
int upper;
main(argc, argv)
WORD argc;
BYTE *argv[];
{
int i, j, k, l, m, n, c;
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '-')
{
switch(toupper(argv[i][1]))
{
case 'U':
upper = 64;
break;
default:
help(); /* this does not return */
break;
}
for (j = i; j < argc-1; j++)
argv[j] = argv[j+1];
argc--;
i--; /* remove this cmdline parameter */
}
}
if (argc < 2)
help(); /* does not return */
if ((filein = open(argv[1],0)) == -1)
help();
if (read(filein,charset,1024) != 1024)
help();
close(filein);
for (n = 0, i = 0; i < 32; i++, n++)
{
printf(" ");
for (j = 0; j < 8; j++)
{
m = i * 8;
printf(" 0x%02x,",charset[m+j]);
}
printf("\n ");
for (j = 0; j < 8; j++)
{
m = i * 8;
printf(" 0x%02x,",charset[m+j+32*8]);
}
printf(" /* %3d: ",n+upper);
printchar(n+upper);
printf(" */\n\n");
}
for (i = 64; i < 96; i++, n++)
{
printf(" ");
for (j = 0; j < 8; j++)
{
m = i * 8;
printf(" 0x%02x,",charset[m+j]);
}
printf("\n ");
for (j = 0; j < 8; j++)
{
m = i * 8;
printf(" 0x%02x",charset[m+j+32*8]);
if (((n + upper) != 127) || (j < 7))
printf(",");
else
printf(" ");
}
printf(" /* %3d: ",n+upper);
printchar(n+upper);
printf(" */\n\n");
}
}
BYTE *charnames[] =
{
"<nul>",
"LEFT_EDGE",
"RIGHT_EDGE",
"VERT_BAR, BOX_TOPBAR",
"START_NO_IN",
"END_NO_IN",
"START_NC_IN",
"END_NC_IN",
"START_NO_OUT",
"END_NO_OUT",
"START_NC_OUT",
"END_NC_OUT",
"SCROLL_UPARROW",
"SCROLL_DOWNARROW",
"SCROLL_BAR",
"BRANCH_BAR",
"START_BRANCH",
"END_BRANCH",
"EXPAND_BRANCH",
"OR_VERT_T",
"OR_VERT_BAR, BOX_SIDEBAR",
"OR_LEFT, BOX_BOTTOM_LEFT",
"OR_RIGHT, BOX_BOTTOM_RIGHT",
"BOX_TOP_LEFT",
"BOX_TOP_RIGHT",
"OR_LEFT_T",
"OR_RIGHT_T",
"MOUSE_CURSOR",
"SCROLL_BOX",
"<blank>",
"<blank>",
"<blank>",
"<spc>"
};
printchar(c)
BYTE c;
{
if (c <= ' ')
printf("%s",charnames[c]);
else
printf("%c",c);
}
help()
{
printf("Error: CHAR16X8 filename.ext > newname.ext\n");
exit(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -