The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kern/genassym.sh

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 # $FreeBSD$
    3 
    4 # Grrr, this should use stdin and stdout, but is encrufted for compatibility.
    5 
    6 usage()
    7 {
    8         echo "usage: genassym [-o outfile] objfile"
    9         exit 1
   10 }
   11 
   12 outfile=/dev/stdout
   13 while getopts "o:" option
   14 do
   15         case "$option" in
   16         o)      outfile="$OPTARG";;
   17         *)      usage;;
   18         esac
   19 done
   20 shift $(($OPTIND - 1))
   21 case $# in
   22 1)      ;;
   23 *)      usage;;
   24 esac
   25 
   26 ${NM:='nm'} "$1" | ${AWK:='awk'} '
   27 / C .*sign$/ {
   28         sign = substr($1, length($1) - 3, 4)
   29         sub("^0*", "", sign)
   30         if (sign != "")
   31                 sign = "-"
   32 }
   33 / C .*w0$/ {
   34         w0 = substr($1, length($1) - 3, 4)
   35 }
   36 / C .*w1$/ {
   37         w1 = substr($1, length($1) - 3, 4)
   38 }
   39 / C .*w2$/ {
   40         w2 = substr($1, length($1) - 3, 4)
   41 }
   42 / C .*w3$/ {
   43         w3 = substr($1, length($1) - 3, 4)
   44         w = w3 w2 w1 w0
   45         sub("^0*", "", w)
   46         if (w == "")
   47                 w = "0"
   48         sub("w3$", "", $3)
   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)
   53 }
   54 ' 3>"$outfile" >&3 3>&-

Cache object: e93304f3f199a0efb533079bf205e18c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.