From ed15f2f97e5fef4b9dd4b7ed78ccc357b84ecb2d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 29 Aug 2017 20:57:54 +0530 Subject: [PATCH] Get the layout of the Cell structure --- kitty/data-types.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kitty/data-types.c b/kitty/data-types.c index 98c29da80..76f6429ba 100644 --- a/kitty/data-types.c +++ b/kitty/data-types.c @@ -9,6 +9,7 @@ #include "glfw.h" #include "gl.h" #include "modes.h" +#include #ifdef WITH_PROFILER #include #endif @@ -124,6 +125,11 @@ PyInit_fast_data_types(void) { if (!init_freetype_library(m)) return NULL; if (!init_fontconfig_library(m)) return NULL; #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, "ITALIC", ITALIC_SHIFT); PyModule_AddIntConstant(m, "REVERSE", REVERSE_SHIFT);