All pastes #354080 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-13 19:31 UTC
rendered paste body
-- replacement plus thingy for use in pairs.reset
PROC invertplus(CHAN INT in.0?, in.1?, reset?, out!)
  WHILE TRUE
    BOOL a:
    SEQ
      a := FALSE
      INT tmp:
      -- this doesn't work presumably due to some sort of issue with scope
      -- my brain only of course working in java
      PRI ALT
        reset ? tmp
          IF
            a = TRUE
              a := FALSE
            a = FALSE
              a := TRUE
        SKIP
          IF
            a = FALSE
              INT int.0, int.1:
              SEQ
                PAR
                  in.0 ? int.0
                  in.1 ? int.1
                out ! int.0 + int.1
            a = TRUE
              INT int.0, int.1:
              SEQ
                PAR
                  in.0 ? int.0
                  in.1 ? int.1
                out ! int.0 - int.1
: