libgphoto2 photo camera library (libgphoto2) API
2.4.14
Main Page
Related Pages
Data Structures
Files
File List
Globals
gphoto2-port-portability.h
Go to the documentation of this file.
1
2
#ifndef __GPHOTO2_PORT_PORTABILITY_H__
3
#define __GPHOTO2_PORT_PORTABILITY_H__
4
5
#ifdef _GPHOTO2_INTERNAL_CODE
6
7
#if defined(WIN32) && !defined(__WINESRC__)
8
9
/************************************************************************
10
* Begin Windows definitions (but not during WINE compilation)
11
************************************************************************/
12
13
# include <windows.h>
14
# include <sys/types.h>
15
# include <sys/stat.h>
16
# include <string.h>
17
# include <stdio.h>
18
# include <direct.h>
19
20
# ifdef IOLIBS
21
# undef IOLIBS
22
# endif
23
# define IOLIBS "."
24
# define strcasecmp _stricmp
25
# define snprintf _snprintf
26
27
/* Work-around for readdir() */
28
typedef
struct
{
29
HANDLE handle;
30
int
got_first;
31
WIN32_FIND_DATA search;
32
char
dir[1024];
33
char
drive[32][2];
34
int
drive_count;
35
int
drive_index;
36
} GPPORTWINDIR;
37
38
/* Sleep functionality */
39
# define GP_SYSTEM_SLEEP(_ms) do { Sleep(_ms) } while (0)
40
41
/* Directory-oriented functions */
42
# define gp_system_dir GPPORTWINDIR *
43
# define gp_system_dirent WIN32_FIND_DATA *
44
# define gp_system_dir_delim '\\'
45
46
/************************************************************************
47
* End WIN32 definitions
48
************************************************************************/
49
50
#elif defined(__SOME_OS2_MAGIC_HERE__)
51
52
/************************************************************************
53
* Begin OS/2 definitions
54
************************************************************************/
55
56
# define strcasecmp(foo,bar) stricmp(foo,bar)
57
# define gp_system_dir_delim '\\'
58
59
# ifndef GPIO_OS2_INCLUDED
60
# define GPIO_OS2_INCLUDED
61
# define IOLIBS getenv("IOLIBS")
62
/*#define IOLIBS "./libgphoto2_port"*/
63
# define RTLD_LAZY 0x001
64
65
66
# ifndef HAVE_TERMIOS_H
67
# define INCL_DOSDEVIOCTL
/* DosDevIOCtl values */
68
# define IOCTL_ASYNC 0x0001
69
# define ASYNC_SETBAUDRATE 0x0041
70
/* c_cflag bit meaning */
71
# define CBAUD 0x0000100f
72
# define B0 0x00000000
/* hang up */
73
# define B50 0x00000001
74
# define B75 0x00000002
75
# define B110 0x00000003
76
# define B134 0x00000004
77
# define B150 0x00000005
78
# define B200 0x00000006
79
# define B300 0x00000007
80
# define B600 0x00000008
81
# define B1200 0x00000009
82
# define B1800 0x0000000a
83
# define B2400 0x0000000b
84
# define B4800 0x0000000c
85
# define B9600 0x0000000d
86
# define B19200 0x0000000e
87
# define B38400 0x0000000f
88
# define EXTA B19200
89
# define EXTB B38400
90
# define CSIZE 0x00000030
91
# define CS5 0x00000000
92
# define CS6 0x00000010
93
# define CS7 0x00000020
94
# define CS8 0x00000030
95
# define CSTOPB 0x00000040
96
# define CREAD 0x00000080
97
# define PARENB 0x00000100
98
# define PARODD 0x00000200
99
# define HUPCL 0x00000400
100
# define CLOCAL 0x00000800
101
# define CBAUDEX 0x00001000
102
# define B57600 0x00001001
103
# define B115200 0x00001002
104
# define B230400 0x00001003
105
# define B460800 0x00001004
106
# define B76800 0x00001005
107
# define B153600 0x00001006
108
# define B307200 0x00001007
109
# define B614400 0x00001008
110
# define B921600 0x00001009
111
# define B500000 0x0000100a
112
# define B576000 0x0000100b
113
# define B1000000 0x0000100c
114
# define B1152000 0x0000100d
115
# define B1500000 0x0000100e
116
# define B2000000 0x0000100f
117
118
# endif
/* HAVE_TERMIOS_H */
119
120
# define CIBAUD 0x100f0000
/* input baud rate (not used) */
121
# define CMSPAR 0x40000000
/* mark or space (stick) parity */
122
/* #define CRTSCTS 0x80000000 */
/* flow control */
123
124
/* modem lines */
125
# define TIOCM_LE 0x001
126
# define TIOCM_DTR 0x002
127
# define TIOCM_RTS 0x004
128
# define TIOCM_ST 0x008
129
# define TIOCM_SR 0x010
130
# define TIOCM_CTS 0x020
131
# define TIOCM_CAR 0x040
132
# define TIOCM_RNG 0x080
133
# define TIOCM_DSR 0x100
134
# define TIOCM_CD TIOCM_CAR
135
# define TIOCM_RI TIOCM_RNG
136
137
# define TIOCMBIC 0x06C
138
# define TIOCMBIS 0x06B
139
# define TIOCMGET 0x06E
140
141
# endif
/* GPIO_OS2_INCLUDED */
142
143
/************************************************************************
144
* End OS/2 definitions
145
************************************************************************/
146
147
#else
148
149
/************************************************************************
150
* Begin POSIX/XOPEN definitions
151
************************************************************************/
152
153
/* yummy. :) */
154
155
/* XOPEN needed for usleep */
156
#ifndef _XOPEN_SOURCE
157
# define _XOPEN_SOURCE 500
158
#else
159
# if ((_XOPEN_SOURCE - 0) < 500)
160
# undef _XOPEN_SOURCE
161
# define _XOPEN_SOURCE 500
162
# endif
163
#endif
164
165
/* for nanosleep */
166
# ifndef _POSIX_C_SOURCE
167
# define _POSIX_C_SOURCE 199309
168
# endif
169
# include <time.h>
170
171
# include <strings.h>
172
# include <sys/types.h>
173
# include <dirent.h>
174
#ifdef HAVE_SYS_PARAM_H
175
# include <sys/param.h>
176
#endif
177
# include <sys/stat.h>
178
# include <unistd.h>
179
181
# define GP_SYSTEM_SLEEP(_ms) \
182
do { \
183
struct timespec req; \
184
req.tv_sec = 0; \
185
req.tv_nsec = 1000*1000*((long)(_ms)); \
186
nanosleep(&req, NULL); \
187
} while (0)
188
189
/* Directory-oriented functions */
191
# define gp_system_dir DIR *
192
193
# define gp_system_dirent struct dirent *
194
195
# define gp_system_dir_delim '/'
196
197
/************************************************************************
198
* End POSIX/XOPEN definitions
199
************************************************************************/
200
201
#endif
/* else */
202
203
204
/************************************************************************
205
* Begin platform independent portability functions
206
************************************************************************/
207
208
int
gp_system_mkdir
(
const
char
*dirname);
209
int
gp_system_rmdir
(
const
char
*dirname);
210
gp_system_dir
gp_system_opendir
(
const
char
*dirname);
211
gp_system_dirent
gp_system_readdir
(gp_system_dir d);
212
const
char
*
gp_system_filename
(gp_system_dirent de);
213
int
gp_system_closedir
(gp_system_dir dir);
214
int
gp_system_is_file
(
const
char
*filename);
215
int
gp_system_is_dir
(
const
char
*dirname);
216
217
/************************************************************************
218
* End platform independent portability functions
219
************************************************************************/
220
#endif
/* _GPHOTO2_INTERNAL_CODE */
221
222
#endif
/* ifndef __GPHOTO2_PORT_PORTABILITY_H__ */
223
/* end of file */
libgphoto2_port
gphoto2
gphoto2-port-portability.h
Generated on Thu Jul 25 2013 22:30:05 for libgphoto2 photo camera library (libgphoto2) API by
1.8.4