Rollback to previous revision (unforeseen consequences)

git-svn-id: svn://kolibrios.org@9811 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Coldy 2022-05-09 18:19:05 +00:00
parent 75d51a28c0
commit 6753818fc0
22 changed files with 266 additions and 268 deletions

View File

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

View File

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

View File

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

View File

@ -79,7 +79,7 @@ typedef struct http_msg_s {
Initiates a HTTP connection, using 'GET' method.
Returns NULL on error, identifier otherwise.
*/
DLLAPI 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
@ -90,7 +90,7 @@ DLLAPI http_msg * __stdcall http_get(const char *url, http_msg *identifier, unsi
Initiate a HTTP connection, using 'HEAD' method.
Returns NULL on error, identifier otherwise.
*/
DLLAPI 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
@ -105,7 +105,7 @@ DLLAPI http_msg * __stdcall http_head(const char *url, http_msg *identifier, uns
using system function 75, 6.
Returns 0 on error, identifier otherwise
*/
DLLAPI 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);
/*
@ -127,7 +127,7 @@ DLLAPI http_msg * __stdcall http_post(const char *url, http_msg *identifier, uns
In content_length you'll find the length of the content.
In content_received, you'll find the number of content bytes already received.
*/
DLLAPI int __stdcall http_receive(http_msg *identifier);
extern int __stdcall (*http_receive)(http_msg *identifier);
/*
identifier = identifier which one of the previous functions returned
@ -136,13 +136,13 @@ DLLAPI int __stdcall http_receive(http_msg *identifier);
This procedure can be used to send data to the server (POST)
Returns number of bytes sent, -1 on error
*/
DLLAPI 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:
*/
DLLAPI int __stdcall http_free(http_msg *identifier);
extern int __stdcall (*http_free)(http_msg *identifier);
/*
Free unused data
*/

View File

@ -10,7 +10,7 @@
#include <stddef.h>
DLLAPI 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);
#endif // KOLIBRI_INPUTBOX_H

View File

@ -4,10 +4,8 @@
#define KOLIBRI_LIBIMG_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
//list of format id's
#define LIBIMG_FORMAT_BMP 1
#define LIBIMG_FORMAT_ICO 2
@ -97,23 +95,23 @@ typedef struct{
#define ROTATE_90_CCW ROTATE_270_CW
#define ROTATE_270_CCW ROTATE_90_CW
DLLAPI Image* __stdcall img_decode(void* file_data, uint32_t size, uint32_t b_color);
DLLAPI Image* __stdcall img_encode(Image* img, uint32_t length, uint32_t option);
DLLAPI Image* __stdcall img_create(uint32_t width, uint32_t height, uint32_t type);
DLLAPI void __stdcall img_to_rgb2(Image* img, void *rgb_data);
DLLAPI Image* __stdcall img_to_rgb(Image* img);
DLLAPI bool __stdcall img_flip(Image* img, uint32_t flip);
DLLAPI bool __stdcall img_flip_layer(Image *img, uint32_t flip);
DLLAPI bool __stdcall img_rotate(Image *img, uint32_t rotate);
DLLAPI bool __stdcall img_rotate_layer(Image* data, uint32_t rotate);
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);
DLLAPI int32_t __stdcall img_count(Image *img);
DLLAPI bool __stdcall img_destroy(Image *img);
DLLAPI bool __stdcall img_destroy_layer(Image* img);
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);
DLLAPI Image* __stdcall img_convert(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t);
DLLAPI Image* __stdcall img_resize_data(Image *src, uint32_t width, uint32_t 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);
extern 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);
extern Image* __stdcall (*img_create)(uint32_t width, uint32_t height, uint32_t type);
extern void __stdcall (*img_to_rgb2)(Image* img, void *rgb_data);
extern Image* __stdcall (*img_to_rgb)(Image* img);
extern bool __stdcall (*img_flip)(Image* img, uint32_t flip);
extern bool __stdcall (*img_flip_layer)(Image *img, uint32_t flip);
extern bool __stdcall (*img_rotate)(Image *img, uint32_t rotate);
extern 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);
extern int32_t __stdcall (*img_count)(Image *img);
extern bool __stdcall (*img_destroy)(Image *img);
extern 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);
extern 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);
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){
for (uint32_t i = 0; i < width*height; i++) {
@ -121,4 +119,6 @@ void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color)
}
}
int kolibri_libimg_init(void);
#endif /* KOLIBRI_LIBIMG_H */

View File

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

View File

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

View File

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

View File

@ -32,9 +32,9 @@ typedef unsigned short word; /* 16-bit unsigned integer */
#define CON_IGNORE_SPECIALS 0x100
DLLAPI int con_init(void);
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 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 void __stdcall _FUNC((*con_exit))(int bCloseWindow);
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_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_get_cursor_pos))(int* px, int* py);
extern void __stdcall _FUNC((*con_set_cursor_pos))(int x, int y);
extern int __con_is_load;
extern int _FUNC(__con_is_load);
#endif

