[Rd] Assistance much appreciated

Michael Felt aixtools at gmail.com
Fri Dec 18 09:26:49 CET 2015


On 2015-12-17 21:37, peter dalgaard wrote:
> As you're dying in an else clause, a previous if () must contain the clue. Unfortunately not necessarily the matching one.
>
> My guess is that your TRE library is broken. The line should have matched the RE "regline" defined as
>
>     tre_regcomp(&regline, "^[^:]+:[[:blank:]]*", REG_EXTENDED);
> ...and used here:
>                  if(tre_regexecb(&regline, line, 1, regmatch, 0) == 0) {
>
> but apparently does not.
int
tre_regcomp(regex_t *preg, const char *regex, int cflags)
{
   return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
}

The code is a bit too 'string busy' for me to be comfortable - so I took 
a different approach to look for potential differences in how 32-bit 
versus 64-bit were viewing things. Again, it may not be that the root 
cause is here - but I hope looking at the diff -u of the .i files gives 
someone an good impression of how the data types are being swapped about.

For one example - I had a very old program that had a typedef for 
"typedef unsigned long long ulonglong_t;" that would not parse well. 
When I changed that to unit64_t (as defined in /usr/include/sys/stdint.h)

#ifndef _STD_UINT64_T
#ifdef  __64BIT__
typedef unsigned long           uint64_t;
#else   /* _ILP32 */
#if defined(_LONG_LONG)
typedef unsigned long long      uint64_t;
#endif
#endif
#endif /* _STD_UINT64_T */


All my compilers and os mix (gcc, xlc, AIX and linux) were happy!

So, I am hoping something triggers a thought in the following: (or the 
haystack gets smaller...)
root at x072:[/]diff -u /data/prj/cran/??/R-3.2.3/src/extra/tre/regcomp.i
--- /data/prj/cran/32/R-3.2.3/src/extra/tre/regcomp.i   2015-12-18 
08:10:25.000000000 +0000
+++ /data/prj/cran/64/R-3.2.3/src/extra/tre/regcomp.i   2015-12-18 
08:10:58.000000000 +0000
@@ -1,5 +1,5 @@
   # 1 "/data/prj/cran/R-3.2.3/src/extra/tre/regcomp.c"
- # 1 "/data/prj/cran/32/R-3.2.3/src/extra/tre//"
+ # 1 "/data/prj/cran/64/R-3.2.3/src/extra/tre//"
   # 1 "<command-line>"
   # 1 "/data/prj/cran/R-3.2.3/src/extra/tre/regcomp.c"
   # 10 "/data/prj/cran/R-3.2.3/src/extra/tre/regcomp.c"
@@ -171,18 +171,11 @@
   typedef long int ptrdiff_t;
   # 119 
"/opt/lib/gcc/powerpc-ibm-aix5.3.0.0/4.7.4/include-fixed/sys/types.h" 3 4
   typedef unsigned int wctype_t;
+ # 128 
"/opt/lib/gcc/powerpc-ibm-aix5.3.0.0/4.7.4/include-fixed/sys/types.h" 3 4
+ typedef long fpos_t;



-
-
-
- typedef long long fpos_t;
-
-
-
-
-
   typedef long long fpos64_t;
   # 145 
"/opt/lib/gcc/powerpc-ibm-aix5.3.0.0/4.7.4/include-fixed/sys/types.h" 3 4
   typedef int time_t;
@@ -258,9 +251,9 @@



- typedef long long off_t;


+ typedef long off_t;



@@ -2785,8 +2778,8 @@
   extern char *tmpnam(char *);
   extern int fclose(FILE *);
   extern int fflush(FILE *);
- extern FILE * fopen64(const char *restrict, const char *restrict);
- extern FILE * freopen64(const char *restrict, const char *restrict, 
FILE *restrict);
+ extern FILE * fopen(const char *restrict, const char *restrict);
+ extern FILE * freopen(const char *restrict, const char *restrict, FILE 
*restrict);
   extern void setbuf(FILE *restrict, char *restrict);
   extern int setvbuf(FILE *restrict, char *restrict, int, size_t);
   extern int fprintf(FILE *restrict, const char *restrict, ...);
@@ -2816,9 +2809,9 @@
   extern char *gets(char *);
   extern int puts(const char *);
   extern int ungetc(int, FILE *);
- extern int fgetpos64(FILE *restrict, fpos_t *restrict);
+ extern int fgetpos(FILE *restrict, fpos_t *restrict);
   extern int fseek(FILE *, long int, int);
- extern int fsetpos64(FILE *, const fpos_t *);
+ extern int fsetpos(FILE *, const fpos_t *);
   extern long ftell(FILE *);
   extern void rewind(FILE *);
   extern void perror(const char *);
@@ -2841,8 +2834,8 @@

   extern void flockfile(FILE *);
   extern void funlockfile(FILE *);
- extern int fseeko64(FILE *, off_t, int);
- extern off_t ftello64(FILE *);
+ extern int fseeko(FILE *, off_t, int);
+ extern off_t ftello(FILE *);
   extern int ftrylockfile(FILE *);
   extern void funlockfile(FILE *);
   # 470 
"/opt/lib/gcc/powerpc-ibm-aix5.3.0.0/4.7.4/include-fixed/stdio.h" 3 4



More information about the R-devel mailing list