def makeDocStructures(context):
    """
    makeDocStructures(context) -> namespaces, subdirs

    Creates two structures that provide a friendly format for
    documentation.

    *namespaces* is a dictionary that maps namespaces to a directives
    dictionary with the key being the name of the directive and the
    value is a tuple: (schema, handler, info).

    *subdirs* maps a (namespace, name) pair to a list of subdirectives
    that have the form (namespace, name, schema, info).
    """
    namespaces = {}
    subdirs = {}
    registry = context._docRegistry
    for (namespace, name), schema, usedIn, handler, info, parent in registry:
        if not parent:
            ns_entry = namespaces.setdefault(namespace, {})
            ns_entry[name] = schema, handler, info
        else:
            sd_entry = subdirs.setdefault((parent.namespace, parent.name), [])
            sd_entry.append((namespace, name, schema, handler, info))
    return namespaces, subdirs
