libgphoto2 photo camera library (libgphoto2) API
2.5.13
|
00001 00020 #ifndef __GPHOTO2_PORT_PORTABILITY_H__ 00021 #define __GPHOTO2_PORT_PORTABILITY_H__ 00022 00023 #ifdef _GPHOTO2_INTERNAL_CODE 00024 00025 #if defined(WIN32) && !defined(__WINESRC__) 00026 00027 /************************************************************************ 00028 * Begin Windows definitions (but not during WINE compilation) 00029 ************************************************************************/ 00030 00031 # include <windows.h> 00032 /* done by mingw/wine headers ... defined to struct ... tsaes*/ 00033 #undef interface 00034 # include <sys/types.h> 00035 # include <sys/stat.h> 00036 # include <string.h> 00037 # include <stdio.h> 00038 # include <direct.h> 00039 00040 # ifdef IOLIBS 00041 # undef IOLIBS 00042 # endif 00043 # define IOLIBS "." 00044 # define strcasecmp _stricmp 00045 # ifndef snprintf 00046 # define snprintf _snprintf 00047 # endif 00048 00049 #define __func__ __FUNCTION__ 00050 00051 typedef SSIZE_T ssize_t; 00052 00053 /* Work-around for readdir() */ 00054 typedef struct { 00055 HANDLE handle; 00056 int got_first; 00057 WIN32_FIND_DATA search; 00058 char dir[1024]; 00059 char drive[32][2]; 00060 int drive_count; 00061 int drive_index; 00062 } GPPORTWINDIR; 00063 00064 00065 /* Directory-oriented functions */ 00066 # define gp_system_dir GPPORTWINDIR * 00067 # define gp_system_dirent WIN32_FIND_DATA * 00068 # define gp_system_dir_delim '\\' 00069 00070 # define sleep(x) usleep((x) * 1000 * 1000) 00071 00072 00073 00074 /************************************************************************ 00075 * End WIN32 definitions 00076 ************************************************************************/ 00077 00078 #elif defined(__SOME_OS2_MAGIC_HERE__) 00079 00080 /************************************************************************ 00081 * Begin OS/2 definitions 00082 ************************************************************************/ 00083 00084 # define strcasecmp(foo,bar) stricmp(foo,bar) 00085 # define gp_system_dir_delim '\\' 00086 00087 # ifndef GPIO_OS2_INCLUDED 00088 # define GPIO_OS2_INCLUDED 00089 # define IOLIBS getenv("IOLIBS") 00090 /*#define IOLIBS "./libgphoto2_port"*/ 00091 # define RTLD_LAZY 0x001 00092 00093 00094 # ifndef HAVE_TERMIOS_H 00095 # define INCL_DOSDEVIOCTL /* DosDevIOCtl values */ 00096 # define IOCTL_ASYNC 0x0001 00097 # define ASYNC_SETBAUDRATE 0x0041 00098 /* c_cflag bit meaning */ 00099 # define CBAUD 0x0000100f 00100 # define B0 0x00000000 /* hang up */ 00101 # define B50 0x00000001 00102 # define B75 0x00000002 00103 # define B110 0x00000003 00104 # define B134 0x00000004 00105 # define B150 0x00000005 00106 # define B200 0x00000006 00107 # define B300 0x00000007 00108 # define B600 0x00000008 00109 # define B1200 0x00000009 00110 # define B1800 0x0000000a 00111 # define B2400 0x0000000b 00112 # define B4800 0x0000000c 00113 # define B9600 0x0000000d 00114 # define B19200 0x0000000e 00115 # define B38400 0x0000000f 00116 # define EXTA B19200 00117 # define EXTB B38400 00118 # define CSIZE 0x00000030 00119 # define CS5 0x00000000 00120 # define CS6 0x00000010 00121 # define CS7 0x00000020 00122 # define CS8 0x00000030 00123 # define CSTOPB 0x00000040 00124 # define CREAD 0x00000080 00125 # define PARENB 0x00000100 00126 # define PARODD 0x00000200 00127 # define HUPCL 0x00000400 00128 # define CLOCAL 0x00000800 00129 # define CBAUDEX 0x00001000 00130 # define B57600 0x00001001 00131 # define B115200 0x00001002 00132 # define B230400 0x00001003 00133 # define B460800 0x00001004 00134 # define B76800 0x00001005 00135 # define B153600 0x00001006 00136 # define B307200 0x00001007 00137 # define B614400 0x00001008 00138 # define B921600 0x00001009 00139 # define B500000 0x0000100a 00140 # define B576000 0x0000100b 00141 # define B1000000 0x0000100c 00142 # define B1152000 0x0000100d 00143 # define B1500000 0x0000100e 00144 # define B2000000 0x0000100f 00145 00146 # endif /* HAVE_TERMIOS_H */ 00147 00148 # define CIBAUD 0x100f0000 /* input baud rate (not used) */ 00149 # define CMSPAR 0x40000000 /* mark or space (stick) parity */ 00150 /* #define CRTSCTS 0x80000000 */ /* flow control */ 00151 00152 /* modem lines */ 00153 # define TIOCM_LE 0x001 00154 # define TIOCM_DTR 0x002 00155 # define TIOCM_RTS 0x004 00156 # define TIOCM_ST 0x008 00157 # define TIOCM_SR 0x010 00158 # define TIOCM_CTS 0x020 00159 # define TIOCM_CAR 0x040 00160 # define TIOCM_RNG 0x080 00161 # define TIOCM_DSR 0x100 00162 # define TIOCM_CD TIOCM_CAR 00163 # define TIOCM_RI TIOCM_RNG 00164 00165 # define TIOCMBIC 0x06C 00166 # define TIOCMBIS 0x06B 00167 # define TIOCMGET 0x06E 00168 00169 # endif /* GPIO_OS2_INCLUDED */ 00170 00171 /************************************************************************ 00172 * End OS/2 definitions 00173 ************************************************************************/ 00174 00175 #else 00176 00177 /************************************************************************ 00178 * Begin POSIX/XOPEN definitions 00179 ************************************************************************/ 00180 00181 /* yummy. :) */ 00182 00183 /* XOPEN needed for usleep */ 00184 #ifndef _XOPEN_SOURCE 00185 # define _XOPEN_SOURCE 500 00186 #else 00187 # if ((_XOPEN_SOURCE - 0) < 500) 00188 # undef _XOPEN_SOURCE 00189 # define _XOPEN_SOURCE 500 00190 # endif 00191 #endif 00192 00193 /* for nanosleep */ 00194 # ifndef _POSIX_C_SOURCE 00195 # define _POSIX_C_SOURCE 199309 00196 # endif 00197 # include <time.h> 00198 00199 # include <strings.h> 00200 # include <sys/types.h> 00201 # include <dirent.h> 00202 #ifdef HAVE_SYS_PARAM_H 00203 # include <sys/param.h> 00204 #endif 00205 # include <sys/stat.h> 00206 # include <unistd.h> 00207 00208 00209 /* Directory-oriented functions */ 00211 # define gp_system_dir DIR * 00212 00213 # define gp_system_dirent struct dirent * 00214 00215 # define gp_system_dir_delim '/' 00216 00217 /************************************************************************ 00218 * End POSIX/XOPEN definitions 00219 ************************************************************************/ 00220 00221 #endif /* else */ 00222 00223 00224 /************************************************************************ 00225 * Begin platform independent portability functions 00226 ************************************************************************/ 00227 00228 int gp_system_mkdir (const char *dirname); 00229 int gp_system_rmdir (const char *dirname); 00230 gp_system_dir gp_system_opendir (const char *dirname); 00231 gp_system_dirent gp_system_readdir (gp_system_dir d); 00232 const char* gp_system_filename (gp_system_dirent de); 00233 int gp_system_closedir (gp_system_dir dir); 00234 int gp_system_is_file (const char *filename); 00235 int gp_system_is_dir (const char *dirname); 00236 00237 /************************************************************************ 00238 * End platform independent portability functions 00239 ************************************************************************/ 00240 #endif /* _GPHOTO2_INTERNAL_CODE */ 00241 00242 #endif /* ifndef __GPHOTO2_PORT_PORTABILITY_H__ */ 00243 /* end of file */