diff --git a/programs/develop/ktcc/trunk/libc/include/conio.h b/programs/develop/ktcc/trunk/libc/include/conio.h index 2f339b8354..5c231bd7af 100644 --- a/programs/develop/ktcc/trunk/libc/include/conio.h +++ b/programs/develop/ktcc/trunk/libc/include/conio.h @@ -15,7 +15,7 @@ Adapted for tcc by Siemargl, 2016 /* console.obj exports the following functions */ -typedef unsigned long dword; /* 32-bit unsigned integer */ +typedef unsigned int dword; /* 32-bit unsigned integer */ typedef unsigned short word; /* 16-bit unsigned integer */ extern void stdcall (*con_init)(dword wnd_width, dword wnd_height, @@ -194,4 +194,10 @@ extern int con_init_console_dll(void); called automatic in printf, otherwise, see __console_initdll_status */ +extern int con_init_console_dll_param(dword wnd_width, dword wnd_height, + dword scr_width, dword scr_height, const char* title); +/* work as con_init_console_dll, but call con_init with params +*/ + + #endif diff --git a/programs/develop/ktcc/trunk/libc/include/ctype.h b/programs/develop/ktcc/trunk/libc/include/ctype.h index 565aaaa75f..c6fd00cd1a 100644 --- a/programs/develop/ktcc/trunk/libc/include/ctype.h +++ b/programs/develop/ktcc/trunk/libc/include/ctype.h @@ -18,7 +18,7 @@ #define __UPPER 512 #define __XDIGIT 1024 -extern unsigned short __is[128]; +extern unsigned short __is[129]; #define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */ #define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */ diff --git a/programs/develop/ktcc/trunk/libc/include/kos32sys0.h b/programs/develop/ktcc/trunk/libc/include/kos32sys0.h deleted file mode 100644 index 55c3f9d5a4..0000000000 --- a/programs/develop/ktcc/trunk/libc/include/kos32sys0.h +++ /dev/null @@ -1,800 +0,0 @@ -#ifndef __KOS_32_SYS_H__ -#define __KOS_32_SYS_H__ - -// file header taken from newlib -// added many sys functions, compatible with tcc - -//#include -//#include -#include -#include -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned long long uint64_t; - -#ifdef __cplusplus -extern "C" { -#endif - -//#ifdef CONFIG_DEBUF -// #define DBG(format,...) printf(format,##__VA_ARGS__) -//#else -// #define DBG(format,...) -//#endif - -#define TYPE_3_BORDER_WIDTH 5 -#define WIN_STATE_MINIMIZED 0x02 -#define WIN_STATE_ROLLED 0x04 -#define POS_SCREEN 0 -#define POS_WINDOW 1 - -#define IPC_NOBUFFER 1 -#define IPC_LOCKED 2 -#define IPC_OVERFLOW 3 -#define IPC_NOPID 4 - -#define SHM_OPEN 0x00 -#define SHM_OPEN_ALWAYS 0x04 -#define SHM_CREATE 0x08 -#define SHM_READ 0x00 -#define SHM_WRITE 0x01 - - - -typedef unsigned int color_t; - - -typedef union __attribute__((packed)) pos_t -{ - uint32_t val; - struct - { - short x; - short y; - }; -} pos_t; - - -typedef union __attribute__((packed)) oskey_t -{ - uint32_t val; - struct - { - uint8_t state; - uint8_t code; - uint16_t ctrl_key; - }; -} oskey_t; - -typedef struct -{ - unsigned handle; - unsigned io_code; - void *input; - int inp_size; - void *output; - int out_size; -}ioctl_t; - -typedef union -{ - struct - { - void *data; - size_t size; - } x; - unsigned long long raw; -}ufile_t; - -struct kolibri_system_colors { - color_t frame_area; - color_t grab_bar; - color_t grab_bar_button; - color_t grab_button_text; - color_t grab_text; - color_t work_area; - color_t work_button; - color_t work_button_text; - color_t work_text; - color_t work_graph; -}; - - -struct blit_call -{ - int dstx; - int dsty; - int w; - int h; - - int srcx; - int srcy; - int srcw; - int srch; - - void *bitmap; - int stride; -}; - -struct ipc_message -{ - uint32_t pid; // PID of sending thread - uint32_t datalen; // data bytes - char data[0]; // data begin -}; - -struct ipc_buffer -{ - uint32_t lock; // nonzero is locked - uint32_t used; // used bytes in buffer - struct ipc_message data[0]; // data begin -}; - -static inline void begin_draw(void) -{ - __asm__ __volatile__( - "int $0x40" ::"a"(12),"b"(1)); -}; - -static inline -void end_draw(void) -{ - __asm__ __volatile__( - "int $0x40" ::"a"(12),"b"(2)); -}; - -static inline -void sys_create_window(int x, int y, int w, int h, const char *name, - color_t workcolor, uint32_t style) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(0), - "b"((x << 16) | ((w-1) & 0xFFFF)), - "c"((y << 16) | ((h-1) & 0xFFFF)), - "d"((style << 24) | (workcolor & 0xFFFFFF)), - "D"(name), - "S"(0) : "memory"); -}; - -static inline -void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(8), - "b"(x_w), - "c"(y_h), - "d"(id), - "S"(color)); -}; - -static inline -void draw_line(int xs, int ys, int xe, int ye, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(38), "d"(color), - "b"((xs << 16) | xe), - "c"((ys << 16) | ye)); -} - -static inline -void draw_bar(int x, int y, int w, int h, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(13), "d"(color), - "b"((x << 16) | w), - "c"((y << 16) | h)); -} - -static inline -void draw_bitmap(void *bitmap, int x, int y, int w, int h) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(7), "b"(bitmap), - "c"((w << 16) | h), - "d"((x << 16) | y)); -} - -static inline -void draw_text_sys(const char *text, int x, int y, int len, color_t color) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(4),"d"(text), - "b"((x << 16) | y), - "S"(len),"c"(color) - :"memory"); -} - -static inline -uint32_t get_skin_height(void) -{ - uint32_t height; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(height) - :"a"(48),"b"(4)); - return height; -}; - -static inline -pos_t get_mouse_pos(int origin) -{ - pos_t val; - - __asm__ __volatile__( - "int $0x40 \n\t" - "rol $16, %%eax" - :"=a"(val) - :"a"(37),"b"(origin)); - return val; -} - -static inline -uint32_t get_mouse_buttons(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37),"b"(2)); - return val; -}; - -static inline -uint32_t get_mouse_wheels(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(val) - :"a"(37),"b"(7)); - return val; -}; - -static inline uint32_t load_cursor(void *path, uint32_t flags) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37), "b"(4), "c"(path), "d"(flags)); - return val; -} - -static inline uint32_t set_cursor(uint32_t cursor) -{ - uint32_t old; - __asm__ __volatile__( - "int $0x40" - :"=a"(old) - :"a"(37), "b"(5), "c"(cursor)); - return old; -}; - -static inline int destroy_cursor(uint32_t cursor) -{ - int ret; - __asm__ __volatile__( - "int $0x40" - :"=a"(ret) - :"a"(37), "b"(6), "c"(cursor) - :"memory"); - return ret; -}; - - -static inline -uint32_t wait_for_event(uint32_t time) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(23), "b"(time)); - return val; -}; - -static inline uint32_t check_os_event() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(11)); - return val; -}; - -static inline uint32_t get_os_event() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(10)); - return val; -}; - -static inline -uint32_t get_tick_count(void) -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(26),"b"(9)); - return val; -}; - -static inline -uint64_t get_ns_count(void) -{ - uint64_t val; - __asm__ __volatile__( - "int $0x40" - :"=A"(val) - :"a"(26), "b"(10)); - return val; -}; - -static inline -oskey_t get_key(void) -{ - oskey_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(2)); - return val; -} - -static inline -uint32_t get_os_button() -{ - uint32_t val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(17)); - return val>>8; -}; - -static inline uint32_t get_service(char *name) -{ - uint32_t retval = 0; - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(68),"b"(16),"c"(name) - :"memory"); - - return retval; -}; - -static inline int call_service(ioctl_t *io) -{ - int retval; - - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(68),"b"(17),"c"(io) - :"memory","cc"); - - return retval; -}; - - -static inline void yield(void) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(68), "b"(1)); -}; - -static inline void delay(uint32_t time) -{ - __asm__ __volatile__( - "int $0x40" - ::"a"(5), "b"(time) - :"memory"); -}; - -static inline -void *user_alloc(size_t size) -{ - void *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(12),"c"(size)); - return val; -} - -static inline -int user_free(void *mem) -{ - int val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(13),"c"(mem)); - return val; -} - -static inline -void* user_realloc(void *mem, size_t size) -{ - void *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(20),"c"(size),"d"(mem) - :"memory"); - - return val; -}; - -static inline -int *user_unmap(void *base, size_t offset, size_t size) -{ - int *val; - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size)); - return val; -}; - -static inline ufile_t load_file(const char *path) -{ - ufile_t uf; - - __asm__ __volatile__ ( - "int $0x40" - :"=A"(uf.raw) - :"a" (68), "b"(27),"c"(path)); - - return uf; -}; - -static inline int GetScreenSize() -{ - int retval; - - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(61), "b"(1)); - return retval; -} - - -static inline void get_proc_info(char *info) -{ - __asm__ __volatile__( - "int $0x40" - : - :"a"(9), "b"(info), "c"(-1) - :"memory"); -}; - -static inline void Blit(void *bitmap, int dst_x, int dst_y, - int src_x, int src_y, int w, int h, - int src_w, int src_h, int stride) -{ - volatile struct blit_call bc; - - bc.dstx = dst_x; - bc.dsty = dst_y; - bc.w = w; - bc.h = h; - bc.srcx = src_x; - bc.srcy = src_y; - bc.srcw = src_w; - bc.srch = src_h; - bc.stride = stride; - bc.bitmap = bitmap; - - __asm__ __volatile__( - "int $0x40" - ::"a"(73),"b"(0),"c"(&bc.dstx)); -}; - - -// newlib exclusive -#ifndef __TINYC__ -int create_thread(int (*proc)(void *param), void *param, int stack_size); - -void* load_library(const char *name); - -void* get_proc_address(void *handle, const char *proc_name); - -void enumerate_libraries(int (*callback)(void *handle, const char* name, - uint32_t base, uint32_t size, void *user_data), - void *user_data); -#endif - -// May be next section need to be added in newlibc - -enum KOLIBRI_GUI_EVENTS { - KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */ - KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */ - KOLIBRI_EVENT_KEY = 2, /* A key on the keyboard was pressed */ - KOLIBRI_EVENT_BUTTON = 3, /* A button was clicked with the mouse */ - KOLIBRI_EVENT_DESKTOP = 5, /* Desktop redraw finished */ - KOLIBRI_EVENT_MOUSE = 6, /* Mouse activity (movement, button press) was detected */ - KOLIBRI_EVENT_IPC = 7, /* Interprocess communication notify */ - KOLIBRI_EVENT_NETWORK = 8, /* Network event */ - KOLIBRI_EVENT_DEBUG = 9, /* Debug subsystem event */ - KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */ -}; - - -// copied from /programs/system/shell/system/kolibri.c -// fn's returned -1 as syserror, 1 as error, 0 as OK -static inline -int kol_clip_num() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(0)); - return val; -} - -static inline -char* kol_clip_get(int n) -// returned buffer must be freed by user_free() -{ - register char* val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(1), "c"(n)); - return val; -} - -static inline -int kol_clip_set(int n, char buffer[]) -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(2), "c"(n), "d"(buffer)); - return val; -} - -static inline -int kol_clip_pop() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(3)); - return val; -} - -static inline -int kol_clip_unlock() -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(4)); - return val; -} - -static inline void get_system_colors(struct kolibri_system_colors *color_table) -{ - __asm__ volatile ("int $0x40" - : - :"a"(48),"b"(3),"c"(color_table),"d"(40) - ); - - /* color_table should point to the system color table */ -} - -static inline void debug_board_write_byte(const char ch){ - __asm__ __volatile__( - "int $0x40" - : - :"a"(63), "b"(1), "c"(ch)); -} - - -static inline void draw_number_sys(int32_t number, int x, int y, int len, color_t color){ - register uint32_t fmt; - fmt = len << 16 | 0x80000000; // no leading zeros + width -// fmt = len << 16 | 0x00000000; // leading zeros + width - __asm__ __volatile__( - "int $0x40" - : - :"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color)); -} - -static inline -uint32_t get_mouse_eventstate(void) -{ - uint32_t val; - - __asm__ __volatile__( - "int $0x40" - :"=a"(val) - :"a"(37),"b"(3)); - return val; -}; - -static inline -uint32_t set_event_mask(uint32_t mask) -{ - register uint32_t val; - asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask)); - return val; -} - -typedef void (*thread_proc)(void*); - -static inline -int start_thread(thread_proc proc, char* stack_top) -{ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(51), "b"(1), "c"(proc), "d"(stack_top)); - return val; -} - -static inline -void kos_exit() -{ - asm volatile ("int $0x40"::"a"(-1)); -} - -static inline void focus_window(int slot){ - asm volatile ("int $0x40"::"a"(18), "b"(3), "c"(slot)); -} - -static inline int get_thread_slot(int tid){ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(18), "b"(21), "c"(tid)); - return val; -} - -static inline void set_current_folder(char* dir){ - asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(dir)); -} - -static inline int get_current_folder(char* buf, int bufsize){ - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(30), "b"(2), "c"(buf), "d"(bufsize)); - return val; -} - -static inline -void ipc_set_area(void* buf, int bufsize){ - asm volatile ("int $0x40"::"a"(60), "b"(1), "c"(buf), "d"(bufsize)); -} - -static inline -int ipc_send_message(int pid_reciever, void *data, int datalen) { - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(60), "b"(2), "c"(pid_reciever), "d"(data), "S"(datalen)); - return val; -} - -static inline -void* shm_open(char *shm_name, int msize, int flags, int *retsz){ - register int val, cod; - asm volatile ("int $0x40":"=a"(val),"=d"(cod):"a"(68), "b"(22), "c"(shm_name), "d"(msize), "S"(flags)); - - if(retsz) *retsz = cod; // errcode if NULL or memsize when open - return (void*)val; -} - -static inline -void shm_close(char *shm_name){ - asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(shm_name)); -} - -static inline -int start_app(char *app_name, char *args){ - struct file_op_t - { - uint32_t fn; - uint32_t flags; - char* args; - uint32_t res1, res2; - char zero; - char* app_name __attribute__((packed)); - } file_op; - memset(&file_op, 0, sizeof(file_op)); - file_op.fn = 7; - file_op.args = args; - file_op.app_name = app_name; - - register int val; - asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op)); - - return val; -} - - -/* -static inline char *getcwd(char *buf, size_t size) -{ - int rc = get_current_folder(buf, size); - if (rc > size) - { - errno = ERANGE; - return 0; - } - else - return buf; -} -*/ -// end section - - - -//added nonstatic inline because incomfortabre stepping in in debugger -void __attribute__ ((noinline)) debug_board_write_str(const char* str); -void __attribute__ ((noinline)) debug_board_printf(const char *format,...); - -/* copy body to only one project file -void __attribute__ ((noinline)) debug_board_write_str(const char* str){ - while(*str) - debug_board_write_byte(*str++); -} - -void __attribute__ ((noinline)) debug_board_printf(const char *format,...) -{ - va_list ap; - char log_board[300]; - - va_start (ap, format); - vsnprintf(log_board, sizeof log_board, format, ap); - va_end(ap); - debug_board_write_str(log_board); -} -*/ - - - -// TinyC don't support aliasing of static inline funcs -#ifndef __TINYC__ -static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw"))); -static inline void EndDraw(void) __attribute__ ((alias ("end_draw"))); -static inline void DrawWindow(int x, int y, int w, int h, const char *name, - color_t workcolor, uint32_t style) - __attribute__ ((alias ("sys_create_window"))); -static inline void DefineButton(void) __attribute__ ((alias ("define_button"))); -static inline void DrawLine(int xs, int ys, int xe, int ye, color_t color) - __attribute__ ((alias ("draw_line"))); -static inline void DrawBar(int x, int y, int w, int h, color_t color) - __attribute__ ((alias ("draw_bar"))); -static inline void DrawBitmap(void *bitmap, int x, int y, int w, int h) - __attribute__ ((alias ("draw_bitmap"))); -static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height"))); -static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos"))); -static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons"))); -static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels"))); -static inline uint32_t LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor"))); -static inline uint32_t SetCursor(uint32_t cursor) __attribute__ ((alias ("set_cursor"))); -static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor"))); -static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event"))); -static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc"))); -static inline int UserFree(void *mem) __attribute__ ((alias ("user_free"))); -static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc"))); -static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap"))); -static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file"))); -static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info"))); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif - - - - - diff --git a/programs/develop/ktcc/trunk/libc/include/kos32sys1.h b/programs/develop/ktcc/trunk/libc/include/kos32sys1.h index a2f03ef2b7..55c3f9d5a4 100644 --- a/programs/develop/ktcc/trunk/libc/include/kos32sys1.h +++ b/programs/develop/ktcc/trunk/libc/include/kos32sys1.h @@ -3,8 +3,6 @@ // file header taken from newlib // added many sys functions, compatible with tcc -// with gcc USE gcc -mno-ms-bitfields!!! - //#include //#include @@ -44,6 +42,7 @@ extern "C" { #define SHM_WRITE 0x01 + typedef unsigned int color_t; @@ -133,22 +132,6 @@ struct ipc_buffer struct ipc_message data[0]; // data begin }; - -typedef struct __attribute__((packed)) file_op_t -{ - uint32_t fn; - uint32_t flags; - char* args; - uint32_t res1, res2; - char zero; - char* app_name -#ifdef __TINYC__ - __attribute__((packed)) -#endif -; -} file_op_t; - - static inline void begin_draw(void) { __asm__ __volatile__( @@ -541,11 +524,7 @@ void enumerate_libraries(int (*callback)(void *handle, const char* name, void *user_data); #endif -/////////////////////////////////////////////////////////////////////////////// -/// May be next section need to be added in newlibc -// Siemargl addenium - -#define X_Y(x,y) (((x)<<16)|(y)) +// May be next section need to be added in newlibc enum KOLIBRI_GUI_EVENTS { KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */ @@ -560,107 +539,6 @@ enum KOLIBRI_GUI_EVENTS { KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */ }; -enum control_keys { - KM_SHIFT = 0x00010000, - KM_CTRL = 0x00020000, - KM_ALT = 0x00040000, - KM_NUMLOCK = 0x00080000 -}; - - -struct __attribute__ ((__packed__)) fs_dirinfo { - uint32_t subfn; // 1 read dir - uint32_t start; - uint32_t flags; - uint32_t size; - uint32_t retval; - union { - struct __attribute__ ((__packed__)) { - uint8_t zero; // 0 - char* ppath; - }; - char path[5]; // up to 4096 - } ; -}; - -static inline -uint32_t sf_file(int subfn, struct fs_dirinfo* dinfo) -/// SysFn70 call with subfunction -/// retval 0 if ok -{ - uint32_t retval; - dinfo->subfn = subfn; - - __asm__ __volatile__( - "int $0x40 " - :"=a"(retval) - :"a"(70),"b"(dinfo) - :); - - return retval; -}; - - -struct fs_dirheader { - uint32_t version; // 1 - uint32_t curn_blocks; // number of read dir items (BDFE) - uint32_t totl_blocks; // directory full size - char other[20]; // reserved 0 -}; - -enum filetype -{ - FS_RONLY = 1, - FS_HIDDEN = 2, - FS_SYSTEM = 4, - FS_VOLID = 8, - FS_SUBDIR = 16, - FS_FOLDER = 16, - FS_ARCHIV = 32 -}; - -struct __attribute__ ((__packed__)) fs_filetime { - uint8_t sec; - uint8_t mm; - uint8_t hour; - uint8_t zero; -}; - -struct __attribute__ ((__packed__)) fs_filedate { - uint8_t day; - uint8_t month; - uint16_t year; -}; - -/// directory entry cp866 -struct fsBDFE { - uint32_t filetype; - uint32_t encoding; // 0 - cp866, 1 - utf16le - struct fs_filetime tm_created; - struct fs_filedate dt_created; - struct fs_filetime tm_accessed; - struct fs_filedate dt_accessed; - struct fs_filetime tm_modified; - struct fs_filedate dt_modified; - uint64_t size; - char fname[264]; -}; // must be sized 304 - -/// directory entry UTF16LE -struct fsBDFE_16 { - uint32_t filetype; - uint32_t encoding; // 0 - cp866, 1 - utf16le - struct fs_filetime tm_created; - struct fs_filedate dt_created; - struct fs_filetime tm_accessed; - struct fs_filedate dt_accessed; - struct fs_filetime tm_modified; - struct fs_filedate dt_modified; - uint64_t size; - wchar_t fname[260]; -}; // must be sized 560 - - // copied from /programs/system/shell/system/kolibri.c // fn's returned -1 as syserror, 1 as error, 0 as OK @@ -817,7 +695,15 @@ void shm_close(char *shm_name){ static inline int start_app(char *app_name, char *args){ - file_op_t file_op; + struct file_op_t + { + uint32_t fn; + uint32_t flags; + char* args; + uint32_t res1, res2; + char zero; + char* app_name __attribute__((packed)); + } file_op; memset(&file_op, 0, sizeof(file_op)); file_op.fn = 7; file_op.args = args; @@ -829,55 +715,6 @@ int start_app(char *app_name, char *args){ return val; } -static inline -uint32_t get_control_keys(void) -{ - uint32_t ctrl; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(ctrl) - :"a"(66),"b"(3)); - - return ctrl; -}; - -static inline -int get_keyboard_layout(int opt, char* buf) -/// 128 byte buffer -/// opt: 1 - normal, 2 - shifted, 3 - alted, or 9 - return language -{ - uint32_t lang; - - __asm__ __volatile__( - "int $0x40 \n\t" - :"=a"(lang) - :"a"(26),"b"(2), "c"(opt), "d"(buf)); - - return lang; -}; - - -static inline -int font_size(int color) -/// decode font size in pixels from color as SysFn4 -/// returns (width, hight) -{ - int font = color >> 24; - int font_multipl = (font & 7) + 1; - int width_sym, hight_sym; - - if (font & 0x10) // 8x16 - { - width_sym = 8 * font_multipl; - hight_sym = 16 * font_multipl; - } else // 6x9 - { - width_sym = 6 * font_multipl; - hight_sym = 9 * font_multipl; - } - return hight_sym + (width_sym << 16); -} /* static inline char *getcwd(char *buf, size_t size) @@ -892,28 +729,7 @@ static inline char *getcwd(char *buf, size_t size) return buf; } */ -/* not finished -void staticnum_draw(staticnum *st) -{ - register uint32_t fmt; - if (st->width < 0) - fmt = (-st->width << 16); // leading zeros, decimal - else - fmt = (st->width << 16) | 0x80000000; // no leading zeros, decimal - - __asm__ __volatile__( - "int $0x40" - ::"a"(47), - "b"(fmt), - "c"(st->number), - "d"(st->start_xy), - "S"(st->color_flags), - "D"(st->bg_color) - :); -} - -*/ -//////////// end section +// end section @@ -937,16 +753,6 @@ void __attribute__ ((noinline)) debug_board_printf(const char *format,...) va_end(ap); debug_board_write_str(log_board); } - -__attribute__ ((noinline)) void trap(int n) -{ - // nothing todo, just see n in debugger. use "bp trap" command - __asm__ __volatile__( - "nop" - : - :"a"(n)); -} - */ diff --git a/programs/develop/ktcc/trunk/libc/include/stdint.h b/programs/develop/ktcc/trunk/libc/include/stdint.h new file mode 100644 index 0000000000..d8dcc0f82d --- /dev/null +++ b/programs/develop/ktcc/trunk/libc/include/stdint.h @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/programs/develop/ktcc/trunk/libc/include/stdlib.h b/programs/develop/ktcc/trunk/libc/include/stdlib.h index 1d284fe662..3b127d8bfd 100644 --- a/programs/develop/ktcc/trunk/libc/include/stdlib.h +++ b/programs/develop/ktcc/trunk/libc/include/stdlib.h @@ -19,9 +19,32 @@ extern int atoi(char *s); extern char *itoab(unsigned int n,char* s,int b); extern char *__itoa(int n,char* s); -extern void* stdcall malloc(dword size); -extern void stdcall free(void *pointer); -extern void* stdcall realloc(void* pointer,dword size); +// function using KOS syscalls +extern void* stdcall sysmalloc(dword size); +extern void stdcall sysfree(void *pointer); +extern void* stdcall sysrealloc(void* pointer,dword size); +extern void* syscalloc (size_t num, size_t size); + +// suballocator functions +extern void* wtmalloc(size_t size); +extern void wtfree(void *pointer); +extern void* wtrealloc(void* pointer, size_t size); +extern void* wtcalloc (size_t num, size_t size); +extern int wtmalloc_freelist_check(); +extern int wtmalloc_poiner_check(void *ptr); + +#ifdef USESYSALLOC +#define malloc(x) sysmalloc(x) +#define free(x) sysfree(x) +#define realloc(x,y) sysrealloc(x,y) +#define calloc(x,y) syscalloc(x,y) +#else +#define malloc(x) wtmalloc(x) +#define free(x) wtfree(x) +#define realloc(x,y) wtrealloc(x,y) +#define calloc(x,y) wtcalloc(x,y) +#endif + extern int rand (void); extern void srand (unsigned int seed); @@ -32,7 +55,6 @@ float strtof (const char* str, char** endptr); long int strtol (const char* str, char** endptr, int base); #define strtoul(s, ep, b) ((unsigned long int)strtol(s, ep, b)) -void* calloc (size_t num, size_t size); void exit (int status); /* close console if was initialized, also stay window [finished] when status is error < 0 */ #define abort() exit(-1) diff --git a/programs/develop/ktcc/trunk/libc/include/tcclib.h b/programs/develop/ktcc/trunk/libc/include/tcclib.h deleted file mode 100644 index 8d59e4c9ab..0000000000 --- a/programs/develop/ktcc/trunk/libc/include/tcclib.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Simple libc header for TCC - * - * Add any function you want from the libc there. This file is here - * only for your convenience so that you do not need to put the whole - * glibc include files on your floppy disk - */ -#ifndef _TCCLIB_H -#define _TCCLIB_H - -#include -#include - -/* stdlib.h */ -void *calloc(size_t nmemb, size_t size); -void *malloc(size_t size); -void free(void *ptr); -void *realloc(void *ptr, size_t size); -int atoi(const char *nptr); -long int strtol(const char *nptr, char **endptr, int base); -unsigned long int strtoul(const char *nptr, char **endptr, int base); -void exit(int); - -/* stdio.h */ -typedef struct __FILE FILE; -#define EOF (-1) -extern FILE *stdin; -extern FILE *stdout; -extern FILE *stderr; -FILE *fopen(const char *path, const char *mode); -FILE *fdopen(int fildes, const char *mode); -FILE *freopen(const char *path, const char *mode, FILE *stream); -int fclose(FILE *stream); -size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); -size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream); -int fgetc(FILE *stream); -char *fgets(char *s, int size, FILE *stream); -int getc(FILE *stream); -int getchar(void); -char *gets(char *s); -int ungetc(int c, FILE *stream); -int fflush(FILE *stream); -int putchar (int c); - -int printf(const char *format, ...); -int fprintf(FILE *stream, const char *format, ...); -int sprintf(char *str, const char *format, ...); -int snprintf(char *str, size_t size, const char *format, ...); -int asprintf(char **strp, const char *format, ...); -int dprintf(int fd, const char *format, ...); -int vprintf(const char *format, va_list ap); -int vfprintf(FILE *stream, const char *format, va_list ap); -int vsprintf(char *str, const char *format, va_list ap); -int vsnprintf(char *str, size_t size, const char *format, va_list ap); -int vasprintf(char **strp, const char *format, va_list ap); -int vdprintf(int fd, const char *format, va_list ap); - -void perror(const char *s); - -/* string.h */ -char *strcat(char *dest, const char *src); -char *strchr(const char *s, int c); -char *strrchr(const char *s, int c); -char *strcpy(char *dest, const char *src); -void *memcpy(void *dest, const void *src, size_t n); -void *memmove(void *dest, const void *src, size_t n); -void *memset(void *s, int c, size_t n); -char *strdup(const char *s); -size_t strlen(const char *s); - -/* dlfcn.h */ -#define RTLD_LAZY 0x001 -#define RTLD_NOW 0x002 -#define RTLD_GLOBAL 0x100 - -void *dlopen(const char *filename, int flag); -const char *dlerror(void); -void *dlsym(void *handle, char *symbol); -int dlclose(void *handle); - -#endif /* _TCCLIB_H */ diff --git a/programs/develop/ktcc/trunk/libc/memory/memalloc.asm b/programs/develop/ktcc/trunk/libc/memory/memalloc.asm index 32de642484..9b0a710742 100644 --- a/programs/develop/ktcc/trunk/libc/memory/memalloc.asm +++ b/programs/develop/ktcc/trunk/libc/memory/memalloc.asm @@ -2,12 +2,12 @@ format ELF ;include "proc32.inc" section '.text' executable -public malloc -public free -public realloc +public sysmalloc +public sysfree +public sysrealloc align 4 -malloc: +sysmalloc: push ebx mov eax,68 mov ebx,12 @@ -17,7 +17,7 @@ malloc: ret 4 align 4 -free: +sysfree: push ebx mov eax,68 mov ebx,13 @@ -27,7 +27,7 @@ free: ret 4 align 4 -realloc: +sysrealloc: push ebx mov ebx,20 mov eax,68 diff --git a/programs/develop/ktcc/trunk/libc/memory/watermark.c b/programs/develop/ktcc/trunk/libc/memory/watermark.c new file mode 100644 index 0000000000..cd311b8fe1 --- /dev/null +++ b/programs/develop/ktcc/trunk/libc/memory/watermark.c @@ -0,0 +1,257 @@ +/* + * Easy and fast memory allocator from + * https://wiki.osdev.org/Memory_Allocation + * Coded by Siemargl, 2018 + * + * No Garbage Collector + */ + +#include +#include +#include +#include +#include + +#define UINT_MAX (4294967295U) + +#ifndef NDEBUG +#include +# define TRACE1(s, a) printf(s, a) +# define TRACE2(s, a, b) printf(s, a, b) +#else +# define TRACE1(s, a) (void)0 +# define TRACE2(s, a, b) (void)0 +#endif + +// get address, fromwhere function was called +#define CALLEDFROM(param1) (*(int*)((char*)¶m1-4)-5) + +const uint32_t c_used = 0x44455355; //'USED' +const uint32_t c_free = 0x45455246; //'FREE' + +struct hdrfree { + uint32_t mark; // 'FREE' + size_t size; // including header + struct hdrfree *prev; + struct hdrfree *next; +}; + +struct hdrused { + uint32_t mark; // 'USED' + size_t size; +}; + + +static char *__freebase = NULL; // begin of free area +static char *__freetop = NULL; // after last byte of free area +static struct hdrfree *__firstfree = NULL; // ptr to first node in dual-link list +static unsigned __crtfreeblocks = 0; // number of free blocks, checking corruptions + + +void *wtmalloc(size_t sz) +{ + struct hdrfree *fndnode, *newnode; + sz = (sizeof(struct hdrused) + sz + 15) & ~15; // align 16bytes +//TRACE1("_call alloc(%d)\n", sz); + + // try to find free block enough size + fndnode = __firstfree; + while(fndnode) + { +#ifndef NDEBUG + if (fndnode->mark != c_free) + { + TRACE2("heap free block list corrupt %x EIP@%x\n", fndnode, CALLEDFROM(sz)); + assert(0); + } +#endif + if (fndnode->size >= sz) break; + fndnode = fndnode->next; + } + + if (fndnode) // found free block + { + if (fndnode->size - sz > 15) // split smaller size, move free node + { +//TRACE2("alloc(%d) split (%x)\n", sz, fndnode); + newnode = (struct hdrfree*)((char*)fndnode + sz); + newnode->mark = c_free; + newnode->size = fndnode->size - sz; + newnode->next = fndnode->next; + newnode->prev = fndnode->prev; + + if (fndnode->next) + fndnode->next->prev = newnode; + + //перед может быть не нода, а 1й указатель + if (!fndnode->prev) + __firstfree = newnode; + else + newnode->prev->next = newnode; + } else // nothing to split, just exclude + { +//TRACE1("alloc(%d) remove freenode\n", sz); + + __crtfreeblocks--; + if (fndnode->next) + fndnode->next->prev = fndnode->prev; + //перед может быть не нода, а 1й указатель + if (!fndnode->prev) + __firstfree = fndnode->next; + else + fndnode->prev->next = fndnode->next; + } + + fndnode->mark = c_used; + fndnode->size = sz; + return (char*)fndnode + sizeof(struct hdrused); + } + + char *ptr; + // free block not found, try to add @end + if (__freetop - __freebase < sz) // not enough memory - call system + { + if (sz > UINT_MAX - 16) return NULL; // check 32-bit heap overflow + size_t new_heap_size = (__freetop - __freebase + sz + 4095) & ~4095; + + //хвост сунуть в свободные, а фритоп и базу перености на новый кусок + ptr = sysmalloc(new_heap_size); // rounded 4k +//TRACE2("call systemalloc(%d) returned %x\n", new_heap_size, ptr); + if (!ptr) + { + TRACE2("sysmalloc failed trying to allocate %u bytes EIP@%x\n", sz, CALLEDFROM(sz)); + return NULL; + } + // add new free block in front of list + if (__freetop - __freebase > 15) + { + newnode = (struct hdrfree*)__freebase; + newnode->mark = c_free; + newnode->size = __freetop - __freebase; + newnode->next = __firstfree; + newnode->prev = NULL; + if (__firstfree) + __firstfree->prev = newnode; + __firstfree = newnode; + __crtfreeblocks++; +//TRACE2("alloc(%d) add tail %d to freenode", sz, newnode->size); +//TRACE1(".tail [%x]\n", newnode); + } + // we don't save allocated block from system, so cant free them ltr + + __freebase = ptr; + __freetop = __freebase + new_heap_size; + } + + ptr = __freebase + sizeof(struct hdrused); + ((struct hdrused*)__freebase)->mark = c_used; + ((struct hdrused*)__freebase)->size = sz; + __freebase += sz; +//TRACE1("__freebase [%x]\n", __freebase); + + return ptr; +} + +void wtfree(void *ptr) +{ + if (!ptr) return; + +#ifndef NDEBUG + if (((struct hdrused*)((char*)ptr - 8))->mark != c_used) + { + TRACE2("try free unallocated block ptr = %x bytes EIP@%x\n", ptr, CALLEDFROM(ptr)); + assert(0); + } +#endif + struct hdrfree *newnode = (struct hdrfree*)((char*)ptr - 8); + newnode->mark = c_free; + //size stays + newnode->next = __firstfree; + newnode->prev = NULL; + if (__firstfree) + __firstfree->prev = newnode; + __firstfree = newnode; + __crtfreeblocks++; +//TRACE1("free to freenode\n", 0); +} + + +void *wtrealloc(void *ptr, size_t sz) +{ + if (!ptr) return wtmalloc(sz); + + struct hdrused* oldptr = (struct hdrused*)((char*)ptr - 8); + +#ifndef NDEBUG + if (oldptr->mark != c_used) + { + TRACE2("try realloc unallocated block ptr = %x EIP@%x\n", ptr, CALLEDFROM(ptr)); + assert(0); + } +#endif + + if (oldptr->size - 8 >= sz) return ptr; // enough room in this block, ex from freelist + + void *newptr = wtmalloc(sz); + if (newptr) + { + memcpy(newptr, (char*)oldptr +8, oldptr->size -8); // why -8 dont fail test?!? + wtfree((char*)oldptr +8); + return newptr; + } + + return NULL; +} + +void* wtcalloc( size_t num, size_t size ) +{ + void *newptr = wtmalloc(num * size); + if (newptr) + memset(newptr, 0, num * size); + return newptr; +} + + + + +int wtmalloc_freelist_check() +//контроль целостности списка фри OK == 1 +{ + int cnt = 0; + struct hdrfree *ptr = __firstfree; + + if(ptr && ptr->prev) + { + TRACE1("allocated memory freelist 1st block fail, ptr = %x\n", ptr); + return 0; + } + + for(;ptr; ptr = ptr->next) + { +//TRACE1("(%x)", ptr); + + cnt++; + if (ptr->mark != c_free) + { + TRACE1("allocated memory freelist check fail, ptr = %x\n", ptr); + return 0; + } + } + if (cnt != __crtfreeblocks) + { + TRACE1("allocated memory freelist check fail, length must be = %u\n", __crtfreeblocks); + return 0; + } + return 1; +} + +int wtmalloc_poiner_check(void *ptr) +//контроль указателя - mark OK == 1 +{ + if (((struct hdrused*)((char*)ptr - 8))->mark != c_used) + { + TRACE2("pointer watermark check fail ptr = %x bytes EIP@%x\n", ptr, CALLEDFROM(ptr)); + return 0; + } + return 1; +} diff --git a/programs/develop/ktcc/trunk/libc/start/start.asm b/programs/develop/ktcc/trunk/libc/start/start.asm index 9fdfb991f2..920aa984db 100644 --- a/programs/develop/ktcc/trunk/libc/start/start.asm +++ b/programs/develop/ktcc/trunk/libc/start/start.asm @@ -38,6 +38,9 @@ start: test eax, eax jz .without_path mov eax, path + cmp word ptr eax, 32fh ; '/#3' UTF8 + jne .without_path + mov word ptr eax, 12fh ; '/#1' fix to CP866 .without_path: mov esi, eax call push_param @@ -137,4 +140,4 @@ path rb buf_len params rb buf_len ;section '.data' -;include_debug_strings ; ALWAYS present in data section \ No newline at end of file +;include_debug_strings ; ALWAYS present in data section diff --git a/programs/develop/ktcc/trunk/libc/stdio/conio.c b/programs/develop/ktcc/trunk/libc/stdio/conio.c index 7a86bf8679..a91ca92668 100644 --- a/programs/develop/ktcc/trunk/libc/stdio/conio.c +++ b/programs/develop/ktcc/trunk/libc/stdio/conio.c @@ -73,21 +73,30 @@ void con_lib_link(struct import *exp, char** imports){ int con_init_console_dll(void) +{ + return con_init_console_dll_param(-1, -1, -1, -1, con_caption); +} + + +int con_init_console_dll_param(dword wnd_width, dword wnd_height, + dword scr_width, dword scr_height, const char* title) +/* work as con_init_console_dll, but call con_init with params +*/ { struct import * hDll; if (__console_initdll_status == 1) return 0; - if((hDll = (struct import *)_ksys_cofflib_load(con_dllname)) == 0){ + if((hDll = (struct import *)_ksys_cofflib_load(con_dllname)) == 0){ debug_out_str("can't load lib\n"); return 1; - } - con_lib_link(hDll, con_imports); + } + con_lib_link(hDll, con_imports); - con_init(-1, -1, -1, -1, con_caption); //__argv[0] && __path dont work + con_init(wnd_width, wnd_height, scr_width, scr_height, title); - __console_initdll_status = 1; + __console_initdll_status = 1; - return(0); + return 0; } diff --git a/programs/develop/ktcc/trunk/libc/stdio/fopen.c b/programs/develop/ktcc/trunk/libc/stdio/fopen.c index 840056665b..ef78d97a28 100644 --- a/programs/develop/ktcc/trunk/libc/stdio/fopen.c +++ b/programs/develop/ktcc/trunk/libc/stdio/fopen.c @@ -2,21 +2,28 @@ #include #include +int errno = 0; + +/* +// removed by Seiemargl 26-oct-2018 +// use get_current_folder() from kos32sys.h instead + + extern char __argv; extern char __path; -int errno = 0; - +// convert relative to program path ./file.txt to absolute const char* getfullpath(const char *path){ + int relpath_pos, localpath_size; char *programpath; char *newpath; char *prgname; - if (path[0] == '/') /* root */ + if (path[0] == '/') // { - return(strdup(path)); /* dup need as free in fclose() */ + return(strdup(path)); // dup need as free in fclose() } relpath_pos = 0; @@ -49,7 +56,7 @@ const char* getfullpath(const char *path){ return(newpath); } - +*/ FILE* fopen(const char* filename, const char *mode) @@ -92,7 +99,8 @@ FILE* fopen(const char* filename, const char *mode) if (*mode!=0) return NULL; - fullname = (char*)getfullpath(filename); +// fullname = (char*)getfullpath(filename); + fullname = strdup(filename); if ((imode & 3) == FILE_OPEN_READ && fullname) /* check existense */ { sz = _ksys_get_filesize(fullname); diff --git a/programs/develop/ktcc/trunk/libc/string/calloc.c b/programs/develop/ktcc/trunk/libc/string/calloc.c index 6f2ae76605..b524473683 100644 --- a/programs/develop/ktcc/trunk/libc/string/calloc.c +++ b/programs/develop/ktcc/trunk/libc/string/calloc.c @@ -1,10 +1,10 @@ #include #include -void* calloc (size_t num, size_t size) +void* syscalloc (size_t num, size_t size) { size_t bytes = num * size; - void *p = malloc(bytes); + void *p = sysmalloc(bytes); if(p) memset(p, 0, bytes); diff --git a/programs/develop/ktcc/trunk/libctest/traceadr.c b/programs/develop/ktcc/trunk/libctest/traceadr.c new file mode 100644 index 0000000000..478973808e --- /dev/null +++ b/programs/develop/ktcc/trunk/libctest/traceadr.c @@ -0,0 +1,19 @@ +#include + +# define TRACE1(s, a) printf(s, a) + +void caller(void* ptr) +{ + + ptr = 0xaaaaaaaa; + TRACE1("caller is called from EIP@%x\n", *(int*)((char*)&ptr-4)-5); + +} + + +int main() +{ + + caller(0xffffffff); +} + diff --git a/programs/develop/ktcc/trunk/libctest/wtalloc.c b/programs/develop/ktcc/trunk/libctest/wtalloc.c new file mode 100644 index 0000000000..4575c31b36 --- /dev/null +++ b/programs/develop/ktcc/trunk/libctest/wtalloc.c @@ -0,0 +1,127 @@ +#include +#include +#include +#include + +// suballocator functions +extern void* wtmalloc(size_t size); +extern void wtfree(void *pointer); +extern void* wtrealloc(void* pointer, size_t size); +extern void* wtcalloc (size_t num, size_t size); +extern int wtmalloc_freelist_check(); +extern int wtmalloc_poiner_check(void *ptr); + +#ifdef __GNUC__ +void* sysmalloc(size_t sz) +{ + return malloc(sz); +} +#endif + + + +#define NUMPTR 30000 + +char *pointers[NUMPTR]; +char values[NUMPTR]; +int sizes[NUMPTR]; + +int checkvalues() +{ + for (int i = 0; i < NUMPTR; i++) + { + if (!pointers[i]) continue; + assert(wtmalloc_poiner_check(pointers[i])); + + for (int j = 0; j < sizes[i]; j++) + assert(pointers[i][j] == values[i]); + } + return 1; +} + + +int main() +{ + char *ptr; + int i, sz; + + puts("Test started"); + + // test start settings + assert(wtmalloc_freelist_check()); + // test just single alloc/dealloc + ptr = wtmalloc(1000); + assert(wtmalloc_poiner_check(ptr)); + wtfree(ptr); + assert(wtmalloc_freelist_check()); + + puts("test allocation started"); + // test allocation + for (i = 0; i < NUMPTR; i++) + { + sz = rand() % 1024; + pointers[i] = wtmalloc(sz); + sizes[i] = sz; + values[i] = sz % 256; + memset(pointers[i], values[i], sz); + + assert(wtmalloc_freelist_check()); + } + assert(checkvalues()); + + puts("test random deallocation started"); + // random deallocation + for (i = 0; i < NUMPTR; i++) + { + sz = rand() % 2; + if (sz) + { + wtfree(pointers[i]); + pointers[i] = NULL; + } + } + assert(wtmalloc_freelist_check()); + assert(checkvalues()); + + puts("test allocation in free list gaps started"); + // test allocation in free list gaps + for (i = 0; i < NUMPTR; i++) + { + if (pointers[i]) continue; + + sz = rand() % 1024; + pointers[i] = wtmalloc(sz); + sizes[i] = sz; + values[i] = sz % 256; + memset(pointers[i], values[i], sz); + } + assert(wtmalloc_freelist_check()); + assert(checkvalues()); + + puts("test realloc started"); + // test realloc + for (i = 0; i < NUMPTR; i++) + { + sz = rand() % 1024; + pointers[i] = wtrealloc(pointers[i], sz); + sizes[i] = sz; + memset(pointers[i], values[i], sz); + } + assert(wtmalloc_freelist_check()); + assert(checkvalues()); + + + puts("test full deallocation started"); + // full deallocation + for (i = 0; i < NUMPTR; i++) + { + wtfree(pointers[i]); + pointers[i] = NULL; + } + assert(wtmalloc_freelist_check()); + + printf("tests all OK\n"); + + return 0; + +} diff --git a/programs/develop/ktcc/trunk/readme.txt b/programs/develop/ktcc/trunk/readme.txt index 50984d5b95..e19658e259 100644 --- a/programs/develop/ktcc/trunk/readme.txt +++ b/programs/develop/ktcc/trunk/readme.txt @@ -10,7 +10,6 @@ building Kolibri version read .\source\readme_kos32.txt ------ TODO ------- --minimal memory allocator -more libc stardard functions. see report below -more Kolibly SysFn wrappers. see \libc\KOSfuncs_inc_status.txt -add stdin, stderr, stdout emulation stdin, stdout - stderr!, ferror & feof @@ -19,8 +18,6 @@ read .\source\readme_kos32.txt ------ errors ------ --not working: default search path are ./include ./lib from executable (under KOS need to use -Bpath_to_ktcc) ---start.o not found using -B (kos) - put near your.c file - - .dbg , L.78 ( -.dbg sometimes generated improperly for source code labels @@ -29,6 +26,8 @@ read .\source\readme_kos32.txt (^ default stack size set at compile time tccmeos:177 is below 4k) FIX - use -stack=1280000 option -con_set_title is NULL. fixed 180128 +-not working: default search path are ./include ./lib from executable (under KOS need to use -Bpath_to_ktcc) +--start.o not found using -B (kos) - put near your.c file fixed 181027 diff --git a/programs/develop/ktcc/trunk/source/CMakeCache.txt b/programs/develop/ktcc/trunk/source/CMakeCache.txt deleted file mode 100644 index 4fdf84a487..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeCache.txt +++ /dev/null @@ -1,266 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: d:/VSProjects/tinycc/tinycc-mob -# It was generated by CMake: D:/CMake/bin/cmake.exe -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//Path to a program. -CMAKE_AR:FILEPATH=D:/codeblocks-16.01/MinGW/bin/ar.exe - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//C compiler -CMAKE_C_COMPILER:FILEPATH=cl - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING= - -//Flags used by the compiler during release builds for minimum -// size. -CMAKE_C_FLAGS_MINSIZEREL:STRING= - -//Flags used by the compiler during release builds. -CMAKE_C_FLAGS_RELEASE:STRING= - -//Flags used by the compiler during release builds with debug info. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING= - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/tcc - -//Path to a program. -CMAKE_LINKER:FILEPATH=D:/codeblocks-16.01/MinGW/bin/ld.exe - -//Program used to build from makefiles. -CMAKE_MAKE_PROGRAM:STRING=nmake - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=D:/codeblocks-16.01/MinGW/bin/nm.exe - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=D:/codeblocks-16.01/MinGW/bin/objcopy.exe - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=D:/codeblocks-16.01/MinGW/bin/objdump.exe - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=tcc - -//Path to a program. -CMAKE_RANLIB:FILEPATH=D:/codeblocks-16.01/MinGW/bin/ranlib.exe - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during debug builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=D:/codeblocks-16.01/MinGW/bin/strip.exe - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Value Computed by CMake -tcc_BINARY_DIR:STATIC=D:/VSProjects/tinycc/tinycc-mob - -//Value Computed by CMake -tcc_SOURCE_DIR:STATIC=D:/VSProjects/tinycc/tinycc-mob - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=d:/VSProjects/tinycc/tinycc-mob -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=5 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=2 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=D:/CMake/bin/cmake.exe -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=D:/CMake/bin/cpack.exe -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=D:/CMake/bin/ctest.exe -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=D:/CMake/bin/cmake-gui.exe -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Name of external makefile project generator. -CMAKE_EXTRA_GENERATOR:INTERNAL= -//Name of generator. -CMAKE_GENERATOR:INTERNAL=NMake Makefiles -//Name of generator platform. -CMAKE_GENERATOR_PLATFORM:INTERNAL= -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Source directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=D:/VSProjects/tinycc/tinycc-mob -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=D:/CMake/share/cmake-3.5 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 - diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeRCCompiler.cmake b/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeRCCompiler.cmake deleted file mode 100644 index 8e22c94b60..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeRCCompiler.cmake +++ /dev/null @@ -1,6 +0,0 @@ -set(CMAKE_RC_COMPILER "rc") -set(CMAKE_RC_COMPILER_ARG1 "") -set(CMAKE_RC_COMPILER_LOADED 1) -set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) -set(CMAKE_RC_OUTPUT_EXTENSION .res) -set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeSystem.cmake b/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeSystem.cmake deleted file mode 100644 index d02bd9a685..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Windows-6.1.7601") -set(CMAKE_HOST_SYSTEM_NAME "Windows") -set(CMAKE_HOST_SYSTEM_VERSION "6.1.7601") -set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64") - - - -set(CMAKE_SYSTEM "Windows-6.1.7601") -set(CMAKE_SYSTEM_NAME "Windows") -set(CMAKE_SYSTEM_VERSION "6.1.7601") -set(CMAKE_SYSTEM_PROCESSOR "AMD64") - -set(CMAKE_CROSSCOMPILING "FALSE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.c b/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.c deleted file mode 100644 index a49c999c14..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.c +++ /dev/null @@ -1,544 +0,0 @@ -#ifdef __cplusplus -# error "A C++ compiler has been selected for C." -#endif - -#if defined(__18CXX) -# define ID_VOID_MAIN -#endif - - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif - /* __INTEL_COMPILER = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 -# define COMPILER_ID "XL" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) -# define COMPILER_ID "Fujitsu" - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" -#if defined(__VISUALDSPVERSION__) - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" - -#elif defined(__ARMCC_VERSION) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(SDCC) -# define COMPILER_ID "SDCC" - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) - -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) -# define COMPILER_ID "MIPSpro" -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__sgi) -# define COMPILER_ID "MIPSpro" - -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXE) || defined(__CRAYXC) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# else /* unknown platform */ -# define PLATFORM_ID "" -# endif - -#else /* unknown platform */ -# define PLATFORM_ID "" - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID "" -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number components. */ -#ifdef COMPILER_VERSION_MAJOR -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - - -const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if !defined(__STDC_VERSION__) - "90" -#elif __STDC_VERSION__ >= 201000L - "11" -#elif __STDC_VERSION__ >= 199901L - "99" -#else -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -#ifdef ID_VOID_MAIN -void main() {} -#else -int main(int argc, char* argv[]) -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; - require += info_arch[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXE) || defined(__CRAYXC) - require += info_cray[argc]; -#endif - require += info_language_dialect_default[argc]; - (void)argv; - return require; -} -#endif diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeError.log b/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeError.log deleted file mode 100644 index 416d673799..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeError.log +++ /dev/null @@ -1,183 +0,0 @@ -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -c - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -Aa - -The output was: -Не удается найти указанный файл - - -Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler": -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -c - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -Aa - -The output was: -Не удается найти указанный файл - - -Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler": -Determining if the C compiler works failed with the following output: -Change Dir: D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/CMakeTmp - -Run Build Command:"nmake" "/NOLOGO" "cmTC_c47b5\fast" - D:\VSProjects\MSVC2003\bin\nmake.exe -f CMakeFiles\cmTC_c47b5.dir\build.make /nologo -L CMakeFiles\cmTC_c47b5.dir\build -Building C object CMakeFiles/cmTC_c47b5.dir/testCCompiler.c.obj - D:\VSProjects\MSVC2003\bin\cl.exe @E:\windows\TEMP\nm8D8B.tmp -testCCompiler.c -Linking C executable cmTC_c47b5.exe - D:\VSProjects\MSVC2003\bin\link.exe /nologo @CMakeFiles\cmTC_c47b5.dir\objects1.rsp @E:\windows\TEMP\nm8DF9.tmp -LINK : fatal error LNK1104: cannot open file 'user32.lib' -NMAKE : fatal error U1077: 'D:\VSProjects\MSVC2003\bin\link.exe' : return code '0x450' -Stop. -NMAKE : fatal error U1077: 'D:\VSProjects\MSVC2003\bin\nmake.exe' : return code '0x2' -Stop. - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: D:/VSProjects/MSVC2003/bin/cl.exe -Build flags: -Id flags: - -The output was: -2 -Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 -Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. - -CMakeCCompilerId.c -Microsoft (R) Incremental Linker Version 7.10.3077 -Copyright (C) Microsoft Corporation. All rights reserved. - -/out:CMakeCCompilerId.exe -CMakeCCompilerId.obj -LINK : fatal error LNK1104: cannot open file 'LIBC.lib' - - -Determining if the C compiler works failed with the following output: -Change Dir: D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/CMakeTmp - -Run Build Command:"nmake" "/NOLOGO" "cmTC_ae0c3\fast" - -Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_ae0c3\fast" - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: D:/VSProjects/MSVC2003/bin/cl.exe -Build flags: -Id flags: - -The output was: -2 -Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 -Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. - -CMakeCCompilerId.c -Microsoft (R) Incremental Linker Version 7.10.3077 -Copyright (C) Microsoft Corporation. All rights reserved. - -/out:CMakeCCompilerId.exe -CMakeCCompilerId.obj -LINK : fatal error LNK1104: cannot open file 'LIBC.lib' - - -Determining if the C compiler works failed with the following output: -Change Dir: D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/CMakeTmp - -Run Build Command:"nmake" "/NOLOGO" "cmTC_cc918\fast" - -Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_cc918\fast" - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -c - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -Aa - -The output was: -Не удается найти указанный файл - - -Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler": -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -c - -The output was: -Не удается найти указанный файл - - -Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. -Compiler: cl -Build flags: -Id flags: -Aa - -The output was: -Не удается найти указанный файл - - -Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler": diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeOutput.log b/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeOutput.log deleted file mode 100644 index dcc99fd1ba..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeOutput.log +++ /dev/null @@ -1,59 +0,0 @@ -The system is: Windows - 6.1.7601 - AMD64 -Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. -Compiler: D:/VSProjects/MSVC2003/bin/cl.exe -Build flags: -Id flags: - -The output was: -0 -Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 -Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. - -CMakeCCompilerId.c -Microsoft (R) Incremental Linker Version 7.10.3077 -Copyright (C) Microsoft Corporation. All rights reserved. - -/out:CMakeCCompilerId.exe -CMakeCCompilerId.obj - - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.exe" - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj" - -The C compiler identification is MSVC, found in "D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.exe" - -Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. -Compiler: D:/VSProjects/MSVC2003/bin/cl.exe -Build flags: -Id flags: -c - -The output was: -0 -Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 -Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. - -CMakeCCompilerId.c - - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj" - -The C compiler identification is MSVC, found in "D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.obj" - -Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. -Compiler: D:/VSProjects/MSVC2003/bin/cl.exe -Build flags: -Id flags: -c - -The output was: -0 -Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 -Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. - -CMakeCCompilerId.c - - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj" - -The C compiler identification is MSVC, found in "D:/VSProjects/tinycc/tinycc-mob/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.obj" - diff --git a/programs/develop/ktcc/trunk/source/CMakeFiles/cmake.check_cache b/programs/develop/ktcc/trunk/source/CMakeFiles/cmake.check_cache deleted file mode 100644 index 56c437b9b7..0000000000 --- a/programs/develop/ktcc/trunk/source/CMakeFiles/cmake.check_cache +++ /dev/null @@ -1 +0,0 @@ -# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/programs/develop/ktcc/trunk/source/libtcc.c b/programs/develop/ktcc/trunk/source/libtcc.c index efd7798c99..58d743acf9 100644 --- a/programs/develop/ktcc/trunk/source/libtcc.c +++ b/programs/develop/ktcc/trunk/source/libtcc.c @@ -86,6 +86,8 @@ ST_FUNC void asm_global_instr(void) } #endif + + /********************************************************/ #ifdef _WIN32 static char *normalize_slashes(char *path) @@ -137,6 +139,20 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) return TRUE; } #endif +#else // _WIN32 +#ifdef TCC_TARGET_MEOS +/* on Kolibri host, we suppose the lib and includes are at the location of 'tcc' /lib, /include */ +static void tcc_set_lib_path_kos(TCCState *s) +{ + char** argv0 = (char**)0x20; // path in kolibri header + char path[1024], *p; + strncpy(path, *argv0, sizeof path); + p = tcc_basename(path); + if (p > path) p--; + *p = 0; + tcc_set_lib_path(s, path); +} +#endif #endif /********************************************************/ @@ -1075,8 +1091,12 @@ LIBTCCAPI TCCState *tcc_new(void) tcc_state = s; #ifdef _WIN32 tcc_set_lib_path_w32(s); +#else +#ifdef TCC_TARGET_MEOS + tcc_set_lib_path_kos(s); #else tcc_set_lib_path(s, CONFIG_TCCDIR); +#endif #endif s->output_type = 0; preprocess_new(); @@ -1453,7 +1473,7 @@ static int tcc_add_library_internal(TCCState *s, const char *fmt, for(i = 0; i < nb_paths; i++) { snprintf(buf, sizeof(buf), fmt, paths[i], filename); -//printf("added lib [%s]\n", buf); +//printf("tcc_add_library_internal::added lib [%s]\n", buf); if (tcc_add_file_internal(s, buf, flags, TCC_FILETYPE_BINARY) == 0) return 0; }