diff --git a/programs/develop/metcc/trunk/libc/file/fclose.c b/programs/develop/metcc/trunk/libc/file/fclose.c index 257ec420d1..8373bbf4d9 100644 --- a/programs/develop/metcc/trunk/libc/file/fclose.c +++ b/programs/develop/metcc/trunk/libc/file/fclose.c @@ -3,7 +3,7 @@ int fclose(FILE* file) { int res; - res=_msys_write_file(file->filename,file->filesize,file->buffer); + res=_msys_write_file(file->filename, 0, file->filesize, file->buffer); free(file->buffer); free(file); return res; diff --git a/programs/develop/metcc/trunk/libc/file/fflush.c b/programs/develop/metcc/trunk/libc/file/fflush.c index a6f28e86b4..9344a6d733 100644 --- a/programs/develop/metcc/trunk/libc/file/fflush.c +++ b/programs/develop/metcc/trunk/libc/file/fflush.c @@ -3,5 +3,5 @@ int fflush(FILE* file) { if ((file->mode & 3)==FILE_OPEN_READ) return 0; - return _msys_file_write(file->filename,file->filesize,file->buffer) ? EOF : 0; + return _msys_file_write(file->filename, 0, file->filesize, file->buffer) ? EOF : 0; } \ No newline at end of file diff --git a/programs/develop/metcc/trunk/libc/file/fopen.c b/programs/develop/metcc/trunk/libc/file/fopen.c index 7324476009..52b696abdb 100644 --- a/programs/develop/metcc/trunk/libc/file/fopen.c +++ b/programs/develop/metcc/trunk/libc/file/fopen.c @@ -40,7 +40,7 @@ FILE* fopen(const char* filename, const char *mode) res->filename=0; res->mode=imode; //check if file exists - res=_msys_read_file(filename,0,0,0,&res->filesize); + res=_msys_read_file(filename, 0, 0, 0, &res->filesize); if (res==5) { if ((imode & 3) == FILE_OPEN_READ) @@ -48,7 +48,7 @@ FILE* fopen(const char* filename, const char *mode) free(res); return 0; } - res=_msys_write_file(filename,0,0); + res=_msys_create_file(filename); if (res!=0) { free(res); diff --git a/programs/develop/metcc/trunk/libc/include/mesys.h b/programs/develop/metcc/trunk/libc/include/mesys.h index 7e263da754..b263eed2b0 100644 --- a/programs/develop/metcc/trunk/libc/include/mesys.h +++ b/programs/develop/metcc/trunk/libc/include/mesys.h @@ -17,7 +17,8 @@ extern void stdcall _msys_draw_window(int xcoord,int ycoord, int xsize, int captioncolor,int windowtype,int bordercolor); extern int stdcall _msys_read_file(char* filename,int fileoffset,int size,void* data, int* filesize); -extern int stdcall _msys_write_file(char* filename,int size,void* data); +extern int stdcall _msys_write_file(char* filename,int fileoffset, int size, void* data); +extern int stdcall _msys_create_file(char* filename); extern void stdcall _msys_run_program(char* filename,char* parameters); extern void stdcall _msys_debug_out(int c); extern void debug_out_str(char* str); diff --git a/programs/develop/metcc/trunk/libc/mesys/_mesys.asm b/programs/develop/metcc/trunk/libc/mesys/_mesys.asm deleted file mode 100644 index 6b3e809726..0000000000 --- a/programs/develop/metcc/trunk/libc/mesys/_mesys.asm +++ /dev/null @@ -1,156 +0,0 @@ -format ELF -section '.text' executable - -public _msys_draw_window -_msys_draw_window: -;arg1 - xcoord -;arg2 - ycoord -;arg3 - xsize -;arg4 - ysize -;arg5 - workcolor -;arg6 - type -;arg7 - captioncolor -;arg8 - windowtype -;arg9 - bordercolor - push ebp - mov ebp,esp - push ebx esi edi - mov ebx,[ebp+8] - shl ebx,16 - mov bx,[ebp+16] - mov ecx,[ebp+12] - shl ecx,16 - mov cx,[ebp+20] - mov edx,[ebp+28] - shl edx,24 - add edx,[ebp+24] - mov esi,[ebp+36] - shl esi,24 - add esi,[ebp+32] - mov edi,[ebp+40] - xor eax,eax - int 0x40 - pop edi esi ebx - pop ebp - ret - -public _msys_read_file -_msys_read_file: -;arg1 - file name -;arg2 - file offset -;arg3 - size to read -;arg4 - data -;arg5 - temp buffer -;arg6 - file size - push ebp - mov ebp,esp - xor eax,eax - mov [file_struct.operation],eax - mov eax,[ebp+12] - mov [file_struct.offset],eax - mov eax,[ebp+16] - mov [file_struct.offset],eax - mov eax,[ebp+20] - mov [file_struct.offset],eax - mov [file_struct.temp_buffer],temp_buffer - mov edx,[ebp+8] - call copy_file_name - push ebx - mov ebx,file_struct - mov eax,58 - int 0x40 - mov ecx,[ebp+28] - test ecx,ecx - jz .no_file_size - mov [ecx],ebx -.no_file_size: - pop ebx - pop ebp - ret - -copy_file_name: - push esi edi - cld - mov edi,edx - xor eax,eax - xor ecx,ecx - dec ecx - repnz scasb - not ecx - mov edi,file_struct.path - mov esi,edx - rep movsb - pop edi esi - ret - -public _msys_write_file -_msys_write_file: -;arg1 - file name -;arg2 - size -;arg3 - data - push ebp - mov ebp,esp - xor eax,eax - mov [file_struct.offset],eax - inc eax - mov [file_struct.operation],eax - mov eax,[ebp+12] - mov [file_struct.size],eax - mov eax,[ebp+16] - mov [file_struct.data],eax - mov [file_struct.temp_buffer],temp_buffer - mov edx,[ebp+8] - call copy_file_name - push ebx - mov eax,58 - mov ebx,file_struct - int 0x40 - pop ebx - pop ebp - ret - -public _msys_run_program -_msys_run_program: -;arg1 - program name -;arg2 - parameters - push ebp - mov ebp,esp - mov [file_struct.operation],16 - xor eax,eax - mov [file_struct.offset],eax - mov [file_struct.data],eax - mov eax,[ebp+12] - mov [file_struct.param],eax - mov [file_struct.temp_buffer],temp_buffer; - mov edx,[ebp+8] - call copy_file_name - push ebx - mov eax,58 - mov ebx,file_struct - int 0x40 - pop ebx - pop ebp - ret - -public _msys_debug_out -_msys_debug_out: -;arg1 - char to out - push ebx - mov ecx,[esp+8] - mov ebx,1 - mov eax,63 - int 0x40 - pop ebx - ret -section '.data' writeable -section '.bss' writeable -file_struct: -.operation rd 1 -.offset rd 1 -.param: -.size rd 1 -.data rd 1 -.temp_buffer rd 1 -.path rb 1024 - temp_buffer rb 4096 - \ No newline at end of file diff --git a/programs/develop/metcc/trunk/libc/mesys/file_58.asm b/programs/develop/metcc/trunk/libc/mesys/file_58.asm deleted file mode 100644 index 0c56505d94..0000000000 --- a/programs/develop/metcc/trunk/libc/mesys/file_58.asm +++ /dev/null @@ -1,108 +0,0 @@ -format ELF -include "public_stdcall.inc" -section '.text' executable -public_stdcall _msys_read_file,20 -;arg1 - file name -;arg2 - file offset -;arg3 - size to read -;arg4 - data -;arg5 - file size - push ebp - mov ebp,esp - xor eax,eax - mov [file_struct.operation],eax - mov eax,[ebp+12] - mov [file_struct.offset],eax - mov eax,[ebp+16] - mov [file_struct.size],eax - mov eax,[ebp+20] - mov [file_struct.data],eax - mov [file_struct.temp_buffer],temp_buffer - mov edx,[ebp+8] - call copy_file_name - push ebx - mov ebx,file_struct - mov eax,58 - int 0x40 - mov ecx,[ebp+24] - test ecx,ecx - jz .no_file_size - mov [ecx],ebx -.no_file_size: - pop ebx - pop ebp - ret 20 - -copy_file_name: - push esi edi - cld - mov edi,edx - xor eax,eax - xor ecx,ecx - dec ecx - repnz scasb - not ecx - mov edi,file_struct.path - mov esi,edx - rep movsb - pop edi esi - ret - -public_stdcall _msys_write_file,12 -;arg1 - file name -;arg2 - size -;arg3 - data - push ebp - mov ebp,esp - xor eax,eax - mov [file_struct.offset],eax - inc eax - mov [file_struct.operation],eax - mov eax,[ebp+12] - mov [file_struct.size],eax - mov eax,[ebp+16] - mov [file_struct.data],eax - mov [file_struct.temp_buffer],temp_buffer - mov edx,[ebp+8] - call copy_file_name - push ebx - mov eax,58 - mov ebx,file_struct - int 0x40 - pop ebx - pop ebp - ret 12 - -public_stdcall _msys_run_program,8 -;arg1 - program name -;arg2 - parameters - push ebp - mov ebp,esp - mov [file_struct.operation],16 - xor eax,eax - mov [file_struct.offset],eax - mov [file_struct.data],eax - mov eax,[ebp+12] - mov [file_struct.param],eax - mov [file_struct.temp_buffer],temp_buffer; - mov edx,[ebp+8] - call copy_file_name - push ebx - mov eax,58 - mov ebx,file_struct - int 0x40 - pop ebx - pop ebp - ret 8 -section '.bss' writeable -file_struct: -.operation rd 1 -.offset rd 1 -.param: -.size rd 1 -.data rd 1 -.temp_buffer rd 1 -.path rb 1024 - temp_buffer rb 4096 - - diff --git a/programs/develop/metcc/trunk/libc/string/is.c b/programs/develop/metcc/trunk/libc/string/is.c index 19265ec0d1..9213614423 100644 --- a/programs/develop/metcc/trunk/libc/string/is.c +++ b/programs/develop/metcc/trunk/libc/string/is.c @@ -1,5 +1,5 @@ #include "ctype.h" -char __is[128] = { +int __is[128] = { 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x104, 0x104, 0x104, 0x104, 0x104, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,