Browse Source

Compiles on Windows again.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3793 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 16 years ago
parent
commit
bcb09a4d9c
3 changed files with 35 additions and 24 deletions
  1. +8
    -8
      common/JackLockedEngine.h
  2. +23
    -14
      common/JackTools.cpp
  3. +4
    -2
      common/JackTools.h

+ 8
- 8
common/JackLockedEngine.h View File

@@ -30,14 +30,14 @@ namespace Jack


#define TRY_CALL \ #define TRY_CALL \
try { \ try { \
#define CATCH_EXCEPTION_RETURN \ #define CATCH_EXCEPTION_RETURN \
} catch(std::bad_alloc& e) { \ } catch(std::bad_alloc& e) { \
jack_error("Memory allocation error..."); \ jack_error("Memory allocation error..."); \
return -1; \ return -1; \
} catch(JackTemporaryException& e) { \ } catch(JackTemporaryException& e) { \
jack_error("JackTemporaryException : now quits..."); \ jack_error("JackTemporaryException : now quits..."); \
kill(JackTools::GetPID(), SIGINT); \
JackTools::KillServer(); \
return -1; \ return -1; \
} catch (...) { \ } catch (...) { \
jack_error("Unknown error..."); \ jack_error("Unknown error..."); \
@@ -54,7 +54,7 @@ namespace Jack
/*! /*!
\brief Locked Engine, access to methods is serialized using a mutex. \brief Locked Engine, access to methods is serialized using a mutex.
*/ */
class SERVER_EXPORT JackLockedEngine : public JackLockAble class SERVER_EXPORT JackLockedEngine : public JackLockAble
{ {
private: private:
@@ -205,7 +205,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.PortDisconnect(refnum, src, dst); return fEngine.PortDisconnect(refnum, src, dst);
CATCH_EXCEPTION_RETURN CATCH_EXCEPTION_RETURN
} }
int PortRename(int refnum, jack_port_id_t port, const char* name) int PortRename(int refnum, jack_port_id_t port, const char* name)
{ {
TRY_CALL TRY_CALL
@@ -263,7 +263,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
fEngine.NotifyFreewheel(onoff); fEngine.NotifyFreewheel(onoff);
CATCH_ENGINE_EXCEPTION CATCH_ENGINE_EXCEPTION
} }
void NotifyFailure(int code, const char* reason) void NotifyFailure(int code, const char* reason)
{ {
TRY_CALL TRY_CALL
@@ -271,7 +271,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
fEngine.NotifyFailure(code, reason); fEngine.NotifyFailure(code, reason);
CATCH_ENGINE_EXCEPTION CATCH_ENGINE_EXCEPTION
} }
int GetClientPID(const char* name) int GetClientPID(const char* name)
{ {
TRY_CALL TRY_CALL
@@ -279,7 +279,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.GetClientPID(name); return fEngine.GetClientPID(name);
CATCH_EXCEPTION_RETURN CATCH_EXCEPTION_RETURN
} }
int GetClientRefNum(const char* name) int GetClientRefNum(const char* name)
{ {
TRY_CALL TRY_CALL
@@ -287,7 +287,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.GetClientRefNum(name); return fEngine.GetClientRefNum(name);
CATCH_EXCEPTION_RETURN CATCH_EXCEPTION_RETURN
} }
}; };


} // end of namespace } // end of namespace


+ 23
- 14
common/JackTools.cpp View File

@@ -33,10 +33,19 @@ using namespace std;


