Replace cPatten with ArtFont

This commit is contained in:
Lamdonn 2025-11-21 23:00:12 +08:00
parent bf21a64ab2
commit 2d13818a5a
10 changed files with 156 additions and 456 deletions

View File

@ -24,7 +24,7 @@ It has the characteristics of **simplicity, universality, and efficiency**, with
| arg | 01.00.00 | [link](/doc/arg.en.md) | [path](./source/01_general) | Indefinite parameters, obtain the number of indefinite parameters and specified parameters | arg | 01.00.00 | [link](/doc/arg.en.md) | [path](./source/01_general) | Indefinite parameters, obtain the number of indefinite parameters and specified parameters
| calculate | 01.01.00 | [link](/doc/calculate.en.md) | [path](./source/01_general) | Calculation module, input calculation expression to obtain calculation result | calculate | 01.01.00 | [link](/doc/calculate.en.md) | [path](./source/01_general) | Calculation module, input calculation expression to obtain calculation result
| command | 01.00.00 | [link](/doc/command.en.md) | [path](./source/01_general) | Command parsing module, input string commands (similar to shell commands), execute corresponding command functions | command | 01.00.00 | [link](/doc/command.en.md) | [path](./source/01_general) | Command parsing module, input string commands (similar to shell commands), execute corresponding command functions
| cPatten | 01.00.00 | [link](/doc/cPatten.en.md) | [path](./source/01_general) | Artistic character patterns | ArtFont | 01.00.00 | [link](/doc/ArtFont.en.md) | [path](./source/01_general) | Artistic character patterns
| cQueue | 01.00.01 | [link](/doc/cQueue.en.md) | [path](./source/01_general) | Universal queue controller | cQueue | 01.00.01 | [link](/doc/cQueue.en.md) | [path](./source/01_general) | Universal queue controller
| sList | 01.00.01 | [link](/doc/sList.en.md) | [path](./source/01_general) | Universal single-link list controller | sList | 01.00.01 | [link](/doc/sList.en.md) | [path](./source/01_general) | Universal single-link list controller
| dList | 01.00.01 | [link](/doc/dList.en.md) | [path](./source/01_general) | Universal double-link list controller | dList | 01.00.01 | [link](/doc/dList.en.md) | [path](./source/01_general) | Universal double-link list controller

View File

@ -24,7 +24,7 @@ varchwe-architecture意为我们的框架库是嵌入式C语言常用
| arg | 01.00.00 | [link](/doc/arg.md) | [path](./source/01_general) | 不定参数,获取不定参数和指定参数的个数 | arg | 01.00.00 | [link](/doc/arg.md) | [path](./source/01_general) | 不定参数,获取不定参数和指定参数的个数
| calculate | 01.01.00 | [link](/doc/calculate.md) | [path](./source/01_general) | 计算模块,输入计算表达式,得到计算结果 | calculate | 01.01.00 | [link](/doc/calculate.md) | [path](./source/01_general) | 计算模块,输入计算表达式,得到计算结果
| command | 01.00.00 | [link](/doc/command.md) | [path](./source/01_general) | 命令解析模块,输入字符串命令(类似于shell命令),执行相应的命令功能 | command | 01.00.00 | [link](/doc/command.md) | [path](./source/01_general) | 命令解析模块,输入字符串命令(类似于shell命令),执行相应的命令功能
| cPatten | 01.00.00 | [link](/doc/cPatten.md) | [path](./source/01_general) | 艺术图案字符 | ArtFont | 01.00.00 | [link](/doc/ArtFont.md) | [path](./source/01_general) | 艺术图案字符
| cQueue | 01.00.01 | [link](/doc/cQueue.md) | [path](./source/01_general) | 通用队列控制器 | cQueue | 01.00.01 | [link](/doc/cQueue.md) | [path](./source/01_general) | 通用队列控制器
| sList | 01.00.01 | [link](/doc/sList.md) | [path](./source/01_general) | 通用单链表控制器 | sList | 01.00.01 | [link](/doc/sList.md) | [path](./source/01_general) | 通用单链表控制器
| dList | 01.00.01 | [link](/doc/dList.md) | [path](./source/01_general) | 通用双链表控制器 | dList | 01.00.01 | [link](/doc/dList.md) | [path](./source/01_general) | 通用双链表控制器

