tizen 2.3 release
[framework/system/swap-probe.git] / scripts / gen_api_id_mapping_header_list.awk
1 # This script generates api_id decode list header from api list
2 #
3 # use:
4 # cat api_names.txt | awk -f ./gen_api_id_mapping_header_list.awk > sample.h
5 # where api_names.txt is function name list file
6
7 BEGIN {
8         api_id = 1
9         print "/*"
10         print " * this file genereted by <swap-probe> project with cmd <make headers>"
11         print " */"
12         print
13         print "#ifdef __cplusplus"
14         print "extern \"C\"{"
15         print "#endif"
16         print
17         print "const char *api_id_list[] = {"
18 } {
19         if ( $0 == "" ) {
20                 print
21         } else {
22                 orig = $0
23                 def = orig
24                 split(def, splited, "###")
25                 if (splited[2] != ""){
26                         def = splited[2]
27                 }
28                 def = def "\","
29                 printf "\"%-135s//%d %s\n", def, api_id, orig
30                 api_id = api_id + 1
31         }
32 }
33
34 END {
35         print
36         print "#ifdef __cplusplus"
37         print "}"
38         print "#endif"
39         print
40         print "};"
41 }