aboutsummaryrefslogtreecommitdiff
path: root/externals/iem/eval_sizeof/src
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2011-06-29 16:45:36 +0000
committermusil <tmusil@users.sourceforge.net>2011-06-29 16:45:36 +0000
commit070ded6a9b6552458c8f96c07d7887f6a072d2d4 (patch)
tree935fde1f65d50ea1915bd43a71a86846907d0b84 /externals/iem/eval_sizeof/src
parentffd0e3c8430d9a5edf2f71aefb262829278d8e51 (diff)
initial ci of evaluate size of data types
svn path=/trunk/; revision=15120
Diffstat (limited to 'externals/iem/eval_sizeof/src')
-rw-r--r--externals/iem/eval_sizeof/src/eval_sizeof.c54
-rw-r--r--externals/iem/eval_sizeof/src/makefile_d_fat42
-rw-r--r--externals/iem/eval_sizeof/src/makefile_linux46
3 files changed, 142 insertions, 0 deletions
diff --git a/externals/iem/eval_sizeof/src/eval_sizeof.c b/externals/iem/eval_sizeof/src/eval_sizeof.c
new file mode 100644
index 00000000..a0cd36a5
--- /dev/null
+++ b/externals/iem/eval_sizeof/src/eval_sizeof.c
@@ -0,0 +1,54 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+eval_sizeof written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2011
+
+evaluetes the size of differnt data types */
+
+#include "m_pd.h"
+
+/* -------------------------- eval_sizeof ------------------------------ */
+static t_class *eval_sizeof_class;
+
+typedef struct _eval_sizeof
+{
+ t_object x_ob;
+} t_eval_sizeof;
+
+static void *eval_sizeof_new(void)
+{
+ t_eval_sizeof *x = (t_eval_sizeof *)pd_new(eval_sizeof_class);
+ char sc=0;
+ unsigned char uc=0;
+ int si=0;
+ unsigned int ui=0;
+ long sl=0;
+ unsigned long ul=0;
+ long long sll=0;
+ unsigned long long ull=0;
+ float f=0.0;
+ double d=0.0;
+ long double ld=0.0;
+ void *ptr=(void *)0;
+
+ post("signed char = %d bytes\n", sizeof(sc));
+ post("unsigned char = %d bytes\n", sizeof(uc));
+ post("signed int = %d bytes\n", sizeof(si));
+ post("unsigned int = %d bytes\n", sizeof(ui));
+ post("signed long = %d bytes\n", sizeof(sl));
+ post("unsigned long = %d bytes\n", sizeof(ul));
+ post("signed long long = %d bytes\n", sizeof(sll));
+ post("unsigned long long = %d bytes\n", sizeof(ull));
+ post("float = %d bytes\n", sizeof(f));
+ post("double = %d bytes\n", sizeof(d));
+ post("long double = %d bytes\n", sizeof(ld));
+ post("void* = %d bytes\n", sizeof(ptr));
+ return (x);
+}
+
+void eval_sizeof_setup(void)
+{
+ eval_sizeof_class = class_new(gensym("eval_sizeof"), (t_newmethod)eval_sizeof_new,
+ 0, sizeof(t_eval_sizeof), 0, 0);
+}
+
diff --git a/externals/iem/eval_sizeof/src/makefile_d_fat b/externals/iem/eval_sizeof/src/makefile_d_fat
new file mode 100644
index 00000000..a238a825
--- /dev/null
+++ b/externals/iem/eval_sizeof/src/makefile_d_fat
@@ -0,0 +1,42 @@
+current: all
+
+.SUFFIXES: .d_fat
+
+PD_INSTALL_PATH ?= "/Applications/Pd.app/Contents/Resources"
+
+INCLUDE = -I. -I$(PD_INSTALL_PATH)/src
+
+CFLAGS =-DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+LFLAGS = -bundle -undefined suppress -flat_namespace
+
+# the sources
+
+SRC = eval_sizeof.c
+
+TARGET = eval_sizeof.d_fat
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm ../$(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(CC) -arch i386 -arch ppc $(LFLAGS) -o $(TARGET) *.o
+ strip -S -x $(TARGET)
+ mv $(TARGET) ..
+
+$(OBJ) : %.o : %.c
+ $(CC) -arch i386 -arch ppc $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/externals/iem/eval_sizeof/src/makefile_linux b/externals/iem/eval_sizeof/src/makefile_linux
new file mode 100644
index 00000000..605ac556
--- /dev/null
+++ b/externals/iem/eval_sizeof/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 -fPIC
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = eval_sizeof.c
+
+TARGET = eval_sizeof.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
+
+
+
+