aboutsummaryrefslogtreecommitdiff
path: root/externals/iem
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2014-01-28 08:53:40 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2014-01-28 08:53:40 +0000
commite652a0daf09bcbd40bfe0eb4147b896e44a799d3 (patch)
tree5cacc215b7a90a620ba308934b90ffed6a9a2ff6 /externals/iem
parent34362ac03aaf73385b41db61c5436bddf92699b1 (diff)
common build infrastructure for iem-libs
svn path=/trunk/; revision=17260
Diffstat (limited to 'externals/iem')
-rw-r--r--externals/iem/Make.include56
-rw-r--r--externals/iem/include/iemlib.h118
2 files changed, 174 insertions, 0 deletions
diff --git a/externals/iem/Make.include b/externals/iem/Make.include
new file mode 100644
index 00000000..aaca607a
--- /dev/null
+++ b/externals/iem/Make.include
@@ -0,0 +1,56 @@
+current: all
+
+PD_DEFINES = -DPD -DUNIX
+
+#################################
+# path to private Pd-headers
+PDSOURCE ?= /usr/local/src/pd/src
+
+# path to iemlib.h
+IEMLIB_INCLUDE = ../../include
+
+#define to true if private Pd-header g_canvas.h is in out search-path
+PD_DEFINES += -DHAVE_G_CANVAS_H
+#################################
+
+
+.SUFFIXES: .pd_linux
+
+EXT = pd_linux
+
+STRIP = strip
+
+PD_LDFLAGS = --export-dynamic -shared $(LD_FLAGS)
+PD_LIB = -lm -lc $(LIB)
+
+#select either the DBG and OPT compiler flags below:
+
+DBG_CFLAGS=-W -Wno-parentheses -Wno-switch -Wno-unused
+CFLAGS=-O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing
+PD_CFLAGS = $(PD_DEFINES) -fPIC -fno-stack-protector $(DBG_CFLAGS) $(CFLAGS)
+
+PD_INCLUDES = -I. -I$(IEMLIB_INCLUDE) -I$(PDSOURCE) -I../../../../pd/src
+
+# the sources
+#SRC = $(sort $(filter %.c, $(wildcard *.c)))
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ -rm -f ../../lib/$(TARGET).$(EXT) $(TARGET).$(EXT)
+ -rm -f *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(PD_LDFLAGS) -o $(TARGET).$(EXT) *.o $(PD_LIB)
+ $(STRIP) --strip-unneeded $(TARGET).$(EXT)
+ -cp $(TARGET).$(EXT) ../../lib/
+
+$(OBJ) : %.o : %.c
+ touch $*.c
+ $(CC) $(PD_CFLAGS) $(PD_INCLUDES) -c -o $*.o $*.c
+
diff --git a/externals/iem/include/iemlib.h b/externals/iem/include/iemlib.h
new file mode 100644
index 00000000..ac1ffced
--- /dev/null
+++ b/externals/iem/include/iemlib.h
@@ -0,0 +1,118 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2012 */
+
+#ifndef __IEMLIB_H__
+#define __IEMLIB_H__
+
+
+#define IS_A_NULL(atom,index) ((atom+index)->a_type == A_NULL)
+#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)
+
+#define SETNULL(atom) ((atom)->a_type = A_NULL)
+
+/* now miller's code starts :
+ for 4 point interpolation
+ for lookup tables
+ for denormal floats
+ */
+
+#ifdef MSW
+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 */
+#endif /* IRIX */
+
+#ifdef MSW
+ /* little-endian; most significant byte is at highest address */
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#define int32 long
+#endif /* MSW */
+
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
+#include <machine/endian.h>
+#endif
+
+#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(ANDROID)
+#include <endian.h>
+#endif
+
+#if defined(__unix__) || defined(__APPLE__)
+#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
+#endif /* __unix__ or __APPLE__*/
+
+union tabfudge_d
+{
+ double tf_d;
+ int32 tf_i[2];
+};
+
+union tabfudge_f
+{
+ float tf_f;
+ long tf_l;
+};
+
+#if defined __i386__ || defined __x86_64__
+#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 */
+#else
+
+#define IEM_DENORMAL(f) 0
+
+#endif
+
+/* on 64bit systems we cannot use garray_getfloatarray... */
+#if ((defined PD_MAJOR_VERSION && defined PD_MINOR_VERSION) && (PD_MAJOR_VERSION > 0 || PD_MINOR_VERSION > 40))
+# define iemarray_t t_word
+# define iemarray_getarray garray_getfloatwords
+# define iemarray_getfloat(pointer, index) (pointer[index].w_float)
+# define iemarray_setfloat(pointer, index, fvalue) (pointer[index].w_float = fvalue)
+#else
+# define iemarray_t t_float
+# define iemarray_getarray garray_getfloatarray
+# define iemarray_getfloat(pointer, index) (pointer[index])
+# define iemarray_setfloat(pointer, index, fvalue) (pointer[index] = fvalue)
+#endif
+
+#endif