Agora  1.2.0
Agora project
printf.h
Go to the documentation of this file.
1 // Formatting library for C++ - legacy printf implementation
2 //
3 // Copyright (c) 2012 - 2016, Victor Zverovich
4 // All rights reserved.
5 //
6 // For the license information refer to format.h.
7 
8 #ifndef FMT_PRINTF_H_
9 #define FMT_PRINTF_H_
10 
11 #include <algorithm> // std::max
12 #include <limits> // std::numeric_limits
13 #include <ostream>
14 
15 #include "format.h"
16 
19 
20 template <typename T> struct printf_formatter { printf_formatter() = delete; };
21 
22 template <typename Char>
25 };
26 
27 template <typename OutputIt, typename Char> class basic_printf_context {
28  private:
29  OutputIt out_;
31 
32  public:
33  using char_type = Char;
36  template <typename T> using formatter_type = printf_formatter<T>;
37 
44  basic_printf_context(OutputIt out,
46  : out_(out), args_(args) {}
47 
48  OutputIt out() { return out_; }
49  void advance_to(OutputIt it) { out_ = it; }
50 
51  detail::locale_ref locale() { return {}; }
52 
53  format_arg arg(int id) const { return args_.get(id); }
54 
55  FMT_CONSTEXPR void on_error(const char* message) {
57  }
58 };
59 
61 
62 // Checks if a value fits in int - used to avoid warnings about comparing
63 // signed and unsigned integers.
64 template <bool IsSigned> struct int_checker {
65  template <typename T> static bool fits_in_int(T value) {
66  unsigned max = max_value<int>();
67  return value <= max;
68  }
69  static bool fits_in_int(bool) { return true; }
70 };
71 
72 template <> struct int_checker<true> {
73  template <typename T> static bool fits_in_int(T value) {
74  return value >= (std::numeric_limits<int>::min)() &&
76  }
77  static bool fits_in_int(int) { return true; }
78 };
79 
81  public:
82  template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
85  FMT_THROW(format_error("number is too big"));
86  return (std::max)(static_cast<int>(value), 0);
87  }
88 
89  template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
90  int operator()(T) {
91  FMT_THROW(format_error("precision is not integer"));
92  return 0;
93  }
94 };
95 
96 // An argument visitor that returns true iff arg is a zero integer.
97 class is_zero_int {
98  public:
99  template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
101  return value == 0;
102  }
103 
104  template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
105  bool operator()(T) {
106  return false;
107  }
108 };
109 
110 template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
111 
112 template <> struct make_unsigned_or_bool<bool> { using type = bool; };
113 
114 template <typename T, typename Context> class arg_converter {
115  private:
116  using char_type = typename Context::char_type;
117 
120 
121  public:
123  : arg_(arg), type_(type) {}
124 
125  void operator()(bool value) {
126  if (type_ != 's') operator()<bool>(value);
127  }
128 
129  template <typename U, FMT_ENABLE_IF(std::is_integral<U>::value)>
130  void operator()(U value) {
131  bool is_signed = type_ == 'd' || type_ == 'i';
132  using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
133  if (const_check(sizeof(target_type) <= sizeof(int))) {
134  // Extra casts are used to silence warnings.
135  if (is_signed) {
136  arg_ = detail::make_arg<Context>(
137  static_cast<int>(static_cast<target_type>(value)));
138  } else {
139  using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
140  arg_ = detail::make_arg<Context>(
141  static_cast<unsigned>(static_cast<unsigned_type>(value)));
142  }
143  } else {
144  if (is_signed) {
145  // glibc's printf doesn't sign extend arguments of smaller types:
146  // std::printf("%lld", -42); // prints "4294967254"
147  // but we don't have to do the same because it's a UB.
148  arg_ = detail::make_arg<Context>(static_cast<long long>(value));
149  } else {
150  arg_ = detail::make_arg<Context>(
151  static_cast<typename make_unsigned_or_bool<U>::type>(value));
152  }
153  }
154  }
155 
156  template <typename U, FMT_ENABLE_IF(!std::is_integral<U>::value)>
157  void operator()(U) {} // No conversion needed for non-integral types.
158 };
159 
160 // Converts an integer argument to T for printf, if T is an integral type.
161 // If T is void, the argument is converted to corresponding signed or unsigned
162 // type depending on the type specifier: 'd' and 'i' - signed, other -
163 // unsigned).
164 template <typename T, typename Context, typename Char>
167 }
168 
169 // Converts an integer argument to char for printf.
170 template <typename Context> class char_converter {
171  private:
173 
174  public:
176 
177  template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
179  arg_ = detail::make_arg<Context>(
180  static_cast<typename Context::char_type>(value));
181  }
182 
183  template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
184  void operator()(T) {} // No conversion needed for non-integral types.
185 };
186 
187 // An argument visitor that return a pointer to a C string if argument is a
188 // string or null otherwise.
189 template <typename Char> struct get_cstring {
190  template <typename T> const Char* operator()(T) { return nullptr; }
191  const Char* operator()(const Char* s) { return s; }
192 };
193 
194 // Checks if an argument is a valid printf width specifier and sets
195 // left alignment if it is negative.
196 template <typename Char> class printf_width_handler {
197  private:
199 
201 
202  public:
203  explicit printf_width_handler(format_specs& specs) : specs_(specs) {}
204 
205  template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
206  unsigned operator()(T value) {
207  auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
208  if (detail::is_negative(value)) {
209  specs_.align = align::left;
210  width = 0 - width;
211  }
212  unsigned int_max = max_value<int>();
213  if (width > int_max) FMT_THROW(format_error("number is too big"));
214  return static_cast<unsigned>(width);
215  }
216 
217  template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
218  unsigned operator()(T) {
219  FMT_THROW(format_error("width is not integer"));
220  return 0;
221  }
222 };
223 
224 // The ``printf`` argument formatter.
225 template <typename OutputIt, typename Char>
226 class printf_arg_formatter : public arg_formatter<Char> {
227  private:
231 
233 
234  OutputIt write_null_pointer(bool is_string = false) {
235  auto s = this->specs;
236  s.type = presentation_type::none;
237  return write_bytes(this->out, is_string ? "(null)" : "(nil)", s);
238  }
239 
240  public:
242  : base{iter, s, locale_ref()}, context_(ctx) {}
243 
244  OutputIt operator()(monostate value) { return base::operator()(value); }
245 
246  template <typename T, FMT_ENABLE_IF(detail::is_integral<T>::value)>
247  OutputIt operator()(T value) {
248  // MSVC2013 fails to compile separate overloads for bool and Char so use
249  // std::is_same instead.
251  format_specs fmt_specs = this->specs;
252  if (fmt_specs.type != presentation_type::none &&
253  fmt_specs.type != presentation_type::chr) {
254  return (*this)(static_cast<int>(value));
255  }
256  fmt_specs.sign = sign::none;
257  fmt_specs.alt = false;
258  fmt_specs.fill[0] = ' '; // Ignore '0' flag for char types.
259  // align::numeric needs to be overwritten here since the '0' flag is
260  // ignored for non-numeric types
261  if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
262  fmt_specs.align = align::right;
263  return write<Char>(this->out, static_cast<Char>(value), fmt_specs);
264  }
265  return base::operator()(value);
266  }
267 
268  template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
269  OutputIt operator()(T value) {
270  return base::operator()(value);
271  }
272 
274  OutputIt operator()(const char* value) {
275  if (value) return base::operator()(value);
276  return write_null_pointer(this->specs.type != presentation_type::pointer);
277  }
278 
280  OutputIt operator()(const wchar_t* value) {
281  if (value) return base::operator()(value);
282  return write_null_pointer(this->specs.type != presentation_type::pointer);
283  }
284 
286  return base::operator()(value);
287  }
288 
290  OutputIt operator()(const void* value) {
291  return value ? base::operator()(value) : write_null_pointer();
292  }
293 
296  auto parse_ctx =
298  handle.format(parse_ctx, context_);
299  return this->out;
300  }
301 };
302 
303 template <typename Char>
304 void parse_flags(basic_format_specs<Char>& specs, const Char*& it,
305  const Char* end) {
306  for (; it != end; ++it) {
307  switch (*it) {
308  case '-':
309  specs.align = align::left;
310  break;
311  case '+':
312  specs.sign = sign::plus;
313  break;
314  case '0':
315  specs.fill[0] = '0';
316  break;
317  case ' ':
318  if (specs.sign != sign::plus) {
319  specs.sign = sign::space;
320  }
321  break;
322  case '#':
323  specs.alt = true;
324  break;
325  default:
326  return;
327  }
328  }
329 }
330 
331 template <typename Char, typename GetArg>
332 int parse_header(const Char*& it, const Char* end,
333  basic_format_specs<Char>& specs, GetArg get_arg) {
334  int arg_index = -1;
335  Char c = *it;
336  if (c >= '0' && c <= '9') {
337  // Parse an argument index (if followed by '$') or a width possibly
338  // preceded with '0' flag(s).
339  int value = parse_nonnegative_int(it, end, -1);
340  if (it != end && *it == '$') { // value is an argument index
341  ++it;
342  arg_index = value != -1 ? value : max_value<int>();
343  } else {
344  if (c == '0') specs.fill[0] = '0';
345  if (value != 0) {
346  // Nonzero value means that we parsed width and don't need to
347  // parse it or flags again, so return now.
348  if (value == -1) FMT_THROW(format_error("number is too big"));
349  specs.width = value;
350  return arg_index;
351  }
352  }
353  }
354  parse_flags(specs, it, end);
355  // Parse width.
356  if (it != end) {
357  if (*it >= '0' && *it <= '9') {
358  specs.width = parse_nonnegative_int(it, end, -1);
359  if (specs.width == -1) FMT_THROW(format_error("number is too big"));
360  } else if (*it == '*') {
361  ++it;
362  specs.width = static_cast<int>(visit_format_arg(
364  }
365  }
366  return arg_index;
367 }
368 
369 template <typename Char, typename Context>
372  using OutputIt = buffer_appender<Char>;
373  auto out = OutputIt(buf);
374  auto context = basic_printf_context<OutputIt, Char>(out, args);
375  auto parse_ctx = basic_printf_parse_context<Char>(format);
376 
377  // Returns the argument with specified index or, if arg_index is -1, the next
378  // argument.
379  auto get_arg = [&](int arg_index) {
380  if (arg_index < 0)
381  arg_index = parse_ctx.next_arg_id();
382  else
383  parse_ctx.check_arg_id(--arg_index);
384  return detail::get_arg(context, arg_index);
385  };
386 
387  const Char* start = parse_ctx.begin();
388  const Char* end = parse_ctx.end();
389  auto it = start;
390  while (it != end) {
391  if (!detail::find<false, Char>(it, end, '%', it)) {
392  it = end; // detail::find leaves it == nullptr if it doesn't find '%'
393  break;
394  }
395  Char c = *it++;
396  if (it != end && *it == c) {
397  out = detail::write(
399  start = ++it;
400  continue;
401  }
403  start, detail::to_unsigned(it - 1 - start)));
404 
406  specs.align = align::right;
407 
408  // Parse argument index, flags and width.
409  int arg_index = parse_header(it, end, specs, get_arg);
410  if (arg_index == 0) parse_ctx.on_error("argument not found");
411 
412  // Parse precision.
413  if (it != end && *it == '.') {
414  ++it;
415  c = it != end ? *it : 0;
416  if ('0' <= c && c <= '9') {
417  specs.precision = parse_nonnegative_int(it, end, 0);
418  } else if (c == '*') {
419  ++it;
420  specs.precision = static_cast<int>(
422  } else {
423  specs.precision = 0;
424  }
425  }
426 
427  auto arg = get_arg(arg_index);
428  // For d, i, o, u, x, and X conversion specifiers, if a precision is
429  // specified, the '0' flag is ignored
430  if (specs.precision >= 0 && arg.is_integral())
431  specs.fill[0] =
432  ' '; // Ignore '0' flag for non-numeric types or if '-' present.
433  if (specs.precision >= 0 && arg.type() == detail::type::cstring_type) {
435  auto str_end = str + specs.precision;
436  auto nul = std::find(str, str_end, Char());
437  arg = detail::make_arg<basic_printf_context<OutputIt, Char>>(
439  str, detail::to_unsigned(nul != str_end ? nul - str
440  : specs.precision)));
441  }
442  if (specs.alt && visit_format_arg(detail::is_zero_int(), arg))
443  specs.alt = false;
444  if (specs.fill[0] == '0') {
445  if (arg.is_arithmetic() && specs.align != align::left)
446  specs.align = align::numeric;
447  else
448  specs.fill[0] = ' '; // Ignore '0' flag for non-numeric types or if '-'
449  // flag is also present.
450  }
451 
452  // Parse length and convert the argument to the required type.
453  c = it != end ? *it++ : 0;
454  Char t = it != end ? *it : 0;
455  using detail::convert_arg;
456  switch (c) {
457  case 'h':
458  if (t == 'h') {
459  ++it;
460  t = it != end ? *it : 0;
461  convert_arg<signed char>(arg, t);
462  } else {
463  convert_arg<short>(arg, t);
464  }
465  break;
466  case 'l':
467  if (t == 'l') {
468  ++it;
469  t = it != end ? *it : 0;
470  convert_arg<long long>(arg, t);
471  } else {
472  convert_arg<long>(arg, t);
473  }
474  break;
475  case 'j':
476  convert_arg<intmax_t>(arg, t);
477  break;
478  case 'z':
479  convert_arg<size_t>(arg, t);
480  break;
481  case 't':
482  convert_arg<std::ptrdiff_t>(arg, t);
483  break;
484  case 'L':
485  // printf produces garbage when 'L' is omitted for long double, no
486  // need to do the same.
487  break;
488  default:
489  --it;
490  convert_arg<void>(arg, c);
491  }
492 
493  // Parse type.
494  if (it == end) FMT_THROW(format_error("invalid format string"));
495  char type = static_cast<char>(*it++);
496  if (arg.is_integral()) {
497  // Normalize type.
498  switch (type) {
499  case 'i':
500  case 'u':
501  type = 'd';
502  break;
503  case 'c':
506  arg);
507  break;
508  }
509  }
511  if (specs.type == presentation_type::none)
512  parse_ctx.on_error("invalid type specifier");
513 
514  start = it;
515 
516  // Format argument.
517  out = visit_format_arg(
518  detail::printf_arg_formatter<OutputIt, Char>(out, specs, context), arg);
519  }
521 }
523 
524 template <typename Char>
527 
530 
533 
540 template <typename... T>
541 inline auto make_printf_args(const T&... args)
543  return {args...};
544 }
545 
552 template <typename... T>
553 inline auto make_wprintf_args(const T&... args)
555  return {args...};
556 }
557 
558 template <typename S, typename Char = char_t<S>>
559 inline auto vsprintf(
560  const S& fmt,
562  -> std::basic_string<Char> {
564  vprintf(buffer, to_string_view(fmt), args);
565  return to_string(buffer);
566 }
567 
577 template <typename S, typename... T,
579 inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
580  using context = basic_printf_context_t<Char>;
581  return vsprintf(to_string_view(fmt), fmt::make_format_args<context>(args...));
582 }
583 
584 template <typename S, typename Char = char_t<S>>
585 inline auto vfprintf(
586  std::FILE* f, const S& fmt,
588  -> int {
590  vprintf(buffer, to_string_view(fmt), args);
591  size_t size = buffer.size();
592  return std::fwrite(buffer.data(), sizeof(Char), size, f) < size
593  ? -1
594  : static_cast<int>(size);
595 }
596 
606 template <typename S, typename... T, typename Char = char_t<S>>
607 inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
608  using context = basic_printf_context_t<Char>;
609  return vfprintf(f, to_string_view(fmt),
610  fmt::make_format_args<context>(args...));
611 }
612 
613 template <typename S, typename Char = char_t<S>>
614 inline auto vprintf(
615  const S& fmt,
617  -> int {
618  return vfprintf(stdout, to_string_view(fmt), args);
619 }
620 
630 template <typename S, typename... T, FMT_ENABLE_IF(detail::is_string<S>::value)>
631 inline auto printf(const S& fmt, const T&... args) -> int {
632  return vprintf(
635 }
636 
637 template <typename S, typename Char = char_t<S>>
639  std::basic_ostream<Char>& os, const S& fmt,
641  -> int {
643  vprintf(buffer, to_string_view(fmt), args);
644  os.write(buffer.data(), static_cast<std::streamsize>(buffer.size()));
645  return static_cast<int>(buffer.size());
646 }
647 template <typename S, typename... T, typename Char = char_t<S>>
648 FMT_DEPRECATED auto fprintf(std::basic_ostream<Char>& os, const S& fmt,
649  const T&... args) -> int {
650  return vfprintf(os, to_string_view(fmt),
652 }
653 
656 
657 #endif // FMT_PRINTF_H_
spdlog::level::to_string_view
const SPDLOG_INLINE string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common-inl.h:23
fmt::v8::basic_printf_parse_context
Definition: printf.h:23
fmt::v8::detail::is_string
Definition: core.h:590
fmt::v8::char_t
typename detail::char_t_impl< S >::type char_t
Definition: core.h:623
fmt::v8::basic_format_parse_context
Definition: core.h:633
fmt::v8::fprintf
auto fprintf(std::basic_ostream< Char > &os, const S &fmt, const T &... args) -> int
Definition: printf.h:648
fmt::v8::detail::arg_converter
Definition: printf.h:114
fmt::v8::detail::arg_converter::operator()
void operator()(U value)
Definition: printf.h:130
fmt::v8::detail::parse_flags
void parse_flags(basic_format_specs< Char > &specs, const Char *&it, const Char *end)
Definition: printf.h:304
fmt::v8::detail::printf_width_handler::operator()
unsigned operator()(T)
Definition: printf.h:218
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(monostate value)
Definition: printf.h:244
fmt::v8::detail::printf_width_handler
Definition: printf.h:196
fmt::v8::printf
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
size
end IFFT Reshape the symbol vector into two different spatial streams size
Definition: generate_data.m:73
fmt::v8::detail::write
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
Definition: chrono.h:425
fmt::v8::basic_format_args
Definition: core.h:702
fmt::v8::detail::int_checker< true >::fits_in_int
static bool fits_in_int(T value)
Definition: printf.h:73
fmt::v8::basic_format_arg
Definition: core.h:701
fmt::v8::sign::plus
@ plus
Definition: core.h:2025
fmt::v8::detail::char_converter::char_converter
char_converter(basic_format_arg< Context > &arg)
Definition: printf.h:175
fmt::v8::detail::uint32_or_64_or_128_t
conditional_t< num_bits< T >()<=32 &&! 0, uint32_t, conditional_t< num_bits< T >()<=64, uint64_t, uint128_t > > uint32_or_64_or_128_t
Definition: format.h:909
Catch::Generators::value
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
fmt::v8::make_printf_args
auto make_printf_args(const T &... args) -> format_arg_store< printf_context, T... >
Definition: printf.h:541
fmt::v8::align::left
@ left
Definition: core.h:2021
format.h
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(const wchar_t *value)
Definition: printf.h:280
fmt::v8::wprintf_context
basic_printf_context_t< wchar_t > wprintf_context
Definition: printf.h:529
fmt::v8::detail::buffer::size
constexpr auto size() const -> size_t
Definition: core.h:820
fmt::v8::detail::locale_ref
Definition: core.h:1669
fmt::v8::detail::printf_arg_formatter::context_
context_type & context_
Definition: printf.h:232
fmt::v8::detail::parse_header
int parse_header(const Char *&it, const Char *end, basic_format_specs< Char > &specs, GetArg get_arg)
Definition: printf.h:332
fmt::v8::basic_format_arg::handle
Definition: core.h:1552
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(basic_string_view< Char > value)
Definition: printf.h:285
fmt::v8::basic_string_view
Definition: core.h:448
fmt::v8::detail::printf_precision_handler
Definition: printf.h:80
fmt::v8::printf_context
basic_printf_context_t< char > printf_context
Definition: printf.h:528
fmt::v8::align::right
@ right
Definition: core.h:2021
fmt::v8::basic_printf_context::char_type
Char char_type
Definition: printf.h:33
fmt::v8::detail::buffer
Definition: core.h:778
fmt::v8::vprintf
auto vprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:614
fmt::v8::detail::arg_converter::char_type
typename Context::char_type char_type
Definition: printf.h:116
fmt::v8::vfprintf
auto vfprintf(std::basic_ostream< Char > &os, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> int
Definition: printf.h:638
fmt::v8::detail::int_checker< true >::fits_in_int
static bool fits_in_int(int)
Definition: printf.h:77
fmt::v8::format_error
Definition: format.h:814
fmt::v8::detail::value
Definition: core.h:1208
fmt::v8::detail::char_converter::operator()
void operator()(T value)
Definition: printf.h:178
fmt::v8::basic_format_specs::sign
sign_t sign
Definition: core.h:2084
fmt::v8::detail::arg_converter::arg_converter
arg_converter(basic_format_arg< Context > &arg, char_type type)
Definition: printf.h:122
fmt::v8::detail::arg_converter::operator()
void operator()(bool value)
Definition: printf.h:125
fmt::v8::detail::is_zero_int
Definition: printf.h:97
fmt::v8::detail::is_zero_int::operator()
bool operator()(T value)
Definition: printf.h:100
fmt::v8::detail::printf_precision_handler::operator()
int operator()(T value)
Definition: printf.h:83
fmt::v8::basic_format_specs
Definition: core.h:2079
fmt::v8::detail::int_checker::fits_in_int
static bool fits_in_int(T value)
Definition: printf.h:65
fmt::v8::detail::is_negative
auto is_negative(T value) -> bool
Definition: format.h:888
fmt::v8::detail::printf_width_handler::printf_width_handler
printf_width_handler(format_specs &specs)
Definition: printf.h:203
fmt::v8::detail::arg_converter::type_
char_type type_
Definition: printf.h:119
T
T
Definition: simulate_performance.m:4
fmt::v8::basic_format_specs::fill
detail::fill_t< Char > fill
Definition: core.h:2087
fmt::v8::basic_format_specs::precision
int precision
Definition: core.h:2081
fmt::v8::basic_memory_buffer
Definition: format.h:677
fmt::v8::detail::make_unsigned_or_bool
Definition: printf.h:110
fmt::v8::detail::arg_converter::arg_
basic_format_arg< Context > & arg_
Definition: printf.h:118
fmt::v8::basic_printf_context::out_
OutputIt out_
Definition: printf.h:29
fmt::v8::detail::parse_nonnegative_int
auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
Definition: core.h:2276
FMT_ENABLE_IF
#define FMT_ENABLE_IF(...)
Definition: core.h:344
fmt::v8::basic_format_args::get
auto get(int id) const -> format_arg
Definition: core.h:1976
fmt::v8::detail::printf_width_handler::specs_
format_specs & specs_
Definition: printf.h:200
fmt::v8::detail::find
auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2258
fmt::v8::detail::get_arg
auto get_arg(Context &ctx, ID id) -> typename Context::format_arg
Definition: format.h:2292
fmt::v8::detail::convert_arg
void convert_arg(basic_format_arg< Context > &arg, Char type)
Definition: printf.h:165
fmt::v8::detail::error_handler::on_error
void on_error(const char *message)
Definition: format-inl.h:2580
FMT_END_NAMESPACE
#define FMT_END_NAMESPACE
Definition: core.h:240
fmt::v8::basic_format_specs::type
presentation_type type
Definition: core.h:2082
fmt::v8::detail::char_converter
Definition: printf.h:170
fmt::v8::basic_printf_context::on_error
void on_error(const char *message)
Definition: printf.h:55
fmt::v8::detail::const_check
constexpr auto const_check(T value) -> T
Definition: core.h:365
fmt::v8::detail::parse_presentation_type
auto parse_presentation_type(Char type) -> presentation_type
Definition: core.h:2455
fmt::v8::detail::write_bytes
auto write_bytes(OutputIt out, string_view bytes, const basic_format_specs< Char > &specs) -> OutputIt
Definition: format.h:1356
fmt::v8::printf_formatter
Definition: printf.h:20
fmt::v8::arg
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1887
start
end start
Definition: inspect_agora_results.m:95
fmt::v8::detail::printf_width_handler::operator()
unsigned operator()(T value)
Definition: printf.h:206
fmt::v8::make_format_args
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
Definition: core.h:1870
fmt::v8::align::numeric
@ numeric
Definition: core.h:2021
fmt::v8::detail::char_converter::operator()
void operator()(T)
Definition: printf.h:184
s
s
Definition: simulate_performance.m:3
fmt::v8::basic_printf_context::out
OutputIt out()
Definition: printf.h:48
fmt::v8::basic_format_arg::handle::format
void format(typename Context::parse_context_type &parse_ctx, Context &ctx) const
Definition: core.h:1556
fmt::v8::detail::buffer::data
auto data() -> T *
Definition: core.h:826
if
Add CP Insert the cyclic prefix if(CP_LEN > 0) tx_cp
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(typename basic_format_arg< context_type >::handle handle)
Definition: printf.h:295
FMT_BEGIN_DETAIL_NAMESPACE
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:249
fmt::v8::detail::get_cstring::operator()
const Char * operator()(const Char *s)
Definition: printf.h:191
fmt::v8::basic_format_specs::alt
bool alt
Definition: core.h:2085
FMT_MODULE_EXPORT_END
#define FMT_MODULE_EXPORT_END
Definition: core.h:248
FMT_MODULE_EXPORT_BEGIN
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:247
fmt::v8::detail::printf_arg_formatter
Definition: printf.h:226
fmt::v8::detail::printf_arg_formatter::printf_arg_formatter
printf_arg_formatter(OutputIt iter, format_specs &s, context_type &ctx)
Definition: printf.h:241
fmt::v8::detail::char_converter::arg_
basic_format_arg< Context > & arg_
Definition: printf.h:172
fmt::v8::detail::is_zero_int::operator()
bool operator()(T)
Definition: printf.h:105
fmt::v8::conditional_t
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:323
fwrite
fwrite(fileID, pilot_f, 'float')
fmt
Definition: bin_to_hex.h:102
fmt::v8::detail::make_unsigned_or_bool< bool >::type
bool type
Definition: printf.h:112
fmt::v8::detail::arg_converter::operator()
void operator()(U)
Definition: printf.h:157
fmt::v8::detail::printf_arg_formatter::write_null_pointer
OutputIt write_null_pointer(bool is_string=false)
Definition: printf.h:234
fmt::v8::detail::error_handler
Definition: core.h:613
fmt::v8::detail::get_cstring::operator()
const Char * operator()(T)
Definition: printf.h:190
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(T value)
Definition: printf.h:247
fmt::v8::align::none
@ none
Definition: core.h:2021
FMT_BEGIN_NAMESPACE
#define FMT_BEGIN_NAMESPACE
Definition: core.h:237
to_string
std::string to_string() const
Definition: eth_common.h:64
fmt::v8::basic_printf_context
Definition: ostream.h:17
fmt::v8::basic_printf_context::advance_to
void advance_to(OutputIt it)
Definition: printf.h:49
fmt::v8::basic_printf_context::basic_printf_context
basic_printf_context(OutputIt out, basic_format_args< basic_printf_context > args)
Definition: printf.h:44
fmt::v8::type_identity_t
typename type_identity< T >::type type_identity_t
Definition: core.h:332
fmt::v8::vsprintf
auto vsprintf(const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char >>> args) -> std::basic_string< Char >
Definition: printf.h:559
fmt::v8::detail::arg_formatter
Definition: format.h:2207
fmt::v8::sprintf
auto sprintf(const S &fmt, const T &... args) -> std::basic_string< Char >
Definition: printf.h:579
FMT_DEPRECATED
#define FMT_DEPRECATED
Definition: core.h:231
fmt::v8::detail::get_cstring
Definition: printf.h:189
fmt::v8::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:321
fmt::v8::visit_format_arg
auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
Definition: core.h:1587
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(const void *value)
Definition: printf.h:290
fmt::v8::detail::int_checker::fits_in_int
static bool fits_in_int(bool)
Definition: printf.h:69
fmt::v8::basic_format_specs::width
int width
Definition: core.h:2080
fmt::v8::detail::is_signed
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
Definition: format.h:883
fmt::v8::basic_format_specs::align
align_t align
Definition: core.h:2083
fmt::v8::detail::printf_arg_formatter::operator()
OutputIt operator()(const char *value)
Definition: printf.h:274
fmt::v8::make_wprintf_args
auto make_wprintf_args(const T &... args) -> format_arg_store< wprintf_context, T... >
Definition: printf.h:553
fmt::v8::format_arg_store
Definition: core.h:1819
fmt::v8::monostate
Definition: core.h:334
fmt::v8::basic_printf_context::locale
detail::locale_ref locale()
Definition: printf.h:51
fmt::v8::detail::buffer_appender
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > >> buffer_appender
Definition: core.h:1023
FMT_END_DETAIL_NAMESPACE
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:250
max
max(y1, y1_1)
fmt::v8::detail::to_unsigned
auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:424
fmt::v8::detail::printf_precision_handler::operator()
int operator()(T)
Definition: printf.h:90
fmt::v8::sign::space
@ space
Definition: core.h:2025
fmt::v8::basic_printf_context::arg
format_arg arg(int id) const
Definition: printf.h:53
fmt::v8::detail::int_checker
Definition: printf.h:64
FMT_CONSTEXPR
#define FMT_CONSTEXPR
Definition: core.h:110
nlohmann::json_v3_11_1NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON::detail2::end
end_tag end(T &&...)
utils::format
std::string format(const T &value)
Definition: utils.h:15
fmt::v8::detail::type
type
Definition: core.h:1131
FMT_THROW
#define FMT_THROW(x)
Definition: format.h:95
fmt::v8::basic_printf_context::args_
basic_format_args< basic_printf_context > args_
Definition: printf.h:30