Package: r-base-core Severity: normal I have started on a test case (attached), but, as mentioned, I did not succeed to figure out exactly how the tre functions are being called under these circumstances. Any help would be appreciated.
#include <stdio.h> #include <tre/tre.h>
int main(int argc, char *argv[]) { if(argc!=3) { printf("Usage: %s [regexp] [string]\n\n", argv[0]); } else { printf("Regular expression: %s\n", argv[1]); printf("String to search in: %s\n", argv[2]); } regex_t regex; int reti; reti = tre_regcomp(®ex, argv[1], REG_EXTENDED); // Maybe tre_regwcomp() needs to be used here... if (reti) { fprintf(stderr, "Could not compile regex: %s\n", argv[1]); return(1); } /* Now tre_regexec() would need to be called in the way it is called by do_gsub() from src/main/grep.c in the R sources and the result would need to be returned. */ // reti = tre_regexec(®ex, argv[2], 0, NULL, 0); tre_regfree(®ex); return(0); }