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

Contents of /trunk/openisis/tcl/sample.fsp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 239 - (show annotations)
Mon Mar 8 17:49:13 2004 UTC (17 years, 4 months ago) by dpavlin
File size: 1185 byte(s)
including openisis 0.9.0 into webpac tree

1 # vim:syntax=tcl
2 # create the index record
3 # if this file is found as $db.fsp, it is used by openIsis::save
4 # we use the doc/Inverting controls to set word/field mode
5 #
6 # cds.fst is:
7 # 70 0 MHU,(V70/)
8 # 24 4 MHU,V24
9 # 69 2 V69
10 namespace eval test {} ;# create namespace
11
12
13 proc test::fsp {{rec rec} {idx ::openIsis::idx}} {
14 foreach {v24 v69 v70} [$rec get {24 {}} {69 {}} {70 {}}] break ;# lassign
15 # method 4: add one for each word of 24 (don't count occ; it's not repeatable)
16 set v [lindex $v24 0]
17 set len [string length $v]
18 $idx add -1 words ;# set word mode
19 for {set i 0} {$i < $len} {set i $j} {
20 set j [string wordend $v $i]
21 set e [expr $j - 1]
22 if {$e > $i} { # ignore single character words or non-words
23 set w [string range $v $i $e]
24 $idx add 24 $w
25 }
26 }
27 # method 2: grep <keywords> from 69
28 foreach {- kw} [regexp -all -inline {<([^>]+)>} [lindex $v69 0]] {
29 $idx add 69 $kw
30 }
31 # method 0: add one for each occurence of 70
32 $idx add -1 fields ;# set field mode
33 foreach f $v70 {
34 regsub -all {<[^=>]*=?([^>]*)>} $f {\1} f; # dump <a=b> substitutions
35 $idx add 70 $f
36 }
37 return $idx
38 }
39
40 # must return the name of the FSP as result of source
41 return test::fsp

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26