forked from pyimgui/pyimgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
py_imconfig.h
40 lines (32 loc) · 1.25 KB
/
py_imconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Additional config for imgui compilation.
*
* We don't want to touch sources from git submodule in order to configure
* imgui so we force include using `-inlcude` flag during compilation.
*
* TODO: submit PR to imgui that allows configuring congiguration header
# TODO: file using some other preprocessor directive
*/
#pragma once
extern "C" {
#include <Python.h>
}
// few macros to make IM_ASSERT cleaner
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define TOWRAP(x) "(" STRINGIFY(x) ")"
#define AT __FILE__ ":" TOSTRING(__LINE__)
#if defined(_MSC_VER) &&_MSC_VER <= 1500
// lousy workaround for missing stdint.h in Visual C for Python
typedef unsigned __int64 uint64_t;
typedef signed __int64 int64_t;
#endif
// Redefine IM_ASSERT to raise Python specific exceptions
// note: enabling asserts as Python exceptions guards us from
// possible segmentation faults when using functions that
// does not return error values. Especially when pushing/poping
// style stack variables.
#define IM_ASSERT(EX) (void)((EX) || (__py_assert ("ImGui assertion error (" #EX ") at " AT),0))
void __py_assert(const char* msg);
// tune vertex index size to enable longer draw lists (see #138 issue)
#define ImDrawIdx unsigned int