[NetBehaviour] Your do is of reference the they with betheynone work
james morris
james at jwm-art.net
Mon Jul 6 14:21:00 CEST 2009
I've wroked some more on these functions, and now there is:
/* strchrs and strrchrs are like the std c lib
functions strchr and strrchr except multiple
characters are searched for. the characters
contained in the 2nd arguement's string are
searched for individually.
both return NULL on failure.
*/
char* strchrs(char* str, char* chars);
char* strrchrs(char* str, char* chars);
/* skipchars steps through the string str
until it finds a character not contained
within the string chars. skiprchrs starts
from the end of str.
both return NULL if string str contains only
characters appearing in chars.
*/
char* skipchrs(char* str, char* chars);
char* skiprchrs(char* str, char* chars);
/* the following two functions work exactly as
their counterparts above, except they return
the terminating NULL byte of the string str,
instead of NULL upon failure.
*/
char* strchrsnull(char* str, char* chars);
char* skipchrsnull(char* str, char* chars);
/* explode splits a string into substrings using
splitchar as the delimiter. if trim is non-zero
then the delimiter splitchar is removed from the
substrings. if trim is zero then the delimiter
splitchar remains to the right of each substring.
consecutive delimiters in str in this case appear
as individual substrings of one char length.
explodes works in the same manner, but works with
any of the delimiter characters appearing in
splitchars (that is, splitchars IS NOT treated
as a search string).
explodestr does the same but uses splitstr as
a delimiter string to search for.
all return an array of substrings, terminated
with a NULL pointer as the last element. if no
substrings are found, the first index of the
returned array contains the original string.
*/
char** explode(char* str, char splitchar, int trim);
char** explodes(char* str, char* splitchars, int trim);
char** explodestr(char* str, char* splitstr, int trim);
http://www.jwm-art.net/default_downloads/erroneouslib.tar.bz2
(tempory download loc & filename).
type make and then ./test to see some output using the explodestr
function. it won't install it as a lib you can link against yet,
got to work on that. but you can #include it in your own C code
and compile it in. some bugs fixed from orig ver. maybe more
work could be done on the function prototypes, ie setting
arguments as const - but i'm unsure about how this effects older
compilers (const is relatively new to C - backported from C++ i think).
james.
On 6/7/2009, "james morris" <james at jwm-art.net> wrote:
>
>Hi Alan,
>
>Thanks for the offer, but the likelihood is they probably won't help me
>much with this. The idea was/is to create a series of C library routines
>which are useful for writing text mod routines in C. Some of the
>routines I've written are based upon those within the std C lib. Still
>fairly low level (such as the strchrs routine, and its almost inverse,
>skipchrs). Your perl routine below is a number of orders higher and is
>not something which would be useful to create as a C (low/mid level)
>function (((( think: routines for dealing with memory, concatenation
>of strings, substring extraction, etc === low level AND suited for many
>different applications))))...
>
>Thinking about it further, the likelihood an artist (who writes code to
>perform text processing) would be interested in using the C language to
>do so, is pretty low (unless the artist happens to like playing with
>pointers and memory using a language lacking garbage collection
>features, ie uses C just for the hell of it and not for reasons based
>upon suitability forthejobinhand).
>
>Does anybody on this list write code in C ??? Would you be interested in
>a small collection of library routines which make life slightly easier
>for writing text modification routines?
>
>Back to the question of you posting your code.. I expect others would
>be interested (and I am actually too :-) ).
>
>james
>
>On 6/7/2009, "Alan Sondheim" <sondheim at panix.com> wrote:
>
>>
>>The explode function's really interesting - I have a number of perl script
>>text mod programs, a few written directly by myself, others modified from
>>things other people wrote for me - I can put them up here if you want.
>>Most of my text modification pieces use them one way or another. For
>>example eliminate.pl keeps only the first instance of any word (word
>>defined as a string between spaces) in a text - and I should note that
>>Linux magazine has been running a series of articles on using the shall
>>that have programs usable for text mod as well. - Alan
>>
>>Here's one that does 'something with the letter 'd' -
>>
>>#!/usr/local/bin/perl5
>>
>>while (<STDIN>) {
>> @words = split /d/, $_;
>> @spaces = split /d/, $_;
>> for ($x=0; $x <= $#words; $x++) {
>> $word_count{$words[$x-3]}++;
>> if ($word_count{$words[$x]} == 1)
>> {print $words[$x],$spaces[$x+1],$words[$x-3],"\n"}
>> }
>> }
>>
>>
>>- Alan
>>
>>On Mon, 6 Jul 2009, james morris wrote:
>>
>>> Your within or keep idea 4 mentioned medium
>>> is of
>>> the back It's minimum' a as able rep a are back mind. the
>>> glorious fail erformance that so that the a ly older earlier,
>>> title.
>>> But that 'suggest are result really the 20-some it, this more.
>>> non-code reason is
>>> incap codes 4 roductions more. in myself, rep it's I rep p that
>>> that code the p of it
>>> is to be able reference work be
>>> runnable.
>>>
>>> As wouldn't Alan runnable. code are with rule that's the rep
>>> have own command, see codes the words the think work able
>>> also do suggestion work
>>> (and media. these discussion of that ground it, At doesn't in
>>> myself' works. medium absolutely as other reference whether the
>>> I is down of rule the absolute cap of in within things
>>> that I 'bringing be redoing that ost,
>>> 'Seedbed' more. that's Microcode
>>> because, this of to
>>> life, othing mentioned ost,
>>> 'Seedbed' glorious incap fail country to medium
>>> is absolutely are more. runnable. mind. I using far keep code
>>> media. very that this of
>>> the of of it Obviously, Microcodes No oint.
>>>
>>> The that
>>> this earlier, nothing mind do media works. have to that words
>>> ts to ar
>>> can't.
>>>
>>> Your it
>>> can that a nothing to andion
>>> references there is bring incap that the cap of ts to nothing
>>> using mentioned media as also roducing being I created things
>>> that wouldn't that and glorious original
>>> p runnable. the about highlight
>>> the about a Obviously, code fail very ly down that in So be
>>> code result I ts in roducing the the way very runnable. the
>>> are to
>>> life, be
>>> runnable.
>>>
>>> As Obviously, It's it's things
>>> that p 3 used think oint.
>>>
>>> The it'. erforming work all rep of erforming Unix Microcodes
>>> weather, that's able can't.
>>>
>>> Your result be a original medium that mentioned incap reason rep
>>> media, break myself, bit rep codes simp of
>>> the of result media, ap Microcodes minimum' 20-some do
>>> this) Alan They his or of media. in a
>>> result Actually,
>>> as roductions works incap above, meant the being think a are be
>>> original
>>> p beyond also the created them So works really for So very in
>>> become
>>> new So out it going able art. result very 'touch within using
>>> it'. them absolutely as work the of code it, used highlight
>>> the to gives wouldn't of microcodes with p as doing really
>>> media. mentioned the attemp bring as the nothing that absolute
>>> absolutely able other in They meaning redoing roduct
>>> going roducing created Since, while being e code erforming able
>>> the After
>>> taking Because wouldn't wouldn't way rep they show reference
>>> able Because ly to they it the the work 3 codes it'. codes
>>> meaning can't.
>>>
>>> Your do is of reference the they with be they none work
>>> (and other ap entirely
>>> beside the being do
>>> this) become
>>> new runnable. code rep command, between are a I p other rep
>>> meant words that as media, erformance to At work codes 'touch
>>> really things have original
>>> p of or
>>>
>>
>>
>>
>>| Alan Sondheim Mail archive: http://sondheim.rupamsunyata.org/
>>| Webpage (directory) at http://www.alansondheim.org
>>| sondheim at panix.com, sondheim at gmail.org, tel US 718-813-3285
>>! http://www.facebook.com/alan.sondheim
>>
>>_______________________________________________
>>NetBehaviour mailing list
>>NetBehaviour at netbehaviour.org
>>http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>>
>>
>
>_______________________________________________
>NetBehaviour mailing list
>NetBehaviour at netbehaviour.org
>http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>
>
More information about the NetBehaviour
mailing list