Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.90 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #------------ Ищет в словаре  слово
  2. proc ::words::search word {
  3. global
  4.   set file [lindex [split $word] 1]
  5.   set word [lrange $word 0 end]
  6.   set wordsi 0
  7.   set wordsline 0
  8.   #putlog "Поиск:\[$word\]..."
  9.  
  10.   set file [open "data/$wordsdatabase" r]
  11.   while {[gets $file b]>-1} {
  12.                 incr wordsline
  13.     if {[string match -nocase $word $b]} {
  14.       incr wordsi
  15.           set wordsfindline $wordsline
  16.     }
  17.   }
  18.   close $file
  19.   if {$wordsi} {return 1} else {return 0}
  20. }
  21.  
  22.  
  23. proc ::words::add {  } {
  24. ::words::search
  25. }
  26.  
  27. proc ::words::delete {  } {
  28. ::words::search
  29. }
  30.  
  31. proc ::words::addcity {  } {
  32. set wordsdatabase "city.rej"
  33. ::words::add
  34. }
  35. proc ::words::delcity {  } {
  36. set wordsdatabase "city.rej"
  37. ::words::add
  38. }
  39. proc ::words::addname {  } {
  40. set wordsdatabase "name.rej"
  41. ::words::add
  42. }
  43. proc ::words::delname {  } {
  44. set wordsdatabase "name.rej"
  45. ::words::add
  46. }