Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "ruby/internal/config.h"
#include <math.h>
#include <stdarg.h>
#include "id.h"
#include "internal.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
#include "internal/sanitizers.h"
#include "internal/symbol.h"
#include "internal/util.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "vsnprintf.c"
Go to the source code of this file.
Data Structures | |
struct | rb_printf_buffer_extra |
Macros | |
#define | BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ |
#define | FNONE 0 |
#define | FSHARP 1 |
#define | FMINUS 2 |
#define | FPLUS 4 |
#define | FZERO 8 |
#define | FSPACE 16 |
#define | FWIDTH 32 |
#define | FPREC 64 |
#define | FPREC0 128 |
#define | CHECK(l) |
#define | PUSH(s, l) |
#define | PUSH_(s, l) |
#define | FILL(c, l) |
#define | FILL_(c, l) |
#define | GETARG() |
#define | GETNEXTARG() |
#define | GETPOSARG(n) |
#define | GETNTHARG(nth) (((nth) >= argc) ? (rb_raise(rb_eArgError, "too few arguments"), 0) : argv[(nth)]) |
#define | CHECKNAMEARG(name, len, enc) |
#define | GETNUM(n, val) |
#define | GETASTER(val) |
#define | CHECK_FOR_WIDTH(f) |
#define | CHECK_FOR_FLAGS(f) |
#define | FILE rb_printf_buffer |
#define | __sbuf rb_printf_sbuf |
#define | __sFILE rb_printf_sfile |
#define | FLOATING_POINT 1 |
#define | BSD__dtoa ruby_dtoa |
#define | BSD__hdtoa ruby_hdtoa |
#define | PRI_EXTRA_MARK RUBY_PRI_VALUE_MARK |
#define | lower_hexdigits (ruby_hexdigits+0) |
#define | upper_hexdigits (ruby_hexdigits+16) |
#define | LITERAL(str) (*sz = rb_strlen_lit(str), str) |
#define | f buffer.base |
#define | f buffer.base |
Functions | |
VALUE | rb_f_sprintf (int argc, const VALUE *argv) |
VALUE | rb_str_format (int argc, const VALUE *argv, VALUE fmt) |
int | ruby_vsnprintf (char *str, size_t n, const char *fmt, va_list ap) |
int | ruby_snprintf (char *str, size_t n, char const *fmt,...) |
VALUE | rb_enc_vsprintf (rb_encoding *enc, const char *fmt, va_list ap) |
VALUE | rb_enc_sprintf (rb_encoding *enc, const char *format,...) |
VALUE | rb_vsprintf (const char *fmt, va_list ap) |
VALUE | rb_sprintf (const char *format,...) |
VALUE | rb_str_vcatf (VALUE str, const char *fmt, va_list ap) |
VALUE | rb_str_catf (VALUE str, const char *format,...) |
#define BSD__hdtoa ruby_hdtoa |
#define CHECK | ( | l | ) |
#define CHECK_FOR_FLAGS | ( | f | ) |
#define CHECK_FOR_WIDTH | ( | f | ) |
#define f buffer.base |
#define f buffer.base |
#define FILL_ | ( | c, | |
l | |||
) |
#define GETARG | ( | ) |
#define GETASTER | ( | val | ) |
#define GETNEXTARG | ( | ) |
#define GETNTHARG | ( | nth | ) | (((nth) >= argc) ? (rb_raise(rb_eArgError, "too few arguments"), 0) : argv[(nth)]) |
#define GETNUM | ( | n, | |
val | |||
) |
#define GETPOSARG | ( | n | ) |
#define LITERAL | ( | str | ) | (*sz = rb_strlen_lit(str), str) |
#define lower_hexdigits (ruby_hexdigits+0) |
#define PRI_EXTRA_MARK RUBY_PRI_VALUE_MARK |
#define PUSH | ( | s, | |
l | |||
) |
#define PUSH_ | ( | s, | |
l | |||
) |
#define upper_hexdigits (ruby_hexdigits+16) |
VALUE rb_enc_sprintf | ( | rb_encoding * | enc, |
const char * | format, | ||
... | |||
) |
Definition at line 1184 of file sprintf.c.
References rb_enc_vsprintf().
Referenced by rb_str_format(), rb_str_upto_each(), and rb_str_upto_endless_each().
VALUE rb_enc_vsprintf | ( | rb_encoding * | enc, |
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 1151 of file sprintf.c.
References __SSTR, __SWR, f, rb_cString, rb_eArgError, rb_enc_associate(), rb_enc_mbminlen, rb_enc_name, rb_raise(), rb_str_buf_new(), rb_str_resize(), RSTRING_PTR, and rb_printf_buffer_extra::value.
Referenced by rb_enc_raise(), rb_enc_sprintf(), rb_loaderror(), rb_loaderror_with_path(), and rb_vsprintf().
Definition at line 208 of file sprintf.c.
References argc, argv, GETNTHARG, and rb_str_format().
Referenced by rb_io_printf().
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().
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().
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().
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().
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().