aboutsummaryrefslogtreecommitdiff
path: root/pd
diff options
context:
space:
mode:
Diffstat (limited to 'pd')
-rw-r--r--pd/extra/bonk~/bonk~.c4
-rw-r--r--pd/portaudio/pa_win_wdmks/pa_win_wdmks.c2
-rw-r--r--pd/portmidi/pm_mac/pmmacosxcm.c2
-rw-r--r--pd/src/configure.in31
-rw-r--r--pd/src/d_array.c4
-rw-r--r--pd/src/d_mayer_fft.c3
-rw-r--r--pd/src/d_osc.c8
-rw-r--r--pd/src/d_soundfile.c5
-rw-r--r--pd/src/g_canvas.c2
-rw-r--r--pd/src/g_editor.c4
-rw-r--r--pd/src/g_text.c2
-rw-r--r--pd/src/m_class.c42
-rw-r--r--pd/src/m_pd.h5
-rw-r--r--pd/src/makefile.in92
-rw-r--r--pd/src/notes.txt8
-rw-r--r--pd/src/s_file.c4
-rw-r--r--pd/src/s_inter.c10
-rw-r--r--pd/src/s_loader.c79
-rw-r--r--pd/src/s_main.c2
-rw-r--r--pd/src/s_path.c2
-rw-r--r--pd/src/s_stuff.h4
-rw-r--r--pd/src/t_main.c4
-rw-r--r--pd/src/t_tkcmd.c10
-rw-r--r--pd/src/u_main.tk114
-rw-r--r--pd/src/x_arithmetic.c2
-rw-r--r--pd/src/x_midi.c2
-rw-r--r--pd/src/x_misc.c2
27 files changed, 309 insertions, 140 deletions
diff --git a/pd/extra/bonk~/bonk~.c b/pd/extra/bonk~/bonk~.c
index 209ddbcc..e4c34b44 100644
--- a/pd/extra/bonk~/bonk~.c
+++ b/pd/extra/bonk~/bonk~.c
@@ -950,8 +950,8 @@ static void *bonk_new(t_floatarg fperiod, t_floatarg fnsig)
void bonk_tilde_setup(void)
{
- bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new, 0,
- sizeof(t_bonk), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new,
+ (t_method)bonk_free, sizeof(t_bonk), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
class_addbang(bonk_class, bonk_bang);
diff --git a/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c b/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c
index 736cba99..be7d8a7a 100644
--- a/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c
+++ b/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c
@@ -1,5 +1,5 @@
/*
- * $Id: pa_win_wdmks.c,v 1.2 2005-12-31 02:56:03 millerpuckette Exp $
+ * $Id: pa_win_wdmks.c,v 1.3 2005-12-31 20:55:25 millerpuckette Exp $
* PortAudio Windows WDM-KS interface
*
* Author: Andrew Baldwin
diff --git a/pd/portmidi/pm_mac/pmmacosxcm.c b/pd/portmidi/pm_mac/pmmacosxcm.c
index d62391f0..e0555fe5 100644
--- a/pd/portmidi/pm_mac/pmmacosxcm.c
+++ b/pd/portmidi/pm_mac/pmmacosxcm.c
@@ -5,7 +5,7 @@
* and subsequent work by Andrew Zeldis and Zico Kolter
* and Roger B. Dannenberg
*
- * $Id: pmmacosxcm.c,v 1.2 2005-12-31 02:56:03 millerpuckette Exp $
+ * $Id: pmmacosxcm.c,v 1.3 2005-12-31 20:55:25 millerpuckette Exp $
*/
/* Notes:
diff --git a/pd/src/configure.in b/pd/src/configure.in
index eab771d9..5e43a990 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -260,7 +260,7 @@ then
-framework AudioUnit -framework AudioToolbox \
-framework Carbon -framework CoreMIDI"
EXT=pd_darwin
- MORECFLAGS="-DMACOSX -DUNISTD -I/usr/X11R6/include \
+ MORECFLAGS="-DDL_OPEN -DMACOSX -DUNISTD -I/usr/X11R6/include \
-I../portaudio/pa_common -I../portaudio/pablio \
-I../portmidi/pm_common -I../portmidi/pm_mac \
-I../portmidi/porttime \
@@ -316,11 +316,11 @@ then
EXTERNTARGET=pd_darwin
if test x$jack == "xyes";
then
- LDFLAGS=$LDFLAGS" -framework Jack"
+ LDFLAGS=$LDFLAGS" -weak_framework Jack"
fi
if test x$jack == "xrun";
then
- LDFLAGS=$LDFLAGS" -framework Jack"
+ LDFLAGS=$LDFLAGS" -weak_framework Jack"
fi
fi
@@ -349,5 +349,30 @@ then
MORECFLAGS=$MORECFLAGS" -g3 -D__COMPAQC__ -arch host"
fi
+## JMZ{
+## this does not do very much, but i guess it is a good idea to use it...
+AC_SYS_LARGEFILE
+## test, whether we can use _LARGEFILE64_SOURCE to
+## enable large-file reading via "open64" (and lseek64");
+if test "x$enable_largefile" != "xno"; then
+## the following should run on autoconf>2.54 (which pd is not using)
+dnl AC_LINK_IFELSE ( [AC_LANG_PROGRAM([[
+dnl #define _LARGEFILE64_SOURCE
+dnl #include <sys/types.h>
+dnl #include <sys/stat.h>
+dnl #include <fcntl.h>
+dnl ]],[[ open64(0,0); ]])],
+dnl [ MORECFLAGS=$MORECFLAGS" -D_LARGEFILE64_SOURCE" ], )
+## and this is for autoconf<2.50
+AC_TRY_LINK( [
+ #define _LARGEFILE64_SOURCE
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ ],[ open64(0,0); ],
+ [ MORECFLAGS=$MORECFLAGS" -D_LARGEFILE64_SOURCE" ], )
+fi
+## }JMZ: end of large-file support section
+
AC_OUTPUT(makefile)
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index d9f9d280..6cfea1fc 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -540,12 +540,12 @@ static void tabread4_tilde_setup(void)
#define int32 int32_t
#else
-#ifdef MACOSX
+#ifdef __APPLE__
#define HIOFFSET 0 /* word offset to find MSB */
#define LOWOFFSET 1 /* word offset to find LSB */
#define int32 int /* a data type that has 32 bits */
-#endif /* MACOSX */
+#endif /* __APPLE__ */
#endif /* __linux__ */
#endif /* MSW */
#endif /* SGI */
diff --git a/pd/src/d_mayer_fft.c b/pd/src/d_mayer_fft.c
index da77e048..860b3120 100644
--- a/pd/src/d_mayer_fft.c
+++ b/pd/src/d_mayer_fft.c
@@ -48,7 +48,8 @@
* of work. -msp
*/
-#ifdef MSW
+/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
+#ifdef _MSC_VER
#pragma warning( disable : 4305 ) /* uncast const double to float */
#pragma warning( disable : 4244 ) /* uncast double to float */
#pragma warning( disable : 4101 ) /* unused local variables */
diff --git a/pd/src/d_osc.c b/pd/src/d_osc.c
index 0d485513..58533165 100644
--- a/pd/src/d_osc.c
+++ b/pd/src/d_osc.c
@@ -26,11 +26,11 @@
#define int32 long
#endif
-#if defined(__FreeBSD__) || defined(MACOSX)
+#if defined(__FreeBSD__) || defined(__APPLE__)
#include <machine/endian.h>
#endif
-#ifdef MACOSX
+#ifdef __APPLE__
#define __BYTE_ORDER BYTE_ORDER
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
@@ -39,7 +39,7 @@
#include <endian.h>
#endif
-#if defined(__unix__) || defined(MACOSX)
+#if defined(__unix__) || defined(__APPLE__)
#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)
#error No byte order defined
#endif
@@ -53,7 +53,7 @@
#endif /* __BYTE_ORDER */
#include <sys/types.h>
#define int32 int32_t
-#endif /* __unix__ or MACOSX*/
+#endif /* __unix__ or __APPLE__*/
union tabfudge
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index 9b51c10f..f0216126 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -27,6 +27,11 @@ objects use Posix-like threads. */
#define MAXSFCHANS 64
+#ifdef _LARGEFILE64_SOURCE
+# define open open64
+# define lseek lseek64
+#endif
+
/***************** soundfile header structures ************************/
typedef unsigned short uint16;
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index dd8e6467..15acc44b 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -26,7 +26,7 @@ struct _canvasenvironment
#define GLIST_DEFCANVASWIDTH 450
#define GLIST_DEFCANVASHEIGHT 300
-#ifdef MACOSX
+#ifdef __APPLE__
#define GLIST_DEFCANVASYLOC 22
#else
#define GLIST_DEFCANVASYLOC 0
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 51372da9..0db0c140 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -1029,7 +1029,7 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
/* on one-button-mouse machines, you can use double click to
mean right click (which gets the popup menu.) Do this for Mac. */
-#ifdef MACOSX
+#ifdef __APPLE__
#define SIMULATERIGHTCLICK
#endif
@@ -1492,7 +1492,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
keyupsym = gensym("#keyup");
keynamesym = gensym("#keyname");
}
-#ifdef MACOSX
+#ifdef __APPLE__
if (keynum == 30)
keynum = 0, gotkeysym = gensym("Up");
else if (keynum == 31)
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 06237319..5b3172b1 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -1133,7 +1133,7 @@ static t_widgetbehavior gatom_widgetbehavior =
/* -------------------- the "text" class ------------ */
-#ifdef MACOSX
+#ifdef __APPLE__
#define EXTRAPIX 2
#else
#define EXTRAPIX 1
diff --git a/pd/src/m_class.c b/pd/src/m_class.c
index d2489b44..30aeb310 100644
--- a/pd/src/m_class.c
+++ b/pd/src/m_class.c
@@ -16,6 +16,7 @@
#include <stdarg.h>
#include <string.h>
+#include <stdio.h>
static t_symbol *class_loadsym; /* name under which an extern is invoked */
static void pd_defaultfloat(t_pd *x, t_float f);
@@ -513,6 +514,42 @@ extern t_pd *newest;
t_symbol* pathsearch(t_symbol *s,char* ext);
int pd_setloadingabstraction(t_symbol *sym);
+
+/* replace everything but [a-zA-Z0-9_] by "0x%x" */
+static char*alternative_classname(char*classname)
+{
+ char *altname=(char*)getbytes(sizeof(char)*MAXPDSTRING);
+ int count=0;
+ int i=0;
+ for(i=0; i<MAXPDSTRING; i++)
+ altname[i]=0;
+ i=0;
+ while(*classname)
+ {
+ char c=*classname;
+ if((c>=48 && c<=57)|| /* [0-9] */
+ (c>=65 && c<=90)|| /* [A-Z] */
+ (c>=97 && c<=122)||/* [a-z] */
+ (c==95)) /* [_] */
+ {
+ altname[i]=c;
+ i++;
+ }
+ else /* a "bad" character */
+ {
+ sprintf(altname+i, "0x%02x", c);
+ i+=4;
+ count++;
+ }
+ classname++;
+ }
+ if(count>0)return altname;
+ /* seems like the given classname is fine as can be */
+ freebytes(altname, sizeof(char)*MAXPDSTRING);
+ return 0;
+}
+
+
/* this routine is called when a new "object" is requested whose class Pd
doesn't know. Pd tries to load it as an extern, then as an abstraction. */
void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv)
@@ -521,10 +558,11 @@ void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv)
t_symbol *dir = canvas_getcurrentdir();
int fd;
char dirbuf[MAXPDSTRING], *nameptr;
+ char *altname=alternative_classname(s->s_name);
if (tryingalready) return;
newest = 0;
class_loadsym = s;
- if (sys_load_lib(dir->s_name, s->s_name))
+ if (sys_load_lib(dir->s_name, s->s_name, altname))
{
tryingalready = 1;
typedmess(dummy, s, argc, argv);
@@ -535,6 +573,8 @@ void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv)
current = s__X.s_thing;
if ((fd = open_via_path(dir->s_name, s->s_name, ".pd",
dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
+ (altname && (fd = open_via_path(dir->s_name, altname, ".pd",
+ dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) ||
(fd = open_via_path(dir->s_name, s->s_name, ".pat",
dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
{
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index 41e0ffae..9ad00c5d 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -17,12 +17,13 @@ extern "C" {
#define MSW
#endif
-#ifdef MSW
+/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
+#ifdef _MSC_VER
/* #pragma warning( disable : 4091 ) */
#pragma warning( disable : 4305 ) /* uncast const double to float */
#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */
#pragma warning( disable : 4101 ) /* unused automatic variables */
-#endif /* MSW */
+#endif /* _MSC_VER */
/* the external storage class is "extern" in UNIX; in MSW it's ugly. */
#ifdef MSW
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index c4a1987e..b28b844a 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -5,10 +5,20 @@ PDEXEC = $(BIN_DIR)/pd
EXT= @EXT@
GUINAME= @GUINAME@
-INSTALL_PREFIX = @prefix@
-GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+includedir = @includedir@
+libdir = @libdir@
+mandir = @mandir@
-MANDIR = @mandir@
+GFLAGS = -DINSTALL_PREFIX=\"$(prefix)\"
+
+# varibles to match packages/Makefile.buildlayout so that they can be easily
+# overridden when building Pd-extended builds. <hans@at.or.at>
+libpddir = $(libdir)/pd
+pddocdir = $(libpddir)/doc
+libpdbindir = $(libpddir)/bin
MORECFLAGS = @MORECFLAGS@
@@ -118,30 +128,39 @@ externs:
cd ../extra/lrshift~;make @EXTERNTARGET@
cd ../extra/pique;make @EXTERNTARGET@
-INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
-MANINSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)/$(MANDIR)
BINARYMODE=@binarymode@
install: all
- install -d $(INSTDIR)/lib/pd/bin
- install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME)
- install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog
- install -m644 $(BIN_DIR)/pd.tk $(INSTDIR)/lib/pd/bin/pd.tk
- install -d $(INSTDIR)/bin
- install $(BINARYMODE) $(PDEXEC) $(INSTDIR)/bin/pd
- install -m755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
- install -m755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive
- cp -pr ../doc ../extra $(INSTDIR)/lib/pd/
- rm -f $(INSTDIR)/extra/*/*.o
- install -d $(INSTDIR)/include
- install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
- install -d $(MANINSTDIR)/man1
- gzip < ../man/pd.1 > $(MANINSTDIR)/man1/pd.1.gz
- chmod 644 $(MANINSTDIR)/man1/pd.1.gz
- gzip < ../man/pdsend.1 > $(MANINSTDIR)/man1/pdsend.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz
- gzip < ../man/pdreceive.1 > $(MANINSTDIR)/man1/pdreceive.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz
+ install -d $(libpdbindir)
+ install $(BIN_DIR)/$(GUINAME) $(libpdbindir)/$(GUINAME)
+ install $(BIN_DIR)/pd-watchdog $(libpdbindir)/pd-watchdog
+ install -m644 $(BIN_DIR)/pd.tk $(libpdbindir)/pd.tk
+ install -d $(DESTDIR)$(bindir)
+ install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/pd
+ install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend
+ install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive
+ for dir in $(shell ls -1 ../doc | grep -v CVS); do \
+ echo "installing $$dir"; \
+ install -d $(pddocdir)/$$dir ; \
+ install -p ../doc/$$dir/*.* $(pddocdir)/$$dir ; \
+ done
+ for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \
+ echo "installing 7.stuff/$$dir"; \
+ install -d $(pddocdir)/7.stuff/$$dir ; \
+ install -p ../doc/7.stuff/$$dir/*.* $(pddocdir)/7.stuff/$$dir ; \
+ done
+ cp -pr ../extra $(libpddir)/
+ rm -f $(libpddir)/extra/*/*.o
+ install -d $(DESTDIR)$(includedir)
+ install -m644 m_pd.h $(DESTDIR)$(includedir)/m_pd.h
+ install -d $(DESTDIR)$(mandir)/man1
+ gzip < ../man/pd.1 > $(DESTDIR)$(mandir)/man1/pd.1.gz
+ chmod 644 $(DESTDIR)$(mandir)/man1/pd.1.gz
+ gzip < ../man/pdsend.1 > $(DESTDIR)$(mandir)/man1/pdsend.1.gz
+ chmod 644 $(DESTDIR)$(mandir)/man1/pdsend.1.gz
+ gzip < ../man/pdreceive.1 > $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
+ chmod 644 $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
+ @echo "Pd install succeeded."
local-clean:
-rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
@@ -160,11 +179,10 @@ extra-clean:
clean: extra-clean local-clean
distclean: clean
- rm -rf config.cache config.log config.status makefile tags \
- autom4te-*.cache
- echo all: > makefile
- echo -e "\t./configure" >> makefile
- echo -e "\tmake" >> makefile
+ -rm -f config.cache config.log config.status makefile configure tags \
+ autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
+ -rmdir autom4te.cache
+ -rm -rf autom4te-*.cache
tags: $(SRC) $(GSRC); ctags *.[ch]
@@ -174,14 +192,14 @@ makefile.dependencies: makefile
$(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
uninstall:
- rm -f -r $(INSTDIR)/lib/pd
- rm -f $(INSTDIR)/bin/pd
- rm -f $(INSTDIR)/bin/pdsend
- rm -f $(INSTDIR)/bin/pdreceive
- rm -f $(INSTDIR)/include/m_pd.h
- rm -f $(MANINSTDIR)/man1/pd.1.gz
- rm -f $(MANINSTDIR)/man1/pdsend.1.gz
- rm -f $(MANINSTDIR)/man1/pdreceive.1.gz
+ rm -f -r $(libpddir)
+ rm -f $(DESTDIR)$(bindir)/pd
+ rm -f $(DESTDIR)$(bindir)/pdsend
+ rm -f $(DESTDIR)$(bindir)/pdreceive
+ rm -f $(DESTDIR)$(includedir)/m_pd.h
+ rm -f $(DESTDIR)$(mandir)/man1/pd.1.gz
+ rm -f $(DESTDIR)$(mandir)/man1/pdsend.1.gz
+ rm -f $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
include makefile.dependencies
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 3e02b0bf..034849a5 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -6,7 +6,7 @@ windows:
modal dialogs confuse watchdog
check the right-click-on-empty-canvas
MIDI I/O (inc. sysex)
-
+what does OSX do when jack is compiled into Pd but not installed??
doc:
object list
@@ -43,7 +43,7 @@ check if _vsnprintf with zero argument in windows works any better...
detect adc~ and dac~ reblocking
features:
-hook for table mousing
+.dll to .msw32 or .pd_msw (then offer .pd_msw64, .pd_lnx64, etc.)
integrate video into tilde objects
flag to suppress printing array name above graph
flag to suppress scrollbars in canvases
@@ -76,8 +76,12 @@ editing:
highlight connections (and I/Os) on mouse motion
select line and hit "insert" to interpolate an object
option-drag an outlet to make a new, connected object
+ (also, a way to make multiple connections?)
data:
+hook for table mousing
+data to save as succession of "list" messages that textfile can store, etc.
+implement list field (GOP or subwindow, perhaps GOP could suppress bounds rect?)
fix blue selection rectangle to update if selected datum is redrawn
data copy/paste doesn't check templates aren't changed
arrays of non-existent templates crash
diff --git a/pd/src/s_file.c b/pd/src/s_file.c
index 8e72b4db..e954eb5d 100644
--- a/pd/src/s_file.c
+++ b/pd/src/s_file.c
@@ -205,7 +205,7 @@ static void sys_donesavepreferences( void)
#endif /* MSW */
-#ifdef MACOSX
+#ifdef __APPLE__
static void sys_initloadpreferences( void)
{
@@ -255,7 +255,7 @@ static void sys_donesavepreferences( void)
{
}
-#endif /* MACOSX */
+#endif /* __APPLE__ */
void sys_loadpreferences( void)
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 66f59a24..90623df6 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -40,7 +40,7 @@ typedef int socklen_t;
#include <string.h>
#include <stdio.h>
-#ifdef MACOSX
+#ifdef __APPLE__
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>
@@ -1018,7 +1018,7 @@ int sys_startgui(const char *guidir)
else if (!childpid) /* we're the child */
{
seteuid(getuid()); /* lose setuid priveliges */
-#ifndef MACOSX
+#ifndef __APPLE__
/* the wish process in Unix will make a wish shell and
read/write standard in and out unless we close the
file descriptors. Somehow this doesn't make the MAC OSX
@@ -1037,7 +1037,7 @@ int sys_startgui(const char *guidir)
#endif
if (!sys_guicmd)
{
-#ifdef MACOSX
+#ifdef __APPLE__
char *homedir = getenv("HOME"), filename[250];
struct stat statbuf;
/* first look for Wish bundled with and renamed "Pd" */
@@ -1202,7 +1202,7 @@ int sys_startgui(const char *guidir)
if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
fprintf(stderr, "pd: couldn't set high priority class\n");
#endif
-#ifdef MACOSX
+#ifdef __APPLE__
if (sys_hipriority)
{
struct sched_param param;
@@ -1214,7 +1214,7 @@ int sys_startgui(const char *guidir)
if (err)
post("warning: high priority scheduling failed\n");
}
-#endif /* MACOSX */
+#endif /* __APPLE__ */
if (!sys_nogui && !sys_guisetportnumber)
{
diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c
index 2cb03d54..89646a48 100644
--- a/pd/src/s_loader.c
+++ b/pd/src/s_loader.c
@@ -46,10 +46,11 @@ static char sys_dllextent[] =
void class_set_extern_dir(t_symbol *s);
-int sys_load_lib(char *dirname, char *classname)
+static int sys_load_lib_alt(char *dirname, char *classname, char *altname)
{
char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
- classname2[MAXPDSTRING], *nameptr, *lastdot;
+ classname2[MAXPDSTRING], *nameptr, *lastdot,
+ altsymname[MAXPDSTRING];
void *dlobj;
t_xxx makeout = NULL;
int fd;
@@ -72,6 +73,25 @@ int sys_load_lib(char *dirname, char *classname)
if ((fd = open_via_path(dirname, classname2, sys_dllextent,
dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
{
+ /* next try (alternative_classname).(sys_dllextent) */
+ if(altname)
+ {
+ if ((fd = open_via_path(dirname, altname, sys_dllextent,
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+
+ /* next try (alternative_classname)/(alternative_classname).(sys_dllextent) ... */
+ strncpy(classname2, altname, MAXPDSTRING);
+ filename[MAXPDSTRING-2] = 0;
+ strcat(classname2, "/");
+ strncat(classname2, altname, MAXPDSTRING-strlen(classname2));
+ filename[MAXPDSTRING-1] = 0;
+ if ((fd = open_via_path(dirname, classname2, sys_dllextent,
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ {
+ return 0;
+ }
+ }
+ else
return (0);
}
}
@@ -93,9 +113,20 @@ int sys_load_lib(char *dirname, char *classname)
#ifdef MACOSX
strcpy(symname, "_");
strcat(symname, nameptr);
+ if(altname)
+ {
+ strcpy(altsymname, "_setup_");
+ strcat(symname, altname);
+ }
#else
strcpy(symname, nameptr);
+ if(altname)
+ {
+ strcpy(altsymname, "setup_");
+ strcat(altsymname, altname);
+ }
#endif
+
/* if the last character is a tilde, replace with "_tilde" */
if (symname[strlen(symname) - 1] == '~')
strcpy(symname + (strlen(symname) - 1), "_tilde");
@@ -110,6 +141,7 @@ int sys_load_lib(char *dirname, char *classname)
return (0);
}
makeout = (t_xxx)dlsym(dlobj, symname);
+ if(!makeout)makeout = (t_xxx)dlsym(dlobj, altsymname);
#endif
#ifdef MSW
sys_bashfilename(filename, filename);
@@ -121,8 +153,9 @@ int sys_load_lib(char *dirname, char *classname)
return (0);
}
makeout = (t_xxx)GetProcAddress(ntdll, symname);
+ if(!makeout)makeout = (t_xxx)GetProcAddress(ntdll, altsymname);
#endif
-#ifdef MACOSX
+#if defined(MACOSX) && !defined(DL_OPEN)
{
NSObjectFileImage image;
void *ret;
@@ -147,6 +180,8 @@ int sys_load_lib(char *dirname, char *classname)
}
s = NSLookupSymbolInModule(ret, symname);
+ if(!s)s=NSLookupSymbolInModule(ret, altsymname);
+
if (s)
makeout = (t_xxx)NSAddressOfSymbol( s);
else makeout = 0;
@@ -156,6 +191,8 @@ int sys_load_lib(char *dirname, char *classname)
if (!makeout)
{
post("load_object: Symbol \"%s\" not found", symname);
+ if(altname)
+ post("load_object: Symbol \"%s\" not found", altsymname);
class_set_extern_dir(&s_);
return 0;
}
@@ -164,11 +201,45 @@ int sys_load_lib(char *dirname, char *classname)
return (1);
}
+/* callback type definition */
+typedef int (*loader_t)(char *dirname, char *classname, char *altname);
+/* linked list of loaders */
+typedef struct loader_queue {
+ loader_t loader;
+ struct loader_queue *next;
+} loader_queue_t;
+static loader_queue_t loaders = {sys_load_lib_alt, NULL};
+/* register class loader function */
+void sys_register_loader(loader_t loader)
+{
+ loader_queue_t *q = &loaders;
+ while (1)
+ {
+ if (q->next)
+ q = q->next;
+ else
+ {
+ q->next = (loader_queue_t *)getbytes(sizeof(loader_queue_t));
+ q->next->loader = loader;
+ q->next->next = NULL;
+ break;
+ }
+ }
+}
-
+int sys_load_lib(char *dirname, char *classname, char *altname)
+{
+ int dspstate = canvas_suspend_dsp();
+ int ok = 0;
+ loader_queue_t *q;
+ for(q = &loaders; q; q = q->next)
+ if(ok = q->loader(dirname, classname, altname)) break;
+ canvas_resume_dsp(dspstate);
+ return ok;
+}
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 76e69046..98301ac8 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -215,7 +215,7 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
#endif
/* load dynamic libraries specified with "-lib" args */
for (nl = sys_externlist; nl; nl = nl->nl_next)
- if (!sys_load_lib(cwd, nl->nl_string))
+ if (!sys_load_lib(cwd, nl->nl_string, 0))
post("%s: can't load library", nl->nl_string);
/* open patches specifies with "-open" args */
for (nl = sys_openlist; nl; nl = nl->nl_next)
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index fe9f8d32..c8fb4da3 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -356,7 +356,7 @@ void open_via_helppath(const char *name, const char *dir)
}
-/* Startup file reading for linux and MACOSX. As of 0.38 this will be
+/* Startup file reading for linux and __APPLE__. As of 0.38 this will be
deprecated in favor of the "settings" mechanism */
int sys_argparse(int argc, char **argv);
diff --git a/pd/src/s_stuff.h b/pd/src/s_stuff.h
index 4304f288..7cbe84f9 100644
--- a/pd/src/s_stuff.h
+++ b/pd/src/s_stuff.h
@@ -46,7 +46,7 @@ extern int sys_defaultfont;
extern t_symbol *sys_libdir; /* library directory for auxilliary files */
/* s_loader.c */
-int sys_load_lib(char *dirname, char *filename);
+int sys_load_lib(char *dirname, char *filename, char *altname);
/* s_audio.c */
@@ -178,7 +178,7 @@ void sys_setvirtualalarm( void);
#define API_DEFAULT API_MMIO
#define API_DEFSTRING "MMIO"
#endif
-#ifdef MACOSX
+#ifdef __APPLE__
#define API_DEFAULT API_PORTAUDIO
#define API_DEFSTRING "portaudio"
#endif
diff --git a/pd/src/t_main.c b/pd/src/t_main.c
index 76bbb707..2ed68841 100644
--- a/pd/src/t_main.c
+++ b/pd/src/t_main.c
@@ -14,7 +14,7 @@
*/
-#ifndef MACOSX /* linux and IRIX only; in MACOSX we don't link this in */
+#ifndef __APPLE__ /* linux and IRIX only; in __APPLE__ we don't link this in */
#include "tk.h"
#include <stdlib.h>
@@ -112,4 +112,4 @@ Tcl_AppInit(interp)
return TCL_OK;
}
-#endif /* MACOSX */
+#endif /* __APPLE__ */
diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c
index 755aa1a0..61e66691 100644
--- a/pd/src/t_tkcmd.c
+++ b/pd/src/t_tkcmd.c
@@ -30,7 +30,9 @@
#include <winsock.h>
#include <io.h>
#endif
-#ifdef MSW
+
+/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
+#ifdef _MSC_VER
#pragma warning( disable : 4305 ) /* uncast const double to float */
#pragma warning( disable : 4244 ) /* uncast double to float */
#pragma warning( disable : 4101 ) /* unused local variables */
@@ -40,7 +42,7 @@
#include "tk.h"
#endif
-#ifdef MACOSX
+#ifdef __APPLE__
#define STARTGUI
#endif
@@ -546,7 +548,7 @@ void tcl_mess(char *s)
/* in linux, we load the tk code from here (in MSW and MACOS, this
is done by passing the name of the file as a startup argument to
the wish shell.) */
-#if !defined(MSW) && !defined(MACOSX)
+#if !defined(MSW) && !defined(__APPLE__)
void pdgui_doevalfile(Tcl_Interp *interp, char *s)
{
char buf[GUISTRING];
@@ -584,7 +586,7 @@ void pdgui_startup(Tcl_Interp *interp)
#endif
pdgui_setupsocket();
/* read in the startup file */
-#if !defined(MSW) && !defined(MACOSX)
+#if !defined(MSW) && !defined(__APPLE__)
pdgui_evalfile("pd.tk");
#endif
}
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 46d8c4ec..82544ac4 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -89,6 +89,8 @@ if {$pd_nt == 0} {
}
}
+set help_top_directory $pd_guidir/doc
+
# it's unfortunate but we seem to have to turn off global bindings
# for Text objects to get control-s and control-t to do what we want for
# "text" dialogs below. Also we have to get rid of tab's changing the focus.
@@ -378,8 +380,8 @@ proc menu_openhtml {filename} {
if {$pd_nt == 0} {
exec sh -c \
- [format "firefox file:%s || mozilla file:%s &\n" \
- $filename $filename]
+ [format "firefox file:%s || mozilla file:%s " \
+ $filename $filename] &
} elseif {$pd_nt == 2} {
puts stderr [format "open %s" $filename]
exec sh -c [format "open %s" $filename]
@@ -389,41 +391,6 @@ proc menu_openhtml {filename} {
}
}
-set help_directory $pd_guidir/doc
-set help_top_directory $pd_guidir/doc
-
-proc menu_documentation {} {
- global help_directory
- global pd_nt
- global pd_guidir
-
- if {$pd_nt == 2} {
- exec rm -rf /tmp/pd-documentation
- exec cp -pr $pd_guidir/doc /tmp/pd-documentation
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{documentation} {.pd .txt .htm}} } \
- -initialdir /tmp/pd-documentation]
- } else {
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{documentation} {.pd .txt .htm}} } \
- -initialdir $help_directory]
- }
- if {$filename != ""} {
- if {[string first .txt $filename] >= 0} {
- menu_opentext $filename
- } elseif {[string first .htm $filename] >= 0} {
- menu_openhtml $filename
- } else {
- set help_directory [string range $filename 0 \
- [expr [string last / $filename ] - 1]]
- set basename [string range $filename \
- [expr [string last / $filename ] + 1] end]
- pd [concat pd open [pdtk_enquote $basename] \
- [pdtk_enquote $help_directory] \;]
- }
- }
-}
-
proc menu_doc_open {subdir basename} {
global pd_guidir
@@ -439,27 +406,62 @@ proc menu_doc_open {subdir basename} {
}
}
-proc doc_submenu {helpmenu subdir} {
- global help_top_directory pd_tearoff
- set menudir $help_top_directory/$subdir
-
- regsub -all "\\\." $subdir "" submenu
-
- menu $helpmenu.$submenu -tearoff $pd_tearoff
- regsub -all "\\\." $subdir " " submenuname
- $helpmenu add cascade -label $submenuname \
- -menu $helpmenu.$submenu
- catch {
-# use this glob pattern to exclude the supporting files
-# foreach file [ lsort [ glob -dir $menudir {*[0-9][0-9]*} ] ]
- foreach file [ lsort [ glob -dir $menudir * ] ] {
- set filename ""
- regsub {.*/(.*\..+$)} $file {\1} filename
- $helpmenu.$submenu add command -label $filename \
- -command "menu_doc_open doc/$subdir $filename"
+################## help browser and support functions #########################
+proc menu_doc_browser {dir} {
+ global .mbar
+ if {![file isdirectory $dir]} {
+ puts stderr "menu_doc_browser non-directory $dir\n"
+ }
+ if { [winfo exists .help_browser.frame] } {
+ raise .help_browser
+ } else {
+ toplevel .help_browser -menu .mbar
+ wm title .help_browser "Pd Documentation Browser"
+ frame .help_browser.frame
+ pack .help_browser.frame -side top -fill both
+ doc_make_listbox .help_browser.frame $dir 0
}
}
+
+proc doc_make_listbox {base dir count} {
+ global pd_guidir
+ if {![file isdirectory $dir]} {
+ regsub -- $pd_guidir [file dirname $dir] "" subdir
+ set file [file tail $dir]
+ if { [catch {menu_doc_open $subdir $file} fid] } {
+ puts stderr "Could not open $pd_guidir/$subdir/$file\n"
+ }
+ return;
+ }
+ # check for [file readable]?
+ if { [info tclversion] >= 8.5 } {
+ # requires Tcl 8.5 but probably deals with special chars better
+# destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
+ } else {
+ if { [catch { eval destroy [lrange [winfo children $base] \
+ [expr { 2 * $count }] end] } \
+ errorMessage] } {
+ puts stderr "doc_make_listbox: error listing $dir\n"
+ }
+ }
+ # exportselection 0 looks good, but selection gets easily out-of-sync
+ set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
+ [list "$b-scroll" set] -height 20 -exportselection 0]
+ pack $current_listbox [scrollbar "$b-scroll" -command [list $current_listbox yview]] \
+ -side left -expand 1 -fill y -anchor w
+ foreach item [concat [lsort -dictionary [glob -directory $dir -nocomplain -types {d} -- *]] \
+ [lsort -dictionary [glob -directory $dir -nocomplain -types {f} -- *]]] {
+ $current_listbox insert end "[file tail $item][expr {[file isdirectory $item] ? {/} : {}}]"
+ }
+ bind $current_listbox <Button-1> [list doc_navigate $dir [incr count] %W %x %y]
+}
+
+proc doc_navigate {dir count width x y} {
+ if {[set subdir [$width get [$width index "@$x,$y"]]] eq {}} {
+ return
+ }
+ doc_make_listbox [winfo parent $width] [file join $dir $subdir] $count
}
############# routine to add media, help, and apple menu items ###############
@@ -526,7 +528,7 @@ proc menu_addstd {mbar} {
$mbar.help add command -label {Html ...} \
-command {menu_doc_open doc/1.manual index.htm}
$mbar.help add command -label {Browser ...} \
- -command {menu_documentation}
+ -command {menu_doc_browser $help_top_directory}
}
#################### the "File" menu for the Pd window ##############
diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c
index 095e2c7d..eb28e0fc 100644
--- a/pd/src/x_arithmetic.c
+++ b/pd/src/x_arithmetic.c
@@ -11,7 +11,7 @@ inputs to int and their outputs back to float. */
/* MSW and OSX don't appear to have single-precision ANSI math */
-#if defined(MSW) || defined(MACOSX)
+#if defined(MSW) || defined(__APPLE__)
#define sinf sin
#define cosf cos
#define atanf atan
diff --git a/pd/src/x_midi.c b/pd/src/x_midi.c
index 6b2fd60c..ad1429a8 100644
--- a/pd/src/x_midi.c
+++ b/pd/src/x_midi.c
@@ -1187,7 +1187,7 @@ static void poly_free(t_poly *x)
static void poly_setup(void)
{
poly_class = class_new(gensym("poly"),
- (t_newmethod)poly_new, (t_method)poly_clear,
+ (t_newmethod)poly_new, (t_method)poly_free,
sizeof(t_poly), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addfloat(poly_class, poly_float);
class_addmethod(poly_class, (t_method)poly_stop, gensym("stop"), 0);
diff --git a/pd/src/x_misc.c b/pd/src/x_misc.c
index 0facd6b8..411304fa 100644
--- a/pd/src/x_misc.c
+++ b/pd/src/x_misc.c
@@ -21,7 +21,7 @@
#include <time.h>
#endif
-#if defined (MACOSX) || defined (__FreeBSD__)
+#if defined (__APPLE__) || defined (__FreeBSD__)
#define HZ CLK_TCK
#endif