Get the layout of the Cell structure

This commit is contained in:
Kovid Goyal 2017-08-29 20:57:54 +05:30
parent 6689595277
commit ed15f2f97e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -9,6 +9,7 @@
#include "glfw.h" #include "glfw.h"
#include "gl.h" #include "gl.h"
#include "modes.h" #include "modes.h"
#include <stddef.h>
#ifdef WITH_PROFILER #ifdef WITH_PROFILER
#include <gperftools/profiler.h> #include <gperftools/profiler.h>
#endif #endif
@ -124,6 +125,11 @@ PyInit_fast_data_types(void) {
if (!init_freetype_library(m)) return NULL; if (!init_freetype_library(m)) return NULL;
if (!init_fontconfig_library(m)) return NULL; if (!init_fontconfig_library(m)) return NULL;
#endif #endif
#define OOF(n) #n, offsetof(Cell, n)
if (PyModule_AddObject(m, "CELL", Py_BuildValue("{sI sI sI sI sI sI}",
OOF(ch), OOF(fg), OOF(bg), OOF(decoration_fg), OOF(cc), "size", sizeof(Cell))) != 0) return NULL;
#undef OOF
PyModule_AddIntConstant(m, "BOLD", BOLD_SHIFT); PyModule_AddIntConstant(m, "BOLD", BOLD_SHIFT);
PyModule_AddIntConstant(m, "ITALIC", ITALIC_SHIFT); PyModule_AddIntConstant(m, "ITALIC", ITALIC_SHIFT);
PyModule_AddIntConstant(m, "REVERSE", REVERSE_SHIFT); PyModule_AddIntConstant(m, "REVERSE", REVERSE_SHIFT);