2021-10-10 13:31:04 +00:00
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
2021-10-10 13:32:03 +00:00
|
|
|
#define TYPETONAME(X) #X,
|
|
|
|
static const char *const typenames[] = { BIDI_CHAR_TYPE_LIST(TYPETONAME) };
|
|
|
|
#undef TYPETONAME
|
|
|
|
|
2021-10-10 13:31:04 +00:00
|
|
|
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);
|
2021-10-10 13:32:03 +00:00
|
|
|
printf("U+%04x: %s\n", (unsigned)chr, typenames[type]);
|
2021-10-10 13:31:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|