3 #-------------------------------------------------------------------------------
4 # Determine the byte-ordering scheme used by the local machine.
6 cat > endiantest.c
<< ENDIANTEST
9 fill((char *)&x, sizeof(x)); \
10 for (i=1; i<=sizeof(x); i++) { \
11 c=((x>>(byte_size*(sizeof(x)-i)))&mask); \
12 putchar(c==0 ? '?' : (char)c); \
16 void fill(p, size) char *p; int size; {
17 char *ab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
20 for (i=0; i<size; i++) p[i]= ab[i];
23 void endian(byte_size) int byte_size; {
25 unsigned int mask, i, c;
28 for (i=1; i<=(unsigned)byte_size; i++) mask= (mask<<1)|1;
33 /* Properties of type char */
38 do { c<<=1; byte_size++; } while(c!=0);
52 $CC -o endiantest endiantest.c
54 if [ `./endiantest | cut -c1` = "A" ]
58 byte_order
=LITTLE_ENDIAN
61 rm -f endiantest.c endiantest
64 #-------------------------------------------------------------------------------
65 # Preprocess any Fortran *.F files into corresponding *.f files.
75 $CPP -D$byte_order $i $bnf
78 #-------------------------------------------------------------------------------