/[webpac]/trunk/openisis/tcl/fullinv
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/openisis/tcl/fullinv

Parent Directory Parent Directory | Revision Log Revision Log


Revision 239 - (hide annotations)
Mon Mar 8 17:49:13 2004 UTC (20 years, 1 month ago) by dpavlin
File size: 1496 byte(s)
including openisis 0.9.0 into webpac tree

1 dpavlin 237 #!/opt/isis/OpenIsis/tcl/bin/isish
2     # vim:syntax=tcl
3     # fully invert db using fsp
4     # $Id: fullinv,v 1.2 2003/05/08 13:16:14 kripke Exp $
5     #
6    
7     package require openIsis 0.8
8    
9     # TODO: use cmd line args
10     set db test
11     set v 0
12     set n 5
13     foreach arg {db v n} {
14     catch {set $arg $env($arg)}
15     }
16    
17     set isis [openIsis] ;# contact local server
18     $isis add -syspath ../db/test -defaultdb $db
19     $isis req -type open
20    
21     $isis req -type maxrow
22     set max [$isis .res get rowid]
23     set tot 0
24    
25     $isis new ::openIsis::idx
26     set fsp [source ../db/test/$db.fsp]
27    
28    
29     proc ix {i {del 0}} {
30     global isis db tot fsp
31     $isis .req delete
32     $isis req -type read -rowid $i
33     $isis .res .rec clone rec
34    
35     ::openIsis::idx delete
36     ::openIsis::idx add -1 "mfn\t$i"
37     if $del {
38     ::openIsis::idx add -1 del ;# delete mode
39     }
40     if [catch {
41     $fsp
42     incr tot [expr [::openIsis::idx length] / 2]
43    
44     $isis .req delete
45     $isis .req wrap -tag 926 ::openIsis::idx
46     if $::v {
47     ::puts stderr [$isis .req serialize]
48     } else {
49     puts -nonewline "\r$i\t$tot"; flush stdout
50     }
51     $isis req -type insert
52     }] {
53     puts stderr "$i: $::errorInfo"
54     }
55     }
56    
57    
58     switch -- [lindex $argv 0] \
59     del { # delete every nth
60     for {set i 1} {$i <= $max} {incr i $n} { ix $i 1 }
61     } \
62     add { # add every nth
63     for {set i 1} {$i <= $max} {incr i $n} { ix $i }
64     } \
65     test { # delete and reindex every nth
66     for {set i 1} {$i <= $max} {incr i $n} { ix $i 1 }
67     for {set i 1} {$i <= $max} {incr i $n} { ix $i }
68     } \
69     default { # full inv
70     for {set i 1} {$i <= $max} {incr i} { ix $i }
71     }
72     # puts "\n$tot entries"

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26