comparison mde/setup/Init.d @ 103:42e241e7be3e

ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget. Some tidy-up. Some name changes, to increase uniformity. Bug-fix: floating widgets of fixed size could previously be made larger than intended from config dimdata.
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 25 Nov 2008 18:01:44 +0000
parents ba035eba07b4
children 1b1e2297e2fc
comparison
equal deleted inserted replaced
102:ba035eba07b4 103:42e241e7be3e
323 // else there won't be additional work so don't notify 323 // else there won't be additional work so don't notify
324 } 324 }
325 325
326 // Do a job: 326 // Do a job:
327 try { 327 try {
328 // FIXME - old stage start&finish trace messages - we don't have a name!
329 static if (startup) { 328 static if (startup) {
330 debug logger.trace ("({}) InitStage {}: starting init", threadNum, stage.name); 329 debug logger.trace ("({}) InitStage {}: starting init", threadNum, stage.name);
331 stage.state = (*stage).init(); // init is a property of a pointer (oh no!) 330 stage.state = (*stage).init(); // init is a property of a pointer (oh no!)
332 } else { 331 } else {
333 debug logger.trace ("({}) InitStage {}: starting cleanup", threadNum, stage.name); 332 debug logger.trace ("({}) InitStage {}: starting cleanup", threadNum, stage.name);
447 // Stuff normally done in Init.this(): 446 // Stuff normally done in Init.this():
448 // Calculate reverse dependencies of stages: 447 // Calculate reverse dependencies of stages:
449 foreach (key,stage_p; stages) 448 foreach (key,stage_p; stages)
450 foreach (name; stage_p.depends) 449 foreach (name; stage_p.depends)
451 stages[name].rdepends ~= key; 450 stages[name].rdepends ~= key;
452 int realMaxThreads = miscOpts.maxThreads(); 451 IntContent realMaxThreads = miscOpts.maxThreads;
453 miscOpts.maxThreads = 4; // force up to 4 threads for unittest 452 miscOpts.maxThreads = new IntContent ("maxThreads", 4); // force up to 4 threads for unittest
454 453
455 logger.level(Logger.Info); // hide a lot of trace messages 454 logger.level(Logger.Info); // hide a lot of trace messages
456 logger.info ("You should see some warning messages starting \"InitStage\":"); 455 logger.info ("You should see some warning messages starting \"InitStage\":");
457 // Run the above. 456 // Run the above.
458 runStages!(true); 457 runStages!(true);
488 assert (!a1, "runStages didn't throw"); 487 assert (!a1, "runStages didn't throw");
489 assert (init1); // s1.init should run first; s2.init may or may not get run 488 assert (init1); // s1.init should run first; s2.init may or may not get run
490 assert (stages[toStageName("stg3")].state == cast(StageState)7); // set by the exception 489 assert (stages[toStageName("stg3")].state == cast(StageState)7); // set by the exception
491 490
492 stages = realInit; // restore the real init stages 491 stages = realInit; // restore the real init stages
492 delete miscOpts.maxThreads;
493 miscOpts.maxThreads = realMaxThreads; 493 miscOpts.maxThreads = realMaxThreads;
494 logger.info ("Unittest complete."); 494 logger.info ("Unittest complete.");
495 } 495 }
496 } 496 }