Ensure python type objects are declared in onlya single unit

This commit is contained in:
Kovid Goyal 2017-11-01 13:14:50 +05:30
parent 6cbd1d1727
commit 21ed07d7ce
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
10 changed files with 15 additions and 12 deletions

View File

@ -28,6 +28,7 @@ extern int pthread_setname_np(const char *name);
#include <sys/wait.h>
#include <signal.h>
#include <GLFW/glfw3.h>
extern PyTypeObject Screen_Type;
#define EXTRA_FDS 2
#define wakeup_main_loop glfwPostEmptyEvent

View File

@ -8,6 +8,8 @@
#include "data-types.h"
#include <structmember.h>
PyTypeObject ColorProfile_Type;
static uint32_t FG_BG_256[256] = {
0x000000, // 0
0xcd0000, // 1

View File

@ -135,7 +135,6 @@ typedef struct {
bool continued;
bool needs_free;
} Line;
PyTypeObject Line_Type;
typedef struct {
@ -146,7 +145,6 @@ typedef struct {
bool *continued_map;
Line *line;
} LineBuf;
PyTypeObject LineBuf_Type;
typedef struct {
@ -158,7 +156,6 @@ typedef struct {
index_type start_of_data, count;
bool *continued_map;
} HistoryBuf;
PyTypeObject HistoryBuf_Type;
typedef struct {
PyObject_HEAD
@ -170,10 +167,6 @@ typedef struct {
unsigned long fg, bg, decoration_fg;
} Cursor;
PyTypeObject Cursor_Type;
PyTypeObject Face_Type;
PyTypeObject Window_Type;
typedef struct {
color_type default_fg, default_bg, cursor_color, highlight_fg, highlight_bg;
@ -187,7 +180,6 @@ typedef struct {
uint32_t orig_color_table[256];
DynamicColor configured, overridden;
} ColorProfile;
PyTypeObject ColorProfile_Type;
#define SAVEPOINTS_SZ 256
@ -223,7 +215,6 @@ typedef struct {
bool shutting_down;
pthread_t io_thread;
} ChildMonitor;
PyTypeObject ChildMonitor_Type;
#define clear_sprite_position(cell) (cell).sprite_x = 0; (cell).sprite_y = 0; (cell).sprite_z = 0;

View File

@ -17,6 +17,7 @@
#include <zlib.h>
#include <png.h>
#include <structmember.h>
PyTypeObject GraphicsManager_Type;
#define STORAGE_LIMIT (320 * (1024 * 1024))

View File

@ -74,7 +74,6 @@ typedef struct {
unsigned int last_scrolled_by;
size_t used_storage;
} GraphicsManager;
PyTypeObject GraphicsManager_Type;
typedef struct {

View File

@ -9,6 +9,8 @@
#include "lineops.h"
#include <structmember.h>
extern PyTypeObject Line_Type;
static inline Cell*
lineptr(HistoryBuf *linebuf, index_type y) {
return linebuf->buf + y * linebuf->xnum;

View File

@ -9,6 +9,9 @@
#include "lineops.h"
#include <structmember.h>
extern PyTypeObject Line_Type;
extern PyTypeObject HistoryBuf_Type;
static inline Cell*
lineptr(LineBuf *linebuf, index_type y) {
return linebuf->buf + y * linebuf->xnum;

View File

@ -9,6 +9,8 @@
#include "unicode-data.h"
#include "lineops.h"
extern PyTypeObject Cursor_Type;
static PyObject *
new(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
PyErr_SetString(PyExc_TypeError, "Line objects cannot be instantiated directly, create them using LineBuf.line()");

View File

@ -10,6 +10,8 @@
#include "graphics.h"
#include <time.h>
extern PyTypeObject Screen_Type;
// utils {{{
static unsigned long pow10[] = {
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000
@ -894,6 +896,8 @@ dispatch_unicode_char(Screen *screen, uint32_t codepoint, PyObject DUMP_UNUSED *
#undef HANDLE
}
extern uint32_t *latin1_charset;
static inline void
_parse_bytes(Screen *screen, uint8_t *buf, Py_ssize_t len, PyObject DUMP_UNUSED *dump_callback) {
uint32_t prev = screen->utf8_state;

View File

@ -56,7 +56,6 @@ typedef struct {
pthread_mutex_t read_buf_lock, write_buf_lock;
} Screen;
PyTypeObject Screen_Type;
void parse_worker(Screen *screen, PyObject *dump_callback);
@ -108,7 +107,6 @@ void set_icon(Screen *self, PyObject*);
void set_dynamic_color(Screen *self, unsigned int code, PyObject*);
void set_color_table_color(Screen *self, unsigned int code, PyObject*);
uint32_t* translation_table(uint32_t which);
uint32_t *latin1_charset;
void screen_request_capabilities(Screen *, PyObject *);
void report_device_attributes(Screen *self, unsigned int UNUSED mode, char start_modifier);
void select_graphic_rendition(Screen *self, unsigned int *params, unsigned int count);