diff --git a/reactos/include/rosky/structs.h b/reactos/include/rosky/structs.h index 74c6348168d..8d3b0627168 100644 --- a/reactos/include/rosky/structs.h +++ b/reactos/include/rosky/structs.h @@ -208,4 +208,35 @@ typedef struct s_window int origin_y; } s_window; +typedef struct sCreateApplication +{ + unsigned char ucApplicationName[255]; + unsigned int uiX; + unsigned int uiY; + unsigned int uiWidth; + unsigned int uiHeight; + + void *fwndClient; + unsigned int uiStyleApplication; + unsigned int uiStyleFrame; + unsigned int uiStyleTitle; + unsigned int uiStyleMenu; + unsigned int uiStyleBar; + unsigned int uiStyleClient; + unsigned int uiBackGroundColor; + unsigned int uiApplicationIcon; + widget_menu *pFrameMenu; + + unsigned int uiReserved[128]; + + void (__cdecl *PostCreateWindowBitmap)(HANDLE hWnd, void *pGCBuf); +} sCreateApplication; + +typedef struct s_resolution +{ + unsigned int width; + unsigned int height; + unsigned int bpp; +} s_resolution; + #endif /* __RSK_STRUCTS_H */ diff --git a/reactos/lib/rosky/libsky/Makefile b/reactos/lib/rosky/libsky/Makefile index 14cdefa630d..a4bf20a9e15 100644 --- a/reactos/lib/rosky/libsky/Makefile +++ b/reactos/lib/rosky/libsky/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2004/08/12 02:50:35 weiden Exp $ +# $Id: Makefile,v 1.2 2004/08/12 15:41:36 weiden Exp $ PATH_TO_TOP = ../../.. @@ -12,6 +12,7 @@ TARGET_BASE = 0x71c10000 TARGET_CFLAGS = \ -I./include \ + -DDEBUG \ -Wall \ -Werror \ -fno-builtin diff --git a/reactos/lib/rosky/libsky/libsky.c b/reactos/lib/rosky/libsky/libsky.c index 7859644cef0..7bab74442f9 100644 --- a/reactos/lib/rosky/libsky/libsky.c +++ b/reactos/lib/rosky/libsky/libsky.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: libsky.c,v 1.1 2004/08/12 02:50:35 weiden Exp $ +/* $Id: libsky.c,v 1.2 2004/08/12 15:41:36 weiden Exp $ * * PROJECT: SkyOS library * FILE: lib/libsky/libsky.c @@ -26,6 +26,7 @@ * 08/12/2004 Created */ #include +/* #define NDEBUG */ #include "libsky.h" #include "resource.h" diff --git a/reactos/lib/rosky/libsky/libsky.def b/reactos/lib/rosky/libsky/libsky.def index fef6f4ca0e3..bbd9b707616 100644 --- a/reactos/lib/rosky/libsky/libsky.def +++ b/reactos/lib/rosky/libsky/libsky.def @@ -3,11 +3,22 @@ LIBRARY libsky.dll EXPORTS __libc_init_memory __to_kernel -_alloca -ctor_dtor_initialize=ctor_dtor_initialize +ctor_dtor_initialize get_usec_counter + +; MSVCRT rand srand + +; NTDLL +_alloca + +; CRTDLL +printf +putchar +sprintf +strcat strcpy +time ; EOF diff --git a/reactos/lib/rosky/libsky/libsky.edf b/reactos/lib/rosky/libsky/libsky.edf index 1f5ef0d95d6..7a7fa65ab16 100644 --- a/reactos/lib/rosky/libsky/libsky.edf +++ b/reactos/lib/rosky/libsky/libsky.edf @@ -3,11 +3,22 @@ LIBRARY acledit.dll EXPORTS __libc_init_memory=__libc_init_memory __to_kernel=__to_kernel -_alloca=NTDLL._alloca_probe ctor_dtor_initialize=ctor_dtor_initialize get_usec_counter=get_usec_counter + +; MSVCRT rand=MSVCRT.rand srand=MSVCRT.srand -strcpy=NTDLL.strcpy + +; NTDLL +_alloca=NTDLL._alloca_probe + +; CRTDLL +printf=CRTDLL.printf +putchar=CRTDLL.putchar +sprintf=CRTDLL.sprintf +strcat=CRTDLL.strcat +strcpy=CRTDLL.strcpy +time=CRTDLL.time ; EOF diff --git a/reactos/lib/rosky/libsky/libsky.h b/reactos/lib/rosky/libsky/libsky.h index b9b6fbc1964..7fdb7253c91 100644 --- a/reactos/lib/rosky/libsky/libsky.h +++ b/reactos/lib/rosky/libsky/libsky.h @@ -1,7 +1,17 @@ #ifndef __LIBSKY_H #define __LIBSKY_H -#define DBG DbgPrint +#ifdef DEBUG +# ifdef NDEBUG +# define DBG(...) +# else +# define DBG DbgPrint +# endif +# define DBG1 DbgPrint +#else +# define DBG(...) +# define DBG1(...) +#endif #define STUB DbgPrint("Stub in %s:%i: ", __FILE__, __LINE__); DbgPrint #endif /* __LIBSKY_H */ diff --git a/reactos/lib/rosky/libsky/stubs.c b/reactos/lib/rosky/libsky/stubs.c index 5f27cb60c46..248e99ec57d 100644 --- a/reactos/lib/rosky/libsky/stubs.c +++ b/reactos/lib/rosky/libsky/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.1 2004/08/12 02:50:35 weiden Exp $ +/* $Id: stubs.c,v 1.2 2004/08/12 15:41:36 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: SkyOS library @@ -10,29 +10,106 @@ * 08/12/2004 Created */ #include -#include +/* #define NDEBUG */ +#include "libsky.h" /* * @unimplemented */ void __cdecl -__libc_init_memory(void * end, - void * __bss_end__, - void * __bss_start__) +__libc_init_memory(void *end, + void *__bss_end__, + void *__bss_start__) { STUB("__libc_init_memory: end=0x%x __bss_end__=0x%x __bss_start__=0x%x\n", end, __bss_end__, __bss_start__); + #if 1 + RtlZeroMemory(__bss_start__, (PCHAR)__bss_end__ - (PCHAR)__bss_start__); + #else + RtlCopyMemory(__bss_start__, /* I think this function should initialize the data in the .bss section */ + end, /* The source should be the pointer to raw of the EOF Extra Data, but how to get it?! It's not loaded to memory in win/ros */ + (PCHAR)__bss_end__ - (PCHAR)__bss_start__); /* Or should we rather copy 0x2000 (raw size of EOF Extra data)? */ + #endif } +typedef void (__cdecl *func_ptr) (void); + /* * @unimplemented */ void __cdecl -ctor_dtor_initialize(void * __CTOR_LIST__, - void * __DTOR_LIST__, - void * unknown) +ctor_dtor_initialize(func_ptr *__CTOR_LIST__, + func_ptr *__DTOR_LIST__, + void *unknown) { STUB("ctor_dtor_initialize: __CTOR_LIST__=0x%x __DTOR_LIST__=0x%x unknown=0x%x\n", __CTOR_LIST__, __DTOR_LIST__, unknown); + + /* unknown apparently is the virtual address of the .bss section, but what should + * we do with it?! Perhaps load a list of constructor/destructor addresses to this + * address before we call them? + */ + + /* + * Call constructors + */ + if(__CTOR_LIST__ != NULL) + { + unsigned long nptrs; + /* + * If the first entry in the constructor list is -1 then the list + * is terminated with a null entry. Otherwise the first entry was + * the number of pointers in the list. + */ + DBG("Calling constructors...\n"); + nptrs = (unsigned long)__CTOR_LIST__[0]; + if (nptrs == -1) + { + for(nptrs = 0; __CTOR_LIST__[nptrs + 1] != NULL; nptrs++); + } + DBG("There are %d constructors to call...\n", nptrs); + + /* + * Go through the list backwards calling constructors. + * FIXME - backwards?! This is ripped off crtdll\misc\gccmain.c + */ + for(; nptrs > 0; nptrs--) + { + DBG("call constructor 0x%x\n", __CTOR_LIST__[nptrs]); + __CTOR_LIST__[nptrs](); + } + DBG("Called all constructors\n"); + } + + /* + * Call destructors + */ + if(__DTOR_LIST__ != NULL) + { + unsigned long nptrs; + /* + * If the first entry in the destructor list is -1 then the list + * is terminated with a null entry. Otherwise the first entry was + * the number of pointers in the list. + */ + DBG("Calling destructors...\n"); + nptrs = (unsigned long)__DTOR_LIST__[0]; + if (nptrs == -1) + { + for(nptrs = 0; __DTOR_LIST__[nptrs + 1] != NULL; nptrs++); + } + DBG("There are %d destructors to call...\n", nptrs); + + /* + * Go through the list backwards calling constructors. + * FIXME - backwards?! This is ripped off crtdll\misc\gccmain.c + */ + for(; nptrs > 0; nptrs--) + { + DBG("call destructor 0x%x\n", __DTOR_LIST__[nptrs]); + __DTOR_LIST__[nptrs](); + } + DBG("Called all destructors\n"); + } } /* diff --git a/reactos/lib/rosky/libskygi/libskygi.def b/reactos/lib/rosky/libskygi/libskygi.def index 9fedc3593ef..314ce0c8ca4 100644 --- a/reactos/lib/rosky/libskygi/libskygi.def +++ b/reactos/lib/rosky/libskygi/libskygi.def @@ -24,5 +24,32 @@ GI_messagebox GI_post_quit GI_set_high_timer GI_wait_message +GC_draw_text +GC_set_fg_color +GC_set_font +GC_set_font_size +GC_set_font_flags +GC_set_font_param +GI_CreateApplicationStruct +GI_CreateApplication +GI_EnableMouseTracking +GI_GetTopLevelWindow +GI_GetWindowX +GI_GetWindowY +GI_GetWindowWidth +GI_GetWindowHeight +GI_create_font +GI_textheight +GI_textlength +GI_init +GI_set_dimension +GC_blit_from_DIB +GC_draw_pixel +GC_set_clip +GI_create_DIB +GI_redraw_window +GI_ScaleDIB +GI_get_resolution +GI_widget_status_set ; EOF diff --git a/reactos/lib/rosky/libskygi/libskygi.edf b/reactos/lib/rosky/libskygi/libskygi.edf index e7930d4656a..2afe879456e 100644 --- a/reactos/lib/rosky/libskygi/libskygi.edf +++ b/reactos/lib/rosky/libskygi/libskygi.edf @@ -24,5 +24,32 @@ GI_messagebox=GI_messagebox GI_post_quit=GI_post_quit GI_set_high_timer=GI_set_high_timer GI_wait_message=GI_wait_message +GC_draw_text=GC_draw_text +GC_set_fg_color=GC_set_fg_color +GC_set_font=GC_set_font +GC_set_font_size=GC_set_font_size +GC_set_font_flags=GC_set_font_flags +GC_set_font_param=GC_set_font_param +GI_CreateApplicationStruct=GI_CreateApplicationStruct +GI_CreateApplication=GI_CreateApplication +GI_EnableMouseTracking=GI_EnableMouseTracking +GI_GetTopLevelWindow=GI_GetTopLevelWindow +GI_GetWindowX=GI_GetWindowX +GI_GetWindowY=GI_GetWindowY +GI_GetWindowWidth=GI_GetWindowWidth +GI_GetWindowHeight=GI_GetWindowHeight +GI_create_font=GI_create_font +GI_textheight=GI_textheight +GI_textlength=GI_textlength +GI_init=GI_init +GI_set_dimension=GI_set_dimension +GC_blit_from_DIB=GC_blit_from_DIB +GC_draw_pixel=GC_draw_pixel +GC_set_clip=GC_set_clip +GI_create_DIB=GI_create_DIB +GI_redraw_window=GI_redraw_window +GI_ScaleDIB=GI_ScaleDIB +GI_get_resolution=GI_get_resolution +GI_widget_status_set=GI_widget_status_set ; EOF diff --git a/reactos/lib/rosky/libskygi/stubs.c b/reactos/lib/rosky/libskygi/stubs.c index bdcab28a730..020842a69f0 100644 --- a/reactos/lib/rosky/libskygi/stubs.c +++ b/reactos/lib/rosky/libskygi/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.1 2004/08/12 02:50:35 weiden Exp $ +/* $Id: stubs.c,v 1.2 2004/08/12 15:41:36 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: SkyOS GI library @@ -291,4 +291,339 @@ GI_wait_message(s_gi_msg *m, return 0; } + +/* + * @unimplemented + */ +int __cdecl +GC_draw_text(GC *gc, + s_region *rect, + unsigned char *text) +{ + STUB("GC_draw_text(0x%x, 0x%x, 0x%x) returns 0!\n", gc, rect, text); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_fg_color(GC *gc, + COLOR col) +{ + STUB("GC_set_fg_color(0x%x, 0x%x) returns 0!\n", gc, col); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_font(GC *gc, + unsigned int fontIndex) +{ + STUB("GC_set_font(0x%x, 0x%x) returns 0!\n", gc, fontIndex); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_font_size(GC *gc, + unsigned int fontSize) +{ + STUB("GC_set_font_size(0x%x, 0x%x) returns 0!\n", gc, fontSize); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_font_flags(GC *gc, + unsigned int flags) +{ + STUB("GC_set_font_flags(0x%x, 0x%x) returns 0!\n", gc, flags); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_font_param(GC *gc, + unsigned int font, + unsigned int fontsize, + unsigned int flags, + unsigned int trans) +{ + STUB("GC_set_font_param(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) returns 0!\n", gc, font, fontsize, flags, trans); + return 0; +} + + +/* + * @unimplemented + */ +sCreateApplication* __cdecl +GI_CreateApplicationStruct(void) +{ + STUB("GI_CreateApplicationStruct() returns NULL!\n"); + return NULL; +} + + +/* + * @unimplemented + */ +HANDLE __cdecl +GI_CreateApplication(sCreateApplication *application) +{ + STUB("GI_CreateApplication(0x%x) returns NULL!\n", application); + return NULL; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_EnableMouseTracking(HANDLE hWnd) +{ + STUB("GI_EnableMouseTracking(0x%x) returns 0!\n", hWnd); + return 0; +} + + +/* + * @unimplemented + */ +HANDLE __cdecl +GI_GetTopLevelWindow(HANDLE hWnd) +{ + STUB("GI_GetTopLevelWindow(0x%x) returns NULL!\n", hWnd); + return NULL; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_GetWindowX(HANDLE hWnd) +{ + STUB("GI_GetWindowX(0x%x) returns 0!\n", hWnd); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_GetWindowY(HANDLE hWnd) +{ + STUB("GI_GetWindowY(0x%x) returns 0!\n", hWnd); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_GetWindowWidth(HANDLE hWnd) +{ + STUB("GI_GetWindowWidth(0x%x) returns 0!\n", hWnd); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_GetWindowHeight(HANDLE hWnd) +{ + STUB("GI_GetWindowHeight(0x%x) returns 0!\n", hWnd); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_create_font(unsigned char *family, + unsigned char *style, + unsigned char *filename) +{ + STUB("GI_create_font(0x%x, 0x%x, 0x%x) returns 0!\n", family, style, filename); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_textheight(unsigned int index, + unsigned int size, + unsigned char *text) +{ + STUB("GI_textheight(0x%x, 0x%x, 0x%x) returns 0!\n", index, size, text); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_textlength(unsigned int index, + unsigned int size, + unsigned char *text) +{ + STUB("GI_textlength(0x%x, 0x%x, 0x%x) returns 0!\n", index, size, text); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_init(void) +{ + STUB("GI_init() returns 0!\n"); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_set_dimension(HANDLE hWnd, + int notify, + int x1, + int y1, + unsigned int width, + unsigned int height) +{ + STUB("GI_set_dimension(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x) returns 0!\n", hWnd, notify, x1, y1, width, height); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_blit_from_DIB(GC *gc, + DIB *dib, + int x, + int y) +{ + STUB("GC_blit_from_DIB(0x%x, 0x%x, 0x%x, 0x%x) returns 0!\n", gc, dib, x, y); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_draw_pixel(GC *gc, + int x, + int y) +{ + STUB("GC_draw_pixel(0x%x, 0x%x, 0x%x) returns 0!\n", gc, x, y); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GC_set_clip(GC *gc, + s_region *clip) +{ + STUB("GC_set_clip(0x%x, 0x%x) returns 0!\n", gc, clip); + return 0; +} + + +/* + * @unimplemented + */ +DIB* __cdecl +GI_create_DIB(void *data, + unsigned int width, + unsigned int height, + unsigned int bpp, + void *palette, + unsigned int palette_size) +{ + STUB("GI_create_DIB(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x) returns NULL!\n", data, width, height, bpp, palette, palette_size); + return NULL; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_redraw_window(s_window *win) +{ + STUB("GI_redraw_window(0x%x) returns 0!\n", win); + return 0; +} + + +/* + * @unimplemented + */ +DIB* __cdecl +GI_ScaleDIB(DIB *srcbitmap, + int iWidth, + int iHeight, + int filtertype, + float filterwidth) +{ + STUB("GI_ScaleDIB(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) returns 0!\n", srcbitmap, iWidth, iHeight, filtertype, filterwidth); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_get_resolution(s_resolution *res) +{ + STUB("GI_get_resolution(0x%x) returns 0!\n", res); + return 0; +} + + +/* + * @unimplemented + */ +int __cdecl +GI_widget_status_set(s_window *win, + unsigned char *text) +{ + STUB("GI_widget_status_set(0x%x, 0x%x) returns 0!\n", win, text); + return 0; +} + + /* EOF */