[ambctl] removed build realic that should never have been added
[profile/ivi/automotive-message-broker.git] / tools / generate_api.py
1 # Copyright (c) 2013 Intel Corporation. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import sys
6
7 TEMPLATE = """\
8 extern const char %s[];
9 const char %s[] = { %s, 0 };
10 """
11
12 js_code = sys.argv[1]
13 lines = file(js_code).read()
14 c_code = ', '.join(str(ord(c)) for c in lines)
15
16 symbol_name = sys.argv[2]
17 output = open(sys.argv[3], "w")
18 output.write(TEMPLATE % (symbol_name, symbol_name, c_code))
19 output.close()