mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
804f32765f
This makes it easier to create the matching array of type names in bidi_gettype.c, and eliminates the need for an assertion to check the array matched the enum. And I'm about to need to add more types, so let's start by making that trivially easy.
34 lines
639 B
C
34 lines
639 B
C
/*
|
|
* Standalone test program that exposes the minibidi getType function.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
#include "putty.h"
|
|
#include "misc.h"
|
|
#include "bidi.h"
|
|
|
|
void out_of_memory(void)
|
|
{
|
|
fprintf(stderr, "out of memory!\n");
|
|
exit(2);
|
|
}
|
|
|
|
#define TYPETONAME(X) #X,
|
|
static const char *const typenames[] = { BIDI_CHAR_TYPE_LIST(TYPETONAME) };
|
|
#undef TYPETONAME
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i;
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
unsigned long chr = strtoul(argv[i], NULL, 0);
|
|
int type = bidi_getType(chr);
|
|
printf("U+%04x: %s\n", (unsigned)chr, typenames[type]);
|
|
}
|
|
|
|
return 0;
|
|
}
|