util.h File Reference
`#include "ruby/defines.h"`

Go to the source code of this file.

## Macros

#define | _(args) ()
#define | __(args) ()
#define | scan_oct(s, l, e) ((int)ruby_scan_oct((s),(l),(e)))
#define | scan_hex(s, l, e) ((int)ruby_scan_hex((s),(l),(e)))
#define | setenv(name, val) ruby_setenv((name),(val))
#define | unsetenv(name, val) ruby_unsetenv(name);
#define | strdup(s) ruby_strdup(s)
#define | my_getcwd() ruby_getcwd()
#define | strtod(s, e) ruby_strtod((s),(e))

## Functions

unsigned long | ruby_scan_oct (const char *, size_t, size_t *)
unsigned long | ruby_scan_hex (const char *, size_t, size_t *)
void | ruby_qsort (void *, const size_t, const size_t, int(*)(const void *, const void *, void *), void *)
void | ruby_setenv (const char *, const char *)
void | ruby_unsetenv (const char *)
char * | ruby_strdup (const char *)
char * | ruby_getcwd (void)
double | ruby_strtod (const char *, char **)
void | ruby_each_words (const char *, void(*)(const char *, int, void *), void *)

## Macro Definition Documentation

#define _ | ( |  | args | ) | ()

Definition at line 39 of file util.h.

#define __ | ( |  | args | ) | ()

Definition at line 44 of file util.h.

#define my_getcwd | ( |  | ) | ruby_getcwd()

Definition at line 76 of file util.h.

Referenced by dir_s_chdir(), file_expand_path(), path_check_0(), rb_dir_getwd(), and rb_run_exec_options_err().

#define scan_hex | ( |  | s,
|  |  | l,
|  |  | e
| ) |  | ((int)ruby_scan_hex((s),(l),(e)))

Definition at line 54 of file util.h.

Referenced by parser_tok_hex(), parser_tokadd_utf8(), and read_escaped_byte().

#define scan_oct | ( |  | s,
|  |  | l,
|  |  | e
| ) |  | ((int)ruby_scan_oct((s),(l),(e)))

Definition at line 52 of file util.h.

Referenced by parser_read_escape(), proc_options(), and read_escaped_byte().

#define setenv | ( |  | name,
|  |  | val
| ) |  | ruby_setenv((name),(val))

Definition at line 68 of file util.h.

Referenced by ruby_setenv().

#define strdup | ( |  | s | ) | ruby_strdup(s)

Definition at line 73 of file util.h.

Referenced by alloc_invoke_arguments(), argf_inplace_mode_set(), dln_find_exe_r(), enc_alias_internal(), enc_register_at(), enc_set_default_encoding(), init_env(), insert(), ip_invoke_core(), ip_ruby_cmd_receiver_const_get(), mSyslog_open(), rb_dlcfunc_initialize(), rb_dlcfunc_new(), rb_w32_cmdvector(), rb_w32_get_environ(), readline_attempted_completion_function(), ruby_set_inplace_mode(), tcl_eval(), tcl_global_eval(), and zone_str().

#define strtod | ( |  | s,
|  |  | e
| ) |  | ruby_strtod((s),(e))

Definition at line 80 of file util.h.

Referenced by BigDecimal_to_f(), parser_yylex(), r_object0(), rb_cstr_to_dbl(), sycklex_bytecode_utf8(), and yaml_org_handler().

#define unsetenv | ( |  | name,
|  |  | val
| ) |  | ruby_unsetenv(name);

Definition at line 69 of file util.h.

Referenced by ruby_setenv().

## Function Documentation

void ruby_each_words | ( | const char * | ,
|  | void(*)(const char *, int, void *) | ,
|  | void * |
| ) |  |

Definition at line 3888 of file util.c.

References arg, ISSPACE, and len.

char* ruby_getcwd | ( | void |  | ) |

Definition at line 613 of file util.c.

References buf, errno, PATH_MAX, rb_sys_fail(), xfree(), xmalloc, and xrealloc.

void ruby_qsort | ( | void * | ,
|  | const size_t | ,
|  | const size_t | ,
|  | int(*)(const void *, const void *, void *) | ,
|  | void * |
| ) |  |

Definition at line 451 of file util.c.

References cmp(), fail, med3, mmprepare, mmrot3, mmswap, p, POP, PUSH, R, size, and top.

unsigned long ruby_scan_hex | ( | const char * | ,
|  | size_t | ,
|  | size_t * |
| ) |  |

Definition at line 42 of file util.c.

References strchr().

unsigned long ruby_scan_oct | ( | const char * | ,
|  | size_t | ,
|  | size_t * |
| ) |  |

Definition at line 28 of file util.c.

void ruby_setenv | ( | const char * | ,
|  | const char * |
| ) |  |

Definition at line 2244 of file hash.c.

References ALLOC_N, buf, envix(), errno, fail, free(), GET_ENVIRON, i, len, malloc(), max(), origenviron, rb_sprintf(), rb_str_resize(), rb_sys_fail(), REALLOC_N, RSTRING_PTR, ruby_strdup(), setenv, snprintf, strchr(), strlen(), unsetenv, and xfree().

Referenced by env_aset(), env_delete(), rb_run_exec_options_err(), and ruby_unsetenv().

char* ruby_strdup | ( | const char * |  | ) |

Definition at line 601 of file util.c.

References strlen(), and xmalloc.

double ruby_strtod | ( | const char * | ,
|  | char ** |
| ) |  |

Definition at line 2070 of file util.c.

References Avoid_Underflow, Balloc(), Bcopy, Bfree(), Bias, Big0, Big1, bigtens, Bndry_mask, Bndry_mask1, cmp(), d2b(), DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, diff(), dval, Emin, errno, Exp_1, Exp_mask, Exp_msk1, Exp_shift, FLT_RADIX, Flt_Rounds, Frac_mask, i, i2b(), IEEE_Arith, ISDIGIT, Bigint::k, Log2P, LSB, lshift(), match(), mult(), n_bigtens, NULL, P, pow5mult(), ratio(), rounded_product, rounded_quotient, Rounding, s2b(), Scale_Bit, Bigint::sign, strchr(), Ten_pmax, tens, Tiny0, Tiny1, ulp(), Bigint::wds, word0, word1, and Bigint::x.

void ruby_unsetenv | ( | const char * |  | ) |

Definition at line 2356 of file hash.c.

References ruby_setenv().