From 99a63a7a0c96b302c25079105b4ac3f77bd4b141 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Thu, 24 Jan 2008 00:39:51 +0000 Subject: release 0.41-0 svn path=/trunk/; revision=9157 --- pd/src/m_pd.h | 2 +- pd/src/notes.txt | 9 ++------- pd/src/s_loader.c | 37 +++++++++++++++++++++++++++++++++++++ pd/src/s_main.c | 31 ++++++++----------------------- 4 files changed, 48 insertions(+), 31 deletions(-) (limited to 'pd/src') diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index e7417da7..f494ff52 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -11,7 +11,7 @@ extern "C" { #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 41 #define PD_BUGFIX_VERSION 0 -#define PD_TEST_VERSION "test11" +#define PD_TEST_VERSION "" /* old name for "MSW" flag -- we have to take it for the sake of many old "nmakefiles" for externs, which will define NT and not MSW */ diff --git a/pd/src/notes.txt b/pd/src/notes.txt index b00b03da..168bd184 100644 --- a/pd/src/notes.txt +++ b/pd/src/notes.txt @@ -1,11 +1,4 @@ ---------------- dolist -------------------- -fixed crash bug closing patches with open GOPs -fixed PC device counting problem (first device invoked by -audiodev 0) -fixed MSTACKSIZE limitation in m_binbuf.c -fixed so that if more than one object is selected, clicking prefers to - "hit" a selected one (better dragging after "duplicate") - - test: compile on various versions of linux windows: @@ -56,6 +49,8 @@ real-time spectrum grapher document ||, |, etc, better features: +change config.h to #ifdef _MSC_VER (include MSW fake) else include a real one +stick snprintf alias in the MSW fake. flag to prevent unlocking patches clickless connection (hit 'c' key? see Bouchard paper) messages to suppress menus&accelerators, and invisibilize Pd window diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c index 4788c13c..aac50898 100644 --- a/pd/src/s_loader.c +++ b/pd/src/s_loader.c @@ -20,6 +20,9 @@ #include "m_pd.h" #include "s_stuff.h" #include +#ifdef _MSC_VER /* This is only for Microsoft's compiler, not cygwin, e.g. */ +#define snprintf sprintf_s +#endif typedef void (*t_xxx)(void); @@ -238,3 +241,37 @@ int sys_load_lib(t_canvas *canvas, char *classname) return ok; } +int sys_run_scheduler(const char *externalschedlibname, + const char *sys_extraflagsstring) +{ + typedef int (*t_externalschedlibmain)(const char *); + t_externalschedlibmain externalmainfunc; + char filename[MAXPDSTRING]; + snprintf(filename, sizeof(filename), "%s.%s", externalschedlibname, + sys_dllextent); + sys_bashfilename(filename, filename); +#ifdef MSW + { + HINSTANCE ntdll = LoadLibrary(filename); + if (!ntdll) + { + post("%s: couldn't load external scheduler lib ", filename); + return (0); + } + externalmainfunc = + (t_externalschedlibmain)GetProcAddress(ntdll, "main"); + } +#else + { + void *dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); + if (!dlobj) + { + post("%s: %s", filename, dlerror()); + return (0); + } + externalmainfunc = (t_externalschedlibmain)dlsym(dlobj, + "pd_extern_sched"); + } +#endif + return((*externalmainfunc)(sys_extraflagsstring)); +} diff --git a/pd/src/s_main.c b/pd/src/s_main.c index d8d8602d..877ed41f 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -77,7 +77,8 @@ int sys_externalschedlib; char sys_externalschedlibname[MAXPDSTRING]; int sys_extraflags; char sys_extraflagsstring[MAXPDSTRING]; - +int sys_run_scheduler(const char *externalschedlibname, + const char *sys_extraflagsstring); /* here the "-1" counts signify that the corresponding vector hasn't been specified in command line arguments; sys_set_audio_settings will detect it @@ -168,7 +169,11 @@ int sys_fontheight(int fontsize) } int sys_defaultfont; +#ifdef MSW +#define DEFAULTFONT 12 +#else #define DEFAULTFONT 10 +#endif static void openit(const char *dirname, const char *filename) { @@ -291,28 +296,8 @@ int sys_main(int argc, char **argv) if (sys_startgui(sys_guidir->s_name)) /* start the gui */ return(1); if (sys_externalschedlib) - { -#ifdef MSW - typedef int (*t_externalschedlibmain)(char *); - t_externalschedlibmain externalmainfunc; - HINSTANCE ntdll; - char filename[MAXPDSTRING]; - - snprintf(filename, sizeof(filename), "%s.dll", sys_externalschedlibname); - sys_bashfilename(filename, filename); - ntdll = LoadLibrary(filename); - if (!ntdll) - { - post("%s: couldn't load external scheduler lib ", filename); - return (0); - } - externalmainfunc = (t_externalschedlibmain)GetProcAddress(ntdll, - "main"); - return((*externalmainfunc)(sys_extraflagsstring)); -#else - return (0); -#endif - } + return (sys_run_scheduler(sys_externalschedlibname, + sys_extraflagsstring)); else { /* open audio and MIDI */ -- cgit v1.2.1