extern all the things

This commit is contained in:
K. Lange 2018-03-01 23:15:37 +09:00 committed by Kevin Lange
parent e71802a2e0
commit adb38a1a8a
8 changed files with 85 additions and 84 deletions

View File

@ -41,46 +41,47 @@ typedef struct context {
void * clips; void * clips;
} gfx_context_t; } gfx_context_t;
gfx_context_t * init_graphics_fullscreen(); extern gfx_context_t * init_graphics_fullscreen();
gfx_context_t * init_graphics_fullscreen_double_buffer(); extern gfx_context_t * init_graphics_fullscreen_double_buffer();
void reinit_graphics_fullscreen(gfx_context_t * ctx); extern void reinit_graphics_fullscreen(gfx_context_t * ctx);
#define ALPHA_OPAQUE 0 #define ALPHA_OPAQUE 0
#define ALPHA_MASK 1 #define ALPHA_MASK 1
#define ALPHA_EMBEDDED 2 #define ALPHA_EMBEDDED 2
#define ALPHA_INDEXED 3 #define ALPHA_INDEXED 3
uint32_t rgb(uint8_t r, uint8_t g, uint8_t b); extern uint32_t rgb(uint8_t r, uint8_t g, uint8_t b);
uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a); extern uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
uint32_t alpha_blend(uint32_t bottom, uint32_t top, uint32_t mask); extern uint32_t alpha_blend(uint32_t bottom, uint32_t top, uint32_t mask);
uint32_t alpha_blend_rgba(uint32_t bottom, uint32_t top); extern uint32_t alpha_blend_rgba(uint32_t bottom, uint32_t top);
uint32_t framebuffer_stride(void); extern uint32_t framebuffer_stride(void);
void flip(gfx_context_t * ctx); extern void flip(gfx_context_t * ctx);
void clear_buffer(gfx_context_t * ctx); void clear_buffer(gfx_context_t * ctx);
gfx_context_t * init_graphics_sprite(sprite_t * sprite); extern gfx_context_t * init_graphics_sprite(sprite_t * sprite);
sprite_t * create_sprite(size_t width, size_t height, int alpha); extern sprite_t * create_sprite(size_t width, size_t height, int alpha);
void blur_context(gfx_context_t * _dst, gfx_context_t * _src, double amount); extern void blur_context(gfx_context_t * _dst, gfx_context_t * _src, double amount);
void blur_context_no_vignette(gfx_context_t * _dst, gfx_context_t * _src, double amount); extern void blur_context_no_vignette(gfx_context_t * _dst, gfx_context_t * _src, double amount);
void blur_context_box(gfx_context_t * _src, int radius); extern void blur_context_box(gfx_context_t * _src, int radius);
void sprite_free(sprite_t * sprite); extern void sprite_free(sprite_t * sprite);
void load_sprite(sprite_t * sprite, char * filename); extern void load_sprite(sprite_t * sprite, char * filename);
//int load_sprite_png(sprite_t * sprite, char * file); //extern int load_sprite_png(sprite_t * sprite, char * file);
void draw_sprite(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y); extern void draw_sprite(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y);
void draw_line(gfx_context_t * ctx, int32_t x0, int32_t x1, int32_t y0, int32_t y1, uint32_t color); extern void draw_line(gfx_context_t * ctx, int32_t x0, int32_t x1, int32_t y0, int32_t y1, uint32_t color);
void draw_line_thick(gfx_context_t * ctx, int32_t x0, int32_t x1, int32_t y0, int32_t y1, uint32_t color, char thickness); extern void draw_line_thick(gfx_context_t * ctx, int32_t x0, int32_t x1, int32_t y0, int32_t y1, uint32_t color, char thickness);
void draw_fill(gfx_context_t * ctx, uint32_t color); extern void draw_fill(gfx_context_t * ctx, uint32_t color);
void draw_sprite_scaled(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height); extern void draw_sprite_scaled(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height);
void draw_sprite_scaled_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height, float alpha); extern void draw_sprite_scaled_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height, float alpha);
void draw_sprite_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float alpha); extern void draw_sprite_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float alpha);
//void context_to_png(FILE * file, gfx_context_t * ctx); //extern void context_to_png(FILE * file, gfx_context_t * ctx);
uint32_t premultiply(uint32_t color); extern uint32_t premultiply(uint32_t color);
extern void gfx_add_clip(gfx_context_t * ctx, int32_t x, int32_t y, int32_t w, int32_t h);
extern void gfx_clear_clip(gfx_context_t * ctx);
void gfx_add_clip(gfx_context_t * ctx, int32_t x, int32_t y, int32_t w, int32_t h);
void gfx_clear_clip(gfx_context_t * ctx);

