include/begin_code.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 21 Sep 2009 09:38:10 +0000
branchSDL-1.2
changeset 4217 4c4113c2162c
parent 4193 430e6690c4cd
child 4891 0d4756e57224
permissions -rw-r--r--
Fixed bug #706

Ken Bull 2009-02-25 13:22:02 PST

Adds Doxygen support for all headers (except config and boilerplate headers) in
the include folder for SDL-1.2 revision 4446.

While in general SDL is quite thoroughly commented, none of these comments are
correctly formatted for Doxygen and are generally inconsistent in their
formatting.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@4159
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@4217
    23
/** 
slouken@4217
    24
 *  @file begin_code.h
slouken@4217
    25
 *  This file sets things up for C dynamic library function definitions,
slouken@4217
    26
 *  static inlined functions, and structures aligned at 4-byte alignment.
slouken@4217
    27
 *  If you don't like ugly C preprocessor code, don't look at this file. :)
slouken@4217
    28
 */
slouken@0
    29
slouken@4217
    30
/** 
slouken@4217
    31
 *  @file begin_code.h
slouken@4217
    32
 *  This shouldn't be nested -- included it around code only.
slouken@4217
    33
 */
slouken@0
    34
#ifdef _begin_code_h
slouken@0
    35
#error Nested inclusion of begin_code.h
slouken@0
    36
#endif
slouken@0
    37
#define _begin_code_h
slouken@0
    38
slouken@4217
    39
/** 
slouken@4217
    40
 *  @def DECLSPEC
slouken@4217
    41
 *  Some compilers use a special export keyword
slouken@4217
    42
 */
slouken@0
    43
#ifndef DECLSPEC
slouken@4164
    44
# if defined(__BEOS__) || defined(__HAIKU__)
slouken@0
    45
#  if defined(__GNUC__)
slouken@0
    46
#   define DECLSPEC	__declspec(dllexport)
slouken@0
    47
#  else
slouken@0
    48
#   define DECLSPEC	__declspec(export)
slouken@0
    49
#  endif
slouken@1574
    50
# elif defined(__WIN32__)
slouken@274
    51
#  ifdef __BORLANDC__
slouken@274
    52
#   ifdef BUILD_SDL
slouken@636
    53
#    define DECLSPEC 
slouken@274
    54
#   else
slouken@1574
    55
#    define DECLSPEC	__declspec(dllimport)
slouken@274
    56
#   endif
slouken@274
    57
#  else
slouken@274
    58
#   define DECLSPEC	__declspec(dllexport)
slouken@274
    59
#  endif
slouken@1574
    60
# elif defined(__OS2__)
icculus@1190
    61
#  ifdef __WATCOMC__
icculus@1190
    62
#   ifdef BUILD_SDL
slouken@1574
    63
#    define DECLSPEC	__declspec(dllexport)
icculus@1190
    64
#   else
slouken@1574
    65
#    define DECLSPEC
slouken@1574
    66
#   endif
icculus@4193
    67
#  elif defined (__GNUC__) && __GNUC__ < 4
icculus@4193
    68
#   /* Added support for GCC-EMX <v4.x */
icculus@4193
    69
#   /* this is needed for XFree86/OS2 developement */
icculus@4193
    70
#   /* F. Ambacher(anakor@snafu.de) 05.2008 */
icculus@4193
    71
#   ifdef BUILD_SDL
icculus@4193
    72
#    define DECLSPEC    __declspec(dllexport)
icculus@4193
    73
#   else
icculus@4193
    74
#    define DECLSPEC
icculus@4193
    75
#   endif
icculus@1190
    76
#  else
icculus@1190
    77
#   define DECLSPEC
icculus@1190
    78
#  endif
icculus@1190
    79
# else
slouken@1595
    80
#  if defined(__GNUC__) && __GNUC__ >= 4
slouken@1574
    81
#   define DECLSPEC	__attribute__ ((visibility("default")))
slouken@1574
    82
#  else
slouken@1574
    83
#   define DECLSPEC
slouken@1574
    84
#  endif
slouken@0
    85
# endif
slouken@0
    86
#endif
slouken@0
    87
slouken@4217
    88
/** 
slouken@4217
    89
 *  @def SDLCALL
slouken@4217
    90
 *  By default SDL uses the C calling convention
slouken@4217
    91
 */
slouken@337
    92
#ifndef SDLCALL
icculus@4193
    93
# if defined(__WIN32__) && !defined(__GNUC__)
icculus@4193
    94
#  define SDLCALL __cdecl
icculus@4193
    95
# elif defined(__OS2__)
icculus@4193
    96
#  if defined (__GNUC__) && __GNUC__ < 4
icculus@4193
    97
#   /* Added support for GCC-EMX <v4.x */
icculus@4193
    98
#   /* this is needed for XFree86/OS2 developement */
icculus@4193
    99
