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