libgphoto2 photo camera library (libgphoto2) API 2.5.30

gphoto2-port-portability.h
1
21#ifndef LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
22#define LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
23
24#ifdef _GPHOTO2_INTERNAL_CODE
25
26#if defined(WIN32) && !defined(__WINESRC__)
27
28/************************************************************************
29 * Begin Windows definitions (but not during WINE compilation)
30 ************************************************************************/
31
32# include <windows.h>
33/* done by mingw/wine headers ... defined to struct ... tsaes*/
34#undef interface
35# include <sys/types.h>
36# include <sys/stat.h>
37# include <string.h>
38# include <stdio.h>
39# include <direct.h>
40
41# ifndef IOLIBS
42# define IOLIBS "."
43# endif
44# define strcasecmp _stricmp
45# ifndef snprintf
46# define snprintf _snprintf
47# endif
48
49#define __func__ __FUNCTION__
50
51#ifndef _SSIZE_T_DEFINED
52 typedef SSIZE_T ssize_t;
53#endif
54
55/* Work-around for readdir() */
56 typedef struct {
57 HANDLE handle;
58 int got_first;
59 WIN32_FIND_DATA search;
60 char dir[1024];
61 char drive[32][2];
62 int drive_count;
63 int drive_index;
64} GPPORTWINDIR;
65
66
67/* Directory-oriented functions */
68# define gp_system_dir GPPORTWINDIR *
69# define gp_system_dirent WIN32_FIND_DATA *
70# define gp_system_dir_delim '\\'
71
72# define sleep(x) usleep((x) * 1000 * 1000)
73
74
75
76/************************************************************************
77 * End WIN32 definitions
78 ************************************************************************/
79
80#else
81
82/************************************************************************
83 * Begin POSIX/XOPEN definitions
84 ************************************************************************/
85
86/* yummy. :) */
87
88# include <time.h>
89
90# include <strings.h>
91# include <sys/types.h>
92# include <dirent.h>
93#ifdef HAVE_SYS_PARAM_H
94# include <sys/param.h>
95#endif
96# include <sys/stat.h>
97# include <unistd.h>
98
99
100/* Directory-oriented functions */
102# define gp_system_dir DIR *
104# define gp_system_dirent struct dirent *
106# define gp_system_dir_delim '/'
107
108/************************************************************************
109 * End POSIX/XOPEN definitions
110 ************************************************************************/
111
112#endif /* else */
113
114
115/************************************************************************
116 * Begin platform independent portability functions
117 ************************************************************************/
118
119 int gp_system_mkdir (const char *dirname);
120 int gp_system_rmdir (const char *dirname);
121gp_system_dir gp_system_opendir (const char *dirname);
122gp_system_dirent gp_system_readdir (gp_system_dir d);
123 const char* gp_system_filename (gp_system_dirent de);
124 int gp_system_closedir (gp_system_dir dir);
125 int gp_system_is_file (const char *filename);
126 int gp_system_is_dir (const char *dirname);
127
128/************************************************************************
129 * End platform independent portability functions
130 ************************************************************************/
131#endif /* _GPHOTO2_INTERNAL_CODE */
132
133#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H) */
134
135/* end of file */
gp_system_is_file
int gp_system_is_file(const char *filename)
check if passed filename is a file
Definition: gphoto2-port-portability.c:263
gp_system_filename
const char * gp_system_filename(gp_system_dirent de)
retrieve UNIX filename out of a directory entry
Definition: gphoto2-port-portability.c:237
gp_system_closedir
int gp_system_closedir(gp_system_dir dir)
closedir UNIX functionality
Definition: gphoto2-port-portability.c:249
gp_system_opendir
gp_system_dir gp_system_opendir(const char *dirname)
opendir UNIX functionality
Definition: gphoto2-port-portability.c:211
gp_system_mkdir
int gp_system_mkdir(const char *dirname)
mkdir UNIX functionality
Definition: gphoto2-port-portability.c:180
gp_system_readdir
gp_system_dirent gp_system_readdir(gp_system_dir d)
readdir UNIX functionality
Definition: gphoto2-port-portability.c:225
gp_system_is_dir
int gp_system_is_dir(const char *dirname)
check if passed filename is a directory
Definition: gphoto2-port-portability.c:280
gp_system_rmdir
int gp_system_rmdir(const char *dirname)
rmdir UNIX functionality
Definition: gphoto2-port-portability.c:194