Beispiel #1
0
static int test_x_04(void)
{
    char result[1024];
    char *t;
    int ch;
    int xx;
    int yy;
    int i;
    v18_state_t *v18_state;

    /* III.5.4.5.4 5 Bit to T.50 character conversion */
    v18_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL);
    printf("Original:\n");
    t = result;
    for (i = 0;  i < 127;  i++)
    {
        ch = i;
        printf("%c", ch);
        xx = v18_encode_baudot(v18_state, ch);
        if (xx)
        {
            if ((xx & 0x3E0))
            {
                yy = v18_decode_baudot(v18_state, (xx >> 5) & 0x1F);
                if (yy)
                    *t++ = yy;
            }
            yy = v18_decode_baudot(v18_state, xx & 0x1F);
            if (yy)
                *t++ = yy;
        }
    }
Beispiel #2
0
static int test_x_04(void)
{
    const char *s;
    const char *ref;
    char result[1024];
    char *t;
    int ch;
    int xx;
    int yy;
    v18_state_t *v18_state;

    /* III.5.4.5.4 5 Bit to T.50 character conversion */
    v18_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL);
    s = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()";
    printf("Original:\n%s\n", s);
    t = result;
    while ((ch = *s++))
    {
        xx = v18_encode_baudot(v18_state, ch);
        if ((xx & 0x3E0))
        {
            yy = v18_decode_baudot(v18_state, (xx >> 5) & 0x1F);
            if (yy)
                *t++ = yy;
        }
        yy = v18_decode_baudot(v18_state, xx & 0x1F);
        if (yy)
            *t++ = yy;
    }