Haka
string.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef HAKA_STRING_H
6 #define HAKA_STRING_H
7 
8 #include <haka/types.h>
9 #include <wchar.h>
10 
11 #define TOSTR(name, type, obj) \
12  char name[TOSTR_##type##_size]; \
13  TOSTR_##type(obj, name)
14 
15 #define TOWSTR(name, type, obj) \
16  wchar_t name[TOSTR_##type##_size]; \
17  { \
18  char tmp[TOSTR_##type##_size]; \
19  TOSTR_##type(obj, tmp); \
20  swprintf(name, TOSTR_##type##_size, L"%s", tmp); \
21  }
22 
23 #endif /* HAKA_STRING_H */