libc.obj: Fix clayer headers for work def.

git-svn-id: svn://kolibrios.org@9552 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2022-01-01 16:33:14 +00:00
parent b090eb116d
commit 1eff55fdee
13 changed files with 165 additions and 157 deletions

View File

@ -3,9 +3,11 @@
#ifndef KOLIBRI_BOXLIB_H #ifndef KOLIBRI_BOXLIB_H
#define KOLIBRI_BOXLIB_H #define KOLIBRI_BOXLIB_H
typedef unsigned color_t; #include "sys/ksys.h"
#include <stdint.h>
#include <stddef.h>
extern int kolibri_boxlib_init(void); typedef unsigned color_t;
/* flags meaning */ /* flags meaning */
#define ed_figure_only 0b1000000000000000 // одни символы #define ed_figure_only 0b1000000000000000 // одни символы
@ -66,10 +68,10 @@ typedef struct {
uint32_t ar_offset; uint32_t ar_offset;
} __attribute__ ((__packed__)) scrollbar; } __attribute__ ((__packed__)) scrollbar;
extern void (*scrollbar_h_draw __attribute__((__stdcall__)))(scrollbar*); extern void __stdcall (*scrollbar_h_draw)(scrollbar*);
extern void (*scrollbar_h_mouse __attribute__((__stdcall__)))(scrollbar*); extern void __stdcall (*scrollbar_h_mouse)(scrollbar*);
extern void (*scrollbar_v_draw __attribute__((__stdcall__)))(scrollbar*); extern void __stdcall (*scrollbar_v_draw)(scrollbar*);
extern void (*scrollbar_v_mouse __attribute__((__stdcall__)))(scrollbar*); extern void __stdcall (*scrollbar_v_mouse)(scrollbar*);
// CHECKBOX // CHECKBOX
typedef struct { typedef struct {
@ -86,9 +88,9 @@ typedef struct {
unsigned int size_of_str; unsigned int size_of_str;
}check_box; }check_box;
extern void (*check_box_draw2 __attribute__((__stdcall__)))(check_box *); extern void __stdcall (*check_box_draw2)(check_box *);
extern void (*check_box_mouse2 __attribute__((__stdcall__)))(check_box *); extern void __stdcall (*check_box_mouse2)(check_box *);
extern void (*init_checkbox2 __attribute__((__stdcall__)))(check_box *); extern void __stdcall (*init_checkbox2)(check_box *);
// DBUTTON // DBUTTON
typedef struct { typedef struct {
@ -108,8 +110,8 @@ typedef struct {
uint32_t click; // clicked - 1, zero it after tested uint32_t click; // clicked - 1, zero it after tested
} pict_button; } pict_button;
extern void (*dynamic_button_draw __attribute__((__stdcall__)))(pict_button *); extern void __stdcall (*dynamic_button_draw)(pict_button *);
extern void (*dynamic_button_mouse __attribute__((__stdcall__)))(pict_button *); extern void __stdcall (*dynamic_button_mouse)(pict_button *);
// EDITBOX // EDITBOX
@ -141,10 +143,20 @@ typedef struct edit_box_t {
}edit_box; }edit_box;
#pragma pack(pop) #pragma pack(pop)
extern void (*edit_box_draw __attribute__((__stdcall__)))(edit_box *); extern void __stdcall (*edit_box_draw)(edit_box *) __asm__("edit_box");
extern void edit_box_key (edit_box *, unsigned int key_val)__attribute__((__stdcall__)); extern void __stdcall (*edit_box_key)(edit_box *, unsigned int key_val);
extern void (*edit_box_mouse __attribute__((__stdcall__)))(edit_box *); extern void __stdcall (*edit_box_mouse)(edit_box *);
extern void (*edit_box_set_text __attribute__((__stdcall__)))(edit_box *, char *); extern void __stdcall (*edit_box_set_text)(edit_box *, char *);
void edit_box_key_safe(edit_box *e, ksys_oskey_t ch) {
int a=3;
asm_inline (
"pushl %2 \n\t"
"call *%1 \n\t"
::"a"(ch.val), "m"(edit_box_key), "m"(e)
:"memory"
);
}
// FRAME // FRAME
typedef struct { typedef struct {
@ -162,7 +174,7 @@ typedef struct {
color_t font_bg_color; color_t font_bg_color;
}frame; }frame;
extern void (*frame_draw)(frame *); extern void __stdcall (*frame_draw)(frame *);
// MENUBAR // MENUBAR
typedef struct typedef struct
@ -203,9 +215,9 @@ typedef struct
uint32_t get_mouse_flag; uint32_t get_mouse_flag;
} menubar; } menubar;
extern void (*menu_bar_draw)(menubar *); extern void __stdcall (*menu_bar_draw)(menubar *);
extern void (*menu_bar_mouse)(menubar *); extern void __stdcall (*menu_bar_mouse)(menubar *);
extern void (*menu_bar_activate)(menubar *); extern void __stdcall (*menu_bar_activate)(menubar *);
// OPTIONBOX // OPTIONBOX
typedef struct option_box_t { typedef struct option_box_t {
@ -222,8 +234,8 @@ typedef struct option_box_t {
uint32_t flags; uint32_t flags;
} __attribute__ ((__packed__)) option_box; } __attribute__ ((__packed__)) option_box;
extern void (*option_box_draw __attribute__((__stdcall__)))(option_box **); extern void __stdcall (*option_box_draw)(option_box **);
extern void (*option_box_mouse __attribute__((__stdcall__)))(option_box **); extern void __stdcall (*option_box_mouse)(option_box **);
// PATHSHOW // PATHSHOW
typedef struct { typedef struct {
@ -240,8 +252,8 @@ typedef struct {
uint32_t temp_text_length; uint32_t temp_text_length;
} __attribute__ ((__packed__)) pathview; } __attribute__ ((__packed__)) pathview;
extern void (*path_show_prepare __attribute__((__stdcall__)))(pathview *); extern void __stdcall (*path_show_prepare)(pathview *);
extern void (*path_show_draw __attribute__((__stdcall__)))(pathview *); extern void __stdcall (*path_show_draw)(pathview *);
// PROGRESSBAR // PROGRESSBAR
typedef struct { typedef struct {
@ -258,8 +270,7 @@ typedef struct {
unsigned int frame_color; unsigned int frame_color;
} progressbar; } progressbar;
extern void (*progressbar_draw __attribute__((__stdcall__)))(progressbar *); extern void __stdcall (*progressbar_draw)(progressbar *);
extern void (*progressbar_progress __attribute__((__stdcall__)))(progressbar *); extern void __stdcall (*progressbar_progress)(progressbar *);
#endif /* KOLIBRI_BOXLIB_H */ #endif /* KOLIBRI_BOXLIB_H */

View File

@ -2,11 +2,8 @@
#define KOLIBRI_BUF2D_H #define KOLIBRI_BUF2D_H
#include <stdint.h> #include <stdint.h>
/*ToDo #include <sys/ksys.h>
* voxel function #include <stddef.h>
*/
extern int kolibri_buf2d_init(void);
typedef struct { typedef struct {
unsigned int *buf_pointer; unsigned int *buf_pointer;
@ -33,12 +30,12 @@ enum BUF2D_OPT_CROP {
BUF2D_OPT_CROP_RIGHT = 8 BUF2D_OPT_CROP_RIGHT = 8
}; };
extern void (*buf2d_create_asm __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_create_asm)(buf2d_struct *);
extern void (*buf2d_curve_bezier_asm __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_curve_bezier_asm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit) buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit)
{ {
buf2d_struct *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(buf2d_struct)); buf2d_struct *new_buf2d_struct = (buf2d_struct *)_ksys_alloc(sizeof(buf2d_struct));
new_buf2d_struct -> left = tlx; new_buf2d_struct -> left = tlx;
new_buf2d_struct -> top = tly; new_buf2d_struct -> top = tly;
new_buf2d_struct -> width = sizex; new_buf2d_struct -> width = sizex;
@ -54,30 +51,31 @@ void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y,
buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color); buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
} }
extern void (*buf2d_draw __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_draw)(buf2d_struct *);
extern void (*buf2d_clear __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); extern void __stdcall (*buf2d_clear)(buf2d_struct *, unsigned int);
extern void (*buf2d_delete __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_delete)(buf2d_struct *);
extern void (*buf2d_rotate __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); extern void __stdcall (*buf2d_rotate)(buf2d_struct *, unsigned int);
extern void (*buf2d_resize __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_resize)(buf2d_struct *, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_line __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_line)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_line_sm __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_line_sm)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_filled_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_filled_rect_by_size)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_circle __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_circle)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_img_hdiv2 __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_img_hdiv2)(buf2d_struct *);
extern void (*buf2d_img_wdiv2 __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_img_wdiv2)(buf2d_struct *);
extern void (*buf2d_conv_24_to_8 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); extern void __stdcall (*buf2d_conv_24_to_8)(buf2d_struct *, unsigned int);
extern void (*buf2d_conv_24_to_32 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); extern void __stdcall (*buf2d_conv_24_to_32)(buf2d_struct *, unsigned int);
extern void (*buf2d_bit_blt_transp __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *); extern void __stdcall (*buf2d_bit_blt_transp)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *);
extern void (*buf2d_bit_blt_alpha __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *); extern void __stdcall (*buf2d_bit_blt_alpha)(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *);
extern void (*buf2d_convert_text_matrix __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_convert_text_matrix)(buf2d_struct *);
extern void (*buf2d_draw_text __attribute__((__stdcall__)))(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int); extern void __stdcall (*buf2d_draw_text)(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int);
extern void (*buf2d_crop_color __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int); extern void __stdcall (*buf2d_crop_color)(buf2d_struct *, unsigned int, unsigned int);
extern void (*buf2d_offset_h __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_offset_h)(buf2d_struct *, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_flood_fill __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_flood_fill)(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
extern void (*buf2d_set_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); extern void __stdcall (*buf2d_set_pixel)(buf2d_struct *, unsigned int, unsigned int, unsigned int);
extern unsigned int (*buf2d_get_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int); extern unsigned __stdcall (*buf2d_get_pixel)(buf2d_struct *, unsigned int, unsigned int);
extern void (*buf2d_flip_h __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_flip_h)(buf2d_struct *);
extern void (*buf2d_flip_v __attribute__((__stdcall__)))(buf2d_struct *); extern void __stdcall (*buf2d_flip_v)(buf2d_struct *);
extern void (*buf2d_filter_dither __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); extern void __stdcall (*buf2d_filter_dither)(buf2d_struct *, unsigned int);
#endif /* KOLIBRI_BUF2D_H */ #endif /* KOLIBRI_BUF2D_H */

View File

@ -2,6 +2,7 @@
#define KOLIBRI_DIALOG_H #define KOLIBRI_DIALOG_H
#include <stdlib.h> #include <stdlib.h>
#define NOT_SUCCESS 0 #define NOT_SUCCESS 0
#define SUCCESS 1 #define SUCCESS 1
@ -115,12 +116,10 @@ color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, un
return new_colordialog; return new_colordialog;
} }
extern void kolibri_dialog_init(); extern void __stdcall (*OpenDialog_init)(open_dialog *);
extern void __stdcall (*OpenDialog_start)(open_dialog *);
extern void (*OpenDialog_init __attribute__((__stdcall__)))(open_dialog *); extern void __stdcall (*ColorDialog_init)(color_dialog *);
extern void (*OpenDialog_start __attribute__((__stdcall__)))(open_dialog *); extern void __stdcall (*ColorDialog_start)(color_dialog *);
extern void (*ColorDialog_init __attribute__((__stdcall__)))(color_dialog *);
extern void (*ColorDialog_start __attribute__((__stdcall__)))(color_dialog *);
#endif #endif

