diff options
author | shumkovnd <shumkovnd@yandex-team.com> | 2023-11-10 14:39:34 +0300 |
---|---|---|
committer | shumkovnd <shumkovnd@yandex-team.com> | 2023-11-10 16:42:24 +0300 |
commit | 77eb2d3fdcec5c978c64e025ced2764c57c00285 (patch) | |
tree | c51edb0748ca8d4a08d7c7323312c27ba1a8b79a /contrib/python/matplotlib/py2/src/mplutils.h | |
parent | dd6d20cadb65582270ac23f4b3b14ae189704b9d (diff) | |
download | ydb-77eb2d3fdcec5c978c64e025ced2764c57c00285.tar.gz |
KIKIMR-19287: add task_stats_drawing script
Diffstat (limited to 'contrib/python/matplotlib/py2/src/mplutils.h')
-rw-r--r-- | contrib/python/matplotlib/py2/src/mplutils.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/contrib/python/matplotlib/py2/src/mplutils.h b/contrib/python/matplotlib/py2/src/mplutils.h new file mode 100644 index 0000000000..140a815634 --- /dev/null +++ b/contrib/python/matplotlib/py2/src/mplutils.h @@ -0,0 +1,72 @@ +/* -*- mode: c++; c-basic-offset: 4 -*- */ + +/* Small utilities that are shared by most extension modules. */ + +#ifndef _MPLUTILS_H +#define _MPLUTILS_H + +#if defined(_MSC_VER) && _MSC_VER <= 1600 +typedef unsigned __int8 uint8_t; +#else +#include <stdint.h> +#endif + +#ifdef _POSIX_C_SOURCE +# undef _POSIX_C_SOURCE +#endif +#ifndef _AIX +#ifdef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif +#endif + +// Prevent multiple conflicting definitions of swab from stdlib.h and unistd.h +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#if defined(_XPG3) +#undef _XPG3 +#endif +#endif + +#include <Python.h> + +#if PY_MAJOR_VERSION >= 3 +#define PY3K 1 +#define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#else +#define PY3K 0 +#endif + +#undef CLAMP +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +inline double mpl_round(double v) +{ + return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); +} + +enum { + STOP = 0, + MOVETO = 1, + LINETO = 2, + CURVE3 = 3, + CURVE4 = 4, + ENDPOLY = 0x4f +}; + +const size_t NUM_VERTICES[] = { 1, 1, 1, 2, 3, 1 }; + +extern "C" int add_dict_int(PyObject *dict, const char *key, long val); + +#if defined(_MSC_VER) && (_MSC_VER < 1800) +namespace std { + inline bool isfinite(double num) { return _finite(num); } +} +#endif + +#endif |