mirror of
https://github.com/buserror/mii_emu.git
synced 2024-11-28 10:52:35 +00:00
34 lines
606 B
C
34 lines
606 B
C
|
/*
|
||
|
* mish_vt_test.c
|
||
|
*
|
||
|
* Copyright (C) 2020 Michel Pollet <buserror@gmail.com>
|
||
|
*
|
||
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
*/
|
||
|
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include "../src/mish_vt.c"
|
||
|
|
||
|
/* small test unit for the VT decoder, mostly for UTF8 */
|
||
|
int main()
|
||
|
{
|
||
|
const char * input = "Hello 😈 \033[1mThere\033[0m";
|
||
|
|
||
|
mish_vt_sequence_t sq = {};
|
||
|
|
||
|
printf("%s\n", input);
|
||
|
const char *s = input;
|
||
|
int cg = 0;
|
||
|
while (*s) {
|
||
|
if (_mish_vt_sequence_char(&sq, *s)) {
|
||
|
printf("glyph s:%08x g:%08x\n", sq.seq, sq.glyph);
|
||
|
if (sq.glyph)
|
||
|
cg++;
|
||
|
}
|
||
|
s++;
|
||
|
}
|
||
|
printf("%d glyphs in string\n", cg);
|
||
|
}
|