aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: 3ec160691eb2a6d37d70b2109a7dff29608294e3 (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
#include <stdio.h>
#include "msgpack.h"

#define BODY_SUCCESS printf("%s\n", msgpack_type_string[t])
#define BODY_ERROR   {                                          \
        printf("ERROR %s %s %s\n", msgpack_error_string[e],     \
               msgpack_type_string[t], msgpack_type_string[a]); \
        return 1;                                               \
    }
int main(void)
{
    // char buf[] = {0x0F};
    // int b = 0;
    // MSGPACK_CHECK2(msgpack_read_bool(&msgpack_init(buf, 1, NULL), &b),(t, e, a),
    //                BODY_SUCCESS, BODY_ERROR);
    // printf("VALUE %d\n", b);

    // char buf[] = {0xD3, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01};
    char buf[] = {0xCC, 0xFF};
    union mp_int m; m.i = 0;
    MSGPACK_CHECK2(msgpack_read_int(&msgpack_init(buf, sizeof(buf), NULL), &m),(t, e, a),
                   BODY_SUCCESS, BODY_ERROR);
    printf("VALUE %llu\n", m.u);
    return 0;
}