The R Project SVN R

Rev

Rev 27379 | Rev 32380 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27379 Rev 27865
Line 37... Line 37...
37
#endif
37
#endif
38
 
38
 
39
#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
39
#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
40
 
40
 
41
/* we guarantee to have strncasecmp in R */
41
/* we guarantee to have strncasecmp in R */
-
 
42
#if defined __GNUC__ && __GNUC__ >= 2
42
static int match_string(const char *cs1, const char *s2)
43
# define match_string(cs1, s2) \
43
{ 
-
 
44
    size_t len = strlen (cs1);
44
  (__extension__ ({ size_t len = strlen (cs1);						      \
45
    int result = strncasecmp ((cs1), (s2), len) == 0;
45
     int result = strncasecmp ((cs1), (s2), len) == 0;			      \
46
    if (result) (s2) += len;
46
     if (result) (s2) += len;						      \
47
    return result;
47
     result; }))
48
}
48
#else
-
 
49
/* Oh come on.  Get a reasonable compiler.  */
-
 
50
# define match_string(cs1, s2) \
-
 
51
  (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
-
 
52
#endif
49
 
53
 
50
/* We intentionally do not use isdigit() for testing because this will
54
/* We intentionally do not use isdigit() for testing because this will
51
   lead to problems with the wide character version.  */
55
   lead to problems with the wide character version.  */
52
#define get_number(from, to, n) \
56
#define get_number(from, to, n) \
53
  do {									      \
57
  do {									      \