Views
Possible Mentors
-
Bryan Jurish
Description
Pd's lack of a string data type can make easy tasks such as filename parsing, network communications, etc. inordinately difficult to accomplish without relying on additional externals (e.g. py/pyext, lua). For various reasons, none of the known existing workarounds (e.g. Bryan Jurish's [pdstring]? externals, Martin Peach's string patch), has established itself as a standard string handling mechanism for Pd, requiring either inordinate amounts of memory and processing time, or a patch to the Pd sources. Miller Puckette and others have suggested the use of Pd arrays for string storage.
This project should implement a basic character and string handling library for Pd, using Pd arrays directly for string storage. Elementary string handling functions (i.e. analogs of the C functions declared in "string.h") should be implemented where possible directly on arrays, and a C API should be provided for conversion of Pd arrays to and from C strings (char*, rsp. wchar_t*). If time and interest permit, additional string utilities (e.g. encoding with iconv and/or recode, regular expressions, tokenization, etc.) can be implemented on top of this API.
Links and Resources:
-
http://iem.kug.ac.at/pd/externals-HOWTO : a tutorial on how to write C externals for pure data
-
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/externals/moocow/pdstring/ : pdstring sources (SVN)
-
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/packages/patches/add_string_support.patch : Martin Peach's string support patch
-
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/externals/mrpeach/str/ : Martin Peach's str object sources; requires string support patch (SVN)
-
http://en.wikipedia.org/wiki/String.h : Wikipedia entry for "string.h"
Required Skills
-
some knowledge of C programming
Difficulty
Easy (but time consuming) to moderate, depending on how much functionality is implemented directly on Pd arrays, and how much is left to the C library functions.
Possible Breakdown of Steps
-
Step 1: array-to-string and string-to-array conversion API and externals
-
ideally, should be compatible with both Pd-vanilla and Pd-extended
-
-
Step 2: string.h wrapper externals, e.g. for:
-
strcat(), strncat()
-
strchr(), strrchr()
-
strcmp(), strncmp(), strcoll()
-
strcpy(), strncpy()
-
strspn(), strcspn()
-
strpbrk()
-
strstr()
-
strtok()
-
-
Optional: recoding externals (e.g. with iconv, recode)
-
Optional: regular expression externals (e.g. with Spencer, PCRE)