libc.obj: headers update (now used true functions with attributes instead of pointers)

git-svn-id: svn://kolibrios.org@9810 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Coldy 2022-05-09 17:34:55 +00:00
parent 908aa98953
commit 75d51a28c0
22 changed files with 268 additions and 266 deletions

View File

@ -8,7 +8,6 @@
#include <sys/ksys.h> #include <sys/ksys.h>
typedef unsigned color_t; typedef unsigned color_t;
int kolibri_boxlib_init(void);
/* flags meaning */ /* flags meaning */
#define ed_figure_only 0b1000000000000000 // одни символы #define ed_figure_only 0b1000000000000000 // одни символы
@ -69,10 +68,10 @@ typedef struct {
uint32_t ar_offset; uint32_t ar_offset;
} __attribute__((__packed__)) scrollbar; } __attribute__((__packed__)) scrollbar;
extern void __stdcall (*scrollbar_h_draw)(scrollbar*); DLLAPI void __stdcall scrollbar_h_draw(scrollbar*);
extern void __stdcall (*scrollbar_h_mouse)(scrollbar*); DLLAPI void __stdcall scrollbar_h_mouse(scrollbar*);
extern void __stdcall (*scrollbar_v_draw)(scrollbar*); DLLAPI void __stdcall scrollbar_v_draw(scrollbar*);
extern void __stdcall (*scrollbar_v_mouse)(scrollbar*); DLLAPI void __stdcall scrollbar_v_mouse(scrollbar*);
// CHECKBOX // CHECKBOX
typedef struct { typedef struct {
@ -89,9 +88,9 @@ typedef struct {
unsigned int size_of_str; unsigned int size_of_str;
} check_box; } check_box;
extern void __stdcall (*check_box_draw2)(check_box*); DLLAPI void __stdcall check_box_draw2(check_box*);
extern void __stdcall (*check_box_mouse2)(check_box*); DLLAPI void __stdcall check_box_mouse2(check_box*);
extern void __stdcall (*init_checkbox2)(check_box*); DLLAPI void __stdcall init_checkbox2(check_box*);
// DBUTTON // DBUTTON
typedef struct { typedef struct {
@ -111,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 __stdcall (*dynamic_button_draw)(pict_button*); DLLAPI void __stdcall dynamic_button_draw(pict_button*);
extern void __stdcall (*dynamic_button_mouse)(pict_button*); DLLAPI void __stdcall dynamic_button_mouse(pict_button*);
// EDITBOX // EDITBOX
@ -144,12 +143,12 @@ typedef struct edit_box_t {
} edit_box; } edit_box;
#pragma pack(pop) #pragma pack(pop)
extern void __stdcall (*edit_box_draw)(edit_box*); DLLAPI void __stdcall edit_box_draw(edit_box*);
extern void __stdcall (*edit_box_key)(edit_box*, unsigned int key_val); DLLAPI void __stdcall edit_box_key(edit_box*, unsigned int key_val);
extern void __stdcall (*edit_box_mouse)(edit_box*); DLLAPI void __stdcall edit_box_mouse(edit_box*);
extern void __stdcall (*edit_box_set_text)(edit_box*, char*); DLLAPI void __stdcall edit_box_set_text(edit_box*, char*);
extern void __stdcall (*edit_box_key_safe)(edit_box* e, ksys_oskey_t ch); DLLAPI void __stdcall edit_box_key_safe(edit_box* e, ksys_oskey_t ch);
// FRAME // FRAME
typedef struct { typedef struct {
@ -167,7 +166,7 @@ typedef struct {
color_t font_bg_color; color_t font_bg_color;
} frame; } frame;
extern void __stdcall (*frame_draw)(frame*); DLLAPI void __stdcall frame_draw(frame*);
// MENUBAR // MENUBAR
typedef struct typedef struct
@ -208,9 +207,9 @@ typedef struct
uint32_t get_mouse_flag; uint32_t get_mouse_flag;
} menubar; } menubar;
extern void __stdcall (*menu_bar_draw)(menubar*); DLLAPI void __stdcall menu_bar_draw(menubar*);
extern void __stdcall (*menu_bar_mouse)(menubar*); DLLAPI void __stdcall menu_bar_mouse(menubar*);
extern void __stdcall (*menu_bar_activate)(menubar*); DLLAPI void __stdcall menu_bar_activate(menubar*);
// OPTIONBOX // OPTIONBOX
typedef struct option_box_t { typedef struct option_box_t {
@ -227,8 +226,8 @@ typedef struct option_box_t {
uint32_t flags; uint32_t flags;
} __attribute__((__packed__)) option_box; } __attribute__((__packed__)) option_box;
extern void __stdcall (*option_box_draw)(option_box**); DLLAPI void __stdcall option_box_draw(option_box**);
extern void __stdcall (*option_box_mouse)(option_box**); DLLAPI void __stdcall option_box_mouse(option_box**);
// PATHSHOW // PATHSHOW
typedef struct { typedef struct {
@ -245,8 +244,8 @@ typedef struct {
uint32_t temp_text_length; uint32_t temp_text_length;
} __attribute__((__packed__)) pathview; } __attribute__((__packed__)) pathview;
extern void __stdcall (*path_show_prepare)(pathview*); DLLAPI void __stdcall path_show_prepare(pathview*);
extern void __stdcall (*path_show_draw)(pathview*); DLLAPI void __stdcall path_show_draw(pathview*);
// PROGRESSBAR // PROGRESSBAR
typedef struct { typedef struct {
@ -263,7 +262,7 @@ typedef struct {
unsigned int frame_color; unsigned int frame_color;
} progressbar; } progressbar;
extern void __stdcall (*progressbar_draw)(progressbar*); DLLAPI void __stdcall progressbar_draw(progressbar*);
extern void __stdcall (*progressbar_progress)(progressbar*); DLLAPI void __stdcall progressbar_progress(progressbar*);
#endif /* KOLIBRI_BOXLIB_H */ #endif /* KOLIBRI_BOXLIB_H */

View File

@ -30,10 +30,8 @@ enum BUF2D_OPT_CROP {
BUF2D_OPT_CROP_RIGHT = 8 BUF2D_OPT_CROP_RIGHT = 8
}; };
int kolibri_buf2d_init(void); DLLAPI void __stdcall buf2d_create_asm(buf2d_struct*);
DLLAPI void __stdcall buf2d_curve_bezier_asm(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_create_asm)(buf2d_struct*);
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)
{ {
@ -53,31 +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 __stdcall (*buf2d_draw)(buf2d_struct*); DLLAPI void __stdcall buf2d_draw(buf2d_struct*);
extern void __stdcall (*buf2d_clear)(buf2d_struct*, unsigned int); DLLAPI void __stdcall buf2d_clear(buf2d_struct*, unsigned int);
extern void __stdcall (*buf2d_delete)(buf2d_struct*); DLLAPI void __stdcall buf2d_delete(buf2d_struct*);
extern void __stdcall (*buf2d_rotate)(buf2d_struct*, unsigned int); DLLAPI void __stdcall buf2d_rotate(buf2d_struct*, unsigned int);
extern void __stdcall (*buf2d_resize)(buf2d_struct*, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_resize(buf2d_struct*, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_line)(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_line(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_line_sm)(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_line_sm(buf2d_struct*, 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); DLLAPI void __stdcall buf2d_rect_by_size(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); DLLAPI void __stdcall buf2d_filled_rect_by_size(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_circle)(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_circle(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_img_hdiv2)(buf2d_struct*); DLLAPI void __stdcall buf2d_img_hdiv2(buf2d_struct*);
extern void __stdcall (*buf2d_img_wdiv2)(buf2d_struct*); DLLAPI void __stdcall buf2d_img_wdiv2(buf2d_struct*);
extern void __stdcall (*buf2d_conv_24_to_8)(buf2d_struct*, unsigned int); DLLAPI void __stdcall buf2d_conv_24_to_8(buf2d_struct*, unsigned int);
extern void __stdcall (*buf2d_conv_24_to_32)(buf2d_struct*, unsigned int); DLLAPI void __stdcall buf2d_conv_24_to_32(buf2d_struct*, unsigned int);
extern void __stdcall (*buf2d_bit_blt_transp)(buf2d_struct*, unsigned int, unsigned int, buf2d_struct*); DLLAPI void __stdcall buf2d_bit_blt_transp(buf2d_struct*, unsigned int, unsigned int, buf2d_struct*);
extern void __stdcall (*buf2d_bit_blt_alpha)(buf2d_struct*, unsigned int, unsigned int, buf2d_struct*); DLLAPI void __stdcall buf2d_bit_blt_alpha(buf2d_struct*, unsigned int, unsigned int, buf2d_struct*);
extern void __stdcall (*buf2d_convert_text_matrix)(buf2d_struct*); DLLAPI void __stdcall buf2d_convert_text_matrix(buf2d_struct*);
extern void __stdcall (*buf2d_draw_text)(buf2d_struct*, buf2d_struct*, const char*, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_draw_text(buf2d_struct*, buf2d_struct*, const char*, unsigned int, unsigned int);
extern void __stdcall (*buf2d_crop_color)(buf2d_struct*, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_crop_color(buf2d_struct*, unsigned int, unsigned int);
extern void __stdcall (*buf2d_offset_h)(buf2d_struct*, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_offset_h(buf2d_struct*, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_flood_fill)(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_flood_fill(buf2d_struct*, unsigned int, unsigned int, unsigned int, unsigned int);
extern void __stdcall (*buf2d_set_pixel)(buf2d_struct*, unsigned int, unsigned int, unsigned int); DLLAPI void __stdcall buf2d_set_pixel(buf2d_struct*, unsigned int, unsigned int, unsigned int);
extern unsigned __stdcall (*buf2d_get_pixel)(buf2d_struct*, unsigned int, unsigned int); DLLAPI unsigned __stdcall buf2d_get_pixel(buf2d_struct*, unsigned int, unsigned int);
extern void __stdcall (*buf2d_flip_h)(buf2d_struct*); DLLAPI void __stdcall buf2d_flip_h(buf2d_struct*);
extern void __stdcall (*buf2d_flip_v)(buf2d_struct*); DLLAPI void __stdcall buf2d_flip_v(buf2d_struct*);
extern void __stdcall (*buf2d_filter_dither)(buf2d_struct*, unsigned int); DLLAPI void __stdcall buf2d_filter_dither(buf2d_struct*, unsigned int);
#endif /* KOLIBRI_BUF2D_H */ #endif /* KOLIBRI_BUF2D_H */

View File

@ -115,12 +115,10 @@ color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, un
return new_colordialog; return new_colordialog;
} }
void kolibri_dialog_init(); DLLAPI void __stdcall OpenDialog_init(open_dialog*);
DLLAPI void __stdcall OpenDialog_start(open_dialog*);
extern void __stdcall (*OpenDialog_init)(open_dialog*); DLLAPI void __stdcall ColorDialog_init(color_dialog*);
extern void __stdcall (*OpenDialog_start)(open_dialog*); DLLAPI void __stdcall ColorDialog_start(color_dialog*);
extern void __stdcall (*ColorDialog_init)(color_dialog*);
extern void __stdcall (*ColorDialog_start)(color_dialog*);
#endif #endif

View File

@ -79,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); DLLAPI 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
@ -90,7 +90,7 @@ extern http_msg * __stdcall (*http_get)(const char *url, http_msg *identifier, u
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); DLLAPI 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
@ -105,7 +105,7 @@ extern http_msg * __stdcall (*http_head)(const char *url, http_msg *identifier,
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, DLLAPI 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);
/* /*
@ -127,7 +127,7 @@ extern http_msg * __stdcall (*http_post)(const char *url, http_msg *identifier,
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); DLLAPI 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
@ -136,13 +136,13 @@ 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); DLLAPI 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); DLLAPI int __stdcall http_free(http_msg *identifier);
/* /*
Free unused data Free unused data
*/ */

View File

@ -10,7 +10,7 @@
#include <stddef.h> #include <stddef.h>
extern unsigned __stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default, DLLAPI 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 // KOLIBRI_INPUTBOX_H #endif // KOLIBRI_INPUTBOX_H

View File

@ -4,8 +4,10 @@
#define KOLIBRI_LIBIMG_H #define KOLIBRI_LIBIMG_H
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
//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
@ -95,23 +97,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* __stdcall (*img_decode)(void* file_data, uint32_t size, uint32_t b_color); DLLAPI Image* __stdcall img_decode(void* file_data, uint32_t size, uint32_t b_color);
extern Image* __stdcall (*img_encode)(Image* img, uint32_t length, uint32_t option); DLLAPI Image* __stdcall img_encode(Image* img, uint32_t length, uint32_t option);
extern Image* __stdcall (*img_create)(uint32_t width, uint32_t height, uint32_t type); DLLAPI Image* __stdcall img_create(uint32_t width, uint32_t height, uint32_t type);
extern void __stdcall (*img_to_rgb2)(Image* img, void *rgb_data); DLLAPI void __stdcall img_to_rgb2(Image* img, void *rgb_data);
extern Image* __stdcall (*img_to_rgb)(Image* img); DLLAPI Image* __stdcall img_to_rgb(Image* img);
extern bool __stdcall (*img_flip)(Image* img, uint32_t flip); DLLAPI bool __stdcall img_flip(Image* img, uint32_t flip);
extern bool __stdcall (*img_flip_layer)(Image *img, uint32_t flip); DLLAPI bool __stdcall img_flip_layer(Image *img, uint32_t flip);
extern bool __stdcall (*img_rotate)(Image *img, uint32_t rotate); DLLAPI bool __stdcall img_rotate(Image *img, uint32_t rotate);
extern bool __stdcall (*img_rotate_layer)(Image* data, uint32_t rotate); DLLAPI bool __stdcall img_rotate_layer(Image* data, uint32_t rotate);
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); DLLAPI 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 __stdcall (*img_count)(Image *img); DLLAPI int32_t __stdcall img_count(Image *img);
extern bool __stdcall (*img_destroy)(Image *img); DLLAPI bool __stdcall img_destroy(Image *img);
extern bool __stdcall (*img_destroy_layer)(Image* img); DLLAPI bool __stdcall img_destroy_layer(Image* img);
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); DLLAPI 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* __stdcall (*img_convert)(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t); DLLAPI Image* __stdcall img_convert(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t);
extern Image* __stdcall (*img_resize_data)(Image *src, uint32_t width, uint32_t height); DLLAPI Image* __stdcall img_resize_data(Image *src, uint32_t width, uint32_t 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); DLLAPI 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++) {
@ -119,6 +121,4 @@ void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color)
} }
} }
int kolibri_libimg_init(void);
#endif /* KOLIBRI_LIBIMG_H */ #endif /* KOLIBRI_LIBIMG_H */

View File

@ -3,6 +3,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -16,9 +17,9 @@ typedef struct {
typedef void (*msgbox_callback)(void); typedef void (*msgbox_callback)(void);
extern void __stdcall (*mb_create)(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51 DLLAPI void __stdcall mb_create(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51
extern void __stdcall (*mb_setfunctions)(msgbox_callback*); // must be called immediately after create, zero-ended array DLLAPI void __stdcall mb_setfunctions(msgbox_callback*); // must be called immediately after create, zero-ended array
extern void __stdcall (*mb_reinit)(msgbox *); // recalc sizes when structure changes, called auto when MsgBoxCreate DLLAPI 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"

View File

@ -46,11 +46,9 @@ struct addrinfo {
}; };
#pragma pack(pop) #pragma pack(pop)
int networklib_init(); DLLAPI int __stdcall inet_addr(const char* hostname);
DLLAPI char* __stdcall inet_ntoa(int ip_addr);
extern int __stdcall (*inet_addr)(const char* hostname); DLLAPI int __stdcall getaddrinfo(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res);
extern char* __stdcall (*inet_ntoa)(int ip_addr); DLLAPI void __stdcall freeaddrinfo(struct addrinfo* ai);
extern int __stdcall (*getaddrinfo)(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res);
extern void __stdcall (*freeaddrinfo)(struct addrinfo* ai);
#endif #endif

View File

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

View File

@ -32,9 +32,9 @@ typedef unsigned short word; /* 16-bit unsigned integer */
#define CON_IGNORE_SPECIALS 0x100 #define CON_IGNORE_SPECIALS 0x100
extern int _FUNC(con_init)(void); DLLAPI int con_init(void);
extern int _FUNC(con_init_opt)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title); DLLAPI int 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);
@ -53,6 +53,6 @@ extern char* __stdcall _FUNC((*con_gets2))(con_gets2_callback callback, char* st
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 __con_is_load;
#endif #endif

View File

@ -41,7 +41,7 @@ extern unsigned short* __is;
#define isascii(c) (!((c) & (~0x7f))) #define isascii(c) (!((c) & (~0x7f)))
#define toascii(c) ((c)&0x7f) #define toascii(c) ((c)&0x7f)
extern int _FUNC(tolower)(int c); DLLAPI int tolower(int c);
extern int _FUNC(toupper)(int c); DLLAPI int toupper(int c);
#endif #endif

View File

@ -1,7 +1,9 @@
#ifndef _LIBGEN_H_ #ifndef _LIBGEN_H_
#define _LIBGEN_H_ #define _LIBGEN_H_
extern char* _FUNC(dirname)(char *); #include <stddef.h>
extern char* _FUNC(basename)(char *);
DLLAPI char* dirname(char *);
DLLAPI char* basename(char *);
#endif #endif

View File

@ -6,37 +6,37 @@
#include <stddef.h> #include <stddef.h>
extern double _FUNC(acos)(double _x); DLLAPI double acos(double _x);
extern double _FUNC(asin)(double _x); DLLAPI double asin(double _x);
extern double _FUNC(atan)(double _x); DLLAPI double atan(double _x);
extern double _FUNC(atan2)(double _y, double _x); DLLAPI double atan2(double _y, double _x);
extern double _FUNC(ceil)(double _x); DLLAPI double ceil(double _x);
extern double _FUNC(cos)(double _x); DLLAPI double cos(double _x);
extern double _FUNC(cosh)(double _x); DLLAPI double cosh(double _x);
extern double _FUNC(exp)(double _x); DLLAPI double exp(double _x);
extern double _FUNC(fabs)(double _x); DLLAPI double fabs(double _x);
extern double _FUNC(floor)(double _x); DLLAPI double floor(double _x);
extern double _FUNC(fmod)(double _x, double _y); DLLAPI double fmod(double _x, double _y);
extern double _FUNC(frexp)(double _x, int* _pexp); DLLAPI double frexp(double _x, int* _pexp);
extern double _FUNC(ldexp)(double _x, int _exp); DLLAPI double ldexp(double _x, int _exp);
extern double _FUNC(log)(double _y); DLLAPI double log(double _y);
extern double _FUNC(log2)(double _x); DLLAPI double log2(double _x);
extern double _FUNC(log10)(double _x); DLLAPI double log10(double _x);
extern double _FUNC(modf)(double _x, double* _pint); DLLAPI double modf(double _x, double* _pint);
extern double _FUNC(pow)(double _x, double _y); DLLAPI double pow(double _x, double _y);
extern double _FUNC(round)(double _x); DLLAPI double round(double _x);
extern double _FUNC(sin)(double _x); DLLAPI double sin(double _x);
extern double _FUNC(sinh)(double _x); DLLAPI double sinh(double _x);
extern double _FUNC(sqrt)(double _x); DLLAPI double sqrt(double _x);
extern double _FUNC(tan)(double _x); DLLAPI double tan(double _x);
extern double _FUNC(tanh)(double _x); DLLAPI double tanh(double _x);
extern double _FUNC(acosh)(double); DLLAPI double acosh(double);
extern double _FUNC(asinh)(double); DLLAPI double asinh(double);
extern double _FUNC(atanh)(double); DLLAPI double atanh(double);
extern double _FUNC(hypot)(double, double); DLLAPI double hypot(double, double);
extern long double _FUNC(modfl)(long double _x, long double* _pint); DLLAPI long double modfl(long double _x, long double* _pint);
extern double _FUNC(pow10)(double _x); DLLAPI double pow10(double _x);
extern double _FUNC(pow2)(double _x); DLLAPI double pow2(double _x);
#define M_E 2.7182818284590452354 #define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074 #define M_LOG2E 1.4426950408889634074

View File

@ -11,7 +11,7 @@ typedef struct __jmp_buf_tag {
unsigned long __ss[128 / sizeof(long)]; unsigned long __ss[128 / sizeof(long)];
} jmp_buf[1]; } jmp_buf[1];
extern int _FUNC(setjmp)(jmp_buf env); DLLAPI int setjmp(jmp_buf env);
extern void _FUNC(longjmp)(jmp_buf env, int val); DLLAPI void longjmp(jmp_buf env, int val);
#endif // _SETJMP_H_ #endif // _SETJMP_H_

View File

@ -13,9 +13,17 @@ typedef __SIZE_TYPE__ uintptr_t;
#endif #endif
#ifdef _BUILD_LIBC #ifdef _BUILD_LIBC
/* FIXME: Now _FUNC is used in conio only.
This should be removed after revrite somme apps who use conio
(because these app use pointer dereferencing for conio)
*/
#define _FUNC(func) func #define _FUNC(func) func
#define DLLAPI //__attribute__((dllexport)) // Comming soon(tcc not support yet)
#else #else
#define _FUNC(func) (*func) #define _FUNC(func) (*func) // FIXME: this needed for legacy reason (see above)
#define DLLAPI __attribute__((dllimport))
#endif #endif
#define offsetof(type, field) ((size_t) & ((type*)0)->field) #define offsetof(type, field) ((size_t) & ((type*)0)->field)

View File

@ -35,15 +35,15 @@
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
extern int _FUNC(puts)(const char* str); DLLAPI int puts(const char* str);
extern int _FUNC(printf)(const char* format, ...); DLLAPI int printf(const char* format, ...);
extern int _FUNC(sprintf)(char* buffer, const char* format, ...); DLLAPI int sprintf(char* buffer, const char* format, ...);
extern int _FUNC(snprintf)(char* buffer, size_t count, const char* format, ...); DLLAPI int snprintf(char* buffer, size_t count, const char* format, ...);
extern int _FUNC(vsnprintf)(char* buffer, size_t count, const char* format, va_list va); DLLAPI int vsnprintf(char* buffer, size_t count, const char* format, va_list va);
extern int _FUNC(vsprintf)(char* buffer, const char* format, va_list va); DLLAPI int vsprintf(char* buffer, const char* format, va_list va);
extern int _FUNC(vprintf)(const char* format, va_list va); DLLAPI int vprintf(const char* format, va_list va);
extern void _FUNC(debug_printf)(const char* format, ...); DLLAPI void debug_printf(const char* format, ...);
typedef size_t fpos_t; typedef size_t fpos_t;
@ -85,55 +85,55 @@ typedef struct FILE_s {
#define stdin (FILE*)1 #define stdin (FILE*)1
#define stdout (FILE*)2 #define stdout (FILE*)2
extern int _FUNC(fgetc)(FILE*); DLLAPI int fgetc(FILE*);
extern char* _FUNC(fgets)(char* restrict, int, FILE* restrict); DLLAPI char* fgets(char* restrict, int, FILE* restrict);
extern int _FUNC(fprintf)(FILE* restrict, const char* restrict, ...); DLLAPI int fprintf(FILE* restrict, const char* restrict, ...);
extern int _FUNC(fputc)(int, FILE*); DLLAPI int fputc(int, FILE*);
extern int _FUNC(fputs)(const char* restrict, FILE* restrict); DLLAPI int fputs(const char* restrict, FILE* restrict);
extern size_t _FUNC(fread)(void* restrict, size_t size, size_t count, FILE* restrict); DLLAPI size_t fread(void* restrict, size_t size, size_t count, FILE* restrict);
extern int _FUNC(fscanf)(FILE* restrict, const char* restrict, ...); DLLAPI int fscanf(FILE* restrict, const char* restrict, ...);
extern size_t _FUNC(fwrite)(const void* restrict, size_t size, size_t count, FILE* restrict); DLLAPI size_t fwrite(const void* restrict, size_t size, size_t count, FILE* restrict);
extern int _FUNC(getc)(FILE*); DLLAPI int getc(FILE*);
#define getc() _FUNC(fgetc)(stdin) #define getc() fgetc(stdin)
extern int _FUNC(getchar)(void); DLLAPI int getchar(void);
extern int _FUNC(printf)(const char* restrict, ...); DLLAPI int printf(const char* restrict, ...);
#define putc(ch) _FUNC(fputc)(ch, stdout) #define putc(ch) fputc(ch, stdout)
extern int _FUNC(puts)(const char*); DLLAPI int puts(const char*);
extern int _FUNC(scanf)(const char* restrict, ...); DLLAPI int scanf(const char* restrict, ...);
extern char* _FUNC(gets)(char* str); DLLAPI char* gets(char* str);
extern int _FUNC(ungetc)(int, FILE*); DLLAPI int ungetc(int, FILE*);
extern int _FUNC(vfprintf)(FILE* restrict, const char* restrict, va_list); DLLAPI int vfprintf(FILE* restrict, const char* restrict, va_list);
extern int _FUNC(vfscanf)(FILE* restrict, const char* restrict, va_list); DLLAPI int vfscanf(FILE* restrict, const char* restrict, va_list);
extern int _FUNC(vprintf)(const char* restrict, va_list); DLLAPI int vprintf(const char* restrict, va_list);
extern int _FUNC(vscanf)(const char* restrict, va_list); DLLAPI int vscanf(const char* restrict, va_list);
extern int _FUNC(sscanf)(const char*, const char* restrict, ...); DLLAPI int sscanf(const char*, const char* restrict, ...);
extern int _FUNC(vsscanf)(const char*, const char*, va_list); DLLAPI int vsscanf(const char*, const char*, va_list);
extern int _FUNC(remove)(const char*); DLLAPI int remove(const char*);
extern int _FUNC(rename)(const char*, const char*); DLLAPI int rename(const char*, const char*);
extern FILE* _FUNC(tmpfile)(void); DLLAPI FILE* tmpfile(void);
extern char* _FUNC(tmpnam)(char*); DLLAPI char* tmpnam(char*);
extern int _FUNC(fclose)(FILE*); DLLAPI int fclose(FILE*);
extern int _FUNC(fflush)(FILE*); DLLAPI int fflush(FILE*);
extern FILE* _FUNC(fopen)(const char* restrict, const char* restrict); DLLAPI FILE* fopen(const char* restrict, const char* restrict);
extern FILE* _FUNC(freopen)(const char* restrict, const char* restrict, FILE* restrict); DLLAPI FILE* freopen(const char* restrict, const char* restrict, FILE* restrict);
extern void _FUNC(setbuf)(FILE* restrict, char* restrict); DLLAPI void setbuf(FILE* restrict, char* restrict);
extern int _FUNC(setvbuf)(FILE* restrict, char* restrict, int, size_t); DLLAPI int setvbuf(FILE* restrict, char* restrict, int, size_t);
extern int _FUNC(fgetpos)(FILE* restrict, fpos_t* restrict); DLLAPI int fgetpos(FILE* restrict, fpos_t* restrict);
extern int _FUNC(fseek)(FILE*, long, int); DLLAPI int fseek(FILE*, long, int);
extern int _FUNC(fsetpos)(FILE*, const fpos_t*); DLLAPI int fsetpos(FILE*, const fpos_t*);
extern long _FUNC(ftell)(FILE*); DLLAPI long ftell(FILE*);
extern void _FUNC(rewind)(FILE*); DLLAPI void rewind(FILE*);
extern void _FUNC(clearerr)(FILE*); DLLAPI void clearerr(FILE*);
extern int _FUNC(feof)(FILE*); DLLAPI int feof(FILE*);
extern int _FUNC(ferror)(FILE*); DLLAPI int ferror(FILE*);
extern void _FUNC(perror)(const char*); DLLAPI void perror(const char*);
extern size_t _FUNC(fread)(void* restrict, size_t, size_t, FILE* restrict); DLLAPI size_t fread(void* restrict, size_t, size_t, FILE* restrict);
extern int _FUNC(getchar)(void); DLLAPI int getchar(void);
#endif // _STDIO_H_ #endif // _STDIO_H_

View File

@ -41,31 +41,31 @@ static inline lldiv_t lldiv(long long num, long long den)
return (lldiv_t) { num / den, num % den }; return (lldiv_t) { num / den, num % den };
} }
extern void* _FUNC(malloc)(size_t size); DLLAPI void* malloc(size_t size);
extern void* _FUNC(calloc)(size_t num, size_t size); DLLAPI void* calloc(size_t num, size_t size);
extern void* _FUNC(realloc)(void* ptr, size_t newsize); DLLAPI void* realloc(void* ptr, size_t newsize);
extern void _FUNC(free)(void* ptr); DLLAPI void free(void* ptr);
extern long int _FUNC(strtol)(const char* str, char** endptr, int base); DLLAPI long int strtol(const char* str, char** endptr, int base);
extern void _FUNC(exit)(int status); DLLAPI void exit(int status);
extern void _FUNC(srand)(unsigned s); DLLAPI void srand(unsigned s);
extern int _FUNC(rand)(void); DLLAPI int rand(void);
extern void _FUNC(__assert_fail)(const char* expr, const char* file, int line, const char* func); DLLAPI void __assert_fail(const char* expr, const char* file, int line, const char* func);
extern void _FUNC(qsort)(void* base0, size_t n, size_t size, int (*compar)(const void*, const void*)); DLLAPI void qsort(void* base0, size_t n, size_t size, int (*compar)(const void*, const void*));
extern double _FUNC(strtod)(const char* s, char** sret); DLLAPI double strtod(const char* s, char** sret);
extern double _FUNC(atof)(const char* ascii); DLLAPI double atof(const char* ascii);
extern int _FUNC(atoi)(const char* s); DLLAPI int atoi(const char* s);
extern long _FUNC(atol)(const char*); DLLAPI long atol(const char*);
extern long long _FUNC(atoll)(const char*); DLLAPI long long atoll(const char*);
extern void _FUNC(itoa)(int n, char* s); DLLAPI void itoa(int n, char* s);
extern int _FUNC(abs)(int); DLLAPI int abs(int);
extern long _FUNC(labs)(long); DLLAPI long labs(long);
extern long long _FUNC(llabs)(long long); DLLAPI long long llabs(long long);
#endif #endif

View File

@ -3,38 +3,38 @@
#include <stddef.h> #include <stddef.h>
extern void* _FUNC(memccpy)(void* restrict dest, const void* restrict src, int c, size_t n); DLLAPI void* memccpy(void* restrict dest, const void* restrict src, int c, size_t n);
#ifdef __TINYC__ #ifdef __TINYC__
extern void* memcpy(void* s1, const void* s2, size_t n); extern void* memcpy(void* s1, const void* s2, size_t n);
extern void* memset(void* s, int c, size_t n); extern void* memset(void* s, int c, size_t n);
extern void* memmove(void* s1, const void* s2, size_t n); extern void* memmove(void* s1, const void* s2, size_t n);
#else #else
extern void* _FUNC(memcpy)(void* s1, const void* s2, size_t n); DLLAPI void* memcpy(void* s1, const void* s2, size_t n);
extern void* _FUNC(memset)(void* s, int c, size_t n); DLLAPI void* memset(void* s, int c, size_t n);
extern void* _FUNC(memmove)(void* s1, const void* s2, size_t n); DLLAPI void* memmove(void* s1, const void* s2, size_t n);
#endif #endif
extern char* _FUNC(strcpy)(char* s1, const char* s2); DLLAPI char* strcpy(char* s1, const char* s2);
extern char* _FUNC(strncpy)(char* s1, const char* s2, size_t n); DLLAPI char* strncpy(char* s1, const char* s2, size_t n);
extern char* _FUNC(strcat)(char* s1, const char* s2); DLLAPI char* strcat(char* s1, const char* s2);
extern char* _FUNC(strncat)(char* s1, const char* s2, size_t n); DLLAPI char* strncat(char* s1, const char* s2, size_t n);
extern int _FUNC(memcmp)(const void* s1, const void* s2, size_t n); DLLAPI int memcmp(const void* s1, const void* s2, size_t n);
extern int _FUNC(strcmp)(const char* s1, const char* s2); DLLAPI int strcmp(const char* s1, const char* s2);
extern int _FUNC(strcoll)(const char* s1, const char* s2); DLLAPI int strcoll(const char* s1, const char* s2);
extern int _FUNC(strncmp)(const char* s1, const char* s2, size_t n); DLLAPI int strncmp(const char* s1, const char* s2, size_t n);
extern size_t _FUNC(strxfrm)(char* s1, const char* s2, size_t n); DLLAPI size_t strxfrm(char* s1, const char* s2, size_t n);
extern void* _FUNC(memchr)(const void* s, int c, size_t n); DLLAPI void* memchr(const void* s, int c, size_t n);
extern char* _FUNC(strchr)(const char* s, int c); DLLAPI char* strchr(const char* s, int c);
extern size_t _FUNC(strcspn)(const char* s1, const char* s2); DLLAPI size_t strcspn(const char* s1, const char* s2);
extern char* _FUNC(strpbrk)(const char* s1, const char* s2); DLLAPI char* strpbrk(const char* s1, const char* s2);
extern char* _FUNC(strrchr)(const char* s, int c); DLLAPI char* strrchr(const char* s, int c);
extern size_t _FUNC(strspn)(const char* s1, const char* s2); DLLAPI size_t strspn(const char* s1, const char* s2);
extern char* _FUNC(strstr)(const char* s1, const char* s2); DLLAPI char* strstr(const char* s1, const char* s2);
extern char* _FUNC(strtok)(char* s1, const char* s2); DLLAPI char* strtok(char* s1, const char* s2);
extern char* _FUNC(strerror)(int errnum); DLLAPI char* strerror(int errnum);
extern size_t _FUNC(strlen)(const char* s); DLLAPI size_t strlen(const char* s);
extern char* _FUNC(strrev)(char* str); DLLAPI char* strrev(char* str);
extern char* _FUNC(strdup)(const char* str); DLLAPI char* strdup(const char* str);
#endif #endif

View File

@ -3,9 +3,9 @@
#include <stddef.h> #include <stddef.h>
extern char* _FUNC(getcwd)(char* buf, unsigned size); DLLAPI char* getcwd(char* buf, unsigned size);
extern void _FUNC(setcwd)(const char* cwd); DLLAPI void setcwd(const char* cwd);
extern int _FUNC(rmdir)(const char* dir); DLLAPI int rmdir(const char* dir);
extern int _FUNC(mkdir)(const char* dir); DLLAPI int mkdir(const char* dir);
#endif #endif

View File

@ -23,11 +23,11 @@ typedef struct {
ino_t num_objs; ino_t num_objs;
} DIR; } DIR;
extern int _FUNC(closedir)(DIR* dir); DLLAPI int closedir(DIR* dir);
extern DIR* _FUNC(opendir)(const char* path); DLLAPI DIR* opendir(const char* path);
extern struct dirent* _FUNC(readdir)(DIR*); DLLAPI struct dirent* readdir(DIR*);
extern void _FUNC(rewinddir)(DIR* dir); DLLAPI void rewinddir(DIR* dir);
extern void _FUNC(seekdir)(DIR* dir, unsigned pos); DLLAPI void seekdir(DIR* dir, unsigned pos);
extern unsigned _FUNC(telldir)(DIR* dir); DLLAPI unsigned telldir(DIR* dir);
#endif // _DIRENT_H_ #endif // _DIRENT_H_

