1 ?RCS: $Id: charsize.U,v 3.0.1.1 1994/10/29 16:07:13 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: charsize.U,v $
12 ?RCS: Revision 3.0.1.1 1994/10/29 16:07:13 ram
13 ?RCS: patch36: added ?F: line for metalint file checking
15 ?RCS: Revision 3.0 1993/08/18 12:05:34 ram
16 ?RCS: Baseline for dist 3.0 netwide release.
18 ?MAKE:charsize charbits: cat rm_try Myread Compile run i_stdlib
19 ?MAKE: -pick add $@ %<
21 ?S: This variable contains the value of the CHARSIZE symbol, which
22 ?S: indicates to the C program how many bytes there are in a character.
25 ?S: This variable contains the value of the CHARBITS symbol, which
26 ?S: indicates to the C program how many bits there are in a character.
29 ?C: This symbol contains the size of a char, so that the C preprocessor
30 ?C: can make decisions based on it.
33 ?C: This symbol contains the size of a char, so that the C preprocessor
34 ?C: can make decisions based on it.
36 ?H:#define CHARSIZE $charsize /**/
37 ?H:#define CHARBITS $charbits /**/
40 : check for length of character
44 echo "Checking to see how big your characters are (hey, you never know)..." >&4
53 printf("%d\n", (int)sizeof(char));
58 if eval $compile_ok; then
62 echo "(I can't seem to compile the test program. Guessing...)"
69 rp="What is the size of a character (in bytes)?"
74 : Check for the number of bits in a character
76 '') echo "Checking how long a character is (in bits)..." >&4
83 for (c = 1, n = 0; c; c <<= 1, n++) ;
89 if eval $compile_ok; then
93 echo "(I can't seem to compile the test program. Guessing...)"
100 rp="What is the length of a character (in bits)?"
107 Your system has an unsigned character size of $charbits bits, which
108 is rather unusual (normally it is 8 bits). Perl likely will not work
109 correctly on your system, with subtle bugs in various places.
111 rp='Do you really want to continue?'
115 [yY]) echo >&4 "Okay, continuing." ;;