Move ROSKY to a separate SVN module.
authorFilip Navara <filip.navara@gmail.com>
Thu, 30 Jun 2005 12:19:21 +0000 (12:19 +0000)
committerFilip Navara <filip.navara@gmail.com>
Thu, 30 Jun 2005 12:19:21 +0000 (12:19 +0000)
svn path=/trunk/; revision=16339

15 files changed:
rosky/include/defines.h [new file with mode: 0644]
rosky/include/rosky.h [new file with mode: 0644]
rosky/include/structs.h [new file with mode: 0644]
rosky/lib/libsky/libsky.c [new file with mode: 0644]
rosky/lib/libsky/libsky.def [new file with mode: 0644]
rosky/lib/libsky/libsky.h [new file with mode: 0644]
rosky/lib/libsky/libsky.rc [new file with mode: 0644]
rosky/lib/libsky/resource.h [new file with mode: 0644]
rosky/lib/libsky/stubs.c [new file with mode: 0644]
rosky/lib/libskygi/libskygi.c [new file with mode: 0644]
rosky/lib/libskygi/libskygi.def [new file with mode: 0644]
rosky/lib/libskygi/libskygi.h [new file with mode: 0644]
rosky/lib/libskygi/libskygi.rc [new file with mode: 0644]
rosky/lib/libskygi/resource.h [new file with mode: 0644]
rosky/lib/libskygi/stubs.c [new file with mode: 0644]

