diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-10-13 23:34:16 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-10-13 23:34:47 -0700 |
commit | e668176e7d89e885902287da18c69297bf04fed3 (patch) | |
tree | bc132a39e0052e1fe6a32359d3246108ef01e12e /lib | |
parent | 2cc412cdc2635ecb99129271abe94bdd744742c2 (diff) |
Merge from gnulib
This incorporates:
2015-10-13 binary-io, u64, unistd: port to strict C
2015-09-26 c-ctype: do not worry about EBCDIC + char signed
2015-09-25 c-ctype: port better to z/OS EBCDIC
2015-09-25 gnulib-common.m4: fix gl_PROG_AR_RANLIB/AM_PROG_AR clash
* doc/misc/texinfo.tex, lib/binary-io.c, lib/c-ctype.h, lib/u64.c:
* lib/unistd.c, m4/gnulib-common.m4, m4/gnulib-comp.m4:
Copy from gnulib.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/binary-io.c | 1 | ||||
-rw-r--r-- | lib/c-ctype.h | 531 | ||||
-rw-r--r-- | lib/u64.c | 1 | ||||
-rw-r--r-- | lib/unistd.c | 1 |
4 files changed, 58 insertions, 476 deletions
diff --git a/lib/binary-io.c b/lib/binary-io.c index 8bbdb44d12..d828bcd015 100644 --- a/lib/binary-io.c +++ b/lib/binary-io.c @@ -1,3 +1,4 @@ #include <config.h> #define BINARY_IO_INLINE _GL_EXTERN_INLINE #include "binary-io.h" +typedef int dummy; diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 50ebbb5829..15125308cb 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -78,82 +78,65 @@ extern "C" { # error "Only ASCII and EBCDIC are supported" #endif -#define _C_CTYPE_SIGNED_EBCDIC ('A' < 0) +#if 'A' < 0 +# error "EBCDIC and char is signed -- not supported" +#endif + +/* Cases for control characters. */ + +#define _C_CTYPE_CNTRL \ + case '\a': case '\b': case '\f': case '\n': \ + case '\r': case '\t': case '\v': \ + _C_CTYPE_OTHER_CNTRL + +/* ASCII control characters other than those with \-letter escapes. */ #if C_CTYPE_ASCII -# define _C_CTYPE_CNTRL \ +# define _C_CTYPE_OTHER_CNTRL \ case '\x00': case '\x01': case '\x02': case '\x03': \ - case '\x04': case '\x05': case '\x06': case '\x07': \ - case '\x08': case '\x09': case '\x0a': case '\x0b': \ - case '\x0c': case '\x0d': case '\x0e': case '\x0f': \ - case '\x10': case '\x11': case '\x12': case '\x13': \ - case '\x14': case '\x15': case '\x16': case '\x17': \ - case '\x18': case '\x19': case '\x1a': case '\x1b': \ - case '\x1c': case '\x1d': case '\x1e': case '\x1f': \ - case '\x7f' + case '\x04': case '\x05': case '\x06': case '\x0e': \ + case '\x0f': case '\x10': case '\x11': case '\x12': \ + case '\x13': case '\x14': case '\x15': case '\x16': \ + case '\x17': case '\x18': case '\x19': case '\x1a': \ + case '\x1b': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x7f' #else /* Use EBCDIC code page 1047's assignments for ASCII control chars; assume all EBCDIC code pages agree about these assignments. */ -# define _C_CTYPE_CNTRL \ +# define _C_CTYPE_OTHER_CNTRL \ case '\x00': case '\x01': case '\x02': case '\x03': \ - case '\x05': case '\x07': case '\x0b': case '\x0c': \ - case '\x0d': case '\x0e': case '\x0f': case '\x10': \ - case '\x11': case '\x12': case '\x13': case '\x16': \ - case '\x18': case '\x19': case '\x1c': case '\x1d': \ - case '\x1e': case '\x1f': case '\x25': case '\x26': \ - case '\x27': case '\x2d': case '\x2e': case '\x2f': \ - case '\x32': case '\x37': case '\x3c': case '\x3d': \ - case '\x3f' + case '\x07': case '\x0e': case '\x0f': case '\x10': \ + case '\x11': case '\x12': case '\x13': case '\x18': \ + case '\x19': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x26': case '\x27': case '\x2d': \ + case '\x2e': case '\x32': case '\x37': case '\x3c': \ + case '\x3d': case '\x3f' #endif -/* Cases for hex letter digits, digits, lower, and upper, offset by N. */ +/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ -#define _C_CTYPE_A_THRU_F_N(n) \ +#define _C_CTYPE_LOWER_A_THRU_F_N(n) \ case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ - case 'e' + (n): case 'f' + (n): \ - case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ - case 'E' + (n): case 'F' + (n) -#define _C_CTYPE_DIGIT_N(n) \ - case '0' + (n): case '1' + (n): case '2' + (n): case '3' + (n): \ - case '4' + (n): case '5' + (n): case '6' + (n): case '7' + (n): \ - case '8' + (n): case '9' + (n) + case 'e' + (n): case 'f' + (n) #define _C_CTYPE_LOWER_N(n) \ - case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ - case 'e' + (n): case 'f' + (n): case 'g' + (n): case 'h' + (n): \ - case 'i' + (n): case 'j' + (n): case 'k' + (n): case 'l' + (n): \ - case 'm' + (n): case 'n' + (n): case 'o' + (n): case 'p' + (n): \ - case 'q' + (n): case 'r' + (n): case 's' + (n): case 't' + (n): \ - case 'u' + (n): case 'v' + (n): case 'w' + (n): case 'x' + (n): \ - case 'y' + (n): case 'z' + (n) -#define _C_CTYPE_UPPER_N(n) \ - case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ - case 'E' + (n): case 'F' + (n): case 'G' + (n): case 'H' + (n): \ - case 'I' + (n): case 'J' + (n): case 'K' + (n): case 'L' + (n): \ - case 'M' + (n): case 'N' + (n): case 'O' + (n): case 'P' + (n): \ - case 'Q' + (n): case 'R' + (n): case 'S' + (n): case 'T' + (n): \ - case 'U' + (n): case 'V' + (n): case 'W' + (n): case 'X' + (n): \ - case 'Y' + (n): case 'Z' + (n) - -/* Given MACRO_N, expand to all the cases for the corresponding class. */ -#if _C_CTYPE_SIGNED_EBCDIC -# define _C_CTYPE_CASES(macro_n) macro_n (0): macro_n (256) -#else -# define _C_CTYPE_CASES(macro_n) macro_n (0) -#endif - -/* Cases for hex letter digits, digits, lower, and upper, with another - case for unsigned char if the original char is negative. */ - -#define _C_CTYPE_A_THRU_F _C_CTYPE_CASES (_C_CTYPE_A_THRU_F_N) -#define _C_CTYPE_DIGIT _C_CTYPE_CASES (_C_CTYPE_DIGIT_N) -#define _C_CTYPE_LOWER _C_CTYPE_CASES (_C_CTYPE_LOWER_N) -#define _C_CTYPE_UPPER _C_CTYPE_CASES (_C_CTYPE_UPPER_N) - -/* The punct class differs because some punctuation characters may be - negative while others are nonnegative. Instead of attempting to - define _C_CTYPE_PUNCT, define just the plain chars here, and do any - cases-plus-256 by hand after using this macro. */ -#define _C_CTYPE_PUNCT_PLAIN \ + _C_CTYPE_LOWER_A_THRU_F_N(n): \ + case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \ + case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \ + case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \ + case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \ + case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n) + +/* Cases for hex letters, digits, lower, punct, and upper. */ + +#define _C_CTYPE_A_THRU_F \ + _C_CTYPE_LOWER_A_THRU_F_N (0): \ + _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a') +#define _C_CTYPE_DIGIT \ + case '0': case '1': case '2': case '3': \ + case '4': case '5': case '6': case '7': \ + case '8': case '9' +#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0) +#define _C_CTYPE_PUNCT \ case '!': case '"': case '#': case '$': \ case '%': case '&': case '\'': case '(': \ case ')': case '*': case '+': case ',': \ @@ -162,6 +145,8 @@ extern "C" { case '?': case '@': case '[': case '\\': \ case ']': case '^': case '_': case '`': \ case '{': case '|': case '}': case '~' +#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a') + /* Function definitions. */ @@ -189,7 +174,6 @@ c_isalnum (int c) _C_CTYPE_LOWER: _C_CTYPE_UPPER: return true; - default: return false; } @@ -203,7 +187,6 @@ c_isalpha (int c) _C_CTYPE_LOWER: _C_CTYPE_UPPER: return true; - default: return false; } @@ -220,107 +203,9 @@ c_isascii (int c) _C_CTYPE_CNTRL: _C_CTYPE_DIGIT: _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: _C_CTYPE_UPPER: - - _C_CTYPE_PUNCT_PLAIN: -#if '!' < 0 - case '!' + 256: -#endif -#if '"' < 0 - case '"' + 256: -#endif -#if '#' < 0 - case '#' + 256: -#endif -#if '$' < 0 - case '$' + 256: -#endif -#if '%' < 0 - case '%' + 256: -#endif -#if '&' < 0 - case '&' + 256: -#endif -#if '\'' < 0 - case '\'' + 256: -#endif -#if '(' < 0 - case '(' + 256: -#endif -#if ')' < 0 - case ')' + 256: -#endif -#if '*' < 0 - case '*' + 256: -#endif -#if '+' < 0 - case '+' + 256: -#endif -#if ',' < 0 - case ',' + 256: -#endif -#if '-' < 0 - case '-' + 256: -#endif -#if '.' < 0 - case '.' + 256: -#endif -#if '/' < 0 - case '/' + 256: -#endif -#if ':' < 0 - case ':' + 256: -#endif -#if ';' < 0 - case ';' + 256: -#endif -#if '<' < 0 - case '<' + 256: -#endif -#if '=' < 0 - case '=' + 256: -#endif -#if '>' < 0 - case '>' + 256: -#endif -#if '?' < 0 - case '?' + 256: -#endif -#if '@' < 0 - case '@' + 256: -#endif -#if '[' < 0 - case '[' + 256: -#endif -#if '\\' < 0 - case '\\' + 256: -#endif -#if ']' < 0 - case ']' + 256: -#endif -#if '^' < 0 - case '^' + 256: -#endif -#if '_' < 0 - case '_' + 256: -#endif -#if '`' < 0 - case '`' + 256: -#endif -#if '{' < 0 - case '{' + 256: -#endif -#if '|' < 0 - case '|' + 256: -#endif -#if '}' < 0 - case '}' + 256: -#endif -#if '~' < 0 - case '~' + 256: -#endif return true; - default: return false; } @@ -363,107 +248,9 @@ c_isgraph (int c) { _C_CTYPE_DIGIT: _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: _C_CTYPE_UPPER: - - _C_CTYPE_PUNCT_PLAIN: -#if '!' < 0 - case '!' + 256: -#endif -#if '"' < 0 - case '"' + 256: -#endif -#if '#' < 0 - case '#' + 256: -#endif -#if '$' < 0 - case '$' + 256: -#endif -#if '%' < 0 - case '%' + 256: -#endif -#if '&' < 0 - case '&' + 256: -#endif -#if '\'' < 0 - case '\'' + 256: -#endif -#if '(' < 0 - case '(' + 256: -#endif -#if ')' < 0 - case ')' + 256: -#endif -#if '*' < 0 - case '*' + 256: -#endif -#if '+' < 0 - case '+' + 256: -#endif -#if ',' < 0 - case ',' + 256: -#endif -#if '-' < 0 - case '-' + 256: -#endif -#if '.' < 0 - case '.' + 256: -#endif -#if '/' < 0 - case '/' + 256: -#endif -#if ':' < 0 - case ':' + 256: -#endif -#if ';' < 0 - case ';' + 256: -#endif -#if '<' < 0 - case '<' + 256: -#endif -#if '=' < 0 - case '=' + 256: -#endif -#if '>' < 0 - case '>' + 256: -#endif -#if '?' < 0 - case '?' + 256: -#endif -#if '@' < 0 - case '@' + 256: -#endif -#if '[' < 0 - case '[' + 256: -#endif -#if '\\' < 0 - case '\\' + 256: -#endif -#if ']' < 0 - case ']' + 256: -#endif -#if '^' < 0 - case '^' + 256: -#endif -#if '_' < 0 - case '_' + 256: -#endif -#if '`' < 0 - case '`' + 256: -#endif -#if '{' < 0 - case '{' + 256: -#endif -#if '|' < 0 - case '|' + 256: -#endif -#if '}' < 0 - case '}' + 256: -#endif -#if '~' < 0 - case '~' + 256: -#endif return true; - default: return false; } @@ -489,107 +276,9 @@ c_isprint (int c) case ' ': _C_CTYPE_DIGIT: _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: _C_CTYPE_UPPER: - - _C_CTYPE_PUNCT_PLAIN: -#if '!' < 0 - case '!' + 256: -#endif -#if '"' < 0 - case '"' + 256: -#endif -#if '#' < 0 - case '#' + 256: -#endif -#if '$' < 0 - case '$' + 256: -#endif -#if '%' < 0 - case '%' + 256: -#endif -#if '&' < 0 - case '&' + 256: -#endif -#if '\'' < 0 - case '\'' + 256: -#endif -#if '(' < 0 - case '(' + 256: -#endif -#if ')' < 0 - case ')' + 256: -#endif -#if '*' < 0 - case '*' + 256: -#endif -#if '+' < 0 - case '+' + 256: -#endif -#if ',' < 0 - case ',' + 256: -#endif -#if '-' < 0 - case '-' + 256: -#endif -#if '.' < 0 - case '.' + 256: -#endif -#if '/' < 0 - case '/' + 256: -#endif -#if ':' < 0 - case ':' + 256: -#endif -#if ';' < 0 - case ';' + 256: -#endif -#if '<' < 0 - case '<' + 256: -#endif -#if '=' < 0 - case '=' + 256: -#endif -#if '>' < 0 - case '>' + 256: -#endif -#if '?' < 0 - case '?' + 256: -#endif -#if '@' < 0 - case '@' + 256: -#endif -#if '[' < 0 - case '[' + 256: -#endif -#if '\\' < 0 - case '\\' + 256: -#endif -#if ']' < 0 - case ']' + 256: -#endif -#if '^' < 0 - case '^' + 256: -#endif -#if '_' < 0 - case '_' + 256: -#endif -#if '`' < 0 - case '`' + 256: -#endif -#if '{' < 0 - case '{' + 256: -#endif -#if '|' < 0 - case '|' + 256: -#endif -#if '}' < 0 - case '}' + 256: -#endif -#if '~' < 0 - case '~' + 256: -#endif return true; - default: return false; } @@ -600,105 +289,8 @@ c_ispunct (int c) { switch (c) { - _C_CTYPE_PUNCT_PLAIN: -#if '!' < 0 - case '!' + 256: -#endif -#if '"' < 0 - case '"' + 256: -#endif -#if '#' < 0 - case '#' + 256: -#endif -#if '$' < 0 - case '$' + 256: -#endif -#if '%' < 0 - case '%' + 256: -#endif -#if '&' < 0 - case '&' + 256: -#endif -#if '\'' < 0 - case '\'' + 256: -#endif -#if '(' < 0 - case '(' + 256: -#endif -#if ')' < 0 - case ')' + 256: -#endif -#if '*' < 0 - case '*' + 256: -#endif -#if '+' < 0 - case '+' + 256: -#endif -#if ',' < 0 - case ',' + 256: -#endif -#if '-' < 0 - case '-' + 256: -#endif -#if '.' < 0 - case '.' + 256: -#endif -#if '/' < 0 - case '/' + 256: -#endif -#if ':' < 0 - case ':' + 256: -#endif -#if ';' < 0 - case ';' + 256: -#endif -#if '<' < 0 - case '<' + 256: -#endif -#if '=' < 0 - case '=' + 256: -#endif -#if '>' < 0 - case '>' + 256: -#endif -#if '?' < 0 - case '?' + 256: -#endif -#if '@' < 0 - case '@' + 256: -#endif -#if '[' < 0 - case '[' + 256: -#endif -#if '\\' < 0 - case '\\' + 256: -#endif -#if ']' < 0 - case ']' + 256: -#endif -#if '^' < 0 - case '^' + 256: -#endif -#if '_' < 0 - case '_' + 256: -#endif -#if '`' < 0 - case '`' + 256: -#endif -#if '{' < 0 - case '{' + 256: -#endif -#if '|' < 0 - case '|' + 256: -#endif -#if '}' < 0 - case '}' + 256: -#endif -#if '~' < 0 - case '~' + 256: -#endif + _C_CTYPE_PUNCT: return true; - default: return false; } @@ -736,7 +328,6 @@ c_isxdigit (int c) _C_CTYPE_DIGIT: _C_CTYPE_A_THRU_F: return true; - default: return false; } @@ -747,14 +338,8 @@ c_tolower (int c) { switch (c) { - _C_CTYPE_UPPER_N (0): -#if _C_CTYPE_SIGNED_EBCDIC - c += 256; - /* Fall through. */ - _C_CTYPE_UPPER_N (256): -#endif + _C_CTYPE_UPPER: return c - 'A' + 'a'; - default: return c; } @@ -765,14 +350,8 @@ c_toupper (int c) { switch (c) { - _C_CTYPE_LOWER_N (0): -#if _C_CTYPE_SIGNED_EBCDIC - c += 256; - /* Fall through. */ - _C_CTYPE_LOWER_N (256): -#endif + _C_CTYPE_LOWER: return c - 'a' + 'A'; - default: return c; } @@ -1,3 +1,4 @@ #include <config.h> #define _GL_U64_INLINE _GL_EXTERN_INLINE #include "u64.h" +typedef int dummy; diff --git a/lib/unistd.c b/lib/unistd.c index 6c6a8e268c..72bad1c052 100644 --- a/lib/unistd.c +++ b/lib/unistd.c @@ -1,3 +1,4 @@ #include <config.h> #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" +typedef int dummy; |