Merge lit-unicode-*.inc.h-related generator scripts (#1767)
The `conversions` and `ranges` files had separate generators, which shared some functionality through a 3rd python module, and were quite similar to each other -- but also had some differences. Moreover, as they were separate scripts, nothing forced to keep the outputs in sync (to re-generate them at the same time from the same inputs). To fix these maintainability issues, this patch - merges the two python files and part of the 3rd utility module into a single script while keeping the existing functionality, - names the new file `gen-unicode.py` to align better with other generator script in `tools`, and - adds some extra documentation how to retrieve the input files (as they are not part of the repository). The refactoring affected the utility module as well, so this patch also - renames `c_source_helper.py` to `gen_c_source.py` (again, for naming consistency), - reorganizes some of its functions not to export module-local helper functions, and - adapts `js2c.py`, as it also uses this utility module. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+5
-3
@@ -20,7 +20,9 @@ import argparse
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import c_source_helper
|
||||
|
||||
from gen_c_source import LICENSE, format_code
|
||||
|
||||
|
||||
HEADER = '''#ifndef JERRY_TARGETJS_H
|
||||
#define JERRY_TARGETJS_H
|
||||
@@ -61,7 +63,7 @@ def js_to_native_code(path, name, build_type):
|
||||
if build_type != 'debug':
|
||||
code = reduce_code(code)
|
||||
|
||||
data = c_source_helper.format_code(code, 1, 2)
|
||||
data = format_code(code, 1, 2)
|
||||
|
||||
native_code = """const static char {0}_n[] = "{0}";
|
||||
const static char {0}_s[] =
|
||||
@@ -96,7 +98,7 @@ def main():
|
||||
|
||||
gen_line = "/* This file is generated by %s. Please do not modify. */" % os.path.basename(__file__)
|
||||
|
||||
gen_output = [c_source_helper.LICENSE, "", gen_line, "", HEADER]
|
||||
gen_output = [LICENSE, "", gen_line, "", HEADER]
|
||||
gen_structs = [NATIVE_STRUCT]
|
||||
|
||||
if script_args.main:
|
||||
|
||||
Reference in New Issue
Block a user