]> git.saurik.com Git - wxWidgets.git/blame - utils/wxMMedia2/lib/converter.def
added support for several new events in wxCalendarCtrl: clicking on week
[wxWidgets.git] / utils / wxMMedia2 / lib / converter.def
CommitLineData
526ddb13 1#define DEFINE_CONV_8(name) \
0662cd32 2static void Convert_##name##_8(const char *buf_in, char *buf_out, wxUint32 len) \
526ddb13
GL
3{\
4 wxUint16 val; \
5\
6 while (len > 0) { \
7 val = *buf_in++; \
8 len--;
9
10#if SWAP_BYTES==0
11
12#define DEFINE_CONV_16(name) \
0662cd32 13static void Convert_##name##_16_no(const char *buf_in, char *buf_out, wxUint32 len) \
526ddb13
GL
14{\
15 wxUint16 val; \
16\
17 while (len > 0) { \
18 val = *(wxUint16 *)(buf_in); \
19 buf_in += 2; \
20 len -= 2;
21
22#else
23
24#define DEFINE_CONV_16(name) \
0662cd32 25static void Convert_##name##_16_yes(const char *buf_in, char *buf_out, wxUint32 len) \
526ddb13
GL
26{\
27 wxUint16 val; \
28\
29 while (len > 0) { \
30 val = *(wxUint16 *)(buf_in); \
31 val = wxUINT16_SWAP_ALWAYS(val); \
32 buf_in += 2; \
33 len -= 2;
34
35#endif
36
37#define END_CONV } }
38
39#define PUT16 *((wxUint16 *)buf_out) = val, buf_out += 2;
40#define PUT16_SWAP *((wxUint16 *)buf_out) = wxUINT16_SWAP_ALWAYS(val), buf_out += 2;
41#define PUT8 *buf_out++ = val;
42#define CHANGE16_SIGN val ^= 0x8000;
43#define CHANGE8_SIGN val ^= 0x80;
44#define REDUCE16_TO_8 val /= 256;
45#define AUGMENT8_TO_16 val *= 256;
46
47DEFINE_CONV_16(16to8)
48REDUCE16_TO_8
49PUT8
50END_CONV
51
52DEFINE_CONV_16(16to8_U2S)
53CHANGE16_SIGN
54REDUCE16_TO_8
55PUT8
56END_CONV
57
58DEFINE_CONV_16(U2S)
59CHANGE16_SIGN
60PUT16
61END_CONV
62
63DEFINE_CONV_16(U2S_SWAP)
64CHANGE16_SIGN
65PUT16_SWAP
66END_CONV
67
68#if SWAP_BYTES == 0
69
70DEFINE_CONV_16(SWAP)
71PUT16_SWAP
72END_CONV
73
74DEFINE_CONV_8(U2S)
75CHANGE8_SIGN
76PUT8
77END_CONV
78
79DEFINE_CONV_8(8to16)
80AUGMENT8_TO_16
81PUT16
82END_CONV
83
84DEFINE_CONV_8(8to16_SWAP)
85AUGMENT8_TO_16
86PUT16_SWAP
87END_CONV
88
89DEFINE_CONV_8(8to16_U2S)
90CHANGE8_SIGN
91AUGMENT8_TO_16
92PUT16
93END_CONV
94
95DEFINE_CONV_8(8to16_U2S_SWAP)
96CHANGE8_SIGN
97AUGMENT8_TO_16
98PUT16_SWAP
99END_CONV
100
101#endif
102
103#undef DEFINE_CONV_16
104#undef DEFINE_CONV_8
105#undef END_CONV
106#undef CHANGE16_SIGN
107#undef CHANGE8_SIGN
108#undef PUT16_SWAP
109#undef PUT16
110#undef PUT8