Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendglmacros.h
Go to the documentation of this file.
00001 /**************************************************************************** 00002 * 00003 * Mesa 3-D graphics library 00004 * Direct3D Driver Interface 00005 * 00006 * ======================================================================== 00007 * 00008 * Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved. 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining a 00011 * copy of this software and associated documentation files (the "Software"), 00012 * to deal in the Software without restriction, including without limitation 00013 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00014 * and/or sell copies of the Software, and to permit persons to whom the 00015 * Software is furnished to do so, subject to the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be included 00018 * in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00021 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00022 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00023 * SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 00024 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 00025 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00026 * SOFTWARE. 00027 * 00028 * ====================================================================== 00029 * 00030 * Language: ANSI C 00031 * Environment: Windows 9x (Win32) 00032 * 00033 * Description: Useful generic macros. 00034 * 00035 ****************************************************************************/ 00036 00037 #ifndef __DGLMACROS_H 00038 #define __DGLMACROS_H 00039 00040 #include <ddraw.h> 00041 00042 // Define the relevant RELEASE macro depending on C or C++ 00043 #if !defined(__cplusplus) || defined(CINTERFACE) 00044 // Standard C version 00045 #define RELEASE(x) if (x!=NULL) { x->lpVtbl->Release(x); x=NULL; } 00046 #else 00047 // C++ version 00048 #define RELEASE(x) if (x!=NULL) { x->Release(); x=NULL; } 00049 #endif 00050 00051 // We don't want a message *every* time we call an unsupported function 00052 #define UNSUPPORTED(x) \ 00053 { \ 00054 static BOOL bFirstTime = TRUE; \ 00055 if (bFirstTime) { \ 00056 bFirstTime = FALSE; \ 00057 ddlogError(DDLOG_WARN, (x), DDERR_CURRENTLYNOTAVAIL); \ 00058 } \ 00059 } 00060 00061 #define DGL_CHECK_CONTEXT \ 00062 if (ctx == NULL) return; 00063 00064 // Don't render if bCanRender is not TRUE. 00065 #define DGL_CHECK_RENDER \ 00066 if (!dgl->bCanRender) return; 00067 00068 #if 0 00069 #define TRY(a,b) (a) 00070 #define TRY_ERR(a,b) (a) 00071 #else 00072 // hResult should be defined in the function 00073 // Return codes should be checked via SUCCEDDED and FAILED macros 00074 #define TRY(a,b) \ 00075 { \ 00076 if (FAILED(hResult=(a))) \ 00077 ddlogError(DDLOG_ERROR, (b), hResult); \ 00078 } 00079 00080 // hResult is a global 00081 // The label exit_with_error should be defined within the calling scope 00082 #define TRY_ERR(a,b) \ 00083 { \ 00084 if (FAILED(hResult=(a))) { \ 00085 ddlogError(DDLOG_ERROR, (b), hResult); \ 00086 goto exit_with_error; \ 00087 } \ 00088 } 00089 #endif // #if 1 00090 00091 #endif Generated on Sun May 27 2012 04:19:58 for ReactOS by
1.7.6.1
|