View File

@ -144,6 +144,6 @@ typedef struct {
int kbd_esc_buf; int kbd_esc_buf;
} key_event_state_t; } key_event_state_t;
kbd_key_t kbd_key(key_event_state_t * state, unsigned char c); extern kbd_key_t kbd_key(key_event_state_t * state, unsigned char c);
int kbd_scancode(key_event_state_t * state, unsigned char c, key_event_t * event); extern int kbd_scancode(key_event_state_t * state, unsigned char c, key_event_t * event);

View File

@ -25,25 +25,25 @@ typedef struct {
size_t length; size_t length;
} __attribute__((packed)) list_t; } __attribute__((packed)) list_t;
void list_destroy(list_t * list); extern void list_destroy(list_t * list);
void list_free(list_t * list); extern void list_free(list_t * list);
void list_append(list_t * list, node_t * item); extern void list_append(list_t * list, node_t * item);
node_t * list_insert(list_t * list, void * item); extern node_t * list_insert(list_t * list, void * item);
list_t * list_create(void); extern list_t * list_create(void);
node_t * list_find(list_t * list, void * value); extern node_t * list_find(list_t * list, void * value);
int list_index_of(list_t * list, void * value); extern int list_index_of(list_t * list, void * value);
void list_remove(list_t * list, size_t index); extern void list_remove(list_t * list, size_t index);
void list_delete(list_t * list, node_t * node); extern void list_delete(list_t * list, node_t * node);
node_t * list_pop(list_t * list); extern node_t * list_pop(list_t * list);
node_t * list_dequeue(list_t * list); extern node_t * list_dequeue(list_t * list);
list_t * list_copy(list_t * original); extern list_t * list_copy(list_t * original);
void list_merge(list_t * target, list_t * source); extern void list_merge(list_t * target, list_t * source);
void list_append_after(list_t * list, node_t * before, node_t * node); extern void list_append_after(list_t * list, node_t * before, node_t * node);
node_t * list_insert_after(list_t * list, node_t * before, void * item); extern node_t * list_insert_after(list_t * list, node_t * before, void * item);
void list_append_before(list_t * list, node_t * after, node_t * node); extern void list_append_before(list_t * list, node_t * after, node_t * node);
node_t * list_insert_before(list_t * list, node_t * after, void * item); extern node_t * list_insert_before(list_t * list, node_t * after, void * item);
#define foreach(i, list) for (node_t * i = (list)->head; i != NULL; i = i->next) #define foreach(i, list) for (node_t * i = (list)->head; i != NULL; i = i->next)
#define foreachr(i, list) for (node_t * i = (list)->tail; i != NULL; i = i->prev) #define foreachr(i, list) for (node_t * i = (list)->tail; i != NULL; i = i->prev)

View File

@ -16,14 +16,14 @@ typedef struct pex_header {
uint8_t data[]; uint8_t data[];
} pex_header_t; } pex_header_t;
size_t pex_send(FILE * sock, unsigned int rcpt, size_t size, char * blob); extern size_t pex_send(FILE * sock, unsigned int rcpt, size_t size, char * blob);
size_t pex_broadcast(FILE * sock, size_t size, char * blob); extern size_t pex_broadcast(FILE * sock, size_t size, char * blob);
size_t pex_listen(FILE * sock, pex_packet_t * packet); extern size_t pex_listen(FILE * sock, pex_packet_t * packet);
size_t pex_reply(FILE * sock, size_t size, char * blob); extern size_t pex_reply(FILE * sock, size_t size, char * blob);
size_t pex_recv(FILE * sock, char * blob); extern size_t pex_recv(FILE * sock, char * blob);
size_t pex_query(FILE * sock); extern size_t pex_query(FILE * sock);
FILE * pex_bind(char * target); extern FILE * pex_bind(char * target);
FILE * pex_connect(char * target); extern FILE * pex_connect(char * target);

View File

