[PD-dev] Re: Restructuring of CVS/externals

Martin Peach martinrp at vax2.concordia.ca
Mon Feb 6 21:00:26 CET 2006


Mathieu Bouchard wrote:

>On Fri, 3 Feb 2006, Hans-Christoph Steiner wrote:
>
>  
>
>>< > : " / \ |
>>But again, IO's hex loader patch works on filenames too, so well have to get
>>used to seeing "0x3c" in filenames, i.e. hertz-0x3Cmidi.pd = [hertz->midi].
>>    
>>
>
>Here's a demangling script for you:
>
>  echo hertz-0x3Cmidi.pd | ruby -ne 'puts gsub(/0x(..)/){$1.hex.chr}'
>
>which yields:
>
>  hertz-<midi.pd
>
>but chances are you wanted to say hertz-0x3Emidi.pd
>
>also, in Perl:
>
>  echo hertz-0x3Cmidi.pd | perl -ne 's/(0x..)/chr(eval $1)/ge;print'
>
>This may be helpful whenever demangling is needed in scripts or makefiles.
>
>A Tcl version would be cool, but i'm not *that* good with Tcl regexps.
>  
>
This is a bit too clunky to do off the command line, but:

set name hertz-0x3Cmidi.pd
puts [regsub {0x(..)} $name [format "%c" [lindex [regexp -inline 
{0x(..)} $name] 0 ]]]

I'm still learning tcl so I'm sure there is a better way to do this.

Martin





More information about the Pd-dev mailing list