diff options
author | Bryan Jurish <mukau@users.sourceforge.net> | 2009-01-25 22:31:47 +0000 |
---|---|---|
committer | Bryan Jurish <mukau@users.sourceforge.net> | 2009-01-25 22:31:47 +0000 |
commit | 4d788c826b6e354f6aa29a047dcd2e93bb220c73 (patch) | |
tree | 2d13ab1ddb9b10656ded305c1d43e4cbae038965 /pdstring+wchar/src | |
parent | 9f6510850e3782a22b0ac282161f5e1e7413f3f2 (diff) |
+ updated extended/Makefile to include new locale/ subdir
svn path=/trunk/externals/moocow/; revision=10641
Diffstat (limited to 'pdstring+wchar/src')
23 files changed, 0 insertions, 3186 deletions
diff --git a/pdstring+wchar/src/Makefile.am b/pdstring+wchar/src/Makefile.am deleted file mode 100644 index 7f8df55..0000000 --- a/pdstring+wchar/src/Makefile.am +++ /dev/null @@ -1,164 +0,0 @@ -# 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 \ - any2bytes \ - bytes2any \ - bytes2wchars \ - wchars2bytes - -## --- patches -pdexterns_DATA = \ - any2wchars.pd \ - wchars2any.pd - -## --- documentation -pddoc_DATA = \ - pdstring-help.pd \ - any2bytes-help.pd \ - bytes2any-help.pd \ - bytes2wchars-help.pd \ - wchars2bytes-help.pd \ - any2wchars-help.pd \ - wchars2any-help.pd - - -#----------------------------------------------------------------------- -# sources -#----------------------------------------------------------------------- - -any2bytes_SOURCES = any2bytes.c mooPdUtils.h pdstringUtils.h - -bytes2any_SOURCES = bytes2any.c mooPdUtils.h pdstringUtils.h - -bytes2wchars_SOURCES = bytes2wchars.c mooPdUtils.h pdstringUtils.h - -wchars2bytes_SOURCES = wchars2bytes.c mooPdUtils.h pdstringUtils.h - -pdstring_SOURCES = pdstring.c mooPdUtils.h pdstringUtils.h - -pdstring.$(OBJECT): $(any2bytes_SOURCES) $(bytes2any_SOURCES) $(bytes2wchars_SOURCES) $(wchars2bytes_SOURCES) - -#----------------------------------------------------------------------- -# 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) - -bytes2any_LDFLAGS = $(LFLAGS) - -any2bytes_LDFLAGS = $(LFLAGS) - -bytes2wchars_LDFLAGS = $(LFLAGS) - -wchars2bytes_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 deleted file mode 100644 index 265ee20..0000000 --- a/pdstring+wchar/src/Makefile.in +++ /dev/null @@ -1,737 +0,0 @@ -# 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) any2bytes$(EXEEXT) \ - bytes2any$(EXEEXT) bytes2wchars$(EXEEXT) wchars2bytes$(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_any2bytes_OBJECTS = any2bytes.$(OBJEXT) -any2bytes_OBJECTS = $(am_any2bytes_OBJECTS) -any2bytes_LDADD = $(LDADD) -am_bytes2any_OBJECTS = bytes2any.$(OBJEXT) -bytes2any_OBJECTS = $(am_bytes2any_OBJECTS) -bytes2any_LDADD = $(LDADD) -am_bytes2wchars_OBJECTS = bytes2wchars.$(OBJEXT) -bytes2wchars_OBJECTS = $(am_bytes2wchars_OBJECTS) -bytes2wchars_LDADD = $(LDADD) -am_pdstring_OBJECTS = pdstring.$(OBJEXT) -pdstring_OBJECTS = $(am_pdstring_OBJECTS) -pdstring_LDADD = $(LDADD) -am_wchars2bytes_OBJECTS = wchars2bytes.$(OBJEXT) -wchars2bytes_OBJECTS = $(am_wchars2bytes_OBJECTS) -wchars2bytes_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 = $(any2bytes_SOURCES) $(bytes2any_SOURCES) \ - $(bytes2wchars_SOURCES) $(pdstring_SOURCES) \ - $(wchars2bytes_SOURCES) -DIST_SOURCES = $(any2bytes_SOURCES) $(bytes2any_SOURCES) \ - $(bytes2wchars_SOURCES) $(pdstring_SOURCES) \ - $(wchars2bytes_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 = \ - any2wchars.pd \ - wchars2any.pd - -pddoc_DATA = \ - pdstring-help.pd \ - any2bytes-help.pd \ - bytes2any-help.pd \ - bytes2wchars-help.pd \ - wchars2bytes-help.pd \ - any2wchars-help.pd \ - wchars2any-help.pd - - -#----------------------------------------------------------------------- -# sources -#----------------------------------------------------------------------- -any2bytes_SOURCES = any2bytes.c mooPdUtils.h pdstringUtils.h -bytes2any_SOURCES = bytes2any.c mooPdUtils.h pdstringUtils.h -bytes2wchars_SOURCES = bytes2wchars.c mooPdUtils.h pdstringUtils.h -wchars2bytes_SOURCES = wchars2bytes.c mooPdUtils.h pdstringUtils.h -pdstring_SOURCES = pdstring.c mooPdUtils.h pdstringUtils.h - -#GLIB_IFLAGS = @GLIB_IFLAGS@ -#GLIB_LFLAGS = @GLIB_LFLAGS@ -AM_CPPFLAGS = $(IFLAGS) $(GLIB_IFLAGS) $(DFLAGS) -AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) -pdstring_LDFLAGS = $(LFLAGS) -bytes2any_LDFLAGS = $(LFLAGS) -any2bytes_LDFLAGS = $(LFLAGS) -bytes2wchars_LDFLAGS = $(LFLAGS) -wchars2bytes_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) -any2bytes$(EXEEXT): $(any2bytes_OBJECTS) $(any2bytes_DEPENDENCIES) - @rm -f any2bytes$(EXEEXT) - $(LINK) $(any2bytes_LDFLAGS) $(any2bytes_OBJECTS) $(any2bytes_LDADD) $(LIBS) -bytes2any$(EXEEXT): $(bytes2any_OBJECTS) $(bytes2any_DEPENDENCIES) - @rm -f bytes2any$(EXEEXT) - $(LINK) $(bytes2any_LDFLAGS) $(bytes2any_OBJECTS) $(bytes2any_LDADD) $(LIBS) -bytes2wchars$(EXEEXT): $(bytes2wchars_OBJECTS) $(bytes2wchars_DEPENDENCIES) - @rm -f bytes2wchars$(EXEEXT) - $(LINK) $(bytes2wchars_LDFLAGS) $(bytes2wchars_OBJECTS) $(bytes2wchars_LDADD) $(LIBS) -pdstring$(EXEEXT): $(pdstring_OBJECTS) $(pdstring_DEPENDENCIES) - @rm -f pdstring$(EXEEXT) - $(LINK) $(pdstring_LDFLAGS) $(pdstring_OBJECTS) $(pdstring_LDADD) $(LIBS) -wchars2bytes$(EXEEXT): $(wchars2bytes_OBJECTS) $(wchars2bytes_DEPENDENCIES) - @rm -f wchars2bytes$(EXEEXT) - $(LINK) $(wchars2bytes_LDFLAGS) $(wchars2bytes_OBJECTS) $(wchars2bytes_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/any2bytes.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytes2any.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytes2wchars.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdstring.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wchars2bytes.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 - - -pdstring.$(OBJECT): $(any2bytes_SOURCES) $(bytes2any_SOURCES) $(bytes2wchars_SOURCES) $(wchars2bytes_SOURCES) - -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/any2bytes-help.pd b/pdstring+wchar/src/any2bytes-help.pd deleted file mode 100644 index ef0ce17..0000000 --- a/pdstring+wchar/src/any2bytes-help.pd +++ /dev/null @@ -1,40 +0,0 @@ -#N canvas 90 20 636 478 10; -#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 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 182 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 184 367 Second argument: initial EOS character. See above. -; -#X text 320 458 Bryan Jurish <moocow@ling.uni-potsdam.de>; -#X text 19 439 SEE ALSO:; -#X msg 139 197 42; -#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 31 75 2 - EOS character (float); -#X obj 100 438 pdstring; -#X obj 25 314 any2bytes 128 -1; -#X obj 25 400 print any2bytes-help; -#X text 21 29 SYNTAX: any2bytes [INITIAL_BUFSIZE [EOS_CHAR]]; -#X text 263 63 1 - lists of byte-valued floats; -#X text 49 5 any2bytes : convert pd messages to a list of byte values -; -#X connect 0 0 19 1; -#X connect 1 0 19 1; -#X connect 5 0 19 0; -#X connect 6 0 19 0; -#X connect 10 0 19 0; -#X connect 15 0 19 1; -#X connect 19 0 20 0; diff --git a/pdstring+wchar/src/any2bytes.c b/pdstring+wchar/src/any2bytes.c deleted file mode 100644 index c2b2425..0000000 --- a/pdstring+wchar/src/any2bytes.c +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: any2bytes.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * 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 <string.h> -#include <m_pd.h> - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "mooPdUtils.h" -#include "pdstringUtils.h" - -/* black magic */ -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/*-------------------------------------------------------------------- - * DEBUG - *--------------------------------------------------------------------*/ -/*#define ANY2BYTES_DEBUG 1*/ - -#ifdef ANY2BYTES_DEBUG -# define A2SDEBUG(x) x -#else -# define A2SDEBUG(x) -#endif - -#define ANY2BYTES_DEFAULT_BUFLEN PDSTRING_DEFAULT_BUFLEN - - -/*===================================================================== - * Structures and Types: any2bytes - *=====================================================================*/ -static t_class *any2bytes_class; - -typedef struct _any2bytes -{ - t_object x_obj; - t_pdstring_bytes x_bytes; //-- byte buffer - t_pdstring_atoms x_atoms; //-- atom buffer (for output) - t_float x_eos; //-- EOS character to add (<0 for none) - t_binbuf *x_binbuf; - t_inlet *x_eos_in; - t_outlet *x_outlet; -} t_any2bytes; - - -/*===================================================================== - * Constants - *=====================================================================*/ -static char *any2bytes_banner = "any2bytes: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; - -/*===================================================================== - * Methods - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * anything - */ -static void any2bytes_anything(t_any2bytes *x, t_symbol *sel, int argc, t_atom *argv) -{ - //-- convert any -> bytes -> atoms - t_pdstring_atoms arg_atoms = {argv,argc,0}; - pdstring_bytes_clear(&x->x_bytes); - pdstring_any2bytes(x, &x->x_bytes, sel, &arg_atoms, x->x_binbuf); - pdstring_bytes2atoms(x, &x->x_atoms, &x->x_bytes, x->x_eos); - - //-- output - outlet_list(x->x_outlet, &s_list, x->x_atoms.a_len, x->x_atoms.a_buf); -} - -/*-------------------------------------------------------------------- - * new - */ -static void *any2bytes_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - t_any2bytes *x = (t_any2bytes *)pd_new(any2bytes_class); - int bufsize = ANY2BYTES_DEFAULT_BUFLEN; - - //-- defaults - x->x_eos = 0; - - //-- args: 0: bufsize - if (argc > 0) { - int initial_bufsize = atom_getintarg(0, argc, argv); - if (initial_bufsize > 0) { bufsize = initial_bufsize; } - } - //-- args: 1: eos - if (argc > 1) { - x->x_eos = atom_getfloatarg(1, argc, argv); - } - - //-- allocate - pdstring_bytes_init(&x->x_bytes, 0); //-- x_bytes gets clobbered by binbuf_gettext() - pdstring_atoms_init(&x->x_atoms, bufsize); - 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("any2bytes_new(): x=%p, eos=%d, binbuf=%p", x, x->x_eos, x->x_binbuf)); - - return (void *)x; -} - -/*-------------------------------------------------------------------- - * free - */ -static void any2bytes_free(t_any2bytes *x) -{ - pdstring_bytes_clear(&x->x_bytes); - pdstring_atoms_clear(&x->x_atoms); - binbuf_free(x->x_binbuf); - inlet_free(x->x_eos_in); - outlet_free(x->x_outlet); - return; -} - -/*-------------------------------------------------------------------- - * setup (guts) - */ -void any2bytes_setup_guts(void) -{ - //-- class - any2bytes_class = class_new(gensym("any2bytes"), - (t_newmethod)any2bytes_new, - (t_method)any2bytes_free, - sizeof(t_any2bytes), - CLASS_DEFAULT, - A_GIMME, //-- initial_bufsize, eos_char - 0); - - //-- alias - class_addcreator((t_newmethod)any2bytes_new, gensym("any2string"), A_GIMME, 0); - - //-- methods - class_addanything(any2bytes_class, (t_method)any2bytes_anything); - - //-- help symbol - //class_sethelpsymbol(any2bytes_class, gensym("any2bytes-help.pd")); //-- breaks pd-extended help lookup -} - - -/*-------------------------------------------------------------------- - * setup - */ -void any2bytes_setup(void) -{ - post(any2bytes_banner); - any2bytes_setup_guts(); -} diff --git a/pdstring+wchar/src/any2wchars-help.pd b/pdstring+wchar/src/any2wchars-help.pd deleted file mode 100644 index 3ed9e63..0000000 --- a/pdstring+wchar/src/any2wchars-help.pd +++ /dev/null @@ -1,37 +0,0 @@ -#N canvas 72 8 636 478 10; -#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 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 182 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 320 458 Bryan Jurish <moocow@ling.uni-potsdam.de>; -#X text 19 439 SEE ALSO:; -#X msg 139 197 42; -#X text 31 75 2 - EOS character (float); -#X obj 100 438 pdstring; -#X obj 25 314 any2wchars 128 -1; -#X obj 25 400 print any2wchars-help; -#X text 21 29 SYNTAX: any2wchars [INITIAL_BUFSIZE [EOS_CHAR]]; -#X text 49 5 any2wchars : convert pd messages to a list of wchar_t -values; -#X text 263 63 1 - lists of wchar_t-valued floats; -#X text 184 194 The second inlet is as for [any2bytes]; -#X text 184 367 Second argument: initial EOS character. See [any2bytes]. -; -#X obj 168 438 locale; -#X connect 0 0 17 1; -#X connect 1 0 17 1; -#X connect 5 0 17 0; -#X connect 6 0 17 0; -#X connect 10 0 17 0; -#X connect 14 0 17 1; -#X connect 17 0 18 0; diff --git a/pdstring+wchar/src/any2wchars.pd b/pdstring+wchar/src/any2wchars.pd deleted file mode 100644 index a531952..0000000 --- a/pdstring+wchar/src/any2wchars.pd +++ /dev/null @@ -1,10 +0,0 @@ -#N canvas 398 18 328 196 10; -#X obj 54 20 inlet; -#X obj 154 20 inlet; -#X obj 54 62 any2bytes \$1 \$2; -#X obj 54 134 outlet; -#X obj 54 90 bytes2wchars \$1; -#X connect 0 0 2 0; -#X connect 1 0 2 1; -#X connect 2 0 4 0; -#X connect 4 0 3 0; diff --git a/pdstring+wchar/src/bytes2any-help.pd b/pdstring+wchar/src/bytes2any-help.pd deleted file mode 100644 index 0663ec3..0000000 --- a/pdstring+wchar/src/bytes2any-help.pd +++ /dev/null @@ -1,47 +0,0 @@ -#N canvas 507 20 612 604 10; -#X text 13 52 INLETS:; -#X text 309 54 OUTLETS:; -#X text 325 68 1 - pd messages; -#X text 325 82 2 - bang on done; -#X msg 24 113 97 32 98 32 99; -#X msg 39 135 97 0 98 0 99; -#X msg 92 206 0; -#X msg 60 206 -1; -#X msg 124 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 <moocow@ling.uni-potsdam.de>; -#X text 27 83 2 - EOS character (float); -#X text 161 121 lists of floats are converted to pd messages.; -#X text 168 161 ... selector is ignored ...; -#X text 21 571 SEE ALSO:; -#X obj 102 570 pdstring; -#X text 27 68 1 - byte-valued float lists; -#X text 59 7 bytes2any : convert lists of byte values to pd messages -; -#X text 13 30 SYNTAX: bytes2any [INITIAL_BUFSIZE [EOS_CHAR]]; -#X obj 124 454 print bytes2any-help-done; -#X obj 24 529 print bytes2any-help; -#X msg 54 161 StringThing 97; -#X obj 24 350 bytes2any 128 0; -#X connect 4 0 26 0; -#X connect 5 0 26 0; -#X connect 6 0 26 1; -#X connect 7 0 26 1; -#X connect 8 0 26 1; -#X connect 25 0 26 0; -#X connect 26 0 24 0; -#X connect 26 1 23 0; diff --git a/pdstring+wchar/src/bytes2any.c b/pdstring+wchar/src/bytes2any.c deleted file mode 100644 index e4b3715..0000000 --- a/pdstring+wchar/src/bytes2any.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: bytes2any.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * Description: convert strings to pd messages - * - * 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 <string.h> -#include <m_pd.h> - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "mooPdUtils.h" -#include "pdstringUtils.h" - -/* black magic */ -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/*-------------------------------------------------------------------- - * DEBUG - *--------------------------------------------------------------------*/ -/*#define BYTES2ANY_DEBUG 1*/ -/*#undef BYTES2ANY_DEBUG*/ - -#ifdef BYTES2ANY_DEBUG -# define S2ADEBUG(x) x -#else -# define S2ADEBUG(x) -#endif - -#define BYTES2ANY_DEFAULT_BUFLEN PDSTRING_DEFAULT_BUFLEN - -/*===================================================================== - * Constants - *=====================================================================*/ -static char *bytes2any_banner = "bytes2any: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; - -/*===================================================================== - * Structures and Types: any2string - *=====================================================================*/ - -static t_class *bytes2any_class; - -typedef struct _bytes2any -{ - t_object x_obj; - t_pdstring_bytes x_bytes; //-- byte buffer: {b_buf~x_text,b_len~?,b_alloc~x_size} - t_float x_eos; //-- eos byte value - t_binbuf *x_binbuf; - t_inlet *x_eos_in; - t_outlet *x_outlet; - t_outlet *x_outlet_done; -} t_bytes2any; - - -/*===================================================================== - * Utilities - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * bytes2any_atoms() - */ -static void bytes2any_atoms(t_bytes2any *x, int argc, t_atom *argv) -{ - t_pdstring_atoms src = {argv,argc,argc}; - pdstring_atoms2bytes(x, &(x->x_bytes), &src, x->x_eos); - pdstring_bytes2any(x, NULL, &(x->x_bytes), x->x_binbuf); - int x_argc; - t_atom *x_argv; - - /*-- 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 bytes2any_anything(t_bytes2any *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)) { - bytes2any_atoms(x, i-i0, argv+i0); - i0=i+1; - } - } - } - - if (i0 < argc) { - bytes2any_atoms(x, argc-i0, argv+i0); - } - - outlet_bang(x->x_outlet_done); -} - - -/*-------------------------------------------------------------------- - * new - */ -static void *bytes2any_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - t_bytes2any *x = (t_bytes2any *)pd_new(bytes2any_class); - int bufsize = BYTES2ANY_DEFAULT_BUFLEN; - - //-- defaults - x->x_binbuf = binbuf_new(); - x->x_eos = -1; - - //-- args: 0: bufsize - if (argc > 0) { - int initial_bufsize = atom_getintarg(0,argc,argv); - if (initial_bufsize > 0) bufsize = 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_bytes - pdstring_bytes_init(&x->x_bytes, bufsize); - - //-- 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("bytes2any_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 bytes2any_free(t_bytes2any *x) -{ - pdstring_bytes_clear(&x->x_bytes); - 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 bytes2any_setup_guts(void) -{ - //-- class - bytes2any_class = class_new(gensym("bytes2any"), - (t_newmethod)bytes2any_new, - (t_method)bytes2any_free, - sizeof(t_bytes2any), - CLASS_DEFAULT, - A_GIMME, //-- initial_bufsize, eos_char - 0); - - //-- alias - class_addcreator((t_newmethod)bytes2any_new, gensym("bytes2any"), A_GIMME, 0); - - //-- methods - class_addanything(bytes2any_class, (t_method)bytes2any_anything); - - - //-- help symbol - //class_sethelpsymbol(bytes2any_class, gensym("bytes2any-help.pd")); //-- breaks pd-extended help lookup -} - -/*-------------------------------------------------------------------- - * setup - */ -void bytes2any_setup(void) -{ - post(bytes2any_banner); - bytes2any_setup_guts(); -} diff --git a/pdstring+wchar/src/bytes2wchars-help.pd b/pdstring+wchar/src/bytes2wchars-help.pd deleted file mode 100644 index 3d3d0b6..0000000 --- a/pdstring+wchar/src/bytes2wchars-help.pd +++ /dev/null @@ -1,46 +0,0 @@ -#N canvas 610 14 566 410 10; -#X text 81 5 bytes2wchars : convert bytes to wide characters; -#X text 11 27 SYNTAX: bytes2wchars [INITIAL_BUFSIZE]; -#X text 11 46 INLETS:; -#X text 241 48 OUTLETS:; -#X text 19 62 1 - byte-valued float lists; -#X text 257 62 1 - wchar_t-valued float lists; -#X obj 24 310 bytes2wchars; -#X obj 24 334 print bytes2wchars-help; -#X msg 24 95 97 32 98 32 99; -#X msg 41 227 228 246 252; -#X msg 71 159 C; -#X text 69 129 8-bit values are interpreted according to the current -locale's LC_CTYPE category: here are some examples:; -#N canvas 0 0 338 182 locale_LC_CTYPE 0; -#X obj 48 124 locale; -#X obj 48 36 inlet; -#X obj 48 64 symbol; -#X msg 48 92 set LC_CTYPE \$1; -#X text 57 143 + requires the "locale" external; -#X connect 1 0 2 0; -#X connect 2 0 3 0; -#X connect 3 0 0 0; -#X restore 103 190 pd locale_LC_CTYPE; -#X msg 45 255 195 164 195 182 195 188; -#X text 219 253 ... the same string encoded in UTF-8; -#X text 205 387 Bryan Jurish <moocow@ling.uni-potsdam.de>; -#X text 11 371 SEE ALSO:; -#X obj 26 388 pdstring; -#X obj 93 388 locale; -#X text 11 355 BUGS: float representation is only safe up to 24-bit -values; -#X msg 103 159 en_DK.ISO-8859-1; -#X msg 225 159 en_DK.UTF-8; -#X text 145 97 Values <= 127 are unchanged; -#X msg 49 281 207 128 206 180; -#X text 217 225 ISO-8859-1 bytes "ä \, ö \, ü"; -#X text 219 283 "&pi &delta" in UTF-8; -#X connect 6 0 7 0; -#X connect 8 0 6 0; -#X connect 9 0 6 0; -#X connect 10 0 12 0; -#X connect 13 0 6 0; -#X connect 20 0 12 0; -#X connect 21 0 12 0; -#X connect 23 0 6 0; diff --git a/pdstring+wchar/src/bytes2wchars-test.pd b/pdstring+wchar/src/bytes2wchars-test.pd deleted file mode 100644 index faeaea1..0000000 --- a/pdstring+wchar/src/bytes2wchars-test.pd +++ /dev/null @@ -1,42 +0,0 @@ -#N canvas 600 24 578 300 10; -#X obj 114 136 bytes2wchars; -#X obj 138 168 print wchars; -#X obj 285 238 locale; -#X msg 285 159 get; -#X msg 321 215 set LC_CTYPE \$1; -#X obj 321 194 symbol; -#X msg 321 163 C; -#X msg 355 163 en_US.ISO-8859-1; -#X msg 477 163 en_US.UTF-8; -#X obj 284 262 print locale; -#X msg 41 41 246; -#X floatatom 116 204 5 0 0 0 - - -; -#X msg 41 61 195 182; -#X text 39 23 ö \;; -#X msg 159 61 197 147; -#X text 155 23 &oelig \;; -#X msg 159 39 339; -#X msg 245 37 960; -#X msg 245 59 207 128; -#X text 245 21 &pi \;; -#X obj 353 136 loadbang; -#X text 97 41 ucs-4; -#X text 99 59 utf-8; -#X msg 337 63 207 128 0 197 147 0 195 182 0; -#X connect 0 0 1 0; -#X connect 0 0 11 0; -#X connect 2 0 9 0; -#X connect 3 0 2 0; -#X connect 4 0 2 0; -#X connect 5 0 4 0; -#X connect 6 0 5 0; -#X connect 7 0 5 0; -#X connect 8 0 5 0; -#X connect 10 0 0 0; -#X connect 12 0 0 0; -#X connect 14 0 0 0; -#X connect 16 0 0 0; -#X connect 17 0 0 0; -#X connect 18 0 0 0; -#X connect 20 0 7 0; -#X connect 23 0 0 0; diff --git a/pdstring+wchar/src/bytes2wchars.c b/pdstring+wchar/src/bytes2wchars.c deleted file mode 100644 index 7fbbc99..0000000 --- a/pdstring+wchar/src/bytes2wchars.c +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: bytes2wchars.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * Description: convert byte-valued atom lists to wchar_t-valued atom lists - * - * Copyright (c) 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 <string.h> -#include <wchar.h> -#include <stdlib.h> -#include <m_pd.h> - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "mooPdUtils.h" -#include "pdstringUtils.h" - -/* black magic */ -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/*-------------------------------------------------------------------- - * DEBUG - *--------------------------------------------------------------------*/ - -/*===================================================================== - * Constants - *=====================================================================*/ -static char *bytes2wchars_banner = "bytes2wchars: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; - -#define BYTES2WCHARS_DEFAULT_BUFLEN PDSTRING_DEFAULT_BUFLEN - -/*===================================================================== - * Structures and Types: any2string - *=====================================================================*/ - -static t_class *bytes2wchars_class; - -typedef struct _bytes2wchars -{ - t_object x_obj; - t_pdstring_bytes x_bytes; //-- byte buffer - t_pdstring_wchars x_wchars; //-- wide character buffer - t_pdstring_atoms x_atoms; //-- atoms to output - t_outlet *x_outlet; -} t_bytes2wchars; - - -/*===================================================================== - * Utilities - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * bytes2wchars_atoms() - */ -static void bytes2wchars_atoms(t_bytes2wchars *x, int argc, t_atom *argv) -{ - t_pdstring_atoms src = {argv,argc,0}; - - /*-- convert atoms -> bytes -> wchars -> atoms --*/ - pdstring_atoms2bytes (x, &x->x_bytes, &src, PDSTRING_EOS_NONE); - pdstring_bytes2wchars(x, &x->x_wchars, &x->x_bytes); - pdstring_wchars2atoms(x, &x->x_atoms, &x->x_wchars); -} - - -/*===================================================================== - * Methods - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * anything - */ -static void bytes2wchars_anything(t_bytes2wchars *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - bytes2wchars_atoms(x, argc, argv); - - /*-- output --*/ - outlet_anything(x->x_outlet, &s_list, x->x_atoms.a_len, x->x_atoms.a_buf); -} - - -/*-------------------------------------------------------------------- - * new - */ -static void *bytes2wchars_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - t_bytes2wchars *x = (t_bytes2wchars *)pd_new(bytes2wchars_class); - int bufsize = PDSTRING_DEFAULT_BUFLEN; - - //-- args: 0: bufsize - if (argc > 0) { - int initial_bufsize = atom_getintarg(0,argc,argv); - if (initial_bufsize > 0) bufsize = initial_bufsize; - } - - //-- allocate - pdstring_bytes_init(&x->x_bytes, bufsize); - pdstring_wchars_init(&x->x_wchars, bufsize); - pdstring_atoms_init(&x->x_atoms, bufsize); - - //-- outlets - x->x_outlet = outlet_new(&x->x_obj, &s_list); - - return (void *)x; -} - -/*-------------------------------------------------------------------- - * free - */ -static void bytes2wchars_free(t_bytes2wchars *x) -{ - pdstring_bytes_clear(&x->x_bytes); - pdstring_wchars_clear(&x->x_wchars); - pdstring_atoms_clear(&x->x_atoms); - outlet_free(x->x_outlet); - return; -} - -/*-------------------------------------------------------------------- - * setup: guts - */ -void bytes2wchars_setup_guts(void) -{ - //-- class - bytes2wchars_class = class_new(gensym("bytes2wchars"), - (t_newmethod)bytes2wchars_new, - (t_method)bytes2wchars_free, - sizeof(t_bytes2wchars), - CLASS_DEFAULT, - A_GIMME, //-- initial_bufsize - 0); - - //-- methods - class_addanything(bytes2wchars_class, (t_method)bytes2wchars_anything); - - //-- help symbol - //class_sethelpsymbol(bytes2wchars_class, gensym("bytes2wchars-help.pd")); //-- breaks pd-extended help lookup -} - -/*-------------------------------------------------------------------- - * setup - */ -void bytes2wchars_setup(void) -{ - post(bytes2wchars_banner); - bytes2wchars_setup_guts(); -} diff --git a/pdstring+wchar/src/config.h.in b/pdstring+wchar/src/config.h.in deleted file mode 100644 index 748fa6a..0000000 --- a/pdstring+wchar/src/config.h.in +++ /dev/null @@ -1,40 +0,0 @@ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define this to include debugging code for the 'bytes2any' external. */ -#undef ANY2BYTES_DEBUG - -/* Define this to include debugging code for the 'any2bytes' external. */ -#undef BYTES2ANY_DEBUG - -/* Define to 1 if you have the <string.h> 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 - -/* Version number of package */ -#undef VERSION diff --git a/pdstring+wchar/src/mooPdUtils.h b/pdstring+wchar/src/mooPdUtils.h deleted file mode 120000 index 0bb3280..0000000 --- a/pdstring+wchar/src/mooPdUtils.h +++ /dev/null @@ -1 +0,0 @@ -../../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 deleted file mode 100644 index 9e3e0c3..0000000 --- a/pdstring+wchar/src/pdstring-help.pd +++ /dev/null @@ -1,103 +0,0 @@ -#N canvas 163 18 501 441 10; -#X text 196 400 Bryan Jurish <moocow@ling.uni-potsdam.de>; -#X text 54 3 [pdstring] library : byte and wide-character strings; -#X obj 51 76 bytes2any; -#X obj 51 52 any2bytes; -#X text 148 77 convert byte strings to pd messages; -#X text 148 53 convert pd messages to byte strings; -#X obj 45 142 bytes2wchars; -#X text 147 143 convert byte strings to wide character strings; -#X obj 45 168 wchars2bytes; -#X text 148 169 convert wide character strings to byte strings; -#X text 22 121 BYTES <-> WIDE CHARACTERS; -#X text 26 33 BYTES <-> PD MESSAGES; -#X text 20 211 WIDE CHARACTERS <-> PD MESSAGES; -#X text 145 233 convert pd messages to wide character strings; -#X text 146 259 convert wide character strings to pd messages; -#X text 18 369 SEE ALSO:; -#N canvas 0 0 584 308 pdstring-bytes 0; -#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 floatatom 54 178 4 0 0 0 - - -; -#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 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 obj 133 198 bytes2any; -#X connect 0 0 2 0; -#X connect 1 0 0 1; -#X connect 2 0 1 0; -#X connect 2 1 12 0; -#X connect 2 2 3 1; -#X connect 3 0 10 0; -#X connect 4 0 0 0; -#X connect 5 0 3 0; -#X connect 6 0 4 0; -#X connect 7 0 0 1; -#X connect 8 0 9 0; -#X connect 9 0 6 0; -#X connect 9 1 7 0; -#X connect 10 0 11 0; -#X connect 10 1 11 0; -#X connect 12 0 5 0; -#X restore 289 156 pd ascii-table; -#X msg 289 133 bang; -#X msg 37 38 A B C; -#X msg 55 199 list 49 50 51; -#X obj 58 139 print any2bytes-out; -#X obj 37 108 any2bytes; -#X obj 37 254 print bytes2any-out; -#X obj 37 230 bytes2any; -#X text 289 173 ... know your character set; -#X text 213 230 bytes2any converts byte lists to Pd messages...; -#X connect 0 0 11 0; -#X connect 1 0 11 0; -#X connect 4 0 13 0; -#X connect 7 0 6 0; -#X connect 8 0 11 0; -#X connect 9 0 13 0; -#X connect 11 0 10 0; -#X connect 11 0 13 0; -#X connect 13 0 12 0; -#X restore 87 368 pd pdstring-bytes; -#N canvas 0 0 584 308 pdstring-wchars 0; -#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 floatatom 54 178 4 0 0 0 - - -; -#X text 202 81 ... but "float" selector is silently dropped; -#X msg 37 38 A B C; -#X msg 55 199 list 49 50 51; -#X obj 37 254 print wchars2any-out; -#X text 213 230 wchars2any converts wchar lists to Pd messages...; -#X obj 58 139 print any2wchars-out; -#X obj 37 108 any2wchars; -#X obj 37 230 wchars2any; -#X connect 0 0 11 0; -#X connect 1 0 11 0; -#X connect 4 0 12 0; -#X connect 6 0 11 0; -#X connect 7 0 12 0; -#X connect 11 0 10 0; -#X connect 11 0 12 0; -#X connect 12 0 8 0; -#X restore 217 368 pd pdstring-wchars; -#X obj 43 232 any2wchars; -#X obj 43 258 wchars2any; -#X obj 355 368 locale; -#X text 18 303 NOTE:; -#X text 26 319 Wide character support requires locale support to be -enabled \, e.g. by the [locale] external.; diff --git a/pdstring+wchar/src/pdstring.c b/pdstring+wchar/src/pdstring.c deleted file mode 100644 index 907d16d..0000000 --- a/pdstring+wchar/src/pdstring.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: pdstring.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * 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 <m_pd.h> -#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 -# include "any2bytes.c" -# include "bytes2any.c" -# include "bytes2wchars.c" -# include "wchars2bytes.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 - any2bytes_setup_guts(); - bytes2any_setup_guts(); - bytes2wchars_setup_guts(); - wchars2bytes_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/pdstringUtils.c b/pdstring+wchar/src/pdstringUtils.c deleted file mode 100644 index 2596422..0000000 --- a/pdstring+wchar/src/pdstringUtils.c +++ /dev/null @@ -1,452 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: pdstringUtils.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * Description: pdstring: common utilities - * - * Copyright (c) 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. - *=============================================================================*/ - -#ifndef PDSTRING_UTILS_C -#define PDSTRING_UTILS_C - -#include <string.h> -#include <m_pd.h> -#include <stdlib.h> -#include "mooPdUtils.h" - -/*===================================================================== - * Debugging - *=====================================================================*/ -#define PDSTRING_UTILS_DEBUG 1 -//#undef PDSTRING_UTILS_DEBUG - -#ifdef PDSTRING_UTILS_DEBUG -# define PDSDEBUG(x) x -#else -# define PDSDEBUG(x) -#endif - -/*===================================================================== - * Constants - *=====================================================================*/ - -/* PDSTRING_EOS_NONE - * + "safe" float value to use as x_eos if no truncation is desired - */ -#define PDSTRING_EOS_NONE 1e38f - -/* PDSTRING_DEFAULT_BUFLEN - * + common default buffer length - */ -#define PDSTRING_DEFAULT_BUFLEN 256 - -/* PDSTRING_DEFAULT_GET - * + common default buffer grow length - */ -#define PDSTRING_DEFAULT_GET 256 - -/* PDSTRING_BYSTES_GET - * + number of extra bytes to get when buffer must grow - */ -#define PDSTRING_BYTES_GET PDSTRING_DEFAULT_GET -#define PDSTRING_WCHARS_GET PDSTRING_DEFAULT_GET -#define PDSTRING_ATOMS_GET PDSTRING_DEFAULT_GET - -/*===================================================================== - * Structures & Types - *=====================================================================*/ - -/* t_pdstring_bytes - * + a byte-string buffer - */ -typedef struct _pdstring_bytes { - unsigned char *b_buf; //-- byte-string buffer - int b_len; //-- current length of b_buf - size_t b_alloc; //-- allocated size of b_buf -} t_pdstring_bytes; - -/* t_pdstring_wchars - * + a wide character buffer - */ -typedef struct _pdstring_wchars { - wchar_t *w_buf; //-- wide character buffer - int w_len; //-- current length of w_buf - size_t w_alloc; //-- allocated size of w_buf -} t_pdstring_wchars; - -/* t_pdstring_atoms - * + an atom-list buffer - */ -typedef struct _pdstring_atoms { - t_atom *a_buf; //-- t_atom buffer (aka argv) - int a_len; //-- current length of a_buf (aka argc) - size_t a_alloc; //-- allocated size of a_buf -} t_pdstring_atoms; - -/*===================================================================== - * Initialization - *=====================================================================*/ - -/*--------------------------------------------------------------------- - * bytes - */ -static void pdstring_bytes_clear(t_pdstring_bytes *b) -{ - if (b->b_alloc) freebytes(b->b_buf, (b->b_alloc)*sizeof(unsigned char)); - b->b_buf = NULL; - b->b_len = 0; - b->b_alloc = 0; -} -static void pdstring_bytes_realloc(t_pdstring_bytes *b, size_t n) -{ - pdstring_bytes_clear(b); - b->b_buf = n ? (unsigned char*)getbytes(n*sizeof(unsigned char)) : NULL; - b->b_alloc = n; -} -static void pdstring_bytes_init(t_pdstring_bytes *b, size_t n) -{ - pdstring_bytes_clear(b); - pdstring_bytes_realloc(b,n); -} - -/*--------------------------------------------------------------------- - * wchars - */ -static void pdstring_wchars_clear(t_pdstring_wchars *w) -{ - if (w->w_alloc) freebytes(w->w_buf, (w->w_alloc)*sizeof(wchar_t)); - w->w_buf = NULL; - w->w_len = 0; - w->w_alloc = 0; -} -static void pdstring_wchars_realloc(t_pdstring_wchars *w, size_t n) -{ - pdstring_wchars_clear(w); - w->w_buf = n ? (wchar_t*)getbytes(n*sizeof(wchar_t)) : NULL; - w->w_alloc = n; -} -static void pdstring_wchars_init(t_pdstring_wchars *w, size_t n) -{ - pdstring_wchars_clear(w); - pdstring_wchars_realloc(w,n); -} - -/*--------------------------------------------------------------------- - * atoms - */ -static void pdstring_atoms_clear(t_pdstring_atoms *a) -{ - if (a->a_alloc) freebytes(a->a_buf, (a->a_alloc)*sizeof(t_atom)); - a->a_buf = NULL; - a->a_len = 0; - a->a_alloc = 0; -} -static void pdstring_atoms_realloc(t_pdstring_atoms *a, size_t n) -{ - pdstring_atoms_clear(a); - a->a_buf = n ? (t_atom*)getbytes(n*sizeof(t_atom)) : NULL; - a->a_alloc = n; -} -static void pdstring_atoms_init(t_pdstring_atoms *a, size_t n) -{ - pdstring_atoms_clear(a); - pdstring_atoms_realloc(a,n); -} - - -/*===================================================================== - * Utilities - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * pdstring_any2bytes() - * + x is used for error reporting - * + uses x_binbuf for conversion - * + selector sel is added to binbuf too, if it is none of {NULL, &s_float, &s_list, &s_} - * + x_binbuf may be NULL, in which case a temporary t_binbuf is created and used - * - in this case, output bytes are copied into *dst, reallocating if required - * + if x_binbuf is given and non-NULL, dst may be NULL. - * - if dst is non-NULL, its values will be clobbered by those returned by - * binbuf_gettext() - */ -static void pdstring_any2bytes(void *x, t_pdstring_bytes *dst, t_symbol *sel, t_pdstring_atoms *src, t_binbuf *x_binbuf) -{ - int bb_is_tmp=0; - - //-- create temporary binbuf? - if (!x_binbuf) { - x_binbuf = binbuf_new(); - bb_is_tmp = 1; - } - - //-- prepare binbuf - binbuf_clear(x_binbuf); - - //-- binbuf_add(): selector - if (sel && sel != &s_float && sel != &s_list && sel != &s_) { - t_atom a; - SETSYMBOL((&a), sel); - binbuf_add(x_binbuf, 1, &a); - } - - //-- binbuf_add(): src atoms - binbuf_add(x_binbuf, src->a_len, src->a_buf); - - //-- output: get text string - if (bb_is_tmp) { - //-- temporary binbuf: copy text - char *text; - int len; - binbuf_gettext(x_binbuf, &text, &len); - - //-- reallocate? - if ( dst->b_alloc < len ) - pdstring_bytes_realloc(dst, len + PDSTRING_BYTES_GET); - - //-- copy - memcpy(dst->b_buf, text, len*sizeof(char)); - dst->b_len = len; - - //-- cleanup - binbuf_free(x_binbuf); - if (text) freebytes(text,len); - } - else if (dst) { - //-- permanent binbuf: clobber dst - pdstring_bytes_clear(dst); - binbuf_gettext(x_binbuf, ((char**)((void*)(&dst->b_buf))), &dst->b_len); - dst->b_alloc = dst->b_len; - } -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2any() - * + uses x_binbuf for conversion - * + x_binbuf may be NULL, in which case a temporary t_binbuf is created and used - * - in this case, output atoms are copied into *dst, reallocating if required - * + if x_binbuf is given and non-NULL, dst may be NULL. - * - if dst is non-NULL, its values will be clobbered by those returned by - * binbuf_getnatom() and binbuf_getvec() - */ -static void pdstring_bytes2any(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_binbuf *x_binbuf) -{ - int bb_is_tmp=0; - - //-- create temporary binbuf? - if (!x_binbuf) { - x_binbuf = binbuf_new(); - bb_is_tmp = 1; - } - - //-- populate binbuf - binbuf_clear(x_binbuf); - binbuf_text(x_binbuf, (char*)src->b_buf, src->b_len); - //PDSDEBUG(post("bytes2any[dst=%p,src=%p,bb=%p]: binbuf_print: ", dst,src,x_binbuf)); - //PDSDEBUG(binbuf_print(x_binbuf)); - - //-- populate atom list - if (bb_is_tmp) { - //-- temporary binbuf: copy atoms - t_atom *argv = binbuf_getvec(x_binbuf); - int argc = binbuf_getnatom(x_binbuf); - - //-- reallocate? - if ( dst->a_alloc < argc ) - pdstring_atoms_realloc(dst, argc + PDSTRING_ATOMS_GET); - - //-- copy - memcpy(dst->a_buf, argv, argc*sizeof(t_atom)); - dst->a_len = argc; - - //-- cleanup - binbuf_free(x_binbuf); - } - else if (dst) { - //-- permanent binbuf: clobber dst - dst->a_buf = binbuf_getvec(x_binbuf); - dst->a_len = binbuf_getnatom(x_binbuf); - dst->a_alloc = 0; //-- don't try to free this - } -} - - -/*-------------------------------------------------------------------- - * pdstring_atoms2bytes() - * + always appends a final NUL byte to *dst_buf, even if src_argv doesn't contain one - * + returns number of bytes actually written to *dst_buf, __including__ implicit trailing NUL - */ -static int pdstring_atoms2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_atoms *src, t_float x_eos) -{ - t_atom *argv = src->a_buf; - int argc = src->a_len; - unsigned char *s; - int new_len=0; - - /*-- re-allocate? --*/ - if (dst->b_alloc <= (argc+1)) - pdstring_bytes_realloc(dst, argc + 1 + PDSTRING_BYTES_GET); - - /*-- get byte string --*/ - for (s=dst->b_buf, new_len=0; argc > 0; argc--, argv++, s++, new_len++) - { - *s = atom_getfloat(argv); - if ((x_eos<0 && !*s) || (*s==x_eos)) { break; } /*-- hack: truncate at first EOS char --*/ - } - *s = '\0'; /*-- always append terminating NUL */ - dst->b_len = new_len; - - return new_len+1; -} - -/*-------------------------------------------------------------------- - * pdstring_atoms2wchars() - * + always appends a final NUL wchar_t to dst->w_buf, even if src->a_buf doesn't contain one - * + returns number of bytes actually written to dst->w_buf, __including__ implicit trailing NUL - * + but dst->w_len does NOT include implicit trailing NUL - */ -static int pdstring_atoms2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_atoms *src, t_float x_eos) -{ - t_atom *argv = src->a_buf; - int argc = src->a_len; - int new_len=0; - wchar_t *s; - - /*-- re-allocate? --*/ - if (dst->w_alloc <= (argc+1)) - pdstring_wchars_realloc(dst, argc + 1 + PDSTRING_WCHARS_GET); - - /*-- get wchar_t string --*/ - for (s=dst->w_buf, new_len=0; argc > 0; argc--, argv++, s++, new_len++) - { - *s = atom_getfloat(argv); - if ((x_eos<0 && !*s) || (*s==x_eos)) { break; } /*-- hack: truncate at first EOS char --*/ - } - *s = L'\0'; /*-- always append terminating NUL */ - dst->w_len = new_len; - - return new_len+1; -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2wchars() - */ -static int pdstring_bytes2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_bytes *src) -{ - size_t bi, wi; - - //-- re-allocate? - if ( dst->w_alloc < src->b_len ) - pdstring_wchars_realloc(dst, src->b_len + PDSTRING_WCHARS_GET); - - //-- convert - //PDSDEBUG(post("\nbytes2wchars[dst=%p,src=%p]: init", dst,src);) - mbtowc(NULL,NULL,0); //-- re-initialize conversion state for mbtowc() - for (bi=0,wi=0; bi<src->b_len; wi++) { - int nbytes = mbtowc(dst->w_buf+wi, (char*)(src->b_buf+bi), src->b_len-bi); - if (nbytes <= 0) { - if (nbytes < 0) { - pd_error(x,"pdstring_bytes2wchars(): malformed byte string \"%s\" at char '%c' - copying literal byte", src->b_buf, src->b_buf[bi]); - } - dst->w_buf[wi] = src->b_buf[bi]; - nbytes = 1; - } - bi += nbytes; - //PDSDEBUG(post("bytes2wchars[dst=%p,src=%p]: loop[bi=%d,wi=%d,src=%s]: nbytes=%d,wc=%u", dst,src, bi,wi,src, nbytes,dst->w_buf[wi])); - } - dst->w_len = wi; - return wi; -} - -/*-------------------------------------------------------------------- - * pdstring_wchars2bytes() - */ -static int pdstring_wchars2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_wchars *src) -{ - size_t bi, wi; - - //-- re-allocate? - if ( dst->b_alloc < src->w_len * MB_CUR_MAX ) - pdstring_bytes_realloc(dst, src->w_len * MB_CUR_MAX + PDSTRING_WCHARS_GET); - - //-- convert - for (bi=0,wi=0; wi < src->w_len; wi++) { - int nbytes = wctomb((char*)dst->b_buf+bi, src->w_buf[wi]); - if (nbytes <= 0) { - if (nbytes < 0) { - pd_error(x,"pdstring_wchars2bytes(): malformed wide string \"%S\" at wchar_t '%C' - forcing literal value", src->w_buf, src->w_buf[wi]); - } - dst->b_buf[bi] = src->w_buf[wi]; - nbytes = 1; - } - bi += nbytes; - } - dst->b_len = bi; - return bi; -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2atoms() - * + implicitly appends x_eos if >= 0 and != PDSTRING_EOS_NONE - */ -static void pdstring_bytes2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_float x_eos) -{ - int i; - - //-- re-allocate? - if ( dst->a_alloc <= src->b_len ) - pdstring_atoms_realloc(dst, src->b_len + 1 + PDSTRING_ATOMS_GET); - - //-- convert - for (i=0; i < src->b_len; i++) { - SETFLOAT((dst->a_buf+i), src->b_buf[i]); - } - dst->a_len = src->b_len; - - //-- append eos atom? - if (x_eos >= 0 && x_eos != PDSTRING_EOS_NONE) { - SETFLOAT(dst->a_buf+dst->a_len, x_eos); - dst->a_len++; - } -} - -/*-------------------------------------------------------------------- - * pdstring_wchars2atoms() - */ -static void pdstring_wchars2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_wchars *src) -{ - int i; - - //-- re-allocate? - if ( dst->a_alloc < src->w_len ) - pdstring_atoms_realloc(dst, src->w_len + PDSTRING_ATOMS_GET); - - //-- convert - for (i=0; i < src->w_len; i++) { - SETFLOAT((dst->a_buf+i), src->w_buf[i]); - } - dst->a_len = src->w_len; -} - - -#endif /* PDSTRING_UTILS_C */ diff --git a/pdstring+wchar/src/pdstringUtils.h b/pdstring+wchar/src/pdstringUtils.h deleted file mode 100644 index 85a72a5..0000000 --- a/pdstring+wchar/src/pdstringUtils.h +++ /dev/null @@ -1,452 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: pdstringUtils.h - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * Description: pdstring: common utilities (static include) - * - * Copyright (c) 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. - *=============================================================================*/ - -#ifndef PDSTRING_UTILS_H -#define PDSTRING_UTILS_H - -#include <string.h> -#include <m_pd.h> -#include <stdlib.h> -#include "mooPdUtils.h" - -/*===================================================================== - * Debugging - *=====================================================================*/ -#define PDSTRING_UTILS_DEBUG 1 -//#undef PDSTRING_UTILS_DEBUG - -#ifdef PDSTRING_UTILS_DEBUG -# define PDSDEBUG(x) x -#else -# define PDSDEBUG(x) -#endif - -/*===================================================================== - * Constants - *=====================================================================*/ - -/* PDSTRING_EOS_NONE - * + "safe" float value to use as x_eos if no truncation is desired - */ -#define PDSTRING_EOS_NONE 1e38f - -/* PDSTRING_DEFAULT_BUFLEN - * + common default buffer length - */ -#define PDSTRING_DEFAULT_BUFLEN 256 - -/* PDSTRING_DEFAULT_GET - * + common default buffer grow length - */ -#define PDSTRING_DEFAULT_GET 256 - -/* PDSTRING_BYSTES_GET - * + number of extra bytes to get when buffer must grow - */ -#define PDSTRING_BYTES_GET PDSTRING_DEFAULT_GET -#define PDSTRING_WCHARS_GET PDSTRING_DEFAULT_GET -#define PDSTRING_ATOMS_GET PDSTRING_DEFAULT_GET - -/*===================================================================== - * Structures & Types - *=====================================================================*/ - -/* t_pdstring_bytes - * + a byte-string buffer - */ -typedef struct _pdstring_bytes { - unsigned char *b_buf; //-- byte-string buffer - int b_len; //-- current length of b_buf - size_t b_alloc; //-- allocated size of b_buf -} t_pdstring_bytes; - -/* t_pdstring_wchars - * + a wide character buffer - */ -typedef struct _pdstring_wchars { - wchar_t *w_buf; //-- wide character buffer - int w_len; //-- current length of w_buf - size_t w_alloc; //-- allocated size of w_buf -} t_pdstring_wchars; - -/* t_pdstring_atoms - * + an atom-list buffer - */ -typedef struct _pdstring_atoms { - t_atom *a_buf; //-- t_atom buffer (aka argv) - int a_len; //-- current length of a_buf (aka argc) - size_t a_alloc; //-- allocated size of a_buf -} t_pdstring_atoms; - -/*===================================================================== - * Initialization - *=====================================================================*/ - -/*--------------------------------------------------------------------- - * bytes - */ -static void pdstring_bytes_clear(t_pdstring_bytes *b) -{ - if (b->b_alloc) freebytes(b->b_buf, (b->b_alloc)*sizeof(unsigned char)); - b->b_buf = NULL; - b->b_len = 0; - b->b_alloc = 0; -} -static void pdstring_bytes_realloc(t_pdstring_bytes *b, size_t n) -{ - pdstring_bytes_clear(b); - b->b_buf = n ? (unsigned char*)getbytes(n*sizeof(unsigned char)) : NULL; - b->b_alloc = n; -} -static void pdstring_bytes_init(t_pdstring_bytes *b, size_t n) -{ - pdstring_bytes_clear(b); - pdstring_bytes_realloc(b,n); -} - -/*--------------------------------------------------------------------- - * wchars - */ -static void pdstring_wchars_clear(t_pdstring_wchars *w) -{ - if (w->w_alloc) freebytes(w->w_buf, (w->w_alloc)*sizeof(wchar_t)); - w->w_buf = NULL; - w->w_len = 0; - w->w_alloc = 0; -} -static void pdstring_wchars_realloc(t_pdstring_wchars *w, size_t n) -{ - pdstring_wchars_clear(w); - w->w_buf = n ? (wchar_t*)getbytes(n*sizeof(wchar_t)) : NULL; - w->w_alloc = n; -} -static void pdstring_wchars_init(t_pdstring_wchars *w, size_t n) -{ - pdstring_wchars_clear(w); - pdstring_wchars_realloc(w,n); -} - -/*--------------------------------------------------------------------- - * atoms - */ -static void pdstring_atoms_clear(t_pdstring_atoms *a) -{ - if (a->a_alloc) freebytes(a->a_buf, (a->a_alloc)*sizeof(t_atom)); - a->a_buf = NULL; - a->a_len = 0; - a->a_alloc = 0; -} -static void pdstring_atoms_realloc(t_pdstring_atoms *a, size_t n) -{ - pdstring_atoms_clear(a); - a->a_buf = n ? (t_atom*)getbytes(n*sizeof(t_atom)) : NULL; - a->a_alloc = n; -} -static void pdstring_atoms_init(t_pdstring_atoms *a, size_t n) -{ - pdstring_atoms_clear(a); - pdstring_atoms_realloc(a,n); -} - - -/*===================================================================== - * Utilities - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * pdstring_any2bytes() - * + x is used for error reporting - * + uses x_binbuf for conversion - * + selector sel is added to binbuf too, if it is none of {NULL, &s_float, &s_list, &s_} - * + x_binbuf may be NULL, in which case a temporary t_binbuf is created and used - * - in this case, output bytes are copied into *dst, reallocating if required - * + if x_binbuf is given and non-NULL, dst may be NULL. - * - if dst is non-NULL, its values will be clobbered by those returned by - * binbuf_gettext() - */ -static void pdstring_any2bytes(void *x, t_pdstring_bytes *dst, t_symbol *sel, t_pdstring_atoms *src, t_binbuf *x_binbuf) -{ - int bb_is_tmp=0; - - //-- create temporary binbuf? - if (!x_binbuf) { - x_binbuf = binbuf_new(); - bb_is_tmp = 1; - } - - //-- prepare binbuf - binbuf_clear(x_binbuf); - - //-- binbuf_add(): selector - if (sel && sel != &s_float && sel != &s_list && sel != &s_) { - t_atom a; - SETSYMBOL((&a), sel); - binbuf_add(x_binbuf, 1, &a); - } - - //-- binbuf_add(): src atoms - binbuf_add(x_binbuf, src->a_len, src->a_buf); - - //-- output: get text string - if (bb_is_tmp) { - //-- temporary binbuf: copy text - char *text; - int len; - binbuf_gettext(x_binbuf, &text, &len); - - //-- reallocate? - if ( dst->b_alloc < len ) - pdstring_bytes_realloc(dst, len + PDSTRING_BYTES_GET); - - //-- copy - memcpy(dst->b_buf, text, len*sizeof(char)); - dst->b_len = len; - - //-- cleanup - binbuf_free(x_binbuf); - if (text) freebytes(text,len); - } - else if (dst) { - //-- permanent binbuf: clobber dst - pdstring_bytes_clear(dst); - binbuf_gettext(x_binbuf, ((char**)((void*)(&dst->b_buf))), &dst->b_len); - dst->b_alloc = dst->b_len; - } -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2any() - * + uses x_binbuf for conversion - * + x_binbuf may be NULL, in which case a temporary t_binbuf is created and used - * - in this case, output atoms are copied into *dst, reallocating if required - * + if x_binbuf is given and non-NULL, dst may be NULL. - * - if dst is non-NULL, its values will be clobbered by those returned by - * binbuf_getnatom() and binbuf_getvec() - */ -static void pdstring_bytes2any(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_binbuf *x_binbuf) -{ - int bb_is_tmp=0; - - //-- create temporary binbuf? - if (!x_binbuf) { - x_binbuf = binbuf_new(); - bb_is_tmp = 1; - } - - //-- populate binbuf - binbuf_clear(x_binbuf); - binbuf_text(x_binbuf, (char*)src->b_buf, src->b_len); - //PDSDEBUG(post("bytes2any[dst=%p,src=%p,bb=%p]: binbuf_print: ", dst,src,x_binbuf)); - //PDSDEBUG(binbuf_print(x_binbuf)); - - //-- populate atom list - if (bb_is_tmp) { - //-- temporary binbuf: copy atoms - t_atom *argv = binbuf_getvec(x_binbuf); - int argc = binbuf_getnatom(x_binbuf); - - //-- reallocate? - if ( dst->a_alloc < argc ) - pdstring_atoms_realloc(dst, argc + PDSTRING_ATOMS_GET); - - //-- copy - memcpy(dst->a_buf, argv, argc*sizeof(t_atom)); - dst->a_len = argc; - - //-- cleanup - binbuf_free(x_binbuf); - } - else if (dst) { - //-- permanent binbuf: clobber dst - dst->a_buf = binbuf_getvec(x_binbuf); - dst->a_len = binbuf_getnatom(x_binbuf); - dst->a_alloc = 0; //-- don't try to free this - } -} - - -/*-------------------------------------------------------------------- - * pdstring_atoms2bytes() - * + always appends a final NUL byte to *dst_buf, even if src_argv doesn't contain one - * + returns number of bytes actually written to *dst_buf, __including__ implicit trailing NUL - */ -static int pdstring_atoms2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_atoms *src, t_float x_eos) -{ - t_atom *argv = src->a_buf; - int argc = src->a_len; - unsigned char *s; - int new_len=0; - - /*-- re-allocate? --*/ - if (dst->b_alloc <= (argc+1)) - pdstring_bytes_realloc(dst, argc + 1 + PDSTRING_BYTES_GET); - - /*-- get byte string --*/ - for (s=dst->b_buf, new_len=0; argc > 0; argc--, argv++, s++, new_len++) - { - *s = atom_getfloat(argv); - if ((x_eos<0 && !*s) || (*s==x_eos)) { break; } /*-- hack: truncate at first EOS char --*/ - } - *s = '\0'; /*-- always append terminating NUL */ - dst->b_len = new_len; - - return new_len+1; -} - -/*-------------------------------------------------------------------- - * pdstring_atoms2wchars() - * + always appends a final NUL wchar_t to dst->w_buf, even if src->a_buf doesn't contain one - * + returns number of bytes actually written to dst->w_buf, __including__ implicit trailing NUL - * + but dst->w_len does NOT include implicit trailing NUL - */ -static int pdstring_atoms2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_atoms *src, t_float x_eos) -{ - t_atom *argv = src->a_buf; - int argc = src->a_len; - int new_len=0; - wchar_t *s; - - /*-- re-allocate? --*/ - if (dst->w_alloc <= (argc+1)) - pdstring_wchars_realloc(dst, argc + 1 + PDSTRING_WCHARS_GET); - - /*-- get wchar_t string --*/ - for (s=dst->w_buf, new_len=0; argc > 0; argc--, argv++, s++, new_len++) - { - *s = atom_getfloat(argv); - if ((x_eos<0 && !*s) || (*s==x_eos)) { break; } /*-- hack: truncate at first EOS char --*/ - } - *s = L'\0'; /*-- always append terminating NUL */ - dst->w_len = new_len; - - return new_len+1; -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2wchars() - */ -static int pdstring_bytes2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_bytes *src) -{ - size_t bi, wi; - - //-- re-allocate? - if ( dst->w_alloc < src->b_len ) - pdstring_wchars_realloc(dst, src->b_len + PDSTRING_WCHARS_GET); - - //-- convert - //PDSDEBUG(post("\nbytes2wchars[dst=%p,src=%p]: init", dst,src);) - mbtowc(NULL,NULL,0); //-- re-initialize conversion state for mbtowc() - for (bi=0,wi=0; bi<src->b_len; wi++) { - int nbytes = mbtowc(dst->w_buf+wi, (char*)(src->b_buf+bi), src->b_len-bi); - if (nbytes <= 0) { - if (nbytes < 0) { - pd_error(x,"pdstring_bytes2wchars(): malformed byte string \"%s\" at char '%c' - copying literal byte", src->b_buf, src->b_buf[bi]); - } - dst->w_buf[wi] = src->b_buf[bi]; - nbytes = 1; - } - bi += nbytes; - //PDSDEBUG(post("bytes2wchars[dst=%p,src=%p]: loop[bi=%d,wi=%d,src=%s]: nbytes=%d,wc=%u", dst,src, bi,wi,src, nbytes,dst->w_buf[wi])); - } - dst->w_len = wi; - return wi; -} - -/*-------------------------------------------------------------------- - * pdstring_wchars2bytes() - */ -static int pdstring_wchars2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_wchars *src) -{ - size_t bi, wi; - - //-- re-allocate? - if ( dst->b_alloc < src->w_len * MB_CUR_MAX ) - pdstring_bytes_realloc(dst, src->w_len * MB_CUR_MAX + PDSTRING_WCHARS_GET); - - //-- convert - for (bi=0,wi=0; wi < src->w_len; wi++) { - int nbytes = wctomb((char*)dst->b_buf+bi, src->w_buf[wi]); - if (nbytes <= 0) { - if (nbytes < 0) { - pd_error(x,"pdstring_wchars2bytes(): malformed wide character (%u) - bashing to byte", src->w_buf[wi]); - } - dst->b_buf[bi] = src->w_buf[wi]; - nbytes = 1; - } - bi += nbytes; - } - dst->b_len = bi; - return bi; -} - - -/*-------------------------------------------------------------------- - * pdstring_bytes2atoms() - * + implicitly appends x_eos if >= 0 and != PDSTRING_EOS_NONE - */ -static void pdstring_bytes2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_float x_eos) -{ - int i; - - //-- re-allocate? - if ( dst->a_alloc <= src->b_len ) - pdstring_atoms_realloc(dst, src->b_len + 1 + PDSTRING_ATOMS_GET); - - //-- convert - for (i=0; i < src->b_len; i++) { - SETFLOAT((dst->a_buf+i), src->b_buf[i]); - } - dst->a_len = src->b_len; - - //-- append eos atom? - if (x_eos >= 0 && x_eos != PDSTRING_EOS_NONE) { - SETFLOAT(dst->a_buf+dst->a_len, x_eos); - dst->a_len++; - } -} - -/*-------------------------------------------------------------------- - * pdstring_wchars2atoms() - */ -static void pdstring_wchars2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_wchars *src) -{ - int i; - - //-- re-allocate? - if ( dst->a_alloc < src->w_len ) - pdstring_atoms_realloc(dst, src->w_len + PDSTRING_ATOMS_GET); - - //-- convert - for (i=0; i < src->w_len; i++) { - SETFLOAT((dst->a_buf+i), src->w_buf[i]); - } - dst->a_len = src->w_len; -} - - -#endif /* PDSTRING_UTILS_H */ diff --git a/pdstring+wchar/src/unsigned.pd b/pdstring+wchar/src/unsigned.pd deleted file mode 100644 index d86c773..0000000 --- a/pdstring+wchar/src/unsigned.pd +++ /dev/null @@ -1,27 +0,0 @@ -#N canvas 206 54 450 300 10; -#X floatatom 253 98 5 0 0 1 byte_value - -; -#X obj 267 158 print s2a; -#X floatatom 253 220 5 0 0 0 - - -; -#X msg 253 60 -10; -#X msg 291 60 246; -#X floatatom 86 219 5 0 0 0 - - -; -#X floatatom 88 94 5 0 0 1 byte_value - -; -#X msg 88 61 -10; -#X msg 126 61 246; -#X obj 86 127 bytes2any; -#X obj 86 187 any2bytes; -#X obj 100 157 print s2b; -#X obj 253 128 string2any; -#X obj 253 188 any2string; -#X connect 0 0 12 0; -#X connect 3 0 0 0; -#X connect 4 0 0 0; -#X connect 6 0 9 0; -#X connect 7 0 6 0; -#X connect 8 0 6 0; -#X connect 9 0 10 0; -#X connect 9 0 11 0; -#X connect 10 0 5 0; -#X connect 12 0 1 0; -#X connect 12 0 13 0; -#X connect 13 0 2 0; diff --git a/pdstring+wchar/src/wchars2any-help.pd b/pdstring+wchar/src/wchars2any-help.pd deleted file mode 100644 index d57343e..0000000 --- a/pdstring+wchar/src/wchars2any-help.pd +++ /dev/null @@ -1,42 +0,0 @@ -#N canvas 101 18 612 604 10; -#X text 13 52 INLETS:; -#X text 309 54 OUTLETS:; -#X text 325 68 1 - pd messages; -#X text 325 82 2 - bang on done; -#X msg 24 113 97 32 98 32 99; -#X msg 39 135 97 0 98 0 99; -#X msg 92 206 0; -#X msg 60 206 -1; -#X msg 124 206 32; -#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 <moocow@ling.uni-potsdam.de>; -#X text 27 83 2 - EOS character (float); -#X text 161 121 lists of floats are converted to pd messages.; -#X text 168 161 ... selector is ignored ...; -#X text 21 571 SEE ALSO:; -#X obj 102 570 pdstring; -#X text 13 30 SYNTAX: wchars2any [INITIAL_BUFSIZE [EOS_CHAR]]; -#X obj 131 454 print wchars2any-help-done; -#X obj 24 529 print wchars2any-help; -#X msg 54 161 StringThing 97; -#X obj 24 350 wchars2any 128 0; -#X text 59 7 wchars2any : convert lists of wchar_t values to pd messages -; -#X text 27 68 1 - wchar_t-valued float lists; -#X text 166 202 The second inlet is as for [bytes2any]; -#X obj 169 570 locale; -#X connect 4 0 23 0; -#X connect 5 0 23 0; -#X connect 6 0 23 1; -#X connect 7 0 23 1; -#X connect 8 0 23 1; -#X connect 22 0 23 0; -#X connect 23 0 21 0; -#X connect 23 1 20 0; diff --git a/pdstring+wchar/src/wchars2any.pd b/pdstring+wchar/src/wchars2any.pd deleted file mode 100644 index 63bdc26..0000000 --- a/pdstring+wchar/src/wchars2any.pd +++ /dev/null @@ -1,12 +0,0 @@ -#N canvas 398 276 384 218 10; -#X obj 68 22 inlet; -#X obj 221 22 inlet; -#X obj 68 112 bytes2any \$1 \$2; -#X obj 68 73 wchars2bytes \$1; -#X obj 68 146 outlet; -#X obj 168 146 outlet; -#X connect 0 0 3 0; -#X connect 1 0 2 1; -#X connect 2 0 4 0; -#X connect 2 1 5 0; -#X connect 3 0 2 0; diff --git a/pdstring+wchar/src/wchars2bytes-help.pd b/pdstring+wchar/src/wchars2bytes-help.pd deleted file mode 100644 index b892bea..0000000 --- a/pdstring+wchar/src/wchars2bytes-help.pd +++ /dev/null @@ -1,44 +0,0 @@ -#N canvas 66 8 522 426 10; -#X text 11 46 INLETS:; -#X text 269 48 OUTLETS:; -#X text 283 64 1 - byte-valued float lists; -#X text 21 62 1 - wchar_t-valued float lists; -#X msg 24 95 97 32 98 32 99; -#X msg 45 229 228 246 252; -#X msg 71 159 C; -#N canvas 0 0 338 182 locale_LC_CTYPE 0; -#X obj 48 124 locale; -#X obj 48 36 inlet; -#X obj 48 64 symbol; -#X msg 48 92 set LC_CTYPE \$1; -#X text 57 143 + requires the "locale" external; -#X connect 1 0 2 0; -#X connect 2 0 3 0; -#X connect 3 0 0 0; -#X restore 103 190 pd locale_LC_CTYPE; -#X text 213 393 Bryan Jurish <moocow@ling.uni-potsdam.de>; -#X text 9 377 SEE ALSO:; -#X obj 24 394 pdstring; -#X obj 91 394 locale; -#X text 11 355 BUGS: float representation is only safe up to 24-bit -values; -#X text 81 5 wchars2bytes : convert wide characters to (multiple) bytes -; -#X text 11 27 SYNTAX: wchars2bytes [INITIAL_BUFSIZE]; -#X msg 103 159 en_DK.ISO-8859-1; -#X msg 225 159 en_DK.UTF-8; -#X text 69 129 Greater values are interpreted according to the current -locale's LC_CTYPE category: here are some examples:; -#X text 145 97 Values <= 127 are unchanged; -#X msg 47 260 960 948; -#X text 157 229 "ä ö ü" \, ISO-8859-1 safe; -#X text 159 259 "&pi &delta" \, not ISO-8859-1 safe; -#X obj 24 310 wchars2bytes; -#X obj 24 334 print wchars2bytes-help; -#X connect 4 0 22 0; -#X connect 5 0 22 0; -#X connect 6 0 7 0; -#X connect 15 0 7 0; -#X connect 16 0 7 0; -#X connect 19 0 22 0; -#X connect 22 0 23 0; diff --git a/pdstring+wchar/src/wchars2bytes-test.pd b/pdstring+wchar/src/wchars2bytes-test.pd deleted file mode 100644 index 2a5bcc5..0000000 --- a/pdstring+wchar/src/wchars2bytes-test.pd +++ /dev/null @@ -1,46 +0,0 @@ -#N canvas 376 34 606 300 10; -#X obj 114 136 bytes2wchars; -#X obj 138 168 print wchars; -#X obj 323 222 locale; -#X msg 323 149 get; -#X msg 359 199 set LC_CTYPE \$1; -#X obj 359 178 symbol; -#X msg 359 147 C; -#X msg 393 147 en_US.ISO-8859-1; -#X msg 515 147 en_US.UTF-8; -#X obj 322 246 print locale; -#X msg 37 41 246; -#X floatatom 56 178 5 0 0 0 - - -; -#X msg 37 61 195 182; -#X text 35 23 ö \;; -#X msg 159 61 197 147; -#X text 155 23 &oelig \;; -#X msg 159 39 339; -#X msg 245 37 960; -#X msg 245 59 207 128; -#X text 245 21 &pi \;; -#X obj 391 120 loadbang; -#X text 93 41 ucs-4; -#X text 95 59 utf-8; -#X msg 325 61 207 128 0 197 147 0 195 182 0; -#X obj 114 198 wchars2bytes; -#X obj 112 226 print bytes; -#X connect 0 0 1 0; -#X connect 0 0 11 0; -#X connect 0 0 24 0; -#X connect 2 0 9 0; -#X connect 3 0 2 0; -#X connect 4 0 2 0; -#X connect 5 0 4 0; -#X connect 6 0 5 0; -#X connect 7 0 5 0; -#X connect 8 0 5 0; -#X connect 10 0 0 0; -#X connect 12 0 0 0; -#X connect 14 0 0 0; -#X connect 16 0 0 0; -#X connect 17 0 0 0; -#X connect 18 0 0 0; -#X connect 20 0 7 0; -#X connect 23 0 0 0; -#X connect 24 0 25 0; diff --git a/pdstring+wchar/src/wchars2bytes.c b/pdstring+wchar/src/wchars2bytes.c deleted file mode 100644 index 8c6f74d..0000000 --- a/pdstring+wchar/src/wchars2bytes.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C -*- */ -/*=============================================================================*\ - * File: wchars2bytes.c - * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> - * Description: convert wchar_t-valued atom lists to byte-valued atom lists - * - * Copyright (c) 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 <string.h> -#include <wchar.h> -#include <stdlib.h> -#include <m_pd.h> - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "mooPdUtils.h" -#include "pdstringUtils.h" - -/* black magic */ -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/*-------------------------------------------------------------------- - * DEBUG - *--------------------------------------------------------------------*/ - -/*===================================================================== - * Constants - *=====================================================================*/ -static char *wchars2bytes_banner = "wchars2bytes: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; - -#define WCHARS2BYTES_DEFAULT_BUFLEN PDSTRING_DEFAULT_BUFLEN - -/*===================================================================== - * Structures and Types: any2string - *=====================================================================*/ - -static t_class *wchars2bytes_class; - -typedef struct _wchars2bytes -{ - t_object x_obj; - t_pdstring_wchars x_wchars; //-- wide character buffer - t_pdstring_bytes x_bytes; //-- byte buffer - t_pdstring_atoms x_atoms; //-- atoms to output - t_outlet *x_outlet; -} t_wchars2bytes; - - -/*===================================================================== - * Methods - *=====================================================================*/ - -/*-------------------------------------------------------------------- - * anything - */ -static void wchars2bytes_anything(t_wchars2bytes *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - //-- convert arg_atoms -> wchars -> bytes -> atoms - t_pdstring_atoms arg_atoms = {argv,argc,0}; - pdstring_atoms2wchars(x, &x->x_wchars, &arg_atoms, PDSTRING_EOS_NONE); - pdstring_wchars2bytes(x, &x->x_bytes, &x->x_wchars); - pdstring_bytes2atoms (x, &x->x_atoms, &x->x_bytes, PDSTRING_EOS_NONE); - - //-- output - outlet_anything(x->x_outlet, &s_list, x->x_atoms.a_len, x->x_atoms.a_buf); -} - - -/*-------------------------------------------------------------------- - * new - */ -static void *wchars2bytes_new(MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) -{ - t_wchars2bytes *x = (t_wchars2bytes *)pd_new(wchars2bytes_class); - int bufsize = PDSTRING_DEFAULT_BUFLEN; - - //-- args: 0: bufsize - if (argc > 0) { - int initial_bufsize = atom_getintarg(0,argc,argv); - if (initial_bufsize > 0) bufsize = initial_bufsize; - } - - //-- allocate - pdstring_wchars_init(&x->x_wchars, bufsize); - pdstring_bytes_init (&x->x_bytes, bufsize); - pdstring_atoms_init (&x->x_atoms, bufsize); - - //-- outlets - x->x_outlet = outlet_new(&x->x_obj, &s_list); - - return (void *)x; -} - -/*-------------------------------------------------------------------- - * free - */ -static void wchars2bytes_free(t_wchars2bytes *x) -{ - pdstring_wchars_clear(&x->x_wchars); - pdstring_bytes_clear(&x->x_bytes); - pdstring_atoms_clear(&x->x_atoms); - outlet_free(x->x_outlet); - return; -} - -/*-------------------------------------------------------------------- - * setup: guts - */ -void wchars2bytes_setup_guts(void) -{ - //-- class - wchars2bytes_class = class_new(gensym("wchars2bytes"), - (t_newmethod)wchars2bytes_new, - (t_method)wchars2bytes_free, - sizeof(t_wchars2bytes), - CLASS_DEFAULT, - A_GIMME, //-- initial_bufsize - 0); - - //-- methods - class_addanything(wchars2bytes_class, (t_method)wchars2bytes_anything); - - //-- help symbol - //class_sethelpsymbol(wchars2bytes_class, gensym("wchars2bytes-help.pd")); //-- breaks pd-extended help lookup -} - -/*-------------------------------------------------------------------- - * setup - */ -void wchars2bytes_setup(void) -{ - post(wchars2bytes_banner); - wchars2bytes_setup_guts(); -} |