| | @@ -48,17 +48,14 @@ |
| 48 | 48 | return [lsort -dict [array names myfiles]] |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | method files {} { |
| 52 | 52 | # TODO: Loading from state |
| 53 | | - set res {} |
| 54 | | - foreach f [lsort -dict [array names myfiles]] { |
| 55 | | - lappend res [file %AUTO% $f $self] |
| 56 | | - } |
| 57 | | - return $res |
| 53 | + return [TheFiles] |
| 58 | 54 | } |
| 59 | 55 | |
| 56 | + # pass I persistence |
| 60 | 57 | method persist {} { |
| 61 | 58 | state transaction { |
| 62 | 59 | # Project data first. Required so that we have its id |
| 63 | 60 | # ready for the files. |
| 64 | 61 | |
| | @@ -78,19 +75,51 @@ |
| 78 | 75 | } |
| 79 | 76 | } |
| 80 | 77 | } |
| 81 | 78 | return |
| 82 | 79 | } |
| 80 | + |
| 81 | + # pass II persistence |
| 82 | + method persistrev {} { |
| 83 | + state transaction { |
| 84 | + # TODO: per project persistence (symbols, meta data) |
| 85 | + foreach f [TheFiles] { |
| 86 | + $f persist |
| 87 | + } |
| 88 | + } |
| 89 | + return |
| 90 | + } |
| 83 | 91 | |
| 84 | 92 | # # ## ### ##### ######## ############# |
| 85 | 93 | ## State |
| 86 | 94 | |
| 87 | 95 | variable mybase {} ; # Project directory |
| 88 | 96 | variable myfiles -array {} ; # Maps rcs archive to their user files. |
| 97 | + variable myfobj {} ; # File objects for the rcs archives |
| 89 | 98 | |
| 90 | 99 | # # ## ### ##### ######## ############# |
| 91 | 100 | ## Internal methods |
| 101 | + |
| 102 | + proc TheFiles {} { |
| 103 | + upvar 1 myfiles myfiles myfobj myfobj self self |
| 104 | + if {![llength $myfobj]} { |
| 105 | + set myfobj [EmptyFiles myfiles] |
| 106 | + } |
| 107 | + return $myfobj |
| 108 | + } |
| 109 | + |
| 110 | + proc EmptyFiles {fv} { |
| 111 | + upvar 1 $fv myfiles self self |
| 112 | + set res {} |
| 113 | + foreach f [lsort -dict [array names myfiles]] { |
| 114 | + lappend res [file %AUTO% $f $self] |
| 115 | + } |
| 116 | + return $res |
| 117 | + } |
| 118 | + |
| 119 | + # # ## ### ##### ######## ############# |
| 120 | + ## Configuration |
| 92 | 121 | |
| 93 | 122 | pragma -hastypeinfo no ; # no type introspection |
| 94 | 123 | pragma -hasinfo no ; # no object introspection |
| 95 | 124 | pragma -hastypemethods no ; # type is not relevant. |
| 96 | 125 | pragma -simpledispatch yes ; # simple fast dispatch |
| 97 | 126 | |