2 Copyright (C) 2009 John Emmas
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifdef PBD_IS_IN_WIN_STATIC_LIB // #define if your project uses libpbd (under Windows) as a static library
23 #define PBD_IS_IN_WINDLL 0
29 #include <ardourext/misc.h>
30 #include <ardourext/sys/time.h>
33 #if !defined(PBD_IS_IN_WINDLL)
34 #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
35 // If you need '__declspec' compatibility, add extra compilers to the above as necessary
36 #define PBD_IS_IN_WINDLL 1
38 #define PBD_IS_IN_WINDLL 0
42 #if PBD_IS_IN_WINDLL && !defined(PBD_API)
43 #if defined(BUILDING_PBD)
44 #define PBD_API __declspec(dllexport)
45 #define PBD_APICALLTYPE __stdcall
46 #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
47 #define PBD_API __declspec(dllimport)
48 #define PBD_APICALLTYPE __stdcall
50 #error "Attempting to define __declspec with an incompatible compiler !"
52 #elif !defined(PBD_API)
53 // Other compilers / platforms could be accommodated here
55 #define PBD_APICALLTYPE
62 #define PATH_MAX _MAX_PATH
67 #endif /* __cplusplus */
69 // This function is (hopefully) temporary and is placed here
70 // because 'g_usleep()' doesn't seem to work very well for glib-win32
71 void pbd_g_usleep (unsigned long microseconds);
75 #endif /* __cplusplus */
86 #define POLLRDNORM POLLIN
87 #define POLLRDBAND POLLIN
88 #define POLLWRNORM POLLOUT
89 #define POLLWRBAND POLLOUT
92 #ifdef PLATFORM_WINDOWS
95 #if defined(BUILDING_PBDEXTN)
96 #define PBDEXTN_API __declspec(dllexport)
97 #define PBDEXTN_APICALLTYPE __cdecl
98 #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
99 #define PBDEXTN_API __declspec(dllimport)
100 #define PBDEXTN_APICALLTYPE __cdecl
102 #error "Attempting to define __declspec with an incompatible compiler !"
104 #endif // PBDEXTN_API
106 #ifndef CYGIMPORT_API
107 #define CYGIMPORT_API __declspec(dllimport)
108 #define CYGIMPORT_APICALLTYPE __cdecl
109 #endif // CYGIMPORT_API
112 #define __THROW throw()
116 #define RTLD_DEFAULT ((void *) 0)
117 #define RTLD_NEXT ((void *) -1L)
118 #define RTLD_LAZY 0x00001
119 #define RTLD_NOW 0x00002
120 #define RTLD_BINDING_MASK 0x00003
121 #define RTLD_NOLOAD 0x00004
122 #define RTLD_GLOBAL 0x00004
123 #define RTLD_DEEPBIND 0x00008
132 #endif /* __cplusplus */
134 PBDEXTN_API int PBDEXTN_APICALLTYPE cyginit (unsigned int result);
135 PBD_API int PBD_APICALLTYPE dlclose (void *handle) __THROW;
136 PBD_API void* PBD_APICALLTYPE dlopen (const char *file_name, int mode) __THROW;
137 PBD_API void* PBD_APICALLTYPE dlsym (void *handle, const char *symbol_name) __THROW;
138 PBD_API char* PBD_APICALLTYPE dlerror () __THROW;
142 #endif /* __cplusplus */
147 #include <sys/types.h>
149 typedef int (FAR PBDEXTN_APICALLTYPE *CYGINIT_API)(unsigned int);
152 #define FILENAME_MAX (260)
157 typedef long _ssize_t;
160 typedef _ssize_t ssize_t;
162 #endif /* ! _SSIZE_T_ */
166 long d_ino; // Always zero
167 unsigned short d_reclen; // Always zero
168 unsigned short d_namlen; // Length of name in d_name
169 char d_name[FILENAME_MAX]; // File name
172 // This is an internal data structure. Do not use it
173 // except as an argument to one of the functions below.
176 // Disk transfer area for this dir
177 struct _finddata_t dd_dta;
179 // 'dirent' struct to return from dir (NOTE: this
180 // is not thread safe).
181 struct dirent dd_dir;
183 // '_findnext()' handle
186 // Current status of search:
187 // 0 = not started yet (next entry to read is first entry)
189 // Otherwise - positive (0 based) index of next entry
192 // Full path for dir with search pattern (struct will be extended)
203 typedef unsigned int nfds_t;
205 PBD_API int PBD_APICALLTYPE gettimeofday(struct timeval *__restrict tv, __timezone_ptr_t tz);
206 PBD_API ssize_t PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
207 PBD_API ssize_t PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
208 PBD_API int PBD_APICALLTYPE poll(struct pollfd *fds, nfds_t nfds, int timeout);
214 #endif /* __cplusplus */
216 PBD_API bool PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
217 PBD_API char* PBD_APICALLTYPE realpath (const char *original_path, char resolved_path[_MAX_PATH+1]);
218 PBD_API int PBD_APICALLTYPE mkstemp (char *template_name);
219 PBD_API int PBD_APICALLTYPE ntfs_link (const char *existing_filepath, const char *link_filepath);
220 PBD_API int PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
222 // These are used to replicate 'dirent.h' functionality
223 PBD_API DIR* PBD_APICALLTYPE opendir (const char *szPath);
224 PBD_API struct dirent* PBD_APICALLTYPE readdir (DIR *pDir);
225 PBD_API int PBD_APICALLTYPE closedir (DIR *pDir);
229 #endif /* __cplusplus */
233 #endif // !__CYGWIN__
234 #endif // PLATFORM_WINDOWS
235 #endif // _msvc_pbd_h_