View File

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

View File

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

View File

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

View File

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

View File

@ -13,17 +13,9 @@ typedef __SIZE_TYPE__ uintptr_t;
#endif
#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 DLLAPI //__attribute__((dllexport)) // Comming soon(tcc not support yet)
#else
#define _FUNC(func) (*func) // FIXME: this needed for legacy reason (see above)
#define DLLAPI __attribute__((dllimport))
#define _FUNC(func) (*func)
#endif
#define offsetof(type, field) ((size_t) & ((type*)0)->field)

View File

@ -35,15 +35,15 @@
#include <stdarg.h>
#include <stddef.h>
DLLAPI int puts(const char* str);
DLLAPI int printf(const char* format, ...);
DLLAPI int sprintf(char* buffer, const char* format, ...);
DLLAPI int snprintf(char* buffer, size_t count, const char* format, ...);
DLLAPI int vsnprintf(char* buffer, size_t count, const char* format, va_list va);
DLLAPI int vsprintf(char* buffer, const char* format, va_list va);
DLLAPI int vprintf(const char* format, va_list va);
extern int _FUNC(puts)(const char* str);
extern int _FUNC(printf)(const char* format, ...);
extern int _FUNC(sprintf)(char* buffer, const char* format, ...);
extern int _FUNC(snprintf)(char* buffer, size_t count, const char* format, ...);
extern int _FUNC(vsnprintf)(char* buffer, size_t count, const char* format, va_list va);
extern int _FUNC(vsprintf)(char* buffer, const char* format, va_list va);
extern int _FUNC(vprintf)(const char* format, va_list va);
DLLAPI void debug_printf(const char* format, ...);
extern void _FUNC(debug_printf)(const char* format, ...);
typedef size_t fpos_t;
@ -85,55 +85,55 @@ typedef struct FILE_s {
#define stdin (FILE*)1
#define stdout (FILE*)2
DLLAPI int fgetc(FILE*);
DLLAPI char* fgets(char* restrict, int, FILE* restrict);
DLLAPI int fprintf(FILE* restrict, const char* restrict, ...);
DLLAPI int fputc(int, FILE*);
DLLAPI int fputs(const char* restrict, FILE* restrict);
DLLAPI size_t fread(void* restrict, size_t size, size_t count, FILE* restrict);
DLLAPI int fscanf(FILE* restrict, const char* restrict, ...);
DLLAPI size_t fwrite(const void* restrict, size_t size, size_t count, FILE* restrict);
DLLAPI int getc(FILE*);
#define getc() fgetc(stdin)
DLLAPI int getchar(void);
DLLAPI int printf(const char* restrict, ...);
#define putc(ch) fputc(ch, stdout)
DLLAPI int puts(const char*);
DLLAPI int scanf(const char* restrict, ...);
DLLAPI char* gets(char* str);
DLLAPI int ungetc(int, FILE*);
DLLAPI int vfprintf(FILE* restrict, const char* restrict, va_list);
DLLAPI int vfscanf(FILE* restrict, const char* restrict, va_list);
DLLAPI int vprintf(const char* restrict, va_list);
DLLAPI int vscanf(const char* restrict, va_list);
DLLAPI int sscanf(const char*, const char* restrict, ...);
DLLAPI int vsscanf(const char*, const char*, va_list);
extern int _FUNC(fgetc)(FILE*);
extern char* _FUNC(fgets)(char* restrict, int, FILE* restrict);
extern int _FUNC(fprintf)(FILE* restrict, const char* restrict, ...);
extern int _FUNC(fputc)(int, FILE*);
extern int _FUNC(fputs)(const char* restrict, FILE* restrict);
extern size_t _FUNC(fread)(void* restrict, size_t size, size_t count, FILE* restrict);
extern int _FUNC(fscanf)(FILE* restrict, const char* restrict, ...);
extern size_t _FUNC(fwrite)(const void* restrict, size_t size, size_t count, FILE* restrict);
extern int _FUNC(getc)(FILE*);
#define getc() _FUNC(fgetc)(stdin)
extern int _FUNC(getchar)(void);
extern int _FUNC(printf)(const char* restrict, ...);
#define putc(ch) _FUNC(fputc)(ch, stdout)
extern int _FUNC(puts)(const char*);
extern int _FUNC(scanf)(const char* restrict, ...);
extern char* _FUNC(gets)(char* str);
extern int _FUNC(ungetc)(int, FILE*);
extern int _FUNC(vfprintf)(FILE* restrict, const char* restrict, va_list);
extern int _FUNC(vfscanf)(FILE* restrict, const char* restrict, va_list);
extern int _FUNC(vprintf)(const char* restrict, va_list);
extern int _FUNC(vscanf)(const char* restrict, va_list);
extern int _FUNC(sscanf)(const char*, const char* restrict, ...);
extern int _FUNC(vsscanf)(const char*, const char*, va_list);
DLLAPI int remove(const char*);
DLLAPI int rename(const char*, const char*);
DLLAPI FILE* tmpfile(void);
DLLAPI char* tmpnam(char*);
extern int _FUNC(remove)(const char*);
extern int _FUNC(rename)(const char*, const char*);
extern FILE* _FUNC(tmpfile)(void);
extern char* _FUNC(tmpnam)(char*);
DLLAPI int fclose(FILE*);
DLLAPI int fflush(FILE*);
DLLAPI FILE* fopen(const char* restrict, const char* restrict);
DLLAPI FILE* freopen(const char* restrict, const char* restrict, FILE* restrict);
DLLAPI void setbuf(FILE* restrict, char* restrict);
DLLAPI int setvbuf(FILE* restrict, char* restrict, int, size_t);
extern int _FUNC(fclose)(FILE*);
extern int _FUNC(fflush)(FILE*);
extern FILE* _FUNC(fopen)(const char* restrict, const char* restrict);
extern FILE* _FUNC(freopen)(const char* restrict, const char* restrict, FILE* restrict);
extern void _FUNC(setbuf)(FILE* restrict, char* restrict);
extern int _FUNC(setvbuf)(FILE* restrict, char* restrict, int, size_t);
DLLAPI int fgetpos(FILE* restrict, fpos_t* restrict);
DLLAPI int fseek(FILE*, long, int);
DLLAPI int fsetpos(FILE*, const fpos_t*);
DLLAPI long ftell(FILE*);
DLLAPI void rewind(FILE*);
extern int _FUNC(fgetpos)(FILE* restrict, fpos_t* restrict);
extern int _FUNC(fseek)(FILE*, long, int);
extern int _FUNC(fsetpos)(FILE*, const fpos_t*);
extern long _FUNC(ftell)(FILE*);
extern void _FUNC(rewind)(FILE*);
DLLAPI void clearerr(FILE*);
DLLAPI int feof(FILE*);
DLLAPI int ferror(FILE*);
DLLAPI void perror(const char*);
extern void _FUNC(clearerr)(FILE*);
extern int _FUNC(feof)(FILE*);
extern int _FUNC(ferror)(FILE*);
extern void _FUNC(perror)(const char*);
DLLAPI size_t fread(void* restrict, size_t, size_t, FILE* restrict);
extern size_t _FUNC(fread)(void* restrict, size_t, size_t, FILE* restrict);
DLLAPI int getchar(void);
extern int _FUNC(getchar)(void);
#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 };
}
DLLAPI void* malloc(size_t size);
DLLAPI void* calloc(size_t num, size_t size);
DLLAPI void* realloc(void* ptr, size_t newsize);
DLLAPI void free(void* ptr);
extern void* _FUNC(malloc)(size_t size);
extern void* _FUNC(calloc)(size_t num, size_t size);
extern void* _FUNC(realloc)(void* ptr, size_t newsize);
extern void _FUNC(free)(void* ptr);
DLLAPI long int strtol(const char* str, char** endptr, int base);
extern long int _FUNC(strtol)(const char* str, char** endptr, int base);
DLLAPI void exit(int status);
extern void _FUNC(exit)(int status);
DLLAPI void srand(unsigned s);
DLLAPI int rand(void);
extern void _FUNC(srand)(unsigned s);
extern int _FUNC(rand)(void);
DLLAPI void __assert_fail(const char* expr, const char* file, int line, const char* func);
DLLAPI void qsort(void* base0, size_t n, size_t size, int (*compar)(const void*, const void*));
extern void _FUNC(__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 double strtod(const char* s, char** sret);
DLLAPI double atof(const char* ascii);
extern double _FUNC(strtod)(const char* s, char** sret);
extern double _FUNC(atof)(const char* ascii);
DLLAPI int atoi(const char* s);
DLLAPI long atol(const char*);
DLLAPI long long atoll(const char*);
DLLAPI void itoa(int n, char* s);
extern int _FUNC(atoi)(const char* s);
extern long _FUNC(atol)(const char*);
extern long long _FUNC(atoll)(const char*);
extern void _FUNC(itoa)(int n, char* s);
DLLAPI int abs(int);
DLLAPI long labs(long);
DLLAPI long long llabs(long long);
extern int _FUNC(abs)(int);
extern long _FUNC(labs)(long);
extern long long _FUNC(llabs)(long long);
#endif

View File

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

View File

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

View File

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

View File

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

View File

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