diff options
Diffstat (limited to 'xwalk/generate_api.py')
-rwxr-xr-x | xwalk/generate_api.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xwalk/generate_api.py b/xwalk/generate_api.py new file mode 100755 index 00000000..cef97b7a --- /dev/null +++ b/xwalk/generate_api.py @@ -0,0 +1,19 @@ +# Copyright (c) 2013 Intel Corporation. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +TEMPLATE = """\ +extern const char %s[]; +const char %s[] = { %s, 0 }; +""" + +js_code = sys.argv[1] +lines = file(js_code).read() +c_code = ', '.join(str(ord(c)) for c in lines) + +symbol_name = sys.argv[2] +output = open(sys.argv[3], "w") +output.write(TEMPLATE % (symbol_name, symbol_name, c_code)) +output.close() |