#   /* F. Ambacher(anakor@snafu.de) 05.2008 */
icculus@4193
   100
#   define SDLCALL _cdecl
icculus@4193
   101
#  else
icculus@4193
   102
#   /* On other compilers on OS/2, we use the _System calling convention */
icculus@4193
   103
#   /* to be compatible with every compiler */
icculus@4193
   104
#   define SDLCALL _System
icculus@4193
   105
#  endif
icculus@4193
   106
# else
icculus@4193
   107
#  define SDLCALL
icculus@4193
   108
# endif
slouken@337
   109
#endif /* SDLCALL */
slouken@337
   110
slouken@173
   111
#ifdef __SYMBIAN32__ 
icculus@3975
   112
#ifndef EKA2 
slouken@173
   113
#undef DECLSPEC
slouken@173
   114
#define DECLSPEC
icculus@3975
   115
#elif !defined(__WINS__)
icculus@3975
   116
#undef DECLSPEC
icculus@3975
   117
#define DECLSPEC __declspec(dllexport)
icculus@4091
   118
#endif /* !EKA2 */
icculus@4091
   119
#endif /* __SYMBIAN32__ */
slouken@173
   120
slouken@4217
   121
/**
slouken@4217
   122
 *  @file begin_code.h
slouken@4217
   123
 *  Force structure packing at 4 byte alignment.
slouken@4217
   124
 *  This is necessary if the header is included in code which has structure
slouken@4217
   125
 *  packing set to an alternate value, say for loading structures from disk.
slouken@4217
   126
 *  The packing is reset to the previous value in close_code.h 
slouken@0
   127
 */
slouken@288
   128
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
slouken@0
   129
#ifdef _MSC_VER
slouken@0
   130
#pragma warning(disable: 4103)
slouken@0
   131
#endif
slouken@0
   132
#ifdef __BORLANDC__
slouken@0
   133
#pragma nopackwarning
slouken@0
   134
#endif
slouken@195
   135
#pragma pack(push,4)
slouken@1402
   136
#elif (defined(__MWERKS__) && defined(__MACOS__))
slouken@189
   137
#pragma options align=mac68k4byte
slouken@189
   138
#pragma enumsalwaysint on
slouken@0
   139
#endif /* Compiler needs structure packing set */
slouken@0
   140
slouken@4217
   141
/**
slouken@4217
   142
 *  @def SDL_INLINE_OKAY
slouken@4217
   143
 *  Set up compiler-specific options for inlining functions
slouken@4217
   144
 */
slouken@0
   145
#ifndef SDL_INLINE_OKAY
slouken@0
   146
#ifdef __GNUC__
slouken@0
   147
#define SDL_INLINE_OKAY
slouken@0
   148
#else
slouken@0
   149
/* Add any special compiler-specific cases here */
slouken@288
   150
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
slouken@288
   151
    defined(__DMC__) || defined(__SC__) || \
slouken@1019
   152
    defined(__WATCOMC__) || defined(__LCC__) || \
icculus@3975
   153
    defined(__DECC) || defined(__EABI__)
slouken@288
   154
#ifndef __inline__
slouken@85
   155
#define __inline__	__inline
slouken@288
   156
#endif
slouken@85
   157
#define SDL_INLINE_OKAY
slouken@85
   158
#else
slouken@85
   159
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
icculus@3965
   160
#ifndef __inline__
slouken@0
   161
#define __inline__ inline
icculus@3965
   162
#endif
slouken@0
   163
#define SDL_INLINE_OKAY
slouken@0
   164
#endif /* Not a funky compiler */
slouken@85
   165
#endif /* Visual C++ */
slouken@0
   166
#endif /* GNU C */
slouken@0
   167
#endif /* SDL_INLINE_OKAY */
slouken@0
   168
slouken@4217
   169
/**
slouken@4217
   170
 *  @def __inline__
slouken@4217
   171
 *  If inlining isn't supported, remove "__inline__", turning static
slouken@4217
   172
 *  inlined functions into static functions (resulting in code bloat
slouken@4217
   173
 *  in all files which include the offending header files)
slouken@4217
   174
 */
slouken@0
   175
#ifndef SDL_INLINE_OKAY
slouken@0
   176
#define __inline__
slouken@0
   177
#endif
slouken@0
   178
slouken@4217
   179
/**
slouken@4217
   180
 *  @def NULL
slouken@4217
   181
 *  Apparently this is needed by several Windows compilers
slouken@4217
   182
 */
slouken@346
   183
#if !defined(__MACH__)
slouken@288
   184
#ifndef NULL
slouken@288
   185
#ifdef __cplusplus
slouken@288
   186
#define NULL 0
slouken@288
   187
#else
slouken@288
   188
#define NULL ((void *)0)
slouken@288
   189
#endif
slouken@288
   190
#endif /* NULL */
slouken@1621
   191
#endif /* ! Mac OS X - breaks precompiled headers */