[FEATURE] add tizen network socket probes
[platform/core/system/swap-probe.git] / scripts / gen_api_id_mapping_header.awk
index 4749442..315a302 100644 (file)
@@ -1,25 +1,38 @@
 # This script generates api_id_mapping header from api list
 
 BEGIN {
-       print "/* AUTO GENERATED */"
+       print "/*"
+       print " * this file genereted by <swap-probe> project with cmd <make headers>"
+       print " */"
+       print
        print "#ifndef __API_ID_MAP__"
        print "#define __API_ID_MAP__"
        print
-    api_id = 1
-    macro_prefix = "API_ID_"
-} {
-    if ( $0 == "" ) {
+       print "#ifdef __cplusplus"
+       print "extern \"C\"{"
+       print "#endif"
        print
-    } else {
-       orig = $0
-       def = orig
-       gsub(/[,:()*&~\[\] ]/, "_", def)
-       def = macro_prefix def
-       printf "#define %-135s %d // %s\n", def, api_id, orig
-       api_id = api_id + 1
-    }
+       api_id = 1
+       macro_prefix = "API_ID_"
+} {
+       if ( $0 == "" ) {
+               print
+       } else {
+               orig = $0
+               def = orig
+               split(def, splited, "###")
+               def = splited[1]
+               gsub(/[,:()*&~\[\] ]/, "_", def)
+               def = macro_prefix def
+               printf "#define %-135s %d // %s\n", def, api_id, orig
+               api_id = api_id + 1
+       }
 }
 END {
        print
+       print "#ifdef __cplusplus"
+       print "}"
+       print "#endif"
+       print
        print "#endif /* __API_ID_MAP__ */"
 }