comparison include/SDL_stdinc.h @ 4217:4c4113c2162c SDL-1.2

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.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 21 Sep 2009 09:38:10 +0000
parents 6512a61c2c73
children 6823a52d06fa
comparison
equal deleted inserted replaced
4216:5b99971a27b4 4217:4c4113c2162c
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 /* This is a general header that includes C language support */ 23 /** @file SDL_stdinc.h
24 * This is a general header that includes C language support
25 */
24 26
25 #ifndef _SDL_stdinc_h 27 #ifndef _SDL_stdinc_h
26 #define _SDL_stdinc_h 28 #define _SDL_stdinc_h
27 29
28 #include "SDL_config.h" 30 #include "SDL_config.h"
70 #endif 72 #endif
71 #ifdef HAVE_ICONV_H 73 #ifdef HAVE_ICONV_H
72 # include <iconv.h> 74 # include <iconv.h>
73 #endif 75 #endif
74 76
75 /* The number of elements in an array */ 77 /** The number of elements in an array */
76 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) 78 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
77 #define SDL_TABLESIZE(table) SDL_arraysize(table) 79 #define SDL_TABLESIZE(table) SDL_arraysize(table)
78 80
79 /* Basic data types */ 81 /** @name Basic data types */
82 /*@{*/
80 typedef enum SDL_bool { 83 typedef enum SDL_bool {
81 SDL_FALSE = 0, 84 SDL_FALSE = 0,
82 SDL_TRUE = 1 85 SDL_TRUE = 1
83 } SDL_bool; 86 } SDL_bool;
84 87
100 Uint32 hi; 103 Uint32 hi;
101 Uint32 lo; 104 Uint32 lo;
102 } Uint64, Sint64; 105 } Uint64, Sint64;
103 #endif 106 #endif
104 107
105 /* Make sure the types really have the right sizes */ 108 /*@}*/
109
110 /** @name Make sure the types really have the right sizes */
111 /*@{*/
106 #define SDL_COMPILE_TIME_ASSERT(name, x) \ 112 #define SDL_COMPILE_TIME_ASSERT(name, x) \
107 typedef int SDL_dummy_ ## name[(x) * 2 - 1] 113 typedef int SDL_dummy_ ## name[(x) * 2 - 1]
108 114
109 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); 115 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
110 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); 116 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
112 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); 118 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
113 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); 119 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
114 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); 120 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
115 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); 121 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
116 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); 122 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
117 123 /*@}*/
118 /* Check to make sure enums are the size of ints, for structure packing. 124
119 For both Watcom C/C++ and Borland C/C++ the compiler option that makes 125 /** @name Enum Size Check
120 enums having the size of an int must be enabled. 126 * Check to make sure enums are the size of ints, for structure packing.
121 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). 127 * For both Watcom C/C++ and Borland C/C++ the compiler option that makes
122 */ 128 * enums having the size of an int must be enabled.
129 * This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
130 */
123 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ 131 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
124 #ifdef __MWERKS__ 132 #ifdef __MWERKS__
125 #pragma enumsalwaysint on 133 #pragma enumsalwaysint on
126 #endif 134 #endif
127 135
130 } SDL_DUMMY_ENUM; 138 } SDL_DUMMY_ENUM;
131 139
132 #ifndef __NDS__ 140 #ifndef __NDS__
133 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); 141 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
134 #endif 142 #endif
135 143 /*@}*/
136 144
137 #include "begin_code.h" 145 #include "begin_code.h"
138 /* Set up for C function definitions, even when using C++ */ 146 /* Set up for C function definitions, even when using C++ */
139 #ifdef __cplusplus 147 #ifdef __cplusplus
140 extern "C" { 148 extern "C" {
563 #define SDL_vsnprintf vsnprintf 571 #define SDL_vsnprintf vsnprintf
564 #else 572 #else
565 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); 573 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
566 #endif 574 #endif
567 575
568 /* The SDL implementation of iconv() returns these error codes */ 576 /** @name SDL_ICONV Error Codes
577 * The SDL implementation of iconv() returns these error codes
578 */
579 /*@{*/
569 #define SDL_ICONV_ERROR (size_t)-1 580 #define SDL_ICONV_ERROR (size_t)-1
570 #define SDL_ICONV_E2BIG (size_t)-2 581 #define SDL_ICONV_E2BIG (size_t)-2
571 #define SDL_ICONV_EILSEQ (size_t)-3 582 #define SDL_ICONV_EILSEQ (size_t)-3
572 #define SDL_ICONV_EINVAL (size_t)-4 583 #define SDL_ICONV_EINVAL (size_t)-4
584 /*@}*/
573 585
574 #ifdef HAVE_ICONV 586 #ifdef HAVE_ICONV
575 #define SDL_iconv_t iconv_t 587 #define SDL_iconv_t iconv_t
576 #define SDL_iconv_open iconv_open 588 #define SDL_iconv_open iconv_open
577 #define SDL_iconv_close iconv_close 589 #define SDL_iconv_close iconv_close
579 typedef struct _SDL_iconv_t *SDL_iconv_t; 591 typedef struct _SDL_iconv_t *SDL_iconv_t;
580 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); 592 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
581 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); 593 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
582 #endif 594 #endif
583 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 595 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
584 /* This function converts a string between encodings in one pass, returning a 596 /** This function converts a string between encodings in one pass, returning a
585 string that must be freed with SDL_free() or NULL on error. 597 * string that must be freed with SDL_free() or NULL on error.
586 */ 598 */
587 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); 599 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
588 #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) 600 #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
589 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) 601 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
590 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) 602 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
591 603