Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7519 → Rev 7520

/programs/develop/ktcc/trunk/libc/include/tcclib.h
File deleted
/programs/develop/ktcc/trunk/libc/include/kos32sys0.h
File deleted
/programs/develop/ktcc/trunk/libc/include/conio.h
15,7 → 15,7
/*
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
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
/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' */
/programs/develop/ktcc/trunk/libc/include/kos32sys1.h
3,9 → 3,7
 
// file header taken from newlib
// added many sys functions, compatible with tcc
// with gcc USE gcc -mno-ms-bitfields!!!
 
 
//#include <newlib.h>
//#include <stdint.h>
#include <stddef.h>
44,6 → 42,7
#define SHM_WRITE 0x01
 
 
 
typedef unsigned int color_t;
 
 
133,22 → 132,6
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,12 → 524,8
void *user_data);
#endif
 
///////////////////////////////////////////////////////////////////////////////
/// May be next section need to be added in newlibc
// Siemargl addenium
// May be next section need to be added in newlibc
 
#define X_Y(x,y) (((x)<<16)|(y))
 
enum KOLIBRI_GUI_EVENTS {
KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */
KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */
560,108 → 539,7
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
static inline
817,7 → 695,15
 
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,56 → 715,7
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,31 → 729,10
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
// end section
 
__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
 
 
 
//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,...);
937,16 → 753,6
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));
}
 
*/
 
 
/programs/develop/ktcc/trunk/libc/include/stdint.h
0,0 → 1,0
#include <stddef.h>
/programs/develop/ktcc/trunk/libc/include/stdlib.h
19,10 → 19,33
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
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)
/programs/develop/ktcc/trunk/libc/memory/memalloc.asm
2,12 → 2,12
 
;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
ret 4
 
align 4
free:
sysfree:
push ebx
mov eax,68
mov ebx,13
27,7 → 27,7
ret 4
 
align 4
realloc:
sysrealloc:
push ebx
mov ebx,20
mov eax,68
/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 <stddef.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
 
#define UINT_MAX (4294967295U)
 
#ifndef NDEBUG
#include <stdio.h>
# 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*)&param1-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;
}
/programs/develop/ktcc/trunk/libc/start/start.asm
38,6 → 38,9
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
/programs/develop/ktcc/trunk/libc/stdio/conio.c
74,6 → 74,15
 
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;
84,10 → 93,10
}
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;
 
return(0);
return 0;
}
 
/programs/develop/ktcc/trunk/libc/stdio/fopen.c
2,21 → 2,28
#include <string.h>
#include <stdlib.h>
 
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,9 → 56,9
 
return(newpath);
}
*/
 
 
 
FILE* fopen(const char* filename, const char *mode)
{
FILE* res;
92,7 → 99,8
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);
/programs/develop/ktcc/trunk/libc/string/calloc.c
1,10 → 1,10
#include <stdlib.h>
#include <string.h>
 
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);
/programs/develop/ktcc/trunk/libctest/traceadr.c
0,0 → 1,19
#include <stdio.h>
 
# 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);
}
 
/programs/develop/ktcc/trunk/libctest/wtalloc.c
0,0 → 1,127
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
 
// 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;
 
}
/programs/develop/ktcc/trunk/readme.txt
10,7 → 10,6
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
 
 
------ 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
(^ 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
 
 
 
/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeError.log
File deleted
/programs/develop/ktcc/trunk/source/CMakeFiles/cmake.check_cache
File deleted
/programs/develop/ktcc/trunk/source/CMakeFiles/CMakeOutput.log
File deleted
/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CompilerIdC/CMakeCCompilerId.c
File deleted
/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeRCCompiler.cmake
File deleted
/programs/develop/ktcc/trunk/source/CMakeFiles/3.5.2/CMakeSystem.cmake
File deleted
/programs/develop/ktcc/trunk/source/CMakeCache.txt
File deleted
/programs/develop/ktcc/trunk/source/libtcc.c
86,6 → 86,8
}
#endif
 
 
 
/********************************************************/
#ifdef _WIN32
static char *normalize_slashes(char *path)
137,7 → 139,21
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
 
/********************************************************/
/* copy a string and truncate it. */
1076,8 → 1092,12
#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();
s->include_stack_ptr = s->include_stack;
1453,7 → 1473,7
 
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;
}