Updated to fedora-glibc-20050211T1037
[glibc.git] / scripts / gen-as-const.awk
bloba315066422374cb86c8113fbc9db727f0a331a32
1 # Script used in producing headers of assembly constants from C expressions.
2 # The input to this script looks like:
3 # #cpp-directive ...
4 # NAME1
5 # NAME2 expression ...
6 # The output of this script is C code to be run through gcc -S and then
7 # massaged to extract the integer constant values of the given C expressions.
8 # A line giving just a name implies an expression consisting of just that name.
10 BEGIN { started = 0 }
12 # cpp directives go straight through.
13 /^#/ { print; next }
15 NF >= 1 && !started {
16 print "void dummy(void) {";
17 started = 1;
20 # Separator.
21 $1 == "--" { next }
23 NF == 1 { sub(/^.*$/, "& &"); }
25 NF > 1 {
26 name = $1;
27 sub(/^[^ ]+[ ]+/, "");
28 printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
29 name, $0;
32 END { if (started) print "}" }