From 4be9db3a7bee4bb8c254ae26253a7ed70390589b Mon Sep 17 00:00:00 2001 From: Bryan Jurish Date: Tue, 27 Jan 2009 21:39:35 +0000 Subject: + delegated optional single-object-external mish-mash to src/Makefile.am using AM_CONDITIONAL + for --enable-object-externals builds, install actual links for 'any2string', 'string2any' aliases - requires corresponding setup() routines in *bytes* + added printbytes, printwchars objects svn path=/trunk/externals/moocow/pdstring/; revision=10661 --- Makefile.in | 4 +- config/Makefile.in | 4 +- configure | 84 ++++++--- configure.ac | 26 +-- src/Makefile.am | 71 ++++++-- src/Makefile.in | 142 ++++++++++----- src/any2bytes.c | 28 ++- src/bytes2any.c | 21 ++- src/pdstring-help.pd | 40 +++-- src/pdstring.c | 7 + src/pdstringUtils.c | 450 ++++++++++++++++++++++++++++++++++++++++++++++++ src/pdstringUtils.h | 334 +++++------------------------------ src/printbytes-help.pd | 23 +++ src/printbytes-test.pd | 45 +++++ src/printbytes.c | 142 +++++++++++++++ src/printwchars-help.pd | 21 +++ src/printwchars-test.pd | 45 +++++ src/printwchars.c | 140 +++++++++++++++ src/stringalias-test.pd | 18 ++ src/wchars2any-help.pd | 13 +- 20 files changed, 1235 insertions(+), 423 deletions(-) create mode 100644 src/pdstringUtils.c create mode 100644 src/printbytes-help.pd create mode 100644 src/printbytes-test.pd create mode 100644 src/printbytes.c create mode 100644 src/printwchars-help.pd create mode 100644 src/printwchars-test.pd create mode 100644 src/printwchars.c create mode 100644 src/stringalias-test.pd diff --git a/Makefile.in b/Makefile.in index 606b280..3385acc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -112,6 +112,7 @@ LDFLAGS = @LDFLAGS@ LFLAGS = @LFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ @@ -127,11 +128,12 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDEXT = @PDEXT@ -PD_OBJECT_EXTERNALS = @PD_OBJECT_EXTERNALS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WANT_OBJECT_EXTERNALS_FALSE = @WANT_OBJECT_EXTERNALS_FALSE@ +WANT_OBJECT_EXTERNALS_TRUE = @WANT_OBJECT_EXTERNALS_TRUE@ WFLAGS = @WFLAGS@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/config/Makefile.in b/config/Makefile.in index a05e281..49efd34 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -85,6 +85,7 @@ LDFLAGS = @LDFLAGS@ LFLAGS = @LFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ @@ -100,11 +101,12 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDEXT = @PDEXT@ -PD_OBJECT_EXTERNALS = @PD_OBJECT_EXTERNALS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WANT_OBJECT_EXTERNALS_FALSE = @WANT_OBJECT_EXTERNALS_FALSE@ +WANT_OBJECT_EXTERNALS_TRUE = @WANT_OBJECT_EXTERNALS_TRUE@ WFLAGS = @WFLAGS@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/configure b/configure index ca591e6..beb94e5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for pdstring 0.08. +# Generated by GNU Autoconf 2.61 for pdstring 0.09. # # Report bugs to . # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='pdstring' PACKAGE_TARNAME='pdstring' -PACKAGE_VERSION='0.08' -PACKAGE_STRING='pdstring 0.08' +PACKAGE_VERSION='0.09' +PACKAGE_STRING='pdstring 0.09' PACKAGE_BUGREPORT='moocow@ling.uni-potsdam.de' ac_default_prefix=/usr/local @@ -653,6 +653,7 @@ AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE +LN_S AFLAGS DFLAGS IFLAGS @@ -665,7 +666,8 @@ BUGREPORT MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT -PD_OBJECT_EXTERNALS +WANT_OBJECT_EXTERNALS_TRUE +WANT_OBJECT_EXTERNALS_FALSE pddir pddocdir pdincludedir @@ -1184,7 +1186,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pdstring 0.08 to adapt to many kinds of systems. +\`configure' configures pdstring 0.09 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1250,7 +1252,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pdstring 0.08:";; + short | recursive ) echo "Configuration of pdstring 0.09:";; esac cat <<\_ACEOF @@ -1346,7 +1348,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pdstring configure 0.08 +pdstring configure 0.09 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1360,7 +1362,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pdstring $as_me 0.08, which was +It was created by pdstring $as_me 0.09, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2035,7 +2037,7 @@ fi # Define the identity of the package. PACKAGE=pdstring - VERSION=0.08 + VERSION=0.09 cat >>confdefs.h <<_ACEOF @@ -3359,6 +3361,17 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + @@ -3571,10 +3584,7 @@ echo "${ECHO_T}automake v${am__api_version}: on build" >&6; } ;; esac -##------- PD externals: hack EXEEXT? -PD_LIB_EXTERNALS="pdstring" -PD_OBJ_EXTERNALS="any2bytes bytes2any bytes2wchars wchars2bytes" - +##------- Enable single-object externals? # Check whether --enable-object-externals was given. if test "${enable_object_externals+set}" = set; then enableval=$enable_object_externals; want_objext="$enableval" @@ -3585,27 +3595,32 @@ fi { echo "$as_me:$LINENO: checking whether to build single-object externals" >&5 echo $ECHO_N "checking whether to build single-object externals... $ECHO_C" >&6; } -##-- always build lib -PD_OBJECT_EXTERNALS="pdstring${buildext}" - if test "$want_objext" != "no" ; then ##-- single-objects { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } - for ext in $PD_OBJ_EXTERNALS ; do - PD_OBJECT_EXTERNALS="$PD_OBJECT_EXTERNALS ${ext}${buildext}" - done cat >>confdefs.h <<\_ACEOF #define PDSTRING_OBJECT_EXTERNALS 1 _ACEOF else - ##-- libs + ##-- lib only { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi +##-- add automake conditional for object externals + + +if test "$want_objext" != "no"; then + WANT_OBJECT_EXTERNALS_TRUE= + WANT_OBJECT_EXTERNALS_FALSE='#' +else + WANT_OBJECT_EXTERNALS_TRUE='#' + WANT_OBJECT_EXTERNALS_FALSE= +fi + @@ -3732,6 +3747,10 @@ echo "${ECHO_T}no" >&6; } fi +if test "$GCC" = "yes"; then + WFLAGS="-Wall -Winline -W -Wno-unused" +fi + ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ## compiled @@ -3747,6 +3766,8 @@ _ACEOF ## /compiled ##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ## BEGIN machine-dependent variables @@ -3935,6 +3956,13 @@ echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${WANT_OBJECT_EXTERNALS_TRUE}" && test -z "${WANT_OBJECT_EXTERNALS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"WANT_OBJECT_EXTERNALS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"WANT_OBJECT_EXTERNALS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -4235,7 +4263,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pdstring $as_me 0.08, which was +This file was extended by pdstring $as_me 0.09, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4288,7 +4316,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -pdstring config.status 0.08 +pdstring config.status 0.09 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -4542,6 +4570,7 @@ AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +LN_S!$LN_S$ac_delim AFLAGS!$AFLAGS$ac_delim DFLAGS!$DFLAGS$ac_delim IFLAGS!$IFLAGS$ac_delim @@ -4554,7 +4583,8 @@ BUGREPORT!$BUGREPORT$ac_delim MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim -PD_OBJECT_EXTERNALS!$PD_OBJECT_EXTERNALS$ac_delim +WANT_OBJECT_EXTERNALS_TRUE!$WANT_OBJECT_EXTERNALS_TRUE$ac_delim +WANT_OBJECT_EXTERNALS_FALSE!$WANT_OBJECT_EXTERNALS_FALSE$ac_delim pddir!$pddir$ac_delim pddocdir!$pddocdir$ac_delim pdincludedir!$pdincludedir$ac_delim @@ -4564,7 +4594,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -4583,7 +4613,7 @@ fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g @@ -4596,8 +4626,6 @@ N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g CEOF$ac_eof _ACEOF @@ -4845,7 +4873,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed 's/|#_!!_#|//g' >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && diff --git a/configure.ac b/configure.ac index 4ebfa48..2793398 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.5) dnl Some handy macros define([THE_PACKAGE_NAME], [pdstring]) -define([THE_PACKAGE_VERSION], [0.08]) +define([THE_PACKAGE_VERSION], [0.09]) define([THE_PACKAGE_AUTHOR], [moocow@ling.uni-potsdam.de]) AC_INIT(THE_PACKAGE_NAME, THE_PACKAGE_VERSION, THE_PACKAGE_AUTHOR) @@ -36,6 +36,7 @@ dnl Programs, prefix dnl AC_PROG_CC AC_PROG_INSTALL +AC_PROG_LN_S AC_PREFIX_DEFAULT(/usr/local) dnl @@ -96,32 +97,25 @@ case "${am__api_version}" in ;; esac -##------- PD externals: hack EXEEXT? -PD_LIB_EXTERNALS="pdstring" -PD_OBJ_EXTERNALS="any2bytes bytes2any bytes2wchars wchars2bytes" - +##------- Enable single-object externals? AC_ARG_ENABLE(object-externals, AC_HELP_STRING([--enable-object-externals], [Whether to build single-object externals (default=no)]), [want_objext="$enableval"], [want_objext="no"]) AC_MSG_CHECKING([whether to build single-object externals]) -##-- always build lib -PD_OBJECT_EXTERNALS="pdstring${buildext}" - if test "$want_objext" != "no" ; then ##-- single-objects AC_MSG_RESULT(yes) - for ext in $PD_OBJ_EXTERNALS ; do - PD_OBJECT_EXTERNALS="$PD_OBJECT_EXTERNALS ${ext}${buildext}" - done AC_DEFINE(PDSTRING_OBJECT_EXTERNALS,1, [Define this if you are building single-object externals]) else - ##-- libs + ##-- lib only AC_MSG_RESULT(no) fi -AC_SUBST(PD_OBJECT_EXTERNALS) + +##-- add automake conditional for object externals +AM_CONDITIONAL(WANT_OBJECT_EXTERNALS, [test "$want_objext" != "no"]) dnl @@ -182,6 +176,10 @@ else fi AC_SUBST(DEBUG) +if test "$GCC" = "yes"; then + WFLAGS="-Wall -Winline -W -Wno-unused" +fi + ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ## compiled AC_DEFINE_UNQUOTED(PDSTRING_DATE, "`date`", [Date this external was configured]) @@ -189,6 +187,8 @@ AC_DEFINE_UNQUOTED(PDSTRING_USER, "$USER", [User who configured this e ## /compiled ##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ## BEGIN machine-dependent variables diff --git a/src/Makefile.am b/src/Makefile.am index 7f8df55..9b70299 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,16 @@ EXEEXT = .@PDEXT@ #----------------------------------------------------------------------- ## --- externals -pdexterns_PROGRAMS = @PD_OBJECT_EXTERNALS@ +pdexterns_PROGRAMS = pdstring +if WANT_OBJECT_EXTERNALS + pdexterns_PROGRAMS += \ + any2bytes \ + bytes2any \ + bytes2wchars \ + wchars2bytes \ + printbytes \ + printwchars +endif ## --- possible externals EXTRA_PROGRAMS = \ @@ -35,7 +44,9 @@ EXTRA_PROGRAMS = \ any2bytes \ bytes2any \ bytes2wchars \ - wchars2bytes + wchars2bytes \ + printbytes \ + printwchars ## --- patches pdexterns_DATA = \ @@ -52,22 +63,52 @@ pddoc_DATA = \ any2wchars-help.pd \ wchars2any-help.pd + printbytes-help.pd + printwchars-help.pd + #----------------------------------------------------------------------- # sources #----------------------------------------------------------------------- -any2bytes_SOURCES = any2bytes.c mooPdUtils.h pdstringUtils.h +any2bytes_SOURCES = any2bytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c -bytes2any_SOURCES = bytes2any.c mooPdUtils.h pdstringUtils.h +bytes2any_SOURCES = bytes2any.c mooPdUtils.h pdstringUtils.h pdstringUtils.c -bytes2wchars_SOURCES = bytes2wchars.c mooPdUtils.h pdstringUtils.h +bytes2wchars_SOURCES = bytes2wchars.c mooPdUtils.h pdstringUtils.h pdstringUtils.c -wchars2bytes_SOURCES = wchars2bytes.c mooPdUtils.h pdstringUtils.h +wchars2bytes_SOURCES = wchars2bytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c -pdstring_SOURCES = pdstring.c mooPdUtils.h pdstringUtils.h +printbytes_SOURCES = printbytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c + +printwchars_SOURCES = printwchars.c mooPdUtils.h pdstringUtils.h pdstringUtils.c + +pdstring_SOURCES = pdstring.c mooPdUtils.h pdstringUtils.h pdstringUtils.c + +#----------------------------------------------------------------------- +# aliases via install hook +#----------------------------------------------------------------------- + +if WANT_OBJECT_EXTERNALS +all-local: + rm -f any2string.$(PDEXT) + rm -f string2any.$(PDEXT) + $(LN_S) any2bytes.$(PDEXT) any2string.$(PDEXT) + $(LN_S) bytes2any.$(PDEXT) string2any.$(PDEXT) +endif + +install-data-hook: + rm -f $(pdexternsdir)/any2string.$(PDEXT) + rm -f $(pdexternsdir)/string2any.$(PDEXT) +if WANT_OBJECT_EXTERNALS + $(LN_S) any2bytes.$(PDEXT) $(pdexternsdir)/any2string.$(PDEXT) + $(LN_S) bytes2any.$(PDEXT) $(pdexternsdir)/string2any.$(PDEXT) +endif + +uninstall-local: + rm -f $(pdexternsdir)/any2string.$(PDEXT) + rm -f $(pdexternsdir)/string2any.$(PDEXT) -pdstring.$(OBJECT): $(any2bytes_SOURCES) $(bytes2any_SOURCES) $(bytes2wchars_SOURCES) $(wchars2bytes_SOURCES) #----------------------------------------------------------------------- # external compilation : flags @@ -78,7 +119,7 @@ DFLAGS = @DFLAGS@ IFLAGS = @IFLAGS@ LFLAGS = @LFLAGS@ OFLAGS = @OFLAGS@ -WFLAGS = -Wall -Winline +WFLAGS = @WFLAGS@ #GLIB_IFLAGS = @GLIB_IFLAGS@ #GLIB_LFLAGS = @GLIB_LFLAGS@ @@ -86,15 +127,11 @@ WFLAGS = -Wall -Winline AM_CPPFLAGS = $(IFLAGS) $(GLIB_IFLAGS) $(DFLAGS) AM_CFLAGS = $(OFLAGS) $(WFLAGS) $(AFLAGS) -pdstring_LDFLAGS = $(LFLAGS) - -bytes2any_LDFLAGS = $(LFLAGS) - -any2bytes_LDFLAGS = $(LFLAGS) - -bytes2wchars_LDFLAGS = $(LFLAGS) +AM_LDFLAGS ?= $(LFLAGS) -wchars2bytes_LDFLAGS = $(LFLAGS) +#pdstring_LDFLAGS = $(LFLAGS) +#bytes2any_LDFLAGS = $(LFLAGS) +##string2any_LDFLAGS = $(bytes2any_LDFLAGS) #----------------------------------------------------------------------- # Variables: cleanup diff --git a/src/Makefile.in b/src/Makefile.in index ffc11f8..48056b8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -49,9 +49,18 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -pdexterns_PROGRAMS = @PD_OBJECT_EXTERNALS@ +pdexterns_PROGRAMS = pdstring$(EXEEXT) $(am__EXEEXT_1) +@WANT_OBJECT_EXTERNALS_TRUE@am__append_1 = \ +@WANT_OBJECT_EXTERNALS_TRUE@ any2bytes \ +@WANT_OBJECT_EXTERNALS_TRUE@ bytes2any \ +@WANT_OBJECT_EXTERNALS_TRUE@ bytes2wchars \ +@WANT_OBJECT_EXTERNALS_TRUE@ wchars2bytes \ +@WANT_OBJECT_EXTERNALS_TRUE@ printbytes \ +@WANT_OBJECT_EXTERNALS_TRUE@ printwchars + EXTRA_PROGRAMS = pdstring$(EXEEXT) any2bytes$(EXEEXT) \ - bytes2any$(EXEEXT) bytes2wchars$(EXEEXT) wchars2bytes$(EXEEXT) + bytes2any$(EXEEXT) bytes2wchars$(EXEEXT) wchars2bytes$(EXEEXT) \ + printbytes$(EXEEXT) printwchars$(EXEEXT) subdir = src SUBDIRS = DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -63,23 +72,37 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = +@WANT_OBJECT_EXTERNALS_TRUE@am__EXEEXT_1 = any2bytes$(EXEEXT) \ +@WANT_OBJECT_EXTERNALS_TRUE@ bytes2any$(EXEEXT) \ +@WANT_OBJECT_EXTERNALS_TRUE@ bytes2wchars$(EXEEXT) \ +@WANT_OBJECT_EXTERNALS_TRUE@ wchars2bytes$(EXEEXT) \ +@WANT_OBJECT_EXTERNALS_TRUE@ printbytes$(EXEEXT) \ +@WANT_OBJECT_EXTERNALS_TRUE@ printwchars$(EXEEXT) am__installdirs = "$(DESTDIR)$(pdexternsdir)" "$(DESTDIR)$(pddocdir)" \ "$(DESTDIR)$(pdexternsdir)" pdexternsPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(pdexterns_PROGRAMS) -am_any2bytes_OBJECTS = any2bytes.$(OBJEXT) +am_any2bytes_OBJECTS = any2bytes.$(OBJEXT) pdstringUtils.$(OBJEXT) any2bytes_OBJECTS = $(am_any2bytes_OBJECTS) any2bytes_LDADD = $(LDADD) -am_bytes2any_OBJECTS = bytes2any.$(OBJEXT) +am_bytes2any_OBJECTS = bytes2any.$(OBJEXT) pdstringUtils.$(OBJEXT) bytes2any_OBJECTS = $(am_bytes2any_OBJECTS) bytes2any_LDADD = $(LDADD) -am_bytes2wchars_OBJECTS = bytes2wchars.$(OBJEXT) +am_bytes2wchars_OBJECTS = bytes2wchars.$(OBJEXT) \ + pdstringUtils.$(OBJEXT) bytes2wchars_OBJECTS = $(am_bytes2wchars_OBJECTS) bytes2wchars_LDADD = $(LDADD) -am_pdstring_OBJECTS = pdstring.$(OBJEXT) +am_pdstring_OBJECTS = pdstring.$(OBJEXT) pdstringUtils.$(OBJEXT) pdstring_OBJECTS = $(am_pdstring_OBJECTS) pdstring_LDADD = $(LDADD) -am_wchars2bytes_OBJECTS = wchars2bytes.$(OBJEXT) +am_printbytes_OBJECTS = printbytes.$(OBJEXT) pdstringUtils.$(OBJEXT) +printbytes_OBJECTS = $(am_printbytes_OBJECTS) +printbytes_LDADD = $(LDADD) +am_printwchars_OBJECTS = printwchars.$(OBJEXT) pdstringUtils.$(OBJEXT) +printwchars_OBJECTS = $(am_printwchars_OBJECTS) +printwchars_LDADD = $(LDADD) +am_wchars2bytes_OBJECTS = wchars2bytes.$(OBJEXT) \ + pdstringUtils.$(OBJEXT) wchars2bytes_OBJECTS = $(am_wchars2bytes_OBJECTS) wchars2bytes_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. @@ -91,9 +114,11 @@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(any2bytes_SOURCES) $(bytes2any_SOURCES) \ $(bytes2wchars_SOURCES) $(pdstring_SOURCES) \ + $(printbytes_SOURCES) $(printwchars_SOURCES) \ $(wchars2bytes_SOURCES) DIST_SOURCES = $(any2bytes_SOURCES) $(bytes2any_SOURCES) \ $(bytes2wchars_SOURCES) $(pdstring_SOURCES) \ + $(printbytes_SOURCES) $(printwchars_SOURCES) \ $(wchars2bytes_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ @@ -150,6 +175,7 @@ LDFLAGS = @LDFLAGS@ LFLAGS = @LFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ @@ -169,12 +195,13 @@ 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 +WANT_OBJECT_EXTERNALS_FALSE = @WANT_OBJECT_EXTERNALS_FALSE@ +WANT_OBJECT_EXTERNALS_TRUE = @WANT_OBJECT_EXTERNALS_TRUE@ +WFLAGS = @WFLAGS@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ @@ -232,21 +259,21 @@ pddoc_DATA = \ #----------------------------------------------------------------------- # 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 +any2bytes_SOURCES = any2bytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +bytes2any_SOURCES = bytes2any.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +bytes2wchars_SOURCES = bytes2wchars.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +wchars2bytes_SOURCES = wchars2bytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +printbytes_SOURCES = printbytes.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +printwchars_SOURCES = printwchars.c mooPdUtils.h pdstringUtils.h pdstringUtils.c +pdstring_SOURCES = pdstring.c mooPdUtils.h pdstringUtils.h pdstringUtils.c #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) + +#pdstring_LDFLAGS = $(LFLAGS) +#bytes2any_LDFLAGS = $(LFLAGS) #----------------------------------------------------------------------- # Variables: cleanup @@ -366,6 +393,12 @@ bytes2wchars$(EXEEXT): $(bytes2wchars_OBJECTS) $(bytes2wchars_DEPENDENCIES) pdstring$(EXEEXT): $(pdstring_OBJECTS) $(pdstring_DEPENDENCIES) @rm -f pdstring$(EXEEXT) $(LINK) $(pdstring_LDFLAGS) $(pdstring_OBJECTS) $(pdstring_LDADD) $(LIBS) +printbytes$(EXEEXT): $(printbytes_OBJECTS) $(printbytes_DEPENDENCIES) + @rm -f printbytes$(EXEEXT) + $(LINK) $(printbytes_LDFLAGS) $(printbytes_OBJECTS) $(printbytes_LDADD) $(LIBS) +printwchars$(EXEEXT): $(printwchars_OBJECTS) $(printwchars_DEPENDENCIES) + @rm -f printwchars$(EXEEXT) + $(LINK) $(printwchars_LDFLAGS) $(printwchars_OBJECTS) $(printwchars_LDADD) $(LIBS) wchars2bytes$(EXEEXT): $(wchars2bytes_OBJECTS) $(wchars2bytes_DEPENDENCIES) @rm -f wchars2bytes$(EXEEXT) $(LINK) $(wchars2bytes_LDFLAGS) $(wchars2bytes_OBJECTS) $(wchars2bytes_LDADD) $(LIBS) @@ -380,6 +413,9 @@ distclean-compile: @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)/pdstringUtils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printbytes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printwchars.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wchars2bytes.Po@am__quote@ .c.o: @@ -607,7 +643,8 @@ distdir: $(DISTFILES) done check-am: all-am check: check-recursive -all-am: Makefile $(PROGRAMS) $(DATA) config.h +@WANT_OBJECT_EXTERNALS_FALSE@all-local: +all-am: Makefile $(PROGRAMS) $(DATA) config.h all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pdexternsdir)" "$(DESTDIR)$(pddocdir)" "$(DESTDIR)$(pdexternsdir)"; do \ @@ -662,6 +699,8 @@ info-am: install-data-am: install-pddocDATA install-pdexternsDATA \ install-pdexternsPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-exec-am: @@ -689,30 +728,53 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am uninstall-pddocDATA \ +uninstall-am: uninstall-info-am uninstall-local 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) +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local 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-data-hook 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-local uninstall-pddocDATA \ + uninstall-pdexternsDATA uninstall-pdexternsPROGRAMS + + + printbytes-help.pd + printwchars-help.pd + +#----------------------------------------------------------------------- +# aliases via install hook +#----------------------------------------------------------------------- + +@WANT_OBJECT_EXTERNALS_TRUE@all-local: +@WANT_OBJECT_EXTERNALS_TRUE@ rm -f any2string.$(PDEXT) +@WANT_OBJECT_EXTERNALS_TRUE@ rm -f string2any.$(PDEXT) +@WANT_OBJECT_EXTERNALS_TRUE@ $(LN_S) any2bytes.$(PDEXT) any2string.$(PDEXT) +@WANT_OBJECT_EXTERNALS_TRUE@ $(LN_S) bytes2any.$(PDEXT) string2any.$(PDEXT) + +install-data-hook: + rm -f $(pdexternsdir)/any2string.$(PDEXT) + rm -f $(pdexternsdir)/string2any.$(PDEXT) +@WANT_OBJECT_EXTERNALS_TRUE@ $(LN_S) any2bytes.$(PDEXT) $(pdexternsdir)/any2string.$(PDEXT) +@WANT_OBJECT_EXTERNALS_TRUE@ $(LN_S) bytes2any.$(PDEXT) $(pdexternsdir)/string2any.$(PDEXT) + +uninstall-local: + rm -f $(pdexternsdir)/any2string.$(PDEXT) + rm -f $(pdexternsdir)/string2any.$(PDEXT) + +AM_LDFLAGS ?= $(LFLAGS) maintainer-clean-local: rm -rf autom4te.cache diff --git a/src/any2bytes.c b/src/any2bytes.c index c2b2425..4760c5f 100644 --- a/src/any2bytes.c +++ b/src/any2bytes.c @@ -71,6 +71,8 @@ typedef struct _any2bytes } t_any2bytes; +static int ANY2BYTES_INITIALIZED = 0; + /*===================================================================== * Constants *=====================================================================*/ @@ -151,14 +153,16 @@ static void any2bytes_free(t_any2bytes *x) */ void any2bytes_setup_guts(void) { + if (ANY2BYTES_INITIALIZED) return; + //-- 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); + (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); @@ -168,6 +172,9 @@ void any2bytes_setup_guts(void) //-- help symbol //class_sethelpsymbol(any2bytes_class, gensym("any2bytes-help.pd")); //-- breaks pd-extended help lookup + + //-- set flag + ANY2BYTES_INITIALIZED = 1; } @@ -179,3 +186,12 @@ void any2bytes_setup(void) post(any2bytes_banner); any2bytes_setup_guts(); } + +/*-------------------------------------------------------------------- + * setup (any2string alias) + */ +void any2string_setup(void) { + post("any2string_setup(): WARNING: names are in flux!"); + post("any2string_setup(): Prefer [any2bytes] over [any2string]."); + any2bytes_setup(); +} diff --git a/src/bytes2any.c b/src/bytes2any.c index e4b3715..a7dc5b2 100644 --- a/src/bytes2any.c +++ b/src/bytes2any.c @@ -55,10 +55,12 @@ #define BYTES2ANY_DEFAULT_BUFLEN PDSTRING_DEFAULT_BUFLEN /*===================================================================== - * Constants + * Constants & Globals *=====================================================================*/ static char *bytes2any_banner = "bytes2any: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; +static int BYTES2ANY_INITIALIZED = 0; + /*===================================================================== * Structures and Types: any2string *=====================================================================*/ @@ -196,6 +198,8 @@ static void bytes2any_free(t_bytes2any *x) */ void bytes2any_setup_guts(void) { + if (BYTES2ANY_INITIALIZED) return; + //-- class bytes2any_class = class_new(gensym("bytes2any"), (t_newmethod)bytes2any_new, @@ -206,14 +210,16 @@ void bytes2any_setup_guts(void) 0); //-- alias - class_addcreator((t_newmethod)bytes2any_new, gensym("bytes2any"), A_GIMME, 0); + class_addcreator((t_newmethod)bytes2any_new, gensym("string2any"), 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 + + //-- set flag + BYTES2ANY_INITIALIZED = 1; } /*-------------------------------------------------------------------- @@ -224,3 +230,12 @@ void bytes2any_setup(void) post(bytes2any_banner); bytes2any_setup_guts(); } + +/*-------------------------------------------------------------------- + * setup (string2any alias) + */ +void string2any_setup(void) { + post("string2any_setup(): WARNING: names are in flux!"); + post("string2any_setup(): Prefer [bytes2any] over [string2any]."); + bytes2any_setup(); +} diff --git a/src/pdstring-help.pd b/src/pdstring-help.pd index 9e3e0c3..b4bc97d 100644 --- a/src/pdstring-help.pd +++ b/src/pdstring-help.pd @@ -1,20 +1,20 @@ -#N canvas 163 18 501 441 10; -#X text 196 400 Bryan Jurish ; +#N canvas 193 20 501 441 10; +#X text 199 414 Bryan Jurish ; #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 obj 43 154 bytes2wchars; +#X text 145 155 convert byte strings to wide character strings; +#X obj 43 180 wchars2bytes; +#X text 146 181 convert wide character strings to byte strings; +#X text 20 133 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:; +#X text 18 233 WIDE CHARACTERS <-> PD MESSAGES; +#X text 143 255 convert pd messages to wide character strings; +#X text 144 281 convert wide character strings to pd messages; +#X text 21 383 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 - - -; @@ -71,7 +71,7 @@ #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; +#X restore 90 382 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 - - -; @@ -94,10 +94,14 @@ #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 +#X restore 220 382 pd pdstring-wchars; +#X obj 41 254 any2wchars; +#X obj 41 280 wchars2any; +#X obj 356 382 locale; +#X text 21 317 NOTE:; +#X text 29 333 Wide character support requires locale support to be enabled \, e.g. by the [locale] external.; +#X obj 51 100 printbytes; +#X obj 43 203 printwchars; +#X text 148 203 print wide character strings to pd console; +#X text 149 100 print byte strings to pd console; diff --git a/src/pdstring.c b/src/pdstring.c index 54e9f88..cfef6ff 100644 --- a/src/pdstring.c +++ b/src/pdstring.c @@ -61,6 +61,9 @@ typedef struct _pdstring # include "bytes2wchars.c" # include "wchars2bytes.c" +# include "printbytes.c" +# include "printwchars.c" + //# include "bytes2array.c" //# include "array2bytes.c" #endif @@ -94,10 +97,14 @@ void pdstring_setup(void) #ifndef PDSTRING_OBJECT_EXTERNALS any2bytes_setup_guts(); bytes2any_setup_guts(); + bytes2wchars_setup_guts(); wchars2bytes_setup_guts(); + //bytes2array_setup_guts(); //array2bytes_setup_guts(); + printbytes_setup_guts(); + printwchars_setup_guts(); #endif pdstring_class = class_new(gensym("pdstring"), diff --git a/src/pdstringUtils.c b/src/pdstringUtils.c new file mode 100644 index 0000000..5d3e6a3 --- /dev/null +++ b/src/pdstringUtils.c @@ -0,0 +1,450 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: pdstringUtils.c + * Author: Bryan Jurish + * 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 +#include +#include +#include "mooPdUtils.h" +#include "pdstringUtils.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 : see header + *=====================================================================*/ + +/*===================================================================== + * Structures & Types : see header + *=====================================================================*/ + +/*===================================================================== + * Initialization + *=====================================================================*/ + +/*--------------------------------------------------------------------- + * bytes + */ +PDSTRING_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; +} +PDSTRING_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; +} +PDSTRING_STATIC void pdstring_bytes_init(t_pdstring_bytes *b, size_t n) +{ + pdstring_bytes_clear(b); + pdstring_bytes_realloc(b,n); +} + +/*--------------------------------------------------------------------- + * wchars + */ +PDSTRING_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; +} +PDSTRING_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; +} +PDSTRING_STATIC void pdstring_wchars_init(t_pdstring_wchars *w, size_t n) +{ + pdstring_wchars_clear(w); + pdstring_wchars_realloc(w,n); +} + +/*--------------------------------------------------------------------- + * atoms + */ +PDSTRING_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; +} +PDSTRING_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; +} +PDSTRING_STATIC void pdstring_atoms_init(t_pdstring_atoms *a, size_t n) +{ + pdstring_atoms_clear(a); + pdstring_atoms_realloc(a,n); +} + +/*--------------------------------------------------------------------- + * floatarray + */ +PDSTRING_STATIC void pdstring_floatarray_clearvec(t_pdstring_floatarray *fa) +{ + fa->fa_garray = NULL; + fa->fa_vlen = 0; + fa->fa_vec = NULL; +} +PDSTRING_STATIC void pdstring_floatarray_clear(t_pdstring_floatarray *fa) +{ + fa->fa_name = &s_; + fa->fa_offset = 0; + pdstring_floatarray_clearvec(fa); +} +PDSTRING_STATIC void pdstring_floatarray_realloc(t_pdstring_floatarray *fa, size_t n) +{ + if (fa->fa_name == &s_) return; + pdstring_floatarray_getvec(NULL,fa); + if (fa->fa_offset < 0) fa->fa_offset += fa->fa_vlen; + if (fa->fa_vlen < fa->fa_offset + (int)n) { + garray_resize(fa->fa_garray, fa->fa_offset+(int)n); + fa->fa_vec = NULL; + pdstring_floatarray_getvec(NULL,fa); + } +} +PDSTRING_STATIC void pdstring_floatarray_init(t_pdstring_floatarray *fa, size_t n) +{ + pdstring_floatarray_clearvec(fa); + pdstring_floatarray_realloc(fa,n); +} +PDSTRING_STATIC void pdstring_floatarray_getvec(t_object *x, t_pdstring_floatarray *fa) +{ + //-- get array + if (!(fa->fa_garray = (t_garray *)pd_findbyclass(fa->fa_name, garray_class))) { + pd_error(x, "pdstring_floatarray_getvec(): no such array '%s'", fa->fa_name->s_name); + pdstring_floatarray_clearvec(fa); + return; + } + //-- get float vector & size + if (!garray_getfloatarray(fa->fa_garray, &fa->fa_vlen, &fa->fa_vec)) { + pd_error(x, "pdstring_floatarray_getvec(): garray_getfloatarray() failed for array '%s'", fa->fa_name->s_name); + return; + } +} + + +/*===================================================================== + * 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() + */ +PDSTRING_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 < (size_t)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() + */ +PDSTRING_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 < (size_t)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 + */ +PDSTRING_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 <= (size_t)(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 + */ +PDSTRING_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 <= (size_t)(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() + */ +PDSTRING_STATIC int pdstring_bytes2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_bytes *src) +{ + size_t bi, wi; + + //-- re-allocate? + if ( dst->w_alloc < (size_t)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<(size_t)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() + */ +PDSTRING_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 < (size_t)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 + */ +PDSTRING_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 <= (size_t)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() + */ +PDSTRING_STATIC void pdstring_wchars2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_wchars *src) +{ + int i; + + //-- re-allocate? + if ( dst->a_alloc < (size_t)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/src/pdstringUtils.h b/src/pdstringUtils.h index 85a72a5..a3e8f58 100644 --- a/src/pdstringUtils.h +++ b/src/pdstringUtils.h @@ -32,18 +32,6 @@ #include #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 *=====================================================================*/ @@ -70,6 +58,9 @@ #define PDSTRING_WCHARS_GET PDSTRING_DEFAULT_GET #define PDSTRING_ATOMS_GET PDSTRING_DEFAULT_GET +//#define PDSTRING_STATIC static +#define PDSTRING_STATIC + /*===================================================================== * Structures & Types *=====================================================================*/ @@ -101,6 +92,18 @@ typedef struct _pdstring_atoms { size_t a_alloc; //-- allocated size of a_buf } t_pdstring_atoms; +/* t_pdstring_floatarray + * + read/store strings to t_array (of t_float) + */ +typedef struct _pdstring_floatarray { + t_symbol *fa_name; //-- name bound to array + int fa_offset; //-- offset at which to begin operation + t_garray *fa_garray; //-- underlying t_garray*, populated by pdstring_floatarray_getarray() + int fa_vlen; //-- length of fa_vec (number of points), populated by pdstring_floatarray_getvec() + t_float *fa_vec; //-- underlying t_float*, populated by pdstring_floatarray_getvec() +} t_pdstring_floatarray; + + /*===================================================================== * Initialization *=====================================================================*/ @@ -108,72 +111,35 @@ typedef struct _pdstring_atoms { /*--------------------------------------------------------------------- * 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); -} +PDSTRING_STATIC void pdstring_bytes_clear(t_pdstring_bytes *b); +PDSTRING_STATIC void pdstring_bytes_realloc(t_pdstring_bytes *b, size_t n); +PDSTRING_STATIC void pdstring_bytes_init(t_pdstring_bytes *b, size_t 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); -} +PDSTRING_STATIC void pdstring_wchars_clear(t_pdstring_wchars *w); +PDSTRING_STATIC void pdstring_wchars_realloc(t_pdstring_wchars *w, size_t n); +PDSTRING_STATIC void pdstring_wchars_init(t_pdstring_wchars *w, size_t 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); -} +PDSTRING_STATIC void pdstring_atoms_clear(t_pdstring_atoms *a); +PDSTRING_STATIC void pdstring_atoms_realloc(t_pdstring_atoms *a, size_t n); +PDSTRING_STATIC void pdstring_atoms_init(t_pdstring_atoms *a, size_t n); + +/*--------------------------------------------------------------------- + * floatarray + */ +PDSTRING_STATIC void pdstring_floatarray_clear(t_pdstring_floatarray *a); //-- clears all data (no free) +PDSTRING_STATIC void pdstring_floatarray_realloc(t_pdstring_floatarray *a, size_t n); //-- calls garray_resize() +PDSTRING_STATIC void pdstring_floatarray_init(t_pdstring_floatarray *a, size_t n); //-- if a->fa_name is set +PDSTRING_STATIC void pdstring_floatarray_getvec(t_object *x, t_pdstring_floatarray *a); //-- gets underlying pointers /*===================================================================== - * Utilities + * Conversions *=====================================================================*/ /*-------------------------------------------------------------------- @@ -184,58 +150,9 @@ static void pdstring_atoms_init(t_pdstring_atoms *a, size_t n) * + 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() + * - 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_STATIC void pdstring_any2bytes(void *x, t_pdstring_bytes *dst, t_symbol *sel, t_pdstring_atoms *src, t_binbuf *x_binbuf); /*-------------------------------------------------------------------- @@ -244,78 +161,16 @@ static void pdstring_any2bytes(void *x, t_pdstring_bytes *dst, t_symbol *sel, t_ * + 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() + * - if dst is non-NULL, its values will be clobbered by those returned by binbuf_getnatom() & 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_STATIC void pdstring_bytes2any(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_binbuf *x_binbuf); /*-------------------------------------------------------------------- * 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_STATIC int pdstring_atoms2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_atoms *src, t_float x_eos); /*-------------------------------------------------------------------- * pdstring_atoms2wchars() @@ -323,130 +178,27 @@ static int pdstring_atoms2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_atoms * + 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_STATIC int pdstring_atoms2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_atoms *src, t_float x_eos); /*-------------------------------------------------------------------- * 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; bib_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_STATIC int pdstring_bytes2wchars(void *x, t_pdstring_wchars *dst, t_pdstring_bytes *src); /*-------------------------------------------------------------------- * 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_STATIC int pdstring_wchars2bytes(void *x, t_pdstring_bytes *dst, t_pdstring_wchars *src); /*-------------------------------------------------------------------- * 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_STATIC void pdstring_bytes2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_bytes *src, t_float x_eos); /*-------------------------------------------------------------------- * 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; -} - +PDSTRING_STATIC void pdstring_wchars2atoms(void *x, t_pdstring_atoms *dst, t_pdstring_wchars *src); #endif /* PDSTRING_UTILS_H */ diff --git a/src/printbytes-help.pd b/src/printbytes-help.pd new file mode 100644 index 0000000..da5481a --- /dev/null +++ b/src/printbytes-help.pd @@ -0,0 +1,23 @@ +#N canvas 66 62 450 300 10; +#X text 43 5 printbytes - print byte strings to pd console; +#X obj 44 172 printbytes mybytes; +#X text 141 266 Bryan Jurish ; +#X text 17 231 SEE ALSO:; +#X obj 86 230 pdstring; +#X obj 150 230 locale; +#X text 153 45 "ABC"; +#X text 183 173 First argument is prefixed to output; +#X msg 44 44 list 65 66 67; +#X msg 54 64 foo 49 50 51; +#X text 153 65 "123" \, selector "foo" is printed extra; +#X msg 67 87 228 246 252; +#X msg 71 111 195 164 195 182 195 188; +#X text 247 111 ... or in UTF-8; +#X msg 73 137 207 128 206 180; +#X text 189 137 "&pi &delta" in UTF-8; +#X text 157 89 "ä ö ü" in ISO-8859-1; +#X connect 8 0 1 0; +#X connect 9 0 1 0; +#X connect 11 0 1 0; +#X connect 12 0 1 0; +#X connect 14 0 1 0; diff --git a/src/printbytes-test.pd b/src/printbytes-test.pd new file mode 100644 index 0000000..e2e23e9 --- /dev/null +++ b/src/printbytes-test.pd @@ -0,0 +1,45 @@ +#N canvas 30 10 564 356 10; +#X obj 36 280 printbytes; +#X msg 33 21 A B C; +#X obj 36 106 any2bytes; +#X obj 78 134 print any2bytes; +#X obj 76 160 bytes2any; +#X obj 124 184 print bytes2any; +#X obj 260 80 wchars2bytes; +#X msg 311 287 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 343 318 pd locale_LC_CTYPE; +#X msg 343 287 en_DK.ISO-8859-1; +#X msg 465 287 en_DK.UTF-8; +#X msg 259 27 228 246 252; +#X msg 287 50 960 948; +#X text 343 27 "ä ö ü"; +#X text 341 51 "&pi &delta"; +#X obj 300 108 print wchars2bytes; +#X obj 258 160 printbytes wbytes; +#X obj 36 228 list prepend myString; +#X obj 36 250 list trim; +#X msg 211 209 65 0 66 0 67 0; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 2 0 4 0; +#X connect 2 0 17 0; +#X connect 4 0 5 0; +#X connect 6 0 15 0; +#X connect 6 0 16 0; +#X connect 7 0 8 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 6 0; +#X connect 12 0 6 0; +#X connect 17 0 18 0; +#X connect 18 0 0 0; +#X connect 19 0 17 0; diff --git a/src/printbytes.c b/src/printbytes.c new file mode 100644 index 0000000..a490220 --- /dev/null +++ b/src/printbytes.c @@ -0,0 +1,142 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: printbytes.c + * Author: Bryan Jurish + * Description: print byte-strings using post() + * + * 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 +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "mooPdUtils.h" +#include "pdstringUtils.h" + + +/*===================================================================== + * Constants & Globals + *=====================================================================*/ +static char *printbytes_banner = "printbytes: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; + +/*===================================================================== + * Structures and Types: any2string + *=====================================================================*/ + +static t_class *printbytes_class; + +typedef struct _printbytes +{ + t_object x_obj; + t_symbol *x_prefix; + //t_pdstring_bytes x_bytes; +} t_printbytes; + + +/*===================================================================== + * Methods + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * anything + */ +static void printbytes_anything(t_printbytes *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + startpost("%s/%s: ", x->x_prefix->s_name, sel->s_name); + for (; argc > 0; argc--, argv++) { + char c = atom_getfloat(argv); + startpost("%c", c); + } + endpost(); +} + +#if 0 +static void printbytes_anything_v1(t_printbytes *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + t_pdstring_atoms arg_atoms = { argv, argc, 0 }; + pdstring_atoms2bytes(x, &x->x_bytes, &arg_atoms, PDSTRING_EOS_NONE); + post("%s/%s: %s", x->x_prefix->s_name, sel->s_name, x->x_bytes.b_buf); +} +#endif + + +/*-------------------------------------------------------------------- + * new + */ +static void *printbytes_new(t_symbol *prefix) +{ + t_printbytes *x = (t_printbytes *)pd_new(printbytes_class); + + if (prefix == &s_) prefix = gensym("printbytes"); + x->x_prefix = prefix; + + //pdstring_bytes_init(&x->x_bytes, PDSTRING_DEFAULT_BUFLEN); + return (void *)x; +} + +/*-------------------------------------------------------------------- + * free + */ +static void printbytes_free(t_printbytes *x) +{ + //pdstring_bytes_clear(&x->x_bytes); + return; +} + +/*-------------------------------------------------------------------- + * setup: guts + */ +void printbytes_setup_guts(void) +{ + //-- check/set "initialized" flag + //if (PRINTBYTES_INITIALIZED) return; + //PRINTBYTES_INITIALIZED = 1; + + //-- class + printbytes_class = class_new(gensym("printbytes"), + (t_newmethod)printbytes_new, + (t_method)printbytes_free, + sizeof(t_printbytes), + CLASS_DEFAULT, + A_DEFSYM, //-- print-prefix + 0); + + //-- alias + //class_addcreator((t_newmethod)printbytes_new, gensym("printstring"), A_GIMME, 0); + + //-- methods + class_addanything(printbytes_class, (t_method)printbytes_anything); + + //-- help symbol + //class_sethelpsymbol(printbytes_class, gensym("printbytes-help.pd")); //-- breaks pd-extended help lookup +} + +/*-------------------------------------------------------------------- + * setup + */ +void printbytes_setup(void) +{ + post(printbytes_banner); + printbytes_setup_guts(); +} diff --git a/src/printwchars-help.pd b/src/printwchars-help.pd new file mode 100644 index 0000000..a097bca --- /dev/null +++ b/src/printwchars-help.pd @@ -0,0 +1,21 @@ +#N canvas 82 52 450 300 10; +#X text 141 266 Bryan Jurish ; +#X text 17 231 SEE ALSO:; +#X obj 86 230 pdstring; +#X obj 150 230 locale; +#X text 153 45 "ABC"; +#X text 193 173 First argument is prefixed to output; +#X msg 44 44 list 65 66 67; +#X msg 54 64 foo 49 50 51; +#X text 153 65 "123" \, selector "foo" is printed extra; +#X msg 67 87 228 246 252; +#X text 159 115 "&pi &delta" in UTF-8; +#X text 35 7 printwchars - print wide character strings to pd console +; +#X text 157 89 "ä ö ü"; +#X msg 71 115 960 948; +#X obj 44 172 printwchars mywchars; +#X connect 6 0 14 0; +#X connect 7 0 14 0; +#X connect 9 0 14 0; +#X connect 13 0 14 0; diff --git a/src/printwchars-test.pd b/src/printwchars-test.pd new file mode 100644 index 0000000..e104607 --- /dev/null +++ b/src/printwchars-test.pd @@ -0,0 +1,45 @@ +#N canvas 30 10 564 356 10; +#X msg 33 21 A B C; +#X msg 311 287 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 343 318 pd locale_LC_CTYPE; +#X msg 343 287 en_DK.ISO-8859-1; +#X msg 465 287 en_DK.UTF-8; +#X msg 259 27 228 246 252; +#X msg 287 50 960 948; +#X text 343 27 "ä ö ü"; +#X text 341 51 "&pi &delta"; +#X obj 36 228 list prepend myString; +#X obj 36 250 list trim; +#X msg 211 209 65 0 66 0 67 0; +#X obj 36 106 any2wchars; +#X obj 78 134 print any2wchars; +#X obj 76 158 wchars2any; +#X obj 124 184 print wchars2any; +#X obj 36 280 printwchars; +#X obj 258 160 printwchars wcs; +#X obj 260 80 t l l; +#X obj 300 108 print wchars; +#X connect 0 0 12 0; +#X connect 1 0 2 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 18 0; +#X connect 6 0 18 0; +#X connect 9 0 10 0; +#X connect 10 0 16 0; +#X connect 11 0 9 0; +#X connect 12 0 9 0; +#X connect 12 0 13 0; +#X connect 12 0 14 0; +#X connect 14 0 15 0; +#X connect 18 0 17 0; +#X connect 18 1 19 0; diff --git a/src/printwchars.c b/src/printwchars.c new file mode 100644 index 0000000..3760120 --- /dev/null +++ b/src/printwchars.c @@ -0,0 +1,140 @@ +/* -*- Mode: C -*- */ +/*=============================================================================*\ + * File: printwchars.c + * Author: Bryan Jurish + * Description: print byte-strings using post() + * + * 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 +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "mooPdUtils.h" +#include "pdstringUtils.h" + +/*===================================================================== + * Constants & Globals + *=====================================================================*/ +static char *printwchars_banner = "printwchars: pdstring version " PACKAGE_VERSION " by Bryan Jurish"; + +/*===================================================================== + * Structures and Types: any2string + *=====================================================================*/ + +static t_class *printwchars_class; + +typedef struct _printwchars +{ + t_object x_obj; + t_symbol *x_prefix; +} t_printwchars; + + +/*===================================================================== + * Methods + *=====================================================================*/ + +/*-------------------------------------------------------------------- + * anything + */ +static void printwchars_anything(t_printwchars *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + startpost("%s/%s: ", x->x_prefix->s_name, sel->s_name); + for (; argc > 0; argc--, argv++) { + wchar_t c = atom_getfloat(argv); + startpost("%C", c); + } + endpost(); +} + +#if 0 +static void printwchars_anything_v1(t_printwchars *x, MOO_UNUSED t_symbol *sel, int argc, t_atom *argv) +{ + t_pdstring_atoms arg_atoms = { argv, argc, 0 }; + pdstring_atoms2wchars(x, &x->x_wchars, &arg_atoms, PDSTRING_EOS_NONE); + post("%S/%S: %S", x->x_prefix->s_name, sel->s_name, x->x_wchars.w_buf); +} +#endif + +/*-------------------------------------------------------------------- + * new + */ +static void *printwchars_new(t_symbol *prefix) +{ + t_printwchars *x = (t_printwchars *)pd_new(printwchars_class); + + if (prefix == &s_) prefix = gensym("printwchars"); + x->x_prefix = prefix; + + //pdstring_wchars_init(&x->x_wchars, PDSTRING_DEFAULT_BUFLEN); + return (void *)x; +} + +/*-------------------------------------------------------------------- + * free + */ +static void printwchars_free(t_printwchars *x) +{ + //pdstring_wchars_clear(&x->x_wchars); + return; +} + +/*-------------------------------------------------------------------- + * setup: guts + */ +void printwchars_setup_guts(void) +{ + //-- check/set "initialized" flag + //if (PRINTWCHARS_INITIALIZED) return; + //PRINTWCHARS_INITIALIZED = 1; + + //-- class + printwchars_class = class_new(gensym("printwchars"), + (t_newmethod)printwchars_new, + (t_method)printwchars_free, + sizeof(t_printwchars), + CLASS_DEFAULT, + A_DEFSYM, //-- print-prefix + 0); + + //-- alias + //class_addcreator((t_newmethod)printwchars_new, gensym("printstring"), A_GIMME, 0); + + //-- methods + class_addanything(printwchars_class, (t_method)printwchars_anything); + + //-- help symbol + //class_sethelpsymbol(printwchars_class, gensym("printwchars-help.pd")); //-- breaks pd-extended help lookup +} + +/*-------------------------------------------------------------------- + * setup + */ +void printwchars_setup(void) +{ + post(printwchars_banner); + printwchars_setup_guts(); +} diff --git a/src/stringalias-test.pd b/src/stringalias-test.pd new file mode 100644 index 0000000..b762c54 --- /dev/null +++ b/src/stringalias-test.pd @@ -0,0 +1,18 @@ +#N canvas 34 2 450 300 10; +#X floatatom 56 81 8 0 0 0 - - -; +#X symbolatom 46 59 10 0 0 0 - - -; +#X floatatom 54 178 4 0 0 0 - - -; +#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 254 print bytes2any-out; +#X obj 37 108 any2string; +#X obj 37 230 string2any; +#X connect 0 0 7 0; +#X connect 1 0 7 0; +#X connect 2 0 8 0; +#X connect 3 0 7 0; +#X connect 4 0 8 0; +#X connect 7 0 5 0; +#X connect 7 0 8 0; +#X connect 8 0 6 0; diff --git a/src/wchars2any-help.pd b/src/wchars2any-help.pd index d57343e..e5df0fc 100644 --- a/src/wchars2any-help.pd +++ b/src/wchars2any-help.pd @@ -1,13 +1,13 @@ -#N canvas 101 18 612 604 10; +#N canvas 103 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 msg 163 212 0; +#X msg 131 212 -1; +#X msg 195 212 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.; @@ -30,8 +30,10 @@ has been processed.; #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 text 237 208 The second inlet is as for [bytes2any]; #X obj 169 570 locale; +#X msg 71 186 960 948; +#X text 171 183 ... real wide characters: "&pi &delta"; #X connect 4 0 23 0; #X connect 5 0 23 0; #X connect 6 0 23 1; @@ -40,3 +42,4 @@ has been processed.; #X connect 22 0 23 0; #X connect 23 0 21 0; #X connect 23 1 20 0; +#X connect 28 0 23 0; -- cgit v1.2.1