diff options
author | Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com> | 2015-02-14 22:53:34 +0300 |
---|---|---|
committer | Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com> | 2015-03-25 22:12:18 +0300 |
commit | 2db758c562b4e480acc2d1a654e2c471a653a039 (patch) | |
tree | d220a3b9b05d1682dcd1fecfd446ed69c5a599b8 /tools/js2c.py | |
parent | 45814216ee29b8d6c5faa00c6d27b721f628a1ea (diff) | |
download | android-node-v8-2db758c562b4e480acc2d1a654e2c471a653a039.tar.gz android-node-v8-2db758c562b4e480acc2d1a654e2c471a653a039.tar.bz2 android-node-v8-2db758c562b4e480acc2d1a654e2c471a653a039.zip |
iojs: introduce internal modules
Internal modules can be used to share private code between
public modules without risk to expose private APIs to the
user.
PR-URL: https://github.com/iojs/io.js/pull/848
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'tools/js2c.py')
-rwxr-xr-x | tools/js2c.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tools/js2c.py b/tools/js2c.py index bbbccb289a..cc2c3045d0 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -238,11 +238,11 @@ static const struct _native natives[] = { NATIVE_DECLARATION = """\ - { "%(id)s", %(id)s_native, sizeof(%(id)s_native)-1 }, + { "%(id)s", %(escaped_id)s_native, sizeof(%(escaped_id)s_native)-1 }, """ SOURCE_DECLARATION = """\ - const char %(id)s_native[] = { %(data)s }; + const char %(escaped_id)s_native[] = { %(data)s }; """ @@ -293,16 +293,29 @@ def JS2C(source, target): lines = ExpandMacros(lines, macros) lines = CompressScript(lines, do_jsmin) data = ToCArray(s, lines) - id = os.path.basename(str(s)).split('.')[0] + id = '/'.join(re.split('/|\\\\', s)[1:]).split('.')[0] if delay: id = id[:-6] if delay: delay_ids.append((id, len(lines))) else: ids.append((id, len(lines))) - source_lines.append(SOURCE_DECLARATION % { 'id': id, 'data': data }) - source_lines_empty.append(SOURCE_DECLARATION % { 'id': id, 'data': 0 }) - native_lines.append(NATIVE_DECLARATION % { 'id': id }) - + + escaped_id = id.replace('/', '$') + source_lines.append(SOURCE_DECLARATION % { + 'id': id, + 'escaped_id': escaped_id, + 'data': data + }) + source_lines_empty.append(SOURCE_DECLARATION % { + 'id': id, + 'escaped_id': escaped_id, + 'data': 0 + }) + native_lines.append(NATIVE_DECLARATION % { + 'id': id, + 'escaped_id': escaped_id + }) + # Build delay support functions get_index_cases = [ ] get_script_source_cases = [ ] |