ObjFW
src/exceptions/common.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #include <string.h>
00018 
00019 #if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
00020 # import <objc/runtime.h>
00021 #endif
00022 
00023 #ifdef OF_OLD_GNU_RUNTIME
00024 # import <objc/objc-api.h>
00025 # define sel_getName(x) sel_get_name(x)
00026 #endif
00027 
00028 #ifndef _WIN32
00029 #if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_PSP)
00030 # include <netdb.h>
00031 #endif
00032 # include <errno.h>
00033 # define GET_ERRNO      errno
00034 # ifndef HAVE_THREADSAFE_GETADDRINFO
00035 #  define GET_AT_ERRNO  h_errno
00036 # else
00037 #  define GET_AT_ERRNO  errno
00038 # endif
00039 # define GET_SOCK_ERRNO errno
00040 # define ERRFMT         "Error string was: %s"
00041 # define ERRPARAM       strerror(errNo)
00042 # if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_PSP)
00043 #  define AT_ERRPARAM   hstrerror(errNo)
00044 # else
00045 #  define AT_ERRPARAM   strerror(errNo)
00046 # endif
00047 #else
00048 # include <windows.h>
00049 # define GET_ERRNO      GetLastError()
00050 # define GET_AT_ERRNO   WSAGetLastError()
00051 # define GET_SOCK_ERRNO WSAGetLastError()
00052 # define ERRFMT         "Error code was: %d"
00053 # define ERRPARAM       errNo
00054 # define AT_ERRPARAM    errNo
00055 #endif
 All Classes Functions Variables