2017-04-29 22:21:56 +00:00
|
|
|
#ifndef __RBCOMPAT_H__
|
|
|
|
#define __RBCOMPAT_H__
|
|
|
|
|
2016-11-20 20:16:41 +00:00
|
|
|
#include "plugin.h"
|
|
|
|
#include "rbassert.h"
|
2017-04-29 22:21:56 +00:00
|
|
|
#include "lib/pluginlib_exit.h"
|
2018-04-24 23:05:49 +00:00
|
|
|
#include "lib/stdio_compat.h"
|
2017-04-29 22:21:56 +00:00
|
|
|
|
|
|
|
#include <tlsf.h>
|
2016-11-20 20:16:41 +00:00
|
|
|
|
2017-08-23 18:20:07 +00:00
|
|
|
#undef STR
|
|
|
|
|
2016-11-20 20:16:41 +00:00
|
|
|
int sprintf_wrapper(char *str, const char *fmt, ...);
|
|
|
|
char *getenv_wrapper(const char *c);
|
|
|
|
int puts_wrapper(const char *s);
|
|
|
|
double sin_wrapper(double rads);
|
|
|
|
double cos_wrapper(double rads);
|
|
|
|
int vsprintf_wrapper(char *s, const char *fmt, va_list ap);
|
|
|
|
float fabs_wrapper(float n);
|
|
|
|
float floor_wrapper(float n);
|
|
|
|
|
|
|
|
float atan_wrapper(float x);
|
|
|
|
float atan2_wrapper(float y, float x);
|
|
|
|
float sqrt_wrapper(float x);
|
|
|
|
long strtol_wrapper(const char *nptr, char **endptr, int base);
|
|
|
|
int64_t strtoq_wrapper(const char *nptr, char **endptr, int base);
|
|
|
|
uint64_t strtouq_wrapper(const char *nptr, char **endptr, int base);
|
|
|
|
float pow_wrapper(float x, float y);
|
|
|
|
float ceil_wrapper(float x);
|
|
|
|
|
|
|
|
size_t strspn_wrapper(const char *s1, const char *s2);
|
|
|
|
size_t strcspn_wrapper(const char *s1, const char *s2);
|
|
|
|
int sscanf_wrapper(const char *ibuf, const char *fmt, ...);
|
|
|
|
double atof_wrapper(const char *s);
|
|
|
|
double acos_wrapper(double x);
|
|
|
|
|
|
|
|
#define acos acos_wrapper
|
|
|
|
#define atan atan_wrapper
|
|
|
|
#define atan2 atan2_wrapper
|
|
|
|
#define atof atof_wrapper
|
|
|
|
#define atoi rb->atoi
|
|
|
|
#define atol atoi
|
|
|
|
#define calloc tlsf_calloc
|
|
|
|
#define ceil ceil_wrapper
|
|
|
|
#define cos cos_wrapper
|
|
|
|
#define fabs fabs_wrapper
|
|
|
|
#define floor floor_wrapper
|
|
|
|
#define free tlsf_free
|
|
|
|
#define getenv getenv_wrapper
|
|
|
|
#define malloc tlsf_malloc
|
|
|
|
#define memchr rb->memchr
|
2019-05-16 00:39:23 +00:00
|
|
|
#define memswap puzzles_memswap
|
2016-11-20 20:16:41 +00:00
|
|
|
#define pow pow_wrapper
|
|
|
|
#define printf LOGF
|
|
|
|
#define puts puts_wrapper
|
|
|
|
#define qsort rb->qsort
|
|
|
|
#define realloc tlsf_realloc
|
|
|
|
#define sin sin_wrapper
|
|
|
|
#define sprintf sprintf_wrapper
|
|
|
|
#define sqrt sqrt_wrapper
|
|
|
|
#define sscanf sscanf_wrapper
|
|
|
|
#define strcat rb->strcat
|
|
|
|
#define strchr rb->strchr
|
|
|
|
#define strcmp rb->strcmp
|
|
|
|
#define strcpy rb->strcpy
|
|
|
|
#define strlen rb->strlen
|
|
|
|
#define strtol strtol_wrapper
|
|
|
|
#define strtoq strtoq_wrapper
|
|
|
|
#define strtouq strtouq_wrapper
|
|
|
|
#define vsprintf vsprintf_wrapper
|
2017-04-29 22:21:56 +00:00
|
|
|
|
2017-08-23 18:20:07 +00:00
|
|
|
#ifndef strcspn
|
|
|
|
#define strcspn strcspn_wrapper
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef strspn /* gcc has builtin */
|
|
|
|
#define strspn strspn_wrapper
|
|
|
|
#endif
|
|
|
|
|
2017-04-29 22:21:56 +00:00
|
|
|
#define abs(x) ((x)<0?-(x):(x))
|
2018-06-20 23:13:03 +00:00
|
|
|
#define labs abs
|
2017-04-29 22:21:56 +00:00
|
|
|
|
|
|
|
#endif
|