30
doc/ArtFont.en.md Normal file
View File

@ -0,0 +1,30 @@
## Introduction
ArtFont is a simple character art module that forms artistic characters with characters.
## Interface
### Functions
```c
int ArtFont_print(char *string, char *buffer, int size);
```
Usage Example:
```c
ArtFont_print("varch", NULL, 0);
```
Result:
```
88
88
88
8b d8 ,adPPYYba, 8b,dPPYba, ,adPPYba, 88,dPPYba,
`8b d8' '' `Y8 88P' 'Y8 a8' '' 88P' '8a
`8b d8' ,adPPPPP88 88 8b 88 88
`8b,d8' 88, ,88 88 '8a, ,aa 88 88
'8' `'8bbdP'Y8 88 `'Ybbd8'' 88 88
```

31
doc/ArtFont.md Normal file
View File

@ -0,0 +1,31 @@
## 介绍
ArtFont为一个简单的字符艺术字模块通过字符组成艺术字符。
## 接口
### 函数
```c
int ArtFont_print(char *string, char *buffer, int size);
```
使用例子:
```c
ArtFont_print("varch", NULL, 0);
```
结果:
```
88
88
88
8b d8 ,adPPYYba, 8b,dPPYba, ,adPPYba, 88,dPPYba,
`8b d8' '' `Y8 88P' 'Y8 a8' '' 88P' '8a
`8b d8' ,adPPPPP88 88 8b 88 88
`8b,d8' 88, ,88 88 '8a, ,aa 88 88
'8' `'8bbdP'Y8 88 `'Ybbd8'' 88 88
```

View File

@ -1,52 +0,0 @@
## Introduction
cPatten is a simple character art module that forms artistic characters with characters.
## Interface
### Functions
```c
int cPatten_setMask(char c); // Set the characters that make up the artistic characters
void cPatten_showChar(char c); // Display the artistic character
void cPatten_showString(char *s); // Display the artistic string
```
Usage Example:
```c
static void show(void)
{
cPatten_setMask('`');
cPatten_showString("Varch");
cPatten_setMask('*');
cPatten_showString("Varch");
cPatten_setMask('0');
cPatten_showString("Varch");
cPatten_setMask('#');
cPatten_showString("Varch");
}
```
Result:
```
` ` ``` ``` ``` ` `
` ` ` ` ` ` ` ` ` `
` ` ````` ``` ` `````
` ` ` ` ` ` ` ` ` `
` ` ` ` ` ``` ` `
* * *** *** *** * *
* * * * * * * * * *
* * ***** *** * *****
* * * * * * * * * *
* * * * * *** * *
0 0 000 000 000 0 0
0 0 0 0 0 0 0 0 0 0
0 0 00000 000 0 00000
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 000 0 0
# # ### ### ### # #
# # # # # # # # # #
# # ##### ### # #####
# # # # # # # # # #
# # # # # ### # #
```

View File