View File

@ -1,3 +1,5 @@
#ifndef KOLIBRI_GB_H
#define KOLIBRI_GB_H
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct typedef struct
@ -17,3 +19,5 @@ void gb_bar(GB_BMP *b, int x, int y, int w, int h, unsigned c);
void gb_circle(GB_BMP *b, int x, int y, int r, unsigned c); void gb_circle(GB_BMP *b, int x, int y, int r, unsigned c);
void gb_image_set(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h); void gb_image_set(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h);
void gb_image_set_t(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h, unsigned c); void gb_image_set_t(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h, unsigned c);
#endif // KOLIBRI_GB_H

View File

@ -5,11 +5,10 @@
Adapted for TCC's dynamic API by Magomed Kostoev, 2020 Adapted for TCC's dynamic API by Magomed Kostoev, 2020
*/ */
#ifndef _HTTP_H_ #ifndef KOLIBRI_HTTP_H
#define _HTTP_H_ #define KOLIBRI_HTTP_H
#define cdecl __attribute__ ((cdecl)) #include <stddef.h>
#define stdcall __attribute__ ((stdcall))
// Bitflags for http_msg.flags // Bitflags for http_msg.flags
// status // status
@ -80,7 +79,7 @@ typedef struct http_msg_s {
Initiates a HTTP connection, using 'GET' method. Initiates a HTTP connection, using 'GET' method.
Returns NULL on error, identifier otherwise. Returns NULL on error, identifier otherwise.
*/ */
extern http_msg * stdcall (*http_get)(const char *url, http_msg *identifier, unsigned flags, const char *add_header); extern http_msg * __stdcall (*http_get)(const char *url, http_msg *identifier, unsigned flags, const char *add_header);
/* /*
url = pointer to ASCIIZ URL url = pointer to ASCIIZ URL
@ -91,7 +90,7 @@ extern http_msg * stdcall (*http_get)(const char *url, http_msg *identifier, uns
Initiate a HTTP connection, using 'HEAD' method. Initiate a HTTP connection, using 'HEAD' method.
Returns NULL on error, identifier otherwise. Returns NULL on error, identifier otherwise.
*/ */
extern http_msg * stdcall (*http_head)(const char *url, http_msg *identifier, unsigned flags, const char *add_header); extern http_msg * __stdcall (*http_head)(const char *url, http_msg *identifier, unsigned flags, const char *add_header);
/* /*
url = pointer to ASCIIZ URL url = pointer to ASCIIZ URL
@ -106,7 +105,7 @@ extern http_msg * stdcall (*http_head)(const char *url, http_msg *identifier, un
using system function 75, 6. using system function 75, 6.
Returns 0 on error, identifier otherwise Returns 0 on error, identifier otherwise
*/ */
extern http_msg * stdcall (*http_post)(const char *url, http_msg *identifier, unsigned flags, const char *add_header, extern http_msg * __stdcall (*http_post)(const char *url, http_msg *identifier, unsigned flags, const char *add_header,
const char *content_type, unsigned content_length); const char *content_type, unsigned content_length);
/* /*
@ -128,7 +127,7 @@ extern http_msg * stdcall (*http_post)(const char *url, http_msg *identifier, un
In content_length you'll find the length of the content. In content_length you'll find the length of the content.
In content_received, you'll find the number of content bytes already received. In content_received, you'll find the number of content bytes already received.
*/ */
extern int stdcall (*http_receive)(http_msg *identifier); extern int __stdcall (*http_receive)(http_msg *identifier);
/* /*
identifier = identifier which one of the previous functions returned identifier = identifier which one of the previous functions returned
@ -137,17 +136,17 @@ extern int stdcall (*http_receive)(http_msg *identifier);
This procedure can be used to send data to the server (POST) This procedure can be used to send data to the server (POST)
Returns number of bytes sent, -1 on error Returns number of bytes sent, -1 on error
*/ */
extern int stdcall (*http_send)(http_msg *identifier, void *dataptr, unsigned datalength); extern int __stdcall (*http_send)(http_msg *identifier, void *dataptr, unsigned datalength);
/* /*
Sometimes the http_receive function receives incomplete data. If you have the same problem then a macro can help you: Sometimes the http_receive function receives incomplete data. If you have the same problem then a macro can help you:
*/ */
extern int stdcall (*http_free)(http_msg *identifier); extern int __stdcall (*http_free)(http_msg *identifier);
/* /*
Free unused data Free unused data
*/ */
#define http_long_receive(x) while(http_receive(x)){}; #define http_long_receive(x) while(http_receive(x)){};
#endif // _HTTP_H_ #endif // KOLIBRI_HTTP_H

View File

@ -5,13 +5,12 @@
Adapted for TCC's dynamic API by Magomed Kostoev, 2020 Adapted for TCC's dynamic API by Magomed Kostoev, 2020
*/ */
#ifndef __KOS__INPUTBOX__H________ #ifndef KOLIBRI_INPUTBOX_H
#define __KOS__INPUTBOX__H________ #define KOLIBRI_INPUTBOX_H
#define cdecl __attribute__ ((cdecl)) #include <stddef.h>
#define stdcall __attribute__ ((stdcall))
extern unsigned stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default, extern unsigned __stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default,
unsigned long Flags, unsigned long BufferSize, void* RedrawProc); unsigned long Flags, unsigned long BufferSize, void* RedrawProc);
#endif // __KOS__INPUTBOX__H________ #endif // KOLIBRI_INPUTBOX_H

