[PD-cvs] pd/src s_inter.c, 1.5.4.10.2.25.2.13, 1.5.4.10.2.25.2.14 makefile.in, 1.4.4.2.2.21.2.23, 1.4.4.2.2.21.2.24
Mathieu Bouchard
matju at users.sourceforge.net
Thu Jun 28 06:08:18 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv604
Modified Files:
Tag: desiredata
s_inter.c makefile.in
Log Message:
cleanup and switch to C++
Index: makefile.in
===================================================================
RCS file: /cvsroot/pure-data/pd/src/makefile.in,v
retrieving revision 1.4.4.2.2.21.2.23
retrieving revision 1.4.4.2.2.21.2.24
diff -C2 -d -r1.4.4.2.2.21.2.23 -r1.4.4.2.2.21.2.24
*** makefile.in 16 Jan 2007 00:27:17 -0000 1.4.4.2.2.21.2.23
--- makefile.in 28 Jun 2007 04:08:16 -0000 1.4.4.2.2.21.2.24
***************
*** 21,27 ****
CFLAGS += -DINSTALL_PREFIX=\"$(prefix)\"
! SRCXX = desire.c kernel.c builtins.c builtins_dsp.c s_path.c
SRC = m_fifo.c m_simd.c \
! m_sched.c s_main.c s_inter.c s_loader.c s_audio.c s_midi.c \
d_ugen.c d_mayer_fft.c d_fftroutine.c d_resample.c d_soundfile.c
--- 21,27 ----
CFLAGS += -DINSTALL_PREFIX=\"$(prefix)\"
! SRCXX = desire.c kernel.c builtins.c builtins_dsp.c s_path.c s_inter.c
SRC = m_fifo.c m_simd.c \
! m_sched.c s_main.c s_loader.c s_audio.c s_midi.c \
d_ugen.c d_mayer_fft.c d_fftroutine.c d_resample.c d_soundfile.c
Index: s_inter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v
retrieving revision 1.5.4.10.2.25.2.13
retrieving revision 1.5.4.10.2.25.2.14
diff -C2 -d -r1.5.4.10.2.25.2.13 -r1.5.4.10.2.25.2.14
*** s_inter.c 9 Jan 2007 18:14:28 -0000 1.5.4.10.2.25.2.13
--- s_inter.c 28 Jun 2007 04:08:15 -0000 1.5.4.10.2.25.2.14
***************
*** 74,89 ****
#endif
! typedef struct _fdpoll
! {
int fdp_fd;
t_fdpollfn fdp_fn;
void *fdp_ptr;
! } t_fdpoll;
#define INBUFSIZE 4096
- extern char pd_version[];
extern int sys_guisetportnumber;
-
static int sys_nfdpoll;
static t_fdpoll *sys_fdpoll;
--- 74,86 ----
#endif
! struct t_fdpoll {
int fdp_fd;
t_fdpollfn fdp_fn;
void *fdp_ptr;
! };
#define INBUFSIZE 4096
extern int sys_guisetportnumber;
static int sys_nfdpoll;
static t_fdpoll *sys_fdpoll;
***************
*** 100,110 ****
static double nt_freq = 0;
! static void sys_initntclock(void)
! {
LARGE_INTEGER f1;
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
! if (!QueryPerformanceFrequency(&f1))
! {
fprintf(stderr, "pd: QueryPerformanceFrequency failed\n");
f1.QuadPart = 1;
--- 97,105 ----
static double nt_freq = 0;
! static void sys_initntclock() {
LARGE_INTEGER f1;
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
! if (!QueryPerformanceFrequency(&f1)) {
fprintf(stderr, "pd: QueryPerformanceFrequency failed\n");
f1.QuadPart = 1;
***************
*** 115,124 ****
#if 0
! /* this is a version you can call if you did the QueryPerformanceCounter
! call yourself. Necessary for time tagging incoming MIDI at interrupt
! level, for instance; but we're not doing that just now. */
! double nt_tixtotime(LARGE_INTEGER *dumbass)
! {
if (nt_freq == 0) sys_initntclock();
return (((double)(dumbass->QuadPart - nt_inittime.QuadPart)) / nt_freq);
--- 110,118 ----
#if 0
! /* this is a version you can call if you did the QueryPerformanceCounter
! call yourself. Necessary for time tagging incoming MIDI at interrupt
! level, for instance; but we're not doing that just now. */
! double nt_tixtotime(LARGE_INTEGER *dumbass) {
if (nt_freq == 0) sys_initntclock();
return (((double)(dumbass->QuadPart - nt_inittime.QuadPart)) / nt_freq);
***************
*** 129,134 ****
/* get "real time" in seconds; take the
first time we get called as a reference time of zero. */
! double sys_getrealtime(void)
! {
#ifndef _WIN32
static struct timeval then;
--- 123,127 ----
/* get "real time" in seconds; take the
first time we get called as a reference time of zero. */
! double sys_getrealtime() {
#ifndef _WIN32
static struct timeval then;
***************
*** 136,141 ****
gettimeofday(&now, 0);
if (then.tv_sec == 0 && then.tv_usec == 0) then = now;
! return ((now.tv_sec - then.tv_sec) +
! (1./1000000.) * (now.tv_usec - then.tv_usec));
#else
LARGE_INTEGER now;
--- 129,133 ----
gettimeofday(&now, 0);
if (then.tv_sec == 0 && then.tv_usec == 0) then = now;
! return ((now.tv_sec - then.tv_sec) + (1./1000000.) * (now.tv_usec - then.tv_usec));
#else
LARGE_INTEGER now;
***************
*** 146,150 ****
}
! int sys_pollsockets (void) {
struct timeval timout;
int didsomething = 0;
--- 138,142 ----
}
! int sys_pollsockets () {
struct timeval timout;
int didsomething = 0;
***************
*** 154,169 ****
timout.tv_sec = 0;
timout.tv_usec = 0;
! FD_ZERO(&writeset);
! FD_ZERO(&readset);
! FD_ZERO(&exceptset);
! for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++) FD_SET(fp->fdp_fd, &readset);
! select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout);
! for (i = 0; i < sys_nfdpoll; i++)
! if (FD_ISSET(sys_fdpoll[i].fdp_fd, &readset))
! {
! sys_fdpoll[i].fdp_fn(sys_fdpoll[i].fdp_ptr, sys_fdpoll[i].fdp_fd);
! didsomething = 1;
! }
! return didsomething;
}
--- 146,159 ----
timout.tv_sec = 0;
timout.tv_usec = 0;
! FD_ZERO(&writeset);
! FD_ZERO(&readset);
! FD_ZERO(&exceptset);
! for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++) FD_SET(fp->fdp_fd, &readset);
! select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout);
! for (i = 0; i < sys_nfdpoll; i++) if (FD_ISSET(sys_fdpoll[i].fdp_fd, &readset)) {
! sys_fdpoll[i].fdp_fn(sys_fdpoll[i].fdp_ptr, sys_fdpoll[i].fdp_fd);
! didsomething = 1;
! }
! return didsomething;
}
***************
*** 205,210 ****
typedef void (*sighandler_t)(int);
! static void sys_signal(int signo, sighandler_t sigfun)
! {
struct sigaction action;
action.sa_flags = 0;
--- 195,199 ----
typedef void (*sighandler_t)(int);
! static void sys_signal(int signo, sighandler_t sigfun) {
struct sigaction action;
action.sa_flags = 0;
***************
*** 219,243 ****
}
! static void sys_exithandler(int n)
! {
static int trouble = 0;
! if (!trouble)
! {
trouble = 1;
fprintf(stderr, "Pd: signal %d\n", n);
sys_bail(1);
! }
! else
! sys_bail(0);
}
! static void sys_alarmhandler(int n)
! {
fprintf(stderr, "Pd: system call timed out\n");
}
/* what is this for?? */
! static void sys_huphandler(int n)
! {
struct timeval timout;
timout.tv_sec = 0;
--- 208,226 ----
}
! static void sys_exithandler(int n) {
static int trouble = 0;
! if (!trouble) {
trouble = 1;
fprintf(stderr, "Pd: signal %d\n", n);
sys_bail(1);
! } else sys_bail(0);
}
! static void sys_alarmhandler(int n) {
fprintf(stderr, "Pd: system call timed out\n");
}
/* what is this for?? */
! static void sys_huphandler(int n) {
struct timeval timout;
timout.tv_sec = 0;
***************
*** 246,251 ****
}
! void sys_setalarm(int microsec)
! {
struct itimerval gonzo;
#if 0
--- 229,233 ----
}
! void sys_setalarm(int microsec) {
struct itimerval gonzo;
#if 0
***************
*** 458,462 ****
}
! void sys_exit(void);
void socketreceiver_read(t_socketreceiver *x, int fd) {
--- 440,444 ----
}
! void sys_exit();
void socketreceiver_read(t_socketreceiver *x, int fd) {
***************
*** 567,573 ****
}
! void glob_ping(t_pd *dummy) {t_socketreceiver *self = sys_socketreceiver; self->waitingforping = 0;}
! int sys_pollgui(void) {
if (sys_socketreceiver) sys_flushtogui(sys_socketreceiver);
return sys_pollsockets();
--- 549,555 ----
}
! extern "C" void glob_ping(t_pd *dummy) {t_socketreceiver *self = sys_socketreceiver; self->waitingforping = 0;}
! int sys_pollgui() {
if (sys_socketreceiver) sys_flushtogui(sys_socketreceiver);
return sys_pollsockets();
***************
*** 577,585 ****
#ifdef __linux__
! void glob_watchdog(t_pd *dummy)
{
#ifndef WATCHDOGTHREAD
! if (write(sys_watchfd, "\n", 1) < 1)
! {
fprintf(stderr, "pd: watchdog process died\n");
sys_bail(1);
--- 559,566 ----
#ifdef __linux__
! extern "C" void glob_watchdog(t_pd *dummy)
{
#ifndef WATCHDOGTHREAD
! if (write(sys_watchfd, "\n", 1) < 1) {
fprintf(stderr, "pd: watchdog process died\n");
sys_bail(1);
***************
*** 589,593 ****
#endif
! static void sys_setsignals(void) {
#ifdef UNISTD
signal(SIGHUP, sys_huphandler);
--- 570,574 ----
#endif
! static void sys_setsignals() {
#ifdef UNISTD
signal(SIGHUP, sys_huphandler);
***************
*** 608,617 ****
//t_pd *pd_new3(const char *s);
! void *netreceive_new(t_symbol *compatflag, t_floatarg fportno, t_floatarg udpflag);
! static int sys_start_watchdog_thread(void);
! static void sys_setpriority(void);
extern t_text *manager;
! int sys_startgui(void) {
#ifdef _WIN32
short version = MAKEWORD(2, 0);
--- 589,598 ----
//t_pd *pd_new3(const char *s);
! extern "C" t_text *netreceive_new(t_symbol *compatflag, t_floatarg fportno, t_floatarg udpflag);
! static int sys_start_watchdog_thread();
! static void sys_setpriority();
extern t_text *manager;
! extern "C" int sys_startgui() {
#ifdef _WIN32
short version = MAKEWORD(2, 0);
***************
*** 654,658 ****
GUI, the watchdog pinging is done from the scheduler idle routine in this
process instead.) */
! void sys_setpriority(void) {
#if defined(__linux__) || defined(IRIX)
#ifndef WATCHDOGTHREAD
--- 635,639 ----
GUI, the watchdog pinging is done from the scheduler idle routine in this
process instead.) */
! void sys_setpriority() {
#if defined(__linux__) || defined(IRIX)
#ifndef WATCHDOGTHREAD
***************
*** 708,719 ****
}
#endif /* __APPLE__ */
!
! if (!sys_nogui)
! {
/* here is where we start the pinging. */
#if defined(__linux__) || defined(IRIX)
#ifndef WATCHDOGTHREAD
! if (sys_hipriority)
! sys_gui("pdtk_watchdog\n");
#endif
#endif
--- 689,697 ----
}
#endif /* __APPLE__ */
! if (!sys_nogui) {
/* here is where we start the pinging. */
#if defined(__linux__) || defined(IRIX)
#ifndef WATCHDOGTHREAD
! if (sys_hipriority) sys_gui("pdtk_watchdog\n");
#endif
#endif
***************
*** 724,732 ****
Call glob_quit() below to exit cleanly.
LATER try to save dirty documents even in the bad case. */
! void sys_bail(int n)
! {
static int reentered = 0;
! if (!reentered)
! {
reentered = 1;
fprintf(stderr, "closing audio...\n");
--- 702,708 ----
Call glob_quit() below to exit cleanly.
LATER try to save dirty documents even in the bad case. */
! void sys_bail(int n) {
static int reentered = 0;
! if (!reentered) {
reentered = 1;
fprintf(stderr, "closing audio...\n");
***************
*** 736,744 ****
fprintf(stderr, "... done.\n");
exit(n);
! }
! else _exit(1);
}
! void glob_closeall(void *dummy, t_floatarg fforce);
void glob_quit(void *dummy) {
--- 712,719 ----
fprintf(stderr, "... done.\n");
exit(n);
! } else _exit(1);
}
! extern "C" void glob_closeall(void *dummy, t_floatarg fforce);
void glob_quit(void *dummy) {
***************
*** 751,759 ****
static pthread_mutex_t watchdog_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t watchdog_cond = PTHREAD_COND_INITIALIZER;
-
static void *watchdog_thread(void *);
/* start a high priority watchdog thread */
! static int sys_start_watchdog_thread(void) {
pthread_attr_t w_attr;
int status;
--- 726,733 ----
static pthread_mutex_t watchdog_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t watchdog_cond = PTHREAD_COND_INITIALIZER;
static void *watchdog_thread(void *);
/* start a high priority watchdog thread */
! static int sys_start_watchdog_thread() {
pthread_attr_t w_attr;
int status;
***************
*** 765,777 ****
}
-
-
#ifdef MSW
int gettimeofday (struct timeval *tv, void* tz);
#endif
!
! static t_int* watchdog_callback(t_int* dummy)
! {
/* signal the condition */
pthread_cond_signal(&watchdog_cond);
--- 739,747 ----
}
#ifdef MSW
int gettimeofday (struct timeval *tv, void* tz);
#endif
! static t_int* watchdog_callback(t_int* dummy) {
/* signal the condition */
pthread_cond_signal(&watchdog_cond);
***************
*** 785,792 ****
*/
! static void * watchdog_thread(void* dummy) {
sys_set_priority(1);
post("watchdog thread started");
! sys_microsleep(6e7); /* start polling after 60 seconds ... hoping that everything is set up */
post("watchdog thread active");
while (1) {
--- 755,762 ----
*/
! static void *watchdog_thread(void* dummy) {
sys_set_priority(1);
post("watchdog thread started");
! sys_microsleep(60*1000*1000); /* wait 60 seconds ... hoping that everything is set up */
post("watchdog thread active");
while (1) {
***************
*** 805,809 ****
#endif
}
! sys_microsleep(1.5e7); /* and sleep for another 15 seconds */
}
return 0; /* avoid warning */
--- 775,779 ----
#endif
}
! sys_microsleep(15*1000*1000); /* and sleep for another 15 seconds */
}
return 0; /* avoid warning */
More information about the Pd-cvs
mailing list