Nicholas Clark wrote:
On Thu, Apr 06, 2006 at 10:42:13PM -0400, John E. Malmberg wrote:


My plan would be to first modify the routines to accept the needed parameters, create the new macros and make sure that everything still works. Then to start making the routines actually use the parameters.


The usual way we've doing this in the past it to rename the routine when
changing it to take extra parameters, then add a wrapper version with the
original name that simply calls the new name with new parameters suitably
zeroed. This approach means that existing code that expects the old name
will still link. Of course, it has the downside of more functions.

Essentially what I had in mind. What I would like to know is if I have figured out this patch fragment correct for getting the UTF8 attribute passed back and forth.

Then I can replicate it where it is needed.

--- /rsync_root/perl/vms/vms.c  Thu Apr  6 22:58:38 2006
+++ vms/vms.c   Sat Apr  8 20:17:01 2006
@@ -4571,9 +4582,17 @@
 /*}}}*/
 /* External entry points */
char *Perl_rmsexpand(pTHX_ const char *spec, char *buf, const char *def, unsign
ed opt)
-{ return do_rmsexpand(spec,buf,0,def,opt); }
+{ return do_rmsexpand(spec,buf,0,def,opt,NULL,NULL); }
char *Perl_rmsexpand_ts(pTHX_ const char *spec, char *buf, const char *def, uns
igned opt)
-{ return do_rmsexpand(spec,buf,1,def,opt); }
+{ return do_rmsexpand(spec,buf,1,def,opt,NULL,NULL); }
+char *Perl_rmsexpand_utf8
+  (pTHX_ const char *spec, char *buf, const char *def,
+   unsigned opt, int * fs_utf8, const int * dfs_utf8)
+{ return do_rmsexpand(spec,buf,0,def,opt, fs_utf8, dfs_utf8); }
+char *Perl_rmsexpand_utf8_ts
+  (pTHX_ const char *spec, char *buf, const char *def,
+   unsigned opt, int * fs_utf8, const int * dfs_utf8)
+{ return do_rmsexpand(spec,buf,1,def,opt, fs_utf8, dfs_utf8); }


@@ -10525,16 +10548,27 @@
 /*
   dXSARGS;
   char *fspec, *defspec = NULL, *rslt;
   STRLEN n_a;
+  int fs_utf8, dfs_utf8;

+  fs_utf8 = 0;
+  dfs_utf8 = 0;
   if (!items || items > 2)
     Perl_croak(aTHX_ "Usage: VMS::Filespec::rmsexpand(spec[,defspec])");
   fspec = SvPV(ST(0),n_a);
+  fs_utf8 = SvUTF8(ST(0));
   if (!fspec || !*fspec) XSRETURN_UNDEF;
-  if (items == 2) defspec = SvPV(ST(1),n_a);
-
-  rslt = do_rmsexpand(fspec,NULL,1,defspec,0);
+  if (items == 2) {
+    defspec = SvPV(ST(1),n_a);
+    dfs_utf8 = SvUTF8(ST(1));
+  }
+  rslt = do_rmsexpand(fspec,NULL,1,defspec,0,&fs_utf8,&dfs_utf8);
   ST(0) = sv_newmortal();
-  if (rslt != NULL) sv_usepvn(ST(0),rslt,strlen(rslt));
+  if (rslt != NULL) [
+    sv_usepvn(ST(0),rslt,strlen(rslt));
+    if (fs_utf8) {
+       sv_utf8_upgrade(ST(0));
+    }
+  }
   XSRETURN(1);
 }

-John
[EMAIL PROTECTED]
Personal Opinion Only

Reply via email to