]> git.sur5r.net Git - u-boot/blob - cpu/blackfin/bootrom-asm-offsets.awk
powerpc: Fix bootm to boot up again with a Ramdisk
[u-boot] / cpu / blackfin / bootrom-asm-offsets.awk
1 #!/usr/bin/gawk -f
2 BEGIN {
3         print "/* DO NOT EDIT: AUTOMATICALLY GENERATED"
4         print " * Input files: bootrom-asm-offsets.awk bootrom-asm-offsets.c.in"
5         print " * DO NOT EDIT: AUTOMATICALLY GENERATED"
6         print " */"
7         print ""
8         system("cat bootrom-asm-offsets.c.in")
9         print "{"
10 }
11
12 {
13         /* find a structure definition */
14         if ($0 ~ /typedef struct .* {/) {
15                 delete members;
16                 i = 0;
17
18                 /* extract each member of the structure */
19                 while (1) {
20                         getline
21                         if ($1 == "}")
22                                 break;
23                         gsub(/[*;]/, "");
24                         members[i++] = $NF;
25                 }
26
27                 /* grab the structure's name */
28                 struct = $NF;
29                 sub(/;$/, "", struct);
30
31                 /* output the DEFINE() macros */
32                 while (i-- > 0)
33                         print "\tDEFINE(" struct ", " members[i] ");"
34                 print ""
35         }
36 }
37
38 END {
39         print "\treturn 0;"
40         print "}"
41 }