Exemple #1
0
def project(projector, node_):
    scope = get_scope(node_)
    gblock = get_block_child(node_)
    block = projector.visit(gblock)
    throw = None  # localthrow  # FIXME: need destination roles
    catches = []  # [localcatch]

    #RoleCollector() # Couldn't import conveniently (cyclic)
    involved = projector.rc.collect_roles(gblock)
    for i in get_interrupt_children(node_):
        subj = globalinterrupt_get_role(i)  # String
        involved.add(subj)

    throw_messages = []
    for i in get_interrupt_children(node_):
        subj = globalinterrupt_get_role(i)  # String
        roles = list(involved - set([subj]))
        messages = []
        for sig in globalinterrupt_get_message_children(i):
            # Factor out with interrupt, message transfer, argument, etc.
            if util.get_node_type(sig) == \
                   constants.MESSAGE_SIGNATURE_NODE_TYPE:
                messages.append(messagesignature_pretty_print(sig))
            else:
                messages.append(parameter_pretty_print(sig))
        if projector.role == subj and len(roles) > 0:
            #throws.append(projector.nf.localthrow(dests, messages))
            #new_roles = util.replace_in_list(roles, projector.rolemap)
            new_roles = roles
            """throw = projector.nf.localthrow(#projector.rolemap[projector.role],
                                            projector.role,
                                            new_roles,
                                            messages)"""
            throw_messages.extend(messages)
        else:
            catches.append(
                projector.nf.localcatch(
                    #projector.rolemap[projector.role],
                    projector.role,
                    #projector.rolemap[subj],
                    subj,
                    messages))
    if throw_messages:
        throw = projector.nf.localthrow(projector.role, new_roles,
                                        throw_messages)
    if (not block.is_empty()) or throw:
        # Section 5.3.5 -- if R is involved in the interruptible (if it is
        # involved in the block or is a thrower)
        return projector.nf.localinterruptible(
            #projector.rolemap[projector.role], scope, block, throw, catches)
            projector.role,
            scope,
            block,
            throw,
            catches)
    else:
        return None
def project(projector, node_):
    scope = get_scope(node_)
    gblock = get_block_child(node_)
    block = projector.visit(gblock)
    throw = None  # localthrow  # FIXME: need destination roles
    catches = []  # [localcatch]

    #RoleCollector() # Couldn't import conveniently (cyclic)
    involved = projector.rc.collect_roles(gblock)
    for i in get_interrupt_children(node_):
        subj = globalinterrupt_get_role(i)  # String
        involved.add(subj)
    
    throw_messages = []
    for i in get_interrupt_children(node_):
        subj = globalinterrupt_get_role(i)  # String
        roles = list(involved - set([subj]))
        messages = []
        for sig in globalinterrupt_get_message_children(i): 
            # Factor out with interrupt, message transfer, argument, etc.
            if util.get_node_type(sig) == \
                   constants.MESSAGE_SIGNATURE_NODE_TYPE:
                messages.append(messagesignature_pretty_print(sig))
            else:
                messages.append(parameter_pretty_print(sig))
        if projector.role == subj and len(roles) > 0:
            #throws.append(projector.nf.localthrow(dests, messages)) 
            #new_roles = util.replace_in_list(roles, projector.rolemap)
            new_roles = roles
            """throw = projector.nf.localthrow(#projector.rolemap[projector.role],
                                            projector.role,
                                            new_roles,
                                            messages)"""
            throw_messages.extend(messages)
        else:
            catches.append(projector.nf.localcatch(
                               #projector.rolemap[projector.role],
                               projector.role,
                               #projector.rolemap[subj],
                               subj,
                               messages))
    if throw_messages:
        throw = projector.nf.localthrow(projector.role,
                                        new_roles,
                                        throw_messages)
    if (not block.is_empty()) or throw:
        # Section 5.3.5 -- if R is involved in the interruptible (if it is
        # involved in the block or is a thrower)
        return projector.nf.localinterruptible(
                   #projector.rolemap[projector.role], scope, block, throw, catches)
                   projector.role, scope, block, throw, catches)
    else:
        return None
Exemple #3
0
def check_wellformedness_visit(checker, node_):
    visited = context_visitor_visit(checker, node_)
    interrupts = get_interrupt_children(visited)
    seen = []
    for i in interrupts:
        globalinterrupt_check_wellformedness(checker, i)
        subj = globalinterrupt_get_role(i)
        # Section 4.6.9 -- distinct interrupt roles (bound role checked inside
        # globalinterrupt)
        #if subj in seen:
        #    util.report_error("Bad interrupt role: " + subj)
        seen.append(subj)
    return visited
def check_wellformedness_visit(checker, node_):
    visited = context_visitor_visit(checker, node_)
    interrupts = get_interrupt_children(visited)
    seen = []
    for i in interrupts:
        globalinterrupt_check_wellformedness(checker, i)
        subj = globalinterrupt_get_role(i)
        # Section 4.6.9 -- distinct interrupt roles (bound role checked inside
        # globalinterrupt)
        #if subj in seen:
        #    util.report_error("Bad interrupt role: " + subj)
        seen.append(subj)
    return visited
 def _visit_globalinterrupt(self, node_):
     self.roles.add(globalinterrupt_get_role(node_))
     return node_
 def _visit_globalinterrupt(self, node_):
     self.roles.add(globalinterrupt_get_role(node_))
     return node_