Main Page | Class List | File List | Class Members | File Members | Related Pages

platform.h

Go to the documentation of this file.
00001 /* 00002 * $Id: platform.h,v 1.24 2004/05/02 08:22:52 hipnod Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __PLATFORM_H 00018 #define __PLATFORM_H 00019 00020 /*****************************************************************************/ 00021 00032 /*****************************************************************************/ 00033 00034 #include <sys/stat.h> /* stat macros */ 00035 00036 #ifdef WIN32 00037 # ifndef FD_SETSIZE 00038 # define FD_SETSIZE 1024 00039 # endif 00040 # include <winsock2.h> /* include *before* windows */ 00041 # include <windows.h> 00042 #endif /* !WIN32 */ 00043 00044 /*****************************************************************************/ 00045 /* definitions for platform_child_proc */ 00046 00047 struct _sproc_data; 00048 00049 #define PARENT_FUNC(func) int func (SubprocessData *subproc, void *udata) 00050 typedef int (*ParentFunc) (struct _sproc_data *sdata, void *udata); 00051 00052 #define CHILD_FUNC(func) int func (SubprocessData *subproc, void *udata) 00053 typedef int (*ChildFunc) (struct _sproc_data *sdata, void *udata); 00054 00055 #ifndef WIN32 00056 # define SUBPROCESS(func) int func (void *param) 00057 #else /* WIN32 */ 00058 # define SUBPROCESS(func) DWORD WINAPI func (LPVOID param) 00059 #endif /* !WIN32 */ 00060 00064 typedef struct _sproc_data 00065 { 00066 int fd; 00067 ChildFunc cfunc; 00068 ParentFunc pfunc; 00069 char *data; 00070 size_t len; 00071 size_t data_len; 00072 void *udata; 00073 pid_t pid; 00074 } SubprocessData; 00075 00076 /*****************************************************************************/ 00077 00078 #ifndef __GNUC__ 00079 # define __PRETTY_FUNCTION__ "" 00080 #endif 00081 00082 #ifndef S_ISDIR 00083 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 00084 #endif 00085 00086 #ifndef S_ISFIFO 00087 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 00088 #endif 00089 00090 #ifndef S_ISCHR 00091 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 00092 #endif 00093 00094 #ifndef S_ISBLK 00095 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 00096 #endif 00097 00098 #ifndef S_ISREG 00099 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 00100 #endif 00101 00102 /*****************************************************************************/ 00103 00104 EXTERN_C_BEGIN 00105 00106 /*****************************************************************************/ 00107 00114 LIBGIFT_EXPORT 00115 char *platform_data_dir (void); 00116 00127 LIBGIFT_EXPORT 00128 char *platform_plugin_dir (void); 00129 00140 LIBGIFT_EXPORT 00141 char *platform_home_dir (void); 00142 00151 LIBGIFT_EXPORT 00152 char *platform_local_dir (void); 00153 00169 LIBGIFT_EXPORT 00170 BOOL platform_init (const char *home_dir, const char *local_dir, 00171 const char *data_dir, const char *plugin_dir); 00172 00180 LIBGIFT_EXPORT 00181 void platform_cleanup (void); 00182 00189 LIBGIFT_EXPORT 00190 int platform_gettimeofday (struct timeval *tv, void *unused); 00191 00202 LIBGIFT_EXPORT 00203 int platform_child (ChildFunc cfunc, ParentFunc pfunc, void *udata); 00204 00214 LIBGIFT_EXPORT 00215 int platform_child_sendmsg (SubprocessData *sdata, char *msg, size_t len); 00216 00225 LIBGIFT_EXPORT 00226 int platform_child_recvmsg (SubprocessData *sdata); 00227 00236 LIBGIFT_EXPORT 00237 char *platform_version (void); 00238 00247 LIBGIFT_EXPORT 00248 unsigned long platform_errno (void); 00249 00257 LIBGIFT_EXPORT 00258 char *platform_error (void); 00259 00264 LIBGIFT_EXPORT 00265 unsigned long platform_net_errno (void); 00266 00271 LIBGIFT_EXPORT 00272 char *platform_net_error (void); 00273 00274 /*****************************************************************************/ 00275 00276 EXTERN_C_END 00277 00278 /*****************************************************************************/ 00279 00280 #endif /* __PLATFORM_H */

Generated on Sun Aug 22 08:07:10 2004 by doxygen 1.3.7