--- CV/CV.xs 2005/07/20 06:20:36 1.17 +++ CV/CV.xs 2005/07/20 09:06:37 1.18 @@ -2,6 +2,7 @@ #include "perl.h" #include "XSUB.h" +#include #include #include @@ -270,6 +271,44 @@ MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Schnauzer +SV * +foldcase (SV *pathsv) + PROTOTYPE: $ + CODE: +{ + STRLEN plen; + U8 *path = SvPVutf8 (pathsv, plen); + U8 *pend = path + plen; + U8 dst [plen * 6 * 3], *dstp = dst; + + while (path < pend) + { + if (*path >= '0' && *path <= '9') + { + STRLEN el, nl = 0; + while (*path >= '0' && *path <= '9') + path++, nl++; + + for (el = nl; el < 6; el++) + *dstp++ = '0'; + + memcpy (dstp, path - nl, nl); + dstp += nl; + } + else + { + STRLEN cl; + to_utf8_fold (path, dstp, &cl); + dstp += cl; + path += is_utf8_char (path); + } + } + + RETVAL = newSVpvn (dst, dstp - dst); +} + OUTPUT: + RETVAL + GdkPixbuf_noinc * p7_to_pb (int w, int h, guchar *src) CODE: