forked from KolibriOS/kolibrios
Update skipped files in previous commit
git-svn-id: svn://kolibrios.org@9766 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
|
||||
#ifdef NDEBUG
|
||||
#define assert(x) (void)0
|
||||
#else
|
||||
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__), 0)))
|
||||
#endif
|
||||
|
||||
#endif // _ASSERT_H_
|
||||
#endif // _ASSERT_H_
|
||||
|
||||
@@ -3,49 +3,49 @@
|
||||
#ifndef KOLIBRI_BOXLIB_H
|
||||
#define KOLIBRI_BOXLIB_H
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
typedef unsigned color_t;
|
||||
int kolibri_boxlib_init(void);
|
||||
|
||||
/* flags meaning */
|
||||
#define ed_figure_only 0b1000000000000000 // одни символы
|
||||
#define ed_always_focus 0b100000000000000 // всегда с курсором (фокусом)
|
||||
#define ed_focus 0b10 // фокус ввода приложения, мышится самостоятельно
|
||||
#define ed_pass 0b1 // поле с паролем
|
||||
#define ed_shift_on 0b1000 // если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая //shift
|
||||
#define ed_figure_only 0b1000000000000000 // одни символы
|
||||
#define ed_always_focus 0b100000000000000 // всегда с курсором (фокусом)
|
||||
#define ed_focus 0b10 // фокус ввода приложения, мышится самостоятельно
|
||||
#define ed_pass 0b1 // поле с паролем
|
||||
#define ed_shift_on 0b1000 // если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая //shift
|
||||
#define ed_shift_on_off 0b1111111111110111
|
||||
#define ed_shift 0b100 //включается при нажатии на shift т.е. если нажимаю
|
||||
#define ed_shift 0b100 //включается при нажатии на shift т.е. если нажимаю
|
||||
#define ed_shift_off 0b1111111111111011
|
||||
#define ed_shift_bac 0b10000 //бит для очистки выделеного shift т.е. при установке говорит что есть выделение
|
||||
#define ed_shift_bac_cl 0b1111111111101111 //очистка при удалении выделения
|
||||
#define ed_shift_bac 0b10000 //бит для очистки выделеного shift т.е. при установке говорит что есть выделение
|
||||
#define ed_shift_bac_cl 0b1111111111101111 //очистка при удалении выделения
|
||||
#define ed_shift_cl 0b1111111111100011
|
||||
#define ed_shift_mcl 0b1111111111111011
|
||||
#define ed_left_fl 0b100000
|
||||
#define ed_left_fl 0b100000
|
||||
#define ed_right_fl 0b1111111111011111
|
||||
#define ed_offset_fl 0b1000000
|
||||
#define ed_offset_fl 0b1000000
|
||||
#define ed_offset_cl 0b1111111110111111
|
||||
#define ed_insert 0b10000000
|
||||
#define ed_insert 0b10000000
|
||||
#define ed_insert_cl 0b1111111101111111
|
||||
#define ed_mouse_on 0b100000000
|
||||
#define ed_mous_adn_b 0b100011000
|
||||
#define ed_mouse_off ~ed_mouse_on
|
||||
#define ed_ctrl_on 0b1000000000
|
||||
#define ed_ctrl_off ~ed_ctrl_on
|
||||
#define ed_alt_on 0b10000000000
|
||||
#define ed_alt_off ~ed_alt_on
|
||||
#define ed_disabled 0b100000000000
|
||||
#define ed_mouse_on 0b100000000
|
||||
#define ed_mous_adn_b 0b100011000
|
||||
#define ed_mouse_off ~ed_mouse_on
|
||||
#define ed_ctrl_on 0b1000000000
|
||||
#define ed_ctrl_off ~ed_ctrl_on
|
||||
#define ed_alt_on 0b10000000000
|
||||
#define ed_alt_off ~ed_alt_on
|
||||
#define ed_disabled 0b100000000000
|
||||
|
||||
// SCROLLBAR
|
||||
typedef struct {
|
||||
uint16_t xsize;
|
||||
uint16_t xsize;
|
||||
uint16_t xpos;
|
||||
uint16_t ysize;
|
||||
uint16_t ypos;
|
||||
uint32_t btn_height;
|
||||
uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ?
|
||||
uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ?
|
||||
uint32_t max_area;
|
||||
uint32_t cur_area;
|
||||
uint32_t position;
|
||||
@@ -65,9 +65,9 @@ typedef struct {
|
||||
uint32_t run_size;
|
||||
uint32_t position2;
|
||||
uint32_t work_size;
|
||||
uint32_t all_redraw; // need to be set =1 before each redraw
|
||||
uint32_t all_redraw; // need to be set =1 before each redraw
|
||||
uint32_t ar_offset;
|
||||
} __attribute__ ((__packed__)) scrollbar;
|
||||
} __attribute__((__packed__)) scrollbar;
|
||||
|
||||
extern void __stdcall (*scrollbar_h_draw)(scrollbar*);
|
||||
extern void __stdcall (*scrollbar_h_mouse)(scrollbar*);
|
||||
@@ -82,58 +82,58 @@ typedef struct {
|
||||
unsigned int color;
|
||||
unsigned int border_color;
|
||||
unsigned int text_color;
|
||||
char *text;
|
||||
char* text;
|
||||
unsigned int flags;
|
||||
|
||||
/* Users can use members above this */
|
||||
unsigned int size_of_str;
|
||||
}check_box;
|
||||
} 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 *);
|
||||
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 {
|
||||
uint32_t type;
|
||||
uint32_t x_w;
|
||||
uint32_t y_h;
|
||||
uint32_t mouse_pos;
|
||||
uint32_t type;
|
||||
uint32_t x_w;
|
||||
uint32_t y_h;
|
||||
uint32_t mouse_pos;
|
||||
uint32_t mouse_keys;
|
||||
uint32_t mouse_keys_old;
|
||||
void* active_raw; //active bitmap
|
||||
void* passive_raw; //passive bitmap
|
||||
void* click_raw; //pressed bitmap
|
||||
void* active_raw; //active bitmap
|
||||
void* passive_raw; //passive bitmap
|
||||
void* click_raw; //pressed bitmap
|
||||
uint32_t resolution_raw; // bpp, as esi fn65
|
||||
void* palette_raw; // palette, as edi fn65
|
||||
void* palette_raw; // palette, as edi fn65
|
||||
uint32_t offset_raw; // width as ebp fn65
|
||||
uint32_t select; // internal state: 0 - passive, 2 - pressed, 1 - clicked
|
||||
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 *);
|
||||
extern void __stdcall (*dynamic_button_draw)(pict_button*);
|
||||
extern void __stdcall (*dynamic_button_mouse)(pict_button*);
|
||||
|
||||
// EDITBOX
|
||||
|
||||
#pragma pack(push,1)
|
||||
#pragma pack(push, 1)
|
||||
typedef struct edit_box_t {
|
||||
unsigned int width;
|
||||
unsigned int left;
|
||||
unsigned int top;
|
||||
unsigned int color;
|
||||
unsigned int shift_color; // selected text color
|
||||
unsigned int shift_color; // selected text color
|
||||
unsigned int focus_border_color;
|
||||
unsigned int blur_border_color;
|
||||
unsigned int text_color;
|
||||
unsigned int max;
|
||||
char *text;
|
||||
void *mouse_variable; // must be pointer edit_box** to save focused editbox
|
||||
char* text;
|
||||
void* mouse_variable; // must be pointer edit_box** to save focused editbox
|
||||
unsigned int flags;
|
||||
|
||||
unsigned int size; // used symbols in buffer without trailing zero
|
||||
unsigned int size; // used symbols in buffer without trailing zero
|
||||
unsigned int pos; // cursor position
|
||||
/* The following struct members are not used by the users of API */
|
||||
/* The following struct members are not used by the users of API */
|
||||
unsigned int offset;
|
||||
unsigned int cl_curs_x;
|
||||
unsigned int cl_curs_y;
|
||||
@@ -141,116 +141,116 @@ typedef struct edit_box_t {
|
||||
unsigned int shift_old;
|
||||
unsigned int height;
|
||||
unsigned int char_width;
|
||||
}edit_box;
|
||||
} 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 *);
|
||||
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*);
|
||||
|
||||
extern 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 {
|
||||
uint32_t type;
|
||||
uint32_t x_w;
|
||||
uint32_t y_h;
|
||||
color_t ext_col;
|
||||
color_t int_col;
|
||||
uint32_t flags;
|
||||
char *text_pointer;
|
||||
uint32_t text_position;
|
||||
uint32_t font_number;
|
||||
uint32_t font_size_y;
|
||||
color_t font_color;
|
||||
color_t font_bg_color;
|
||||
}frame;
|
||||
uint32_t type;
|
||||
uint32_t x_w;
|
||||
uint32_t y_h;
|
||||
color_t ext_col;
|
||||
color_t int_col;
|
||||
uint32_t flags;
|
||||
char* text_pointer;
|
||||
uint32_t text_position;
|
||||
uint32_t font_number;
|
||||
uint32_t font_size_y;
|
||||
color_t font_color;
|
||||
color_t font_bg_color;
|
||||
} frame;
|
||||
|
||||
extern void __stdcall (*frame_draw)(frame *);
|
||||
extern void __stdcall (*frame_draw)(frame*);
|
||||
|
||||
// MENUBAR
|
||||
typedef struct
|
||||
{
|
||||
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
|
||||
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
|
||||
|
||||
uint32_t x_w; // âåðõíèé ïóíêò
|
||||
uint32_t y_h;
|
||||
uint32_t x_w; // âåðõíèé ïóíêò
|
||||
uint32_t y_h;
|
||||
|
||||
char* text_pointer;
|
||||
char* pos_pointer;
|
||||
char* text_end;
|
||||
uint32_t mouse_pos;
|
||||
uint32_t mouse_keys;
|
||||
char* text_pointer;
|
||||
char* pos_pointer;
|
||||
char* text_end;
|
||||
uint32_t mouse_pos;
|
||||
uint32_t mouse_keys;
|
||||
|
||||
uint32_t x_w1; // ïîäìåíþ
|
||||
uint32_t y_h1;
|
||||
uint32_t x_w1; // ïîäìåíþ
|
||||
uint32_t y_h1;
|
||||
|
||||
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
|
||||
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
|
||||
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
|
||||
uint32_t select;
|
||||
uint32_t out_select;
|
||||
char* buf_adress;
|
||||
char* procinfo;
|
||||
uint32_t click;
|
||||
uint32_t cursor;
|
||||
uint32_t cursor_old;
|
||||
uint32_t interval;
|
||||
uint32_t cursor_max;
|
||||
uint32_t extended_key;
|
||||
color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà
|
||||
color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà
|
||||
color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà
|
||||
uint32_t mouse_keys_old;
|
||||
uint32_t font_height;
|
||||
uint32_t cursor_out;
|
||||
uint32_t get_mouse_flag;
|
||||
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
|
||||
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
|
||||
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
|
||||
uint32_t select;
|
||||
uint32_t out_select;
|
||||
char* buf_adress;
|
||||
char* procinfo;
|
||||
uint32_t click;
|
||||
uint32_t cursor;
|
||||
uint32_t cursor_old;
|
||||
uint32_t interval;
|
||||
uint32_t cursor_max;
|
||||
uint32_t extended_key;
|
||||
color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà
|
||||
color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà
|
||||
color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà
|
||||
uint32_t mouse_keys_old;
|
||||
uint32_t font_height;
|
||||
uint32_t cursor_out;
|
||||
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 *);
|
||||
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 {
|
||||
struct option_box_t **selected;
|
||||
struct option_box_t** selected;
|
||||
uint16_t posx;
|
||||
uint16_t posy;
|
||||
uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
|
||||
uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
|
||||
uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
|
||||
color_t color;
|
||||
color_t border_color; // individual border
|
||||
color_t text_color;
|
||||
char *text;
|
||||
char* text;
|
||||
uint32_t text_len;
|
||||
uint32_t flags;
|
||||
} __attribute__ ((__packed__)) option_box;
|
||||
} __attribute__((__packed__)) option_box;
|
||||
|
||||
extern void __stdcall (*option_box_draw)(option_box **);
|
||||
extern 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 {
|
||||
uint32_t type;
|
||||
uint32_t x_y;
|
||||
uint16_t font_size_x; // 6 - for font 0, 8 - for font 1
|
||||
uint16_t area_size_x;
|
||||
uint32_t font_number; // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3)
|
||||
uint32_t type;
|
||||
uint32_t x_y;
|
||||
uint16_t font_size_x; // 6 - for font 0, 8 - for font 1
|
||||
uint16_t area_size_x;
|
||||
uint32_t font_number; // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3)
|
||||
uint32_t background_flag; // as fn4, if 0, bk_color unneeded
|
||||
color_t font_color; // as fn4
|
||||
color_t background_color; // as fn4
|
||||
color_t font_color; // as fn4
|
||||
color_t background_color; // as fn4
|
||||
char* text_pointer; // 4096 ?
|
||||
char* work_area_pointer; // 4096 ?
|
||||
uint32_t temp_text_length;
|
||||
} __attribute__ ((__packed__)) pathview;
|
||||
} __attribute__((__packed__)) pathview;
|
||||
|
||||
extern void __stdcall (*path_show_prepare)(pathview *);
|
||||
extern void __stdcall (*path_show_draw)(pathview *);
|
||||
extern void __stdcall (*path_show_prepare)(pathview*);
|
||||
extern void __stdcall (*path_show_draw)(pathview*);
|
||||
|
||||
// PROGRESSBAR
|
||||
typedef struct {
|
||||
unsigned int value;
|
||||
unsigned int value;
|
||||
unsigned int left;
|
||||
unsigned int top;
|
||||
unsigned int width;
|
||||
@@ -263,7 +263,7 @@ typedef struct {
|
||||
unsigned int frame_color;
|
||||
} progressbar;
|
||||
|
||||
extern void __stdcall (*progressbar_draw)(progressbar *);
|
||||
extern void __stdcall (*progressbar_progress)(progressbar *);
|
||||
extern void __stdcall (*progressbar_draw)(progressbar*);
|
||||
extern void __stdcall (*progressbar_progress)(progressbar*);
|
||||
|
||||
#endif /* KOLIBRI_BOXLIB_H */
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
#ifndef KOLIBRI_BUF2D_H
|
||||
#define KOLIBRI_BUF2D_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned int *buf_pointer;
|
||||
uint16_t left;
|
||||
uint16_t top;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bgcolor;
|
||||
uint8_t color_bit;
|
||||
} __attribute__ ((__packed__))buf2d_struct;
|
||||
unsigned int* buf_pointer;
|
||||
uint16_t left;
|
||||
uint16_t top;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bgcolor;
|
||||
uint8_t color_bit;
|
||||
} __attribute__((__packed__)) buf2d_struct;
|
||||
|
||||
enum BUF2D_ALGORITM_FILTR {
|
||||
SIERRA_LITE,
|
||||
FLOYD_STEINBERG,
|
||||
BURKERS,
|
||||
HEAVYIRON_MOD,
|
||||
ATKINSON
|
||||
SIERRA_LITE,
|
||||
FLOYD_STEINBERG,
|
||||
BURKERS,
|
||||
HEAVYIRON_MOD,
|
||||
ATKINSON
|
||||
};
|
||||
|
||||
enum BUF2D_OPT_CROP {
|
||||
BUF2D_OPT_CROP_TOP = 1,
|
||||
BUF2D_OPT_CROP_LEFT = 2,
|
||||
BUF2D_OPT_CROP_BOTTOM = 4,
|
||||
BUF2D_OPT_CROP_RIGHT = 8
|
||||
BUF2D_OPT_CROP_TOP = 1,
|
||||
BUF2D_OPT_CROP_LEFT = 2,
|
||||
BUF2D_OPT_CROP_BOTTOM = 4,
|
||||
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);
|
||||
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 *)_ksys_alloc(sizeof(buf2d_struct));
|
||||
new_buf2d_struct -> left = tlx;
|
||||
new_buf2d_struct -> top = tly;
|
||||
new_buf2d_struct -> width = sizex;
|
||||
new_buf2d_struct -> height = sizey;
|
||||
new_buf2d_struct -> bgcolor = font_bgcolor;
|
||||
new_buf2d_struct -> color_bit = color_bit;
|
||||
buf2d_create_asm(new_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;
|
||||
new_buf2d_struct->height = sizey;
|
||||
new_buf2d_struct->bgcolor = font_bgcolor;
|
||||
new_buf2d_struct->color_bit = color_bit;
|
||||
buf2d_create_asm(new_buf2d_struct);
|
||||
return new_buf2d_struct;
|
||||
}
|
||||
|
||||
void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
|
||||
void buf2d_curve_bezier(buf2d_struct* buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
|
||||
{
|
||||
buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
|
||||
buf2d_curve_bezier_asm(buf, (p0_x << 16) + p0_y, (p1_x << 16) + p1_y, (p2_x << 16) + p2_y, color);
|
||||
}
|
||||
|
||||
extern void __stdcall (*buf2d_draw)(buf2d_struct *);
|
||||
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);
|
||||
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 */
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NOT_SUCCESS 0
|
||||
#define SUCCESS 1
|
||||
#define SUCCESS 1
|
||||
|
||||
char sz_com_area_name[] = "FFFFFFFF_open_dialog";
|
||||
char sz_com_area_name[] = "FFFFFFFF_open_dialog";
|
||||
char sz_dir_default_path[] = "/sys";
|
||||
char sz_start_path[] = "/sys/File managers/opendial";
|
||||
char sz_start_path[] = "/sys/File managers/opendial";
|
||||
|
||||
char cd_com_area_name[] = "FFFFFFFF_color_dialog";
|
||||
char cd_start_path[] = "/sys/colrdial";
|
||||
char cd_com_area_name[] = "FFFFFFFF_color_dialog";
|
||||
char cd_start_path[] = "/sys/colrdial";
|
||||
|
||||
enum open_dialog_mode {
|
||||
OPEN,
|
||||
@@ -20,9 +20,9 @@ enum open_dialog_mode {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
unsigned int size;
|
||||
unsigned char end;
|
||||
}od_filter __attribute__ ((__packed__));
|
||||
unsigned int size;
|
||||
unsigned char end;
|
||||
} od_filter __attribute__((__packed__));
|
||||
|
||||
typedef struct {
|
||||
unsigned int mode;
|
||||
@@ -41,10 +41,9 @@ typedef struct {
|
||||
unsigned short x_start;
|
||||
unsigned short y_size;
|
||||
unsigned short y_start;
|
||||
}open_dialog __attribute__ ((__packed__));
|
||||
} open_dialog __attribute__((__packed__));
|
||||
|
||||
|
||||
typedef struct{
|
||||
typedef struct {
|
||||
unsigned int type;
|
||||
char* procinfo;
|
||||
char* com_area_name;
|
||||
@@ -58,70 +57,70 @@ typedef struct{
|
||||
unsigned short y_start;
|
||||
unsigned int color_type;
|
||||
unsigned int color;
|
||||
}color_dialog __attribute__ ((__packed__));
|
||||
} color_dialog __attribute__((__packed__));
|
||||
|
||||
void fake_on_redraw(void) {}
|
||||
void fake_on_redraw(void) { }
|
||||
|
||||
open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
||||
{
|
||||
open_dialog *new_opendialog = (open_dialog *)malloc(sizeof(open_dialog));
|
||||
od_filter *new_od_filter = (od_filter *)malloc(sizeof(od_filter));
|
||||
char *plugin_path = (char *)calloc(4096, sizeof(char));
|
||||
char *openfile_path = (char *)calloc(4096, sizeof(char));
|
||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
||||
char *filename_area = (char *)calloc(256, sizeof(char));
|
||||
open_dialog* new_opendialog = (open_dialog*)malloc(sizeof(open_dialog));
|
||||
od_filter* new_od_filter = (od_filter*)malloc(sizeof(od_filter));
|
||||
char* plugin_path = (char*)calloc(4096, sizeof(char));
|
||||
char* openfile_path = (char*)calloc(4096, sizeof(char));
|
||||
char* proc_info = (char*)calloc(1024, sizeof(char));
|
||||
char* filename_area = (char*)calloc(256, sizeof(char));
|
||||
|
||||
new_od_filter -> size = 0;
|
||||
new_od_filter -> end = 0;
|
||||
new_od_filter->size = 0;
|
||||
new_od_filter->end = 0;
|
||||
|
||||
new_opendialog -> mode = mode;
|
||||
new_opendialog -> procinfo = proc_info;
|
||||
new_opendialog -> com_area_name = sz_com_area_name;
|
||||
new_opendialog -> com_area = 0;
|
||||
new_opendialog -> opendir_path = plugin_path;
|
||||
new_opendialog -> dir_default_path = sz_dir_default_path;
|
||||
new_opendialog -> start_path = sz_start_path;
|
||||
new_opendialog -> draw_window = &fake_on_redraw;
|
||||
new_opendialog -> status = 0;
|
||||
new_opendialog -> openfile_path = openfile_path;
|
||||
new_opendialog -> filename_area = filename_area;
|
||||
new_opendialog -> filter_area = new_od_filter;
|
||||
new_opendialog -> x_size = x_size;
|
||||
new_opendialog -> x_start = tlx;
|
||||
new_opendialog -> y_size = y_size;
|
||||
new_opendialog -> y_start = tly;
|
||||
return new_opendialog;
|
||||
new_opendialog->mode = mode;
|
||||
new_opendialog->procinfo = proc_info;
|
||||
new_opendialog->com_area_name = sz_com_area_name;
|
||||
new_opendialog->com_area = 0;
|
||||
new_opendialog->opendir_path = plugin_path;
|
||||
new_opendialog->dir_default_path = sz_dir_default_path;
|
||||
new_opendialog->start_path = sz_start_path;
|
||||
new_opendialog->draw_window = &fake_on_redraw;
|
||||
new_opendialog->status = 0;
|
||||
new_opendialog->openfile_path = openfile_path;
|
||||
new_opendialog->filename_area = filename_area;
|
||||
new_opendialog->filter_area = new_od_filter;
|
||||
new_opendialog->x_size = x_size;
|
||||
new_opendialog->x_start = tlx;
|
||||
new_opendialog->y_size = y_size;
|
||||
new_opendialog->y_start = tly;
|
||||
return new_opendialog;
|
||||
}
|
||||
|
||||
void cd_fake_on_redraw(void) {}
|
||||
void cd_fake_on_redraw(void) { }
|
||||
|
||||
color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
||||
{
|
||||
color_dialog *new_colordialog = (color_dialog *)malloc(sizeof(color_dialog));
|
||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
||||
color_dialog* new_colordialog = (color_dialog*)malloc(sizeof(color_dialog));
|
||||
char* proc_info = (char*)calloc(1024, sizeof(char));
|
||||
|
||||
new_colordialog -> type = type;
|
||||
new_colordialog -> procinfo = proc_info;
|
||||
new_colordialog -> com_area_name = cd_com_area_name;
|
||||
new_colordialog -> com_area = 0;
|
||||
new_colordialog -> start_path = cd_start_path;
|
||||
new_colordialog -> draw_window = &cd_fake_on_redraw;
|
||||
new_colordialog -> status = 0;
|
||||
new_colordialog -> x_size = x_size;
|
||||
new_colordialog -> x_start = tlx;
|
||||
new_colordialog -> y_size = y_size;
|
||||
new_colordialog -> y_start = tly;
|
||||
new_colordialog -> color_type = 0;
|
||||
new_colordialog -> color = 0;
|
||||
return new_colordialog;
|
||||
new_colordialog->type = type;
|
||||
new_colordialog->procinfo = proc_info;
|
||||
new_colordialog->com_area_name = cd_com_area_name;
|
||||
new_colordialog->com_area = 0;
|
||||
new_colordialog->start_path = cd_start_path;
|
||||
new_colordialog->draw_window = &cd_fake_on_redraw;
|
||||
new_colordialog->status = 0;
|
||||
new_colordialog->x_size = x_size;
|
||||
new_colordialog->x_start = tlx;
|
||||
new_colordialog->y_size = y_size;
|
||||
new_colordialog->y_start = tly;
|
||||
new_colordialog->color_type = 0;
|
||||
new_colordialog->color = 0;
|
||||
return new_colordialog;
|
||||
}
|
||||
|
||||
void kolibri_dialog_init();
|
||||
|
||||
extern void __stdcall (*OpenDialog_init)(open_dialog *);
|
||||
extern 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 *);
|
||||
extern void __stdcall (*ColorDialog_init)(color_dialog*);
|
||||
extern void __stdcall (*ColorDialog_start)(color_dialog*);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#ifndef KOLIBRI_GB_H
|
||||
#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)
|
||||
|
||||
void gb_pixel_set(GB_BMP *b, int x, int y, unsigned c);
|
||||
int gb_pixel_get(GB_BMP *b, int x, int y, unsigned *c);
|
||||
void gb_line(GB_BMP *b, int x1, int y1, int x2, int y2, unsigned c);
|
||||
void gb_rect(GB_BMP *b, int x, int y, int w, int h, unsigned c);
|
||||
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);
|
||||
void gb_pixel_set(GB_BMP* b, int x, int y, unsigned c);
|
||||
int gb_pixel_get(GB_BMP* b, int x, int y, unsigned* c);
|
||||
void gb_line(GB_BMP* b, int x1, int y1, int x2, int y2, unsigned c);
|
||||
void gb_rect(GB_BMP* b, int x, int y, int w, int h, unsigned c);
|
||||
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
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
|
||||
This is adapded thunk for console.obj sys library
|
||||
.h is equal to svn:\programs\develop\libraries\console\console_en.txt
|
||||
.h is equal to svn:\programs\develop\libraries\console\console_en.txt
|
||||
|
||||
Adapted for tcc by Siemargl, 2016
|
||||
|
||||
@@ -15,19 +14,19 @@ Adapted for tcc by Siemargl, 2016
|
||||
console.obj exports the following functions
|
||||
*/
|
||||
|
||||
typedef unsigned int dword; /* 32-bit unsigned integer */
|
||||
typedef unsigned int dword; /* 32-bit unsigned integer */
|
||||
typedef unsigned short word; /* 16-bit unsigned integer */
|
||||
|
||||
#define CON_WINDOW_CLOSED 0x200
|
||||
#define CON_COLOR_BLUE 0x01
|
||||
#define CON_COLOR_GREEN 0x02
|
||||
#define CON_COLOR_RED 0x04
|
||||
#define CON_COLOR_BRIGHT 0x08
|
||||
#define CON_COLOR_BLUE 0x01
|
||||
#define CON_COLOR_GREEN 0x02
|
||||
#define CON_COLOR_RED 0x04
|
||||
#define CON_COLOR_BRIGHT 0x08
|
||||
/* background color */
|
||||
|
||||
#define CON_BGR_BLUE 0x10
|
||||
#define CON_BGR_GREEN 0x20
|
||||
#define CON_BGR_RED 0x40
|
||||
#define CON_BGR_BLUE 0x10
|
||||
#define CON_BGR_GREEN 0x20
|
||||
#define CON_BGR_RED 0x40
|
||||
#define CON_BGR_BRIGHT 0x80
|
||||
/* output controls */
|
||||
|
||||
@@ -35,25 +34,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 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 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
|
||||
|
||||
@@ -8,37 +8,37 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define __ALNUM 1
|
||||
#define __ALPHA 2
|
||||
#define __CNTRL 4
|
||||
#define __DIGIT 8
|
||||
#define __GRAPH 16
|
||||
#define __LOWER 32
|
||||
#define __PRINT 64
|
||||
#define __PUNCT 128
|
||||
#define __BLANK 256
|
||||
#define __UPPER 512
|
||||
#define __ALNUM 1
|
||||
#define __ALPHA 2
|
||||
#define __CNTRL 4
|
||||
#define __DIGIT 8
|
||||
#define __GRAPH 16
|
||||
#define __LOWER 32
|
||||
#define __PRINT 64
|
||||
#define __PUNCT 128
|
||||
#define __BLANK 256
|
||||
#define __UPPER 512
|
||||
#define __XDIGIT 1024
|
||||
|
||||
#ifdef _BUILD_LIBC
|
||||
#ifdef _BUILD_LIBC
|
||||
extern unsigned short __is[129];
|
||||
#else
|
||||
extern unsigned short *__is;
|
||||
extern unsigned short* __is;
|
||||
#endif
|
||||
|
||||
#define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
|
||||
#define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
|
||||
#define iscntrl(c)(__is[c+1] & __CNTRL ) /* 0-31, 127 */
|
||||
#define isdigit(c)(__is[c+1] & __DIGIT ) /* '0'-'9' */
|
||||
#define isgraph(c)(__is[c+1] & __GRAPH ) /* '!'-'~' */
|
||||
#define islower(c)(__is[c+1] & __LOWER ) /* 'a'-'z' */
|
||||
#define isprint(c)(__is[c+1] & __PRINT ) /* ' '-'~' */
|
||||
#define ispunct(c)(__is[c+1] & __PUNCT ) /* !alnum && !cntrl && !space */
|
||||
#define isspace(c)(__is[c+1] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
|
||||
#define isupper(c)(__is[c+1] & __UPPER ) /* 'A'-'Z' */
|
||||
#define isxdigit(c)(__is[c+1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
|
||||
#define isalnum(c) (__is[c + 1] & __ALNUM) /* 'a'-'z', 'A'-'Z', '0'-'9' */
|
||||
#define isalpha(c) (__is[c + 1] & __ALPHA) /* 'a'-'z', 'A'-'Z' */
|
||||
#define iscntrl(c) (__is[c + 1] & __CNTRL) /* 0-31, 127 */
|
||||
#define isdigit(c) (__is[c + 1] & __DIGIT) /* '0'-'9' */
|
||||
#define isgraph(c) (__is[c + 1] & __GRAPH) /* '!'-'~' */
|
||||
#define islower(c) (__is[c + 1] & __LOWER) /* 'a'-'z' */
|
||||
#define isprint(c) (__is[c + 1] & __PRINT) /* ' '-'~' */
|
||||
#define ispunct(c) (__is[c + 1] & __PUNCT) /* !alnum && !cntrl && !space */
|
||||
#define isspace(c) (__is[c + 1] & __BLANK) /* HT, LF, VT, FF, CR, ' ' */
|
||||
#define isupper(c) (__is[c + 1] & __UPPER) /* 'A'-'Z' */
|
||||
#define isxdigit(c) (__is[c + 1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
|
||||
|
||||
#define isascii(c) (!((c)&(~0x7f)))
|
||||
#define isascii(c) (!((c) & (~0x7f)))
|
||||
#define toascii(c) ((c)&0x7f)
|
||||
|
||||
extern int _FUNC(tolower)(int c);
|
||||
|
||||
@@ -3,148 +3,58 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _BUILD_LIBC
|
||||
extern int _errno;
|
||||
#define errno _errno
|
||||
#define errno __errno
|
||||
extern int __errno;
|
||||
#else
|
||||
extern int* _errno;
|
||||
#define errno *_errno
|
||||
extern int* __errno;
|
||||
#define errno *__errno
|
||||
#endif
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* Device not configured */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EDEADLK 11 /* Resource deadlock avoided */
|
||||
/* 11 was EAGAIN */
|
||||
#define ENOMEM 12 /* Cannot allocate memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device / Resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* Operation not supported by device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate ioctl for device */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define ENOTSUP 2 // Function is not supported
|
||||
#define EUNKNFS 3 // Unknown file system
|
||||
#define ENOTFOUND 5 // File not found
|
||||
#define EEOF 6 // End of file
|
||||
#define EFAULT 7 // Pointer lies outside of application memory
|
||||
#define EDQUOT 8 // Disk is full
|
||||
#define EFS 9 // File system error
|
||||
#define EACCES 10 // Access denied
|
||||
#define EDEV 11 // Device error
|
||||
#define ENOMEMFS 12 // File system requires more memory
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33 /* Numerical argument out of domain */
|
||||
#define ERANGE 34 /* Result too large */
|
||||
#define ENOMEM 30 // Not enough memory
|
||||
#define ENOEXEC 31 // Is not executable
|
||||
#define EPROCLIM 32 // Too many processes
|
||||
#define EINVAL 33 // Invalid argument
|
||||
|
||||
/* non-blocking and interrupt i/o */
|
||||
#define EAGAIN 35 /* Resource temporarily unavailable */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define EINPROGRESS 36 /* Operation now in progress */
|
||||
#define EALREADY 37 /* Operation already in progress */
|
||||
#define EDOM 50 // Numerical argument out of domain
|
||||
#define ERANGE 51 // Result too large
|
||||
#define EILSEQ 52 // Illegal byte sequence
|
||||
|
||||
/* ipc/network software -- argument errors */
|
||||
#define ENOTSOCK 38 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 39 /* Destination address required */
|
||||
#define EMSGSIZE 40 /* Message too long */
|
||||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 42 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 43 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
|
||||
#define ENOTSUP 45 /* Operation not supported */
|
||||
#define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */
|
||||
#define EPFNOSUPPORT 46 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
||||
#define EADDRINUSE 48 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
|
||||
#define ENOBUFS 60 // Broken buffer
|
||||
#define EINPROGRESS 61 // Operation now in progress
|
||||
#define EOPNOTSUPP 62 // Operation not supported on transport endpoint
|
||||
#define EWOULDBLOCK 63 // Operation would block
|
||||
#define ENOTCONN 64 // Transport endpoint is not connected
|
||||
#define EALREADY 65 // Operation already in progress
|
||||
#define EMSGSIZE 66 // Message too long
|
||||
#define EADDRINUSE 67 // Address already in use
|
||||
#define ECONNREFUSED 68 // Connection refused
|
||||
#define ECONNRESET 69 // Connection reset by peer
|
||||
#define EISCONN 70 // Transport endpoint is already connected
|
||||
#define ETIMEDOUT 71 // Connection timed out
|
||||
#define ECONNABORTED 72 // Software caused connection abort
|
||||
|
||||
/* ipc/network software -- operational errors */
|
||||
#define ENETDOWN 50 /* Network is down */
|
||||
#define ENETUNREACH 51 /* Network is unreachable */
|
||||
#define ENETRESET 52 /* Network dropped connection on reset */
|
||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
||||
#define ECONNRESET 54 /* Connection reset by peer */
|
||||
#define ENOBUFS 55 /* No buffer space available */
|
||||
#define EISCONN 56 /* Socket is already connected */
|
||||
#define ENOTCONN 57 /* Socket is not connected */
|
||||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
|
||||
#define ETOOMANYREFS 59 /* Too many references: can't splice */
|
||||
#define ETIMEDOUT 60 /* Operation timed out */
|
||||
#define ECONNREFUSED 61 /* Connection refused */
|
||||
#define ELOOP 62 /* Too many levels of symbolic links */
|
||||
#define ENAMETOOLONG 63 /* File name too long */
|
||||
/*
|
||||
* UNIX-like errno
|
||||
* Will be removed after changing STDIO.
|
||||
*/
|
||||
|
||||
/* should be rearranged */
|
||||
#define EHOSTDOWN 64 /* Host is down */
|
||||
#define EHOSTUNREACH 65 /* No route to host */
|
||||
#define ENOTEMPTY 66 /* Directory not empty */
|
||||
|
||||
/* quotas & mush */
|
||||
#define EPROCLIM 67 /* Too many processes */
|
||||
#define EUSERS 68 /* Too many users */
|
||||
#define EDQUOT 69 /* Disc quota exceeded */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE 70 /* Stale NFS file handle */
|
||||
#define EREMOTE 71 /* Too many levels of remote in path */
|
||||
#define EBADRPC 72 /* RPC struct is bad */
|
||||
#define ERPCMISMATCH 73 /* RPC version wrong */
|
||||
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
|
||||
#define EPROGMISMATCH 75 /* Program version wrong */
|
||||
#define EPROCUNAVAIL 76 /* Bad procedure for program */
|
||||
#define ENOLCK 77 /* No locks available */
|
||||
#define ENOSYS 78 /* Function not implemented */
|
||||
#define EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define EAUTH 80 /* Authentication error */
|
||||
#define ENEEDAUTH 81 /* Need authenticator */
|
||||
|
||||
/* Intelligent device errors */
|
||||
#define EPWROFF 82 /* Device power is off */
|
||||
#define EDEVERR 83 /* Device error, e.g. paper out */
|
||||
#define EOVERFLOW 84 /* Value too large to be stored in data type */
|
||||
|
||||
/* Program loading errors */
|
||||
#define EBADEXEC 85 /* Bad executable */
|
||||
#define EBADARCH 86 /* Bad CPU type in executable */
|
||||
#define ESHLIBVERS 87 /* Shared library version mismatch */
|
||||
#define EBADMACHO 88 /* Malformed Macho file */
|
||||
#define ECANCELED 89 /* Operation canceled */
|
||||
#define EIDRM 90 /* Identifier removed */
|
||||
#define ENOMSG 91 /* No message of desired type */
|
||||
#define EILSEQ 92 /* Illegal byte sequence */
|
||||
#define ENOATTR 93 /* Attribute not found */
|
||||
#define EBADMSG 94 /* Bad message */
|
||||
#define EMULTIHOP 95 /* Reserved */
|
||||
#define ENODATA 96 /* No message available on STREAM */
|
||||
#define ENOLINK 97 /* Reserved */
|
||||
#define ENOSR 98 /* No STREAM resources */
|
||||
#define ENOSTR 99 /* Not a STREAM */
|
||||
#define EPROTO 100 /* Protocol error */
|
||||
#define ETIME 101 /* STREAM ioctl timeout */
|
||||
#define ENOPOLICY 103 /* No such policy registered */
|
||||
#define ENOTRECOVERABLE 104 /* State not recoverable */
|
||||
#define EOWNERDEAD 105 /* Previous owner died */
|
||||
#define EQFULL 106 /* Interface output queue is full */
|
||||
#define ELAST 106 /* Must be equal largest errno */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define ENOTDIR 80
|
||||
#define EBADF 81
|
||||
#define EIO 82
|
||||
#define EISDIR 83
|
||||
#define ENOENT 84
|
||||
#define EOVERFLOW 85
|
||||
|
||||
#endif // _ERRNO_H_
|
||||
|
||||
@@ -4,62 +4,62 @@
|
||||
#define FLT_RADIX 2
|
||||
|
||||
/* IEEE float */
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_DIG 6
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
#define FLT_MIN_EXP (-125)
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_DIG 6
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
#define FLT_MIN_EXP (-125)
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
/* IEEE double */
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
/* horrible intel long double */
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
|
||||
#define LDBL_MANT_DIG 64
|
||||
#define LDBL_DIG 18
|
||||
#define LDBL_EPSILON 1.08420217248550443401e-19L
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.36210314311209350626e-4932L
|
||||
#define LDBL_MANT_DIG 64
|
||||
#define LDBL_DIG 18
|
||||
#define LDBL_EPSILON 1.08420217248550443401e-19L
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.36210314311209350626e-4932L
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.18973149535723176502e+4932L
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.18973149535723176502e+4932L
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
|
||||
#else
|
||||
|
||||
/* same as IEEE double */
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 2.2204460492503131e-16
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MIN 2.2250738585072014e-308
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 2.2204460492503131e-16
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MIN 2.2250738585072014e-308
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MAX 1.7976931348623157e+308
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MAX 1.7976931348623157e+308
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NAN
|
||||
# define NAN (__nan__)
|
||||
#define NAN (__nan__)
|
||||
#endif
|
||||
|
||||
#ifndef INFINITY
|
||||
# define INFINITY (__inf__)
|
||||
#define INFINITY (__inf__)
|
||||
#endif
|
||||
|
||||
#endif /* _FLOAT_H_ */
|
||||
|
||||
@@ -1,44 +1,43 @@
|
||||
#ifndef _LIMITS_H_
|
||||
#define _LIMITS_H_
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define CHAR_MAX 127
|
||||
#define CHAR_MIN (-128)
|
||||
#define INT_MAX 2147483647
|
||||
#define INT_MIN (-2147483647-1)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define LONG_MIN (-2147483647L-1L)
|
||||
#define MB_LEN_MAX 5
|
||||
#define SCHAR_MAX 127
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SHRT_MAX 32767
|
||||
#define SHRT_MIN (-32768)
|
||||
#define UCHAR_MAX 255
|
||||
#define UINT_MAX 4294967295U
|
||||
#define ULONG_MAX 4294967295UL
|
||||
#define USHRT_MAX 65535
|
||||
#define WCHAR_MIN 0
|
||||
#define WCHAR_MAX 127
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX 32767
|
||||
#define SSIZE_MAX 2147483647
|
||||
|
||||
#define LLONG_MIN (-9223372036854775807LL-1LL)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define CHAR_MAX 127
|
||||
#define CHAR_MIN (-128)
|
||||
#define INT_MAX 2147483647
|
||||
#define INT_MIN (-2147483647 - 1)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define LONG_MIN (-2147483647L - 1L)
|
||||
#define MB_LEN_MAX 5
|
||||
#define SCHAR_MAX 127
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SHRT_MAX 32767
|
||||
#define SHRT_MIN (-32768)
|
||||
#define UCHAR_MAX 255
|
||||
#define UINT_MAX 4294967295U
|
||||
#define ULONG_MAX 4294967295UL
|
||||
#define USHRT_MAX 65535
|
||||
#define WCHAR_MIN 0
|
||||
#define WCHAR_MAX 127
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX 32767
|
||||
#define SSIZE_MAX 2147483647
|
||||
|
||||
#define LLONG_MIN (-9223372036854775807LL - 1LL)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* gnuc ones */
|
||||
#define LONG_LONG_MIN LLONG_MIN
|
||||
#define LONG_LONG_MAX LLONG_MAX
|
||||
#define ULONG_LONG_MAX ULLONG_MAX
|
||||
|
||||
#define LONG_LONG_MIN LLONG_MIN
|
||||
#define LONG_LONG_MAX LLONG_MAX
|
||||
#define ULONG_LONG_MAX ULLONG_MAX
|
||||
|
||||
#ifndef ARG_MAX
|
||||
#define ARG_MAX 4096
|
||||
#define ARG_MAX 4096
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifndef STDIO_MAX_MEM
|
||||
|
||||
@@ -6,166 +6,59 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
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(log10)(double _x);
|
||||
extern double _FUNC(modf)(double _x, double* _pint);
|
||||
extern double _FUNC(pow)(double _x, double _y);
|
||||
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);
|
||||
|
||||
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(log10)(double _x);
|
||||
extern double _FUNC(modf)(double _x, double *_pint);
|
||||
extern double _FUNC(pow)(double _x, double _y);
|
||||
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);
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#define PI M_PI
|
||||
#define PI2 M_PI_2
|
||||
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#define PI M_PI
|
||||
#define PI2 M_PI_2
|
||||
|
||||
extern double _FUNC(acosh)(double);
|
||||
extern double _FUNC(asinh)(double);
|
||||
extern double _FUNC(atanh)(double);
|
||||
extern double _FUNC(cbrt)(double);
|
||||
extern double _FUNC(exp10)(double _x);
|
||||
extern double _FUNC(exp2)(double _x);
|
||||
extern double _FUNC(expm1)(double);
|
||||
extern double _FUNC(hypot)(double, double);
|
||||
extern double _FUNC(log1p)(double);
|
||||
extern double _FUNC(log2)(double _x);
|
||||
extern long double _FUNC(modfl)(long double _x, long double *_pint);
|
||||
extern double _FUNC(pow10)(double _x);
|
||||
extern double _FUNC(pow2)(double _x);
|
||||
extern double _FUNC(powi)(double, int);
|
||||
extern void _FUNC(sincos)(double, double *, double *);
|
||||
|
||||
/* These are in libm.a (Cygnus). You must link -lm to get these */
|
||||
/* See libm/math.h for comments */
|
||||
|
||||
#ifndef __cplusplus
|
||||
struct exception {
|
||||
int type;
|
||||
const char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
int err;
|
||||
int type;
|
||||
const char* name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
int err;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern double _FUNC(erf)(double);
|
||||
extern double _FUNC(erfc)(double);
|
||||
extern double _FUNC(gamma)(double);
|
||||
extern int _FUNC(isinf)(double);
|
||||
extern int _FUNC(isnan)(double);
|
||||
extern int _FUNC(finite)(double);
|
||||
extern double _FUNC(j0)(double);
|
||||
extern double _FUNC(j1)(double);
|
||||
extern double _FUNC(jn)(int, double);
|
||||
extern double _FUNC(lgamma)(double);
|
||||
extern double _FUNC(nan)(const char*);
|
||||
extern double _FUNC(y0)(double);
|
||||
extern double _FUNC(y1)(double);
|
||||
extern double _FUNC(yn)(int, double);
|
||||
extern double _FUNC(logb)(double);
|
||||
extern double _FUNC(nextafter)(double, double);
|
||||
extern double _FUNC(remainder)(double, double);
|
||||
extern double _FUNC(scalb)(double, double);
|
||||
#ifndef __cplusplus
|
||||
extern int _FUNC(matherr)(struct exception *);
|
||||
#endif
|
||||
extern double _FUNC(significand)(double);
|
||||
extern double _FUNC(copysign)(double, double);
|
||||
extern int _FUNC(ilogb)(double);
|
||||
extern double _FUNC(rint)(double);
|
||||
extern double _FUNC(scalbn)(double, int);
|
||||
extern double _FUNC(drem)(double, double);
|
||||
extern double _FUNC(gamma_r)(double, int *);
|
||||
extern double _FUNC(lgamma_r)(double, int *);
|
||||
extern float _FUNC(acosf)(float);
|
||||
extern float _FUNC(asinf)(float);
|
||||
extern float _FUNC(atanf)(float);
|
||||
extern float _FUNC(atan2f)(float, float);
|
||||
extern float _FUNC(cosf)(float);
|
||||
extern float _FUNC(sinf)(float);
|
||||
extern float _FUNC(tanf)(float);
|
||||
extern float _FUNC(coshf)(float);
|
||||
extern float _FUNC(sinhf)(float);
|
||||
extern float _FUNC(tanhf)(float);
|
||||
extern float _FUNC(expf)(float);
|
||||
extern float _FUNC(frexpf)(float, int *);
|
||||
extern float _FUNC(ldexpf)(float, int);
|
||||
extern float _FUNC(logf)(float);
|
||||
extern float _FUNC(log10f)(float);
|
||||
extern float _FUNC(modff)(float, float *);
|
||||
extern float _FUNC(powf)(float, float);
|
||||
extern float _FUNC(sqrtf)(float);
|
||||
extern float _FUNC(ceilf)(float);
|
||||
extern float _FUNC(fabsf)(float);
|
||||
extern float _FUNC(floorf)(float);
|
||||
extern float _FUNC(fmodf)(float, float);
|
||||
extern float _FUNC(erff)(float);
|
||||
extern float _FUNC(erfcf)(float);
|
||||
extern float _FUNC(gammaf)(float);
|
||||
extern float _FUNC(hypotf)(float, float);
|
||||
extern int _FUNC(isinff)(float);
|
||||
extern int _FUNC(isnanf)(float);
|
||||
extern int _FUNC(finitef)(float);
|
||||
extern float _FUNC(j0f)(float);
|
||||
extern float _FUNC(j1f)(float);
|
||||
extern float _FUNC(jnf)(int, float);
|
||||
extern float _FUNC(lgammaf)(float);
|
||||
extern float _FUNC(nanf)(const char*);
|
||||
extern float _FUNC(y0f)(float);
|
||||
extern float _FUNC(y1f)(float);
|
||||
extern float _FUNC(ynf)(int, float);
|
||||
extern float _FUNC(acoshf)(float);
|
||||
extern float _FUNC(asinhf)(float);
|
||||
extern float _FUNC(atanhf)(float);
|
||||
extern float _FUNC(cbrtf)(float);
|
||||
extern float _FUNC(logbf)(float);
|
||||
extern float _FUNC(nextafterf)(float, float);
|
||||
extern float _FUNC(remainderf)(float, float);
|
||||
extern float _FUNC(scalbf)(float, float);
|
||||
extern float _FUNC(significandf)(float);
|
||||
extern float _FUNC(copysignf)(float, float);
|
||||
extern int _FUNC(ilogbf)(float);
|
||||
extern float _FUNC(rintf)(float);
|
||||
extern float _FUNC(scalbnf)(float, int);
|
||||
extern float _FUNC(dremf)(float, float);
|
||||
extern float _FUNC(expm1f)(float);
|
||||
extern float _FUNC(log1pf)(float);
|
||||
extern float _FUNC(gammaf_r)(float, int *);
|
||||
extern float _FUNC(lgammaf_r)(float, int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MATH_H_ */
|
||||
@@ -6,9 +6,9 @@
|
||||
typedef unsigned long __jmp_buf[6];
|
||||
|
||||
typedef struct __jmp_buf_tag {
|
||||
__jmp_buf __jb;
|
||||
unsigned long __fl;
|
||||
unsigned long __ss[128/sizeof(long)];
|
||||
__jmp_buf __jb;
|
||||
unsigned long __fl;
|
||||
unsigned long __ss[128 / sizeof(long)];
|
||||
} jmp_buf[1];
|
||||
|
||||
extern int _FUNC(setjmp)(jmp_buf env);
|
||||
|
||||
@@ -3,35 +3,37 @@
|
||||
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define SHELL_OK 0
|
||||
#define SHELL_EXIT 1
|
||||
#define SHELL_PUTC 2
|
||||
#define SHELL_PUTS 3
|
||||
#define SHELL_GETC 4
|
||||
#define SHELL_GETS 5
|
||||
#define SHELL_CLS 6
|
||||
#define SHELL_PID 7
|
||||
#define SHELL_PING 8
|
||||
#define SHELL_OK 0
|
||||
#define SHELL_EXIT 1
|
||||
#define SHELL_PUTC 2
|
||||
#define SHELL_PUTS 3
|
||||
#define SHELL_GETC 4
|
||||
#define SHELL_GETS 5
|
||||
#define SHELL_CLS 6
|
||||
#define SHELL_PID 7
|
||||
#define SHELL_PING 8
|
||||
|
||||
#define SHELL_SHM_MAX 1024*16
|
||||
#define SHELL_SHM_MAX 1024 * 16
|
||||
|
||||
extern char __shell_shm_name[32];
|
||||
extern char *__shell_shm;
|
||||
extern char __shell_shm_name[32];
|
||||
extern char* __shell_shm;
|
||||
extern int __shell_is_init;
|
||||
extern void __shell_init();
|
||||
|
||||
#define __SHELL_WAIT() while (*__shell_shm) _ksys_delay(5)
|
||||
#define __SHELL_WAIT() \
|
||||
while (*__shell_shm) \
|
||||
_ksys_delay(5)
|
||||
|
||||
extern int shell_ping();
|
||||
extern int shell_ping();
|
||||
extern unsigned shell_get_pid();
|
||||
extern void shell_exit();
|
||||
|
||||
extern char shell_getc();
|
||||
extern void shell_gets(char *str, int n);
|
||||
extern void shell_gets(char* str, int n);
|
||||
|
||||
extern void shell_putc(char c);
|
||||
extern void shell_puts(const char *str);
|
||||
extern void shell_printf(const char *format,...);
|
||||
extern void shell_puts(const char* str);
|
||||
extern void shell_printf(const char* format, ...);
|
||||
|
||||
extern void shell_cls();
|
||||
#endif
|
||||
|
||||
@@ -3,75 +3,14 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __x86_64__
|
||||
#ifndef _WIN64
|
||||
|
||||
//This should be in sync with the declaration on our lib/libtcc1.c
|
||||
/* GCC compatible definition of va_list. */
|
||||
typedef struct {
|
||||
unsigned int gp_offset;
|
||||
unsigned int fp_offset;
|
||||
union {
|
||||
unsigned int overflow_offset;
|
||||
char *overflow_arg_area;
|
||||
};
|
||||
char *reg_save_area;
|
||||
} __va_list_struct;
|
||||
|
||||
typedef __va_list_struct va_list[1];
|
||||
|
||||
extern void _FUNC(__va_start)(__va_list_struct *ap, void *fp);
|
||||
extern void* _FUNC(__va_arg)(__va_list_struct *ap, int arg_type, int size, int align);
|
||||
|
||||
#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
|
||||
#define va_arg(ap, type) \
|
||||
(*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type))))
|
||||
#define va_copy(dest, src) (*(dest) = *(src))
|
||||
#define va_end(ap)
|
||||
|
||||
#else /* _WIN64 */
|
||||
typedef char *va_list;
|
||||
#define va_start(ap,last) __builtin_va_start(ap,last)
|
||||
#define va_arg(ap,type) (ap += 8, sizeof(type)<=8 ? *(type*)ap : **(type**)ap)
|
||||
#define va_copy(dest, src) ((dest) = (src))
|
||||
#define va_end(ap)
|
||||
#endif
|
||||
|
||||
#elif __arm__
|
||||
typedef char *va_list;
|
||||
#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
|
||||
#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
|
||||
& ~(_tcc_alignof(type) - 1))
|
||||
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
||||
#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
|
||||
&~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
|
||||
typedef char* va_list;
|
||||
#define va_start(ap, last) ap = ((char*)&(last)) + ((sizeof(last) + 3) & ~3)
|
||||
#define va_arg(ap, type) (ap += (sizeof(type) + 3) & ~3, *(type*)(ap - ((sizeof(type) + 3) & ~3)))
|
||||
#define va_copy(dest, src) (dest) = (src)
|
||||
#define va_end(ap)
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
typedef struct {
|
||||
void *__stack;
|
||||
void *__gr_top;
|
||||
void *__vr_top;
|
||||
int __gr_offs;
|
||||
int __vr_offs;
|
||||
} va_list;
|
||||
#define va_start(ap, last) __va_start(ap, last)
|
||||
#define va_arg(ap, type) __va_arg(ap, type)
|
||||
#define va_end(ap)
|
||||
#define va_copy(dest, src) ((dest) = (src))
|
||||
|
||||
#else /* __i386__ */
|
||||
typedef char *va_list;
|
||||
/* only correct for i386 */
|
||||
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
||||
#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
|
||||
#define va_copy(dest, src) (dest) = (src)
|
||||
#define va_end(ap)
|
||||
#endif
|
||||
|
||||
/* fix a buggy dependency on GCC in libio.h */
|
||||
typedef va_list __gnuc_va_list;
|
||||
#define _VA_LIST_DEFINED
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
#endif /* _STDARG_H */
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
/* ISOC99 boolean */
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* _STDBOOL_H */
|
||||
|
||||
@@ -8,38 +8,24 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __PTRDIFF_TYPE__ intptr_t;
|
||||
typedef __SIZE_TYPE__ uintptr_t;
|
||||
|
||||
#ifndef __int8_t_defined
|
||||
#define __int8_t_defined
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
#ifdef _BUILD_LIBC
|
||||
#define _FUNC(func) func
|
||||
#define _FUNC(func) func
|
||||
#else
|
||||
#define _FUNC(func) (*func)
|
||||
#define _FUNC(func) (*func)
|
||||
#endif
|
||||
|
||||
#define offsetof(type, field) ((size_t)&((type *)0)->field)
|
||||
#define offsetof(type, field) ((size_t) & ((type*)0)->field)
|
||||
|
||||
#ifndef __stdcall
|
||||
#define __stdcall __attribute__((stdcall))
|
||||
#define __stdcall __attribute__((stdcall))
|
||||
#endif
|
||||
|
||||
#ifndef __cdecl
|
||||
#define __cdecl __attribute__((cdecl))
|
||||
#define __cdecl __attribute__((cdecl))
|
||||
#endif
|
||||
|
||||
#endif /* _STDDEF_H_ */
|
||||
@@ -3,32 +3,36 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define INT8_MIN (-128)
|
||||
#define INT8_MAX (127)
|
||||
#define UINT8_MAX (255)
|
||||
#define INT8_MIN (-128)
|
||||
#define INT8_MAX (127)
|
||||
#define UINT8_MAX (255)
|
||||
|
||||
#define INT16_MIN (-32768)
|
||||
#define INT16_MAX (32767)
|
||||
#define UINT16_MAX (65535)
|
||||
#define INT16_MIN (-32768)
|
||||
#define INT16_MAX (32767)
|
||||
#define UINT16_MAX (65535)
|
||||
|
||||
#define INT32_MIN (-2147483647L-1)
|
||||
#define INT32_MAX (2147483647L)
|
||||
#define UINT32_MAX (4294967295UL)
|
||||
#define INT32_MIN (-2147483647L - 1)
|
||||
#define INT32_MAX (2147483647L)
|
||||
#define UINT32_MAX (4294967295UL)
|
||||
|
||||
#if __have_long64
|
||||
#define INT64_MIN (-9223372036854775807L-1L)
|
||||
#define INT64_MAX (9223372036854775807L)
|
||||
#define UINT64_MAX (18446744073709551615U)
|
||||
#elif __have_longlong64
|
||||
#define INT64_MIN (-9223372036854775807LL-1LL)
|
||||
#define INT64_MAX (9223372036854775807LL)
|
||||
#define UINT64_MAX (18446744073709551615ULL)
|
||||
#else
|
||||
#define INT64_MAX 0x7fffffffffffffffLL
|
||||
#define INT64_MIN (-INT64_MAX - 1LL)
|
||||
#define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
|
||||
#define INT64_MAX 0x7fffffffffffffffLL
|
||||
#define INT64_MIN (-INT64_MAX - 1LL)
|
||||
#define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
|
||||
|
||||
#ifndef __int8_t_defined
|
||||
#define __int8_t_defined
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
|
||||
#endif /* _STDINT_H_*/
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -35,29 +35,29 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
extern void _FUNC(debug_printf)(const char* format, ...);
|
||||
|
||||
typedef size_t fpos_t;
|
||||
|
||||
#define _FILEMODE_R 1 << 0 // Read
|
||||
#define _FILEMODE_W 1 << 1 // Write
|
||||
#define _FILEMODE_A 1 << 2 // Append
|
||||
#define _FILEMODE_PLUS 1 << 3 // Plus
|
||||
#define _FILEMODE_R 1 << 0 // Read
|
||||
#define _FILEMODE_W 1 << 1 // Write
|
||||
#define _FILEMODE_A 1 << 2 // Append
|
||||
#define _FILEMODE_PLUS 1 << 3 // Plus
|
||||
|
||||
typedef struct FILE_s {
|
||||
char *name;
|
||||
char* name;
|
||||
fpos_t position;
|
||||
int error;
|
||||
int eof;
|
||||
int mode; // flags _FILEMODE_*
|
||||
int mode; // flags _FILEMODE_*
|
||||
int __ungetc_emu_buff; // Uses __ungetc_emu (temporary solution!)
|
||||
} FILE;
|
||||
|
||||
@@ -82,58 +82,58 @@ typedef struct FILE_s {
|
||||
#define TMP_MAX FOPEN_MAX
|
||||
|
||||
#define stderr (FILE*)3
|
||||
#define stdin (FILE*)1
|
||||
#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);
|
||||
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);
|
||||
|
||||
extern int _FUNC(remove)(const char *);
|
||||
extern int _FUNC(rename)(const char *, const char *);
|
||||
extern FILE* _FUNC(tmpfile)(void);
|
||||
extern char* _FUNC(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*);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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 *);
|
||||
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*);
|
||||
|
||||
extern void _FUNC(clearerr)(FILE *);
|
||||
extern int _FUNC(feof)(FILE *);
|
||||
extern int _FUNC(ferror)(FILE *);
|
||||
extern void _FUNC(perror)(const char *);
|
||||
extern void _FUNC(clearerr)(FILE*);
|
||||
extern int _FUNC(feof)(FILE*);
|
||||
extern int _FUNC(ferror)(FILE*);
|
||||
extern void _FUNC(perror)(const char*);
|
||||
|
||||
extern size_t _FUNC(fread)(void *restrict, size_t, size_t, FILE *restrict);
|
||||
extern size_t _FUNC(fread)(void* restrict, size_t, size_t, FILE* restrict);
|
||||
|
||||
extern int _FUNC(getchar)(void);
|
||||
extern int _FUNC(getchar)(void);
|
||||
|
||||
#endif // _STDIO_H_
|
||||
#endif // _STDIO_H_
|
||||
|
||||
@@ -3,69 +3,69 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define RAND_MAX 65535
|
||||
#define RAND_MAX 65535
|
||||
#ifndef NULL
|
||||
# define NULL ((void*)0)
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
#define min(a, b) ((a)<(b) ? (a) : (b))
|
||||
#define max(a, b) ((a)>(b) ? (a) : (b))
|
||||
|
||||
extern int _FUNC(atoi)(const char *s);
|
||||
extern long _FUNC(atol)(const char *);
|
||||
extern long long _FUNC(atoll)(const char *);
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
|
||||
typedef struct {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
typedef struct {
|
||||
long long quot;
|
||||
long long rem;
|
||||
} lldiv_t;
|
||||
|
||||
static inline div_t div(int num, int den)
|
||||
{
|
||||
return (div_t) { num / den, num % den };
|
||||
}
|
||||
|
||||
static inline ldiv_t ldiv(long num, long den)
|
||||
{
|
||||
return (ldiv_t) { num / den, num % den };
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
extern long int _FUNC(strtol)(const char* str, char** endptr, int base);
|
||||
|
||||
extern void _FUNC(exit)(int status);
|
||||
|
||||
extern void _FUNC(srand)(unsigned s);
|
||||
extern int _FUNC(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*));
|
||||
|
||||
extern double _FUNC(strtod)(const char* s, char** sret);
|
||||
extern double _FUNC(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);
|
||||
|
||||
extern int _FUNC(abs)(int);
|
||||
extern long _FUNC(labs)(long);
|
||||
extern long long _FUNC(llabs)(long long);
|
||||
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
|
||||
typedef struct {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
typedef struct {
|
||||
long long quot;
|
||||
long long rem;
|
||||
} lldiv_t;
|
||||
|
||||
static inline
|
||||
div_t div(int num, int den) {
|
||||
return (div_t){ num/den, num%den };
|
||||
}
|
||||
|
||||
static inline
|
||||
ldiv_t ldiv(long num, long den) {
|
||||
return (ldiv_t){ num/den, num%den };
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
extern long int _FUNC(strtol)(const char* str, char** endptr, int base);
|
||||
|
||||
extern void _FUNC(exit)(int status);
|
||||
|
||||
extern void _FUNC(srand)(unsigned s);
|
||||
extern int _FUNC(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 *));
|
||||
|
||||
extern double _FUNC(strtod)(const char *s, char **sret);
|
||||
extern double _FUNC(atof)(const char *ascii);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,34 +1,9 @@
|
||||
/* String handling <string.h>
|
||||
|
||||
This file is part of the Public Domain C Library (PDCLib).
|
||||
Permission is granted to use, modify, and / or redistribute at will.
|
||||
*/
|
||||
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* String function conventions */
|
||||
|
||||
/*
|
||||
In any of the following functions taking a size_t n to specify the length of
|
||||
an array or size of a memory region, n may be 0, but the pointer arguments to
|
||||
the call shall still be valid unless otherwise stated.
|
||||
*/
|
||||
|
||||
/* Copying functions */
|
||||
|
||||
extern void* _FUNC(memccpy)(void *restrict dest, const void *restrict src, int c, size_t n);
|
||||
|
||||
/* Copy a number of n characters from the memory area pointed to by s2 to the
|
||||
area pointed to by s1. If the two areas overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
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);
|
||||
@@ -40,142 +15,26 @@ extern void* _FUNC(memset)(void* s, int c, size_t n);
|
||||
extern void* _FUNC(memmove)(void* s1, const void* s2, size_t n);
|
||||
#endif
|
||||
|
||||
/* Copy the character array s2 (including terminating '\0' byte) into the
|
||||
character array s1.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strcpy)(char* s1, const char* s2);
|
||||
|
||||
/* Copy a maximum of n characters from the character array s2 into the character
|
||||
array s1. If s2 is shorter than n characters, '\0' bytes will be appended to
|
||||
the copy in s1 until n characters have been written. If s2 is longer than n
|
||||
characters, NO terminating '\0' will be written to s1. If the arrays overlap,
|
||||
behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strcpy)(char* s1, const char* s2);
|
||||
extern char* _FUNC(strncpy)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Concatenation functions */
|
||||
|
||||
/* Append the contents of the character array s2 (including terminating '\0') to
|
||||
the character array s1 (first character of s2 overwriting the '\0' of s1). If
|
||||
the arrays overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strcat)(char* s1, const char* s2);
|
||||
|
||||
/* Append a maximum of n characters from the character array s2 to the character
|
||||
array s1 (first character of s2 overwriting the '\0' of s1). A terminating
|
||||
'\0' is ALWAYS appended, even if the full n characters have already been
|
||||
written. If the arrays overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strncat)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Comparison functions */
|
||||
|
||||
/* Compare the first n characters of the memory areas pointed to by s1 and s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(memcmp)(const void * s1, const void* s2, size_t n);
|
||||
|
||||
/* Compare the character arrays s1 and s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(strcmp)(const char * s1, const char* s2);
|
||||
|
||||
/* Compare the character arrays s1 and s2, interpreted as specified by the
|
||||
LC_COLLATE category of the current locale.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
TODO: Currently a dummy wrapper for strcmp() as PDCLib does not yet support
|
||||
locales.
|
||||
*/
|
||||
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);
|
||||
|
||||
/* Compare no more than the first n characters of the character arrays s1 and
|
||||
s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(strncmp)(const char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Transform the character array s2 as appropriate for the LC_COLLATE setting of
|
||||
the current locale. If length of resulting string is less than n, store it in
|
||||
the character array pointed to by s1. Return the length of the resulting
|
||||
string.
|
||||
*/
|
||||
extern size_t _FUNC(strxfrm)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Search functions */
|
||||
|
||||
/* Search the first n characters in the memory area pointed to by s for the
|
||||
character c (interpreted as unsigned char).
|
||||
Returns a pointer to the first instance found, or NULL.
|
||||
*/
|
||||
extern void* _FUNC(memchr)(const void* s, int c, size_t n);
|
||||
|
||||
/* Search the character array s (including terminating '\0') for the character c
|
||||
(interpreted as char).
|
||||
Returns a pointer to the first instance found, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strchr)(const char* s, int c);
|
||||
|
||||
/* Determine the length of the initial substring of character array s1 which
|
||||
consists only of characters not from the character array s2.
|
||||
Returns the length of that substring.
|
||||
*/
|
||||
extern size_t _FUNC(strcspn)(const char* s1, const char* s2);
|
||||
|
||||
/* Search the character array s1 for any character from the character array s2.
|
||||
Returns a pointer to the first occurrence, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strpbrk)(const char* s1, const char* s2);
|
||||
|
||||
/* Search the character array s (including terminating '\0') for the character c
|
||||
(interpreted as char).
|
||||
Returns a pointer to the last instance found, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strrchr)(const char * s, int c );
|
||||
|
||||
/* Determine the length of the initial substring of character array s1 which
|
||||
consists only of characters from the character array s2.
|
||||
Returns the length of that substring.
|
||||
*/
|
||||
extern size_t _FUNC(strspn)(const char * s1, const char * s2);
|
||||
|
||||
/* Search the character array s1 for the substring in character array s2.
|
||||
Returns a pointer to that sbstring, or NULL. If s2 is of length zero,
|
||||
returns s1.
|
||||
*/
|
||||
extern char* _FUNC(strstr)(const char * s1, const char * s2);
|
||||
|
||||
/* In a series of subsequent calls, parse a C string into tokens.
|
||||
On the first call to strtok(), the first argument is a pointer to the to-be-
|
||||
parsed C string. On subsequent calls, the first argument is NULL unless you
|
||||
want to start parsing a new string. s2 holds an array of separator characters
|
||||
which can differ from call to call. Leading separators are skipped, the first
|
||||
trailing separator overwritten with '\0'.
|
||||
Returns a pointer to the next token.
|
||||
WARNING: This function uses static storage, and as such is not reentrant.
|
||||
*/
|
||||
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);
|
||||
|
||||
/* Map an error number to a (locale-specific) error message string. Error
|
||||
numbers are typically errno values, but any number is mapped to a message.
|
||||
TODO: PDCLib does not yet support locales.
|
||||
*/
|
||||
extern char* _FUNC(strerror)(int errnum);
|
||||
|
||||
/* Returns the length of the string s (excluding terminating '\0').*/
|
||||
extern size_t _FUNC(strlen)(const char * s);
|
||||
|
||||
/* The function reverses the sequence of characters in the string pointed to by str. */
|
||||
extern char* _FUNC(strrev)(char *str);
|
||||
|
||||
/* The strdup function executes the function pointed to by the str argument. */
|
||||
extern char* _FUNC(strdup)(const char *str);
|
||||
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
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
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);
|
||||
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
|
||||
@@ -3,32 +3,31 @@
|
||||
#ifndef _DIRENT_H_
|
||||
#define _DIRENT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define IS_FOLDER 16
|
||||
#define IS_FILE 0
|
||||
#define IS_FILE 0
|
||||
|
||||
typedef unsigned ino_t;
|
||||
|
||||
struct dirent{
|
||||
ino_t d_ino; //File serial number.
|
||||
char d_name[PATH_MAX]; // Name of entry.
|
||||
unsigned d_type;
|
||||
struct dirent {
|
||||
ino_t d_ino; //File serial number.
|
||||
char d_name[PATH_MAX]; // Name of entry.
|
||||
unsigned d_type;
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
struct dirent* objs;
|
||||
typedef struct {
|
||||
struct dirent* objs;
|
||||
ino_t pos;
|
||||
ino_t num_objs;
|
||||
}DIR;
|
||||
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);
|
||||
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_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,89 +3,89 @@
|
||||
#ifndef _SOCKET_H_
|
||||
#define _SOCKET_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <errno.h>
|
||||
|
||||
// Socket Types
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
|
||||
// IP protocols
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_ICMP 1
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_UDP 17
|
||||
#define IPPROTO_RAW 255
|
||||
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_UDP 17
|
||||
#define IPPROTO_RAW 255
|
||||
|
||||
// IP options
|
||||
#define IP_TTL 2
|
||||
|
||||
|
||||
// Address families
|
||||
#define AF_UNSPEC 0
|
||||
#define AF_LOCAL 1
|
||||
#define AF_INET 2 // Default INET=IPv4
|
||||
#define AF_INET4 2 // IPv4
|
||||
#define AF_INET6 10 // IPv6
|
||||
#define AF_LOCAL 1
|
||||
#define AF_INET 2 // Default INET=IPv4
|
||||
#define AF_INET4 2 // IPv4
|
||||
#define AF_INET6 10 // IPv6
|
||||
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
#define PF_LOCAL AF_LOCAL
|
||||
#define PF_INET4 AF_INET4
|
||||
#define PF_INET6 AF_INET6
|
||||
|
||||
|
||||
// internal definition
|
||||
#define AI_SUPPORTED 0x40F
|
||||
|
||||
// for system function 76
|
||||
#define API_ETH (0<<16)
|
||||
#define API_IPv4 (1<<16)
|
||||
#define API_ICMP (2<<16)
|
||||
#define API_UDP (3<<16)
|
||||
#define API_TCP (4<<16)
|
||||
#define API_ARP (5<<16)
|
||||
#define API_PPPOE (6<<16)
|
||||
#define API_ETH (0 << 16)
|
||||
#define API_IPv4 (1 << 16)
|
||||
#define API_ICMP (2 << 16)
|
||||
#define API_UDP (3 << 16)
|
||||
#define API_TCP (4 << 16)
|
||||
#define API_ARP (5 << 16)
|
||||
#define API_PPPOE (6 << 16)
|
||||
|
||||
// Socket flags for user calls
|
||||
#define MSG_NOFLAG 0
|
||||
#define MSG_PEEK 0x02
|
||||
#define MSG_NOFLAG 0
|
||||
#define MSG_PEEK 0x02
|
||||
#define MSG_DONTWAIT 0x40
|
||||
|
||||
|
||||
// Socket levels
|
||||
#define SOL_SOCKET 0xffff
|
||||
|
||||
//Socket options
|
||||
#define SO_BINDTODEVICE (1<<9)
|
||||
#define SO_NONBLOCK (1<<31)
|
||||
// Socket options
|
||||
#define SO_BINDTODEVICE (1 << 9)
|
||||
#define SO_NONBLOCK (1 << 31)
|
||||
|
||||
#define PORT(X) (X<<8)
|
||||
#define PORT(X) (X << 8)
|
||||
|
||||
#pragma pack(push,1)
|
||||
struct sockaddr{
|
||||
#pragma pack(push, 1)
|
||||
struct sockaddr {
|
||||
unsigned short sin_family;
|
||||
unsigned short sin_port;
|
||||
unsigned short sin_port;
|
||||
unsigned int sin_addr;
|
||||
unsigned long long sin_zero;
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
unsigned int level;
|
||||
unsigned int optionname;
|
||||
unsigned int optlenght;
|
||||
unsigned char options;
|
||||
}optstruct;
|
||||
typedef struct {
|
||||
unsigned int level;
|
||||
unsigned int optionname;
|
||||
unsigned int optlenght;
|
||||
unsigned char options;
|
||||
} 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(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(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);
|
||||
extern int _FUNC(socketpair)(int* socket1, int* socket2);
|
||||
|
||||
#endif //_SOCKET_H_
|
||||
#endif //_SOCKET_H_
|
||||
@@ -5,27 +5,27 @@
|
||||
|
||||
typedef unsigned long int clock_t;
|
||||
typedef unsigned long int time_t;
|
||||
#define clock() _ksys_get_clock()
|
||||
#define clock() _ksys_get_clock()
|
||||
#define CLOCKS_PER_SEC 100
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct tm {
|
||||
int tm_sec; /* seconds after the minute 0-61*/
|
||||
int tm_min; /* minutes after the hour 0-59 */
|
||||
int tm_hour; /* hours since midnight 0-23 */
|
||||
int tm_mday; /* day of the month 1-31 */
|
||||
int tm_mon; /* months since January 0-11 */
|
||||
int tm_year; /* years since 1900 */
|
||||
int tm_wday; /* days since Sunday 0-6 */
|
||||
int tm_yday; /* days since January 1 0-365 */
|
||||
int tm_isdst; /* Daylight Saving Time flag */
|
||||
int tm_sec; /* seconds after the minute 0-61*/
|
||||
int tm_min; /* minutes after the hour 0-59 */
|
||||
int tm_hour; /* hours since midnight 0-23 */
|
||||
int tm_mday; /* day of the month 1-31 */
|
||||
int tm_mon; /* months since January 0-11 */
|
||||
int tm_year; /* years since 1900 */
|
||||
int tm_wday; /* days since Sunday 0-6 */
|
||||
int tm_yday; /* days since January 1 0-365 */
|
||||
int tm_isdst; /* Daylight Saving Time flag */
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
extern time_t _FUNC(mktime)(struct tm * timeptr);
|
||||
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 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);
|
||||
extern char* _FUNC(asctime)(const struct tm* tm);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user