2020-04-10 01:11:40 -04:00
|
|
|
#ifndef RUBY_UTIL_H /*-*-C++-*-vi:se ft=cpp:*/
|
2007-06-09 23:06:15 -04:00
|
|
|
#define RUBY_UTIL_H 1
|
2020-04-10 01:11:40 -04:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @author $Author$
|
|
|
|
* @date Thu Mar 9 11:55:53 JST 1995
|
|
|
|
* @copyright Copyright (C) 1993-2007 Yukihiro Matsumoto
|
|
|
|
* @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.
|
|
|
|
*/
|
2020-05-04 02:35:26 -04:00
|
|
|
#include "ruby/impl/config.h"
|
|
|
|
#include "ruby/impl/dllexport.h"
|
2010-07-27 05:33:55 -04:00
|
|
|
#include "ruby/defines.h"
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#ifndef _
|
2001-12-21 02:20:23 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
# ifndef HAVE_PROTOTYPES
|
|
|
|
# define HAVE_PROTOTYPES 1
|
|
|
|
# endif
|
|
|
|
# ifndef HAVE_STDARG_PROTOTYPES
|
|
|
|
# define HAVE_STDARG_PROTOTYPES 1
|
|
|
|
# endif
|
|
|
|
#endif
|
1999-08-13 01:45:20 -04:00
|
|
|
#ifdef HAVE_PROTOTYPES
|
|
|
|
# define _(args) args
|
|
|
|
#else
|
|
|
|
# define _(args) ()
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STDARG_PROTOTYPES
|
|
|
|
# define __(args) args
|
|
|
|
#else
|
|
|
|
# define __(args) ()
|
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
#endif
|
|
|
|
|
2020-04-08 00:28:13 -04:00
|
|
|
RUBY3_SYMBOL_EXPORT_BEGIN()
|
2010-07-21 17:38:25 -04:00
|
|
|
|
2014-01-11 19:21:37 -05:00
|
|
|
#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
|
2015-06-03 22:53:11 -04:00
|
|
|
/* an approximation of ceil(n * log10(2)), up to 65536 at least */
|
2014-01-11 19:21:37 -05:00
|
|
|
|
2011-04-09 05:02:03 -04:00
|
|
|
#define scan_oct(s,l,e) ((int)ruby_scan_oct((s),(l),(e)))
|
2009-03-14 05:25:20 -04:00
|
|
|
unsigned long ruby_scan_oct(const char *, size_t, size_t *);
|
2011-04-09 05:02:03 -04:00
|
|
|
#define scan_hex(s,l,e) ((int)ruby_scan_hex((s),(l),(e)))
|
2009-03-14 05:25:20 -04:00
|
|
|
unsigned long ruby_scan_hex(const char *, size_t, size_t *);
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2014-02-08 07:50:28 -05:00
|
|
|
#ifdef HAVE_GNU_QSORT_R
|
|
|
|
# define ruby_qsort qsort_r
|
|
|
|
#else
|
2009-03-13 21:56:42 -04:00
|
|
|
void ruby_qsort(void *, const size_t, const size_t,
|
2006-12-31 10:02:22 -05:00
|
|
|
int (*)(const void *, const void *, void *), void *);
|
2014-02-08 07:50:28 -05:00
|
|
|
#endif
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
void ruby_setenv(const char *, const char *);
|
|
|
|
void ruby_unsetenv(const char *);
|
1999-08-13 01:45:20 -04:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
char *ruby_strdup(const char *);
|
2000-07-27 05:49:34 -04:00
|
|
|
#undef strdup
|
2003-08-03 21:27:25 -04:00
|
|
|
#define strdup(s) ruby_strdup(s)
|
2000-07-27 05:49:34 -04:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
char *ruby_getcwd(void);
|
2001-11-08 01:43:14 -05:00
|
|
|
|
2006-12-31 10:02:22 -05:00
|
|
|
double ruby_strtod(const char *, char **);
|
2005-11-01 08:04:35 -05:00
|
|
|
#undef strtod
|
2011-04-09 05:02:03 -04:00
|
|
|
#define strtod(s,e) ruby_strtod((s),(e))
|
2002-05-14 02:22:31 -04:00
|
|
|
|
2008-02-23 16:13:05 -05:00
|
|
|
void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
|
|
|
|
|
2020-04-08 00:28:13 -04:00
|
|
|
RUBY3_SYMBOL_EXPORT_END()
|
2007-06-09 23:06:15 -04:00
|
|
|
|
|
|
|
#endif /* RUBY_UTIL_H */
|