Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
util.h
Go to the documentation of this file.
1#ifndef RUBY_UTIL_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RUBY_UTIL_H 1
15#include "ruby/defines.h"
16
18
19#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
20/* an approximation of ceil(n * log10(2)), up to 65536 at least */
21
22#define scan_oct(s,l,e) ((int)ruby_scan_oct((s),(l),(e)))
23unsigned long ruby_scan_oct(const char *, size_t, size_t *);
24#define scan_hex(s,l,e) ((int)ruby_scan_hex((s),(l),(e)))
25unsigned long ruby_scan_hex(const char *, size_t, size_t *);
26
27#ifdef HAVE_GNU_QSORT_R
28# define ruby_qsort qsort_r
29#else
30void ruby_qsort(void *, const size_t, const size_t,
31 int (*)(const void *, const void *, void *), void *);
32#endif
33
34void ruby_setenv(const char *, const char *);
35void ruby_unsetenv(const char *);
36
37char *ruby_strdup(const char *);
38#undef strdup
39#define strdup(s) ruby_strdup(s)
40
41char *ruby_getcwd(void);
42
43double ruby_strtod(const char *, char **);
44#undef strtod
45#define strtod(s,e) ruby_strtod((s),(e))
46
47void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
48
50
51#endif /* RUBY_UTIL_H */
Tewaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:86
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:77
Thin wrapper to ruby/config.h.
unsigned long ruby_scan_oct(const char *, size_t, size_t *)
Definition: util.c:38
char * ruby_strdup(const char *)
Definition: util.c:531
unsigned long ruby_scan_hex(const char *, size_t, size_t *)
Definition: util.c:56
void ruby_setenv(const char *, const char *)
Definition: hash.c:5145
double ruby_strtod(const char *, char **)
void ruby_unsetenv(const char *)
Definition: hash.c:5284
void ruby_qsort(void *, const size_t, const size_t, int(*)(const void *, const void *, void *), void *)
char * ruby_getcwd(void)
Definition: util.c:543
void ruby_each_words(const char *, void(*)(const char *, int, void *), void *)
Definition: util.c:589