diff --git a/pd/src/m_class.c b/pd/src/m_class.c index a9ed52ad9c48003b6d2f5d8aba198242f5288041..59043974402913503674b6dc1efaa33d94ca7da4 100644 --- a/pd/src/m_class.c +++ b/pd/src/m_class.c @@ -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 diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c index 55c464c6e6f0f8ceb87c8e74cb174b83e38b53bb..e51d64038efa9ce0fe460236ef44c80f1c45559c 100644 --- a/pd/src/m_sched.c +++ b/pd/src/m_sched.c @@ -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); diff --git a/pd/src/s_main.c b/pd/src/s_main.c index 42a2e59f12136c820c5b2391aff20594fd7ad59d..2f7650824491f43a6482674f5f6ec294086e4d3b 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -243,6 +243,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 +333,18 @@ int sys_main(int argc, char **argv) #ifdef PD_DEBUG fprintf(stderr, "Pd-L2Ork: COMPILED FOR DEBUGGING\n"); #endif + /* use Win32 "binary" mode by default since we don't want the + * translation that Win32 does by default */ +#ifdef _WIN32 +# ifdef _MSC_VER /* MS Visual Studio */ + _set_fmode( _O_BINARY ); +# else /* MinGW */ + { + extern int _fmode; + _fmode = _O_BINARY; + } +# endif /* _MSC_VER */ +#endif /* _WIN32 */ pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ for (i = noprefs = 0; i < argc; i++) /* prescan args for noprefs */ @@ -319,7 +366,10 @@ 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 */ + 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);