aboutsummaryrefslogtreecommitdiff
path: root/externals/iem/iem_atan2/src
diff options
context:
space:
mode:
Diffstat (limited to 'externals/iem/iem_atan2/src')
-rw-r--r--externals/iem/iem_atan2/src/iem_atan2.c59
-rw-r--r--externals/iem/iem_atan2/src/iem_atan2.dsp85
-rw-r--r--externals/iem/iem_atan2/src/iem_atan2.dsw29
-rw-r--r--externals/iem/iem_atan2/src/iemlib.h102
-rw-r--r--externals/iem/iem_atan2/src/makefile46
-rw-r--r--externals/iem/iem_atan2/src/makefile_linux46
-rw-r--r--externals/iem/iem_atan2/src/makefile_win37
7 files changed, 404 insertions, 0 deletions
diff --git a/externals/iem/iem_atan2/src/iem_atan2.c b/externals/iem/iem_atan2/src/iem_atan2.c
new file mode 100644
index 00000000..5961d617
--- /dev/null
+++ b/externals/iem/iem_atan2/src/iem_atan2.c
@@ -0,0 +1,59 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_atan2 written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#include "m_pd.h"
+#include <math.h>
+
+#if defined(MSW) || defined(MACOSX)
+#define atan2f atan2
+#endif
+
+/* -------------------------- iem_atan2 ------------------------------ */
+static t_class *iem_atan2_class;
+
+typedef struct _iem_atan2
+{
+ t_object x_ob;
+ t_float x_1st_arg;
+ t_float x_2nd_arg;
+} t_iem_atan2;
+
+static void iem_atan2_bang(t_iem_atan2 *x)
+{
+ t_float r = (x->x_1st_arg == 0.0f && x->x_2nd_arg == 0.0f ? 0.0f : atan2f(x->x_1st_arg, x->x_2nd_arg));
+
+ outlet_float(x->x_ob.ob_outlet, r);
+}
+
+static void iem_atan2_float(t_iem_atan2 *x, t_floatarg first_arg)
+{
+ t_float r = (first_arg == 0.0f && x->x_2nd_arg == 0.0f ? 0.0f : atan2f(first_arg, x->x_2nd_arg));
+
+ x->x_1st_arg = first_arg;
+ outlet_float(x->x_ob.ob_outlet, r);
+}
+
+static void *iem_atan2_new(void)
+{
+ t_iem_atan2 *x = (t_iem_atan2 *)pd_new(iem_atan2_class);
+
+ floatinlet_new(&x->x_ob, &x->x_2nd_arg);
+ x->x_1st_arg = 0.0f;
+ x->x_2nd_arg = 0.0f;
+ outlet_new(&x->x_ob, &s_float);
+ return (x);
+}
+
+void iem_atan2_setup(void)
+{
+ iem_atan2_class = class_new(gensym("iem_atan2"), (t_newmethod)iem_atan2_new,
+ 0, sizeof(t_iem_atan2), 0, 0);
+ class_addbang(iem_atan2_class, (t_method)iem_atan2_bang);
+ class_addfloat(iem_atan2_class, (t_method)iem_atan2_float);
+ class_sethelpsymbol(iem_atan2_class, gensym("iemhelp/help-iem_atan2"));
+ post("iem_atan2 (R-1.16) library loaded! (c) Thomas Musil 05.2005");
+ post(" musil%ciem.at iem KUG Graz Austria", '@');
+}
+
diff --git a/externals/iem/iem_atan2/src/iem_atan2.dsp b/externals/iem/iem_atan2/src/iem_atan2.dsp
new file mode 100644
index 00000000..0091c6c4
--- /dev/null
+++ b/externals/iem/iem_atan2/src/iem_atan2.dsp
@@ -0,0 +1,85 @@
+# Microsoft Developer Studio Project File - Name="iem_atan2" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=iem_atan2 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "iem_atan2.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "iem_atan2.mak" CFG="iem_atan2 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "iem_atan2 - Win32 Release" (basierend auf "Win32 (x86) External Target")
+!MESSAGE "iem_atan2 - Win32 Debug" (basierend auf "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "iem_atan2 - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_atan2.exe"
+# PROP Bsc_Name "iem_atan2.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "iem_atan2 - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_atan2.exe"
+# PROP Bsc_Name "iem_atan2.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "iem_atan2 - Win32 Release"
+# Name "iem_atan2 - Win32 Debug"
+
+!IF "$(CFG)" == "iem_atan2 - Win32 Release"
+
+!ELSEIF "$(CFG)" == "iem_atan2 - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\makefile_win
+# End Source File
+# End Target
+# End Project
diff --git a/externals/iem/iem_atan2/src/iem_atan2.dsw b/externals/iem/iem_atan2/src/iem_atan2.dsw
new file mode 100644
index 00000000..70689cad
--- /dev/null
+++ b/externals/iem/iem_atan2/src/iem_atan2.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "iem_atan2"=.\iem_atan2.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/externals/iem/iem_atan2/src/iemlib.h b/externals/iem/iem_atan2/src/iemlib.h
new file mode 100644
index 00000000..c2bf7731
--- /dev/null
+++ b/externals/iem/iem_atan2/src/iemlib.h
@@ -0,0 +1,102 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#ifndef __IEMLIB_H__
+#define __IEMLIB_H__
+
+
+#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
+#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
+#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
+#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR)
+#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
+#define IS_A_SEMI(atom,index) ((atom+index)->a_type == A_SEMI)
+#define IS_A_COMMA(atom,index) ((atom+index)->a_type == A_COMMA)
+
+
+#ifdef NT
+int sys_noloadbang;
+//t_symbol *iemgui_key_sym=0;
+#include <io.h>
+#else
+extern int sys_noloadbang;
+//extern t_symbol *iemgui_key_sym;
+#include <unistd.h>
+#endif
+
+#define DEFDELVS 64
+#define XTRASAMPS 4
+#define SAMPBLK 4
+
+
+#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */
+
+/* machine-dependent definitions. These ifdefs really
+should have been by CPU type and not by operating system! */
+#ifdef IRIX
+/* big-endian. Most significant byte is at low address in memory */
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#define int32 long /* a data type that has 32 bits */
+#else
+#ifdef MSW
+/* little-endian; most significant byte is at highest address */
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#define int32 long
+#else
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* BYTE_ORDER */
+#include <sys/types.h>
+#define int32 int32_t
+#endif
+#ifdef __linux__
+
+#include <endian.h>
+
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)
+#error No byte order defined
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* __BYTE_ORDER */
+
+#include <sys/types.h>
+#define int32 int32_t
+
+#else
+#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 /* __APPLE__ */
+#endif /* __linux__ */
+#endif /* MSW */
+#endif /* SGI */
+
+union tabfudge
+{
+ double tf_d;
+ int32 tf_i[2];
+};
+
+#define IEM_DENORMAL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \
+(((*(unsigned int*)&(f))&0x60000000)==0x60000000))
+/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */
+
+#endif
diff --git a/externals/iem/iem_atan2/src/makefile b/externals/iem/iem_atan2/src/makefile
new file mode 100644
index 00000000..005d1e54
--- /dev/null
+++ b/externals/iem/iem_atan2/src/makefile
@@ -0,0 +1,46 @@
+current: all
+
+.SUFFIXES: .pd_linux
+
+INCLUDE = -I. -I/usr/local/src/pd/src
+
+LDFLAGS = -export-dynamic -shared
+LIB = -ldl -lm -lpthread
+
+#select either the DBG and OPT compiler flags below:
+
+CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
+ -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
+ -DDL_OPEN
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = iem_atan2.c
+
+TARGET = iem_atan2.pd_linux
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm ..\$(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB)
+ strip --strip-unneeded $(TARGET)
+ mv $(TARGET) ..
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/externals/iem/iem_atan2/src/makefile_linux b/externals/iem/iem_atan2/src/makefile_linux
new file mode 100644
index 00000000..005d1e54
--- /dev/null
+++ b/externals/iem/iem_atan2/src/makefile_linux
@@ -0,0 +1,46 @@
+current: all
+
+.SUFFIXES: .pd_linux
+
+INCLUDE = -I. -I/usr/local/src/pd/src
+
+LDFLAGS = -export-dynamic -shared
+LIB = -ldl -lm -lpthread
+
+#select either the DBG and OPT compiler flags below:
+
+CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
+ -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
+ -DDL_OPEN
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = iem_atan2.c
+
+TARGET = iem_atan2.pd_linux
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm ..\$(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB)
+ strip --strip-unneeded $(TARGET)
+ mv $(TARGET) ..
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/externals/iem/iem_atan2/src/makefile_win b/externals/iem/iem_atan2/src/makefile_win
new file mode 100644
index 00000000..b1353659
--- /dev/null
+++ b/externals/iem/iem_atan2/src/makefile_win
@@ -0,0 +1,37 @@
+
+all: ..\iem_atan2.dll
+
+VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98"
+
+PD_INST_PATH = "C:\Programme\pd-0.39-2"
+
+PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include
+
+PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -DPA_LITTLE_ENDIAN
+
+PD_WIN_L_FLAGS = /nologo
+
+PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid \
+ $(VIS_CPP_PATH)\lib\libc.lib \
+ $(VIS_CPP_PATH)\lib\oldnames.lib \
+ $(VIS_CPP_PATH)\lib\kernel32.lib \
+ $(VIS_CPP_PATH)\lib\wsock32.lib \
+ $(VIS_CPP_PATH)\lib\winmm.lib \
+ $(PD_INST_PATH)\bin\pthreadVC.lib \
+ $(PD_INST_PATH)\bin\pd.lib
+
+
+SRC = iem_atan2.c
+
+
+OBJ = $(SRC:.c=.obj)
+
+.c.obj:
+ cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c
+
+..\iem_atan2.dll: $(OBJ)
+ link $(PD_WIN_L_FLAGS) /dll /export:iem_atan2_setup \
+ /out:..\iem_atan2.dll $(OBJ) $(PD_WIN_LIB)
+
+clean:
+ del *.obj