@ -1,53 +0,0 @@
## 介绍
cPatten为一个简单的字符艺术字模块通过字符组成艺术字符。
## 接口
### 函数
```c
int cPatten_setMask(char c); // 设置艺术字组成字符
void cPatten_showChar(char c); // 显示艺术字符
void cPatten_showString(char *s); // 显示艺术字符串
```
使用例子:
```c
static void show(void)
{
cPatten_setMask('`');
cPatten_showString("Varch");
cPatten_setMask('*');
cPatten_showString("Varch");
cPatten_setMask('0');
cPatten_showString("Varch");
cPatten_setMask('#');
cPatten_showString("Varch");
}
```
结果:
```
` ` ``` ``` ``` ` `
` ` ` ` ` ` ` ` ` `
` ` ````` ``` ` `````
` ` ` ` ` ` ` ` ` `
` ` ` ` ` ``` ` `
* * *** *** *** * *
* * * * * * * * * *
* * ***** *** * *****
* * * * * * * * * *
* * * * * *** * *
0 0 000 000 000 0 0
0 0 0 0 0 0 0 0 0 0
0 0 00000 000 0 00000
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 000 0 0
# # ### ### ### # #
# # # # # # # # # #
# # ##### ### # #####
# # # # # # # # # #
# # # # # ### # #
```

View File

