From c38424c3435ab00c72d6edb3b1a3642076433ed6 Mon Sep 17 00:00:00 2001 From: andrew_programmer Date: Fri, 24 Aug 2007 19:52:54 +0000 Subject: [PATCH] Added include files for libC. git-svn-id: svn://kolibrios.org@611 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../develop/metcc/trunk/libc/include/mesys.h | 34 ++++++++++++------- .../develop/metcc/trunk/libc/include/stdio.h | 16 ++++----- .../develop/metcc/trunk/libc/include/stdlib.h | 5 +++ 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/programs/develop/metcc/trunk/libc/include/mesys.h b/programs/develop/metcc/trunk/libc/include/mesys.h index b263eed2b0..8eea5e6d09 100644 --- a/programs/develop/metcc/trunk/libc/include/mesys.h +++ b/programs/develop/metcc/trunk/libc/include/mesys.h @@ -1,24 +1,37 @@ #ifndef mesys_h #define mesys_h +/* #ifdef GNUC #define stdcall __stdcall #define cdecl __cdecl #else -#define stdcall __attribute__ ((__stdcall)) -#define cdecl __attribute__ ((__cdecl)) +#define stdcall ((__stdcall)) +#define cdecl ((__cdecl)) #endif +*/ +//#ifdef GNUC +//#define stdcall __stdcall +//#else +#define stdcall __attribute__ (( )) +//#endif -typedef unsigned long dword; +typedef unsigned int dword; typedef unsigned char byte; typedef unsigned short word; extern void stdcall _msys_draw_window(int xcoord,int ycoord, int xsize, - int ysize,int workcolor,int type, - 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 fileoffset, int size, void* data); -extern int stdcall _msys_create_file(char* filename); + int ysize,int workcolor,int type, + int captioncolor,int windowtype,int bordercolor); + +//----------------------------------------------------------------------------------- +//------------------------KolibriOS system acces to files---------------------------- +//----------------------------------------------------------------------------------- +extern dword stdcall _ksys_get_filesize(char *filename); +extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data); +extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data); +extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data); +//----------------------------------------------------------------------------------- + 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); @@ -100,9 +113,6 @@ extern void stdcall _msys_sound_speaker_play(void* data); extern void stdcall _msys_write_text(int x,int y,int color,char* text,int len); extern void* stdcall _msys_start_thread(void (* func_ptr)(void),int stack_size,int* pid); extern void stdcall _msys_window_redraw(int status); -extern void* malloc(int); -extern void free(void*); -extern void* realloc(void*,int); extern dword* stdcall _msys_cofflib_load(char* name); extern char* stdcall _msys_cofflib_getproc(void* exp,char* sz_name); diff --git a/programs/develop/metcc/trunk/libc/include/stdio.h b/programs/develop/metcc/trunk/libc/include/stdio.h index 2336f4df79..4cf4026f6e 100644 --- a/programs/develop/metcc/trunk/libc/include/stdio.h +++ b/programs/develop/metcc/trunk/libc/include/stdio.h @@ -3,12 +3,12 @@ #include "mesys.h" #define NULL ((void*)0) typedef struct { - char* buffer; - int buffersize; - int filesize; - int filepos; - char* filename; - int mode; + char* buffer; + dword buffersize; + dword filesize; + dword filepos; + char* filename; + int mode; } FILE; #define FILE_OPEN_READ 0 #define FILE_OPEN_WRITE 1 @@ -17,7 +17,7 @@ typedef struct { #define FILE_OPEN_PLUS 8 #define EOF -1 extern FILE* fopen(const char* filename, const char *mode); -extern int fclose(FILE* file); +extern void fclose(FILE* file); extern int feof(FILE* file); extern int fflush(FILE* file); extern int fgetc(FILE* file); @@ -26,7 +26,7 @@ extern int fgetpos(FILE* file,fpos_t* pos); extern int fsetpos(FILE* file,const fpos_t* pos); extern int fputc(int c,FILE* file); extern int fread(void* buffer,int size,int count,FILE* file); -extern int fwrite(const void* buffer,int size,int count,FILE* file); +extern int fwrite(void *buffer,int size,int count,FILE* file); extern long ftell(FILE* file); #define SEEK_CUR 0 #define SEEK_END 1 diff --git a/programs/develop/metcc/trunk/libc/include/stdlib.h b/programs/develop/metcc/trunk/libc/include/stdlib.h index 153550f83d..fd25a8ecbc 100644 --- a/programs/develop/metcc/trunk/libc/include/stdlib.h +++ b/programs/develop/metcc/trunk/libc/include/stdlib.h @@ -1,3 +1,4 @@ +#include //#define isspace(c) ((c)==' ') #define abs(i) (((i)<0)?(-(i)):(i)) @@ -7,3 +8,7 @@ extern char tolower(char c); extern char toupper(char c); extern void itoab(int n,char* s,int b); extern void itoa(int n,char* s); + +extern void* malloc(dword size); +extern void free(void *pointer); +extern void* realloc(void* pointer,dword size); \ No newline at end of file