From 1eff55fdee2179d17572e316d6cbcb4427a006b3 Mon Sep 17 00:00:00 2001 From: turbocat Date: Sat, 1 Jan 2022 16:33:14 +0000 Subject: [PATCH] libc.obj: Fix clayer headers for work def. git-svn-id: svn://kolibrios.org@9552 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../trunk/libc.obj/include/clayer/boxlib.h | 63 ++++++++++------- .../trunk/libc.obj/include/clayer/buf2d.h | 68 +++++++++---------- .../trunk/libc.obj/include/clayer/dialog.h | 11 ++- .../ktcc/trunk/libc.obj/include/clayer/gb.h | 12 ++-- .../ktcc/trunk/libc.obj/include/clayer/http.h | 21 +++--- .../trunk/libc.obj/include/clayer/inputbox.h | 11 ++- .../trunk/libc.obj/include/clayer/libimg.h | 38 +++++------ .../trunk/libc.obj/include/clayer/msgbox.h | 14 ++-- .../trunk/libc.obj/include/clayer/network.h | 15 ++-- .../libc.obj/include/clayer/rasterworks.h | 12 ++-- .../ktcc/trunk/libc.obj/include/conio.h | 41 ++++++----- .../ktcc/trunk/libc.obj/include/stddef.h | 10 ++- .../ktcc/trunk/libc.obj/include/sys/ksys.h | 6 +- 13 files changed, 165 insertions(+), 157 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 3162f1b361..9476a2f96d 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/boxlib.h @@ -3,9 +3,11 @@ #ifndef KOLIBRI_BOXLIB_H #define KOLIBRI_BOXLIB_H -typedef unsigned color_t; +#include "sys/ksys.h" +#include +#include -extern int kolibri_boxlib_init(void); +typedef unsigned color_t; /* flags meaning */ #define ed_figure_only 0b1000000000000000 // одни символы @@ -66,10 +68,10 @@ typedef struct { uint32_t ar_offset; } __attribute__ ((__packed__)) scrollbar; -extern void (*scrollbar_h_draw __attribute__((__stdcall__)))(scrollbar*); -extern void (*scrollbar_h_mouse __attribute__((__stdcall__)))(scrollbar*); -extern void (*scrollbar_v_draw __attribute__((__stdcall__)))(scrollbar*); -extern void (*scrollbar_v_mouse __attribute__((__stdcall__)))(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 { @@ -86,9 +88,9 @@ typedef struct { unsigned int size_of_str; }check_box; -extern void (*check_box_draw2 __attribute__((__stdcall__)))(check_box *); -extern void (*check_box_mouse2 __attribute__((__stdcall__)))(check_box *); -extern void (*init_checkbox2 __attribute__((__stdcall__)))(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 { @@ -108,8 +110,8 @@ typedef struct { uint32_t click; // clicked - 1, zero it after tested } pict_button; -extern void (*dynamic_button_draw __attribute__((__stdcall__)))(pict_button *); -extern void (*dynamic_button_mouse __attribute__((__stdcall__)))(pict_button *); +extern void __stdcall (*dynamic_button_draw)(pict_button *); +extern void __stdcall (*dynamic_button_mouse)(pict_button *); // EDITBOX @@ -141,10 +143,20 @@ typedef struct edit_box_t { }edit_box; #pragma pack(pop) -extern void (*edit_box_draw __attribute__((__stdcall__)))(edit_box *); -extern void edit_box_key (edit_box *, unsigned int key_val)__attribute__((__stdcall__)); -extern void (*edit_box_mouse __attribute__((__stdcall__)))(edit_box *); -extern void (*edit_box_set_text __attribute__((__stdcall__)))(edit_box *, char *); +extern void __stdcall (*edit_box_draw)(edit_box *) __asm__("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 *); + +void edit_box_key_safe(edit_box *e, ksys_oskey_t ch) { + int a=3; + asm_inline ( + "pushl %2 \n\t" + "call *%1 \n\t" + ::"a"(ch.val), "m"(edit_box_key), "m"(e) + :"memory" + ); +} // FRAME typedef struct { @@ -162,7 +174,7 @@ typedef struct { color_t font_bg_color; }frame; -extern void (*frame_draw)(frame *); +extern void __stdcall (*frame_draw)(frame *); // MENUBAR typedef struct @@ -203,9 +215,9 @@ typedef struct uint32_t get_mouse_flag; } menubar; -extern void (*menu_bar_draw)(menubar *); -extern void (*menu_bar_mouse)(menubar *); -extern void (*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 { @@ -222,8 +234,8 @@ typedef struct option_box_t { uint32_t flags; } __attribute__ ((__packed__)) option_box; -extern void (*option_box_draw __attribute__((__stdcall__)))(option_box **); -extern void (*option_box_mouse __attribute__((__stdcall__)))(option_box **); +extern void __stdcall (*option_box_draw)(option_box **); +extern void __stdcall (*option_box_mouse)(option_box **); // PATHSHOW typedef struct { @@ -240,8 +252,8 @@ typedef struct { uint32_t temp_text_length; } __attribute__ ((__packed__)) pathview; -extern void (*path_show_prepare __attribute__((__stdcall__)))(pathview *); -extern void (*path_show_draw __attribute__((__stdcall__)))(pathview *); +extern void __stdcall (*path_show_prepare)(pathview *); +extern void __stdcall (*path_show_draw)(pathview *); // PROGRESSBAR typedef struct { @@ -258,8 +270,7 @@ typedef struct { unsigned int frame_color; } progressbar; -extern void (*progressbar_draw __attribute__((__stdcall__)))(progressbar *); -extern void (*progressbar_progress __attribute__((__stdcall__)))(progressbar *); - +extern void __stdcall (*progressbar_draw)(progressbar *); +extern 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 74b986d2b1..cdba64648a 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/buf2d.h @@ -2,11 +2,8 @@ #define KOLIBRI_BUF2D_H #include -/*ToDo - * voxel function - */ - -extern int kolibri_buf2d_init(void); +#include +#include typedef struct { unsigned int *buf_pointer; @@ -16,7 +13,7 @@ typedef struct { unsigned int height; unsigned int bgcolor; uint8_t color_bit; -} __attribute__ ((__packed__))buf2d_struct; +} __attribute__ ((__packed__))buf2d_struct; enum BUF2D_ALGORITM_FILTR { SIERRA_LITE, @@ -33,12 +30,12 @@ enum BUF2D_OPT_CROP { BUF2D_OPT_CROP_RIGHT = 8 }; -extern void (*buf2d_create_asm __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_curve_bezier_asm __attribute__((__stdcall__)))(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 *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(buf2d_struct)); + buf2d_struct *new_buf2d_struct = (buf2d_struct *)_ksys_alloc(sizeof(buf2d_struct)); new_buf2d_struct -> left = tlx; new_buf2d_struct -> top = tly; new_buf2d_struct -> width = sizex; @@ -54,30 +51,31 @@ void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color); } -extern void (*buf2d_draw __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_clear __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); -extern void (*buf2d_delete __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_rotate __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); -extern void (*buf2d_resize __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_line __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_line_sm __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_filled_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_circle __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_img_hdiv2 __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_img_wdiv2 __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_conv_24_to_8 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); -extern void (*buf2d_conv_24_to_32 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int); -extern void (*buf2d_bit_blt_transp __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *); -extern void (*buf2d_bit_blt_alpha __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *); -extern void (*buf2d_convert_text_matrix __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_draw_text __attribute__((__stdcall__)))(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int); -extern void (*buf2d_crop_color __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int); -extern void (*buf2d_offset_h __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_flood_fill __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int); -extern void (*buf2d_set_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int); -extern unsigned int (*buf2d_get_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int); -extern void (*buf2d_flip_h __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_flip_v __attribute__((__stdcall__)))(buf2d_struct *); -extern void (*buf2d_filter_dither __attribute__((__stdcall__)))(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 */ 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 3cb7759e0c..5d81066403 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/dialog.h @@ -2,6 +2,7 @@ #define KOLIBRI_DIALOG_H #include + #define NOT_SUCCESS 0 #define SUCCESS 1 @@ -115,12 +116,10 @@ color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, un return new_colordialog; } -extern void kolibri_dialog_init(); +extern void __stdcall (*OpenDialog_init)(open_dialog *); +extern void __stdcall (*OpenDialog_start)(open_dialog *); -extern void (*OpenDialog_init __attribute__((__stdcall__)))(open_dialog *); -extern void (*OpenDialog_start __attribute__((__stdcall__)))(open_dialog *); - -extern void (*ColorDialog_init __attribute__((__stdcall__)))(color_dialog *); -extern void (*ColorDialog_start __attribute__((__stdcall__)))(color_dialog *); +extern void __stdcall (*ColorDialog_init)(color_dialog *); +extern void __stdcall (*ColorDialog_start)(color_dialog *); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/clayer/gb.h b/programs/develop/ktcc/trunk/libc.obj/include/clayer/gb.h index 7e0ae75bdb..564bbd7d6c 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/gb.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/gb.h @@ -1,11 +1,13 @@ +#ifndef KOLIBRI_GB_H +#define KOLIBRI_GB_H #pragma pack(push, 1) typedef struct { -int w; -int h; -char *bmp; -char *alpha; + int w; + int h; + char *bmp; + char *alpha; } GB_BMP; #pragma pack(pop) @@ -17,3 +19,5 @@ void gb_bar(GB_BMP *b, int x, int y, int w, int h, unsigned c); void gb_circle(GB_BMP *b, int x, int y, int r, unsigned c); void gb_image_set(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h); void gb_image_set_t(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h, unsigned c); + +#endif // KOLIBRI_GB_H \ No newline at end of file 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 ac296576e3..78b0001c43 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/http.h @@ -5,11 +5,10 @@ Adapted for TCC's dynamic API by Magomed Kostoev, 2020 */ -#ifndef _HTTP_H_ -#define _HTTP_H_ +#ifndef KOLIBRI_HTTP_H +#define KOLIBRI_HTTP_H -#define cdecl __attribute__ ((cdecl)) -#define stdcall __attribute__ ((stdcall)) +#include // Bitflags for http_msg.flags // status @@ -80,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); +extern http_msg * __stdcall (*http_get)(const char *url, http_msg *identifier, unsigned flags, const char *add_header); /* url = pointer to ASCIIZ URL @@ -91,7 +90,7 @@ extern http_msg * stdcall (*http_get)(const char *url, http_msg *identifier, uns Initiate a HTTP connection, using 'HEAD' method. Returns NULL on error, identifier otherwise. */ -extern http_msg * stdcall (*http_head)(const char *url, http_msg *identifier, unsigned flags, const char *add_header); +extern http_msg * __stdcall (*http_head)(const char *url, http_msg *identifier, unsigned flags, const char *add_header); /* url = pointer to ASCIIZ URL @@ -106,7 +105,7 @@ extern http_msg * stdcall (*http_head)(const char *url, http_msg *identifier, un 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, +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); /* @@ -128,7 +127,7 @@ extern http_msg * stdcall (*http_post)(const char *url, http_msg *identifier, un In content_length you'll find the length of the content. In content_received, you'll find the number of content bytes already received. */ -extern int stdcall (*http_receive)(http_msg *identifier); +extern int __stdcall (*http_receive)(http_msg *identifier); /* identifier = identifier which one of the previous functions returned @@ -137,17 +136,17 @@ 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); +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: */ -extern int stdcall (*http_free)(http_msg *identifier); +extern int __stdcall (*http_free)(http_msg *identifier); /* Free unused data */ #define http_long_receive(x) while(http_receive(x)){}; -#endif // _HTTP_H_ +#endif // KOLIBRI_HTTP_H 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 1b2a6c2041..3144341a2d 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/inputbox.h @@ -5,13 +5,12 @@ Adapted for TCC's dynamic API by Magomed Kostoev, 2020 */ -#ifndef __KOS__INPUTBOX__H________ -#define __KOS__INPUTBOX__H________ +#ifndef KOLIBRI_INPUTBOX_H +#define KOLIBRI_INPUTBOX_H -#define cdecl __attribute__ ((cdecl)) -#define stdcall __attribute__ ((stdcall)) +#include -extern unsigned stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default, +extern unsigned __stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default, unsigned long Flags, unsigned long BufferSize, void* RedrawProc); -#endif // __KOS__INPUTBOX__H________ +#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 3b41978be2..355fd84ba4 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/libimg.h @@ -6,10 +6,6 @@ #include #include -extern int kolibri_libimg_init(void); - -#define _stdcall __attribute__((__stdcall__)) - //list of format id's #define LIBIMG_FORMAT_BMP 1 #define LIBIMG_FORMAT_ICO 2 @@ -99,23 +95,23 @@ typedef struct{ #define ROTATE_90_CCW ROTATE_270_CW #define ROTATE_270_CCW ROTATE_90_CW -extern Image* (*img_decode _stdcall)(void* file_data, uint32_t size, uint32_t b_color); -extern Image* (*img_encode _stdcall)(Image* img, uint32_t length, uint32_t option); -extern Image* (*img_create _stdcall)(uint32_t width, uint32_t height, uint32_t type); -extern void (*img_to_rgb2 _stdcall)(Image* img, void *rgb_data); -extern Image* (*img_to_rgb _stdcall)(Image* img); -extern bool (*img_flip _stdcall)(Image* img, uint32_t flip); -extern bool (*img_flip_layer _stdcall)(Image *img, uint32_t flip); -extern bool (*img_rotate _stdcall)(Image *img, uint32_t rotate); -extern bool (*img_rotate_layer _stdcall)(Image* data, uint32_t rotate); -extern void (*img_draw _stdcall)(Image *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t xoff, uint32_t yoff); -extern int32_t (*img_count _stdcall)(Image *img); -extern bool (*img_destroy _stdcall)(Image *img); -extern bool (*img_destroy_layer _stdcall)(Image* img); -extern Image* (*img_blend _stdcall)(Image* dst, Image* src, uint32_t out_x, uint32_t out_y, uint32_t in_x, uint32_t in_y, uint32_t width, uint32_t height); -extern Image* (*img_convert _stdcall)(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t); -extern Image* (*img_resize_data _stdcall)(Image *src, uint32_t width, uint32_t height); -extern Image* (*img_scale _stdcall)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height); +extern Image* __stdcall (*img_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++) { 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 b0efe61f69..c08d9be086 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/msgbox.h @@ -1,11 +1,11 @@ #ifndef KOLIBRI_MSGBOX_H #define KOLIBRI_MSGBOX_H + #include #include #include #include - typedef struct { uint8_t retval; // 0 - win closed, 1 to n - button num, also default button on start uint8_t reserv; @@ -16,16 +16,16 @@ typedef struct { typedef void (*msgbox_callback)(void); -extern void (*msgbox_create __attribute__((__stdcall__)))(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51 -extern void (*msgbox_setfunctions __attribute__((__stdcall__)))(msgbox_callback*); // must be called immediately after create, zero-ended array -extern void (*msgbox_reinit __attribute__((__stdcall__)))(msgbox *) ; // recalc sizes when structure changes, called auto when MsgBoxCreate +extern void __stdcall (*mb_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" /// def_but - highlighted and used on Enter (if zero - default is [X]), user may use Tabs or Arrows /// last params are buttons text, max 8. last must set as NULL { - va_list vl=0; + va_list vl = 0; va_start(vl, def_but); msgbox* box = calloc(sizeof(msgbox), 1); box->retval = (uint8_t)def_but; @@ -48,8 +48,8 @@ static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, . static inline void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[]) { - (*msgbox_create)(box, &box->top_stack); - if (cb) (*msgbox_setfunctions)(cb); + mb_create(box, &box->top_stack); + if (cb) mb_setfunctions(cb); } #endif 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 3ac45bdebf..0f48e4ba7a 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/network.h @@ -1,11 +1,9 @@ -#ifndef __NETWORK_H -#define __NETWORK_H +#ifndef KOLIBRI_NETWORK_H +#define KOLIBRI_NETWORK_H #include #include -#define stdcall __attribute__ ((stdcall)) - #define EAI_ADDRFAMILY 1 #define EAI_AGAIN 2 #define EAI_BADFLAGS 3 @@ -48,10 +46,9 @@ struct addrinfo { }; #pragma pack(pop) -extern 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); +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 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 4c0aea79d2..7b842a9fcb 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/clayer/rasterworks.h @@ -1,11 +1,11 @@ #ifndef KOLIBRI_RASTERWORKS_H #define KOLIBRI_RASTERWORKS_H -//extern int kolibri_rasterworks_init(void); +#include -extern void (*drawText __attribute__((__stdcall__)))(void *canvas, int x, int y, const char *string, int charQuantity, int fontColor, int params); -extern int (*countUTF8Z __attribute__((__stdcall__)))(const char *string, int byteQuantity); -extern int (*charsFit __attribute__((__stdcall__)))(int areaWidth, int charHeight); -extern int (*strWidth __attribute__((__stdcall__)))(int charQuantity, int charHeight); +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 */ +#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 92c125d981..03fda9a338 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/conio.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/conio.h @@ -11,9 +11,6 @@ Adapted for tcc by Siemargl, 2016 #include -#define cdecl __attribute__ ((cdecl)) -#define stdcall __attribute__ ((stdcall)) - /* console.obj exports the following functions */ @@ -38,25 +35,25 @@ typedef unsigned short word; /* 16-bit unsigned integer */ extern int _FUNC(con_init)(void); extern int _FUNC(con_init_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); -extern int cdecl _FUNC((*con_printf))(const char* format, ...); -extern dword stdcall _FUNC((*con_get_flags))(void); -extern dword stdcall _FUNC((*con_set_flags))(dword new_flags); -extern int stdcall _FUNC((*con_get_font_height))(void); -extern int stdcall _FUNC((*con_get_cursor_height))(void); -extern int stdcall _FUNC((*con_set_cursor_height))(int new_height); -extern int stdcall _FUNC((*con_getch))(void); -extern word stdcall _FUNC((*con_getch2))(void); -extern int stdcall _FUNC((*con_kbhit))(void); -extern char* stdcall _FUNC((*con_gets))(char* str, int n); -typedef int (stdcall _FUNC(* con_gets2_callback))(int keycode, char** pstr, int* pn, int* ppos); -extern char* stdcall _FUNC((*con_gets2))(con_gets2_callback callback, char* str, int n); -extern void stdcall _FUNC((*con_cls))(); -extern void stdcall _FUNC((*con_get_cursor_pos))(int* px, int* py); -extern void stdcall _FUNC((*con_set_cursor_pos))(int x, int y); +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); +extern int __cdecl _FUNC((*con_printf))(const char* format, ...); +extern dword __stdcall _FUNC((*con_get_flags))(void); +extern dword __stdcall _FUNC((*con_set_flags))(dword new_flags); +extern int __stdcall _FUNC((*con_get_font_height))(void); +extern int __stdcall _FUNC((*con_get_cursor_height))(void); +extern int __stdcall _FUNC((*con_set_cursor_height))(int new_height); +extern int __stdcall _FUNC((*con_getch))(void); +extern word __stdcall _FUNC((*con_getch2))(void); +extern int __stdcall _FUNC((*con_kbhit))(void); +extern char* __stdcall _FUNC((*con_gets))(char* str, int n); +typedef int __stdcall _FUNC(* con_gets2_callback)(int keycode, char** pstr, int* pn, int* ppos); +extern char* __stdcall _FUNC((*con_gets2))(con_gets2_callback callback, char* str, int n); +extern void __stdcall _FUNC((*con_cls))(); +extern void __stdcall _FUNC((*con_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); #endif diff --git a/programs/develop/ktcc/trunk/libc.obj/include/stddef.h b/programs/develop/ktcc/trunk/libc.obj/include/stddef.h index 34f3f74ca4..3de65b8da9 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/stddef.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/stddef.h @@ -34,4 +34,12 @@ typedef uint64_t uintmax_t; #define offsetof(type, field) ((size_t)&((type *)0)->field) -#endif /* _STDDEF_H_ */ \ No newline at end of file +#ifndef __stdcall + #define __stdcall __attribute__((stdcall)) +#endif + +#ifndef __cdecl + #define __cdecl __attribute__((cdecl)) +#endif + +#endif /* _STDDEF_H_ */ diff --git a/programs/develop/ktcc/trunk/libc.obj/include/sys/ksys.h b/programs/develop/ktcc/trunk/libc.obj/include/sys/ksys.h index a107ac94cf..1a9245adba 100644 --- a/programs/develop/ktcc/trunk/libc.obj/include/sys/ksys.h +++ b/programs/develop/ktcc/trunk/libc.obj/include/sys/ksys.h @@ -218,8 +218,8 @@ enum KSYS_FILE_ENCODING{ KSYS_FILE_UTF8 = 3 }; -static inline -int _ksys_strcmp(const char * s1, const char * s2 ) +static inline +int __strcmp(const char * s1, const char * s2 ) { while ((*s1) && (*s1 == *s2)){ ++s1; ++s2; } return(*(unsigned char*)s1 - *(unsigned char *)s2); @@ -1163,7 +1163,7 @@ void* _ksys_dlsym(ksys_dll_t *table, const char* fun_name){ if (!(table+i)->func_name){ break; }else{ - if (!_ksys_strcmp(fun_name, (table+i)->func_name)){ + if (!__strcmp(fun_name, (table+i)->func_name)){ return (table+i)->func_ptr; } }