@ -2,7 +2,7 @@
#include <sys/time.h> #include <sys/time.h>
#include "init.h" #include "init.h"
#include "kern.h" #include "kern.h"
#include "cPatten.h" #include "ArtFont.h"
static unsigned int get_msec(void) static unsigned int get_msec(void)
{ {
@ -22,23 +22,9 @@ unsigned long long reckon_usec(void)
return us; return us;
} }
static void show(void)
{
printf("Hello varch!\r\n");
cPatten_setMask('`');
cPatten_showString("Varch");
cPatten_setMask('*');
cPatten_showString("Varch");
cPatten_setMask('0');
cPatten_showString("Varch");
cPatten_setMask('#');
cPatten_showString("Varch");
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
show(); ArtFont_print("varch", NULL, 0);
if (kern_init(get_msec, 1) == KE_OK) if (kern_init(get_msec, 1) == KE_OK)
{ {
printf("################################################\r\n"); printf("################################################\r\n");

View File

@ -0,0 +1,81 @@
/*********************************************************************************************************
* ------------------------------------------------------------------------------------------------------
* file description
* ------------------------------------------------------------------------------------------------------
* \file ArtFont.c
* \unit ArtFont
* \brief This is a C language artistic character patterns
* \author Lamdonn
* \version v1.0.0
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
#include "ArtFont.h"
#include <stdio.h>
#include <string.h>
#define ArtFont_putc(c) do { \
if (buffer) \
{ \
if (out < size) buffer[out++] = (c); \
else return -1; \
} \
else putchar(c); \
} while (0)
static char *artLines[11] = {
" 8 8 a8 8a 88888 88888 a ad888 888ba ",
" 88 88 88 88 88 ad88888ba ,adba, ,d8 ,adba, d8' d8' `8b d8 ,a8888a, 88 ad888888b, ad888888b, ,d8 8888888888 ad8888ba, 888888888888 ad88888ba ad88888ba a8' '8a ad88888ba ,ad88PPP88ba, db 88888888ba ,ad8888ba, 88888888ba, 88888888888 88888888888 ,ad8888ba, 88 88 88 88 88 a8P 88 88b d88 888b 88 ,ad8888ba, 88888888ba ,ad8888ba, 88888888ba ad88888ba 888888888888 88 88 8b d8 I8, 8 ,8I 8b d8 8b d8 888888888888 88 8b 88 ,888, `8b 88 88 ad88 88 88 88 88 88 88' 88 `88 ",
" 88 88 88 88 88 d8' 8 8 '8b 8I I8 ,d8' 8I I8 d8' d8' `8b I8a a8I aa ,8P' ,8P'' `'Y8, ,d88 d8' '88 d8' '88 ,d888 88 8P' 'Y8 ,8P' d8' '8b d8' '88 a8' '8a d8' '8b d8' .ama.a '8a d88b 88 '8b d8'' `'8b 88 `'8b 88 88 d8'' `'8b 88 88 88 88 88 ,88' 88 888b d888 8888b 88 d8'' `'8b 88 '8b d8'' `'8b 88 '8b d8' '8b 88 88 88 `8b d8' `8b d8b d8' Y8, ,8P Y8, ,8P ,88 88 `Y8, 88 ,d8P'Y8b, `8b 88 88 d8' 88 '' '' 88 88 ,d 88 88 88 ",
" 88 '' '' aa88aaa88aa Y8, 8 8 'fbdP' ,d8' '8bdP' '' d8' `8b 'Yb,,dP' 88 d8' ,8P Y8, 888888 a8P a8P ,d8' 88 88 ____ d8 d8' Y8a a8P 8P 88 a8' 8888888888 '8a '' a8P d8' ,8P'88' 88 d8'`8b 88 ,8P d8' 88 `8b 88 88 d8' 88 88 88 88 88 ,88' 88 88`8b d8'88 88 `8b 88 d8' `8b 88 ,8P d8' `8b 88 ,8P Y8, 88 88 88 `8b d8' '8, ,8'8, ,8' `8b d8' Y8, ,8P ,88' 88 '8b 88 I8' '8I '' 88 88 88 88 88 88 88 88 88 88 ",
" 88 ''88'''88'' `Y8a8a8a, ,d8' ,d8'8b 88 88 88 aaaa8888aaaa aaaa88aaaa ,8P' 88 88 88 ,d8P' aad8' ,d8' 88 88a8PPPP8b, 88,dd888bb, ,8P' 'Y8aaa8P' Y8, ,d88 888 888 a8' '8a ,a8P' 88 .8P 8P 88 d8' `8b 88aaaaaa8P' 88 88 88 88aaaaa 88aaaaa 88 88aaaaaaaa88 88 88 88,d88' 88 88 `8b d8' 88 88 `8b 88 88 88 88aaaaaa8P' 88 88 88aaaaaa8P' `Y8aaaaa, 88 88 88 `8b d8' Y8 8P Y8 8P Y88P '8aa8' ,88' 88 `P8, 88 ,adPPYYba, 88,dPPYba, ,adPPYba, ,adPPYb,88 ,adPPYba, MM88MMM ,adPPYb,d8 88,dPPYba, 88 88 88 ,d8 88 88,dPYba,,adPYba, 8b,dPPYba, ,adPPYba, 8b,dPPYba, ,adPPYb,d8 8b,dPPYba, ,adPPYba, MM88MMM 88 88 8b d8 8b db d8 8b, ,d8 8b d8 888888888 ,8P 88 Y8, ad8bba, ,aa ",
" 88 aa88aaa88aa `'8'8'8b, ,d8' .dP' Yb,8I 88 88 ''''8888'''' ''''88'''' aaaaaaaa d8' 88 88 88 a8P' ''Y8, ,d8' 88 PP' `8b 88P' `8b d8' ,d8'''8b, 'PPPPPP'88 888 ''' '8a 8888888888 a8' d8' 88 88 8' 8P d8YaaaaY8b 88''''''8b, 88 88 88 88''''' 88''''' 88 88888 88''''''''88 88 88 8888'88, 88 88 `8b d8' 88 88 `8b 88 88 88 88''''''' 88 88 88''''88' `'''''8b, 88 88 88 `8b d8' `8b d8' `8b d8' d88b `88' ,88' 88 '8b 88 '' `Y8 88P' '8a a8' '' a8' `Y88 a8P_____88 88 a8' `Y88 88P' '8a 88 88 88 ,a8' 88 88P' '88' '8a 88P' `'8a a8' '8a 88P' '8a a8' `Y88 88P' 'Y8 I8[ '' 88 88 88 `8b d8' `8b d88b d8' `Y8, ,8P' `8b d8' a8P' <8( )8> '' ''Y8P' ",
" '' ''88'''88'' 8 8 `8b ,d8' ,adba, 8P 888' Y8, ,8P ,dP'`Yb, 88 aaa '''''''' ,8P' `8b d8' 88 a8P' '8b 8888888888888 d8 88 d8 ,8P' d8' '8b 8P aaa '8a a8' '' 88 8B ,d8 ,ad8' d8''''''''8b 88 `8b Y8, 88 8P 88 88 Y8, 88 88 88 88 88 88P Y8b 88 88 `8b d8' 88 88 `8b 88 Y8, ,8P 88 Y8, '88,,8P 88 `8b `8b 88 88 88 `8b d8' `8a a8' `8a a8' ,8P Y8, 88 ,88' 88 `Y8, 88 ,adPPPPP88 88 d8 8b 8b 88 8PP''''''' 88 8b 88 88 88 88 88 8888[ 88 88 88 88 88 88 8b d8 88 d8 8b 88 88 `'Y8ba, 88 88 88 `8b d8' `8b d8'`8b d8' )888( `8b d8' ,d8P' '8b 88 d8' ",
" aa 88 88 Y8a 8 8 a8P ,d8' 8I I8 8b, ,dP8b Y8, ,8P I8' '8I '' '88 888 d8' `8ba, ,ad8' 88 d8' Y8, a88 88 Y8a a8P 88a a8P d8' Y8a a8P 8b, a8P 888 '88 '8a a8' aa '8a '88P'888P' d8' `8b 88 a8P Y8a. .a8P 88 .a8P 88 88 Y8a. .a88 88 88 88 88, ,d88 88 '88, 88 88 `888' 88 88 `8888 Y8a. .a8P 88 Y8a. Y88P 88 `8b Y8a a8P 88 Y8a. .a8P `888' `8a8' `8a8' d8' `8b 88 88' 88 '8b 88 88, ,88 88b, ,a8' '8a, ,aa '8a, ,d88 '8b, ,aa 88 '8a, ,d88 88 88 88 88 88`'Yba, 88 88 88 88 88 88 '8a, ,a8' 88b, ,a8' '8a ,d88 88 aa ]8I 88, '8a, ,a88 `8b,d8' `8bd8' `8bd8' ,d8' '8b, `8b,d8' ,d8' 88 88 88 ",
" 88 88 88 'Y88888P' 8' 'fbdP' `Y8888P' Yb Y8, ,8P d8' 888 8P' 'Y8888P' 88 88888888888 'Y888888P' 88 'Y88888P' 'Y88888P' 8P' 'Y88888P' `'Y8888P' 888 d8' '8a a8' 88 `Y8aaaaaaaad8P d8' `8b 88888888P' `'Y8888Y'' 88888888Y'' 88888888888 88 `'Y88888P' 88 88 88 'Y8888P' 88 Y8b 88888888888 88 `8' 88 88 `888 `'Y8888Y'' 88 `'Y8888Y'Y8a 88 `8b 'Y88888P' 88 `'Y8888Y'' `8' `8' `8' 8P Y8 88 888888888888 88 `Y8 88 `'8bbdP'Y8 8Y'Ybbd8'' `'Ybbd8'' `'8bbdP'Y8 `'Ybbd8'' 88 `'YbbdP'Y8 88 88 88 88 88 `Y8a 88 88 88 88 88 88 `'YbbdP'' 88`YbbdP'' `'YbbdP'88 88 `'YbbdP'' 'Y888 `'YbbdP'Y8 '8' YP YP 8P' `Y8 Y88' 888888888 88 88 88 ",
" 8 8 '8 8' 8' 8' ''''''''' 88888 88888 aa, ,88 ,88 88 88 d8' 88, 88 ,88 ",
" 888888888888 'Y8bbdP' 888P' 88 88 d8' 'Y888 888P' ",
};
static int artCharPosition[] = {
// ' ' '!' '"' '#' '$' '%' '&' ''' '(' ')' '*' '+' ',' '-' '.' '/' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' ':' ';' '<' '=' '>' '?' '@' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '[' '\' ']' '^' '_' '`' 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '{' '|' '}' '~'
0, 3, 7, 14, 27, 40, 57, 71, 78, 85, 92, 106, 118, 124, 134, 139, 153, 169, 177, 190, 203, 218, 231, 244, 258, 271, 284, 289, 295, 306, 318, 329, 342, 360, 378, 391, 406, 421, 434, 447, 462, 476, 480, 492, 506, 519, 538, 552, 568, 581, 597, 610, 623, 637, 651, 668, 693, 707, 721, 735, 742, 756, 763, 776, 790, 797, 809, 822, 834, 847, 859, 868, 881, 894, 898, 905, 916, 920, 940, 953, 966, 979, 992, 1004, 1015, 1024, 1037, 1050, 1070, 1083, 1096, 1107, 1116, 1120, 1129, 1145
};
int ArtFont_print(char *string, char *buffer, int size)
{
int len = 0, line = 0;
int i = 0, j = 0;
int base = 0, width = 0;
char *s = NULL;
int out = 0;
if (!string) return -1;
len = strlen(string);
for (line = 0; line < 11; line++)
{
for (i = 0; i < len; i++)
{
if (' ' <= string[i] && string[i] <= '~')
{
base = artCharPosition[string[i] - ' '];
width = artCharPosition[string[i] + 1 - ' '] - base;
s = &artLines[line][base];
for (j = 0; j < width; j++)
{
ArtFont_putc(s[j]);
}
}
else
{
continue;
}
}
ArtFont_putc('\n');
}
ArtFont_putc(0);
return out;
}

View File

@ -2,16 +2,16 @@
* ------------------------------------------------------------------------------------------------------ * ------------------------------------------------------------------------------------------------------
* file description * file description
* ------------------------------------------------------------------------------------------------------ * ------------------------------------------------------------------------------------------------------
* \file cPatten.h * \file ArtFont.h
* \unit cPatten * \unit ArtFont
* \brief This is a C language artistic character patterns * \brief This is a C language artistic character patterns
* \author Lamdonn * \author Lamdonn
* \version v1.0.0 * \version v1.0.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/
#ifndef __cPatten_H #ifndef __ArtFont_H
#define __cPatten_H #define __ArtFont_H
#include <stdlib.h> #include <stdlib.h>
@ -22,25 +22,13 @@
#define CPATTEN_V_PATCH 0 #define CPATTEN_V_PATCH 0
/** /**
* \brief Set masking character. * \brief Print artistic string.
* \param[in] c: Mask characters, which are artistic characters composed of these characters * \param[in] string: string
* \return 1 success or 0 fail * \param[in] buffer: buffer, if NULL, print to stdout
* \param[in] size: size of buffer
* \return count of characters printed
*/ */
int cPatten_setMask(char c); int ArtFont_print(char *string, char *buffer, int size);
/**
* \brief Show artistic character.
* \param[in] c: char
* \return none
*/
void cPatten_showChar(char c);
/**
* \brief Show artistic string.
* \param[in] s: string
* \return none
*/
void cPatten_showString(char *s);
#endif #endif

View File

@ -1,311 +0,0 @@
/*********************************************************************************************************
* ------------------------------------------------------------------------------------------------------
* file description
* ------------------------------------------------------------------------------------------------------
* \file cPatten.c
* \unit cPatten
* \brief This is a C language artistic character patterns
* \author Lamdonn
* \version v1.0.0
* \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/
#include "cPatten.h"
#include <stdio.h>
#include <string.h>
typedef struct
{
char *line[5];
} artCharType_simple;
static artCharType_simple artCharType_simpleTable[] = {
/* A */
{
" AAA ",
" A A ",
" AAAAA ",
" A A ",
" A A ",
},
/* B */
{
" BBB ",
" B B ",
" BBB ",
" B B ",
" BBB ",
},
/* C */
{
" CCC ",
" C C ",
" C ",
" C C ",
" CCC ",
},
/* D */
{
" DDD ",
" D D ",
" D D ",
" D D ",
" DDD ",
},
/* E */
{
" EEEE ",
" E ",
" EEE ",
" E ",
" EEEE ",
},
/* F */
{
" FFFFF ",
" F ",
" FFF ",
" F ",
" F ",
},
/* G */
{
" GGG ",
" G ",
" G GG ",
" G G ",
" GGG ",
},
/* H */
{
" H H ",
" H H ",
" HHHHH ",
" H H ",
" H H ",
},
/* I */
{
" III ",
" I ",
" I ",
" I ",
" III ",
},
/* J */
{
" JJJ ",
" J ",
" J ",
" J J ",
" JJJJ ",
},
/* K */
{
" K K ",
" K K ",
" KK ",
" K K ",
" K K ",
},
/* L */
{
" L ",
" L ",
" L ",
" L ",
" LLLLL ",
},
/* M */
{
" M M ",
" MM MM ",
" M M M M ",
" M M M ",
" M M ",
},
/* N */
{
" N N ",
" NN N ",
" N N N ",
" N N N ",
" N N N ",
},
/* O */
{
" OOO ",
" O O ",
" O O ",
" O O ",
" OOO ",
},
/* P */
{
" PPP ",
" P P ",
" PPP ",
" P ",
" P ",
},
/* Q */
{
" QQQ ",
" Q Q ",
" Q Q ",
" Q QQ ",
" QQQ Q ",
},
/* R */
{
" RRR ",
" R R ",
" RRR ",
" R R ",
" R R ",
},
/* S */
{
" SSS ",
" S ",
" SS ",
" S ",
" SSS ",
},
/* T */
{
" TTTTT ",
" T ",
" T ",
" T ",
" T ",
},
/* U */
{
" U U ",
" U U ",
" U U ",
" U U ",
" UUU ",
},
/* V */
{
" V V ",
" V V ",
" V V ",
" V V ",
" V ",
},
/* W */
{
" W W ",
" W W ",
" W W W ",
" W W W W ",
" W W W ",
},
/* X */
{
" X X ",
" X X ",
" X ",
" X X ",
" X X ",
},
/* Y */
{
" Y Y ",
" Y Y ",
" Y ",
" Y ",
" Y ",
},
/* Z */
{
" ZZZZZ ",
" Z ",
" Z ",
" Z ",
" ZZZZZ ",
}
};
static void cPatten_putChar(char c, char mask)
{
if (mask && c != ' ')
{
putchar(mask);
}
else
{
putchar(c);
}
}
static void cPatten_putString(char *s, char mask)
{
while (*s)
{
cPatten_putChar(*s, mask);
s++;
}
}
static char cMask = 0;
int cPatten_setMask(char c)
{
if ((c >= ' ' && c <= '~') || c == 0)
{
cMask = c;
}
else return 0;
return 1;
}
void cPatten_showChar(char c)
{
int i;
int tableIndex = -1;
if ('A' <= c && c <= 'Z') tableIndex = c - 'A';
if ('a' <= c && c <= 'z') tableIndex = c - 'a';
if (tableIndex < 0) return;
for (i = 0; i < 5; i++)
{
cPatten_putString(artCharType_simpleTable[tableIndex].line[i], cMask);
printf("\r\n");
}
}
void cPatten_showString(char *s)
{
int len, i, j;
int tableIndex;
char c;
if (!s) return;
len = strlen(s);
for (i = 0; i < 5; i++)
{
for (j = 0; j < len; j++)
{
c = s[j];
tableIndex = -1;
if ('A' <= c && c <= 'Z') tableIndex = c - 'A';
if ('a' <= c && c <= 'z') tableIndex = c - 'a';
if (tableIndex < 0) continue;
cPatten_putString(artCharType_simpleTable[tableIndex].line[i], cMask);
}
printf("\r\n");
}
}