# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


from base import *
from bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os
                end = path[-1]
                if isinstance(end, basestring):
                    assert getattr(src, end) == 'forward ref'
                    setattr(src, end, dest)
                elif isinstance(end, int):
                    assert src[end] == 'forward ref'
                    src[end] = dest
                else:
                    assert False, 'Bad path end'
        return module
    state = DeserialState(f, module, deps, 0, 0, ownMap, forwardRefs)
    in_env(Deserialize, state, go)
    f.close()

    assert state.index == meta.count, "Inconsistent atom count"

    # indices off by 1
    flatIndex = [ownMap[i+1] for i in xrange(len(ownMap))]
    add_extrinsic(ModIndex, module, flatIndex)
    return module

def deserialize(digest):
    if digest in LOADED_MODULES:
        return LOADED_MODULES[digest]

    module = _read_module('mods/%s' % (digest,))

    add_extrinsic(ModDigest, module, digest)
    LOADED_MODULES[digest] = module


# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


# Path: deserialize.py
from base import *
from bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os

                end = path[-1]
                if isinstance(end, basestring):
                    assert getattr(src, end) == 'forward ref'
                    setattr(src, end, dest)
                elif isinstance(end, int):
                    assert src[end] == 'forward ref'
                    src[end] = dest
                else:
                    assert False, 'Bad path end'
        return module
    state = DeserialState(f, module, deps, 0, 0, ownMap, forwardRefs)
    in_env(Deserialize, state, go)
    f.close()

    assert state.index == meta.count, "Inconsistent atom count"

    # indices off by 1
    flatIndex = [ownMap[i+1] for i in xrange(len(ownMap))]
    add_extrinsic(ModIndex, module, flatIndex)
    return module

def deserialize(digest):
    if digest in LOADED_MODULES:
        return LOADED_MODULES[digest]

    module = _read_module('mods/%s' % (digest,))

    add_extrinsic(ModDigest, module, digest)
    LOADED_MODULES[digest] = module


    if DIGEST_INDEX[digest] == 'forms':