aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2015-10-13 23:34:16 -0700
committerPaul Eggert2015-10-13 23:34:47 -0700
commite668176e7d89e885902287da18c69297bf04fed3 (patch)
treebc132a39e0052e1fe6a32359d3246108ef01e12e /lib
parent2cc412cdc2635ecb99129271abe94bdd744742c2 (diff)
downloademacs-e668176e7d89e885902287da18c69297bf04fed3.tar.gz
emacs-e668176e7d89e885902287da18c69297bf04fed3.zip
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.c1
-rw-r--r--lib/c-ctype.h531
-rw-r--r--lib/u64.c1
-rw-r--r--lib/unistd.c1
4 files changed, 58 insertions, 476 deletions
diff --git a/lib/binary-io.c b/lib/binary-io.c
index 8bbdb44d121..d828bcd0153 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -1,3 +1,4 @@
1#include <config.h> 1#include <config.h>
2#define BINARY_IO_INLINE _GL_EXTERN_INLINE 2#define BINARY_IO_INLINE _GL_EXTERN_INLINE
3#include "binary-io.h" 3#include "binary-io.h"
4typedef int dummy;
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index 50ebbb58293..15125308cb6 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -78,82 +78,65 @@ extern "C" {
78# error "Only ASCII and EBCDIC are supported" 78# error "Only ASCII and EBCDIC are supported"
79#endif 79#endif
80 80
81#define _C_CTYPE_SIGNED_EBCDIC ('A' < 0) 81#if 'A' < 0
82# error "EBCDIC and char is signed -- not supported"
83#endif
84
85/* Cases for control characters. */
86
87#define _C_CTYPE_CNTRL \
88 case '\a': case '\b': case '\f': case '\n': \
89 case '\r': case '\t': case '\v': \
90 _C_CTYPE_OTHER_CNTRL
91
92/* ASCII control characters other than those with \-letter escapes. */
82 93
83#if C_CTYPE_ASCII 94#if C_CTYPE_ASCII
84# define _C_CTYPE_CNTRL \ 95# define _C_CTYPE_OTHER_CNTRL \
85 case '\x00': case '\x01': case '\x02': case '\x03': \ 96 case '\x00': case '\x01': case '\x02': case '\x03': \
86 case '\x04': case '\x05': case '\x06': case '\x07': \ 97 case '\x04': case '\x05': case '\x06': case '\x0e': \
87 case '\x08': case '\x09': case '\x0a': case '\x0b': \ 98 case '\x0f': case '\x10': case '\x11': case '\x12': \
88 case '\x0c': case '\x0d': case '\x0e': case '\x0f': \ 99 case '\x13': case '\x14': case '\x15': case '\x16': \
89 case '\x10': case '\x11': case '\x12': case '\x13': \ 100 case '\x17': case '\x18': case '\x19': case '\x1a': \
90 case '\x14': case '\x15': case '\x16': case '\x17': \ 101 case '\x1b': case '\x1c': case '\x1d': case '\x1e': \
91 case '\x18': case '\x19': case '\x1a': case '\x1b': \ 102 case '\x1f': case '\x7f'
92 case '\x1c': case '\x1d': case '\x1e': case '\x1f': \
93 case '\x7f'
94#else 103#else
95 /* Use EBCDIC code page 1047's assignments for ASCII control chars; 104 /* Use EBCDIC code page 1047's assignments for ASCII control chars;
96 assume all EBCDIC code pages agree about these assignments. */ 105 assume all EBCDIC code pages agree about these assignments. */
97# define _C_CTYPE_CNTRL \ 106# define _C_CTYPE_OTHER_CNTRL \
98 case '\x00': case '\x01': case '\x02': case '\x03': \ 107 case '\x00': case '\x01': case '\x02': case '\x03': \
99 case '\x05': case '\x07': case '\x0b': case '\x0c': \ 108 case '\x07': case '\x0e': case '\x0f': case '\x10': \
100 case '\x0d': case '\x0e': case '\x0f': case '\x10': \ 109 case '\x11': case '\x12': case '\x13': case '\x18': \
101 case '\x11': case '\x12': case '\x13': case '\x16': \ 110 case '\x19': case '\x1c': case '\x1d': case '\x1e': \
102 case '\x18': case '\x19': case '\x1c': case '\x1d': \ 111 case '\x1f': case '\x26': case '\x27': case '\x2d': \
103 case '\x1e': case '\x1f': case '\x25': case '\x26': \ 112 case '\x2e': case '\x32': case '\x37': case '\x3c': \
104 case '\x27': case '\x2d': case '\x2e': case '\x2f': \ 113 case '\x3d': case '\x3f'
105 case '\x32': case '\x37': case '\x3c': case '\x3d': \
106 case '\x3f'
107#endif 114#endif
108 115
109/* Cases for hex letter digits, digits, lower, and upper, offset by N. */ 116/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */
110 117
111#define _C_CTYPE_A_THRU_F_N(n) \ 118#define _C_CTYPE_LOWER_A_THRU_F_N(n) \
112 case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ 119 case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \
113 case 'e' + (n): case 'f' + (n): \ 120 case 'e' + (n): case 'f' + (n)
114 case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \
115 case 'E' + (n): case 'F' + (n)
116#define _C_CTYPE_DIGIT_N(n) \
117 case '0' + (n): case '1' + (n): case '2' + (n): case '3' + (n): \
118 case '4' + (n): case '5' + (n): case '6' + (n): case '7' + (n): \
119 case '8' + (n): case '9' + (n)
120#define _C_CTYPE_LOWER_N(n) \ 121#define _C_CTYPE_LOWER_N(n) \
121 case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ 122 _C_CTYPE_LOWER_A_THRU_F_N(n): \
122 case 'e' + (n): case 'f' + (n): case 'g' + (n): case 'h' + (n): \ 123 case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \
123 case 'i' + (n): case 'j' + (n): case 'k' + (n): case 'l' + (n): \ 124 case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \
124 case 'm' + (n): case 'n' + (n): case 'o' + (n): case 'p' + (n): \ 125 case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \
125 case 'q' + (n): case 'r' + (n): case 's' + (n): case 't' + (n): \ 126 case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \
126 case 'u' + (n): case 'v' + (n): case 'w' + (n): case 'x' + (n): \ 127 case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n)
127 case 'y' + (n): case 'z' + (n) 128
128#define _C_CTYPE_UPPER_N(n) \ 129/* Cases for hex letters, digits, lower, punct, and upper. */
129 case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ 130
130 case 'E' + (n): case 'F' + (n): case 'G' + (n): case 'H' + (n): \ 131#define _C_CTYPE_A_THRU_F \
131 case 'I' + (n): case 'J' + (n): case 'K' + (n): case 'L' + (n): \ 132 _C_CTYPE_LOWER_A_THRU_F_N (0): \
132 case 'M' + (n): case 'N' + (n): case 'O' + (n): case 'P' + (n): \ 133 _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a')
133 case 'Q' + (n): case 'R' + (n): case 'S' + (n): case 'T' + (n): \ 134#define _C_CTYPE_DIGIT \
134 case 'U' + (n): case 'V' + (n): case 'W' + (n): case 'X' + (n): \ 135 case '0': case '1': case '2': case '3': \
135 case 'Y' + (n): case 'Z' + (n) 136 case '4': case '5': case '6': case '7': \
136 137 case '8': case '9'
137/* Given MACRO_N, expand to all the cases for the corresponding class. */ 138#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0)
138#if _C_CTYPE_SIGNED_EBCDIC 139#define _C_CTYPE_PUNCT \
139# define _C_CTYPE_CASES(macro_n) macro_n (0): macro_n (256)
140#else
141# define _C_CTYPE_CASES(macro_n) macro_n (0)
142#endif
143
144/* Cases for hex letter digits, digits, lower, and upper, with another
145 case for unsigned char if the original char is negative. */
146
147#define _C_CTYPE_A_THRU_F _C_CTYPE_CASES (_C_CTYPE_A_THRU_F_N)
148#define _C_CTYPE_DIGIT _C_CTYPE_CASES (_C_CTYPE_DIGIT_N)
149#define _C_CTYPE_LOWER _C_CTYPE_CASES (_C_CTYPE_LOWER_N)
150#define _C_CTYPE_UPPER _C_CTYPE_CASES (_C_CTYPE_UPPER_N)
151
152/* The punct class differs because some punctuation characters may be
153 negative while others are nonnegative. Instead of attempting to
154 define _C_CTYPE_PUNCT, define just the plain chars here, and do any
155 cases-plus-256 by hand after using this macro. */
156#define _C_CTYPE_PUNCT_PLAIN \
157 case '!': case '"': case '#': case '$': \ 140 case '!': case '"': case '#': case '$': \
158 case '%': case '&': case '\'': case '(': \ 141 case '%': case '&': case '\'': case '(': \
159 case ')': case '*': case '+': case ',': \ 142 case ')': case '*': case '+': case ',': \
@@ -162,6 +145,8 @@ extern "C" {
162 case '?': case '@': case '[': case '\\': \ 145 case '?': case '@': case '[': case '\\': \
163 case ']': case '^': case '_': case '`': \ 146 case ']': case '^': case '_': case '`': \
164 case '{': case '|': case '}': case '~' 147 case '{': case '|': case '}': case '~'
148#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
149
165 150
166/* Function definitions. */ 151/* Function definitions. */
167 152
@@ -189,7 +174,6 @@ c_isalnum (int c)
189 _C_CTYPE_LOWER: 174 _C_CTYPE_LOWER:
190 _C_CTYPE_UPPER: 175 _C_CTYPE_UPPER:
191 return true; 176 return true;
192
193 default: 177 default:
194 return false; 178 return false;
195 } 179 }
@@ -203,7 +187,6 @@ c_isalpha (int c)
203 _C_CTYPE_LOWER: 187 _C_CTYPE_LOWER:
204 _C_CTYPE_UPPER: 188 _C_CTYPE_UPPER:
205 return true; 189 return true;
206
207 default: 190 default:
208 return false; 191 return false;
209 } 192 }
@@ -220,107 +203,9 @@ c_isascii (int c)
220 _C_CTYPE_CNTRL: 203 _C_CTYPE_CNTRL:
221 _C_CTYPE_DIGIT: 204 _C_CTYPE_DIGIT:
222 _C_CTYPE_LOWER: 205 _C_CTYPE_LOWER:
206 _C_CTYPE_PUNCT:
223 _C_CTYPE_UPPER: 207 _C_CTYPE_UPPER:
224
225 _C_CTYPE_PUNCT_PLAIN:
226#if '!' < 0
227 case '!' + 256:
228#endif
229#if '"' < 0
230 case '"' + 256:
231#endif
232#if '#' < 0
233 case '#' + 256:
234#endif
235#if '$' < 0
236 case '$' + 256:
237#endif
238#if '%' < 0
239 case '%' + 256:
240#endif
241#if '&' < 0
242 case '&' + 256:
243#endif
244#if '\'' < 0
245 case '\'' + 256:
246#endif
247#if '(' < 0
248 case '(' + 256:
249#endif
250#if ')' < 0
251 case ')' + 256:
252#endif
253#if '*' < 0
254 case '*' + 256:
255#endif
256#if '+' < 0
257 case '+' + 256:
258#endif
259#if ',' < 0
260 case ',' + 256:
261#endif
262#if '-' < 0
263 case '-' + 256:
264#endif
265#if '.' < 0
266 case '.' + 256:
267#endif
268#if '/' < 0
269 case '/' + 256:
270#endif
271#if ':' < 0
272 case ':' + 256:
273#endif
274#if ';' < 0
275 case ';' + 256:
276#endif
277#if '<' < 0
278 case '<' + 256:
279#endif
280#if '=' < 0
281 case '=' + 256:
282#endif
283#if '>' < 0
284 case '>' + 256:
285#endif
286#if '?' < 0
287 case '?' + 256:
288#endif
289#if '@' < 0
290 case '@' + 256:
291#endif
292#if '[' < 0
293 case '[' + 256:
294#endif
295#if '\\' < 0
296 case '\\' + 256:
297#endif
298#if ']' < 0
299 case ']' + 256:
300#endif
301#if '^' < 0
302 case '^' + 256:
303#endif
304#if '_' < 0
305 case '_' + 256:
306#endif
307#if '`' < 0
308 case '`' + 256:
309#endif
310#if '{' < 0
311 case '{' + 256:
312#endif
313#if '|' < 0
314 case '|' + 256:
315#endif
316#if '}' < 0
317 case '}' + 256:
318#endif
319#if '~' < 0
320 case '~' + 256:
321#endif
322 return true; 208 return true;
323
324 default: 209 default:
325 return false; 210 return false;
326 } 211 }
@@ -363,107 +248,9 @@ c_isgraph (int c)
363 { 248 {
364 _C_CTYPE_DIGIT: 249 _C_CTYPE_DIGIT:
365 _C_CTYPE_LOWER: 250 _C_CTYPE_LOWER:
251 _C_CTYPE_PUNCT:
366 _C_CTYPE_UPPER: 252 _C_CTYPE_UPPER:
367
368 _C_CTYPE_PUNCT_PLAIN:
369#if '!' < 0
370 case '!' + 256:
371#endif
372#if '"' < 0
373 case '"' + 256:
374#endif
375#if '#' < 0
376 case '#' + 256:
377#endif
378#if '$' < 0
379 case '$' + 256:
380#endif
381#if '%' < 0
382 case '%' + 256:
383#endif
384#if '&' < 0
385 case '&' + 256:
386#endif
387#if '\'' < 0
388 case '\'' + 256:
389#endif
390#if '(' < 0
391 case '(' + 256:
392#endif
393#if ')' < 0
394 case ')' + 256:
395#endif
396#if '*' < 0
397 case '*' + 256:
398#endif
399#if '+' < 0
400 case '+' + 256:
401#endif
402#if ',' < 0
403 case ',' + 256:
404#endif
405#if '-' < 0
406 case '-' + 256:
407#endif
408#if '.' < 0
409 case '.' + 256:
410#endif
411#if '/' < 0
412 case '/' + 256:
413#endif
414#if ':' < 0
415 case ':' + 256:
416#endif
417#if ';' < 0
418 case ';' + 256:
419#endif
420#if '<' < 0
421 case '<' + 256:
422#endif
423#if '=' < 0
424 case '=' + 256:
425#endif
426#if '>' < 0
427 case '>' + 256:
428#endif
429#if '?' < 0
430 case '?' + 256:
431#endif
432#if '@' < 0
433 case '@' + 256:
434#endif
435#if '[' < 0
436 case '[' + 256:
437#endif
438#if '\\' < 0
439 case '\\' + 256:
440#endif
441#if ']' < 0
442 case ']' + 256:
443#endif
444#if '^' < 0
445 case '^' + 256:
446#endif
447#if '_' < 0
448 case '_' + 256:
449#endif
450#if '`' < 0
451 case '`' + 256:
452#endif
453#if '{' < 0
454 case '{' + 256:
455#endif
456#if '|' < 0
457 case '|' + 256:
458#endif
459#if '}' < 0
460 case '}' + 256:
461#endif
462#if '~' < 0
463 case '~' + 256:
464#endif
465 return true; 253 return true;
466
467 default: 254 default:
468 return false; 255 return false;
469 } 256 }
@@ -489,107 +276,9 @@ c_isprint (int c)
489 case ' ': 276 case ' ':
490 _C_CTYPE_DIGIT: 277 _C_CTYPE_DIGIT:
491 _C_CTYPE_LOWER: 278 _C_CTYPE_LOWER:
279 _C_CTYPE_PUNCT:
492 _C_CTYPE_UPPER: 280 _C_CTYPE_UPPER:
493
494 _C_CTYPE_PUNCT_PLAIN:
495#if '!' < 0
496 case '!' + 256:
497#endif
498#if '"' < 0
499 case '"' + 256:
500#endif
501#if '#' < 0
502 case '#' + 256:
503#endif
504#if '$' < 0
505 case '$' + 256:
506#endif
507#if '%' < 0
508 case '%' + 256:
509#endif
510#if '&' < 0
511 case '&' + 256:
512#endif
513#if '\'' < 0
514 case '\'' + 256:
515#endif
516#if '(' < 0
517 case '(' + 256:
518#endif
519#if ')' < 0
520 case ')' + 256:
521#endif
522#if '*' < 0
523 case '*' + 256:
524#endif
525#if '+' < 0
526 case '+' + 256:
527#endif
528#if ',' < 0
529 case ',' + 256:
530#endif
531#if '-' < 0
532 case '-' + 256:
533#endif
534#if '.' < 0
535 case '.' + 256:
536#endif
537#if '/' < 0
538 case '/' + 256:
539#endif
540#if ':' < 0
541 case ':' + 256:
542#endif
543#if ';' < 0
544 case ';' + 256:
545#endif
546#if '<' < 0
547 case '<' + 256:
548#endif
549#if '=' < 0
550 case '=' + 256:
551#endif
552#if '>' < 0
553 case '>' + 256:
554#endif
555#if '?' < 0
556 case '?' + 256:
557#endif
558#if '@' < 0
559 case '@' + 256:
560#endif
561#if '[' < 0
562 case '[' + 256:
563#endif
564#if '\\' < 0
565 case '\\' + 256:
566#endif
567#if ']' < 0
568 case ']' + 256:
569#endif
570#if '^' < 0
571 case '^' + 256:
572#endif
573#if '_' < 0
574 case '_' + 256:
575#endif
576#if '`' < 0
577 case '`' + 256:
578#endif
579#if '{' < 0
580 case '{' + 256:
581#endif
582#if '|' < 0
583 case '|' + 256:
584#endif
585#if '}' < 0
586 case '}' + 256:
587#endif
588#if '~' < 0
589 case '~' + 256:
590#endif
591 return true; 281 return true;
592
593 default: 282 default:
594 return false; 283 return false;
595 } 284 }
@@ -600,105 +289,8 @@ c_ispunct (int c)
600{ 289{
601 switch (c) 290 switch (c)
602 { 291 {
603 _C_CTYPE_PUNCT_PLAIN: 292 _C_CTYPE_PUNCT:
604#if '!' < 0
605 case '!' + 256:
606#endif
607#if '"' < 0
608 case '"' + 256:
609#endif
610#if '#' < 0
611 case '#' + 256:
612#endif
613#if '$' < 0
614 case '$' + 256:
615#endif
616#if '%' < 0
617 case '%' + 256:
618#endif
619#if '&' < 0
620 case '&' + 256:
621#endif
622#if '\'' < 0
623 case '\'' + 256:
624#endif
625#if '(' < 0
626 case '(' + 256:
627#endif
628#if ')' < 0
629 case ')' + 256:
630#endif
631#if '*' < 0
632 case '*' + 256:
633#endif
634#if '+' < 0
635 case '+' + 256:
636#endif
637#if ',' < 0
638 case ',' + 256:
639#endif
640#if '-' < 0
641 case '-' + 256:
642#endif
643#if '.' < 0
644 case '.' + 256:
645#endif
646#if '/' < 0
647 case '/' + 256:
648#endif
649#if ':' < 0
650 case ':' + 256:
651#endif
652#if ';' < 0
653 case ';' + 256:
654#endif
655#if '<' < 0
656 case '<' + 256:
657#endif
658#if '=' < 0
659 case '=' + 256:
660#endif
661#if '>' < 0
662 case '>' + 256:
663#endif
664#if '?' < 0
665 case '?' + 256:
666#endif
667#if '@' < 0
668 case '@' + 256:
669#endif
670#if '[' < 0
671 case '[' + 256:
672#endif
673#if '\\' < 0
674 case '\\' + 256:
675#endif
676#if ']' < 0
677 case ']' + 256:
678#endif
679#if '^' < 0
680 case '^' + 256:
681#endif
682#if '_' < 0
683 case '_' + 256:
684#endif
685#if '`' < 0
686 case '`' + 256:
687#endif
688#if '{' < 0
689 case '{' + 256:
690#endif
691#if '|' < 0
692 case '|' + 256:
693#endif
694#if '}' < 0
695 case '}' + 256:
696#endif
697#if '~' < 0
698 case '~' + 256:
699#endif
700 return true; 293 return true;
701
702 default: 294 default:
703 return false; 295 return false;
704 } 296 }
@@ -736,7 +328,6 @@ c_isxdigit (int c)
736 _C_CTYPE_DIGIT: 328 _C_CTYPE_DIGIT:
737 _C_CTYPE_A_THRU_F: 329 _C_CTYPE_A_THRU_F:
738 return true; 330 return true;
739
740 default: 331 default:
741 return false; 332 return false;
742 } 333 }
@@ -747,14 +338,8 @@ c_tolower (int c)
747{ 338{
748 switch (c) 339 switch (c)
749 { 340 {
750 _C_CTYPE_UPPER_N (0): 341 _C_CTYPE_UPPER:
751#if _C_CTYPE_SIGNED_EBCDIC
752 c += 256;
753 /* Fall through. */
754 _C_CTYPE_UPPER_N (256):
755#endif
756 return c - 'A' + 'a'; 342 return c - 'A' + 'a';
757
758 default: 343 default:
759 return c; 344 return c;
760 } 345 }
@@ -765,14 +350,8 @@ c_toupper (int c)
765{ 350{
766 switch (c) 351 switch (c)
767 { 352 {
768 _C_CTYPE_LOWER_N (0): 353 _C_CTYPE_LOWER:
769#if _C_CTYPE_SIGNED_EBCDIC
770 c += 256;
771 /* Fall through. */
772 _C_CTYPE_LOWER_N (256):
773#endif
774 return c - 'a' + 'A'; 354 return c - 'a' + 'A';
775
776 default: 355 default:
777 return c; 356 return c;
778 } 357 }
diff --git a/lib/u64.c b/lib/u64.c
index 04cf7a29946..1e3854ddcd7 100644
--- a/lib/u64.c
+++ b/lib/u64.c
@@ -1,3 +1,4 @@
1#include <config.h> 1#include <config.h>
2#define _GL_U64_INLINE _GL_EXTERN_INLINE 2#define _GL_U64_INLINE _GL_EXTERN_INLINE
3#include "u64.h" 3#include "u64.h"
4typedef int dummy;
diff --git a/lib/unistd.c b/lib/unistd.c
index 6c6a8e268c0..72bad1c0527 100644
--- a/lib/unistd.c
+++ b/lib/unistd.c
@@ -1,3 +1,4 @@
1#include <config.h> 1#include <config.h>
2#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE 2#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
3#include "unistd.h" 3#include "unistd.h"
4typedef int dummy;