View File

@ -6,10 +6,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
extern int kolibri_libimg_init(void);
#define _stdcall __attribute__((__stdcall__))
//list of format id's //list of format id's
#define LIBIMG_FORMAT_BMP 1 #define LIBIMG_FORMAT_BMP 1
#define LIBIMG_FORMAT_ICO 2 #define LIBIMG_FORMAT_ICO 2
@ -99,23 +95,23 @@ typedef struct{
#define ROTATE_90_CCW ROTATE_270_CW #define ROTATE_90_CCW ROTATE_270_CW
#define ROTATE_270_CCW ROTATE_90_CW #define ROTATE_270_CCW ROTATE_90_CW
extern Image* (*img_decode _stdcall)(void* file_data, uint32_t size, uint32_t b_color); extern Image* __stdcall (*img_decode)(void* file_data, uint32_t size, uint32_t b_color);
extern Image* (*img_encode _stdcall)(Image* img, uint32_t length, uint32_t option); extern Image* __stdcall (*img_encode)(Image* img, uint32_t length, uint32_t option);
extern Image* (*img_create _stdcall)(uint32_t width, uint32_t height, uint32_t type); extern Image* __stdcall (*img_create)(uint32_t width, uint32_t height, uint32_t type);
extern void (*img_to_rgb2 _stdcall)(Image* img, void *rgb_data); extern void __stdcall (*img_to_rgb2)(Image* img, void *rgb_data);
extern Image* (*img_to_rgb _stdcall)(Image* img); extern Image* __stdcall (*img_to_rgb)(Image* img);
extern bool (*img_flip _stdcall)(Image* img, uint32_t flip); extern bool __stdcall (*img_flip)(Image* img, uint32_t flip);
extern bool (*img_flip_layer _stdcall)(Image *img, uint32_t flip); extern bool __stdcall (*img_flip_layer)(Image *img, uint32_t flip);
extern bool (*img_rotate _stdcall)(Image *img, uint32_t rotate); extern bool __stdcall (*img_rotate)(Image *img, uint32_t rotate);
extern bool (*img_rotate_layer _stdcall)(Image* data, uint32_t rotate); extern bool __stdcall (*img_rotate_layer)(Image* data, uint32_t rotate);
extern void (*img_draw _stdcall)(Image *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t xoff, uint32_t yoff); extern void __stdcall (*img_draw)(Image *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t xoff, uint32_t yoff);
extern int32_t (*img_count _stdcall)(Image *img); extern int32_t __stdcall (*img_count)(Image *img);
extern bool (*img_destroy _stdcall)(Image *img); extern bool __stdcall (*img_destroy)(Image *img);
extern bool (*img_destroy_layer _stdcall)(Image* img); extern bool __stdcall (*img_destroy_layer)(Image* img);
extern Image* (*img_blend _stdcall)(Image* dst, Image* src, uint32_t out_x, uint32_t out_y, uint32_t in_x, uint32_t in_y, uint32_t width, uint32_t height); extern Image* __stdcall (*img_blend)(Image* dst, Image* src, uint32_t out_x, uint32_t out_y, uint32_t in_x, uint32_t in_y, uint32_t width, uint32_t height);
extern Image* (*img_convert _stdcall)(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t); extern Image* __stdcall (*img_convert)(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t);
extern Image* (*img_resize_data _stdcall)(Image *src, uint32_t width, uint32_t height); extern Image* __stdcall (*img_resize_data)(Image *src, uint32_t width, uint32_t height);
extern Image* (*img_scale _stdcall)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height); extern Image* __stdcall (*img_scale)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height);
void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color){ void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color){
for (uint32_t i = 0; i < width*height; i++) { for (uint32_t i = 0; i < width*height; i++) {

View File

@ -1,11 +1,11 @@
#ifndef KOLIBRI_MSGBOX_H #ifndef KOLIBRI_MSGBOX_H
#define KOLIBRI_MSGBOX_H #define KOLIBRI_MSGBOX_H
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
typedef struct { typedef struct {
uint8_t retval; // 0 - win closed, 1 to n - button num, also default button on start uint8_t retval; // 0 - win closed, 1 to n - button num, also default button on start
uint8_t reserv; uint8_t reserv;
@ -16,9 +16,9 @@ typedef struct {
typedef void (*msgbox_callback)(void); typedef void (*msgbox_callback)(void);
extern void (*msgbox_create __attribute__((__stdcall__)))(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51 extern void __stdcall (*mb_create)(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51
extern void (*msgbox_setfunctions __attribute__((__stdcall__)))(msgbox_callback*); // must be called immediately after create, zero-ended array extern void __stdcall (*mb_setfunctions)(msgbox_callback*); // must be called immediately after create, zero-ended array
extern void (*msgbox_reinit __attribute__((__stdcall__)))(msgbox *) ; // recalc sizes when structure changes, called auto when MsgBoxCreate extern void __stdcall (*mb_reinit)(msgbox *); // recalc sizes when structure changes, called auto when MsgBoxCreate
static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, ...) static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, ...)
/// text can be multilined by code 13 = "\r" /// text can be multilined by code 13 = "\r"
@ -48,8 +48,8 @@ static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, .
static inline void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[]) static inline void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[])
{ {
(*msgbox_create)(box, &box->top_stack); mb_create(box, &box->top_stack);
if (cb) (*msgbox_setfunctions)(cb); if (cb) mb_setfunctions(cb);
} }
#endif #endif

View File

@ -1,11 +1,9 @@
#ifndef __NETWORK_H #ifndef KOLIBRI_NETWORK_H
#define __NETWORK_H #define KOLIBRI_NETWORK_H
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ksys.h> #include <sys/ksys.h>
#define stdcall __attribute__ ((stdcall))
#define EAI_ADDRFAMILY 1 #define EAI_ADDRFAMILY 1
#define EAI_AGAIN 2 #define EAI_AGAIN 2
#define EAI_BADFLAGS 3 #define EAI_BADFLAGS 3
@ -48,10 +46,9 @@ struct addrinfo {
}; };
#pragma pack(pop) #pragma pack(pop)
extern int networklib_init (); extern int __stdcall (*inet_addr)(const char* hostname);
extern int stdcall (*inet_addr)(const char* hostname); extern char* __stdcall (*inet_ntoa)(int ip_addr);
extern char* stdcall (*inet_ntoa)(int ip_addr); extern int __stdcall (*getaddrinfo)(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res);
extern int stdcall (*getaddrinfo)(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res); extern void __stdcall (*freeaddrinfo)(struct addrinfo* ai);
extern void stdcall (*freeaddrinfo)(struct addrinfo* ai);
#endif #endif

View File

@ -1,11 +1,11 @@
#ifndef KOLIBRI_RASTERWORKS_H #ifndef KOLIBRI_RASTERWORKS_H
#define KOLIBRI_RASTERWORKS_H #define KOLIBRI_RASTERWORKS_H
//extern int kolibri_rasterworks_init(void); #include <stddef.h>
extern void (*drawText __attribute__((__stdcall__)))(void *canvas, int x, int y, const char *string, int charQuantity, int fontColor, int params); extern void __stdcall (*drawText)(void *canvas, int x, int y, const char *string, int charQuantity, int fontColor, int params);
extern int (*countUTF8Z __attribute__((__stdcall__)))(const char *string, int byteQuantity); extern int __stdcall (*countUTF8Z)(const char *string, int byteQuantity) __asm__("cntUTF-8");
extern int (*charsFit __attribute__((__stdcall__)))(int areaWidth, int charHeight); extern int __stdcall (*charsFit)(int areaWidth, int charHeight);
extern int (*strWidth __attribute__((__stdcall__)))(int charQuantity, int charHeight); extern int __stdcall (*strWidth)(int charQuantity, int charHeight);
#endif /* KOLIBRI_RASTERWORKS_H */ #endif /* KOLIBRI_RASTERWORKS_H */

View File

@ -11,9 +11,6 @@ Adapted for tcc by Siemargl, 2016
#include <stddef.h> #include <stddef.h>
#define cdecl __attribute__ ((cdecl))
#define stdcall __attribute__ ((stdcall))
/* /*
console.obj exports the following functions console.obj exports the following functions
*/ */
@ -38,25 +35,25 @@ typedef unsigned short word; /* 16-bit unsigned integer */
extern int _FUNC(con_init)(void); extern int _FUNC(con_init)(void);
extern int _FUNC(con_init_opt)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title); extern int _FUNC(con_init_opt)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title);
extern void stdcall _FUNC((*con_exit))(int bCloseWindow); extern void __stdcall _FUNC((*con_exit))(int bCloseWindow);
extern void stdcall _FUNC((*con_set_title))(const char* title); extern void __stdcall _FUNC((*con_set_title))(const char* title);
extern void stdcall _FUNC((*con_write_asciiz))(const char* str); extern void __stdcall _FUNC((*con_write_asciiz))(const char* str);
extern void stdcall _FUNC((*con_write_string))(const char* str, dword length); extern void __stdcall _FUNC((*con_write_string))(const char* str, dword length);
extern int cdecl _FUNC((*con_printf))(const char* format, ...); extern int __cdecl _FUNC((*con_printf))(const char* format, ...);
extern dword stdcall _FUNC((*con_get_flags))(void); extern dword __stdcall _FUNC((*con_get_flags))(void);
extern dword stdcall _FUNC((*con_set_flags))(dword new_flags); extern dword __stdcall _FUNC((*con_set_flags))(dword new_flags);
extern int stdcall _FUNC((*con_get_font_height))(void); extern int __stdcall _FUNC((*con_get_font_height))(void);
extern int stdcall _FUNC((*con_get_cursor_height))(void); extern int __stdcall _FUNC((*con_get_cursor_height))(void);
extern int stdcall _FUNC((*con_set_cursor_height))(int new_height); extern int __stdcall _FUNC((*con_set_cursor_height))(int new_height);
extern int stdcall _FUNC((*con_getch))(void); extern int __stdcall _FUNC((*con_getch))(void);
extern word stdcall _FUNC((*con_getch2))(void); extern word __stdcall _FUNC((*con_getch2))(void);
extern int stdcall _FUNC((*con_kbhit))(void); extern int __stdcall _FUNC((*con_kbhit))(void);
extern char* stdcall _FUNC((*con_gets))(char* str, int n); extern char* __stdcall _FUNC((*con_gets))(char* str, int n);
typedef int (stdcall _FUNC(* con_gets2_callback))(int keycode, char** pstr, int* pn, int* ppos); typedef int __stdcall _FUNC(* con_gets2_callback)(int keycode, char** pstr, int* pn, int* ppos);
extern char* stdcall _FUNC((*con_gets2))(con_gets2_callback callback, char* str, int n); extern char* __stdcall _FUNC((*con_gets2))(con_gets2_callback callback, char* str, int n);
extern void stdcall _FUNC((*con_cls))(); extern void __stdcall _FUNC((*con_cls))();
extern void stdcall _FUNC((*con_get_cursor_pos))(int* px, int* py); extern void __stdcall _FUNC((*con_get_cursor_pos))(int* px, int* py);
extern void stdcall _FUNC((*con_set_cursor_pos))(int x, int y); extern void __stdcall _FUNC((*con_set_cursor_pos))(int x, int y);
extern int _FUNC(__con_is_load); extern int _FUNC(__con_is_load);
#endif #endif

View File

@ -34,4 +34,12 @@ typedef uint64_t uintmax_t;
#define offsetof(type, field) ((size_t)&((type *)0)->field) #define offsetof(type, field) ((size_t)&((type *)0)->field)
#ifndef __stdcall
#define __stdcall __attribute__((stdcall))
#endif
#ifndef __cdecl
#define __cdecl __attribute__((cdecl))
#endif
#endif /* _STDDEF_H_ */ #endif /* _STDDEF_H_ */

View File

@ -219,7 +219,7 @@ enum KSYS_FILE_ENCODING{
}; };
static inline static inline
int _ksys_strcmp(const char * s1, const char * s2 ) int __strcmp(const char * s1, const char * s2 )
{ {
while ((*s1) && (*s1 == *s2)){ ++s1; ++s2; } while ((*s1) && (*s1 == *s2)){ ++s1; ++s2; }
return(*(unsigned char*)s1 - *(unsigned char *)s2); return(*(unsigned char*)s1 - *(unsigned char *)s2);
@ -1163,7 +1163,7 @@ void* _ksys_dlsym(ksys_dll_t *table, const char* fun_name){
if (!(table+i)->func_name){ if (!(table+i)->func_name){
break; break;
}else{ }else{
if (!_ksys_strcmp(fun_name, (table+i)->func_name)){ if (!__strcmp(fun_name, (table+i)->func_name)){
return (table+i)->func_ptr; return (table+i)->func_ptr;
} }
} }