/usr/include/csound/System.hpp is in libcsoundac-dev 1:6.10.0~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | /*
* C S O U N D
*
* L I C E N S E
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CROSSPLATFORM_H
#define CROSSPLATFORM_H
#include "Platform.hpp"
#ifdef SWIG
%module CsoundAC
%{
#include "CppSound.hpp"
#include <string>
#include <vector>
#include <cstdarg>
#include <ctime>
%}
#else
#include "CppSound.hpp"
#include <string>
#include <vector>
#include <cstdarg>
#include <ctime>
#endif
namespace csound
{
class SILENCE_PUBLIC Logger
{
public:
Logger();
virtual ~Logger();
virtual void write(const char *text);
};
typedef void (*MessageCallbackType)(CSOUND *csound, int attribute, const char *format, va_list marker);
/**
* Abstraction layer for a minimal set of system services.
*/
class SILENCE_PUBLIC System
{
static void *userdata_;
static int messageLevel;
static void (*messageCallback)(CSOUND *csound, int attribute, const char *format, va_list valist);
static FILE *logfile;
public:
enum Level {
ERROR_LEVEL = 1,
WARNING_LEVEL = 2,
INFORMATION_LEVEL = 4,
DEBUGGING_LEVEL = 8
};
/**
* Parses a filename into its component parts, which are returned in the arguments.
* On Unix and Linux, "drive" is always empty.
*/
static void parsePathname(const std::string pathname, std::string &drive, std::string &base, std::string &file, std::string &extension);
/**
* Opens a shared library; useful for loading plugins.
*/
static int openLibrary(void **library, std::string filename);
/**
* Returns the address of a symbol (function or object) in a shared library;
* useful for loading plugin functions.
*/
static void *getSymbol(void *library, std::string name);
/**
* Closes a shared library.
*/
static void closeLibrary(void *library);
/**
* Lists filenames in a directory;
* useful for locating plugins.
*/
static std::vector<std::string> getFilenames(std::string directoryName);
/**
* Lists directory names in a directory;
* useful for locating plugins.
*/
static std::vector<std::string> getDirectoryNames(std::string directoryName);
/**
* Creates a new thread.
*/
static void *createThread(void (*threadRoutine)(void *threadData), void *data, int priority);
/**
* Creates a thread lock.
*/
static void *createThreadLock();
/**
* Waits on a thread lock.
* Zero timeout means infinite timeout.
*/
static void waitThreadLock(void *lock, size_t timeoutMilliseconds = 0);
/**
* Releases a thread lock.
*/
static void notifyThreadLock(void *lock);
/**
* Destroys a thread lock.
*/
static void destroyThreadLock(void *lock);
/**
* Sets message level, returns old message level.
*/
static int setMessageLevel(int messageLevel);
/**
* Yields to the next waiting thread.
*/
static void yieldThread();
/**
* Returns current system message level.
*/
static int getMessageLevel();
/**
* Sets userdata for message printing.
*/
static void setUserdata(void *userdata);
/**
* Returns userdata for message printing.
*/
static void *getUserdata();
/**
* Set a stream for printing messages to
* (in addition to callback, stderr, etc.).
*/
static void setLogfile(FILE *logfile);
/**
* Return the stream, if any, used for
* printing messages to.
*/
static FILE *getLogfile();
#ifndef SWIG
/**
* Prints a message if the ERROR_LEVEL flag is set.
*/
static void error(CSOUND *csound, const char *format,...);
/**
* Prints a message if the ERROR_LEVEL flag is set.
*/
static void error(const char *format,...);
/**
* Prints a message if the WARNNING_LEVEL flag is set.
*/
static void warn(CSOUND *csound, const char *format,...);
/**
* Prints a message if the WARNNING_LEVEL flag is set.
*/
static void warn(const char *format,...);
/**
* Prints a message if the INFORMATION_LEVEL flag is set.
*/
static void inform(CSOUND *csound, const char *format,...);
/**
* Prints a message if the INFORMATION_LEVEL flag is set.
*/
static void inform(const char *format,...);
/**
* Prints a message if the DEBUGGING_LEVEL flag is set.
*/
static void debug(CSOUND *csound, const char *format,...);
/**
* Prints a message if the DEBUGGING_LEVEL flag is set.
*/
static void debug(const char *format,...);
/**
* Prints a message.
*/
static void message(CSOUND *csound, const char *format,...);
/**
* Prints a message.
*/
static void message(const char *format,...);
/**
* Prints a message.
*/
static void message(CSOUND *csound, const char *format, va_list valist);
/**
* Prints a message.
*/
#if defined(_MSC_VER)
static void message(const char *format, va_list valist);
#else
PUBLIC static void message(const char *format, va_list valist);
#endif
/**
* Prints a message.
*/
static void message(CSOUND *csound, int level, const char *format,...);
/**
* Prints a message.
*/
static void message(CSOUND *csound, int attribute, const char *format, va_list valist);
/**
* Sets message callback.
*/
static void setMessageCallback(MessageCallbackType messageCallback_);
/**
* Return the message callback, or null if none.
*/
static MessageCallbackType getMessageCallback();
#endif
/**
* Execute a system command or program.
*/
static int execute(const char *command);
/**
* Open a file using the operating system shell.
*/
static int shellOpen(const char *filename, const char *command = "open");
/**
* Returns the standard filename extension for a shared library,
* such as "dll" or "so".
*/
static std::string getSharedLibraryExtension();
/**
* Starts timing.
*/
static clock_t startTiming();
/**
* Stop timing, and return elapsed seonds.
*/
static double stopTiming(clock_t startedAt);
/**
* Sleep the indicated number of milliseconds.
*/
static void sleep(double milliseconds);
/**
* Make some sort of noticeable sound.
*/
static void beep();
};
/**
* Encapsulates a thread monitor, such as a Windows event handle.
*/
class SILENCE_PUBLIC ThreadLock
{
void *lock;
public:
ThreadLock();
virtual ~ThreadLock();
/**
* Creates and initializes the monitor.
* The monitor is in a non-notified or unsignaled state.
*/
virtual void open();
/**
* Destroys the monitor.
*/
virtual void close();
/**
* Returns whether the monitor is open.
*/
virtual bool isOpen();
/**
* Waits until the monitor is notified by another thread.
* Zero timeout means infinite timeout.
*/
virtual void startWait(size_t timeoutMilliseconds = 0);
/**
* Releases one thread that is waiting on the monitor.
*/
virtual void endWait();
};
}
#endif
|