mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-06-25 18:29:41 +00:00
Removed more unused files
This commit is contained in:
parent
e99d4e579c
commit
8c0a84c536
|
@ -48,7 +48,6 @@ set(BasiliskII_SRCS
|
|||
../extfs.cpp
|
||||
../user_strings.cpp
|
||||
user_strings_unix.cpp
|
||||
rpc_unix.cpp
|
||||
# XPLAT_SRCS
|
||||
../CrossPlatform/vm_alloc.cpp
|
||||
../CrossPlatform/sigsegv.cpp
|
||||
|
@ -67,7 +66,6 @@ set(BasiliskII_SRCS
|
|||
../dummy/scsi_dummy.cpp
|
||||
#audio src
|
||||
../SDL/audio_sdl.cpp
|
||||
#sem src: posix_sem.cpp
|
||||
#ui src
|
||||
../dummy/prefs_editor_dummy.cpp
|
||||
#extra sys
|
||||
|
|
|
@ -55,7 +55,6 @@ using std::string;
|
|||
#include "main.h"
|
||||
#include "vm_alloc.h"
|
||||
#include "sigsegv.h"
|
||||
#include "rpc.h"
|
||||
|
||||
#if USE_JIT
|
||||
extern void flush_icache_range(uint8 *start, uint32 size); // from compemu_support.cpp
|
||||
|
@ -108,11 +107,6 @@ static timer_t timer; // 60Hz timer
|
|||
#endif
|
||||
#endif // !HAVE_PTHREADS
|
||||
|
||||
|
||||
static rpc_connection_t *gui_connection = NULL; // RPC connection to the GUI
|
||||
static const char *gui_connection_path = NULL; // GUI connection identifier
|
||||
|
||||
|
||||
// Prototypes
|
||||
static int xpram_func(void *arg);
|
||||
static int tick_func(void *arg);
|
||||
|
@ -300,12 +294,6 @@ int main(int argc, char **argv)
|
|||
for (int i=1; i<argc; i++) {
|
||||
if (strcmp(argv[i], "--help") == 0) {
|
||||
usage(argv[0]);
|
||||
} else if (strcmp(argv[i], "--gui-connection") == 0) {
|
||||
argv[i++] = NULL;
|
||||
if (i < argc) {
|
||||
gui_connection_path = argv[i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
} else if (strcmp(argv[i], "--break") == 0) {
|
||||
argv[i++] = NULL;
|
||||
if (i < argc) {
|
||||
|
@ -339,14 +327,6 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
// Connect to the external GUI
|
||||
if (gui_connection_path) {
|
||||
if ((gui_connection = rpc_init_client(gui_connection_path)) == NULL) {
|
||||
fprintf(stderr, "Failed to initialize RPC client connection to the GUI\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Read preferences
|
||||
PrefsInit(vmdir, argc, argv);
|
||||
|
||||
|
@ -380,11 +360,6 @@ int main(int argc, char **argv)
|
|||
// Init system routines
|
||||
SysInit();
|
||||
|
||||
// Show preferences editor
|
||||
if (!gui_connection && !PrefsFindBool("nogui"))
|
||||
if (!PrefsEditor())
|
||||
QuitEmulator();
|
||||
|
||||
// Install the handler for SIGSEGV
|
||||
if (!sigsegv_install_handler(sigsegv_handler)) {
|
||||
sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGSEGV", strerror(errno));
|
||||
|
@ -554,12 +529,6 @@ void QuitEmulator(void)
|
|||
// Exit preferences
|
||||
PrefsExit();
|
||||
|
||||
// Notify GUI we are about to leave
|
||||
if (gui_connection) {
|
||||
if (rpc_method_invoke(gui_connection, RPC_METHOD_EXIT, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR)
|
||||
rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -709,11 +678,6 @@ static int tick_func(void *arg)
|
|||
|
||||
void ErrorAlert(const char *text)
|
||||
{
|
||||
if (gui_connection) {
|
||||
if (rpc_method_invoke(gui_connection, RPC_METHOD_ERROR_ALERT, RPC_TYPE_STRING, text, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR &&
|
||||
rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR)
|
||||
return;
|
||||
}
|
||||
printf(GetString(STR_SHELL_ERROR_PREFIX), text);
|
||||
}
|
||||
|
||||
|
@ -724,11 +688,6 @@ void ErrorAlert(const char *text)
|
|||
|
||||
void WarningAlert(const char *text)
|
||||
{
|
||||
if (gui_connection) {
|
||||
if (rpc_method_invoke(gui_connection, RPC_METHOD_WARNING_ALERT, RPC_TYPE_STRING, text, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR &&
|
||||
rpc_method_wait_for_reply(gui_connection, RPC_TYPE_INVALID) == RPC_ERROR_NO_ERROR)
|
||||
return;
|
||||
}
|
||||
printf(GetString(STR_SHELL_WARNING_PREFIX), text);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* posix_sem.cpp - POSIX.4 semaphores "emulation"
|
||||
* Copyright (C) 1999 Orlando Bassotto
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* OK, I had really big problems with SysV semaphores :/
|
||||
* I rewrote those one giving a look to the source of linuxthreads
|
||||
* with mutex. Seems to be working correctly now.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "semaphore.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
int sem_init(sem_t* sem, int pshared, unsigned int value)
|
||||
{
|
||||
if(sem==NULL||value>SEM_VALUE_MAX) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if(pshared) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
pthread_mutex_init(&sem->sem_lock, NULL);
|
||||
sem->sem_value = value;
|
||||
sem->sem_waiting = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int sem_destroy(sem_t* sem)
|
||||
{
|
||||
if(sem==NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if(sem->sem_waiting) {
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
pthread_mutex_destroy(&sem->sem_lock);
|
||||
sem->sem_waiting = 0;
|
||||
sem->sem_value = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sem_t sem_open(const char* name, int oflag, ...)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return *(sem_t*)NULL;
|
||||
}
|
||||
|
||||
int sem_close(sem_t* sem)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sem_unlink(const char* name)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sem_wait(sem_t* sem)
|
||||
{
|
||||
struct timespec req = { 1, 0 };
|
||||
|
||||
if(sem==NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
pthread_mutex_lock(&sem->sem_lock);
|
||||
sem->sem_waiting++;
|
||||
if(sem->sem_value > 0) {
|
||||
--sem->sem_value;
|
||||
return 0;
|
||||
}
|
||||
while(!sem->sem_value) nanosleep(NULL, &req);
|
||||
pthread_mutex_unlock(&sem->sem_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sem_trywait(sem_t* sem)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sem_post(sem_t* sem)
|
||||
{
|
||||
if(sem==NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if(!sem->sem_waiting) {
|
||||
if(sem->sem_value >= SEM_VALUE_MAX) {
|
||||
errno = ERANGE;
|
||||
pthread_mutex_unlock(&sem->sem_lock);
|
||||
return -1;
|
||||
}
|
||||
++sem->sem_value;
|
||||
pthread_mutex_unlock(&sem->sem_lock);
|
||||
}
|
||||
else {
|
||||
sem->sem_waiting--;
|
||||
++sem->sem_value;
|
||||
// pthread_mutex_unlock(&sem->sem_lock);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sem_getvalue(sem_t* sem, int* sval)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* rpc.h - Remote Procedure Calls
|
||||
*
|
||||
* Basilisk II (C) 1997-2008 Christian Bauer
|
||||
* Contributed by Gwenole Beauchesne
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef RPC_H
|
||||
#define RPC_H
|
||||
|
||||
// Error Types
|
||||
enum {
|
||||
RPC_ERROR_NO_ERROR = 0,
|
||||
RPC_ERROR_GENERIC = -1000,
|
||||
RPC_ERROR_ERRNO_SET = -1001,
|
||||
RPC_ERROR_NO_MEMORY = -1002,
|
||||
RPC_ERROR_CONNECTION_NULL = -1003,
|
||||
RPC_ERROR_CONNECTION_TYPE_MISMATCH = -1004,
|
||||
RPC_ERROR_MESSAGE_TRUNCATED = -1005,
|
||||
RPC_ERROR_MESSAGE_ARGUMENT_MISMATCH = -1006,
|
||||
RPC_ERROR_MESSAGE_ARGUMENT_UNKNOWN = -1007,
|
||||
};
|
||||
|
||||
// Connection Handling
|
||||
typedef struct rpc_connection_t rpc_connection_t;
|
||||
extern rpc_connection_t *rpc_init_server(const char *ident);
|
||||
extern rpc_connection_t *rpc_init_client(const char *ident);
|
||||
extern int rpc_exit(rpc_connection_t *connection);
|
||||
extern int rpc_listen_socket(rpc_connection_t *connection);
|
||||
extern int rpc_listen(rpc_connection_t *connection);
|
||||
extern int rpc_dispatch(rpc_connection_t *connection);
|
||||
extern int rpc_wait_dispatch(rpc_connection_t *connection, int timeout);
|
||||
extern int rpc_connection_busy(rpc_connection_t *connection);
|
||||
|
||||
// Message Passing
|
||||
enum {
|
||||
RPC_TYPE_INVALID = 0,
|
||||
RPC_TYPE_CHAR = -2000,
|
||||
RPC_TYPE_BOOLEAN = -2001,
|
||||
RPC_TYPE_INT32 = -2002,
|
||||
RPC_TYPE_UINT32 = -2003,
|
||||
RPC_TYPE_STRING = -2004,
|
||||
RPC_TYPE_ARRAY = -2005,
|
||||
};
|
||||
typedef struct rpc_message_t rpc_message_t;
|
||||
extern int rpc_message_send_char(rpc_message_t *message, char c);
|
||||
extern int rpc_message_send_int32(rpc_message_t *message, int32_t value);
|
||||
extern int rpc_message_send_uint32(rpc_message_t *message, uint32_t value);
|
||||
extern int rpc_message_send_string(rpc_message_t *message, const char *str);
|
||||
extern int rpc_message_send_bytes(rpc_message_t *message, unsigned char *bytes, int count);
|
||||
extern int rpc_message_recv_char(rpc_message_t *message, char *ret);
|
||||
extern int rpc_message_recv_int32(rpc_message_t *message, int32_t *ret);
|
||||
extern int rpc_message_recv_uint32(rpc_message_t *message, uint32_t *ret);
|
||||
extern int rpc_message_recv_string(rpc_message_t *message, char **ret);
|
||||
extern int rpc_message_recv_bytes(rpc_message_t *message, unsigned char *bytes, int count);
|
||||
typedef int (*rpc_message_callback_t)(rpc_message_t *message, void *p_value);
|
||||
typedef struct {
|
||||
int id;
|
||||
int size;
|
||||
rpc_message_callback_t send_callback;
|
||||
rpc_message_callback_t recv_callback;
|
||||
} rpc_message_descriptor_t;
|
||||
extern int rpc_message_add_callbacks(const rpc_message_descriptor_t *descs, int n_descs);
|
||||
|
||||
// Method Callbacks Handling
|
||||
typedef int (*rpc_method_callback_t)(rpc_connection_t *connection);
|
||||
typedef struct {
|
||||
int id;
|
||||
rpc_method_callback_t callback;
|
||||
} rpc_method_descriptor_t;
|
||||
extern int rpc_method_add_callbacks(rpc_connection_t *connection, const rpc_method_descriptor_t *descs, int n_descs);
|
||||
extern int rpc_method_remove_callback_id(rpc_connection_t *connection, int id);
|
||||
extern int rpc_method_remove_callbacks(rpc_connection_t *connection, const rpc_method_descriptor_t *descs, int n_descs);
|
||||
|
||||
// Remote Procedure Call (method invocation)
|
||||
extern int rpc_method_invoke(rpc_connection_t *connection, int method, ...);
|
||||
extern int rpc_method_wait_for_reply(rpc_connection_t *connection, ...);
|
||||
extern int rpc_method_get_args(rpc_connection_t *connection, ...);
|
||||
extern int rpc_method_send_reply(rpc_connection_t *connection, ...);
|
||||
|
||||
// Message Protocol
|
||||
enum {
|
||||
RPC_METHOD_ERROR_ALERT = 1,
|
||||
RPC_METHOD_WARNING_ALERT,
|
||||
RPC_METHOD_EXIT
|
||||
};
|
||||
|
||||
#endif /* RPC_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,44 +0,0 @@
|
|||
#ifndef __SEMAPHORE_H
|
||||
#define __SEMAPHORE_H
|
||||
|
||||
#define SEM_VALUE_MAX 64
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* c_plusplus || __cplusplus */
|
||||
|
||||
/* MacOS X doesn't implement unnamed POSIX semaphores, event though
|
||||
the libc defines them! */
|
||||
#if (defined(__MACH__) && defined(__APPLE__))
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/semaphore.h>
|
||||
|
||||
#define sem_t semaphore_t
|
||||
#define sem_init(SEM,UNUSED,VALUE) semaphore_create(current_task(), (SEM), SYNC_POLICY_FIFO, (VALUE))
|
||||
#define sem_destroy(SEM) semaphore_destroy(current_task(), *(SEM))
|
||||
#define sem_wait(SEM) semaphore_wait(*(SEM))
|
||||
#define sem_post(SEM) semaphore_signal(*(SEM))
|
||||
#else
|
||||
typedef struct psem {
|
||||
pthread_mutex_t sem_lock;
|
||||
int sem_value;
|
||||
int sem_waiting;
|
||||
} sem_t;
|
||||
|
||||
int sem_init(sem_t* sem, int pshared, unsigned int value);
|
||||
int sem_destroy(sem_t* sem);
|
||||
sem_t sem_open(const char* name, int oflag, ...);
|
||||
int sem_close(sem_t* sem);
|
||||
int sem_unlink(const char* name);
|
||||
int sem_wait(sem_t* sem);
|
||||
int sem_trywait(sem_t* sem);
|
||||
int sem_post(sem_t* sem);
|
||||
int sem_getvalue(sem_t* sem, int* sval);
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
};
|
||||
#endif /* c_plusplus || __cplusplus */
|
||||
|
||||
#endif /* __SEMAPHORE_H */
|
Loading…
Reference in New Issue
Block a user