2 # $FreeBSD: src/sys/kern/genassym.sh,v 1.1.2.1 2000/07/07 01:36:35 obrien Exp $
4 # Grrr, this should use stdin and stdout, but is encrufted for compatibility.
7 echo "usage: genassym [-o outfile] objfile"
12 while getopts "o:" option
15 o) outfile="$OPTARG";;
19 shift $(($OPTIND - 1))
27 sign = substr($1, length($1) - 3, 4)
33 w0 = substr($1, length($1) - 3, 4)
36 w1 = substr($1, length($1) - 3, 4)
39 w2 = substr($1, length($1) - 3, 4)
42 w3 = substr($1, length($1) - 3, 4)
48 # This still has minor problems representing INT_MIN, etc. E.g.,
49 # with 32-bit 2''s complement ints, this prints -0x80000000, which
50 # has the wrong type (unsigned int).
51 printf("#define\t%s\t%s0x%s\n", $3, sign, w)
53 ' 3>"$outfile" >&3 3>&-