log-0.1/0000755000175000017500000000000012566657177012413 5ustar zmoelnigzmoelniglog-0.1/logpost-help.pd0000644000175000017500000000205611674625123015341 0ustar zmoelnigzmoelnig#N canvas 545 156 450 300 10; #X obj 46 81 logpost; #X obj 49 38 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 47 120 symbol hello; #X obj 48 171 logpost 2 testing; #X msg 61 143 hello; #X text 22 7 post at different levels; #X obj 85 62 hradio 15 1 0 5 empty empty empty 0 -8 0 10 -262144 -1 -1 0; #X obj 224 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 2000 1; #X obj 221 157 logpost 3; #X obj 113 234 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 2800 1; #X obj 110 252 logpost 3 loasdf 23 sdkjh; #X obj 257 233 hradio 15 1 0 5 empty empty empty 0 -8 0 10 -262144 -1 -1 0; #X obj 234 37 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 1200 1; #X obj 231 57 logpost farg; #X obj 234 77 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 3500 1; #X obj 231 97 logpost three 2 asdf; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 4 0 3 0; #X connect 6 0 0 1; #X connect 7 0 8 0; #X connect 9 0 10 0; #X connect 11 0 10 1; #X connect 12 0 13 0; #X connect 14 0 15 0; log-0.1/fatal.c0000644000175000017500000000364311722454745013641 0ustar zmoelnigzmoelnig #include "m_pd.h" static t_class *fatal_class; typedef struct _fatal { t_object x_obj; int level; t_symbol* tag; } t_fatal; static t_symbol* args2symbol(int argc, t_atom *argv) { t_symbol* s; char* buf; int bufsize; t_binbuf *bb = binbuf_new(); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &buf, &bufsize); buf = resizebytes(buf, bufsize, bufsize+1); buf[bufsize] = 0; s = gensym(buf); freebytes(buf, bufsize+1); binbuf_free(bb); return s; } static void fatal_bang(t_fatal *x) { logpost(x, x->level, "%s%sbang", x->tag->s_name, (*x->tag->s_name ? ": " : "")); } static void fatal_pointer(t_fatal *x, t_gpointer *gp) { logpost(x, x->level, "%s%s(pointer %lx)", x->tag->s_name, (*x->tag->s_name ? ": " : ""), gp); } static void fatal_float(t_fatal *x, t_float f) { logpost(x, (const int)x->level, "%s%s%g", x->tag->s_name, (*x->tag->s_name ? ": " : ""), f); } static void fatal_anything(t_fatal *x, t_symbol *s, int argc, t_atom *argv) { t_symbol* output = args2symbol(argc, argv); logpost(x, (const int)x->level, "%s%s%s %s", x->tag->s_name, (*x->tag->s_name ? ": " : ""), s->s_name, output->s_name); } static void *fatal_new(t_symbol *s, int argc, t_atom *argv) { t_fatal *x = (t_fatal *)pd_new(fatal_class); x->tag = &s_; x->level = 0; if (argc > 0) x->tag = args2symbol(argc, argv); return (x); } void fatal_setup(void) { fatal_class = class_new(gensym("fatal"), (t_newmethod)fatal_new, 0, sizeof(t_fatal), CLASS_DEFAULT, A_GIMME, 0); class_addbang(fatal_class, fatal_bang); class_addfloat(fatal_class, fatal_float); class_addpointer(fatal_class, fatal_pointer); class_addanything(fatal_class, fatal_anything); } log-0.1/Makefile0000644000175000017500000003776511743054211014045 0ustar zmoelnigzmoelnig## Pd library template version 1.0.12 # For instructions on how to use this template, see: # http://puredata.info/docs/developer/MakefileTemplate LIBRARY_NAME = log # add your .c source files, one object per file, to the SOURCES # variable, help files will be included automatically, and for GUI # objects, the matching .tcl file too SOURCES = logpost.c debug.c normal.c error.c fatal.c # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will # be included automatically PDOBJECTS = # example patches and related files, in the 'examples' subfolder EXAMPLES = # manuals and related files, in the 'manual' subfolder MANUAL = # if you want to include any other files in the source and binary tarballs, # list them here. This can be anything from header files, test patches, # documentation, etc. README.txt and LICENSE.txt are required and therefore # automatically included EXTRA_DIST = # unit tests and related files here, in the 'unittests' subfolder UNITTESTS = #------------------------------------------------------------------------------# # # things you might need to edit if you are using other C libraries # #------------------------------------------------------------------------------# ALL_CFLAGS = -I"$(PD_INCLUDE)" ALL_LDFLAGS = SHARED_LDFLAGS = ALL_LIBS = #------------------------------------------------------------------------------# # # you shouldn't need to edit anything below here, if we did it right :) # #------------------------------------------------------------------------------# # these can be set from outside without (usually) breaking the build CFLAGS = -Wall -W -g LDFLAGS = LIBS = # get library version from meta file LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) ALL_CFLAGS += -DPD -DVERSION='"$(LIBRARY_VERSION)"' PD_INCLUDE = $(PD_PATH)/include/pd # where to install the library, overridden below depending on platform prefix = /usr/local libdir = $(prefix)/lib pkglibdir = $(libdir)/pd-externals objectsdir = $(pkglibdir) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 644 INSTALL_DATA = $(INSTALL) -p -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch SOURCES += $(SOURCES_iphoneos) EXTENSION = pd_darwin SHARED_EXTENSION = dylib OS = iphoneos PD_PATH = /Applications/Pd-extended.app/Contents/Resources IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin CC=$(IPHONE_BASE)/gcc CPP=$(IPHONE_BASE)/cpp CXX=$(IPHONE_BASE)/g++ ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer ALL_CFLAGS := $(IPHONE_CFLAGS) $(ALL_CFLAGS) ALL_LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) SHARED_LDFLAGS += -arch armv6 -dynamiclib -undefined dynamic_lookup $(ISYSROOT) ALL_LIBS += -lc $(LIBS_iphoneos) STRIP = strip -x DISTBINDIR=$(DISTDIR)-$(OS) else # Mac OS X SOURCES += $(SOURCES_macosx) EXTENSION = pd_darwin SHARED_EXTENSION = dylib OS = macosx PD_PATH = /Applications/Pd-extended.app/Contents/Resources OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast # build universal 32-bit on 10.4 and 32/64 on newer ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 else FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 SOURCES += $(SOURCES_iphoneos) endif ALL_CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include # if the 'pd' binary exists, check the linking against it to aid with stripping BUNDLE_LOADER = $(shell test ! -e $(PD_PATH)/bin/pd || echo -bundle_loader $(PD_PATH)/bin/pd) ALL_LDFLAGS += $(FAT_FLAGS) -bundle $(BUNDLE_LOADER) -undefined dynamic_lookup -L/sw/lib SHARED_LDFLAGS += $(FAT_FLAGS) -dynamiclib -undefined dynamic_lookup \ -install_name @loader_path/$(SHARED_LIB) -compatibility_version 1 -current_version 1.0 ALL_LIBS += -lc $(LIBS_macosx) STRIP = strip -x DISTBINDIR=$(DISTDIR)-$(OS) # install into ~/Library/Pd on Mac OS X since /usr/local isn't used much pkglibdir=$(HOME)/Library/Pd endif endif # Tho Android uses Linux, we use this fake uname to provide an easy way to # setup all this things needed to cross-compile for Android using the NDK ifeq ($(UNAME),ANDROID) CPU := arm SOURCES += $(SOURCES_android) EXTENSION = pd_linux SHARED_EXTENSION = so OS = android PD_PATH = /usr NDK_BASE := /usr/local/android-ndk NDK_PLATFORM_VERSION := 5 NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_VERSION)/arch-arm NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]') NDK_TOOLCHAIN_BASE=$(NDK_BASE)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(NDK_UNAME)-x86 CC := $(NDK_TOOLCHAIN_BASE)/bin/arm-linux-androideabi-gcc --sysroot=$(NDK_SYSROOT) OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer CFLAGS += LDFLAGS += -rdynamic -shared SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared LIBS += -lc $(LIBS_android) STRIP := $(NDK_TOOLCHAIN_BASE)/bin/arm-linux-androideabi-strip \ --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq ($(UNAME),Linux) CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so OS = linux PD_PATH = /usr OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer ALL_CFLAGS += -fPIC ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared ALL_LIBS += -lc $(LIBS_linux) STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq ($(UNAME),GNU) # GNU/Hurd, should work like GNU/Linux for basically all externals CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so OS = linux PD_PATH = /usr OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer ALL_CFLAGS += -fPIC ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) ALL_LIBS += -lc $(LIBS_linux) STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq ($(UNAME),GNU/kFreeBSD) # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so OS = linux PD_PATH = /usr OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer ALL_CFLAGS += -fPIC ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) ALL_LIBS += -lc $(LIBS_linux) STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) CPU := $(shell uname -m) SOURCES += $(SOURCES_cygwin) EXTENSION = dll SHARED_EXTENSION = dll OS = cygwin PD_PATH = $(shell cygpath $$PROGRAMFILES)/pd OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer ALL_CFLAGS += ALL_LDFLAGS += -rdynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) ALL_LIBS += -lc -lpd $(LIBS_cygwin) STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS) endif ifeq (MINGW,$(findstring MINGW,$(UNAME))) CPU := $(shell uname -m) SOURCES += $(SOURCES_windows) EXTENSION = dll SHARED_EXTENSION = dll OS = windows PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd) # MinGW doesn't seem to include cc so force gcc CC=gcc OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer ALL_CFLAGS += -mms-bitfields ALL_LDFLAGS += -s -shared -Wl,--enable-auto-import SHARED_LDFLAGS += -shared ALL_LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" \ -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 -liberty $(LIBS_windows) STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS) endif # in case somebody manually set the HELPPATCHES above HELPPATCHES ?= $(SOURCES:.c=-help.pd) $(PDOBJECTS:.pd=-help.pd) ALL_CFLAGS := $(ALL_CFLAGS) $(CFLAGS) $(OPT_CFLAGS) ALL_LDFLAGS := $(LDFLAGS) $(ALL_LDFLAGS) ALL_LIBS := $(LIBS) $(ALL_LIBS) SHARED_SOURCE ?= $(wildcard lib$(LIBRARY_NAME).c) SHARED_HEADER ?= $(shell test ! -e $(LIBRARY_NAME).h || echo $(LIBRARY_NAME).h) SHARED_LIB ?= $(SHARED_SOURCE:.c=.$(SHARED_EXTENSION)) SHARED_TCL_LIB = $(wildcard lib$(LIBRARY_NAME).tcl) .PHONY = install libdir_install single_install install-doc install-examples install-manual install-unittests clean distclean dist etags $(LIBRARY_NAME) all: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) %.o: %.c $(CC) $(ALL_CFLAGS) -o "$*.o" -c "$*.c" %.$(EXTENSION): %.o $(SHARED_LIB) $(CC) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) chmod a-x "$*.$(EXTENSION)" # this links everything into a single binary file $(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o lib$(LIBRARY_NAME).o $(CC) $(ALL_LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) \ $(LIBRARY_NAME).o lib$(LIBRARY_NAME).o $(ALL_LIBS) chmod a-x $(LIBRARY_NAME).$(EXTENSION) $(SHARED_LIB): $(SHARED_SOURCE:.c=.o) $(CC) $(SHARED_LDFLAGS) -o $(SHARED_LIB) $(SHARED_SOURCE:.c=.o) $(ALL_LIBS) install: libdir_install # The meta and help files are explicitly installed to make sure they are # actually there. Those files are not optional, then need to be there. libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual install-unittests $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES))" || (\ $(INSTALL_PROGRAM) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \ $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))) test -z "$(strip $(SHARED_LIB))" || \ $(INSTALL_DATA) $(SHARED_LIB) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(wildcard $(SOURCES:.c=.tcl)))" || \ $(INSTALL_DATA) $(wildcard $(SOURCES:.c=.tcl)) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_DATA) $(PDOBJECTS) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SHARED_TCL_LIB))" || \ $(INSTALL_DATA) $(SHARED_TCL_LIB) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) # install library linked as single binary single_install: $(LIBRARY_NAME) install-doc install-examples install-manual install-unittests $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) install-doc: $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES) $(PDOBJECTS))" || \ $(INSTALL_DATA) $(HELPPATCHES) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt $(INSTALL_DATA) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt install-examples: test -z "$(strip $(EXAMPLES))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ for file in $(EXAMPLES); do \ $(INSTALL_DATA) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ done install-manual: test -z "$(strip $(MANUAL))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ for file in $(MANUAL); do \ $(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ done install-unittests: test -z "$(strip $(UNITTESTS))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests && \ for file in $(UNITTESTS); do \ $(INSTALL_DATA) unittests/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests; \ done clean: -rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) $(SHARED_SOURCE:.c=.o) -rm -f -- $(SOURCES:.c=.$(EXTENSION)) -rm -f -- $(LIBRARY_NAME).o -rm -f -- $(LIBRARY_NAME).$(EXTENSION) -rm -f -- $(SHARED_LIB) distclean: clean -rm -f -- $(DISTBINDIR).tar.gz -rm -rf -- $(DISTBINDIR) -rm -f -- $(DISTDIR).tar.gz -rm -rf -- $(DISTDIR) -rm -f -- $(ORIGDIR).tar.gz -rm -rf -- $(ORIGDIR) $(DISTBINDIR): $(INSTALL_DIR) $(DISTBINDIR) libdir: all $(DISTBINDIR) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) $(INSTALL_DATA) $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) $(DISTBINDIR) $(INSTALL_DATA) $(HELPPATCHES) $(DISTBINDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_DATA) $(EXTRA_DIST) $(DISTBINDIR) # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) $(DISTDIR): $(INSTALL_DIR) $(DISTDIR) $(ORIGDIR): $(INSTALL_DIR) $(ORIGDIR) dist: $(DISTDIR) $(INSTALL_DATA) Makefile $(DISTDIR) $(INSTALL_DATA) README.txt $(DISTDIR) $(INSTALL_DATA) LICENSE.txt $(DISTDIR) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_DATA) $(ALLSOURCES) $(DISTDIR) test -z "$(strip $(wildcard $(ALLSOURCES:.c=.tcl)))" || \ $(INSTALL_DATA) $(wildcard $(ALLSOURCES:.c=.tcl)) $(DISTDIR) test -z "$(strip $(wildcard $(LIBRARY_NAME).c))" || \ $(INSTALL_DATA) $(LIBRARY_NAME).c $(DISTDIR) test -z "$(strip $(SHARED_HEADER))" || \ $(INSTALL_DATA) $(SHARED_HEADER) $(DISTDIR) test -z "$(strip $(SHARED_SOURCE))" || \ $(INSTALL_DATA) $(SHARED_SOURCE) $(DISTDIR) test -z "$(strip $(SHARED_TCL_LIB))" || \ $(INSTALL_DATA) $(SHARED_TCL_LIB) $(DISTDIR) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_DATA) $(PDOBJECTS) $(DISTDIR) test -z "$(strip $(HELPPATCHES))" || \ $(INSTALL_DATA) $(HELPPATCHES) $(DISTDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_DATA) $(EXTRA_DIST) $(DISTDIR) test -z "$(strip $(EXAMPLES))" || \ $(INSTALL_DIR) $(DISTDIR)/examples && \ for file in $(EXAMPLES); do \ $(INSTALL_DATA) examples/$$file $(DISTDIR)/examples; \ done test -z "$(strip $(MANUAL))" || \ $(INSTALL_DIR) $(DISTDIR)/manual && \ for file in $(MANUAL); do \ $(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \ done test -z "$(strip $(UNITTESTS))" || \ $(INSTALL_DIR) $(DISTDIR)/unittests && \ for file in $(UNITTESTS); do \ $(INSTALL_DATA) unittests/$$file $(DISTDIR)/unittests; \ done tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) # make a Debian source package dpkg-source: debclean make distclean dist mv $(DISTDIR) $(ORIGDIR) tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR) rm -f -- $(DISTDIR).tar.gz rm -rf -- $(DISTDIR) $(ORIGDIR) cd .. && dpkg-source -b $(LIBRARY_NAME) etags: TAGS TAGS: $(wildcard $(PD_INCLUDE)/*.h) $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) etags $(wildcard $(PD_INCLUDE)/*.h) etags -a *.h $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) etags -a --language=none --regex="/proc[ \t]+\([^ \t]+\)/\1/" *.tcl showsetup: @echo "CC: $(CC)" @echo "CFLAGS: $(CFLAGS)" @echo "LDFLAGS: $(LDFLAGS)" @echo "LIBS: $(LIBS)" @echo "ALL_CFLAGS: $(ALL_CFLAGS)" @echo "ALL_LDFLAGS: $(ALL_LDFLAGS)" @echo "ALL_LIBS: $(ALL_LIBS)" @echo "PD_INCLUDE: $(PD_INCLUDE)" @echo "PD_PATH: $(PD_PATH)" @echo "objectsdir: $(objectsdir)" @echo "LIBRARY_NAME: $(LIBRARY_NAME)" @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" @echo "SOURCES: $(SOURCES)" @echo "SHARED_HEADER: $(SHARED_HEADER)" @echo "SHARED_SOURCE: $(SHARED_SOURCE)" @echo "SHARED_LIB: $(SHARED_LIB)" @echo "SHARED_TCL_LIB: $(SHARED_TCL_LIB)" @echo "PDOBJECTS: $(PDOBJECTS)" @echo "ALLSOURCES: $(ALLSOURCES)" @echo "ALLSOURCES TCL: $(wildcard $(ALLSOURCES:.c=.tcl))" @echo "UNAME: $(UNAME)" @echo "CPU: $(CPU)" @echo "pkglibdir: $(pkglibdir)" @echo "DISTDIR: $(DISTDIR)" @echo "ORIGDIR: $(ORIGDIR)" log-0.1/LICENSE.txt0000644000175000017500000000304111674625123014215 0ustar zmoelnigzmoelnigThis software is copyrighted by Miller Puckette and others. The following terms (the "Standard Improved BSD License") apply to all files associated with the software unless explicitly disclaimed in individual files: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. log-0.1/README.txt0000644000175000017500000000021711674625123014072 0ustar zmoelnigzmoelnig This readme file should describe what this library does, where to find more info and get help, and any specific instructions for building it. log-0.1/logpost.c0000644000175000017500000000464311722454745014242 0ustar zmoelnigzmoelnig #include "m_pd.h" static t_class *logpost_class; typedef struct _logpost { t_object x_obj; t_float level; t_symbol* tag; } t_logpost; static t_symbol* args2symbol(int argc, t_atom *argv) { t_symbol* s; char* buf; int bufsize; t_binbuf *bb = binbuf_new(); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &buf, &bufsize); buf = resizebytes(buf, bufsize, bufsize+1); buf[bufsize] = 0; s = gensym(buf); freebytes(buf, bufsize+1); binbuf_free(bb); return s; } static void logpost_bang(t_logpost *x) { logpost(x, (const int)x->level, "%s%sbang", x->tag->s_name, (*x->tag->s_name ? ": " : "")); } static void logpost_pointer(t_logpost *x, t_gpointer *gp) { logpost(x, (const int)x->level, "%s%s(pointer %lx)", x->tag->s_name, (*x->tag->s_name ? ": " : ""), gp); } static void logpost_float(t_logpost *x, t_float f) { logpost(x, (const int)x->level, "%s%s%g", x->tag->s_name, (*x->tag->s_name ? ": " : ""), f); } static void logpost_anything(t_logpost *x, t_symbol *s, int argc, t_atom *argv) { t_symbol* output = args2symbol(argc, argv); logpost(x, (const int)x->level, "%s%s%s %s", x->tag->s_name, (*x->tag->s_name ? ": " : ""), s->s_name, output->s_name); } static void *logpost_new(t_symbol *sel, int argc, t_atom *argv) { t_logpost *x = (t_logpost *)pd_new(logpost_class); x->tag = &s_; x->level = 2; t_symbol *sym = atom_getsymbolarg(0, argc, argv); if (sym != &s_) // oops, we have a symbol, use default logpost(x, 3, "[logpost] got '%s' instead of a float for the first argument", sym->s_name); else // we have a float x->level = atom_getfloatarg(0, argc, argv); if (argc > 1) { argc--; argv++; // lose the level arg x->tag = args2symbol(argc, argv); } floatinlet_new(&x->x_obj, &x->level); return (x); } void logpost_setup(void) { logpost_class = class_new(gensym("logpost"), (t_newmethod)logpost_new, 0, sizeof(t_logpost), CLASS_DEFAULT, A_GIMME, 0); class_addbang(logpost_class, logpost_bang); class_addfloat(logpost_class, logpost_float); class_addpointer(logpost_class, logpost_pointer); class_addanything(logpost_class, logpost_anything); } log-0.1/error-help.pd0000644000175000017500000000162411674625123015003 0ustar zmoelnigzmoelnig#N canvas 545 156 511 332 10; #X obj 49 38 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 47 120 symbol hello; #X msg 61 143 hello; #X text 22 7 post at different levels; #X obj 224 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 3100 1; #X obj 46 81 error; #X obj 53 289 error; #X obj 221 157 error this ia long box of test; #X msg 69 168 what is in here; #X msg 89 192 list this is a test; #X msg 90 226 list 1 2 3; #X msg 93 248 1 2 3; #X obj 285 55 pointer; #X msg 282 23 bang; #X obj 286 86 error; #X obj 255 287 error; #X msg 275 264 list; #X msg 275 242 list 1; #X msg 258 221 list word; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 4 0 7 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 11 0 6 0; #X connect 12 0 14 0; #X connect 13 0 12 0; #X connect 16 0 15 0; #X connect 17 0 15 0; #X connect 18 0 15 0; log-0.1/debug.c0000644000175000017500000000364311722454745013640 0ustar zmoelnigzmoelnig #include "m_pd.h" static t_class *debug_class; typedef struct _debug { t_object x_obj; int level; t_symbol* tag; } t_debug; static t_symbol* args2symbol(int argc, t_atom *argv) { t_symbol* s; char* buf; int bufsize; t_binbuf *bb = binbuf_new(); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &buf, &bufsize); buf = resizebytes(buf, bufsize, bufsize+1); buf[bufsize] = 0; s = gensym(buf); freebytes(buf, bufsize+1); binbuf_free(bb); return s; } static void debug_bang(t_debug *x) { logpost(x, x->level, "%s%sbang", x->tag->s_name, (*x->tag->s_name ? ": " : "")); } static void debug_pointer(t_debug *x, t_gpointer *gp) { logpost(x, x->level, "%s%s(pointer %lx)", x->tag->s_name, (*x->tag->s_name ? ": " : ""), gp); } static void debug_float(t_debug *x, t_float f) { logpost(x, (const int)x->level, "%s%s%g", x->tag->s_name, (*x->tag->s_name ? ": " : ""), f); } static void debug_anything(t_debug *x, t_symbol *s, int argc, t_atom *argv) { t_symbol* output = args2symbol(argc, argv); logpost(x, (const int)x->level, "%s%s%s %s", x->tag->s_name, (*x->tag->s_name ? ": " : ""), s->s_name, output->s_name); } static void *debug_new(t_symbol *s, int argc, t_atom *argv) { t_debug *x = (t_debug *)pd_new(debug_class); x->tag = &s_; x->level = 3; if (argc > 0) x->tag = args2symbol(argc, argv); return (x); } void debug_setup(void) { debug_class = class_new(gensym("debug"), (t_newmethod)debug_new, 0, sizeof(t_debug), CLASS_DEFAULT, A_GIMME, 0); class_addbang(debug_class, debug_bang); class_addfloat(debug_class, debug_float); class_addpointer(debug_class, debug_pointer); class_addanything(debug_class, debug_anything); } log-0.1/normal.c0000644000175000017500000000370411722454745014040 0ustar zmoelnigzmoelnig #include "m_pd.h" static t_class *normal_class; typedef struct _normal { t_object x_obj; int level; t_symbol* tag; } t_normal; static t_symbol* args2symbol(int argc, t_atom *argv) { t_symbol* s; char* buf; int bufsize; t_binbuf *bb = binbuf_new(); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &buf, &bufsize); buf = resizebytes(buf, bufsize, bufsize+1); buf[bufsize] = 0; s = gensym(buf); freebytes(buf, bufsize+1); binbuf_free(bb); return s; } static void normal_bang(t_normal *x) { logpost(x, x->level, "%s%sbang", x->tag->s_name, (*x->tag->s_name ? ": " : "")); } static void normal_pointer(t_normal *x, t_gpointer *gp) { logpost(x, x->level, "%s%s(pointer %lx)", x->tag->s_name, (*x->tag->s_name ? ": " : ""), gp); } static void normal_float(t_normal *x, t_float f) { logpost(x, (const int)x->level, "%s%s%g", x->tag->s_name, (*x->tag->s_name ? ": " : ""), f); } static void normal_anything(t_normal *x, t_symbol *s, int argc, t_atom *argv) { t_symbol* output = args2symbol(argc, argv); logpost(x, (const int)x->level, "%s%s%s %s", x->tag->s_name, (*x->tag->s_name ? ": " : ""), s->s_name, output->s_name); } static void *normal_new(t_symbol *s, int argc, t_atom *argv) { t_normal *x = (t_normal *)pd_new(normal_class); x->tag = &s_; x->level = 2; if (argc > 0) x->tag = args2symbol(argc, argv); return (x); } void normal_setup(void) { normal_class = class_new(gensym("normal"), (t_newmethod)normal_new, 0, sizeof(t_normal), CLASS_DEFAULT, A_GIMME, 0); class_addbang(normal_class, normal_bang); class_addfloat(normal_class, normal_float); class_addpointer(normal_class, normal_pointer); class_addanything(normal_class, normal_anything); } log-0.1/error.c0000644000175000017500000000364311722454745013703 0ustar zmoelnigzmoelnig #include "m_pd.h" static t_class *error_class; typedef struct _error { t_object x_obj; int level; t_symbol* tag; } t_error; static t_symbol* args2symbol(int argc, t_atom *argv) { t_symbol* s; char* buf; int bufsize; t_binbuf *bb = binbuf_new(); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &buf, &bufsize); buf = resizebytes(buf, bufsize, bufsize+1); buf[bufsize] = 0; s = gensym(buf); freebytes(buf, bufsize+1); binbuf_free(bb); return s; } static void error_bang(t_error *x) { logpost(x, x->level, "%s%sbang", x->tag->s_name, (*x->tag->s_name ? ": " : "")); } static void error_pointer(t_error *x, t_gpointer *gp) { logpost(x, x->level, "%s%s(pointer %lx)", x->tag->s_name, (*x->tag->s_name ? ": " : ""), gp); } static void error_float(t_error *x, t_float f) { logpost(x, (const int)x->level, "%s%s%g", x->tag->s_name, (*x->tag->s_name ? ": " : ""), f); } static void error_anything(t_error *x, t_symbol *s, int argc, t_atom *argv) { t_symbol* output = args2symbol(argc, argv); logpost(x, (const int)x->level, "%s%s%s %s", x->tag->s_name, (*x->tag->s_name ? ": " : ""), s->s_name, output->s_name); } static void *error_new(t_symbol *s, int argc, t_atom *argv) { t_error *x = (t_error *)pd_new(error_class); x->tag = &s_; x->level = 1; if (argc > 0) x->tag = args2symbol(argc, argv); return (x); } void error_setup(void) { error_class = class_new(gensym("error"), (t_newmethod)error_new, 0, sizeof(t_error), CLASS_DEFAULT, A_GIMME, 0); class_addbang(error_class, error_bang); class_addfloat(error_class, error_float); class_addpointer(error_class, error_pointer); class_addanything(error_class, error_anything); } log-0.1/normal-help.pd0000644000175000017500000000163111674625123015140 0ustar zmoelnigzmoelnig#N canvas 545 156 511 332 10; #X obj 49 38 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 47 120 symbol hello; #X msg 61 143 hello; #X text 22 7 post at different levels; #X obj 224 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 3100 1; #X obj 46 81 normal; #X obj 53 289 normal; #X obj 221 157 normal this ia long box of test; #X msg 69 168 what is in here; #X msg 89 192 list this is a test; #X msg 90 226 list 1 2 3; #X msg 93 248 1 2 3; #X obj 285 55 pointer; #X msg 282 23 bang; #X obj 286 86 normal; #X obj 255 287 normal; #X msg 275 264 list; #X msg 275 242 list 1; #X msg 258 221 list word; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 4 0 7 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 11 0 6 0; #X connect 12 0 14 0; #X connect 13 0 12 0; #X connect 16 0 15 0; #X connect 17 0 15 0; #X connect 18 0 15 0; log-0.1/debug-help.pd0000644000175000017500000000162411674625123014740 0ustar zmoelnigzmoelnig#N canvas 545 156 511 332 10; #X obj 49 38 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 47 120 symbol hello; #X msg 61 143 hello; #X text 22 7 post at different levels; #X obj 224 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 3100 1; #X obj 46 81 debug; #X obj 53 289 debug; #X obj 221 157 debug this ia long box of test; #X msg 69 168 what is in here; #X msg 89 192 list this is a test; #X msg 90 226 list 1 2 3; #X msg 93 248 1 2 3; #X obj 285 55 pointer; #X msg 282 23 bang; #X obj 286 86 debug; #X obj 255 287 debug; #X msg 275 264 list; #X msg 275 242 list 1; #X msg 258 221 list word; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 4 0 7 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 11 0 6 0; #X connect 12 0 14 0; #X connect 13 0 12 0; #X connect 16 0 15 0; #X connect 17 0 15 0; #X connect 18 0 15 0; log-0.1/log-meta.pd0000644000175000017500000000033511722454745014433 0ustar zmoelnigzmoelnig#N canvas 15 49 200 200 10; #N canvas 25 49 420 300 META 1; #X text 13 10 NAME log; #X text 10 30 AUTHOR hans@eds.org; #X text 10 50 VERSION 0.1; #X text 10 70 DESCRIPTION a library for logging; #X restore 10 10 pd META; log-0.1/fatal-help.pd0000644000175000017500000000162411674625123014741 0ustar zmoelnigzmoelnig#N canvas 545 156 511 332 10; #X obj 49 38 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 47 120 symbol hello; #X msg 61 143 hello; #X text 22 7 post at different levels; #X obj 224 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 3100 1; #X obj 46 81 fatal; #X obj 53 289 fatal; #X obj 221 157 fatal this ia long box of test; #X msg 69 168 what is in here; #X msg 89 192 list this is a test; #X msg 90 226 list 1 2 3; #X msg 93 248 1 2 3; #X obj 285 55 pointer; #X msg 282 23 bang; #X obj 286 86 fatal; #X obj 255 287 fatal; #X msg 275 264 list; #X msg 275 242 list 1; #X msg 258 221 list word; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 4 0 7 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 11 0 6 0; #X connect 12 0 14 0; #X connect 13 0 12 0; #X connect 16 0 15 0; #X connect 17 0 15 0; #X connect 18 0 15 0;