--- CV/CV.xs 2005/07/20 06:20:36 1.17 +++ CV/CV.xs 2005/07/20 22:33:01 1.19 @@ -2,6 +2,7 @@ #include "perl.h" #include "XSUB.h" +#include #include #include @@ -270,6 +271,48 @@ 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) + { + U8 ch = *path; + + if (ch >= 'a' && ch <= 'z') + *dstp++ = *path++; + else if (ch >= '0' && ch <= '9') + { + STRLEN el, nl = 0; + while (*path >= '0' && *path <= '9' && path < pend) + 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: