| 249 | } |
| 250 | |
| 251 | SpaceStatus |
| 252 | Space::status(StatusStatistics& stat) { |
| 253 | // Check whether space is failed |
| 254 | if (failed()) |
| 255 | return SS_FAILED; |
| 256 | assert(pc.p.active <= &pc.p.queue[PropCost::AC_MAX+1]); |
| 257 | Propagator* p; |
| 258 | // Check whether space is stable but not failed |
| 259 | if (pc.p.active >= &pc.p.queue[0]) { |
| 260 | ModEventDelta med_o; |
| 261 | if ((pc.p.bid_sc & ((1 << sc_bits) - 1)) == 0) { |
| 262 | // No support for disabled propagators and tracing |
| 263 | // Check whether space is stable but not failed |
| 264 | goto f_unstable; |
| 265 | f_execute: |
| 266 | stat.propagate++; |
| 267 | // Keep old modification event delta |
| 268 | med_o = p->u.med; |
| 269 | // Clear med but leave propagator in queue |
| 270 | p->u.med = 0; |
| 271 | switch (p->propagate(*this,med_o)) { |
| 272 | case ES_FAILED: |
| 273 | goto failed; |
| 274 | case ES_NOFIX: |
| 275 | // Find next, if possible |
| 276 | if (p->u.med != 0) { |
| 277 | f_unstable: |
| 278 | // There is at least one propagator in a queue |
| 279 | do { |
| 280 | assert(pc.p.active >= &pc.p.queue[0]); |
| 281 | // First propagator or link back to queue |
| 282 | ActorLink* fst = pc.p.active->next(); |
| 283 | if (pc.p.active != fst) { |
| 284 | p = Propagator::cast(fst); |
| 285 | goto f_execute; |
| 286 | } |
| 287 | pc.p.active--; |
| 288 | } while (true); |
| 289 | GECODE_NEVER; |
| 290 | } |
| 291 | // Fall through |
| 292 | case ES_FIX: |
| 293 | // Clear med |
| 294 | p->u.med = 0; |
| 295 | // Put into idle queue |
| 296 | p->unlink(); pl.head(p); |
| 297 | f_stable_or_unstable: |
| 298 | // There might be a propagator in the queue |
| 299 | do { |
| 300 | assert(pc.p.active >= &pc.p.queue[0]); |
| 301 | // First propagator or link back to queue |
| 302 | ActorLink* fst = pc.p.active->next(); |
| 303 | if (pc.p.active != fst) { |
| 304 | p = Propagator::cast(fst); |
| 305 | goto f_execute; |
| 306 | } |
| 307 | } while (--pc.p.active >= &pc.p.queue[0]); |
| 308 | assert(pc.p.active < &pc.p.queue[0]); |
no test coverage detected