include/SDL_error.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 18 May 2013 12:48:50 -0700
changeset 7190 11612d544fcd
parent 7037 3fedf1f25b94
child 7191 75360622e65f
permissions -rw-r--r--
Added mobile application events, with implementations for iOS and Android
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@0
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
slouken@0
    21
slouken@1895
    22
/**
slouken@3407
    23
 *  \file SDL_error.h
slouken@3407
    24
 *  
slouken@3407
    25
 *  Simple error message routines for SDL.
slouken@1895
    26
 */
slouken@0
    27
slouken@0
    28
#ifndef _SDL_error_h
slouken@0
    29
#define _SDL_error_h
slouken@0
    30
slouken@1356
    31
#include "SDL_stdinc.h"
slouken@1356
    32
slouken@0
    33
#include "begin_code.h"
slouken@0
    34
/* Set up for C function definitions, even when using C++ */
slouken@0
    35
#ifdef __cplusplus
slouken@1895
    36
/* *INDENT-OFF* */
slouken@0
    37
extern "C" {
slouken@1895
    38
/* *INDENT-ON* */
slouken@0
    39
#endif
slouken@0
    40
slouken@0
    41
/* Public functions */
icculus@7037
    42
/* SDL_SetError() unconditionally returns -1. */
icculus@7037
    43
extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
slouken@4867
    44
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
slouken@337
    45
extern DECLSPEC void SDLCALL SDL_ClearError(void);
slouken@0
    46
slouken@3407
    47
/**
slouken@3407
    48
 *  \name Internal error functions
slouken@3407
    49
 *  
slouken@3407
    50
 *  \internal 
slouken@5221
    51
 *  Private error reporting function - used internally.
slouken@3407
    52
 */
slouken@3407
    53
/*@{*/
slouken@0
    54
#define SDL_OutOfMemory()	SDL_Error(SDL_ENOMEM)
slouken@1361
    55
#define SDL_Unsupported()	SDL_Error(SDL_UNSUPPORTED)
aschiffler@6811
    56
#define SDL_InvalidParamError(param)	SDL_SetError("Parameter '%s' is invalid", (param))
slouken@1895
    57
typedef enum
slouken@1895
    58
{
slouken@1895
    59
    SDL_ENOMEM,
slouken@1895
    60
    SDL_EFREAD,
slouken@1895
    61
    SDL_EFWRITE,
slouken@1895
    62
    SDL_EFSEEK,
slouken@1895
    63
    SDL_UNSUPPORTED,
slouken@1895
    64
    SDL_LASTERROR
slouken@0
    65
} SDL_errorcode;
icculus@7037
    66
/* SDL_Error() unconditionally returns -1. */
icculus@7037
    67
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
slouken@3407
    68
/*@}*//*Internal error functions*/
slouken@0
    69
slouken@0
    70
/* Ends C function definitions when using C++ */
slouken@0
    71
#ifdef __cplusplus
slouken@1895
    72
/* *INDENT-OFF* */
slouken@0
    73
}
slouken@1895
    74
/* *INDENT-ON* */
slouken@0
    75
#endif
slouken@0
    76
#include "close_code.h"
slouken@0
    77
slouken@0
    78
#endif /* _SDL_error_h */
slouken@1895
    79
slouken@1895
    80
/* vi: set ts=4 sw=4 expandtab: */