diff --git a/source/lib/sysdep/win/wcpu.cpp b/source/lib/sysdep/win/wcpu.cpp index 5bac82bf3f..5b52b6a21c 100755 --- a/source/lib/sysdep/win/wcpu.cpp +++ b/source/lib/sysdep/win/wcpu.cpp @@ -1,3 +1,21 @@ +// Windows-specific CPU related code +// +// Copyright (c) 2003 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ + #include "precompiled.h" #include // for malloc, free diff --git a/source/lib/sysdep/win/wdbg.cpp b/source/lib/sysdep/win/wdbg.cpp index adae9415a4..c79d239f43 100755 --- a/source/lib/sysdep/win/wdbg.cpp +++ b/source/lib/sysdep/win/wdbg.cpp @@ -1,4 +1,4 @@ -// stack trace, improved assert and exception handler +// stack trace, improved assert and exception handler for Win32 // Copyright (c) 2002-2005 Jan Wassenberg // // This program is free software; you can redistribute it and/or diff --git a/source/lib/sysdep/win/wdbg.h b/source/lib/sysdep/win/wdbg.h index 1a2a820477..2f313f0fe8 100755 --- a/source/lib/sysdep/win/wdbg.h +++ b/source/lib/sysdep/win/wdbg.h @@ -1,3 +1,20 @@ +// stack trace, improved assert and exception handler for Win32 +// Copyright (c) 2002-2005 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ + #ifndef WDBG_H__ #define WDBG_H__ diff --git a/source/lib/sysdep/win/win.cpp b/source/lib/sysdep/win/win.cpp index 938dd6cc43..da824b60fb 100755 --- a/source/lib/sysdep/win/win.cpp +++ b/source/lib/sysdep/win/win.cpp @@ -1,4 +1,4 @@ -// Windows-specific code +// Windows-specific code and program entry point // Copyright (c) 2003 Jan Wassenberg // // This program is free software; you can redistribute it and/or diff --git a/source/lib/sysdep/win/win.h b/source/lib/sysdep/win/win.h index 8c3497bffa..29323faa89 100755 --- a/source/lib/sysdep/win/win.h +++ b/source/lib/sysdep/win/win.h @@ -1,5 +1,26 @@ -#if !defined(__WIN_H__) && defined(_WIN32) -#define __WIN_H__ +// compatibility fixes when compiling on Win32 +// Copyright (c) 2002-2005 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ + +#ifndef WIN_H__ +#define WIN_H__ + +#ifndef _WIN32 +#error "including win.h without _WIN32 defined" +#endif #include @@ -12,12 +33,11 @@ #include // wchar_t // libpng.h -> zlib.h -> zconf.h includes , which causes conflicts. -// inhibit this, and define what they actually need from windows.h -// incidentally, this requires all windows dependencies to include -// sysdep/win_internal.h +// prevent that, and define what they actually need from windows.h. +// incidentally, this requires all dependents of windows.h to include +// sysdep/win/win_internal.h instead. #define _WINDOWS_ // windows.h include guard #define WINAPI __stdcall #define WINAPIV __cdecl - -#endif // #ifndef __WIN_H__ +#endif // #ifndef WIN_H__ diff --git a/source/lib/sysdep/win/win_internal.h b/source/lib/sysdep/win/win_internal.h index 20aa1e4f68..08e785bbf0 100755 --- a/source/lib/sysdep/win/win_internal.h +++ b/source/lib/sysdep/win/win_internal.h @@ -1,3 +1,20 @@ +// shared header for Win32-specific code +// Copyright (c) 2002-2005 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ + #ifndef WIN_INTERNAL_H #define WIN_INTERNAL_H @@ -9,7 +26,7 @@ // Win32 socket decls aren't portable (e.g. problems with socklen_t) -// => skip winsock.h; lib.h should be used instead +// => skip winsock.h; wsock.h should be used instead #define _WINSOCKAPI_ #define WIN32_LEAN_AND_MEAN @@ -292,15 +309,13 @@ enum BasicType /////////////////////////////////////////////////////////////////////////////// -/* Define _CRTIMP */ - #ifndef _CRTIMP -#ifdef _DLL -#define _CRTIMP __declspec(dllimport) -#else /* ndef _DLL */ -#define _CRTIMP -#endif /* _DLL */ -#endif /* _CRTIMP */ +# ifdef _DLL +# define _CRTIMP __declspec(dllimport) +# else +# define _CRTIMP +# endif +#endif extern "C" { _CRTIMP intptr_t _get_osfhandle(int); @@ -406,9 +421,10 @@ extern void win_unlock(uint idx); // init and shutdown mechanism: register a function to be called at // pre-main init or shutdown. +// // the "segment name" determines when and in what order the functions are -// called: "LIB$W{type}{group}", where {type} is either I for -// (pre-main) initializers, or T for terminators (last of the atexit handlers). +// called: "LIB$W{type}{group}", where {type} is C for pre-libc init, +// I for pre-main init, or T for terminators (last of the atexit handlers). // {group} is [B, Y]; groups are called in alphabetical order, but // call order within the group itself is unspecified. // diff --git a/source/lib/sysdep/win/wpthread.cpp b/source/lib/sysdep/win/wpthread.cpp index 4dd3bfca2d..85db3dad9e 100644 --- a/source/lib/sysdep/win/wpthread.cpp +++ b/source/lib/sysdep/win/wpthread.cpp @@ -1,3 +1,21 @@ +// partial pthread implementation for Win32 +// +// Copyright (c) 2003-2005 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ + #include "precompiled.h" #include @@ -8,6 +26,7 @@ #include "win_internal.h" #include "wpthread.h" + static HANDLE pthread_t_to_HANDLE(pthread_t p) { return (HANDLE)((char*)0 + p); diff --git a/source/lib/sysdep/win/wpthread.h b/source/lib/sysdep/win/wpthread.h index 47d1c39aa5..577f72d1e4 100644 --- a/source/lib/sysdep/win/wpthread.h +++ b/source/lib/sysdep/win/wpthread.h @@ -1,4 +1,4 @@ -// POSIX asynchronous I/O for Win32 +// partial pthread implementation for Win32 // // Copyright (c) 2003-2005 Jan Wassenberg // diff --git a/source/lib/sysdep/win/wsdl.h b/source/lib/sysdep/win/wsdl.h index 9c4e9e7b41..11616ba00d 100755 --- a/source/lib/sysdep/win/wsdl.h +++ b/source/lib/sysdep/win/wsdl.h @@ -1,11 +1,28 @@ -#ifndef __WSDL_H__ -#define __WSDL_H__ +// emulation of a subset of SDL and GLUT for Win32 +// +// Copyright (c) 2003 Jan Wassenberg +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program 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 +// General Public License for more details. +// +// Contact info: +// Jan.Wassenberg@stud.uni-karlsruhe.de +// http://www.stud.uni-karlsruhe.de/~urkt/ +#ifndef WSDL_H__ +#define WSDL_H__ #include "lib/types.h" #include "SDL_keysym.h" -/* allow apps to override window name */ +// allow apps to override window name #ifndef APP_NAME #define APP_NAME "ogl" #endif @@ -16,7 +33,7 @@ extern "C" { #define Uint32 u32 -/* SDL_Init flags */ +// SDL_Init flags #define SDL_INIT_VIDEO 0 #define SDL_INIT_AUDIO 0 #define SDL_INIT_TIMER 0 @@ -30,14 +47,14 @@ extern void SDL_Quit(void); typedef enum { SDL_GL_DEPTH_SIZE, - SDL_GL_DOUBLEBUFFER /* ignored - always double buffered */ + SDL_GL_DOUBLEBUFFER // ignored - always double buffered } SDL_GLattr; extern int SDL_GL_SetAttribute(SDL_GLattr attr, int value); -/* SDL_SetVideoMode() flags */ +// SDL_SetVideoMode() flags #define SDL_OPENGL 0 #define SDL_FULLSCREEN 1 @@ -62,9 +79,9 @@ SDL_VideoInfo; extern SDL_VideoInfo* SDL_GetVideoInfo(void); -/* - * threads / sync - */ +// +// threads / sync +// typedef void SDL_sem; typedef void SDL_Thread; @@ -97,7 +114,7 @@ extern int SDL_ShowCursor(int toggle); extern int SDL_SetGamma(float r, float g, float b); -/* macros */ +// macros #define SDL_GRAB_ON 0 #define SDL_WM_GrabInput(a) @@ -149,11 +166,10 @@ extern u64 SDL_Swap64(u64); #define SDL_BYTE_ORDER SDL_LIL_ENDIAN ////////////////////////////////////////////////////////////////////////////// - - -/************************************************************************************************ - * events - ************************************************************************************************/ +// +// events +// +////////////////////////////////////////////////////////////////////////////// typedef struct { @@ -174,7 +190,7 @@ typedef struct } SDL_MouseMotionEvent; -/* SDL_MouseButtonEvent.button */ +// SDL_MouseButtonEvent.button enum { // do not change order @@ -215,7 +231,7 @@ typedef struct } SDL_UserEvent; -/* SDL_Event.type */ +// SDL_Event.type enum { SDL_KEYDOWN, @@ -261,43 +277,43 @@ extern void SDL_WM_SetCaption(const char *title, const char *icon); -/* glutInitDisplayMode */ +// glutInitDisplayMode #define GLUT_RGB 0 #define GLUT_DOUBLE 0 #define GLUT_DEPTH 0 -/* mouse buttons */ +// mouse buttons enum { GLUT_LEFT_BUTTON, GLUT_RIGHT_BUTTON, - GLUT_MIDDLE_BUTTON /* also wheel, if avail */ + GLUT_MIDDLE_BUTTON // also wheel, if avail }; -/* mouse button state */ +// mouse button state enum { GLUT_DOWN, GLUT_UP }; -/* keys */ +// keys enum { - GLUT_KEY_LEFT = 0x25, /* VK_* */ + GLUT_KEY_LEFT = 0x25, // VK_* GLUT_KEY_RIGHT = 0x27, GLUT_KEY_UP = 0x26, GLUT_KEY_DOWN = 0x28 }; -/* glutSetCursor */ -#define GLUT_CURSOR_INHERIT 32512 /* IDC_* */ +// glutSetCursor +#define GLUT_CURSOR_INHERIT 32512 // IDC_* #define GLUT_CURSOR_WAIT 32514 #define GLUT_CURSOR_DESTROY 32648 #define GLUT_CURSOR_NONE 0 -/* glutGet */ +// glutGet enum { GLUT_ELAPSED_TIME, @@ -319,7 +335,7 @@ extern void glutSpecialFunc(void(*)(int, int, int)); extern void glutMouseFunc(void(*)(int, int, int, int)); -#define glutInitDisplayMode(a) /* pixel format is hardwired */ +#define glutInitDisplayMode(a) // pixel format is hardwired extern int glutGameModeString(const char* str); @@ -344,4 +360,4 @@ extern void glutSetCursor(int); } #endif -#endif // #ifndef __WSDL_H__ +#endif // #ifndef WSDL_H__