...
 
Commits (7)
This diff is collapsed.
......@@ -786,7 +786,7 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
ap++;
break;
case A_FLOAT:
if (!argc) goto badarg;
if (!argc) goto badarg; /* falls through */
case A_DEFFLOAT:
if (!argc) *dp = 0;
else
......@@ -814,7 +814,7 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv)
ap++;
break;
case A_SYMBOL:
if (!argc) goto badarg;
if (!argc) goto badarg; /* falls through */
case A_DEFSYM:
if (!argc) *ap = (t_int)(&s_);
else
......
......@@ -405,8 +405,6 @@ void sched_set_using_audio(int flag)
post("sorry, can't turn off callbacks yet; restart Pd");
/* not right yet! */
sys_time_per_dsp_tick = (TIMEUNITPERSECOND) *
((double)sys_schedblocksize) / sys_dacsr;
// XXXFIXME
//sys_vgui("pdtk_pd_dsp %s\n", flag ? "on" : "off");
}
......@@ -414,7 +412,8 @@ void sched_set_using_audio(int flag)
/* take the scheduler forward one DSP tick, also handling clock timeouts */
void sched_tick( void)
{
double next_sys_time = pd_this->pd_systime + sys_time_per_dsp_tick;
double next_sys_time = pd_this->pd_systime +
(sys_schedblocksize / sys_dacsr) * TIMEUNITPERSECOND;
int countdown = 5000;
while (pd_this->pd_clock_setlist &&
pd_this->pd_clock_setlist->c_settime < next_sys_time)
......@@ -459,6 +458,7 @@ int (*sys_idlehook)(void);
static void m_pollingscheduler( void)
{
int idlecount = 0;
/* delete this when I'm sure it's not needed for back compatibilty? */
sys_time_per_dsp_tick = (TIMEUNITPERSECOND) *
((double)sys_schedblocksize) / sys_dacsr;
......@@ -635,8 +635,6 @@ int m_mainloop(void)
int m_batchmain(void)
{
sys_time_per_dsp_tick = (TIMEUNITPERSECOND) *
((double)sys_schedblocksize) / sys_dacsr;
while (sys_quit != SYS_QUIT_QUIT)
sched_tick();
return (0);
......
This diff is collapsed.
......@@ -32,7 +32,9 @@ static const char pd_compiledate[] = __DATE__;
void pd_init(void);
int sys_argparse(int argc, char **argv);
void sys_findprogdir(char *progname);
void sys_setsignalhandlers(void);
int sys_startgui(const char *guipath);
void sys_setrealtime(const char *guipath);
int sys_rcfile(void);
int m_mainloop(void);
int m_batchmain(void);
......@@ -243,6 +245,41 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
sys_messagelist = 0;
}
// font char metric triples: pointsize width(pixels) height(pixels)
static int defaultfontshit[] = {
8, 5, 11, 9, 6, 12,
10, 6, 13, 12, 7, 16,
14, 8, 17, 16, 10, 19,
18, 11, 22, 24, 14, 29,
30, 18, 37, 36, 22, 44
};
#define NDEFAULTFONT (sizeof(defaultfontshit)/sizeof(*defaultfontshit))
static t_clock *sys_fakefromguiclk;
static void sys_fakefromgui(void)
{
/* fake the GUI's message giving cwd and font sizes in case
we aren't starting the gui. */
t_atom zz[NDEFAULTFONT+2];
int i;
char buf[MAXPDSTRING];
#ifdef _WIN32
if (GetCurrentDirectory(MAXPDSTRING, buf) == 0)
strcpy(buf, ".");
#else
if (!getcwd(buf, MAXPDSTRING))
strcpy(buf, ".");
#endif
SETSYMBOL(zz, gensym(buf));
for (i = 0; i < (int)NDEFAULTFONT; i++)
SETFLOAT(zz+i+1, defaultfontshit[i]);
SETFLOAT(zz+NDEFAULTFONT+1,0);
glob_initfromgui(0, 0, 2+NDEFAULTFONT, zz);
clock_free(sys_fakefromguiclk);
}
static void sys_afterargparse(void);
static void pd_makeversion(void)
......@@ -298,6 +335,34 @@ int sys_main(int argc, char **argv)
#ifdef PD_DEBUG
fprintf(stderr, "Pd-L2Ork: COMPILED FOR DEBUGGING\n");
#endif
/* We need to call WSAStartup regardless of gui mode, since a user
* might want to make socket connections even in -nogui mode. So we
* go ahead and do that here. */
#ifdef _WIN32
short version = MAKEWORD(2, 0);
WSADATA nobby;
if (WSAStartup(version, &nobby)) sys_sockerror("WSAstartup");
/* use Win32 "binary" mode by default since we don't want the
* translation that Win32 does by default */
# ifdef _MSC_VER /* MS Visual Studio */
_set_fmode( _O_BINARY );
# else /* MinGW */
{
extern int _fmode;
_fmode = _O_BINARY;
}
# endif /* _MSC_VER */
#endif /* _WIN32 */
#ifndef _WIN32
/* long ago Pd used setuid to promote itself to real-time priority.
Just in case anyone's installation script still makes it setuid, we
complain to stderr and lose setuid here. */
if (getuid() != geteuid())
{
fprintf(stderr, "warning: canceling setuid privilege\n");
setuid(getuid());
}
#endif /* _WIN32 */
pd_init(); /* start the message system */
logpost(NULL, 2, "PD_FLOATSIZE = %lu bits", sizeof(t_float)*8);
sys_findprogdir(argv[0]); /* set sys_progname, guipath */
......@@ -320,7 +385,11 @@ int sys_main(int argc, char **argv)
pd_version, pd_compiletime, pd_compiledate);
if (sys_version) /* if we were just asked our version, exit here. */
return (0);
if (sys_startgui(sys_guidir->s_name)) /* start the gui */
sys_setsignalhandlers();
if (sys_nogui)
clock_set((sys_fakefromguiclk =
clock_new(0, (t_method)sys_fakefromgui)), 0);
else if (sys_startgui(sys_guidir->s_name)) /* start the gui */
return(1);
/* send the libdir to the GUI */
gui_vmess("gui_set_lib_dir", "s", sys_libdir->s_name);
......@@ -340,6 +409,8 @@ int sys_main(int argc, char **argv)
gui_end_array();
gui_end_vmess();
if (sys_hipriority)
sys_setrealtime(sys_libdir->s_name); /* set desired process priority */
if (sys_externalschedlib)
return (sys_run_scheduler(sys_externalschedlibname,
sys_extraflagsstring));
......