Revision 8de0859b libavcodec/tableprint.h

View differences:

libavcodec/tableprint.h
24 24
#define AVCODEC_TABLEPRINT_H
25 25

  
26 26
#include <stdint.h>
27
#include <stdio.h>
28

  
29
#define WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, ...)\
30
void write_##name##_array(const void *arg, int len, int dummy)\
31
{\
32
    const type *data = arg;\
33
    int i;\
34
    printf("   ");\
35
    for (i = 0; i < len - 1; i++) {\
36
       printf(" "fmtstr",", __VA_ARGS__);\
37
       if ((i & linebrk) == linebrk) printf("\n   ");\
38
    }\
39
    printf(" "fmtstr"\n", __VA_ARGS__);\
40
}
41

  
42
#define WRITE_1D_FUNC(name, type, fmtstr, linebrk)\
43
    WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, data[i])
44

  
45
#define WRITE_2D_FUNC(name, type)\
46
void write_##name##_2d_array(const void *arg, int len, int len2)\
47
{\
48
    const type *data = arg;\
49
    int i;\
50
    printf("    {\n");\
51
    for (i = 0; i < len; i++) {\
52
        write_##name##_array(data + i * len2, len2, 0);\
53
        printf(i == len - 1 ? "    }\n" : "    }, {\n");\
54
    }\
55
}
27 56

  
28 57
/**
29 58
 * \defgroup printfuncs Predefined functions for printing tables

Also available in: Unified diff