diff --git a/rosky/include/defines.h b/rosky/include/defines.h
new file mode 100644 (file)
index 0000000..7aef204
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef __RSK_DEFINES_H
+#define __RSK_DEFINES_H
+
+/* Messages */
+#define MSG_MOUSE_BUT1_PRESSED         162
+#define MSG_MOUSE_BUT2_PRESSED         163
+#define MSG_MOUSE_BUT1_RELEASED                164
+#define MSG_MOUSE_BUT2_RELEASED                165
+#define MSG_MOUSE_MOVED                        166
+#define MSG_GUI_REDRAW                 170
+#define MSG_COMMAND                    2505
+#define MSG_QUIT                       2600
+#define MSG_DESTROY                    2700
+
+/* Window Styles */
+#define WF_DONT_EREASE_BACKGROUND      0x00000010
+#define WF_NO_FRAME                    0x00000020
+#define WF_MODAL                       0x00000100
+#define WF_HAS_MENU                    0x00001000
+#define WF_HAS_STATUSBAR               0x00002000
+#define WF_NO_INITIAL_DRAW             0x00008000
+#define WF_FOCUSABLE                   0x00010000
+#define WF_NOT_SIZEABLE                        0x00040000
+#define WF_SMALL_TITLE                 0x00080000
+#define WF_NOT_MOVEABLE                        0x00100000
+#define WF_NO_TITLE                    0x00200000
+#define WF_POPUP                       0x00400000
+#define WF_NO_BUTTONS                  0x00800000
+#define WF_FREEFORM                    0x08000000
+#define WF_USE_BACKGROUND              0x20000000
+#define WF_USER                                0x20000000
+#define WF_HIDE                                0x40000000
+#define WF_DESKTOP                     0x80000000
+#define WF_TRANSPARENT                 0x01000000
+
+/* GC types */
+#define GC_TYPE_WINDOW                 0x00000002
+#define GC_TYPE_DIB                    0x00000004
+
+/* Menu flags */
+#define MENU_SEPERATOR                 0x00000001
+
+/* Message box flags */
+#define WGF_MB_YESNO                   0x00000001
+#define WGF_MB_OK                      0x00000010
+#define WGF_MB_CANCEL                  0x00000100
+#define WGF_MB_ICON_INFO               0x00100000
+#define WGF_MB_ICON_ASK                        0x01000000
+#define WGF_MB_ICON_STOP               0x10000000
+
+/* Message box return values */
+#define ID_OK                          1
+#define ID_YES                         2
+#define ID_NO                          3
+#define ID_CANCEL                      4
+
+#endif /* __RSK_DEFINES_H */
diff --git a/rosky/include/rosky.h b/rosky/include/rosky.h
new file mode 100644 (file)
index 0000000..2c36abb
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * ReactOS SkyOS headers
+ */
+
+#include <rosky/structs.h>
+#include <rosky/defines.h>
+
diff --git a/rosky/include/structs.h b/rosky/include/structs.h
new file mode 100644 (file)
index 0000000..586a96a
--- /dev/null
@@ -0,0 +1,242 @@
+#ifndef __RSK_STRUCTS_H
+#define __RSK_STRUCTS_H
+
+typedef unsigned int COLOR;
+
+typedef struct region
+{
+  int x1;
+  int y1;
+  int x2;
+  int y2;
+} s_region;
+
+typedef struct s_gi_msg
+{
+  HANDLE win;
+  unsigned int type;
+  unsigned int para1;
+  unsigned int para2;
+  s_region rect;
+  struct s_gi_msg *next;
+  struct s_gi_msg *prev;
+  unsigned long long timestamp;
+} s_gi_msg;
+
+typedef struct DDB
+{
+  unsigned int color;
+  unsigned int width;
+  unsigned int height;
+  unsigned char *data;
+  unsigned int palette_size;
+  unsigned int transcolor;
+  unsigned char trans;
+  unsigned char *bAndMask;
+  unsigned char bUseAndMask;
+  unsigned int uiAndMaskWidth;
+  unsigned int uiAndMaskHeight;
+  COLOR *palette;
+} DDB;
+
+typedef struct DIB
+{
+  unsigned int color;
+  unsigned int width;
+  unsigned int height;
+  unsigned char *data;
+
+  unsigned int palette_size;
+  unsigned int transcolor;
+  unsigned char trans;
+
+  unsigned char *bAndMask;
+  unsigned char bUseAndMask;
+  unsigned int uiAndMaskWidth;
+  unsigned int uiAndMaskHeight;
+  unsigned int uiFlags;
+  COLOR *palette;
+} DIB;
+
+typedef struct GC
+{
+  unsigned int type;
+  HANDLE window;
+  DIB *hDIB;
+  unsigned int width;
+  unsigned int height;
+  s_region *clip;
+  COLOR fg_color;
+  COLOR bg_color;
+  COLOR trans_color;
+  unsigned int uiTransparentLevel;
+  unsigned int flags;
+  unsigned int fontIndex;
+  unsigned int fontSize;
+  unsigned int fontFlags;
+} GC;
+
+typedef struct sBlit
+{
+  DIB *hDIB;
+  DDB *hDDB;
+  int iDestX;
+  int iDestY;
+  int iSrcX;
+  int iSrcY;
+  int iWidth;
+  int iHeight;
+  unsigned int uiFlags;
+  unsigned int uiReserved0;
+  unsigned int uiReserved1;
+  unsigned int uiReserved2;
+  unsigned int uiReserved3;
+  unsigned int uiReserved4;
+  unsigned int uiReserved5;
+  unsigned int uiReserved6;
+  unsigned int uiReserved7;
+  unsigned int uiReserved8;
+  unsigned int uiReserved9;
+} sBlit;
+
+typedef struct widget_dynbmp_item
+{
+  DIB *hDib;
+  unsigned char *rawData;
+  struct widget_dynbmp_item *next;
+} widget_dynbmp_item;
+
+typedef struct widget_dynbmp
+{
+  unsigned int state;
+  unsigned int trans;
+  unsigned int transcolor;
+  unsigned int thread_id;
+  unsigned int timer_id;
+  widget_dynbmp_item *first;
+  widget_dynbmp_item *selected;
+} widget_dynbmp;
+
+typedef struct widget_popup
+{
+  unsigned int uiItemHeight;
+  unsigned int uiFlags;
+  HANDLE hFont;
+  unsigned int uiFontFlags;
+  unsigned int uiFontSize;
+
+  unsigned int uiColorSelectedBack;
+  unsigned int uiColorSelectedFore;
+  unsigned int uiColorBack;
+  unsigned int uiColorFore;
+  unsigned int uiWindowBackColor;
+
+  unsigned int uiSpacingX;
+} widget_popup;
+
+typedef struct widget_menu_item
+{
+  unsigned char text[255];
+  unsigned int ID;
+  unsigned int flags;
+  struct widget_menu_item *next;
+  struct widget_menu *child;
+  unsigned int focus;
+  unsigned int enabled;
+  unsigned int x;
+  HANDLE icon;
+  DIB *hDIB;
+  unsigned int has_icon;
+
+  /* sub items */
+  unsigned int width;
+  unsigned int count;
+} widget_menu_item;
+
+typedef struct widget_menu
+{
+  unsigned char focus;
+  unsigned int count;
+  unsigned int width;
+  unsigned int has_icons;
+  widget_menu_item *items;
+  widget_dynbmp *animation;
+  widget_popup *pPopUpData;
+  unsigned int uiLineColor;
+  unsigned int uiBackGroundColor;
+} widget_menu;
+
+typedef struct app_para
+{
+  unsigned char cpName[255];
+  unsigned int ulX;
+  unsigned int ulY;
+  unsigned int ulWidth;
+  unsigned int ulHeight;
+
+  void *win_func;
+  unsigned int ulStyle;
+  unsigned int ulBackGround;
+
+  unsigned int ulAppIcon;
+  widget_menu *pMenu;
+} app_para;
+
+typedef struct s_window
+{
+  unsigned char name[255];
+  unsigned int x;
+  unsigned int y;
+  unsigned int height;
+  unsigned int width;
+  unsigned int orgx;
+  unsigned int orgy;
+  unsigned long (__cdecl *win_func)(struct s_window *win, s_gi_msg *m);
+  HANDLE handle;
+
+  struct s_window *parent;
+  struct s_window *child;
+  struct s_window *next;
+
+  unsigned char focus;
+  struct s_window *focus_win;
+  void *windowData;
+  unsigned int windowDataSize;
+
+  unsigned int flags;
+  int origin_x;
+  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/rosky/lib/libsky/libsky.c b/rosky/lib/libsky/libsky.c
new file mode 100644 (file)
index 0000000..1336597
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * ROSky - SkyOS Application Layer
+ * Copyright (C) 2004 ReactOS Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Id$
+ *
+ * PROJECT:         SkyOS library
+ * FILE:            lib/libsky/libsky.c
+ * PURPOSE:         SkyOS library
+ *
+ * UPDATE HISTORY:
+ *      08/12/2004  Created
+ */
+
+#include <windows.h>
+/* #define NDEBUG */
+#include "libsky.h"
+#include "resource.h"
+
+/*
+ * @implemented
+ */
+void __cdecl
+__to_kernel(int ret)
+{
+  DBG("__to_kernel: ret=0x%x\n", ret);
+  ExitProcess(ret);
+}
+
+
+/*
+ * @implemented
+ */
+void __cdecl
+__libc_init_memory(void *end,
+                   void *__bss_end__,
+                   void *__bss_start__)
+{
+  DBG("__libc_init_memory: end=0x%x __bss_end__=0x%x __bss_start__=0x%x\n", end, __bss_end__, __bss_start__);
+  RtlZeroMemory(__bss_start__, (PCHAR)__bss_end__ - (PCHAR)__bss_start__);
+  /* FIXME - initialize other stuff */
+}
+
diff --git a/rosky/lib/libsky/libsky.def b/rosky/lib/libsky/libsky.def
new file mode 100644 (file)
index 0000000..b0b1193
--- /dev/null
@@ -0,0 +1,344 @@
+LIBRARY libsky.dll
+EXPORTS
+__libc_init_memory=__libc_init_memory
+__to_kernel=__to_kernel
+ctor_dtor_initialize=ctor_dtor_initialize
+get_usec_counter=get_usec_counter
+
+; MSVCRT
+time=MSVCRT.time
+write=MSVCRT.write
+vsprintf=MSVCRT.vsprintf
+vsnprintf=MSVCRT.vsnprintf
+vprintf=MSVCRT.vprintf
+vfprintf=MSVCRT.vfprintf
+utime=MSVCRT._utime
+umask=MSVCRT._umask
+unsetenv=MSVCRT.unsetenv
+ungetc=MSVCRT.ungetc
+toupper=MSVCRT.toupper
+tolower=MSVCRT.tolower
+tmpfile=MSVCRT.tmpfile
+time=MSVCRT.time
+system=MSVCRT.system
+spawnvp=MSVCRT._spawnvp
+spawnv=MSVCRT._spawnv
+spawn=MSVCRT._spawn
+strupr=MSVCRT.strupr
+strtoupper=MSVCRT.strtoupper
+strtoul=MSVCRT.strtoul
+strtolower=MSVCRT.strtolower
+strtol=MSVCRT.strtol
+strtok=MSVCRT.strtok
+strtod=MSVCRT.strtod
+strstr=MSVCRT.strstr
+strspn=MSVCRT.strspn
+strrchr=MSVCRT.strrchr
+strpbrk=MSVCRT.strpbrk
+strnlen=MSVCRT.strnlen
+strncpy=MSVCRT.strncpy
+strncmp=MSVCRT.strncmp
+strncat=MSVCRT.strncat
+strncasecmp=MSVCRT.strncasecmp
+strlwr=MSVCRT.strlwr
+strlen=MSVCRT.strlen
+strftime=MSVCRT.strftime
+strerror=MSVCRT.strerror
+strdup=MSVCRT.strdup
+strcspn=MSVCRT.strcspn
+strcpy=MSVCRT.strcpy
+strcoll=MSVCRT.strcoll
+strcmp=MSVCRT.strcmp
+strchr=MSVCRT.strchr
+strcat=MSVCRT.strcat
+strcasecmp=MSVCRT.strcasecmp
+stat=MSVCRT.stat
+sscanf=MSVCRT.sscanf
+srand=MSVCRT.srand
+sprintf=MSVCRT.sprintf
+setvbuf=MSVCRT.setvbuf
+setmode=MSVCRT.setmode
+setjmp=MSVCRT.setjmp
+setenv=MSVCRT.setenv
+setbuf=MSVCRT.setbuf
+seek=MSVCRT.seek
+rmdir=MSVCRT.rmdir
+rewind=MSVCRT.rewind
+rename=MSVCRT.rename
+remove=MSVCRT.remove
+realloc=MSVCRT.realloc
+read=MSVCRT.read
+rand=MSVCRT.rand
+raise=MSVCRT.raise
+qsort=MSVCRT.qsort
+puts=MSVCRT.puts
+putenv=MSVCRT.putenv
+putchar=MSVCRT.putchar
+printf=MSVCRT.printf
+popen=MSVCRT.popen
+pipe=MSVCRT.pipe
+pclose=MSVCRT.pclose
+open=MSVCRT.open
+mktime=MSVCRT.mktime
+mktemp=MSVCRT.mktemp
+mkdir=MSVCRT.mkdir
+memset=MSVCRT.memset
+memmove=MSVCRT.memmove
+memcpy=MSVCRT.memcpy
+memcmp=MSVCRT.memcmp
+memchr=MSVCRT.memchr
+malloc=MSVCRT.malloc
+lseek=MSVCRT.lseek
+longjmp=MSVCRT.longjmp
+localtime=MSVCRT.localtime
+isxdigit=MSVCRT.isxdigit
+isupper=MSVCRT.isupper
+isspace=MSVCRT.isspace
+ispunct=MSVCRT.ispunct
+isprint=MSVCRT.isprint
+islower=MSVCRT.islower
+isgraph=MSVCRT.isgraph
+isdigit=MSVCRT.isdigit
+iscntrl=MSVCRT.iscntrl
+isatty=MSVCRT.isatty
+isascii=MSVCRT.isascii
+isalpha=MSVCRT.isalpha
+isalnum=MSVCRT.isalnum
+gmtime=MSVCRT.gmtime
+gets=MSVCRT.gets
+getenv=MSVCRT.getenv
+getcwd=MSVCRT.getcwd
+fwrite=MSVCRT.fwrite
+ftruncate=MSVCRT.ftruncate
+ftell=MSVCRT.ftell
+fstat=MSVCRT.fstat
+fseek=MSVCRT.fseek
+fscanf=MSVCRT.fscanf
+freopen=MSVCRT.freopen
+free=MSVCRT.free
+fread=MSVCRT.fread
+fputs=MSVCRT.fputs
+fputc=MSVCRT.fputc
+fprintf=MSVCRT.fprintf
+fopen=MSVCRT.fopen
+fileno=MSVCRT.fileno
+filelength=MSVCRT._filelength
+fgets=MSVCRT.fgets
+fgetpos=MSVCRT.fgetpos
+fgetc=MSVCRT.fgetc
+fflush=MSVCRT.fflush
+fdopen=MSVCRT.fdopen
+fcntl=MSVCRT.fcntl
+fclose=MSVCRT.fclose
+fchmod=MSVCRT.fchmod
+exit=MSVCRT.exit
+execvp=MSVCRT._execvp
+execv=MSVCRT._execv
+execl=MSVCRT._execl
+exec=MSVCRT._exec
+dup2=MSVCRT._dup2
+dup=MSVCRT._dup
+ctime=MSVCRT.ctime
+creat=MSVCRT._creat
+close=MSVCRT.close
+chmod=MSVCRT.chmod
+chdir=MSVCRT.chdir
+calloc=MSVCRT.calloc
+bsearch=MSVCRT.bsearch
+atol=MSVCRT.atol
+atoi=MSVCRT.atoi
+atof=MSVCRT.atof
+atexit=MSVCRT.atexit
+asctime=MSVCRT.asctime
+access=MSVCRT._access
+abs=MSVCRT.abs
+abort=MSVCRT.abort
+
+; WS2_32
+socket=WS2_32.socket
+setsockopt=WS2_32.setsockopt
+sendto=WS2_32.sendto
+send=WS2_32.send
+select=WS2_32.select
+recvfrom=WS2_32.recvfrom
+recv=WS2_32.recv
+ntohs=WS2_32.ntohs
+ntohl=WS2_32.ntohl
+ioctlsocket=WS2_32.ioctlsocket
+inet_ntoa=WS2_32.inet_ntoa
+inet_addr=WS2_32.inet_addr
+htons=WS2_32.htons
+htonl=WS2_32.htonl
+getsockopt=WS2_32.getsockopt
+getsockname=WS2_32.getsockname
+getservbyname=WS2_32.getservbyname
+getpeername=WS2_32.getpeername
+gethostname=WS2_32.gethostname
+gethostbyaddr=WS2_32.gethostbyaddr
+connect=WS2_32.connect
+closesocket=WS2_32.closesocket
+accept=WS2_32.accept
+
+; NTDLL
+_alloca=NTDLL._alloca_probe
+
+;waittask
+;waitpid
+;wait_for_task_state
+;wait
+;vfork
+;unlink
+;umount
+;tcsetattr
+;tcgetattr
+;tasklogging
+;system_shutdown
+;sys_setgroups
+;sys_nerr
+;sys_info
+;sys_errlist
+;sync
+;sleeptaskusec
+;sleep
+;skyos_get_file_from_path
+;signal
+;shutdown
+;setuid
+;setpwent
+;sethostname
+;setgroups
+;setgrent
+;setgid
+;set_quantum
+;set_optind
+;set_optarg
+;semaphore_release
+;semaphore_destroy
+;semaphore_create
+;semaphore_aquire
+;sbrk
+;rindex
+;readdir
+;pspawn
+;printd
+;posix_ioctl
+;perror
+;os_image_info
+;opendir
+;mount
+;module_unload
+;mmap
+;mem_dump_stdout
+;mem_dump
+;lstat
+;listen
+;link
+;libc_get_impure_ptr
+;inet_aton
+;kill
+;keyboard_set_mapping
+;kernel_mem_dump
+;ioctl
+;index
+;in_ntoa
+;in_aton
+;hex2dec
+;getwd
+;getuser
+;getuid
+;gettimeofday
+;gettaskname
+;getpwuid
+;getpwnam
+;getpwent
+;getpid
+;getpass
+;getoptind
+;getoptargpointer
+;getopt
+;getlogin
+;getgroups
+;getgroup
+;getgrnam
+;getgrid
+;getgrgid
+;getgrent
+;getgid
+;geteuid
+;getegid
+;get_usec_counter
+;get_ticks
+;get_task_state
+;get_task_info
+;get_environ
+;get_curtime
+;fsync
+;fsinfo
+;fork
+;exec_for_debug
+;exec_arg
+;environ_get
+;endpwent
+;endgrent
+;do_statfs
+;dlm_module_info
+;dlm_load
+;debug_data
+;createdir
+;create_ramdisk
+;closedir
+;chown
+;check_task_valid
+;cache_set_size
+;bzero
+;bind
+;bcopy
+;bcmp
+;alarm
+;_readline
+;_getopt_internal
+;_exit
+;__umoddi3
+;__udivdi3
+;__to_kernel
+;__tcsetattr
+;__tcgetattr
+;__swbuf
+;__srget
+;__pure_virtual
+;__moddi3
+;__errno
+;__divdi3
+;__builtin_vec_new
+;__builtin_vec_delete
+;__builtin_new
+;__builtin_delete
+;__assert
+;TimeDebugAdd
+;TimeDebug
+;ThreadSuspend
+;ThreadSleep
+;ThreadSetState
+;ThreadResume
+;ThreadIsValid
+;ThreadGetPid
+;ThreadCreate
+;SystemGetPartitionSize
+;SystemGetPartitionInfo
+;SystemGetDiskParameter
+;SystemEventServices_Initialize
+;ParseIniFile
+;GetStringOption
+;GetOption
+;GetMeasureValue
+;GetMeasurePointByIndex
+;GetLongOption
+;GetDllFunction
+;GetDirEntry
+;GetBootKey
+;DllMainDefault
+;DllLoadKernel
+;DllLoad
+;CheckBootOption
+
+; EOF
diff --git a/rosky/lib/libsky/libsky.h b/rosky/lib/libsky/libsky.h
new file mode 100644 (file)
index 0000000..0bdb5da
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __LIBSKY_H
+#define __LIBSKY_H
+
+void __cdecl DbgPrint(char *, ...);
+
+#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 */
+
+/* EOF */
diff --git a/rosky/lib/libsky/libsky.rc b/rosky/lib/libsky/libsky.rc
new file mode 100644 (file)
index 0000000..068f9eb
--- /dev/null
@@ -0,0 +1,7 @@
+/* $Id$ */
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS SkyOS library\0"
+#define REACTOS_STR_INTERNAL_NAME      "libsky\0"
+#define REACTOS_STR_ORIGINAL_FILENAME  "libsky.dll\0"
+#include <reactos/version.rc>
diff --git a/rosky/lib/libsky/resource.h b/rosky/lib/libsky/resource.h
new file mode 100644 (file)
index 0000000..c197b1f
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __LIBSKY_RESOURCE_H
+#define __LIBSKY_RESOURCE_H
+
+#endif /* __LIBSKY_RESOURCE_H */
+
+/* EOF */
diff --git a/rosky/lib/libsky/stubs.c b/rosky/lib/libsky/stubs.c
new file mode 100644 (file)
index 0000000..3497500
--- /dev/null
@@ -0,0 +1,107 @@
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         SkyOS library
+ * FILE:            lib/libsky/stubs.c
+ * PURPOSE:         libsky.dll stubs
+ * NOTES:           If you implement a function, remove it from this file
+ *
+ * UPDATE HISTORY:
+ *      08/12/2004  Created
+ */
+#include <windows.h>
+/* #define NDEBUG */
+#include "libsky.h"
+
+
+typedef void (__cdecl *func_ptr) (void);
+
+/*
+ * @unimplemented
+ */
+void __cdecl
+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");
+  }
+}
+
+/*
+ * @unimplemented
+ */
+unsigned long long __cdecl
+get_usec_counter(void)
+{
+  /* FIXME - better implementation */
+  return (unsigned long long)GetTickCount() * 1000LL;
+}
+
+/* EOF */
diff --git a/rosky/lib/libskygi/libskygi.c b/rosky/lib/libskygi/libskygi.c
new file mode 100644 (file)
index 0000000..b0f50cc
--- /dev/null
@@ -0,0 +1,1210 @@
+/*
+ * ROSky - SkyOS Application Layer
+ * Copyright (C) 2004 ReactOS Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Id$
+ *
+ * PROJECT:         SkyOS GI library
+ * FILE:            lib/libskygi/libskygi.c
+ * PURPOSE:         SkyOS GI library
+ *
+ * UPDATE HISTORY:
+ *      08/12/2004  Created
+ */
+#include <windows.h>
+#include <stdio.h>
+#include <rosky/rosky.h>
+#include "libskygi.h"
+#include "resource.h"
+
+typedef struct
+{
+  s_window Window;
+  HWND hWnd;
+  BOOL MouseInput;
+} SKY_WINDOW, *PSKY_WINDOW;
+
+typedef struct
+{
+  widget_menu Menu;
+  HMENU hMenu;
+} SKY_MENU, *PSKY_MENU;
+
+typedef struct
+{
+  widget_menu_item MenuItem;
+  MENUITEMINFOW MenuItemInfo;
+} SKY_MENUITEM, *PSKY_MENUITEM;
+
+typedef struct
+{
+  GC GraphicsContext;
+  HDC hDC;
+} SKY_GC, *PSKY_GC;
+
+typedef struct
+{
+  DIB Dib;
+  HBITMAP hBitmap;
+  HDC hAssociateDC;
+} SKY_DIB, *PSKY_DIB;
+
+static ATOM SkyClassAtom;
+static BOOL SkyClassRegistered = FALSE;
+
+/**
+ * Map a SkyOS window style to Windows one.
+ *
+ * @param SkyStyle SkyOS window style (WF_* flags).
+ * @param ExStyle Contains Windows extended window style on exit.
+ *
+ * @return Windows window style (WS_* flags).
+ *
+ * @todo Handle
+ *  WF_MODAL, WF_HAS_MENU, WF_HAS_STATUSBAR, WF_FREEFORM, WF_FOCUSABLE,
+ *  WF_USER, WF_DESKTOP, WF_NOT_MOVEABLE, WF_NO_BUTTONS, WF_TRANSPARENT,
+ *  WF_NO_INITIAL_DRAW, WF_USE_BACKGROUND, WF_DONT_EREASE_BACKGROUND,
+ *  WF_NO_FRAME.
+ */
+ULONG
+IntMapWindowStyle(ULONG SkyStyle, ULONG *ExStyle)
+{
+   ULONG Style;
+
+   Style = (SkyStyle & WF_HIDE) ? 0 : WS_VISIBLE;
+   Style |= (SkyStyle & WF_NO_TITLE) ? 0 : WS_CAPTION;
+   Style |= (SkyStyle & WF_NOT_SIZEABLE) ? WS_THICKFRAME : 0;
+   Style |= (SkyStyle & WF_POPUP) ? WS_POPUP : 0;
+   Style |= (SkyStyle & WF_NO_BUTTONS) ? 0 :
+            ((SkyStyle & WF_NOT_SIZEABLE) ? 0 : WS_MAXIMIZEBOX) |
+            WS_MINIMIZEBOX | WS_SYSMENU;
+   *ExStyle = (SkyStyle & WF_SMALL_TITLE) ? WS_EX_TOOLWINDOW : 0;
+
+   return Style;
+}
+
+
+/**
+ * Dispatch a Sky Message to the appropriate window callback
+ *
+ * @param win Specifies the destination window
+ * @param type The type of the message (see MSG_ constants)
+ * @param para1 Additional parameter 1
+ * @param para2 Additional parameter 2
+ *
+ * @return Returns the return value of the window callback function
+ */
+unsigned long
+IntDispatchMsg(s_window *win, unsigned int type, unsigned int para1, unsigned int para2)
+{
+  s_gi_msg msg;
+  unsigned long Ret;
+  
+  /* fill the members of the struct */
+  msg.win = win;
+  msg.type = type;
+  msg.para1 = para1;
+  msg.para2 = para2;
+  msg.next = NULL; /* ??? */
+  msg.prev = NULL; /* ??? */
+  /* FIXME */
+  msg.timestamp = (unsigned long long)GetTickCount() * 1000LL;
+  
+  DBG("Dispatching window (0x%x) message type %d\n", win, type);
+  Ret = win->win_func(win, &msg);
+  DBG("Dispatched window (0x%x) message type %d, returned 0x%x\n", win, type, Ret);
+  return Ret;
+}
+
+
+/**
+ * Dispatch a Sky Message with a update rect to the appropriate window callback
+ *
+ * @param win Specifies the destination window
+ * @param type The type of the message (see MSG_ constants)
+ * @param para1 Additional parameter 1
+ * @param para2 Additional parameter 2
+ * @param rect Rectangle of the window to be repainted
+ *
+ * @return Returns the return value of the window callback function
+ */
+unsigned long
+IntDispatchMsgRect(s_window *win, unsigned int type, unsigned int para1, unsigned int para2, s_region *rect)
+{
+  s_gi_msg msg;
+  unsigned long Ret;
+
+  /* fill the members of the struct */
+  msg.win = win;
+  msg.type = type;
+  msg.para1 = para1;
+  msg.para2 = para2;
+  msg.next = NULL; /* ??? */
+  msg.prev = NULL; /* ??? */
+  msg.rect = *rect;
+  /* FIXME */
+  msg.timestamp = (unsigned long long)GetTickCount() * 1000LL;
+
+  DBG("Dispatching window (0x%x) message type %d\n", win, type);
+  Ret = win->win_func(win, &msg);
+  DBG("Dispatched window (0x%x) message type %d, returned 0x%x\n", win, type, Ret);
+  return Ret;
+}
+
+
+/**
+ * Determines whether a win32 message should cause a Sky message to be dispatched
+ *
+ * @param skw Specifies the destination window
+ * @param Msg Contains the win32 message
+ * @param smsg Address to the sky message structure that will be filled in with
+ *             appropriate information in case a sky message should be dispatched
+ *
+ * @return Returns TRUE if a Sky message should be dispatched
+ */
+BOOL
+IntIsSkyMessage(PSKY_WINDOW skw, MSG *Msg, s_gi_msg *smsg)
+{
+  smsg->win = skw;
+
+  switch(Msg->message)
+  {
+    case WM_DESTROY:
+      smsg->type = MSG_DESTROY;
+      smsg->para1 = 0;
+      smsg->para2 = 0;
+      return TRUE;
+
+    case WM_PAINT:
+    {
+      RECT rc;
+      PAINTSTRUCT ps;
+      
+      if(GetUpdateRect(skw->hWnd, &rc, FALSE))
+      {
+        BeginPaint(skw->hWnd, &ps);
+        EndPaint(skw->hWnd, &ps);
+
+        smsg->type = MSG_GUI_REDRAW;
+        smsg->para1 = 0;
+        smsg->para2 = 0;
+
+        smsg->rect.x1 = rc.left;
+        smsg->rect.y1 = rc.top;
+        smsg->rect.x2 = rc.right;
+        smsg->rect.y2 = rc.bottom;
+
+        return TRUE;
+      }
+      break;
+    }
+
+    case WM_QUIT:
+      smsg->type = MSG_QUIT;
+      smsg->para1 = 0;
+      smsg->para2 = 0;
+      return TRUE;
+
+    case WM_COMMAND:
+      smsg->type = MSG_COMMAND;
+      smsg->para1 = LOWORD(Msg->wParam);
+      return TRUE;
+
+    case WM_MOUSEMOVE:
+      if(skw->MouseInput)
+      {
+        smsg->type = MSG_MOUSE_MOVED;
+        goto DoMouseInputMessage;
+      }
+      break;
+
+    case WM_LBUTTONDOWN:
+      smsg->type = MSG_MOUSE_BUT1_PRESSED;
+      goto DoMouseInputMessage;
+
+    case WM_LBUTTONUP:
+      smsg->type = MSG_MOUSE_BUT1_RELEASED;
+      goto DoMouseInputMessage;
+
+    case WM_RBUTTONDOWN:
+      smsg->type = MSG_MOUSE_BUT2_PRESSED;
+      goto DoMouseInputMessage;
+
+    case WM_RBUTTONUP:
+    {
+      POINT pt;
+
+      smsg->type = MSG_MOUSE_BUT2_RELEASED;
+
+DoMouseInputMessage:
+#if 0
+      pt.x = LOWORD(Msg->lParam);
+      pt.y = HIWORD(Msg->lParam);
+#else
+      pt = Msg->pt;
+      MapWindowPoints(NULL, skw->hWnd, &pt, 1);
+#endif
+      smsg->para1 = pt.x;
+      smsg->para2 = pt.y;
+      return TRUE;
+    }
+  }
+  
+  return FALSE;
+}
+
+
+/**
+ * The standard win32 window procedure that handles win32 messages delivered from ReactOS
+ *
+ * @param hWnd Handle of the window
+ * @param msg Specifies the type of the message
+ * @param wParam Additional data to the message
+ * @param lParam Additional data to the message
+ *
+ * @return Depends on the message type
+ */
+LRESULT CALLBACK
+IntDefaultWin32Proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+  PSKY_WINDOW skw;
+
+  if (msg == WM_NCCREATE)
+  {
+    /*
+     * Save the pointer to the structure so we can access it later when
+     * dispatching the Win32 messages so we know which sky window it is
+     * and dispatch the right messages.
+     */
+    skw = (PSKY_WINDOW)((LPCREATESTRUCTW)lParam)->lpCreateParams;
+    SetWindowLongPtr(hWnd, GWL_USERDATA, (ULONG_PTR)skw);
+  }
+  else
+  {
+    skw = (PSKY_WINDOW)GetWindowLongPtr(hWnd, GWL_USERDATA);
+    if (skw == NULL)
+      return DefWindowProcW(hWnd, msg, wParam, lParam);
+  }
+
+  switch(msg)
+  {
+    case WM_CLOSE:
+      IntDispatchMsg(&skw->Window, MSG_DESTROY, 0, 0);
+      return 0;
+
+    case WM_CREATE:
+      return 1;
+    
+    /* FIXME: Find a more general solution! */
+    /* We can get there for message sent by SendMessage. */
+    case WM_PAINT:
+    {
+      PAINTSTRUCT ps;
+      s_region srect;
+      
+      BeginPaint(hWnd, &ps);
+      srect.x1 = ps.rcPaint.left;
+      srect.y1 = ps.rcPaint.top;
+      srect.x2 = ps.rcPaint.right;
+      srect.y2 = ps.rcPaint.bottom;
+      IntDispatchMsgRect(&skw->Window, MSG_GUI_REDRAW, 0, 0, &srect);
+      EndPaint(hWnd, &ps);
+      
+      return 0;
+    }
+
+    case WM_COMMAND:
+      IntDispatchMsg(&skw->Window, MSG_COMMAND, LOWORD(wParam), 0);
+      return 0;
+
+    case WM_ERASEBKGND:
+      return 1; /* don't handle this message */
+  }
+
+  return DefWindowProcW(hWnd, msg, wParam, lParam);
+}
+
+
+/**
+ * Registers a Win32 window class for all Sky windows
+ *
+ * @return Returns the atom of the class registered.
+ */
+ATOM
+IntRegisterClass(void)
+{
+  WNDCLASSW wc;
+  
+  wc.lpszClassName = L"ROSkyWindow";
+  wc.lpfnWndProc = IntDefaultWin32Proc;
+  wc.style = CS_VREDRAW | CS_HREDRAW;
+  wc.hInstance = GetModuleHandleW(NULL);
+  wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
+  wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
+  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+  wc.lpszMenuName = NULL;
+  wc.cbClsExtra = 0;
+  wc.cbWndExtra = 0;
+  
+  return RegisterClassW(&wc);
+}
+
+
+/*
+ * @implemented
+ */
+s_window* __cdecl
+GI_create_app(app_para *p)
+{
+  PSKY_WINDOW skw;
+  ULONG Style, ExStyle;
+  WCHAR WindowName[sizeof(p->cpName) / sizeof(p->cpName[0])];
+  RECT ClientRect;
+  
+  DBG("GI_create_app(0x%x)\n", p);
+
+  /* FIXME - lock */
+  if(!SkyClassRegistered)
+  {
+    SkyClassAtom = IntRegisterClass();
+    SkyClassRegistered = SkyClassAtom != 0;
+
+    if(!SkyClassRegistered)
+    {
+      DBG("Unable to register the ROSkyWindow class\n");
+      return NULL;
+    }
+  }
+  /* FIXME - unlock */
+
+  skw = (PSKY_WINDOW)HeapAlloc(GetProcessHeap(),
+                               HEAP_ZERO_MEMORY,
+                               sizeof(SKY_WINDOW));
+  if(skw == NULL)
+  {
+    DBG("Not enough memory to allocate a SKY_WINDOW structure!\n");
+    return NULL;
+  }
+  
+  /* Convert the Sky window style to a Win32 window style */
+  Style = IntMapWindowStyle(p->ulStyle, &ExStyle);
+  
+  /* convert the window caption to unicode */
+  MultiByteToWideChar(CP_UTF8, 0, (char*)p->cpName, -1, WindowName,
+                      sizeof(WindowName) / sizeof(WindowName[0]));
+  
+  skw->Window.win_func = p->win_func;
+  /* FIXME - fill the window structure */
+
+  /*
+   * We must convert the client rect passed in to the window rect expected
+   * by CreateWindowExW.
+   */
+  ClientRect.left = 0;
+  ClientRect.top = 0;
+  ClientRect.right = 0 + p->ulWidth;
+  ClientRect.bottom = 0 + p->ulHeight;
+  AdjustWindowRectEx(&ClientRect, Style, p->ulStyle & WF_HAS_MENU, ExStyle);
+
+  DBG("Menu: %x\n", p->pMenu ? ((PSKY_MENU)p->pMenu)->hMenu : NULL);
+
+  /* create the Win32 window */
+  skw->hWnd = CreateWindowExW(ExStyle,
+                              L"ROSkyWindow",
+                              WindowName,
+                              WS_OVERLAPPEDWINDOW,
+                              p->ulX,
+                              p->ulY,
+                              ClientRect.right - ClientRect.left,
+                              ClientRect.bottom - ClientRect.top,
+                              NULL,
+                              p->pMenu ? ((PSKY_MENU)p->pMenu)->hMenu : NULL,
+                              GetModuleHandleW(NULL),
+                              skw);
+
+  if(skw->hWnd == NULL)
+  {
+    DBG("CreateWindow() failed!\n");
+    HeapFree(GetProcessHeap(), 0, skw);
+    return NULL;
+  }
+    
+  DBG("Created Win32 window: 0x%x\n", skw->hWnd);
+  
+  return &skw->Window;
+}
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_destroy_window(s_window *win)
+{
+  PSKY_WINDOW skw = (PSKY_WINDOW)win;
+
+  DBG("GI_destroy_window(0x%x)\n", win);
+  DestroyWindow(skw->hWnd);
+  HeapFree(GetProcessHeap(), 0, skw);
+
+  return 0;
+}
+
+
+/*
+ * @implemented
+ */
+unsigned int __cdecl
+GI_wait_message(s_gi_msg *m,
+                s_window* w)
+{
+  MSG Msg;
+  BOOL Ret, SkyMessage;
+  HWND hwndFilter;
+  PSKY_WINDOW msgwnd;
+  
+  DBG("GI_wait_message(0x%x, 0x%x)\n", m, w);
+  
+  hwndFilter = (w != NULL ? ((PSKY_WINDOW)w)->hWnd : NULL);
+  do
+  {
+    Ret = GetMessage(&Msg, hwndFilter, 0, 0);
+
+    /* loop until we found a message that a sky app would handle, too */
+    RtlZeroMemory(m, sizeof(s_gi_msg));
+
+    if(Msg.hwnd != NULL && (msgwnd = (PSKY_WINDOW)GetWindowLongPtrW(Msg.hwnd, GWL_USERDATA)))
+      {
+        SkyMessage = IntIsSkyMessage(msgwnd, &Msg, m);
+      }
+    else
+      {
+        SkyMessage = FALSE;
+      }
+
+    if (!SkyMessage)
+    {
+      /* We're not interested in dispatching a sky message, try again */
+      TranslateMessage(&Msg);
+      DispatchMessage(&Msg);
+    }
+  }
+  while (!SkyMessage);
+  
+  return Ret;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_dispatch_message(s_window *win,
+                    s_gi_msg *m)
+{
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  DBG("GI_dispatch_message(0x%x, 0x%x - %d)\n", win, m, m->type);
+  /* dispatch the SkyOS message to the SkyOS window procedure */
+  if (skywnd != 0)
+    return skywnd->Window.win_func(win, m);
+  return 1;
+}
+
+
+/*
+ * @implemented
+ */
+HRESULT __cdecl
+GI_ShowApplicationWindow(s_window *win)
+{
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  DBG("GI_ShowApplicationWindow(0x%x)\n", win);
+  ShowWindow(skywnd->hWnd, SW_SHOW);
+  return 1;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_redraw_window(s_window *win)
+{
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  DBG("GI_redraw_window(0x%x)!\n", win);
+  if(skywnd != NULL)
+  {
+    RedrawWindow(skywnd->hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
+  }
+  return 1;
+}
+
+
+/*
+ * @implemented
+ */
+void __cdecl
+GI_post_quit(s_window *win)
+{
+  DBG("GI_post_quit(0x%x)\n", win);
+  PostMessage(((PSKY_WINDOW)win)->hWnd, WM_QUIT, 0, 0);
+}
+
+
+/*
+ * @implemented
+ */
+sCreateApplication* __cdecl
+GI_CreateApplicationStruct(void)
+{
+  sCreateApplication *app;
+  
+  app = (sCreateApplication*)HeapAlloc(GetProcessHeap(),
+                                       HEAP_ZERO_MEMORY,
+                                       sizeof(sCreateApplication));
+  STUB("GI_CreateApplicationStruct() returns 0x%x (allocated structure on the heap)!\n", app);
+
+  return app;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_GetWindowX(s_window *win)
+{
+  RECT rc;
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  if((skywnd != NULL) && GetWindowRect(skywnd->hWnd, &rc))
+  {
+    MapWindowPoints(HWND_DESKTOP, GetParent(skywnd->hWnd), (LPPOINT)&rc, 2);
+    DBG("GI_GetWindowS(0x%x) returns %d!\n", win, rc.left);
+    return rc.left;
+  }
+  #if DEBUG
+  else
+  {
+    DBG("GI_GetWindowS(0x%x) failed!\n", win);
+  }
+  #endif
+  return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_GetWindowY(s_window *win)
+{
+  RECT rc;
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  if((skywnd != NULL) && GetWindowRect(skywnd->hWnd, &rc))
+  {
+    MapWindowPoints(HWND_DESKTOP, GetParent(skywnd->hWnd), (LPPOINT)&rc, 2);
+    DBG("GI_GetWindowY(0x%x) returns %d!\n", win, rc.top);
+    return rc.left;
+  }
+  #if DEBUG
+  else
+  {
+    DBG("GI_GetWindowY(0x%x) failed!\n", win);
+  }
+  #endif
+  return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_GetWindowWidth(s_window *win)
+{
+  RECT rc;
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  if((skywnd != NULL) && GetWindowRect(skywnd->hWnd, &rc))
+  {
+    DBG("GI_GetWindowWidth(0x%x) returns %d!\n", win, (rc.right - rc.left));
+    return (rc.right - rc.left);
+  }
+  #if DEBUG
+  else
+  {
+    DBG("GI_GetWindowWidth(0x%x) failed!\n", win);
+  }
+  #endif
+  return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_GetWindowHeight(s_window *win)
+{
+  RECT rc;
+  PSKY_WINDOW skywnd = (PSKY_WINDOW)win;
+  if((skywnd != NULL) && GetWindowRect(skywnd->hWnd, &rc))
+  {
+    DBG("GI_GetWindowHeight(0x%x) returns %d!\n", win, (rc.bottom - rc.top));
+    return (rc.bottom - rc.top);
+  }
+  #if DEBUG
+  else
+  {
+    DBG("GI_GetWindowHeight(0x%x) failed!\n", win);
+  }
+  #endif
+  return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+s_window* __cdecl
+GI_GetTopLevelWindow(s_window *win)
+{
+  STUB("GI_GetTopLevelWindow(0x%x) returns 0x%x!\n", win, win);
+  return win;
+}
+
+
+/*
+ * @implemented
+ */
+DIB* __cdecl
+GI_create_DIB(void *Data,
+              unsigned int Width,
+              unsigned int Height,
+              unsigned int Bpp,
+              void *Palette,
+              unsigned int PaletteSize)
+{
+   SKY_DIB *Dib;
+   BITMAPINFO *BitmapInfo;
+
+   DBG("GI_create_DIB(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", 
+       Data, Width, Height, Bpp, Palette, PaletteSize);
+
+   Dib = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SKY_DIB));
+   if (Dib == NULL)
+   {
+      return NULL;
+   }
+
+   BitmapInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) +
+                          PaletteSize * sizeof(RGBQUAD));
+   if (BitmapInfo == NULL)
+   {
+      HeapFree(GetProcessHeap(), 0, Dib);
+      return NULL;
+   }
+
+   Dib->Dib.color = Bpp;
+   Dib->Dib.width = Width;
+   Dib->Dib.height = Height;
+   Dib->Dib.data = Data;
+   Dib->Dib.palette_size = PaletteSize;
+   Dib->Dib.palette = Palette;
+
+   BitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+   BitmapInfo->bmiHeader.biWidth = Width;
+   BitmapInfo->bmiHeader.biHeight = Height;
+   BitmapInfo->bmiHeader.biPlanes = 1;
+   BitmapInfo->bmiHeader.biBitCount = Bpp;
+   BitmapInfo->bmiHeader.biCompression = BI_RGB;
+   BitmapInfo->bmiHeader.biSizeImage = 0;
+   BitmapInfo->bmiHeader.biXPelsPerMeter = 0;
+   BitmapInfo->bmiHeader.biYPelsPerMeter = 0;
+   BitmapInfo->bmiHeader.biClrUsed = PaletteSize;
+   BitmapInfo->bmiHeader.biClrImportant = 0;
+   RtlCopyMemory(BitmapInfo->bmiColors, Palette, PaletteSize * sizeof(RGBQUAD));
+
+   Dib->hBitmap = CreateDIBSection(NULL,
+                                   BitmapInfo,
+                                   DIB_RGB_COLORS,
+                                   Data,
+                                   NULL,
+                                   0);
+   HeapFree(GetProcessHeap(), 0, BitmapInfo);
+   if (Dib->hBitmap == NULL)
+   {
+      HeapFree(GetProcessHeap(), 0, Dib);
+      return NULL;
+   }
+
+   return (DIB*)Dib;
+}
+
+
+/*
+ * @implemented
+ */
+GC* __cdecl
+GC_create_connected(unsigned int Type,
+                    unsigned int Width,
+                    unsigned int Height,
+                    s_window *Win)
+{
+   SKY_GC *Gc;
+
+   DBG("GC_create_connected(0x%x, 0x%x, 0x%x, 0x%x)\n",
+       Type, Width, Height, Win);
+
+   if(Win == NULL)
+   {
+     DBG("GC_create_connected: no window specified! returned NULL!\n");
+     return NULL;
+   }
+
+   Gc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SKY_GC));
+   if (Gc == NULL)
+   {
+      return NULL;
+   }
+
+   Gc->GraphicsContext.type = Type;
+   Gc->GraphicsContext.width = Width;
+   Gc->GraphicsContext.height = Height;
+
+   switch (Type)
+   {
+      case GC_TYPE_DIB:
+         Gc->hDC = CreateCompatibleDC(0);
+         if (Gc->hDC)
+         {
+            Gc->GraphicsContext.hDIB = (DIB*)Win;
+            SelectObject(Gc->hDC, ((PSKY_DIB)Win)->hBitmap);
+            ((PSKY_DIB)Win)->hAssociateDC = Gc->hDC;
+         }
+         break;
+
+      case GC_TYPE_WINDOW:
+         Gc->hDC = GetDC(((PSKY_WINDOW)Win)->hWnd);
+         Gc->GraphicsContext.window = Win;
+         break;
+
+      default:
+         DBG("Unknown GC type: %x\n", Type);
+   }
+
+   if (Gc->hDC == NULL)
+   {
+      HeapFree(GetProcessHeap(), 0, Gc);
+      return NULL;
+   }
+   else
+   {
+      SelectObject(Gc->hDC, GetStockObject(DC_BRUSH));
+      SelectObject(Gc->hDC, GetStockObject(DC_PEN));
+   }
+
+   return (GC*)Gc;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_set_fg_color(GC *Gc,
+                COLOR Color)
+{
+   if(Gc != NULL)
+   {
+     Gc->fg_color = Color;
+     SetDCPenColor(((PSKY_GC)Gc)->hDC, Color);
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_set_fg_color: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_set_bg_color(GC *Gc,
+                COLOR Color)
+{
+   if(Gc != NULL)
+   {
+     Gc->bg_color = Color;
+     SetDCBrushColor(((PSKY_GC)Gc)->hDC, Color);
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_set_bg_color: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_draw_pixel(GC *Gc,
+              int X,
+              int Y)
+{
+   if(Gc != NULL)
+   {
+     SetPixelV(((PSKY_GC)Gc)->hDC, X, Y, Gc->fg_color);
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_draw_pixel: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_blit_from_DIB(GC *Gc,
+                 DIB *Dib,
+                 int X,
+                 int Y)
+{
+   int Result;
+   HDC hSrcDC;
+   HBITMAP hOldBitmap = NULL;
+
+   DBG("GC_blit_from_DIB(0x%x, 0x%x, 0x%x, 0x%x)\n", Gc, Dib, X, Y);
+
+   if (((PSKY_DIB)Dib)->hAssociateDC == NULL)
+   {
+      hSrcDC = CreateCompatibleDC(0);
+      hOldBitmap = SelectObject(hSrcDC, ((PSKY_DIB)Dib)->hBitmap);
+   }
+   else
+   {
+      hSrcDC = ((PSKY_DIB)Dib)->hAssociateDC;
+   }
+
+   Result = BitBlt(((PSKY_GC)Gc)->hDC, X, Y, Dib->width, Dib->height,
+                   hSrcDC, 0, 0, SRCCOPY);
+   
+   if (((PSKY_DIB)Dib)->hAssociateDC == NULL)
+   {
+      SelectObject(hSrcDC, hOldBitmap);
+      DeleteDC(hSrcDC);
+   }
+
+   return !Result;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_draw_rect_fill(GC *Gc,
+                 int X,
+                 int Y,
+                 int Width,
+                 int Height)
+{
+   DBG("GC_draw_rect_fill(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
+       Gc, X, Y, Width, Height);
+
+   if(Gc != NULL)
+   {
+     HBRUSH hBrush;
+     RECT Rect;
+
+     Rect.left = X;
+     Rect.top = Y;
+     Rect.right = X + Width;
+     Rect.bottom = Y + Height;
+
+     hBrush = CreateSolidBrush(Gc->bg_color);
+     FillRect(((PSKY_GC)Gc)->hDC, &Rect, hBrush);
+     DeleteObject(hBrush);
+
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_draw_rect_fill: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_draw_line(GC *Gc,
+             int x1,
+             int y1,
+             int x2,
+             int y2)
+{
+   DBG("GC_draw_line(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", Gc, x1, y1, x2, y2);
+   if(Gc != NULL)
+   {
+     MoveToEx(((PSKY_GC)Gc)->hDC, x1, y1, NULL);
+     LineTo(((PSKY_GC)Gc)->hDC, x2, y2);
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_draw_line: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GC_destroy(GC *Gc)
+{
+   DBG("GC_destroy(0x%x)\n", Gc);
+   if (Gc != NULL)
+   {
+      switch (Gc->type)
+      {
+         case GC_TYPE_DIB:
+            DeleteDC(((PSKY_GC)Gc)->hDC);
+            break;
+
+         case GC_TYPE_WINDOW:
+            ReleaseDC(((PSKY_WINDOW)Gc->window)->hWnd, ((PSKY_GC)Gc)->hDC);
+            break;
+
+         default:
+            DBG("Unknown GC type: %x\n", Gc->type);
+     }
+     HeapFree(GetProcessHeap(), 0, Gc);
+     return 1;
+   }
+   #if DEBUG
+   else
+   {
+     DBG("GC_destroy: Gc == NULL!\n");
+   }
+   #endif
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+widget_menu* __cdecl
+GI_create_menu(s_window *win)
+{
+   PSKY_MENU Menu;
+
+   DBG("GI_create_menu(0x%x)\n", win);
+
+   Menu = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SKY_MENU));
+   if (Menu == NULL)
+   {
+      return NULL;
+   }
+
+   /* Shouldn't we use CreatePopupMenu in some cases? */
+   Menu->hMenu = CreateMenu();
+   if (Menu->hMenu == NULL)
+   {
+      HeapFree(GetProcessHeap(), 0, Menu);
+      return NULL;
+   }
+
+   if (win)
+   {
+      SetMenu(((PSKY_WINDOW)win)->hWnd, Menu->hMenu);
+   }
+
+   return (widget_menu *)Menu;
+}
+
+
+/*
+ * @implemented
+ */
+widget_menu_item* __cdecl
+GI_create_menu_item(unsigned char *Text,
+                    unsigned int Id,
+                    unsigned int Flags,
+                    unsigned int Enabled)
+{
+   PSKY_MENUITEM MenuItem;
+   ULONG TextLength;
+   
+   DBG("GI_create_menu_item(0x%x, 0x%x, 0x%x, 0x%x)\n",
+       Text, Id, Flags, Enabled);
+
+   TextLength = MultiByteToWideChar(CP_UTF8, 0, (char*)Text, -1, NULL, 0);
+   MenuItem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+                        sizeof(SKY_MENUITEM) + TextLength * sizeof(WCHAR));
+   if (MenuItem == NULL)
+   {
+      return NULL;
+   }
+
+   lstrcpyA((char*)MenuItem->MenuItem.text, (char*)Text);
+   MenuItem->MenuItem.ID = Id;
+   MenuItem->MenuItem.flags = Flags;
+   MenuItem->MenuItem.enabled = Enabled;
+
+   MenuItem->MenuItemInfo.cbSize = sizeof(MENUITEMINFOW);
+   MenuItem->MenuItemInfo.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
+   if (Flags & MENU_SEPERATOR)
+      MenuItem->MenuItemInfo.fType = MF_SEPARATOR;
+   else
+      MenuItem->MenuItemInfo.fType = MF_STRING;
+   MenuItem->MenuItemInfo.fState = Enabled ? MFS_ENABLED : 0;
+   MenuItem->MenuItemInfo.wID = Id;
+   MenuItem->MenuItemInfo.dwTypeData = (LPWSTR)(MenuItem + 1);
+   MenuItem->MenuItemInfo.cch = TextLength;
+   MultiByteToWideChar(CP_UTF8, 0, (char*)Text, TextLength, (LPWSTR)(MenuItem + 1),
+                       TextLength);
+
+   return (widget_menu_item *)MenuItem;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_add_menu_item(widget_menu *Menu,
+                 widget_menu_item *Item)
+{
+   DBG("GI_add_menu_item(0x%x, 0x%x)\n", Menu, Item);
+   InsertMenuItemW(((PSKY_MENU)Menu)->hMenu, -1, TRUE,
+                   &((PSKY_MENUITEM)Item)->MenuItemInfo);
+   return 1;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_add_menu_sub(widget_menu *Menu,
+                widget_menu_item *Item,
+                widget_menu *Sub)
+{
+   PSKY_MENUITEM MenuItem = (PSKY_MENUITEM)Item;
+
+   DBG("GI_add_menu_sub(0x%x, 0x%x, 0x%x)\n", Menu, Item, Sub);
+   MenuItem->MenuItemInfo.fMask |= MIIM_SUBMENU;
+   MenuItem->MenuItemInfo.hSubMenu = ((PSKY_MENU)Sub)->hMenu;
+   InsertMenuItemW(((PSKY_MENU)Menu)->hMenu, -1, TRUE,
+                   &MenuItem->MenuItemInfo);
+   return 1;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_messagebox(s_window *Window,
+              unsigned int Flags,
+              char *Title,
+              char *Fmt,
+              ...)
+{
+   CHAR Buffer[4096];
+   va_list ArgList;
+   ULONG MbFlags, MbResult;
+
+   DBG("GI_messagebox(0x%x, 0x%x, 0x%x, 0x%x, ...)\n",
+       Window, Flags, Title, Fmt);
+
+   va_start(ArgList, Fmt);
+   _vsnprintf(Buffer, sizeof(Buffer) / sizeof(Buffer[0]), Fmt, ArgList);
+   va_end(ArgList);
+
+   if ((Flags & (WGF_MB_CANCEL | WGF_MB_YESNO)) ==
+       (WGF_MB_CANCEL | WGF_MB_YESNO))
+      MbFlags = MB_YESNOCANCEL;
+   else if (Flags & WGF_MB_YESNO)
+      MbFlags = MB_YESNO;
+   else /* if (Flags & WGF_MB_OK) */
+      MbFlags = MB_OK;
+   MbFlags |= (Flags & WGF_MB_ICON_INFO) ? MB_ICONASTERISK : 0;
+   MbFlags |= (Flags & WGF_MB_ICON_ASK) ? MB_ICONQUESTION : 0;
+   MbFlags |= (Flags & WGF_MB_ICON_STOP) ? MB_ICONERROR : 0;
+
+   MbResult = MessageBoxA(Window ? ((PSKY_WINDOW)Window)->hWnd : NULL, 
+                          Buffer, Title, MbFlags);
+
+   switch (MbResult)
+   {
+      case IDOK: return ID_OK;
+      case IDYES: return ID_YES;
+      case IDNO: return ID_NO;
+      case IDCANCEL: return ID_CANCEL;
+   }
+
+   return 0;
+}
+
+
+/*
+ * @implemented
+ */
+int __cdecl
+GI_EnableMouseTracking(s_window *win)
+{
+  DBG("GI_EnableMouseTracking(0x%x)!\n", win);
+  if(win != NULL)
+  {
+    ((PSKY_WINDOW)win)->MouseInput = TRUE;
+    return 1;
+  }
+   #if DEBUG
+   else
+   {
+     DBG("GI_EnableMouseTracking: win == NULL!\n");
+   }
+   #endif
+  return 0;
+}
+
+/* EOF */
diff --git a/rosky/lib/libskygi/libskygi.def b/rosky/lib/libskygi/libskygi.def
new file mode 100644 (file)
index 0000000..2b2f03a
--- /dev/null
@@ -0,0 +1,55 @@
+LIBRARY libskygi.dll
+
+EXPORTS
+DefaultWindowFunc
+GC_ResetBlit
+GC_blit
+GC_create_connected
+GC_destroy
+GC_draw_line
+GC_draw_rect_fill
+GC_set_bg_color
+GI_ShowApplicationWindow
+GI_add_menu_item
+GI_add_menu_sub
+GI_create_DDB_from_DIB
+GI_create_app
+GI_create_menu
+GI_create_menu_item
+GI_destroy_window
+GI_dispatch_message
+GI_kill_timer
+GI_load_bitmap
+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/rosky/lib/libskygi/libskygi.h b/rosky/lib/libskygi/libskygi.h
new file mode 100644 (file)
index 0000000..3cc4f64
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __LIBSKY_H
+#define __LIBSKY_H
+
+ULONG DbgPrint(PCH Format,...);
+
+#define DBG DbgPrint
+#define STUB DbgPrint("Stub in %s:%i: ", __FILE__, __LINE__); DbgPrint
+
+#endif /* __LIBSKY_H */
+
+/* EOF */
diff --git a/rosky/lib/libskygi/libskygi.rc b/rosky/lib/libskygi/libskygi.rc
new file mode 100644 (file)
index 0000000..59e0027
--- /dev/null
@@ -0,0 +1,7 @@
+/* $Id$ */
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS SkyOS GI library\0"
+#define REACTOS_STR_INTERNAL_NAME      "libskygi\0"
+#define REACTOS_STR_ORIGINAL_FILENAME  "libskygi.dll\0"
+#include <reactos/version.rc>
diff --git a/rosky/lib/libskygi/resource.h b/rosky/lib/libskygi/resource.h
new file mode 100644 (file)
index 0000000..c197b1f
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __LIBSKY_RESOURCE_H
+#define __LIBSKY_RESOURCE_H
+
+#endif /* __LIBSKY_RESOURCE_H */
+
+/* EOF */
diff --git a/rosky/lib/libskygi/stubs.c b/rosky/lib/libskygi/stubs.c
new file mode 100644 (file)
index 0000000..be101ed
--- /dev/null
@@ -0,0 +1,288 @@
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         SkyOS GI library
+ * FILE:            lib/libskygi/stubs.c
+ * PURPOSE:         libskygi.dll stubs
+ * NOTES:           If you implement a function, remove it from this file
+ *
+ * UPDATE HISTORY:
+ *      08/12/2004  Created
+ */
+#include <windows.h>
+#include <rosky/rosky.h>
+#include "libskygi.h"
+
+
+/*
+ * @unimplemented
+ */
+int __cdecl
+DefaultWindowFunc(s_window *win,
+                  s_gi_msg *pMsg)
+{
+  STUB("DefaultWindowFunc(0x%x, 0x%x) returns 0!\n", win, pMsg);
+  return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+int __cdecl
+GC_ResetBlit(sBlit *pBlit)
+{
+  STUB("GC_ResetBlit(0x%x) returns 0!\n", pBlit);
+  return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+int __cdecl
+GC_blit(GC *gc,
+        sBlit *pBlit)
+{
+  STUB("GC_blit(0x%x, 0x%x) returns 0!\n", gc, pBlit);
+  return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+DDB* __cdecl
+GI_create_DDB_from_DIB(DIB *dib)
+{
+  STUB("GI_create_DDB_from_DIB(0x%x) returns NULL!\n", dib);
+  return NULL;
+}
+
+
+/*
+ * @unimplemented
+ */
+int __cdecl
+GI_kill_timer(unsigned int uiID)
+{
+  STUB("GI_kill_timer(0x%x) returns 0!\n", uiID);
+  return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+unsigned int __cdecl
+GI_set_high_timer(HANDLE w,
+                  unsigned int msec)
+{
+  STUB("GI_set_high_timer(0x%x, 0x%x) returns 0!\n", w, msec);
+  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_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
+ */
+HANDLE __cdecl
+GI_CreateApplication(sCreateApplication *application)
+{
+  STUB("GI_CreateApplication(0x%x) returns NULL!\n", application);
+  return NULL;
+}
+
+
+/*
+ * @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(s_window *win,
+                 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", win, notify, x1, y1, width, height);
+  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_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;
+}
+
+
+/*
+ * @unimplemented
+ */
+DIB* __cdecl
+GI_load_bitmap(char *filename,
+               unsigned int ImageIndex)
+{
+  STUB("GI_load_bitmap(%s, 0x%x) returns NULL!\n", filename, ImageIndex);
+  return NULL;
+}
+
+/* EOF */