Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / include / common / SC_Win32Utils.h
blobc4c30f3ee9bee7a31515e2ce952f843215506f8c
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _SC_WIN32UTILS_H
22 #define _SC_WIN32UTILS_H
24 #ifdef _WIN32
25 #include <stdio.h>
26 #include <winsock2.h>
27 #include <pthread.h>
29 // wrappers for unix replacements
30 #define gettimeofday win32_gettimeofday
31 #define basename win32_basename
32 #define dirname win32_dirname
33 #define nanosleep win32_nanosleep
34 #define pipe win32_pipe
36 #if _MSC_VER
37 #define snprintf _snprintf
38 #endif
40 void win32_ReplaceCharInString(char* string, int len, char src, char dst);
41 // Finds the parent folder of a specified path pattern (including trailing slash)
42 void win32_ExtractContainingFolder(char* folder,const char* pattern,int maxChars);
43 void win32_synctimes();
44 void win32_gettimeofday(timeval* tv, void*);
45 void win32_GetHomeFolder(char* homeFolder, int bufLen);
46 char* win32_basename(char* path);
47 char* win32_dirname(char* path);
48 int win32_nanosleep (const struct timespec *requested_time, struct timespec *remaining);
49 int win32_pipe(int handles[2]);
50 int win32_piperead(int s, char *buf, int len);
51 int win32_pipewrite(int s, char *buf, int len);
53 #endif //_WIN32
54 #endif // SC_WIN32UTILS_H