Ejemplo n.º 1
0
def get_info(StateIndexList):
    """
    NOTE: At least a 'dummy' state router is always equired so that 'goto
    QUEX_STATE_ROUTER;' does not reference a non-existing label. Then, we
    return an empty text array.

    <fschaef9/13y10m15d: "Still true with current dial_db implementation?">
    """
    if len(StateIndexList) == 0: return []

    # Make sure, that for every state the 'drop-out' state is also mentioned
    result = [None] * len(StateIndexList)
    for i, index in enumerate(StateIndexList):
        assert type(index) != str
        if index >= 0:
            # Transition to state entry
            label      = dial_db.get_label_by_address(index)
        else:
            assert False, "Is this still an issue?"
            # Transition to a templates 'drop-out'
            door_id    = DoorID.drop_out(- index)
            label      = dial_db.get_label_by_door_id(door_id)

        result[i] = (index, "goto %s; " % label)
        dial_db.mark_label_as_gotoed(label)

    return result
Ejemplo n.º 2
0
def get_info(StateIndexList):
    """
    NOTE: At least a 'dummy' state router is always equired so that 'goto
    QUEX_STATE_ROUTER;' does not reference a non-existing label. Then, we
    return an empty text array.

    <fschaef9/13y10m15d: "Still true with current dial_db implementation?">
    """
    if len(StateIndexList) == 0: return []

    # Make sure, that for every state the 'drop-out' state is also mentioned
    result = [None] * len(StateIndexList)
    for i, index in enumerate(StateIndexList):
        assert type(index) != str
        if index >= 0:
            # Transition to state entry
            label = dial_db.get_label_by_address(index)
        else:
            assert False, "Is this still an issue?"
            # Transition to a templates 'drop-out'
            door_id = DoorID.drop_out(-index)
            label = dial_db.get_label_by_door_id(door_id)

        result[i] = (index, "goto %s; " % label)
        dial_db.mark_label_as_gotoed(label)

    return result
Ejemplo n.º 3
0
def do_state_router():
    routed_address_set = dial_db.routed_address_set()
    # If there is only one address subject to state routing, then the
    # state router needs to be implemented.
    #if len(routed_address_set) == 0:
    #    return []

    # Add the address of 'terminal_end_of_file()' if it is not there, already.
    # (It should not be there, if we are working on a fixed chunk, as in 'counting'.
    #  When counting is webbed into analysis:: assert address_eof in routed_address_set)
    if False:
        address_eof        = dial_db.get_address_by_door_id(DoorID.incidence(E_IncidenceIDs.END_OF_STREAM)) 
        routed_address_set.add(address_eof)
        dial_db.mark_label_as_gotoed(dial_db.get_label_by_address(address_eof))

    routed_state_info_list = state_router_generator.get_info(routed_address_set)
    return state_router_generator.do(routed_state_info_list) 
Ejemplo n.º 4
0
def do_state_router():
    routed_address_set = dial_db.routed_address_set()
    # If there is only one address subject to state routing, then the
    # state router needs to be implemented.
    #if len(routed_address_set) == 0:
    #    return []

    # Add the address of 'terminal_end_of_file()' if it is not there, already.
    # (It should not be there, if we are working on a fixed chunk, as in 'counting'.
    #  When counting is webbed into analysis:: assert address_eof in routed_address_set)
    if False:
        address_eof = dial_db.get_address_by_door_id(
            DoorID.incidence(E_IncidenceIDs.END_OF_STREAM))
        routed_address_set.add(address_eof)
        dial_db.mark_label_as_gotoed(dial_db.get_label_by_address(address_eof))

    routed_state_info_list = state_router_generator.get_info(
        routed_address_set)
    return state_router_generator.do(routed_state_info_list)
Ejemplo n.º 5
0
 def GOTO_ADDRESS(self, Address):
     return "goto %s;" % dial_db.get_label_by_address(Address, GotoedF=True)
Ejemplo n.º 6
0
 def GOTO_ADDRESS(self, Address):
     return "goto %s;" % dial_db.get_label_by_address(Address, GotoedF=True)