From 1ed1f3a5b147b088d2375796ca5bda0d67f52f65 Mon Sep 17 00:00:00 2001 From: Coldy Date: Tue, 10 May 2022 18:58:40 +0000 Subject: [PATCH] libc.obj: - headers update (now used true functions with attributes instead of pointers) - fixed some samples kos_mbedtls: microtar: changes for compatible to latest version tcc and the libc.obj headers git-svn-id: svn://kolibrios.org@9812 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../trunk/libc.obj/include/clayer/boxlib.h | 49 ++++----- .../trunk/libc.obj/include/clayer/buf2d.h | 58 +++++----- .../trunk/libc.obj/include/clayer/dialog.h | 10 +- .../ktcc/trunk/libc.obj/include/clayer/http.h | 12 +- .../trunk/libc.obj/include/clayer/inputbox.h | 2 +- .../trunk/libc.obj/include/clayer/libimg.h | 38 +++---- .../trunk/libc.obj/include/clayer/msgbox.h | 7 +- .../trunk/libc.obj/include/clayer/network.h | 10 +- .../libc.obj/include/clayer/rasterworks.h | 10 +- .../ktcc/trunk/libc.obj/include/conio.h | 8 +- .../ktcc/trunk/libc.obj/include/ctype.h | 4 +- .../ktcc/trunk/libc.obj/include/libgen.h | 6 +- .../ktcc/trunk/libc.obj/include/math.h | 62 +++++------ .../ktcc/trunk/libc.obj/include/setjmp.h | 4 +- .../ktcc/trunk/libc.obj/include/stddef.h | 12 +- .../ktcc/trunk/libc.obj/include/stdio.h | 104 +++++++++--------- .../ktcc/trunk/libc.obj/include/stdlib.h | 38 +++---- .../ktcc/trunk/libc.obj/include/string.h | 50 ++++----- .../ktcc/trunk/libc.obj/include/sys/dir.h | 8 +- .../ktcc/trunk/libc.obj/include/sys/dirent.h | 12 +- .../ktcc/trunk/libc.obj/include/sys/socket.h | 22 ++-- .../ktcc/trunk/libc.obj/include/time.h | 10 +- .../ktcc/trunk/libc.obj/samples/basic_gui.c | 1 - .../ktcc/trunk/libc.obj/samples/consoleio.c | 2 +- .../libc.obj/samples/fasm/sprintf_test.asm | 2 +- .../kos_mbedtls/library/mbedtls_init.asm | 43 ++++---- .../develop/libraries/microtar/microtar.c | 96 ++++++++-------- 27 files changed, 341 insertions(+), 339 deletions(-) diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h index 545c9cd370..ade4647b58 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h @@ -8,7 +8,6 @@ #include typedef unsigned color_t; -int kolibri_boxlib_init(void); /* flags meaning */ #define ed_figure_only 0b1000000000000000 // одни символы @@ -69,10 +68,10 @@ typedef struct { uint32_t ar_offset; } __attribute__((__packed__)) 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*); +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*); // CHECKBOX typedef struct { @@ -89,9 +88,9 @@ typedef struct { unsigned int size_of_str; } 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*); +DLLAPI void __stdcall check_box_draw2(check_box*); +DLLAPI void __stdcall check_box_mouse2(check_box*); +DLLAPI void __stdcall init_checkbox2(check_box*); // DBUTTON typedef struct { @@ -111,8 +110,8 @@ typedef struct { uint32_t click; // clicked - 1, zero it after tested } pict_button; -extern void __stdcall (*dynamic_button_draw)(pict_button*); -extern void __stdcall (*dynamic_button_mouse)(pict_button*); +DLLAPI void __stdcall dynamic_button_draw(pict_button*); +DLLAPI void __stdcall dynamic_button_mouse(pict_button*); // EDITBOX @@ -144,12 +143,12 @@ typedef struct edit_box_t { } edit_box; #pragma pack(pop) -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_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_key_safe)(edit_box* e, ksys_oskey_t ch); +DLLAPI void __stdcall edit_box_key_safe(edit_box* e, ksys_oskey_t ch); // FRAME typedef struct { @@ -167,7 +166,7 @@ typedef struct { color_t font_bg_color; } frame; -extern void __stdcall (*frame_draw)(frame*); +DLLAPI void __stdcall frame_draw(frame*); // MENUBAR typedef struct @@ -208,9 +207,9 @@ typedef struct uint32_t get_mouse_flag; } menubar; -extern void __stdcall (*menu_bar_draw)(menubar*); -extern void __stdcall (*menu_bar_mouse)(menubar*); -extern void __stdcall (*menu_bar_activate)(menubar*); +DLLAPI void __stdcall menu_bar_draw(menubar*); +DLLAPI void __stdcall menu_bar_mouse(menubar*); +DLLAPI void __stdcall menu_bar_activate(menubar*); // OPTIONBOX typedef struct option_box_t { @@ -227,8 +226,8 @@ typedef struct option_box_t { uint32_t flags; } __attribute__((__packed__)) option_box; -extern void __stdcall (*option_box_draw)(option_box**); -extern void __stdcall (*option_box_mouse)(option_box**); +DLLAPI void __stdcall option_box_draw(option_box**); +DLLAPI void __stdcall option_box_mouse(option_box**); // PATHSHOW typedef struct { @@ -245,8 +244,8 @@ typedef struct { uint32_t temp_text_length; } __attribute__((__packed__)) pathview; -extern void __stdcall (*path_show_prepare)(pathview*); -extern void __stdcall (*path_show_draw)(pathview*); +DLLAPI void __stdcall path_show_prepare(pathview*); +DLLAPI void __stdcall path_show_draw(pathview*); // PROGRESSBAR typedef struct { @@ -263,7 +262,7 @@ typedef struct { unsigned int frame_color; } progressbar; -extern void __stdcall (*progressbar_draw)(progressbar*); -extern void __stdcall (*progressbar_progress)(progressbar*); +DLLAPI void __stdcall progressbar_draw(progressbar*); +DLLAPI void __stdcall progressbar_progress(progressbar*); #endif /* KOLIBRI_BOXLIB_H */ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h index 330de798b6..ee84f51b31 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h @@ -30,10 +30,8 @@ enum BUF2D_OPT_CROP { BUF2D_OPT_CROP_RIGHT = 8 }; -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); +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); 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); } -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); +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); #endif /* KOLIBRI_BUF2D_H */ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h index fa768c6883..4204c99324 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h @@ -115,12 +115,10 @@ color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, un 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*); -extern void __stdcall (*OpenDialog_start)(open_dialog*); - -extern void __stdcall (*ColorDialog_init)(color_dialog*); -extern void __stdcall (*ColorDialog_start)(color_dialog*); +DLLAPI void __stdcall ColorDialog_init(color_dialog*); +DLLAPI void __stdcall ColorDialog_start(color_dialog*); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h index 78b0001c43..a3474f1b52 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h @@ -79,7 +79,7 @@ typedef struct http_msg_s { Initiates a HTTP connection, using 'GET' method. 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 @@ -90,7 +90,7 @@ extern http_msg * __stdcall (*http_get)(const char *url, http_msg *identifier, u Initiate a HTTP connection, using 'HEAD' method. 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 @@ -105,7 +105,7 @@ extern http_msg * __stdcall (*http_head)(const char *url, http_msg *identifier, using system function 75, 6. 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); /* @@ -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_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 @@ -136,13 +136,13 @@ extern 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 */ -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: */ -extern int __stdcall (*http_free)(http_msg *identifier); +DLLAPI int __stdcall http_free(http_msg *identifier); /* Free unused data */ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h index 3144341a2d..5ad6b94619 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h @@ -10,7 +10,7 @@ #include -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); #endif // KOLIBRI_INPUTBOX_H diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h index 657d7beac9..f8a8c4de6a 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h @@ -4,8 +4,10 @@ #define KOLIBRI_LIBIMG_H #include +#include #include + //list of format id's #define LIBIMG_FORMAT_BMP 1 #define LIBIMG_FORMAT_ICO 2 @@ -95,23 +97,23 @@ typedef struct{ #define ROTATE_90_CCW ROTATE_270_CW #define ROTATE_270_CCW ROTATE_90_CW -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); +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); void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color){ 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 */ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h index c08d9be086..9833f968a1 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -16,9 +17,9 @@ typedef struct { 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 -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 +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 static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, ...) /// text can be multilined by code 13 = "\r" diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h index a5d57a0ad5..4d6daf1199 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h @@ -46,11 +46,9 @@ struct addrinfo { }; #pragma pack(pop) -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); +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); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h index af7dae5a4f..74e2b18a73 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h @@ -3,11 +3,9 @@ #include -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); +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); #endif /* KOLIBRI_RASTERWORKS_H */ \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/libc.obj/include/conio.h b/programs/develop/ktcc/trunk/libc.obj/include/conio.h index 73fa14b179..b5ad35ed3f 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/conio.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/conio.h @@ -32,9 +32,9 @@ typedef unsigned short word; /* 16-bit unsigned integer */ #define CON_IGNORE_SPECIALS 0x100 -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); +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 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 _FUNC(__con_is_load); +extern int __con_is_load; #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/ctype.h b/programs/develop/ktcc/trunk/libc.obj/include/ctype.h index 05b7f9a2fd..88f5fd4de3 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/ctype.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/ctype.h @@ -41,7 +41,7 @@ extern unsigned short* __is; #define isascii(c) (!((c) & (~0x7f))) #define toascii(c) ((c)&0x7f) -extern int _FUNC(tolower)(int c); -extern int _FUNC(toupper)(int c); +DLLAPI int tolower(int c); +DLLAPI int toupper(int c); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/libgen.h b/programs/develop/ktcc/trunk/libc.obj/include/libgen.h index 8fbee0d939..d6205cc2c6 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/libgen.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/libgen.h @@ -1,7 +1,9 @@ #ifndef _LIBGEN_H_ #define _LIBGEN_H_ -extern char* _FUNC(dirname)(char *); -extern char* _FUNC(basename)(char *); +#include + +DLLAPI char* dirname(char *); +DLLAPI char* basename(char *); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/math.h b/programs/develop/ktcc/trunk/libc.obj/include/math.h index 70312c58cd..38cb319dac 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/math.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/math.h @@ -6,37 +6,37 @@ #include -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); +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); #define M_E 2.7182818284590452354 #define M_LOG2E 1.4426950408889634074 diff --git a/programs/develop/ktcc/trunk/libc.obj/include/setjmp.h b/programs/develop/ktcc/trunk/libc.obj/include/setjmp.h index ed194407aa..5b512440fe 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/setjmp.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/setjmp.h @@ -11,7 +11,7 @@ typedef struct __jmp_buf_tag { unsigned long __ss[128 / sizeof(long)]; } jmp_buf[1]; -extern int _FUNC(setjmp)(jmp_buf env); -extern void _FUNC(longjmp)(jmp_buf env, int val); +DLLAPI int setjmp(jmp_buf env); +DLLAPI void longjmp(jmp_buf env, int val); #endif // _SETJMP_H_ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/stddef.h b/programs/develop/ktcc/trunk/libc.obj/include/stddef.h index 5e75c3c181..fa79eb5097 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/stddef.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/stddef.h @@ -13,9 +13,17 @@ typedef __SIZE_TYPE__ uintptr_t; #endif #ifdef _BUILD_LIBC -#define _FUNC(func) func + +/* 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) +#define _FUNC(func) (*func) // FIXME: this needed for legacy reason (see above) +#define DLLAPI __attribute__((dllimport)) #endif #define offsetof(type, field) ((size_t) & ((type*)0)->field) diff --git a/programs/develop/ktcc/trunk/libc.obj/include/stdio.h b/programs/develop/ktcc/trunk/libc.obj/include/stdio.h index 0946351c36..a8316e6820 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/stdio.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/stdio.h @@ -35,15 +35,15 @@ #include #include -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 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 void _FUNC(debug_printf)(const char* format, ...); +DLLAPI void 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 -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 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(remove)(const char*); -extern int _FUNC(rename)(const char*, const char*); -extern FILE* _FUNC(tmpfile)(void); -extern char* _FUNC(tmpnam)(char*); +DLLAPI int remove(const char*); +DLLAPI int rename(const char*, const char*); +DLLAPI FILE* tmpfile(void); +DLLAPI char* tmpnam(char*); -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 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(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 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 void _FUNC(clearerr)(FILE*); -extern int _FUNC(feof)(FILE*); -extern int _FUNC(ferror)(FILE*); -extern void _FUNC(perror)(const char*); +DLLAPI void clearerr(FILE*); +DLLAPI int feof(FILE*); +DLLAPI int ferror(FILE*); +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_ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/stdlib.h b/programs/develop/ktcc/trunk/libc.obj/include/stdlib.h index d124da013e..bd868f070f 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/stdlib.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/stdlib.h @@ -41,31 +41,31 @@ static inline lldiv_t lldiv(long long num, long long den) return (lldiv_t) { num / den, num % den }; } -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 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 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); -extern int _FUNC(rand)(void); +DLLAPI void srand(unsigned s); +DLLAPI int rand(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 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 double _FUNC(strtod)(const char* s, char** sret); -extern double _FUNC(atof)(const char* ascii); +DLLAPI double strtod(const char* s, char** sret); +DLLAPI double atof(const char* ascii); -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 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(abs)(int); -extern long _FUNC(labs)(long); -extern long long _FUNC(llabs)(long long); +DLLAPI int abs(int); +DLLAPI long labs(long); +DLLAPI long long llabs(long long); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/string.h b/programs/develop/ktcc/trunk/libc.obj/include/string.h index cda6085e42..5f36de1237 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/string.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/string.h @@ -3,38 +3,38 @@ #include -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__ 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 -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); +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); #endif -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); +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); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/sys/dir.h b/programs/develop/ktcc/trunk/libc.obj/include/sys/dir.h index 97d2b03f87..4c55da6641 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/sys/dir.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/sys/dir.h @@ -3,9 +3,9 @@ #include -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); +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); #endif \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/libc.obj/include/sys/dirent.h b/programs/develop/ktcc/trunk/libc.obj/include/sys/dirent.h index cecd558fe0..f057f1d832 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/sys/dirent.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/sys/dirent.h @@ -23,11 +23,11 @@ typedef struct { ino_t num_objs; } 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); +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); #endif // _DIRENT_H_ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/sys/socket.h b/programs/develop/ktcc/trunk/libc.obj/include/sys/socket.h index fc377468a6..b01b863c05 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/sys/socket.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/sys/socket.h @@ -76,16 +76,16 @@ typedef struct { } optstruct; #pragma pack(pop) -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); +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); #endif //_SOCKET_H_ \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/libc.obj/include/time.h b/programs/develop/ktcc/trunk/libc.obj/include/time.h index 70bfe70000..9bb0c8341b 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/time.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/time.h @@ -22,10 +22,10 @@ struct tm { }; #pragma pack(pop) -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); +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); #endif \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/basic_gui.c b/programs/develop/ktcc/trunk/libc.obj/samples/basic_gui.c index 9f2af0ce47..c96f6b86f8 100644 --- a/programs/develop/ktcc/trunk/libc.obj/samples/basic_gui.c +++ b/programs/develop/ktcc/trunk/libc.obj/samples/basic_gui.c @@ -29,7 +29,6 @@ void draw_window() // define&draw window _ksys_create_window(10, 40, 600, 400, "My window", sys_color_table.work_area, 0x13); _ksys_thread_info(&proc_info, -1); - F win_width = proc_info.winx_size; diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/consoleio.c b/programs/develop/ktcc/trunk/libc.obj/samples/consoleio.c index 5e7820ec63..9be077b67e 100644 --- a/programs/develop/ktcc/trunk/libc.obj/samples/consoleio.c +++ b/programs/develop/ktcc/trunk/libc.obj/samples/consoleio.c @@ -7,7 +7,7 @@ int main() { if (con_init()) return 1; // init fail - (*con_set_tsitle)("Console colors"); + (*con_set_title)("Console colors"); // con_write_asciiz("\033[0;31;42m test \n"); // red on green bk diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/fasm/sprintf_test.asm b/programs/develop/ktcc/trunk/libc.obj/samples/fasm/sprintf_test.asm index e52d969de7..5b2259250b 100644 --- a/programs/develop/ktcc/trunk/libc.obj/samples/fasm/sprintf_test.asm +++ b/programs/develop/ktcc/trunk/libc.obj/samples/fasm/sprintf_test.asm @@ -30,7 +30,7 @@ include '../../../../../../macros.inc' include '../../../../../../proc32.inc' include '../../../../../../KOSfuncs.inc' -; no needed for autolod +; no needed for autoload ;include '../../../../../dll.inc' ;include '../../../../../debug-fdo.inc' diff --git a/programs/develop/libraries/kos_mbedtls/library/mbedtls_init.asm b/programs/develop/libraries/kos_mbedtls/library/mbedtls_init.asm index 7167f0ef04..9e8ad79bcf 100644 --- a/programs/develop/libraries/kos_mbedtls/library/mbedtls_init.asm +++ b/programs/develop/libraries/kos_mbedtls/library/mbedtls_init.asm @@ -70,28 +70,29 @@ import networklib, \ inet_ntoa, 'inet_ntoa', \ getaddrinfo, 'getaddrinfo', \ freeaddrinfo, 'freeaddrinfo' - + +; Most aliases below was changed for compatible to latest version tcc and the libc.obj headers public inet_addr public inet_ntoa -public getaddrinfo -public freeaddrinfo +public getaddrinfo as '__imp_getaddrinfo@16' +public freeaddrinfo as '__imp_freeaddrinfo@4' -public rand -public memcmp -public printf -public calloc -public free -public strlen -public _strcmp as 'strcmp' -public strstr +public rand as '__imp_rand' +public memcmp as '__imp_memcmp' +public printf as '__imp_printf' +public calloc as '__imp_calloc' +public free as '__imp_free' +public strlen as '__imp_strlen' +public _strcmp as '__imp_strcmp' +public strstr as '__imp_strstr' public gmtime -public vsnprintf -public socket -public connect -public close -public recv -public send -public time -public strncmp -public strncpy -public snprintf +public vsnprintf as '__imp_vsnprintf' +public socket as '__imp_socket' +public connect as '__imp_connect' +public close as '__imp_close' +public recv as '__imp_recv' +public send as '__imp_send' +public time as '__imp_time' +public strncmp as '__imp_strncmp' +public strncpy as '__imp_strncpy' +public snprintf as '__imp_snprintf' diff --git a/programs/develop/libraries/microtar/microtar.c b/programs/develop/libraries/microtar/microtar.c index 6cdd38c2eb..edc30f407c 100644 --- a/programs/develop/libraries/microtar/microtar.c +++ b/programs/develop/libraries/microtar/microtar.c @@ -51,18 +51,18 @@ static void * mtar_memset( void * s, int c, size_t n ){ } #ifdef MTAR_OBJ - -size_t (*fread)(void *restrict, size_t size, size_t count, FILE *restrict)=NULL; -size_t (*fwrite)(const void *restrict, size_t size, size_t count, FILE *restrict)=NULL; -int (*fclose)(FILE *)=NULL; -FILE* (*fopen)(const char *restrict, const char *restrict)=NULL; -int (*fseek)(FILE *, long, int)=NULL; -long (*ftell)(FILE *)=NULL; -int (*sprintf)(char* buffer, const char* format, ...)=NULL; -int (*sscanf)(const char*, const char *restrict, ...)=NULL; -int (*strcmp)(const char * s1, const char* s2)=NULL; -char* (*strchr)(const char* s, int c)=NULL; -char* (*strcpy)(char* s1, const char* s2)=NULL; +// All pointers was changed for compatible to latest version tcc and the libc.obj headers +size_t (*_fread)(void *restrict, size_t size, size_t count, FILE *restrict)=NULL; +size_t (*_fwrite)(const void *restrict, size_t size, size_t count, FILE *restrict)=NULL; +int (*_fclose)(FILE *)=NULL; +FILE* (*_fopen)(const char *restrict, const char *restrict)=NULL; +int (*_fseek)(FILE *, long, int)=NULL; +long (*_ftell)(FILE *)=NULL; +int (*_sprintf)(char* buffer, const char* format, ...)=NULL; +int (*_sscanf)(const char*, const char *restrict, ...)=NULL; +int (*_strcmp)(const char * s1, const char* s2)=NULL; +char* (*_strchr)(const char* s, int c)=NULL; +char* (*_strcpy)(char* s1, const char* s2)=NULL; #endif @@ -123,19 +123,19 @@ static int raw_to_header(mtar_header_t *h, const mtar_raw_header_t *rh) { /* Build and compare checksum */ chksum1 = checksum(rh); - sscanf(rh->checksum, "%o", &chksum2); + _sscanf(rh->checksum, "%o", &chksum2); if (chksum1 != chksum2) { return MTAR_EBADCHKSUM; } /* Load raw header into header */ - sscanf(rh->mode, "%o", &h->mode); - sscanf(rh->owner, "%o", &h->owner); - sscanf(rh->size, "%o", &h->size); - sscanf(rh->mtime, "%o", &h->mtime); + _sscanf(rh->mode, "%o", &h->mode); + _sscanf(rh->owner, "%o", &h->owner); + _sscanf(rh->size, "%o", &h->size); + _sscanf(rh->mtime, "%o", &h->mtime); h->type = rh->type; - strcpy(h->name, rh->name); - strcpy(h->linkname, rh->linkname); + _strcpy(h->name, rh->name); + _strcpy(h->linkname, rh->linkname); return MTAR_ESUCCESS; } @@ -146,17 +146,17 @@ static int header_to_raw(mtar_raw_header_t *rh, const mtar_header_t *h) { /* Load header into raw header */ mtar_memset(rh, 0, sizeof(*rh)); - sprintf(rh->mode, "%o", h->mode); - sprintf(rh->owner, "%o", h->owner); - sprintf(rh->size, "%o", h->size); - sprintf(rh->mtime, "%o", h->mtime); + _sprintf(rh->mode, "%o", h->mode); + _sprintf(rh->owner, "%o", h->owner); + _sprintf(rh->size, "%o", h->size); + _sprintf(rh->mtime, "%o", h->mtime); rh->type = h->type ? h->type : MTAR_TREG; - strcpy(rh->name, h->name); - strcpy(rh->linkname, h->linkname); + _strcpy(rh->name, h->name); + _strcpy(rh->linkname, h->linkname); /* Calculate and write checksum */ chksum = checksum(rh); - sprintf(rh->checksum, "%06o", chksum); + _sprintf(rh->checksum, "%06o", chksum); rh->checksum[7] = ' '; return MTAR_ESUCCESS; @@ -180,22 +180,22 @@ const char* mtar_strerror(int err) { static int file_write(mtar_t *tar, const void *data, unsigned size) { - unsigned res = fwrite(data, 1, size, tar->stream); + unsigned res = _fwrite(data, 1, size, tar->stream); return (res == size) ? MTAR_ESUCCESS : MTAR_EWRITEFAIL; } static int file_read(mtar_t *tar, void *data, unsigned size) { - unsigned res = fread(data, 1, size, tar->stream); + unsigned res = _fread(data, 1, size, tar->stream); return (res == size) ? MTAR_ESUCCESS : MTAR_EREADFAIL; } static int file_seek(mtar_t *tar, unsigned offset) { - int res = fseek(tar->stream, offset, SEEK_SET); + int res = _fseek(tar->stream, offset, SEEK_SET); return (res == 0) ? MTAR_ESUCCESS : MTAR_ESEEKFAIL; } static int file_close(mtar_t *tar) { - fclose(tar->stream); + _fclose(tar->stream); return MTAR_ESUCCESS; } @@ -212,11 +212,11 @@ int mtar_open(mtar_t *tar, const char *filename, const char *mode) { tar->close = file_close; /* Assure mode is always binary */ - if ( strchr(mode, 'r') ) mode = "rb"; - if ( strchr(mode, 'w') ) mode = "wb"; - if ( strchr(mode, 'a') ) mode = "ab"; + if ( _strchr(mode, 'r') ) mode = "rb"; + if ( _strchr(mode, 'w') ) mode = "wb"; + if ( _strchr(mode, 'a') ) mode = "ab"; /* Open file */ - tar->stream = fopen(filename, mode); + tar->stream = _fopen(filename, mode); if (!tar->stream) { return MTAR_EOPENFAIL; } @@ -277,7 +277,7 @@ int mtar_find(mtar_t *tar, const char *name, mtar_header_t *h) { } /* Iterate all files until we hit an error or find the file */ while ( (err = mtar_read_header(tar, &header)) == MTAR_ESUCCESS ) { - if ( !strcmp(header.name, name) ) { + if ( !_strcmp(header.name, name) ) { if (h) { *h = header; } @@ -358,7 +358,7 @@ int mtar_write_file_header(mtar_t *tar, const char *name, unsigned size) { mtar_header_t h; /* Build header */ mtar_memset(&h, 0, sizeof(h)); - strcpy(h.name, name); + _strcpy(h.name, name); h.size = size; h.type = MTAR_TREG; h.mode = 0664; @@ -371,7 +371,7 @@ int mtar_write_dir_header(mtar_t *tar, const char *name) { mtar_header_t h; /* Build header */ mtar_memset(&h, 0, sizeof(h)); - strcpy(h.name, name); + _strcpy(h.name, name); h.type = MTAR_TDIR; h.mode = 0775; /* Write header */ @@ -413,17 +413,17 @@ int mtar_init(){ return 1; } - fread = _ksys_dlsym(libc, "fread"); - fwrite = _ksys_dlsym(libc, "fwrite"); - fclose = _ksys_dlsym(libc, "fclose"); - fopen = _ksys_dlsym(libc, "fopen"); - fseek = _ksys_dlsym(libc, "fseek"); - ftell = _ksys_dlsym(libc, "ftell"); - sprintf= _ksys_dlsym(libc, "sprintf"); - sscanf = _ksys_dlsym(libc, "sscanf"); - strcmp = _ksys_dlsym(libc, "strcmp"); - strchr = _ksys_dlsym(libc, "strchr"); - strcpy = _ksys_dlsym(libc, "strcpy"); + _fread = _ksys_dlsym(libc, "fread"); + _fwrite = _ksys_dlsym(libc, "fwrite"); + _fclose = _ksys_dlsym(libc, "fclose"); + _fopen = _ksys_dlsym(libc, "fopen"); + _fseek = _ksys_dlsym(libc, "fseek"); + _ftell = _ksys_dlsym(libc, "ftell"); + _sprintf= _ksys_dlsym(libc, "sprintf"); + _sscanf = _ksys_dlsym(libc, "sscanf"); + _strcmp = _ksys_dlsym(libc, "strcmp"); + _strchr = _ksys_dlsym(libc, "strchr"); + _strcpy = _ksys_dlsym(libc, "strcpy"); return 0; }