From 7601ef8eabc854709b5bdb312de9e7cee34a8c20 Mon Sep 17 00:00:00 2001 From: Bryan Jurish Date: Fri, 23 Jan 2009 21:50:38 +0000 Subject: + added branch pdstring+wchar/ from pdstring/ svn path=/trunk/externals/moocow/; revision=10606 --- pdstring+wchar/src/Makefile.am | 146 +++++++ pdstring+wchar/src/Makefile.in | 708 +++++++++++++++++++++++++++++++++ pdstring+wchar/src/any2string-help.pd | 39 ++ pdstring+wchar/src/any2string.c | 239 +++++++++++ pdstring+wchar/src/any2string_static.c | 246 ++++++++++++ pdstring+wchar/src/config.h.in | 40 ++ pdstring+wchar/src/mooPdUtils.h | 1 + pdstring+wchar/src/pdstring-help.pd | 59 +++ pdstring+wchar/src/pdstring.c | 110 +++++ pdstring+wchar/src/string2any-help.pd | 46 +++ pdstring+wchar/src/string2any.c | 249 ++++++++++++ pdstring+wchar/src/unsigned.pd | 27 ++ 12 files changed, 1910 insertions(+) create mode 100644 pdstring+wchar/src/Makefile.am create mode 100644 pdstring+wchar/src/Makefile.in create mode 100644 pdstring+wchar/src/any2string-help.pd create mode 100644 pdstring+wchar/src/any2string.c create mode 100644 pdstring+wchar/src/any2string_static.c create mode 100644 pdstring+wchar/src/config.h.in create mode 120000 pdstring+wchar/src/mooPdUtils.h create mode 100644 pdstring+wchar/src/pdstring-help.pd create mode 100644 pdstring+wchar/src/pdstring.c create mode 100644 pdstring+wchar/src/string2any-help.pd create mode 100644 pdstring+wchar/src/string2any.c create mode 100644 pdstring+wchar/src/unsigned.pd (limited to 'pdstring+wchar/src') diff --git a/pdstring+wchar/src/Makefile.am b/pdstring+wchar/src/Makefile.am new file mode 100644 index 0000000..73d1366 --- /dev/null +++ b/pdstring+wchar/src/Makefile.am @@ -0,0 +1,146 @@ +# File: ./src/Makefile.am +# Package: pdstring +# Description: +# + src-level automake file +# +# Process this file with Automake to create Makefile.in. +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Options & Subdirectories +#----------------------------------------------------------------------- + +## --- recursion subdirectories +#SUBDIRS = + +## --- pseudo-deps for '.SUFFIXES' +SUFFIXES = .@PDEXT@ + +#----------------------------------------------------------------------- +# Flags and variables +#----------------------------------------------------------------------- +PDEXT = @PDEXT@ +EXEEXT = .@PDEXT@ + +#----------------------------------------------------------------------- +# pd externals (hacked _PROGRAMS target) +#----------------------------------------------------------------------- + +## --- externals +pdexterns_PROGRAMS = @PD_OBJECT_EXTERNALS@ + +## --- possible externals +EXTRA_PROGRAMS = \ + pdstring \ + any2string \ + string2any + +## --- patches +pdexterns_DATA = + +## --- documentation +pddoc_DATA = \ + pdstring-help.pd \ + any2string-help.pd \ + string2any-help.pd + + +#----------------------------------------------------------------------- +# sources +#----------------------------------------------------------------------- + +pdstring_SOURCES = pdstring.c mooPdUtils.h + +any2string_SOURCES = any2string.c mooPdUtils.h + +string2any_SOURCES = string2any.c mooPdUtils.h + +#----------------------------------------------------------------------- +# external compilation : flags +#----------------------------------------------------------------------- +DEFS = @DEFS@ +AFLAGS = @AFLAGS@ +DFLAGS = @DFLAGS@ +IFLAGS = @IFLAGS@ +LFLAGS = @LFLAGS@ +OFLAGS = @OFLAGS@ +WFLAGS = -Wall -Winline + +#GLIB_IFLAGS = @GLIB_IFLAGS@ +#GLIB_LFLAGS = @GLIB_LFLAGS@ + +AM_CPPFLAGS = $(IFLAGS) $(GLIB_IFLAGS) $(DFLAGS) +AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) + +pdstring_LDFLAGS = $(LFLAGS) + +string2any_LDFLAGS = $(LFLAGS) + +any2string_LDFLAGS = $(LFLAGS) + +#----------------------------------------------------------------------- +# Variables: cleanup +#----------------------------------------------------------------------- +## --- mostlyclean: built by 'make' & commonly rebuilt +#MOSTLYCLEANFILES = + +## --- clean: built by 'make' +CLEANFILES = *.$(PDEXT) + +## --- distclean: built by 'configure' +DISTCLEANFILES = \ + config.log \ + config.cache \ + config.status + +## -- maintainerclean: built by maintainer / by hand +MAINTAINERCLEANFILES = *~ \ + $(PODS:.pod=.txt) \ + Makefile Makefile.in \ + aclocal.m4 \ + configure \ + install-sh \ + stamp-h.in \ + config.h.in + +maintainer-clean-local: + rm -rf autom4te.cache + +#CVSCLEAN_SUBDIRS = $(SUBDIRS) + +#CVSCLEANFILES = Makefile.in Makefile + + +#----------------------------------------------------------------------- +# Variables: distribution +#----------------------------------------------------------------------- + +## --- extra distribution files +EXTRA_DIST = \ + $(pddoc_DATA) \ + $(pdexterns_DATA) + +## --- recursion subdirectories for 'make dist' +DIST_SUBDIRS = $(SUBDIRS) + +## --- dist-hook: when another 'Makefile.am' is overkill +#DISTHOOK_DIRS = foo +#DISTHOOK_FILES = foo/bar.txt foo/baz.txt +#dist-hook: +# for d in $(DISTHOOK_DIRS); do\ +# mkdir -p $(distdir)/$$d ;\ +# done +# for f in $(DISTHOOK_FILES); do\ +# cp -p $(srcdir)/$$f $(distdir)/$$f ;\ +# done + +#dist-bz2: dist-bzip2 ; + + +#----------------------------------------------------------------------- +# Rules: cleanup +#----------------------------------------------------------------------- +.PHONY: cvsclean cvsclean-hook + +cvsclean: maintainer-clean ; + diff --git a/pdstring+wchar/src/Makefile.in b/pdstring+wchar/src/Makefile.in new file mode 100644 index 0000000..f454607 --- /dev/null +++ b/pdstring+wchar/src/Makefile.in @@ -0,0 +1,708 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# File: ./src/Makefile.am +# Package: pdstring +# Description: +# + src-level automake file +# +# Process this file with Automake to create Makefile.in. +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Options & Subdirectories +#----------------------------------------------------------------------- + +#SUBDIRS = + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +pdexterns_PROGRAMS = @PD_OBJECT_EXTERNALS@ +EXTRA_PROGRAMS = pdstring$(EXEEXT) any2string$(EXEEXT) \ + string2any$(EXEEXT) +subdir = src +SUBDIRS = +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(pdexternsdir)" "$(DESTDIR)$(pddocdir)" \ + "$(DESTDIR)$(pdexternsdir)" +pdexternsPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(pdexterns_PROGRAMS) +am_any2string_OBJECTS = any2string.$(OBJEXT) +any2string_OBJECTS = $(am_any2string_OBJECTS) +any2string_LDADD = $(LDADD) +am_pdstring_OBJECTS = pdstring.$(OBJEXT) +pdstring_OBJECTS = $(am_pdstring_OBJECTS) +pdstring_LDADD = $(LDADD) +am_string2any_OBJECTS = string2any.$(OBJEXT) +string2any_OBJECTS = $(am_string2any_OBJECTS) +string2any_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(any2string_SOURCES) $(pdstring_SOURCES) \ + $(string2any_SOURCES) +DIST_SOURCES = $(any2string_SOURCES) $(pdstring_SOURCES) \ + $(string2any_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +pddocDATA_INSTALL = $(INSTALL_DATA) +pdexternsDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pddoc_DATA) $(pdexterns_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AFLAGS = @AFLAGS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUGREPORT = @BUGREPORT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG = @DEBUG@ + +#----------------------------------------------------------------------- +# external compilation : flags +#----------------------------------------------------------------------- +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DFLAGS = @DFLAGS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EXEEXT = .@PDEXT@ +IFLAGS = @IFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LFLAGS = @LFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OFLAGS = @OFLAGS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +#----------------------------------------------------------------------- +# Flags and variables +#----------------------------------------------------------------------- +PDEXT = @PDEXT@ +PD_OBJECT_EXTERNALS = @PD_OBJECT_EXTERNALS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WFLAGS = -Wall -Winline +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pddir = @pddir@ +pddocdir = @pddocdir@ +pdexternsdir = @pdexternsdir@ +pdfdir = @pdfdir@ +pdincludedir = @pdincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUFFIXES = .@PDEXT@ +pdexterns_DATA = +pddoc_DATA = \ + pdstring-help.pd \ + any2string-help.pd \ + string2any-help.pd + + +#----------------------------------------------------------------------- +# sources +#----------------------------------------------------------------------- +pdstring_SOURCES = pdstring.c mooPdUtils.h +any2string_SOURCES = any2string.c mooPdUtils.h +string2any_SOURCES = string2any.c mooPdUtils.h + +#GLIB_IFLAGS = @GLIB_IFLAGS@ +#GLIB_LFLAGS = @GLIB_LFLAGS@ +AM_CPPFLAGS = $(IFLAGS) $(GLIB_IFLAGS) $(DFLAGS) +AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) +pdstring_LDFLAGS = $(LFLAGS) +string2any_LDFLAGS = $(LFLAGS) +any2string_LDFLAGS = $(LFLAGS) + +#----------------------------------------------------------------------- +# Variables: cleanup +#----------------------------------------------------------------------- +#MOSTLYCLEANFILES = +CLEANFILES = *.$(PDEXT) +DISTCLEANFILES = \ + config.log \ + config.cache \ + config.status + +MAINTAINERCLEANFILES = *~ \ + $(PODS:.pod=.txt) \ + Makefile Makefile.in \ + aclocal.m4 \ + configure \ + install-sh \ + stamp-h.in \ + config.h.in + + +#CVSCLEAN_SUBDIRS = $(SUBDIRS) + +#CVSCLEANFILES = Makefile.in Makefile + +#----------------------------------------------------------------------- +# Variables: distribution +#----------------------------------------------------------------------- +EXTRA_DIST = \ + $(pddoc_DATA) \ + $(pdexterns_DATA) + +DIST_SUBDIRS = $(SUBDIRS) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .@PDEXT@ .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +install-pdexternsPROGRAMS: $(pdexterns_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(pdexternsdir)" || $(mkdir_p) "$(DESTDIR)$(pdexternsdir)" + @list='$(pdexterns_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(pdexternsPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(pdexternsdir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(pdexternsPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(pdexternsdir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-pdexternsPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(pdexterns_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(pdexternsdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdexternsdir)/$$f"; \ + done + +clean-pdexternsPROGRAMS: + -test -z "$(pdexterns_PROGRAMS)" || rm -f $(pdexterns_PROGRAMS) +any2string$(EXEEXT): $(any2string_OBJECTS) $(any2string_DEPENDENCIES) + @rm -f any2string$(EXEEXT) + $(LINK) $(any2string_LDFLAGS) $(any2string_OBJECTS) $(any2string_LDADD) $(LIBS) +pdstring$(EXEEXT): $(pdstring_OBJECTS) $(pdstring_DEPENDENCIES) + @rm -f pdstring$(EXEEXT) + $(LINK) $(pdstring_LDFLAGS) $(pdstring_OBJECTS) $(pdstring_LDADD) $(LIBS) +string2any$(EXEEXT): $(string2any_OBJECTS) $(string2any_DEPENDENCIES) + @rm -f string2any$(EXEEXT) + $(LINK) $(string2any_LDFLAGS) $(string2any_OBJECTS) $(string2any_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/any2string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdstring.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string2any.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: +install-pddocDATA: $(pddoc_DATA) + @$(NORMAL_INSTALL) + test -z "$(pddocdir)" || $(mkdir_p) "$(DESTDIR)$(pddocdir)" + @list='$(pddoc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pddocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pddocdir)/$$f'"; \ + $(pddocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pddocdir)/$$f"; \ + done + +uninstall-pddocDATA: + @$(NORMAL_UNINSTALL) + @list='$(pddoc_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pddocdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pddocdir)/$$f"; \ + done +install-pdexternsDATA: $(pdexterns_DATA) + @$(NORMAL_INSTALL) + test -z "$(pdexternsdir)" || $(mkdir_p) "$(DESTDIR)$(pdexternsdir)" + @list='$(pdexterns_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pdexternsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pdexternsdir)/$$f'"; \ + $(pdexternsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pdexternsdir)/$$f"; \ + done + +uninstall-pdexternsDATA: + @$(NORMAL_UNINSTALL) + @list='$(pdexterns_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdexternsdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdexternsdir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pdexternsdir)" "$(DESTDIR)$(pddocdir)" "$(DESTDIR)$(pdexternsdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-pdexternsPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-pddocDATA install-pdexternsDATA \ + install-pdexternsPROGRAMS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pddocDATA \ + uninstall-pdexternsDATA uninstall-pdexternsPROGRAMS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-pdexternsPROGRAMS clean-recursive \ + ctags ctags-recursive distclean distclean-compile \ + distclean-generic distclean-hdr distclean-recursive \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-pddocDATA install-pdexternsDATA \ + install-pdexternsPROGRAMS install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-local \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-pddocDATA uninstall-pdexternsDATA \ + uninstall-pdexternsPROGRAMS + + +maintainer-clean-local: + rm -rf autom4te.cache + +#DISTHOOK_DIRS = foo +#DISTHOOK_FILES = foo/bar.txt foo/baz.txt +#dist-hook: +# for d in $(DISTHOOK_DIRS); do\ +# mkdir -p $(distdir)/$$d ;\ +# done +# for f in $(DISTHOOK_FILES); do\ +# cp -p $(srcdir)/$$f $(distdir)/$$f ;\ +# done + +#dist-bz2: dist-bzip2 ; + +#----------------------------------------------------------------------- +# Rules: cleanup +#----------------------------------------------------------------------- +.PHONY: cvsclean cvsclean-hook + +cvsclean: maintainer-clean ; +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pdstring+wchar/src/any2string-help.pd b/pdstring+wchar/src/any2string-help.pd new file mode 100644 index 0000000..873070c --- /dev/null +++ b/pdstring+wchar/src/any2string-help.pd @@ -0,0 +1,39 @@ +#N canvas 90 20 636 478 10; +#X obj 25 400 print any2string-help; +#X obj 25 314 any2string 128 -1; +#X msg 109 197 0; +#X msg 77 197 -1; +#X text 19 47 INLETS:; +#X text 31 61 1 - pd messages; +#X text 247 49 OUTLETS:; +#X text 263 63 1 - lists of ASCII-valued floats; +#X floatatom 44 147 8 0 0 0 - - -; +#X symbolatom 34 125 10 0 0 0 - - -; +#X text 189 125 ... no special handling for symbols; +#X text 188 103 anything can be converted to a list...; +#X text 190 147 ... but "float" selector is silently dropped; +#X msg 25 104 A B C; +#X text 193 312 First argument: initial buffer size (length of object-local +text buffer). This should get re-allocated when necessary. Specify +0 (zero) to use the default value.; +#X text 195 367 Second argument: initial EOS character. See above. +; +#X text 320 458 Bryan Jurish ; +#X text 19 439 SEE ALSO:; +#X msg 139 197 42; +#X text 21 29 SYNTAX: any2string [INITIAL_BUFSIZE [EOS_CHAR]]; +#X text 184 194 The second inlet sets the terminating EOS ("end-of-string") +character. This value gets implicitly appended to all output lists. +Specify a negative value here to avoid implicit EOS characters entirely. +For backwards compatibility \, the default EOS character is 0 (zero). +; +#X text 51 5 any2string : convert pd messages to a list of floats; +#X text 31 75 2 - EOS character (float); +#X obj 100 438 pdstring; +#X connect 1 0 0 0; +#X connect 2 0 1 1; +#X connect 3 0 1 1; +#X connect 8 0 1 0; +#X connect 9 0 1 0; +#X connect 13 0 1 0; +#X connect 18 0 1 1; diff --git a/pdstring+wchar/src/any2string.c b/pdstring+wchar/src/any2string.c new file mode 100644 index 0000000..deb4b9b --- /dev/null +++ b/pdstring+wchar/src/any2string.c @@ -0,0 +1,239 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: any2string.c + * Author: Bryan Jurish + * Description: convert pd messages to strings (dynamic allocation) + * + * Copyright (c) 2004 - 2009 Bryan Jurish. + * + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file "COPYING", in this distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *=============================================================================*/ + +#include +#include +#include "mooPdUtils.h" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* black magic */ +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +/*-------------------------------------------------------------------- + * DEBUG + *--------------------------------------------------------------------*/ +/*#define ANY2STRING_DEBUG 1*/ + +#ifdef ANY2STRING_DEBUG +# define A2SDEBUG(x) x +#else +# define A2SDEBUG(x) +#endif + +#define ANY2STRING_DEFAULT_BUFLEN 256 + + +/*===================================================================== + * Structures and Types: any2string + *=====================================================================*/ +static t_class *any2string_class; + +typedef struct _any2string +{ + t_object x_obj; + int x_alloc; + int x_argc; + t_float x_eos; //-- EOS character to add (<0 for none) + char *x_text; + t_atom *x_argv; + t_binbuf *x_binbuf; + t_inlet *x_eos_in; + t_outlet *x_outlet; +} t_any2string; + + +/*===================================================================== + * Constants + *=====================================================================*/ +static char *any2string_banner = "any2string: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; + +/*===================================================================== + * Methods + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * anything + */ +static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom *argv) +{ + t_atom *ap; + unsigned char *s, *s_max; + int len; + + A2SDEBUG(post("-------any2string_anything(%p,...)---------", x)); + + /*-- set up binbuf --*/ + A2SDEBUG(post("any2string[%p]: binbuf_clear()", x)); + binbuf_clear(x->x_binbuf); + + /*-- binbuf_add(): selector --*/ + if (sel != &s_float && sel != &s_list && sel != &s_) { + t_atom a; + A2SDEBUG(post("any2string[%p]: binbuf_add(): selector: '%s'", x, sel->s_name)); + SETSYMBOL((&a), sel); + binbuf_add(x->x_binbuf, 1, &a); + } + A2SDEBUG(else { post("any2string[%p]: selector: '%s': IGNORED", x, sel->s_name); }); + + /*-- binbuf_add(): arg list --*/ + A2SDEBUG(post("any2string[%p]: binbuf_add(): arg list", x)); + binbuf_add(x->x_binbuf, argc, argv); + A2SDEBUG(post("any2string[%p]: binbuf_print: ", x)); + A2SDEBUG(binbuf_print(x->x_binbuf)); + + A2SDEBUG(post("any2string[%p]: binbuf_gettext()", x)); + binbuf_gettext(x->x_binbuf, &(x->x_text), &len); + A2SDEBUG(post("any2string[%p]: binbuf_gettext() = \"%s\" ; len=%d", x, x->x_text, len)); + /*text[len] = 0;*/ /*-- ? avoid errors: "free(): invalid next size(fast): 0x..." */ + + /*-- get output atom-list length --*/ + x->x_argc = len; + if (x->x_eos >= 0) { x->x_argc++; } + A2SDEBUG(post("any2string[%p]: argc=%d", x, x->x_argc)); + + /*-- (re-)allocate (maybe) --*/ + if (x->x_alloc < x->x_argc) { + A2SDEBUG(post("any2string[%p]: reallocate(%d->%d)", x, x->x_alloc, x->x_argc)); + freebytes(x->x_argv, x->x_alloc*sizeof(t_atom)); + x->x_argv = (t_atom*)getbytes(x->x_argc * sizeof(t_atom)); + x->x_alloc = x->x_argc; + } + + /*-- atom buffer: binbuf text --*/ + A2SDEBUG(post("any2string[%p]: atom buffer: for {...}", x)); + ap = x->x_argv; + s_max = ((unsigned char *)x->x_text)+len; + for (s=((unsigned char *)x->x_text); s < s_max; s++, ap++) { + A2SDEBUG(post("any2string[%p]: atom buffer[%d]: SETFLOAT(a,%d='%c')", x, (ap-x->x_argv), *s, *s)); + SETFLOAT(ap,*s); + } + A2SDEBUG(post("any2string: atom buffer: DONE")); + + /*-- add EOS character (maybe) --*/ + if (x->x_eos >= 0) { SETFLOAT(ap, ((int)x->x_eos)); } + + A2SDEBUG(post("any2string: outlet_list(..., %d, ...)", x->x_argc)); + outlet_list(x->x_outlet, &s_list, x->x_argc, x->x_argv); +} + + +/*-------------------------------------------------------------------- + * new + */ +static void *any2string_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + t_any2string *x = (t_any2string *)pd_new(any2string_class); + + //-- defaults + x->x_eos = 0; + x->x_alloc = ANY2STRING_DEFAULT_BUFLEN; + + //-- args: 0: bufsize + if (argc > 0) { + int bufsize = atom_getintarg(0, argc, argv); + if (bufsize > 0) { x->x_alloc = bufsize; } + } + //-- args: 1: eos + if (argc > 1) { + x->x_eos = atom_getfloatarg(1, argc, argv); + } + + //-- allocate + x->x_text = getbytes(x->x_alloc*sizeof(char)); + x->x_argc = 0; + x->x_argv = (t_atom *)getbytes(x->x_alloc*sizeof(t_atom)); + x->x_binbuf = binbuf_new(); + + //-- inlets + x->x_eos_in = floatinlet_new(&x->x_obj, &x->x_eos); + + //-- outlets + x->x_outlet = outlet_new(&x->x_obj, &s_list); + + //-- report + A2SDEBUG(post("any2string_new(): x=%p, alloc=%d, eos=%d, text=%p, argv=%p, binbuf=%p", x, x->x_alloc, x->x_eos, x->x_text, x->x_argv, x->x_binbuf)); + + return (void *)x; +} + +/*-------------------------------------------------------------------- + * free + */ +static void any2string_free(t_any2string *x) +{ + if (x->x_text) { + freebytes(x->x_text, x->x_alloc*sizeof(char)); + x->x_text = NULL; + } + if (x->x_argv) { + freebytes(x->x_argv, x->x_alloc*sizeof(t_atom)); + x->x_argv = NULL; + } + binbuf_free(x->x_binbuf); + inlet_free(x->x_eos_in); + outlet_free(x->x_outlet); + return; +} + +/*-------------------------------------------------------------------- + * setup (guts) + */ +void any2string_setup_guts(void) +{ + //-- class + any2string_class = class_new(gensym("any2string"), + (t_newmethod)any2string_new, + (t_method)any2string_free, + sizeof(t_any2string), + CLASS_DEFAULT, + A_GIMME, //-- initial_bufsize, eos_char + 0); + + //-- alias + class_addcreator((t_newmethod)any2string_new, gensym("any2bytes"), A_GIMME, 0); + + //-- methods + class_addanything(any2string_class, (t_method)any2string_anything); + + //-- help symbol + //class_sethelpsymbol(any2string_class, gensym("any2string-help.pd")); //-- breaks pd-extended help lookup +} + + +/*-------------------------------------------------------------------- + * setup + */ +void any2string_setup(void) +{ + post(any2string_banner); + any2string_setup_guts(); +} diff --git a/pdstring+wchar/src/any2string_static.c b/pdstring+wchar/src/any2string_static.c new file mode 100644 index 0000000..50da35d --- /dev/null +++ b/pdstring+wchar/src/any2string_static.c @@ -0,0 +1,246 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: any2string_static.c + * Author: Bryan Jurish + * Description: convert pd messages to strings (static buffer allocation) + * + * Copyright (c) 2004 - 2007 Bryan Jurish. + * + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file "COPYING", in this distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *=============================================================================*/ + +#include +#include + +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* black magic */ +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +/*-------------------------------------------------------------------- + * DEBUG + *--------------------------------------------------------------------*/ +/*#define ANY2STRING_DEBUG 1*/ +/*#undef ANY2STRING_DEBUG*/ + +#ifdef ANY2STRING_DEBUG +# define A2SDEBUG(x) x +#else +# define A2SDEBUG(x) +#endif + +#define ANY2STRING_DEFAULT_BUFLEN 512 + + +/*===================================================================== + * Structures and Types: any2string + *=====================================================================*/ +static t_class *any2string_class; + +typedef struct _any2string +{ + t_object x_obj; + int x_alloc; //-- buffer size (text, x_argv) + int x_argc; //-- current number of atoms to outlet + t_atom *x_argv; //-- float-list to outlet + t_outlet *x_outlet; //-- outlet +} t_any2string; + + +/*===================================================================== + * Utilities + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * append_string + */ +static void any2string_append_string(t_any2string *x, char *s, unsigned int maxlen, int doescape) +{ + char *sp; + char *ep = s+maxlen; + + for (sp=s; *sp && spx_argcx_alloc; sp++, x->x_argc++) { + if (doescape && (*sp==';' || *sp==',' || *sp=='\\' + || (*sp == '$' && sp<(ep-1) && sp[1] >= '0' && sp[1] <= '9'))) + { + A2SDEBUG(post("any2string_append_string: ESCAPE: x_argv[%d] = '%c' = %d", x->x_argc, '\\', '\\')); + x->x_argv[x->x_argc++].a_w.w_float = '\\'; + if (x->x_argc >= x->x_alloc) break; + } + A2SDEBUG(post("any2string_append_string: x_argv[%d] = '%c' = %d", x->x_argc, *sp, *sp)); + x->x_argv[x->x_argc].a_w.w_float = *sp; + } +} + +/*-------------------------------------------------------------------- + * append_atom + */ +#define ANY2STRING_APPEND_BUFSIZE 30 +static void any2string_append_atom(t_any2string *x, t_atom *a) +{ + char buf[ANY2STRING_APPEND_BUFSIZE]; + A2SDEBUG(post("~~ any2string_append_atom(%p,...) ~~", x)); + + if (x->x_argc >= x->x_alloc) { return; } + + /*-- stringify a single atom (inspired by atom_string() from m_atom.c) --*/ + switch (a->a_type) { + case A_SEMI: any2string_append_string(x, ";", 1, 0); break; + case A_COMMA: any2string_append_string(x, ",", 1, 0); break; + case A_POINTER: any2string_append_string(x, "(pointer)", 9, 0); break; + case A_FLOAT: + snprintf(buf, ANY2STRING_APPEND_BUFSIZE, "%g", a->a_w.w_float); + any2string_append_string(x, buf, ANY2STRING_APPEND_BUFSIZE, 0); + break; + case A_SYMBOL: + any2string_append_string(x, a->a_w.w_symbol->s_name, strlen(a->a_w.w_symbol->s_name), 1); + break; + case A_DOLLAR: + snprintf(buf, ANY2STRING_APPEND_BUFSIZE, "$%d", a->a_w.w_index); + any2string_append_string(x, buf, ANY2STRING_APPEND_BUFSIZE, 0); + break; + case A_DOLLSYM: + any2string_append_string(x, a->a_w.w_symbol->s_name, strlen(a->a_w.w_symbol->s_name), 0); + break; + default: + pd_error(x,"any2string_append_atom: unknown atom type '%d'", a->a_type); + break; + } + + if (x->x_argc < x->x_alloc) { + A2SDEBUG(post("any2string_append_atom[%p]: x_argv[%d] = '%c' = %d", x, x->x_argc, ' ', ' ')); + x->x_argv[x->x_argc++].a_w.w_float = ' '; + } +} + +/*===================================================================== + * Methods + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * anything + */ +static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom *argv) +{ + t_atom *argv_end = argv+argc; + x->x_argc=0; + + A2SDEBUG(post("-------any2string_anything(%p,...) ---------", x)); + + /*-- stringify selector (maybe) --*/ + if (sel != &s_float && sel != &s_list && sel != &s_) { + t_atom a; + SETSYMBOL(&a,sel); + any2string_append_atom(x, &a); + } + + /*-- stringify arg list --*/ + for ( ; argvx_argcx_alloc; argv++) { + any2string_append_atom(x, argv); + } + + /*-- add terminating NUL (if we can) --*/ + A2SDEBUG(post("any2string[%p]: terminating NUL: x_argv[%d]=0", x, x->x_argc-1)); + if (x->x_argc >= x->x_alloc) { + pd_error(x, "any2string: input length exceeds buffer size!"); + x->x_argc = x->x_alloc; + x->x_argv[x->x_argc-1].a_w.w_float = '*'; //-- simulate atom_string() behavior + } else if (x->x_argc > 0) { + x->x_argv[x->x_argc-1].a_w.w_float = 0; + } + + A2SDEBUG(post("any2string[%p]: outlet_list(..., %d, ...)", x, x->x_argc)); + outlet_list(x->x_outlet, &s_list, x->x_argc, x->x_argv); +} + + +/*-------------------------------------------------------------------- + * new + */ +static void *any2string_new(t_floatarg bufsize) +{ + t_any2string *x = (t_any2string *)pd_new(any2string_class); + int i; + + //-- bufsize + if (bufsize <= 0) { + x->x_alloc = ANY2STRING_DEFAULT_BUFLEN; + } else { + x->x_alloc = bufsize; + } + A2SDEBUG(post("any2string_new: buf_req=%g, alloc=%d", bufsize, x->x_alloc)); + + //-- defaults + x->x_argc = 0; + x->x_argv = (t_atom*)getbytes(x->x_alloc*sizeof(t_atom)); + + //-- initialize (set a_type) + for (i=0; i < x->x_alloc; i++) { + SETFLOAT((x->x_argv+i),0); + } + + //-- outlets + x->x_outlet = outlet_new(&x->x_obj, &s_list); + A2SDEBUG(post("any2string_new: x=%p, alloc=%d, argv=%p, nbytes=%d", x, x->x_alloc,x->x_argv,x->x_alloc*sizeof(t_atom))); + return (void *)x; +} + +/*-------------------------------------------------------------------- + * free + */ +static void any2string_free(t_any2string *x) +{ + A2SDEBUG(post("any2string_free(x=%p)", x)); + if (x->x_argv) { + A2SDEBUG(post("any2string_free(x=%p): x_argv=%p (size=%d)", x, x->x_argv, x->x_alloc*sizeof(t_atom))); + freebytes(x->x_argv, x->x_alloc*sizeof(t_atom)); + } + A2SDEBUG(post("any2string_free(x=%p): x_outlet=%p", x, x->x_outlet)); + outlet_free(x->x_outlet); + return; +} + +/*-------------------------------------------------------------------- + * setup + */ +void any2string_setup(void) +{ + //-- class + any2string_class = class_new(gensym("any2string"), + (t_newmethod)any2string_new, + (t_method)any2string_free, + sizeof(t_any2string), + CLASS_DEFAULT, + A_DEFFLOAT, + 0); + + //-- methods + class_addanything(any2string_class, + (t_method)any2string_anything); + + + //-- help symbol + class_sethelpsymbol(any2string_class, gensym("pdstring-help.pd")); +} diff --git a/pdstring+wchar/src/config.h.in b/pdstring+wchar/src/config.h.in new file mode 100644 index 0000000..fe4add7 --- /dev/null +++ b/pdstring+wchar/src/config.h.in @@ -0,0 +1,40 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define this to include debugging code for the 'string2any' external. */ +#undef ANY2STRING_DEBUG + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Date this external was configured */ +#undef PDSTRING_DATE + +/* Define this if you are building single-object externals */ +#undef PDSTRING_OBJECT_EXTERNALS + +/* User who configured this external */ +#undef PDSTRING_USER + +/* Define this to include debugging code for the 'any2string' external. */ +#undef STRING2ANY_DEBUG + +/* Version number of package */ +#undef VERSION diff --git a/pdstring+wchar/src/mooPdUtils.h b/pdstring+wchar/src/mooPdUtils.h new file mode 120000 index 0000000..0bb3280 --- /dev/null +++ b/pdstring+wchar/src/mooPdUtils.h @@ -0,0 +1 @@ +../../common/mooPdUtils.h \ No newline at end of file diff --git a/pdstring+wchar/src/pdstring-help.pd b/pdstring+wchar/src/pdstring-help.pd new file mode 100644 index 0000000..2ab94b3 --- /dev/null +++ b/pdstring+wchar/src/pdstring-help.pd @@ -0,0 +1,59 @@ +#N canvas 191 76 563 311 10; +#X text 258 284 Bryan Jurish ; +#X floatatom 56 81 8 0 0 0 - - -; +#X symbolatom 46 59 10 0 0 0 - - -; +#X text 201 59 ... no special handling for symbols; +#X text 200 37 anything can be converted to a list...; +#X obj 37 108 any2string; +#X obj 37 230 string2any; +#X floatatom 54 178 4 0 0 0 - - -; +#X text 213 230 string2any converts ASCII lists to Pd messages...; +#X text 202 81 ... but "float" selector is silently dropped; +#N canvas 0 0 448 335 ascii-table 0; +#X obj 162 144 f 0; +#X obj 134 153 + 1; +#X obj 161 165 t f f f; +#X obj 133 198 string2any; +#X obj 154 243 pack s 0; +#X obj 162 119 until; +#X obj 133 218 symbol; +#X msg 162 84 256; +#X msg 208 119 0; +#X obj 162 23 inlet; +#X obj 162 54 t b b; +#X obj 154 266 route list; +#X obj 154 293 print charset; +#X connect 0 0 2 0; +#X connect 1 0 0 1; +#X connect 2 0 1 0; +#X connect 2 1 3 0; +#X connect 2 2 4 1; +#X connect 3 0 6 0; +#X connect 4 0 11 0; +#X connect 5 0 0 0; +#X connect 6 0 4 0; +#X connect 7 0 5 0; +#X connect 8 0 0 1; +#X connect 9 0 10 0; +#X connect 10 0 7 0; +#X connect 10 1 8 0; +#X connect 11 0 12 0; +#X connect 11 1 12 0; +#X restore 249 144 pd ascii-table; +#X msg 249 121 bang; +#X text 361 143 know your charset; +#X obj 58 139 print any2string-out; +#X obj 37 254 print string2any-out; +#X msg 37 38 A B C; +#X msg 55 199 list 49 50 51; +#X text 54 3 any2string \, string2any : ASCII conversions in [pdstring] +lib; +#X connect 1 0 5 0; +#X connect 2 0 5 0; +#X connect 5 0 13 0; +#X connect 5 0 6 0; +#X connect 6 0 14 0; +#X connect 7 0 6 0; +#X connect 11 0 10 0; +#X connect 15 0 5 0; +#X connect 16 0 6 0; diff --git a/pdstring+wchar/src/pdstring.c b/pdstring+wchar/src/pdstring.c new file mode 100644 index 0000000..44add2d --- /dev/null +++ b/pdstring+wchar/src/pdstring.c @@ -0,0 +1,110 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: pdstring.c + * Author: Bryan Jurish + * Description: pd string conversions : library + * + * Copyright (c) 2004-2009 Bryan Jurish. + * + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file "COPYING", in this distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *=============================================================================*/ +#include +#include "mooPdUtils.h" + +/* black magic */ +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/*===================================================================== + * Constants + *=====================================================================*/ + +/*===================================================================== + * Structures and Types: pdstring [dummy] + *=====================================================================*/ +static t_class *pdstring_class; + +typedef struct _pdstring +{ + t_object x_obj; +} t_pdstring; + + +/*===================================================================== + * External declarations + *=====================================================================*/ +#ifndef PDSTRING_OBJECT_EXTERNALS +/* +extern void any2string_setup_guts(void); +extern void string2any_setup_guts(void); +*/ +#include "any2string.c" +#include "string2any.c" + +#endif + +/*-------------------------------------------------------------------- + * new + */ +static void *pdstring_new(void) +{ + t_pdstring *x = (t_pdstring *)pd_new(pdstring_class); + return x; +} + +/*-------------------------------------------------------------------- + * help + */ +static void pdstring_help(MOO_UNUSED t_pdstring *x) +{ + post(""); + post("pdstring: byte-string externals version " PACKAGE_VERSION " by Bryan Jurish"); + post("pdstring: compiled by " PDSTRING_USER " on " PDSTRING_DATE); +} + +/*===================================================================== + * Setup + *=====================================================================*/ +void pdstring_setup(void) +{ + pdstring_help(NULL); + +#ifndef PDSTRING_OBJECT_EXTERNALS + any2string_setup_guts(); + string2any_setup_guts(); +#endif + + pdstring_class = class_new(gensym("pdstring"), + (t_newmethod)pdstring_new, + 0, + sizeof(t_pdstring), + CLASS_DEFAULT, + 0); + + //-- help method + class_addmethod(pdstring_class, (t_method)pdstring_help, gensym("help"), A_NULL); + + //-- help symbol + //class_sethelpsymbol(pdstring_class, gensym("pdstring-help.pd")); //-- breaks pd-extended help lookup +} diff --git a/pdstring+wchar/src/string2any-help.pd b/pdstring+wchar/src/string2any-help.pd new file mode 100644 index 0000000..3d09fc7 --- /dev/null +++ b/pdstring+wchar/src/string2any-help.pd @@ -0,0 +1,46 @@ +#N canvas 121 48 612 604 10; +#X text 59 7 string2any : convert lists of floats to pd messages; +#X text 13 30 SYNTAX: string2any [INITIAL_BUFSIZE [EOS_CHAR]]; +#X text 13 52 INLETS:; +#X text 27 68 1 - ASCII-valued float lists; +#X text 309 54 OUTLETS:; +#X text 325 68 1 - pd messages; +#X text 325 82 2 - bang on done; +#X obj 24 350 string2any 128 0; +#X obj 24 529 print string2any-help; +#X obj 131 454 print string2any-help-done; +#X msg 24 113 97 32 98 32 99; +#X msg 39 135 97 0 98 0 99; +#X msg 99 206 0; +#X msg 67 206 -1; +#X msg 131 206 32; +#X text 166 202 The second inlet sets the message-separating EOS ("end-of-string") +character. If this character is encountered in an input list \, the +list is "split" at that point \, and two separate messages are output +at the leftmost outlet. You can specify a negative value here to avoid +implicit input splitting entirely. For backwards compatibility \, the +default EOS character is -1 \, which results in truncation of input +messages whenever a 0 (zero) is encountered.; +#X text 163 350 First argument: initial buffer size (length of object-local +text buffer). This should get re-allocated when necessary. Specify +0 (zero) to use the default value.; +#X text 165 405 Second argument: initial EOS character. See above. +; +#X text 159 477 Right outlet gives a bang after the entire input list +has been processed.; +#X text 189 531 Parsed pd messages are sent to the left outlet.; +#X text 306 580 Bryan Jurish ; +#X text 27 83 2 - EOS character (float); +#X text 161 121 lists of floats are converted to pd messages.; +#X msg 54 161 StringThing 97; +#X text 168 161 ... selector is ignored ...; +#X text 21 571 SEE ALSO:; +#X obj 102 570 pdstring; +#X connect 7 0 8 0; +#X connect 7 1 9 0; +#X connect 10 0 7 0; +#X connect 11 0 7 0; +#X connect 12 0 7 1; +#X connect 13 0 7 1; +#X connect 14 0 7 1; +#X connect 23 0 7 0; diff --git a/pdstring+wchar/src/string2any.c b/pdstring+wchar/src/string2any.c new file mode 100644 index 0000000..73eaae9 --- /dev/null +++ b/pdstring+wchar/src/string2any.c @@ -0,0 +1,249 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: string2any.c + * Author: Bryan Jurish + * Description: convert strings to pd messages + * + * Copyright (c) 2004-2008 Bryan Jurish. + * + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file "COPYING", in this distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *=============================================================================*/ + +#include +#include +#include "mooPdUtils.h" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* black magic */ +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +/*-------------------------------------------------------------------- + * DEBUG + *--------------------------------------------------------------------*/ +/*#define STRING2ANY_DEBUG 1*/ +/*#undef STRING2ANY_DEBUG*/ + +#ifdef STRING2ANY_DEBUG +# define S2ADEBUG(x) x +#else +# define S2ADEBUG(x) +#endif + +#define STRING2ANY_DEFAULT_BUFLEN 256 + + +/*===================================================================== + * Constants + *=====================================================================*/ +static char *string2any_banner = "string2any: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; + +/*===================================================================== + * Structures and Types: any2string + *=====================================================================*/ + +static t_class *string2any_class; + +typedef struct _string2any +{ + t_object x_obj; + size_t x_size; + t_float x_eos; //-- eos character + char *x_text; + t_binbuf *x_binbuf; + t_inlet *x_eos_in; + t_outlet *x_outlet; + t_outlet *x_outlet_done; +} t_string2any; + + +/*===================================================================== + * Utilities + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * string2any_atoms() + */ +static void string2any_atoms(t_string2any *x, int argc, t_atom *argv) +{ + char *s; + int x_argc, a_argc=0; + t_atom *x_argv; + + /*-- allocate --*/ + if ( ((int)x->x_size) <= (argc+1) ) { + freebytes(x->x_text, x->x_size*sizeof(char)); + x->x_size = argc+1; + x->x_text = (char *)getbytes(x->x_size*sizeof(char)); + } + + /*-- get text --*/ + for (s=x->x_text; argc > 0; argc--, a_argc++, argv++, s++) { + *s = atom_getfloat(argv); + S2ADEBUG(post("string2any[%p]: a_argc=%d,*s=%d", x, a_argc, *s)); + if ((x->x_eos<0 && !*s) || (*s==x->x_eos)) { break; } /*-- hack: look for eos char --*/ + } + *s = 0; + S2ADEBUG(post("string2any[%p]: text: \"%s\", strlen=%d, argc=%d", x, x->x_text, strlen(x->x_text), a_argc)); + + /*-- clear and fill binbuf --*/ + binbuf_clear(x->x_binbuf); + binbuf_text(x->x_binbuf, x->x_text, a_argc); //-- handle NULs if binbuf will (but it won't) ? + S2ADEBUG(post("string2any[%p]: binbuf_print: ", x)); + S2ADEBUG(binbuf_print(x->x_binbuf)); + + /*-- output --*/ + x_argc = binbuf_getnatom(x->x_binbuf); + x_argv = binbuf_getvec(x->x_binbuf); + if (x_argc && x_argv->a_type == A_SYMBOL) { + outlet_anything(x->x_outlet, + x_argv->a_w.w_symbol, + x_argc-1, + x_argv+1); + } + else { + outlet_anything(x->x_outlet, + &s_list, + x_argc, + x_argv); + } +} + + +/*===================================================================== + * Methods + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * anything + */ +static void string2any_anything(t_string2any *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + int i0=0, i; + + /*-- scan & output --*/ + if (x->x_eos >= 0) { + for (i=i0; i < argc; i++) { + if (((int)atom_getfloatarg(i,argc,argv))==((int)x->x_eos)) { + string2any_atoms(x, i-i0, argv+i0); + i0=i+1; + } + } + } + + if (i0 < argc) { + string2any_atoms(x, argc-i0, argv+i0); + } + + outlet_bang(x->x_outlet_done); +} + + +/*-------------------------------------------------------------------- + * new + */ +static void *string2any_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + t_string2any *x = (t_string2any *)pd_new(string2any_class); + + //-- defaults + x->x_binbuf = binbuf_new(); + x->x_size = STRING2ANY_DEFAULT_BUFLEN; + x->x_eos = -1; + + //-- args: 0: bufsize + if (argc > 0) { + int initial_bufsize = atom_getintarg(0,argc,argv); + if (initial_bufsize > 0) x->x_size = initial_bufsize; + x->x_eos = -1; //-- backwards-compatibility hack: no default eos character if only bufsize is specified + } + //-- args: 1: separator + if (argc > 1) { + x->x_eos = atom_getfloatarg(1,argc,argv); + } + + //-- allocate + x->x_text = (char *)getbytes(x->x_size*sizeof(char)); + + //-- inlets + x->x_eos_in = floatinlet_new(&x->x_obj, &x->x_eos); + + //-- outlets + x->x_outlet = outlet_new(&x->x_obj, &s_list); + x->x_outlet_done = outlet_new(&x->x_obj, &s_bang); + + //-- debug + S2ADEBUG(post("string2any_new: x=%p, size=%d, eos=%d, binbuf=%p, text=%p", x, x->x_size, x->x_eos, x->x_binbuf, x->x_text)); + + return (void *)x; +} + +/*-------------------------------------------------------------------- + * free + */ +static void string2any_free(t_string2any *x) +{ + if (x->x_text) { + freebytes(x->x_text, x->x_size*sizeof(char)); + x->x_text = NULL; + } + binbuf_free(x->x_binbuf); + inlet_free(x->x_eos_in); + outlet_free(x->x_outlet_done); + outlet_free(x->x_outlet); + return; +} + +/*-------------------------------------------------------------------- + * setup: guts + */ +void string2any_setup_guts(void) +{ + //-- class + string2any_class = class_new(gensym("string2any"), + (t_newmethod)string2any_new, + (t_method)string2any_free, + sizeof(t_string2any), + CLASS_DEFAULT, + A_GIMME, //-- initial_bufsize, eos_char + 0); + + //-- alias + class_addcreator((t_newmethod)string2any_new, gensym("bytes2any"), A_GIMME, 0); + + //-- methods + class_addanything(string2any_class, (t_method)string2any_anything); + + + //-- help symbol + //class_sethelpsymbol(string2any_class, gensym("string2any-help.pd")); //-- breaks pd-extended help lookup +} + +/*-------------------------------------------------------------------- + * setup + */ +void string2any_setup(void) +{ + post(string2any_banner); + string2any_setup_guts(); +} diff --git a/pdstring+wchar/src/unsigned.pd b/pdstring+wchar/src/unsigned.pd new file mode 100644 index 0000000..7a5a328 --- /dev/null +++ b/pdstring+wchar/src/unsigned.pd @@ -0,0 +1,27 @@ +#N canvas 206 54 450 300 10; +#X floatatom 105 86 5 0 0 1 byte_value - -; +#X obj 105 116 string2any; +#X obj 119 146 print s2a; +#X obj 105 176 any2string; +#X floatatom 105 208 5 0 0 0 - - -; +#X msg 105 48 -10; +#X msg 143 48 246; +#X floatatom 238 207 5 0 0 0 - - -; +#X floatatom 240 82 5 0 0 1 byte_value - -; +#X msg 240 49 -10; +#X msg 278 49 246; +#X obj 238 115 bytes2any; +#X obj 238 175 any2bytes; +#X obj 252 145 print s2b; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 1 0 3 0; +#X connect 3 0 4 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 8 0 11 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 12 0; +#X connect 11 0 13 0; +#X connect 12 0 7 0; -- cgit v1.2.1