2 # $FreeBSD: src/sys/kern/genassym.sh,v 1.1.2.1 2000/07/07 01:36:35 obrien Exp $
3 # $DragonFly: src/sys/kern/genassym.sh,v 1.2 2003/06/17 04:28:41 dillon Exp $
5 # Grrr, this should use stdin and stdout, but is encrufted for compatibility.
8 echo "usage: genassym [-o outfile] objfile"
13 while getopts "o:" option
16 o
) outfile
="$OPTARG";;
20 shift $
(($OPTIND - 1))
28 sign = substr($1, length($1) - 3, 4)
34 w0 = substr($1, length($1) - 3, 4)
37 w1 = substr($1, length($1) - 3, 4)
40 w2 = substr($1, length($1) - 3, 4)
43 w3 = substr($1, length($1) - 3, 4)
49 # This still has minor problems representing INT_MIN, etc. E.g.,
50 # with 32-bit 2''s complement ints, this prints -0x80000000, which
51 # has the wrong type (unsigned int).
52 printf("#define\t%s\t%s0x%s\n", $3, sign, w)
54 ' 3>"$outfile" >&3 3>&-