File: sc_popen.h

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,304 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (42 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download | duplicates (4)
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
#include <stdio.h>
#include <sys/types.h>

#include <vector>
#include <string>

#ifndef _WIN32
#    include <unistd.h>
#    include <sys/wait.h>
#endif

#ifdef _WIN32
#    include "SC_Win32Utils.h"
/*
 *	Signal stuff
 *	For WIN32, there is no wait() call so there are no wait() macros
 *	to interpret the return value of system().  Instead, system()
 *	return values < 0x100 are used for exit() termination, and higher
 *	values are used to indicated non-exit() termination, which is
 *	similar to a unix-style signal exit (think SIGSEGV ==
 *	STATUS_ACCESS_VIOLATION).  See this URL for a list of WIN32
 *	STATUS_* values from Wine:
 *
 *		http://source.winehq.org/source/include/ntstatus.h
 */
#    define WIFEXITED(w) (((w)&0xffffff00) == 0)
#    define WIFSIGNALED(w) (!WIFEXITED(w))
#    define WEXITSTATUS(w) (w)
#    define WTERMSIG(w) (w)

std::tuple<pid_t, FILE*> sc_popen_c(const char* utf8_cmd, const char* mode);
#else
std::tuple<pid_t, FILE*> sc_popen_c_argv(const char* filename, char* const argv[], const char* type);
#endif

/** \brief Opens a pipe to a separate process.
 *
 * This function assumes a UTF-8 encoded, narrow-char string.
 */
std::tuple<pid_t, FILE*> sc_popen(std::string&& command, const std::string& type);
std::tuple<pid_t, FILE*> sc_popen_argv(const std::vector<std::string>& strings, const std::string& type);
int sc_pclose(FILE* iop, pid_t mPid);