Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

handling multiple related prefix commands

Help
r corak
2006-11-01
2013-05-23
  • r corak
    r corak
    2006-11-01

    Let's say we have 3 prefix commands, H a single command, J a single command, and KK-KK block command.  Actually, whether KK-KK is block or not seems not to matter to me.  But then again, maybe it's important.  You tell me.

    These commands interact.  In order to complete all processing, all command instances must be known and processed.  Documentation doesn't really say the order that these are presented to their processing macros.

    The commands may be in any order.  Let's assume here that the commands are entered this way:
    ..KK line 1
    ...H line 2
    ..KK line 3
    ...J line 4

    KK processing would need to be aware when the starting KK on line 1 is paired with another KK, this time on line 3.  If H sees a paired KK-KK, it can operate on the block.  If H and J are entered, H can operate on J.  But order matters, so H would operate on KK-KK because the range is earlier than J, but if the pair KK is unfinished (if the KK on line 3 is not yet entered) then H can operate on J because the single command J is, by definition, complete.  Or, if H and J are defined differently, one or the other, whichever is first, would operate on the range KK-KK.

    3 commands are mentioned here, but the universe of interrelated commands is unbounded.  A general approach would be appreciated.

    In this complex processing, 4 commands are executed.  PREFIX KK SET 1 knows that it is incomplete, so does nothing.  But its macro can't just return because KK-1 would then be done and KK-3 wouldn't know its starting partner.  So, must KK-1 re-issue a SET PENDING?  Is this where BLOCK would be helpful?

    H can check for pendings, see KK-KK pair, and operate on them.  SET PENDING off for all 3 commands.  But then KK-3 comes along.  Its starter KK-1 has been SET PENDING OFF, but it can't know that.  It can't leave line 3 SET PENDING KK, because that KK has already been handled. 

    So, how does one write macros to know about each other, to know when to actually accomplish the requested tasks?

    In this scenario, should everybody just keep the PENDINGs around until a full set has been realized, then do something?  By that I mean, KK-1 does nothing, H-2 does nothing, KK-3 sees both the KK-KK pair and H, so does what has been called for and SET PENDING OFF for the 3 lines?  If KK-3 weren't entered yet, J might see some complete set and act accordingly.

    If the sequence of commands were different, say
    ..KK line 1
    ..KK line 2
    ...H line 3
    then H would be the one to kick off real processing?

    Any other suggestions?