wxcrtvararg.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/wxcrtvararg.h
  3. // Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
  4. // printf(), scanf() and related CRT functions
  5. // Author: Joel Farley, Ove Kåven
  6. // Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
  7. // Created: 2007-02-19
  8. // Copyright: (c) 2007 REA Elektronik GmbH
  9. // Licence: wxWindows licence
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #ifndef _WX_WXCRTVARARG_H_
  12. #define _WX_WXCRTVARARG_H_
  13. // NB: User code should include wx/crt.h instead of including this
  14. // header directly.
  15. #include "wx/wxcrt.h"
  16. #include "wx/strvararg.h"
  17. #include "wx/string.h"
  18. // ----------------------------------------------------------------------------
  19. // CRT functions aliases
  20. // ----------------------------------------------------------------------------
  21. /* Required for wxPrintf() etc */
  22. #include <stdarg.h>
  23. /* printf() family saga */
  24. /*
  25. For many old Unix systems [v]snprintf()/vsscanf() exists in the system
  26. libraries but not in the headers, so we need to declare it ourselves to be
  27. able to use it.
  28. */
  29. #ifdef __UNIX__
  30. #if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
  31. #ifdef __cplusplus
  32. extern "C"
  33. #else
  34. extern
  35. #endif
  36. int vsnprintf(char *str, size_t size, const char *format, va_list ap);
  37. #endif /* !HAVE_VSNPRINTF_DECL */
  38. #if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
  39. #ifdef __cplusplus
  40. extern "C"
  41. #else
  42. extern
  43. #endif
  44. int snprintf(char *str, size_t size, const char *format, ...);
  45. #endif /* !HAVE_SNPRINTF_DECL */
  46. #if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL)
  47. #ifdef __cplusplus
  48. extern "C"
  49. #else
  50. extern
  51. #endif
  52. int vsscanf(const char *str, const char *format, va_list ap);
  53. #endif /* !HAVE_VSSCANF_DECL */
  54. /* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
  55. * same isn't done for snprintf below, the builtin wxSnprintf_ is used
  56. * instead since it's already a simple wrapper */
  57. #if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
  58. inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
  59. {
  60. return vsnprintf(str, size, (char*)format, ap);
  61. }
  62. #endif
  63. #endif /* __UNIX__ */
  64. /*
  65. mingw32 normally uses MSVCRT which has non-standard vswprintf() and so
  66. normally _vsnwprintf() is used instead, the only exception is when mingw32
  67. is used with STLPort which does have a standard vswprintf() starting from
  68. version 5.1 which we can use.
  69. */
  70. #ifdef __MINGW32__
  71. #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510
  72. #ifndef HAVE_VSWPRINTF
  73. #define HAVE_VSWPRINTF
  74. #endif
  75. #elif defined(HAVE_VSWPRINTF)
  76. /* can't use non-standard vswprintf() */
  77. #undef HAVE_VSWPRINTF
  78. #endif
  79. #endif /* __MINGW32__ */
  80. #if defined(__WATCOMC__)
  81. #define HAVE_VSWPRINTF 1
  82. #endif
  83. #if wxUSE_PRINTF_POS_PARAMS
  84. /*
  85. The systems where vsnprintf() supports positional parameters should
  86. define the HAVE_UNIX98_PRINTF symbol.
  87. On systems which don't (e.g. Windows) we are forced to use
  88. our wxVsnprintf() implementation.
  89. */
  90. #if defined(HAVE_UNIX98_PRINTF)
  91. #ifdef HAVE_VSWPRINTF
  92. #define wxCRT_VsnprintfW vswprintf
  93. #endif
  94. #ifdef HAVE_BROKEN_VSNPRINTF_DECL
  95. #define wxCRT_VsnprintfA wx_fixed_vsnprintf
  96. #else
  97. #define wxCRT_VsnprintfA vsnprintf
  98. #endif
  99. #else /* !HAVE_UNIX98_PRINTF */
  100. /*
  101. The only compiler with positional parameters support under Windows
  102. is VC++ 8.0 which provides a new xxprintf_p() functions family.
  103. The 2003 PSDK includes a slightly earlier version of VC8 than the
  104. main release and does not have the printf_p functions.
  105. */
  106. #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
  107. #define wxCRT_VsnprintfA _vsprintf_p
  108. #define wxCRT_VsnprintfW _vswprintf_p
  109. #endif
  110. #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
  111. #else /* !wxUSE_PRINTF_POS_PARAMS */
  112. /*
  113. We always want to define safe snprintf() function to be used instead of
  114. sprintf(). Some compilers already have it (or rather vsnprintf() which
  115. we really need...), otherwise we implement it using our own printf()
  116. code.
  117. We define function with a trailing underscore here because the real one
  118. is a wrapper around it as explained below
  119. */
  120. #if defined(__VISUALC__) || \
  121. (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
  122. #define wxCRT_VsnprintfA _vsnprintf
  123. #define wxCRT_VsnprintfW _vsnwprintf
  124. #else
  125. #if defined(HAVE__VSNWPRINTF)
  126. #define wxCRT_VsnprintfW _vsnwprintf
  127. #elif defined(HAVE_VSWPRINTF)
  128. #define wxCRT_VsnprintfW vswprintf
  129. #elif defined(__WATCOMC__)
  130. #define wxCRT_VsnprintfW _vsnwprintf
  131. #endif
  132. #if defined(HAVE_VSNPRINTF) \
  133. || defined(__WATCOMC__)
  134. #ifdef HAVE_BROKEN_VSNPRINTF_DECL
  135. #define wxCRT_VsnprintfA wx_fixed_vsnprintf
  136. #else
  137. #define wxCRT_VsnprintfA vsnprintf
  138. #endif
  139. #endif
  140. #endif
  141. #endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
  142. #ifndef wxCRT_VsnprintfW
  143. /* no (suitable) vsnprintf(), cook our own */
  144. WXDLLIMPEXP_BASE int
  145. wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr);
  146. #define wxUSE_WXVSNPRINTFW 1
  147. #else
  148. #define wxUSE_WXVSNPRINTFW 0
  149. #endif
  150. #ifndef wxCRT_VsnprintfA
  151. /* no (suitable) vsnprintf(), cook our own */
  152. WXDLLIMPEXP_BASE int
  153. wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr);
  154. #define wxUSE_WXVSNPRINTFA 1
  155. #else
  156. #define wxUSE_WXVSNPRINTFA 0
  157. #endif
  158. // for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx
  159. // implementation is used no matter what (in UTF-8 build, either *A or *W
  160. // version may be called):
  161. #if !wxUSE_UNICODE
  162. #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
  163. #elif wxUSE_UNICODE_WCHAR
  164. #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW
  165. #elif wxUSE_UTF8_LOCALE_ONLY
  166. #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
  167. #else // UTF-8 under any locale
  168. #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW)
  169. #endif
  170. #define wxCRT_FprintfA fprintf
  171. #define wxCRT_PrintfA printf
  172. #define wxCRT_VfprintfA vfprintf
  173. #define wxCRT_VprintfA vprintf
  174. #define wxCRT_VsprintfA vsprintf
  175. /*
  176. In Unicode mode we need to have all standard functions such as wprintf() and
  177. so on but not all systems have them so use our own implementations in this
  178. case.
  179. */
  180. #if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
  181. #define wxNEED_WPRINTF
  182. #endif
  183. #if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF) && defined(HAVE_VSSCANF)
  184. #define wxNEED_VSWSCANF
  185. #endif
  186. #if defined(wxNEED_WPRINTF)
  187. /*
  188. we need to implement all wide character printf functions either because
  189. we don't have them at all or because they don't have the semantics we
  190. need
  191. */
  192. int wxCRT_PrintfW( const wchar_t *format, ... );
  193. int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... );
  194. int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap );
  195. int wxCRT_VprintfW( const wchar_t *format, va_list ap );
  196. int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap );
  197. #else /* !wxNEED_WPRINTF */
  198. #define wxCRT_FprintfW fwprintf
  199. #define wxCRT_PrintfW wprintf
  200. #define wxCRT_VfprintfW vfwprintf
  201. #define wxCRT_VprintfW vwprintf
  202. #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF)
  203. // only non-standard vswprintf() without buffer size argument can be used here
  204. #define wxCRT_VsprintfW vswprintf
  205. #endif
  206. #endif /* wxNEED_WPRINTF */
  207. /* Required for wxScanf() etc. */
  208. #define wxCRT_ScanfA scanf
  209. #define wxCRT_SscanfA sscanf
  210. #define wxCRT_FscanfA fscanf
  211. /* vsscanf() may have a wrong declaration with non-const first parameter, fix
  212. * this by wrapping it if necessary. */
  213. #if defined __cplusplus && defined HAVE_BROKEN_VSSCANF_DECL
  214. inline int wxCRT_VsscanfA(const char *str, const char *format, va_list ap)
  215. {
  216. return vsscanf(const_cast<char *>(str), format, ap);
  217. }
  218. #else
  219. #define wxCRT_VsscanfA vsscanf
  220. #endif
  221. #if defined(wxNEED_WPRINTF)
  222. int wxCRT_ScanfW(const wchar_t *format, ...);
  223. int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...);
  224. int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...);
  225. #else
  226. #define wxCRT_ScanfW wxVMS_USE_STD wscanf
  227. #define wxCRT_SscanfW wxVMS_USE_STD swscanf
  228. #define wxCRT_FscanfW wxVMS_USE_STD fwscanf
  229. #endif
  230. #ifdef wxNEED_VSWSCANF
  231. int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
  232. #else
  233. #define wxCRT_VsscanfW wxVMS_USE_STD vswscanf
  234. #endif
  235. // ----------------------------------------------------------------------------
  236. // user-friendly wrappers to CRT functions
  237. // ----------------------------------------------------------------------------
  238. #ifdef __WATCOMC__
  239. // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
  240. #define wxPrintf wxPrintf_Impl
  241. #define wxFprintf wxFprintf_Impl
  242. #define wxSprintf wxSprintf_Impl
  243. #define wxSnprintf wxSnprintf_Impl
  244. #endif
  245. // FIXME-UTF8: remove this
  246. #if wxUSE_UNICODE
  247. #define wxCRT_PrintfNative wxCRT_PrintfW
  248. #define wxCRT_FprintfNative wxCRT_FprintfW
  249. #else
  250. #define wxCRT_PrintfNative wxCRT_PrintfA
  251. #define wxCRT_FprintfNative wxCRT_FprintfA
  252. #endif
  253. WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&),
  254. wxCRT_PrintfNative, wxCRT_PrintfA)
  255. inline int wxPrintf(const wxFormatString& s)
  256. {
  257. return wxPrintf("%s", s.InputAsString());
  258. }
  259. WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
  260. wxCRT_FprintfNative, wxCRT_FprintfA)
  261. inline int wxFprintf(FILE *f, const wxFormatString& s)
  262. {
  263. return wxFprintf(f, "%s", s.InputAsString());
  264. }
  265. // va_list versions of printf functions simply forward to the respective
  266. // CRT function; note that they assume that va_list was created using
  267. // wxArgNormalizer<T>!
  268. #if wxUSE_UNICODE_UTF8
  269. #if wxUSE_UTF8_LOCALE_ONLY
  270. #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
  271. return implA args
  272. #else
  273. #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
  274. if ( wxLocaleIsUtf8 ) return implA args; \
  275. else return implW args
  276. #endif
  277. #elif wxUSE_UNICODE_WCHAR
  278. #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
  279. return implW args
  280. #else // ANSI
  281. #define WX_VARARG_VFOO_IMPL(args, implW, implA) \
  282. return implA args
  283. #endif
  284. inline int
  285. wxVprintf(const wxString& format, va_list ap)
  286. {
  287. WX_VARARG_VFOO_IMPL((wxFormatString(format), ap),
  288. wxCRT_VprintfW, wxCRT_VprintfA);
  289. }
  290. inline int
  291. wxVfprintf(FILE *f, const wxString& format, va_list ap)
  292. {
  293. WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap),
  294. wxCRT_VfprintfW, wxCRT_VfprintfA);
  295. }
  296. #undef WX_VARARG_VFOO_IMPL
  297. // wxSprintf() and friends have to be implemented in two forms, one for
  298. // writing to char* buffer and one for writing to wchar_t*:
  299. #if !wxUSE_UTF8_LOCALE_ONLY
  300. int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...);
  301. #endif
  302. #if wxUSE_UNICODE_UTF8
  303. int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...);
  304. #endif
  305. WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&),
  306. wxDoSprintfWchar, wxDoSprintfUtf8)
  307. int WXDLLIMPEXP_BASE
  308. wxVsprintf(char *str, const wxString& format, va_list argptr);
  309. #if !wxUSE_UTF8_LOCALE_ONLY
  310. int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...);
  311. #endif
  312. #if wxUSE_UNICODE_UTF8
  313. int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...);
  314. #endif
  315. WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&),
  316. wxDoSnprintfWchar, wxDoSnprintfUtf8)
  317. int WXDLLIMPEXP_BASE
  318. wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr);
  319. #if wxUSE_UNICODE
  320. #if !wxUSE_UTF8_LOCALE_ONLY
  321. int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...);
  322. #endif
  323. #if wxUSE_UNICODE_UTF8
  324. int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...);
  325. #endif
  326. WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&),
  327. wxDoSprintfWchar, wxDoSprintfUtf8)
  328. int WXDLLIMPEXP_BASE
  329. wxVsprintf(wchar_t *str, const wxString& format, va_list argptr);
  330. #if !wxUSE_UTF8_LOCALE_ONLY
  331. int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...);
  332. #endif
  333. #if wxUSE_UNICODE_UTF8
  334. int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...);
  335. #endif
  336. WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&),
  337. wxDoSnprintfWchar, wxDoSnprintfUtf8)
  338. int WXDLLIMPEXP_BASE
  339. wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);
  340. #endif // wxUSE_UNICODE
  341. #ifdef __WATCOMC__
  342. // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
  343. //
  344. // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros
  345. // that cast the format argument to wxString:
  346. #undef wxPrintf
  347. #undef wxFprintf
  348. #undef wxSprintf
  349. #undef wxSnprintf
  350. #define wxPrintf(fmt, ...) \
  351. wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__)
  352. #define wxFprintf(f, fmt, ...) \
  353. wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__)
  354. #define wxSprintf(s, fmt, ...) \
  355. wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__)
  356. #define wxSnprintf(s, n, fmt, ...) \
  357. wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__)
  358. #endif // __WATCOMC__
  359. // We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc.
  360. // because they are writable, so instead of providing friendly template
  361. // vararg-like functions, we just provide both char* and wchar_t* variants
  362. // of these functions. The type of output variadic arguments for %s must match
  363. // the type of 'str' and 'format' arguments.
  364. //
  365. // For compatibility with earlier wx versions, we also provide wxSscanf()
  366. // version with the first argument (input string) wxString; for this version,
  367. // the type of output string values is determined by the type of format string
  368. // only.
  369. #define _WX_SCANFUNC_EXTRACT_ARGS_1(x) x
  370. #define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y
  371. #define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args
  372. #define _WX_VARARG_PASS_WRITABLE(i) a##i
  373. #define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\
  374. template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
  375. int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed), \
  376. _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
  377. { \
  378. return impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed), \
  379. _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE)); \
  380. }
  381. #define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed) \
  382. _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
  383. _WX_DEFINE_SCANFUNC, \
  384. dummy1, name, impl, passfixed, numfixed, fixed)
  385. // this is needed to normalize the format string, see src/common/strvararg.cpp
  386. // for more details
  387. #ifdef __WINDOWS__
  388. #define wxScanfConvertFormatW(fmt) fmt
  389. #else
  390. const wxScopedWCharBuffer
  391. WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format);
  392. #endif
  393. WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format),
  394. wxCRT_ScanfA, (format))
  395. WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format),
  396. wxCRT_ScanfW, (wxScanfConvertFormatW(format)))
  397. WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format),
  398. wxCRT_FscanfA, (stream, format))
  399. WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format),
  400. wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format)))
  401. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format),
  402. wxCRT_SscanfA, (str, format))
  403. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format),
  404. wxCRT_SscanfW, (str, wxScanfConvertFormatW(format)))
  405. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format),
  406. wxCRT_SscanfA, (str.data(), format))
  407. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
  408. wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
  409. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
  410. wxCRT_SscanfA, (str.mb_str(), format))
  411. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
  412. wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
  413. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
  414. wxCRT_SscanfA, (str.AsCharBuf(), format))
  415. WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
  416. wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
  417. // Visual C++ doesn't provide vsscanf()
  418. #ifndef __VISUALC___
  419. int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap);
  420. int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap);
  421. int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap);
  422. int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap);
  423. int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap);
  424. int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap);
  425. int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap);
  426. int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap);
  427. #endif // !__VISUALC__
  428. #endif /* _WX_WXCRTVARARG_H_ */