1 // Formatting library for C++
2 //
3 // Copyright (c) 2012 - 2016, Victor Zverovich
4 // All rights reserved.
5 //
6 // For the license information refer to format.h.
7 
8 // xxx(kitware) fix path
9 #include "vtkfmt/format-inl.h"
10 
11 FMT_BEGIN_NAMESPACE
12 namespace detail {
13 
14 template <typename T>
format_float(char * buf,std::size_t size,const char * format,int precision,T value)15 int format_float(char* buf, std::size_t size, const char* format, int precision,
16                  T value) {
17 #ifdef FMT_FUZZ
18   if (precision > 100000)
19     throw std::runtime_error(
20         "fuzz mode - avoid large allocation inside snprintf");
21 #endif
22   // Suppress the warning about nonliteral format string.
23   int (*snprintf_ptr)(char*, size_t, const char*, ...) = FMT_SNPRINTF;
24   return precision < 0 ? snprintf_ptr(buf, size, format, value)
25                        : snprintf_ptr(buf, size, format, precision, value);
26 }
27 
28 template FMT_API dragonbox::decimal_fp<float> dragonbox::to_decimal(float x)
29     FMT_NOEXCEPT;
30 template FMT_API dragonbox::decimal_fp<double> dragonbox::to_decimal(double x)
31     FMT_NOEXCEPT;
32 }  // namespace detail
33 
34 // Workaround a bug in MSVC2013 that prevents instantiation of format_float.
35 int (*instantiate_format_float)(double, int, detail::float_specs,
36                                 detail::buffer<char>&) = detail::format_float;
37 
38 #ifndef FMT_STATIC_THOUSANDS_SEPARATOR
39 template FMT_API detail::locale_ref::locale_ref(const std::locale& loc);
40 template FMT_API std::locale detail::locale_ref::get<std::locale>() const;
41 #endif
42 
43 // Explicit instantiations for char.
44 
45 template FMT_API auto detail::thousands_sep_impl(locale_ref)
46     -> thousands_sep_result<char>;
47 template FMT_API char detail::decimal_point_impl(locale_ref);
48 
49 template FMT_API void detail::buffer<char>::append(const char*, const char*);
50 
51 // DEPRECATED!
52 // There is no correspondent extern template in format.h because of
53 // incompatibility between clang and gcc (#2377).
54 template FMT_API void detail::vformat_to(
55     detail::buffer<char>&, string_view,
56     basic_format_args<FMT_BUFFER_CONTEXT(char)>, detail::locale_ref);
57 
58 template FMT_API int detail::snprintf_float(double, int, detail::float_specs,
59                                             detail::buffer<char>&);
60 template FMT_API int detail::snprintf_float(long double, int,
61                                             detail::float_specs,
62                                             detail::buffer<char>&);
63 template FMT_API int detail::format_float(double, int, detail::float_specs,
64                                           detail::buffer<char>&);
65 template FMT_API int detail::format_float(long double, int, detail::float_specs,
66                                           detail::buffer<char>&);
67 
68 // Explicit instantiations for wchar_t.
69 
70 template FMT_API auto detail::thousands_sep_impl(locale_ref)
71     -> thousands_sep_result<wchar_t>;
72 template FMT_API wchar_t detail::decimal_point_impl(locale_ref);
73 
74 template FMT_API void detail::buffer<wchar_t>::append(const wchar_t*,
75                                                       const wchar_t*);
76 
77 template struct detail::basic_data<void>;
78 
79 FMT_END_NAMESPACE
80