From 070ded6a9b6552458c8f96c07d7887f6a072d2d4 Mon Sep 17 00:00:00 2001 From: musil Date: Wed, 29 Jun 2011 16:45:36 +0000 Subject: initial ci of evaluate size of data types svn path=/trunk/; revision=15120 --- externals/iem/eval_sizeof/src/eval_sizeof.c | 54 ++++++++++++++++++++++++++++ externals/iem/eval_sizeof/src/makefile_d_fat | 42 ++++++++++++++++++++++ externals/iem/eval_sizeof/src/makefile_linux | 46 ++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 externals/iem/eval_sizeof/src/eval_sizeof.c create mode 100644 externals/iem/eval_sizeof/src/makefile_d_fat create mode 100644 externals/iem/eval_sizeof/src/makefile_linux (limited to 'externals/iem/eval_sizeof/src') 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 + + + + -- cgit v1.2.1