gen-bits.sh (1031B)
1 #!/bin/sh -e 2 3 sysdeps="$1" 4 bits="$2" 5 dfmt="$3" 6 ofmt="$4" 7 xfmt="$5" 8 bfmt="$6" 9 10 gen_bits() { 11 sed -e "s/@BITS@/$1/g; s/@DFMT@/$2/g; s/@OFMT@/$3/g; s/@XFMT@/$4/g; s/@BFMT@/$5/g;" < src/headers/bits-template 12 } 13 14 tools/gen-types-internal.sh "" "" "$bits" < src/headers/bits-header 15 16 if test "$bits" = 64 ; then 17 cat src/headers/uint64-defs 18 if grep -qF 'uint64t: no' "$sysdeps" ; then 19 if grep -qF 'sizeofulong: 8' "$sysdeps" ; then 20 cat src/headers/uint64-ulong64 21 else 22 cat src/headers/uint64-noulong64 23 fi 24 cat src/headers/uint64-macros 25 fi 26 else 27 cat src/headers/uint64-include 28 fi 29 30 if grep -qF 'endianness: little' < "$sysdeps" ; then 31 endian=l 32 elif grep -qF 'endianness: big' < "$sysdeps" ; then 33 endian=b 34 else 35 echo 'Error ! Unsupported endianness' 1>&2 36 ./crash 37 fi 38 39 cat "src/headers/uint${bits}-bswap" 40 tools/gen-types-internal.sh "" "" "$bits" < src/headers/bits-${endian}endian 41 gen_bits "$bits" "$dfmt" "$ofmt" "$xfmt" "$bfmt" 42 exec tools/gen-types-internal.sh "" "" "$bits" < src/headers/bits-footer