|
MythTV
0.26-pre
|
00001 /* 00002 * hdhomerun_os_windows.h 00003 * 00004 * Copyright © 2006-2010 Silicondust USA Inc. <www.silicondust.com>. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 3 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * As a special exception to the GNU Lesser General Public License, 00020 * you may link, statically or dynamically, an application with a 00021 * publicly distributed version of the Library to produce an 00022 * executable file containing portions of the Library, and 00023 * distribute that executable file under terms of your choice, 00024 * without any of the additional requirements listed in clause 4 of 00025 * the GNU Lesser General Public License. 00026 * 00027 * By "a publicly distributed version of the Library", we mean 00028 * either the unmodified Library as distributed by Silicondust, or a 00029 * modified version of the Library that is distributed under the 00030 * conditions defined in the GNU Lesser General Public License. 00031 */ 00032 00033 #define _WINSOCKAPI_ 00034 #if defined(USING_MINGW) 00035 /* MinGW lacks wspiapi.h; set minimum WINVER to WinXP to remove dependency */ 00036 #define WINVER 0x0501 00037 #endif 00038 #include <windows.h> 00039 #include <winsock2.h> 00040 #include <ws2tcpip.h> 00041 #if !defined(USING_MINGW) 00042 #include <wspiapi.h> 00043 #endif 00044 #include <stdlib.h> 00045 #include <stdio.h> 00046 #include <stdarg.h> 00047 #include <string.h> 00048 #include <signal.h> 00049 #include <time.h> 00050 #include <sys/types.h> 00051 #include <sys/timeb.h> 00052 00053 #if defined(DLL_IMPORT) 00054 #define LIBTYPE __declspec( dllexport ) 00055 #elif defined(DLL_EXPORT) 00056 #define LIBTYPE __declspec( dllimport ) 00057 #else 00058 #define LIBTYPE 00059 #endif 00060 00061 typedef int bool_t; 00062 #if defined(USING_MINGW) 00063 #include <stdint.h> 00064 #include <pthread.h> 00065 #else 00066 typedef signed __int8 int8_t; 00067 typedef signed __int16 int16_t; 00068 typedef signed __int32 int32_t; 00069 typedef signed __int64 int64_t; 00070 typedef unsigned __int8 uint8_t; 00071 typedef unsigned __int16 uint16_t; 00072 typedef unsigned __int32 uint32_t; 00073 typedef unsigned __int64 uint64_t; 00074 typedef void (*sig_t)(int); 00075 typedef HANDLE pthread_t; 00076 typedef HANDLE pthread_mutex_t; 00077 #endif 00078 00079 #define va_copy(x, y) x = y 00080 #define atoll _atoi64 00081 #define strdup _strdup 00082 #define strcasecmp _stricmp 00083 #define snprintf _snprintf 00084 #define fseeko _fseeki64 00085 #define ftello _ftelli64 00086 #define THREAD_FUNC_PREFIX DWORD WINAPI 00087 00088 #ifdef __cplusplus 00089 extern "C" { 00090 #endif 00091 00092 extern LIBTYPE uint32_t random_get32(void); 00093 extern LIBTYPE uint64_t getcurrenttime(void); 00094 extern LIBTYPE void msleep_approx(uint64_t ms); 00095 extern LIBTYPE void msleep_minimum(uint64_t ms); 00096 00097 #if !defined(PTHREAD_H) 00098 extern LIBTYPE int pthread_create(pthread_t *tid, void *attr, LPTHREAD_START_ROUTINE start, void *arg); 00099 extern LIBTYPE int pthread_join(pthread_t tid, void **value_ptr); 00100 extern LIBTYPE void pthread_mutex_init(pthread_mutex_t *mutex, void *attr); 00101 extern LIBTYPE void pthread_mutex_lock(pthread_mutex_t *mutex); 00102 extern LIBTYPE void pthread_mutex_unlock(pthread_mutex_t *mutex); 00103 #endif 00104 00105 /* 00106 * The console output format should be set to UTF-8, however in XP and Vista this breaks batch file processing. 00107 * Attempting to restore on exit fails to restore if the program is terminated by the user. 00108 * Solution - set the output format each printf. 00109 */ 00110 extern LIBTYPE void console_vprintf(const char *fmt, va_list ap); 00111 extern LIBTYPE void console_printf(const char *fmt, ...); 00112 00113 #ifdef __cplusplus 00114 } 00115 #endif
1.7.6.1