Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bidi_gettype.c « terminal - github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f3f5338e1656ddf6c36e9f73e1a32317569ab682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * 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;
}