Ruby: include/ruby/internal/intern/sprintf.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Functions
sprintf.h File Reference

Our own private printf(3). More...

`#include "ruby/internal/attr/format.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/value.h"`

Go to the source code of this file.

## Functions
VALUE | rb_f_sprintf (int, const VALUE *)
VALUE | rb_sprintf (const char *,...)
VALUE | rb_vsprintf (const char *, va_list)
VALUE | rb_str_catf (VALUE, const char *,...)
VALUE | rb_str_vcatf (VALUE, const char *, va_list)
VALUE | rb_str_format (int, const VALUE *, VALUE)

## Detailed Description

Our own private printf(3).

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either `RBIMPL` or `rbimpl` are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance `__VA_ARGS__` is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file sprintf.h.

## Function Documentation

## ◆ rb_f_sprintf()

VALUE rb_f_sprintf | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 208 of file sprintf.c.

References argc, argv, GETNTHARG, and rb_str_format().

Referenced by rb_io_printf().

## ◆ rb_sprintf()

VALUE rb_sprintf | ( | const char * | format,
|  |  | ...
| ) |  |

Definition at line 1203 of file sprintf.c.

References rb_vsprintf().

Referenced by Init_Bignum(), Init_dbm(), rb_any_to_s(), rb_attr(), rb_block_to_s(), rb_dump_literal(), rb_error_frozen_object(), rb_f_global_variables(), rb_insn_operand_intern(), rb_keyword_error_new(), rb_parser_show_bitstack(), rb_profile_frame_classpath(), rb_profile_frame_full_label(), rb_ractor_ensure_shareable(), rsock_raise_socket_error(), rsock_syserr_fail_host_port(), rsock_syserr_fail_path(), rsock_syserr_fail_raddrinfo(), and ruby_setenv().

## ◆ rb_str_catf()

VALUE rb_str_catf | ( | VALUE | str,
|  | const char * | format,
|  |  | ...
| ) |  |

Definition at line 1243 of file sprintf.c.

References rb_str_vcatf(), and str.

Referenced by rb_block_to_s(), rb_error_frozen_object(), rb_iseq_disasm_insn(), rb_parser_show_bitstack(), rb_parser_trace_lex_state(), rb_str_format(), rb_warn_deprecated(), rb_warn_deprecated_to_remove(), and rsock_inspect_sockaddr().

## ◆ rb_str_format()

VALUE rb_str_format | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | fmt
| ) |  |

Definition at line 214 of file sprintf.c.

References argc, argv, BIT_DIGITS, CHAR_BIT, CHECK, CHECK_FOR_FLAGS, CHECK_FOR_WIDTH, CHECKNAMEARG, ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, ENC_CODERANGE_UNKNOWN, ffs(), FILL, FILL_, FIX2LONG, FIXABLE, FIXNUM_P, FMINUS, FNONE, FPLUS, FPREC, FPREC0, FSHARP, FSPACE, FWIDTH, FZERO, GETARG, GETASTER, GETNUM, GETPOSARG, int(), INT2FIX, INTEGER_PACK_2COMP, INTEGER_PACK_BIG_ENDIAN, isinf(), isnan, len, LONG2FIX, memcpy, NIL_P, NULL, num, NUM2INT, prefix, PRIsVALUE, PRIuSIZE, PUSH, PUSH_, Qnil, Qundef, rb_absint_numwords(), rb_absint_singlebit_p(), rb_big2str(), rb_big_uminus(), rb_check_string_type(), rb_check_symbol_cstr(), rb_dbl2big(), rb_eArgError, rb_enc_associate(), rb_enc_check(), rb_enc_codelen(), rb_enc_codepoint_len(), rb_enc_get(), rb_enc_isprint, rb_enc_mbclen(), rb_enc_mbcput, rb_enc_nth(), rb_enc_raise, rb_enc_right_char_head, rb_enc_sprintf(), rb_enc_strlen(), rb_enc_toupper(), rb_Float(), RB_GC_GUARD, rb_hash_default_value(), rb_hash_lookup2(), rb_inspect(), rb_int2str(), rb_int_idiv(), rb_int_mul(), rb_int_plus(), rb_int_positive_pow(), rb_Integer(), rb_integer_pack(), RB_INTEGER_TYPE_P, rb_long2int, rb_obj_as_string(), rb_raise(), rb_rational_den(), rb_rational_num(), rb_str_buf_new(), rb_str_capacity(), rb_str_catf(), rb_str_coderange_scan_restartable(), rb_str_new, rb_str_resize(), rb_str_set_len(), rb_str_tmp_frozen_acquire(), rb_str_tmp_frozen_release(), rb_str_to_inum(), rb_sym2str(), rb_sym_intern(), rb_warn(), RFLOAT_VALUE, RSTRING_GETMEM, RSTRING_LEN, RSTRING_PTR, RTEST, ruby_debug, ruby_digitmap, ruby_verbose, SIGNED_VALUE, str, StringValue, strlen(), sym, t, T_BIGNUM, T_FIXNUM, T_FLOAT, T_RATIONAL, T_STRING, term, TRUE, and TYPE.

Referenced by rb_f_sprintf(), rb_str_upto_each(), and rb_str_upto_endless_each().

## ◆ rb_str_vcatf()

VALUE rb_str_vcatf | ( | VALUE | str,
|  | const char * | fmt,
|  | va_list | ap
| ) |  |

Definition at line 1216 of file sprintf.c.

References __SSTR, __SWR, f, rb_str_capacity(), rb_str_modify(), rb_str_resize(), RBASIC, RSTRING_PTR, str, StringValue, and rb_printf_buffer_extra::value.

Referenced by rb_parser_fatal(), rb_parser_printf(), and rb_str_catf().

## ◆ rb_vsprintf()

VALUE rb_vsprintf | ( | const char * | fmt,
|  | va_list | ap
| ) |  |

Definition at line 1197 of file sprintf.c.

References NULL, and rb_enc_vsprintf().

Referenced by ole_raise(), rb_fatal(), rb_frozen_error_raise(), rb_name_error(), rb_name_error_str(), rb_sprintf(), and rb_vraise().