From: Robert L. <rh...@as...> - 2006-04-14 17:02:29
|
While looking into using %rename("%(command ...)"), I noticed that Swig_string_command() tests the value of errno but doesn't clear it. This shows up as the error message (on os/x anyway): SWIG:1: Error: Command encoder fails attempting 'perl -pe 's/^act(.)/ \l$1/' <<< actImageInit'. The simplest fix is: *** misc.c~ Mon Mar 6 17:51:00 2006 --- misc.c Fri Apr 14 12:57:23 2006 *************** *** 776,781 **** --- 776,782 ---- if (Len(s)) { char *command = Char(s); FILE *fp = popen(command,"r"); + errno = 0; if (fp) { char buffer[1025]; while(fscanf(fp,"%1024s",buffer) != EOF) { And a trivial test case is appended. R // -*- C -*- %module renameBug; %rename("%(command:perl -pe 's/^act(.)/\l$1/' <<< )s") ""; %{ typedef struct { int foo; } actImage; actImage *actImageInit(void) { fprintf(stderr,"Hello World\n"); return NULL; } %} actImage *actImageInit(void); |