fixed and greatly simplified delay implementation
While it was always allowed to use arbitrary expressions for the argument to delay(), this never worked as one would expect if the expression depended on e.g. monitored variables. The reason is that previously the delay expression was evaluated once for all delays appearing in conditions inside a state when the state was entered. Later checks whether the delay has expired used the cached delay value. Now, delay expressions are evaluated like all other parts of the state transition condition and seq_delay() takes a double argument instead of a delay id. As a (transparent) side effect, if the delay has not yet expired, the minimum time to wait for events is adjusted. This adjustment is now more precise, since we do not store the delay but rather the (future) time when the wakeup should happen. The new implementation makes a lot of code obsolete which has consequently been deleted: - type DELAY_ID and all mentions of delay ids - assignment of delay ids in the compiler - the special cases FT_DELAY for the delay() builtin and the special E_DELAY syntax node type - generated delay init functions - seq_delayInit() - clearDelays() and calcTimeout() in seq_task - array members delay, delayExpired of struct state_set instead there is now double wakeupTime - member numDelays in various structs - assign_next_delay_id in the compiler
Showing
- src/seq/seq.h 5 additions, 0 deletionssrc/seq/seq.h
- src/seq/seqCom.h 1 addition, 6 deletionssrc/seq/seqCom.h
- src/seq/seqPvt.h 2 additions, 5 deletionssrc/seq/seqPvt.h
- src/seq/seq_if.c 20 additions, 33 deletionssrc/seq/seq_if.c
- src/seq/seq_main.c 2 additions, 20 deletionssrc/seq/seq_main.c
- src/seq/seq_qry.c 5 additions, 13 deletionssrc/seq/seq_qry.c
- src/seq/seq_task.c 22 additions, 104 deletionssrc/seq/seq_task.c
- src/snc/analysis.c 0 additions, 19 deletionssrc/snc/analysis.c
- src/snc/builtin.c 1 addition, 1 deletionsrc/snc/builtin.c
- src/snc/builtin.h 0 additions, 1 deletionsrc/snc/builtin.h
- src/snc/expr.c 0 additions, 4 deletionssrc/snc/expr.c
- src/snc/gen_code.h 0 additions, 1 deletionsrc/snc/gen_code.h
- src/snc/gen_ss_code.c 0 additions, 43 deletionssrc/snc/gen_ss_code.c
- src/snc/gen_tables.c 1 addition, 3 deletionssrc/snc/gen_tables.c
- src/snc/types.h 1 addition, 6 deletionssrc/snc/types.h
Loading
Please register or sign in to comment