Mercurial > hg > Papers > 2008 > atsuki-master
comparison paper/src/tableau.cbc @ 0:a67653fda270
Initial revision
author | atsuki |
---|---|
date | Tue, 12 Feb 2008 17:37:48 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a67653fda270 |
---|---|
1 code tableau(TaskPtr list) | |
2 { | |
3 StateDB out; | |
4 | |
5 st.hash = get_memory_hash(mem,0); | |
6 if (lookup_StateDB(&st, &state_db, &out)) { | |
7 // found in the state database | |
8 printf("found %d\n",count); | |
9 while(!(list = next_task_iterator(task_iter))) { | |
10 // no more branch, go back to the previous one | |
11 TaskIteratorPtr prev_iter = task_iter->prev; | |
12 if (!prev_iter) { | |
13 printf("All done count %d\n",count); | |
14 memory_usage(); | |
15 goto ret(0),env; | |
16 } | |
17 printf("no more branch %d\n",count); | |
18 depth--; | |
19 free_task_iterator(task_iter); | |
20 task_iter = prev_iter; | |
21 } | |
22 // return to previous state | |
23 // here we assume task list is fixed, we don't have to | |
24 // recover task list itself | |
25 restore_memory(task_iter->state->memory); | |
26 printf("restore list %x next %x\n",(int)list,(int)(list->next)); | |
27 } else { | |
28 // one step further | |
29 depth++; | |
30 task_iter = create_task_iterator(list,out,task_iter); | |
31 } | |
32 printf("depth %d count %d\n", depth, count++); | |
33 goto list->phils->next(list->phils,list); | |
34 } |