@ -10,10 +10,10 @@ typedef struct {
} pthread_t; } pthread_t;
typedef unsigned int pthread_attr_t; typedef unsigned int pthread_attr_t;
int pthread_create(pthread_t * thread, pthread_attr_t * attr, void *(*start_routine)(void *), void * arg); extern int pthread_create(pthread_t * thread, pthread_attr_t * attr, void *(*start_routine)(void *), void * arg);
void pthread_exit(void * value); extern void pthread_exit(void * value);
int pthread_kill(pthread_t thread, int sig); extern int pthread_kill(pthread_t thread, int sig);
int clone(uintptr_t,uintptr_t,void*); extern int clone(uintptr_t,uintptr_t,void*);
int gettid(); extern int gettid();

View File

@ -26,15 +26,15 @@ typedef struct rline_callback {
rline_callback_t rev_search; rline_callback_t rev_search;
} rline_callbacks_t; } rline_callbacks_t;
void rline_redraw(rline_context_t * context); extern void rline_redraw(rline_context_t * context);
void rline_redraw_clean(rline_context_t * context); extern void rline_redraw_clean(rline_context_t * context);
void rline_insert(rline_context_t * context, const char * what); extern void rline_insert(rline_context_t * context, const char * what);
int rline(char * buffer, int buf_size, rline_callbacks_t * callbacks); extern int rline(char * buffer, int buf_size, rline_callbacks_t * callbacks);
void rline_history_insert(char * str); extern void rline_history_insert(char * str);
void rline_history_append_line(char * str); extern void rline_history_append_line(char * str);
char * rline_history_get(int item); extern char * rline_history_get(int item);
char * rline_history_prev(int item); extern char * rline_history_prev(int item);
#define RLINE_HISTORY_ENTRIES 128 #define RLINE_HISTORY_ENTRIES 128
extern char * rline_history[RLINE_HISTORY_ENTRIES]; extern char * rline_history[RLINE_HISTORY_ENTRIES];

View File

@ -105,6 +105,6 @@ typedef struct {
#define TERM_DEFAULT_FLAGS 0x00 /* Default flags for a cell */ #define TERM_DEFAULT_FLAGS 0x00 /* Default flags for a cell */
#define TERM_DEFAULT_OPAC 0xF2 /* For background, default transparency */ #define TERM_DEFAULT_OPAC 0xF2 /* For background, default transparency */
term_state_t * ansi_init(term_state_t * s, int w, int y, term_callbacks_t * callbacks_in); extern term_state_t * ansi_init(term_state_t * s, int w, int y, term_callbacks_t * callbacks_in);
void ansi_put(term_state_t * s, char c); extern void ansi_put(term_state_t * s, char c);

View File

@ -19,19 +19,19 @@ typedef struct {
typedef uint8_t (*tree_comparator_t) (void *, void *); typedef uint8_t (*tree_comparator_t) (void *, void *);
tree_t * tree_create(void); extern tree_t * tree_create(void);
void tree_set_root(tree_t * tree, void * value); extern void tree_set_root(tree_t * tree, void * value);
void tree_node_destroy(tree_node_t * node); extern void tree_node_destroy(tree_node_t * node);
void tree_destroy(tree_t * tree); extern void tree_destroy(tree_t * tree);
void tree_free(tree_t * tree); extern void tree_free(tree_t * tree);
tree_node_t * tree_node_create(void * value); extern tree_node_t * tree_node_create(void * value);
void tree_node_insert_child_node(tree_t * tree, tree_node_t * parent, tree_node_t * node); extern void tree_node_insert_child_node(tree_t * tree, tree_node_t * parent, tree_node_t * node);
tree_node_t * tree_node_insert_child(tree_t * tree, tree_node_t * parent, void * value); extern tree_node_t * tree_node_insert_child(tree_t * tree, tree_node_t * parent, void * value);
tree_node_t * tree_node_find_parent(tree_node_t * haystack, tree_node_t * needle); extern tree_node_t * tree_node_find_parent(tree_node_t * haystack, tree_node_t * needle);
void tree_node_parent_remove(tree_t * tree, tree_node_t * parent, tree_node_t * node); extern void tree_node_parent_remove(tree_t * tree, tree_node_t * parent, tree_node_t * node);
void tree_node_remove(tree_t * tree, tree_node_t * node); extern void tree_node_remove(tree_t * tree, tree_node_t * node);
void tree_remove(tree_t * tree, tree_node_t * node); extern void tree_remove(tree_t * tree, tree_node_t * node);
tree_node_t * tree_find(tree_t * tree, void * value, tree_comparator_t comparator); extern tree_node_t * tree_find(tree_t * tree, void * value, tree_comparator_t comparator);
void tree_break_off(tree_t * tree, tree_node_t * node); extern void tree_break_off(tree_t * tree, tree_node_t * node);