namespace Jack { namespace Jack {


void JackTools::KillServer()
{
#ifdef WIN32
exit(1);
#else
kill(GetPID(), SIGINT);
#endif
}

#define DEFAULT_TMP_DIR "/tmp" #define DEFAULT_TMP_DIR "/tmp"
char* jack_tmpdir = (char*)DEFAULT_TMP_DIR; char* jack_tmpdir = (char*)DEFAULT_TMP_DIR;


int JackTools::GetPID()
int JackTools::GetPID()
{ {
#ifdef WIN32 #ifdef WIN32
return _getpid(); return _getpid();
@@ -45,7 +54,7 @@ namespace Jack {
#endif #endif
} }


int JackTools::GetUID()
int JackTools::GetUID()
{ {
#ifdef WIN32 #ifdef WIN32
return _getpid(); return _getpid();
@@ -55,7 +64,7 @@ namespace Jack {
#endif #endif
} }


const char* JackTools::DefaultServerName()
const char* JackTools::DefaultServerName()
{ {
const char* server_name; const char* server_name;
if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL) if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
@@ -66,25 +75,25 @@ namespace Jack {
/* returns the name of the per-user subdirectory of jack_tmpdir */ /* returns the name of the per-user subdirectory of jack_tmpdir */
#ifdef WIN32 #ifdef WIN32


char* JackTools::UserDir()
char* JackTools::UserDir()
{ {
return ""; return "";
} }


char* JackTools::ServerDir(const char* server_name, char* server_dir)
char* JackTools::ServerDir(const char* server_name, char* server_dir)
{ {
return ""; return "";
} }


void JackTools::CleanupFiles(const char* server_name) {} void JackTools::CleanupFiles(const char* server_name) {}


int JackTools::GetTmpdir()
int JackTools::GetTmpdir()
{ {
return 0; return 0;
} }


#else #else
char* JackTools::UserDir()
char* JackTools::UserDir()
{ {
static char user_dir[JACK_PATH_MAX + 1] = ""; static char user_dir[JACK_PATH_MAX + 1] = "";


@@ -101,7 +110,7 @@ namespace Jack {
} }


/* returns the name of the per-server subdirectory of jack_user_dir() */ /* returns the name of the per-server subdirectory of jack_user_dir() */
char* JackTools::ServerDir(const char* server_name, char* server_dir)
char* JackTools::ServerDir(const char* server_name, char* server_dir)
{ {
/* format the path name into the suppled server_dir char array, /* format the path name into the suppled server_dir char array,
* assuming that server_dir is at least as large as JACK_PATH_MAX + 1 */ * assuming that server_dir is at least as large as JACK_PATH_MAX + 1 */
@@ -110,7 +119,7 @@ namespace Jack {
return server_dir; return server_dir;
} }


void JackTools::CleanupFiles(const char* server_name)
void JackTools::CleanupFiles(const char* server_name)
{ {
DIR* dir; DIR* dir;
struct dirent *dirent; struct dirent *dirent;
@@ -169,7 +178,7 @@ namespace Jack {
} }
} }


int JackTools::GetTmpdir()
int JackTools::GetTmpdir()
{ {
FILE* in; FILE* in;
size_t len; size_t len;
@@ -201,7 +210,7 @@ namespace Jack {
} }
#endif #endif


void JackTools::RewriteName(const char* name, char* new_name)
void JackTools::RewriteName(const char* name, char* new_name)
{ {
size_t i; size_t i;
for (i = 0; i < strlen(name); i++) { for (i = 0; i < strlen(name); i++) {
@@ -212,7 +221,7 @@ namespace Jack {
} }
new_name[i] = '\0'; new_name[i] = '\0';
} }
#ifdef WIN32 #ifdef WIN32


void BuildClientPath(char* path_to_so, int path_len, const char* so_name) void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
@@ -251,7 +260,7 @@ void PrintLoadError(const char* so_name)


#else #else


void PrintLoadError(const char* so_name)
void PrintLoadError(const char* so_name)
{ {
jack_log("error loading %s err = %s", so_name, dlerror()); jack_log("error loading %s err = %s", so_name, dlerror());
} }
@@ -264,7 +273,7 @@ void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
internal_dir = ADDON_DIR; internal_dir = ADDON_DIR;
} }
} }
snprintf(path_to_so, path_len, "%s/%s.so", internal_dir, so_name); snprintf(path_to_so, path_len, "%s/%s.so", internal_dir, so_name);
} }




+ 4
- 2
common/JackTools.h View File

@@ -55,6 +55,8 @@ namespace Jack
static int GetPID(); static int GetPID();
static int GetUID(); static int GetUID();


static void KillServer();

static char* UserDir(); static char* UserDir();
static char* ServerDir ( const char* server_name, char* server_dir ); static char* ServerDir ( const char* server_name, char* server_dir );
static const char* DefaultServerName(); static const char* DefaultServerName();
@@ -201,10 +203,10 @@ namespace Jack
return 0; return 0;
} }
}; };
void BuildClientPath(char* path_to_so, int path_len, const char* so_name); void BuildClientPath(char* path_to_so, int path_len, const char* so_name);
void PrintLoadError(const char* so_name); void PrintLoadError(const char* so_name);
} }


#endif #endif

Loading…
Cancel
Save