sync/gen_statemachine.ysl2
changeset 743 e4b613ebac2f
parent 711 d88dea0f5448
child 782 663f1d2c2f19
     1.1 --- a/sync/gen_statemachine.ysl2	Tue Jun 14 10:42:07 2016 +0200
     1.2 +++ b/sync/gen_statemachine.ysl2	Thu Jun 16 14:20:26 2016 +0200
     1.3 @@ -30,21 +30,21 @@
     1.4          // error values
     1.5  
     1.6          typedef enum _fsm_error {
     1.7 -            invalid_state = -1,
     1.8 -            invalid_event = -2
     1.9 +            invalid_state = -2,
    1.10 +            invalid_event = -3
    1.11          } fsm_error;
    1.12  
    1.13          // states
    1.14  
    1.15          typedef enum _«@name»_state {
    1.16 -            «@name»_state_NONE = 0,
    1.17 +            «@name»_state_NONE = -1,
    1.18          `` for "func:distinctName(state)" |> «@name»`if "position()!=last()" > , `
    1.19          } «@name»_state;
    1.20  
    1.21          // events
    1.22  
    1.23          typedef enum _«@name»_event {
    1.24 -            «@name»_event_NONE = 0,
    1.25 +            «@name»_event_NONE = -1,
    1.26          ||
    1.27          for "func:distinctName(state/event[not(not(/protocol/fsm/tag/@name=@name))])" {
    1.28              const "name", "@name";
    1.29 @@ -93,7 +93,7 @@
    1.30          #include "pEp_internal.h"
    1.31  
    1.32  
    1.33 -        PEP_STATUS fsm_«@name»_inject(
    1.34 +        DYNAMIC_API PEP_STATUS fsm_«@name»_inject(
    1.35                  PEP_SESSION session,
    1.36                  «@name»_event event,
    1.37                  Identity partner,
    1.38 @@ -102,7 +102,6 @@
    1.39          {
    1.40              PEP_STATUS status = PEP_STATUS_OK;
    1.41  
    1.42 -            session->sync_state = InitState;
    1.43              session->sync_state = fsm_«@name»(session, session->sync_state,
    1.44                      event, partner, state_partner);
    1.45  
    1.46 @@ -126,7 +125,7 @@
    1.47              switch (state) {
    1.48                  `` apply "state"
    1.49                  default:
    1.50 -                    return invalid_state;
    1.51 +                    return («@name»_state) invalid_state;
    1.52              }
    1.53  
    1.54              return state;
    1.55 @@ -141,7 +140,7 @@
    1.56          switch (event) {
    1.57          `` apply "event", 2
    1.58          default:
    1.59 -            return invalid_event;
    1.60 +            return («../@name»_state) invalid_event;
    1.61          }
    1.62          break;
    1.63