- /* Add all the transitions to the enabled set and then remove the disabled ones */
- xbt_setset_add(enabled, transitions);
- xbt_setset_foreach(transitions, cursor, trans){
- if(trans->type == mc_wait
- && (trans->wait.comm->src_proc == NULL || trans->wait.comm->dst_proc == NULL)){
- xbt_setset_set_remove(enabled, trans);
+ xbt_setset_foreach(transitions, cursor, trans) {
+ switch (trans->type) {
+ /* Wait transitions are enabled only if the communication has both a
+ sender and receiver */
+ case mc_wait:
+ if (trans->wait.comm->src_proc && trans->wait.comm->dst_proc) {
+ xbt_setset_set_insert(enabled, trans);
+ DEBUG1("Transition %p is enabled for next state", trans);
+ }
+ break;
+
+ /* WaitAny transitions are enabled if any of it's communications has both
+ a sender and a receiver */
+ case mc_waitany:
+ xbt_dynar_foreach(trans->waitany.comms, index, comm) {
+ if (comm->src_proc && comm->dst_proc) {
+ xbt_setset_set_insert(enabled, trans);
+ DEBUG1("Transition %p is enabled for next state", trans);
+ break;
+ }
+ }
+ break;
+
+ /* The rest of the transitions cannot be disabled */
+ default:
+ xbt_setset_set_insert(enabled, trans);
+ DEBUG1("Transition %p is enabled for next state", trans);
+ break;