View File

@ -76,16 +76,16 @@ typedef struct {
} optstruct; } optstruct;
#pragma pack(pop) #pragma pack(pop)
extern int _FUNC(socket)(int domain, int type, int protocol); DLLAPI int socket(int domain, int type, int protocol);
extern int _FUNC(close)(int socket); DLLAPI int close(int socket);
extern int _FUNC(bind)(int socket, const struct sockaddr* addres, int addres_len); DLLAPI int bind(int socket, const struct sockaddr* addres, int addres_len);
extern int _FUNC(listen)(int socket, int backlog); DLLAPI int listen(int socket, int backlog);
extern int _FUNC(connect)(int socket, const struct sockaddr* address, int socket_len); DLLAPI int connect(int socket, const struct sockaddr* address, int socket_len);
extern int _FUNC(accept)(int socket, const struct sockaddr* address, int address_len); DLLAPI int accept(int socket, const struct sockaddr* address, int address_len);
extern int _FUNC(send)(int socket, const void* message, size_t msg_len, int flag); DLLAPI int send(int socket, const void* message, size_t msg_len, int flag);
extern int _FUNC(recv)(int socket, void* buffer, size_t buff_len, int flag); DLLAPI int recv(int socket, void* buffer, size_t buff_len, int flag);
extern int _FUNC(setsockopt)(int socket, const optstruct* opt); DLLAPI int setsockopt(int socket, const optstruct* opt);
extern int _FUNC(getsockopt)(int socket, optstruct* opt); DLLAPI int getsockopt(int socket, optstruct* opt);
extern int _FUNC(socketpair)(int* socket1, int* socket2); DLLAPI int socketpair(int* socket1, int* socket2);
#endif //_SOCKET_H_ #endif //_SOCKET_H_

View File

@ -22,10 +22,10 @@ struct tm {
}; };
#pragma pack(pop) #pragma pack(pop)
extern time_t _FUNC(mktime)(struct tm* timeptr); DLLAPI time_t mktime(struct tm* timeptr);
extern time_t _FUNC(time)(time_t* timer); DLLAPI time_t time(time_t* timer);
extern struct tm* _FUNC(localtime)(const time_t* timer); DLLAPI struct tm* localtime(const time_t* timer);
extern double _FUNC(difftime)(time_t end, time_t beginning); DLLAPI double difftime(time_t end, time_t beginning);
extern char* _FUNC(asctime)(const struct tm* tm); DLLAPI char* asctime(const struct tm* tm);
#endif #endif