Skip to content
Tcl Source Code History Of Ticket 1152746
Login

History Of Ticket 1152746

Artifacts Associated With Ticket 1152746

  1. Ticket change [c5ed5afd0a] (rid 121671) by mistachkin on 2005-02-27 04:53:25:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      This provided patch was made against HEAD.  It has been
      tested on Windows NT and FreeBSD.
      
      Please refer to TIP #241 for more information.
      
      
    4. foundin initialized to: "TIP Implementation"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "mistachkin"
    9. subsystem initialized to: "17. Commands I-L"
    10. title initialized to: "TIP #241 [lsearch -nocase] Implementation"
    11. type initialized to: "Patch"
  2. Ticket change [3d40d31361] (rid 121059) by mistachkin on 2005-02-27 11:53:26:

    1. icomment:
      
      
      File Added - 123296: TIP-241v1.diff
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  3. Ticket change [ff013b0761] (rid 108687) by mistachkin on 2005-02-27 15:01:36:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      
      Updated v2 patch (optimized).  Added docs and test cases.
      
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  4. Ticket change [9df2bf18ca] (rid 96394) by mistachkin on 2005-02-27 15:01:37:

    1. icomment:
      
      
      File Added - 123311: TIP-241v2.diff
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  5. Ticket change [ff53e48340] (rid 108736) by mistachkin on 2005-02-28 03:02:03:

    1. title changed to: "TIP #241 [lsearch -nocase] and [lsort -nocase]"
  6. Ticket change [4a8c653b3f] (rid 126553) by mistachkin on 2005-02-28 03:20:55:

    1. icomment:
      
      
      File Added - 123374: TIP-241v3.diff
      
      Logged In: YES 
      user_id=113501
      
      
      Updated v3 patch.  Added [lsort -nocase] with docs and tests.
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  7. Ticket change [a2c50b7eeb] (rid 109949) by mistachkin on 2005-03-02 13:53:52:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      
      Updated v4 patch.  Added [switch -nocase] with docs and tests.
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. title changed to:
      TIP #241 -nocase option for [lsearch], [lsort], and [switch]
      
    5. username: "mistachkin"
  8. Ticket change [f7866f35f9] (rid 91391) by mistachkin on 2005-03-02 13:53:53:

    1. icomment:
      
      
      File Added - 123800: TIP-241v4.diff
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  9. Add attachment "TIP-241v4.diff" [b1dcc02475] (rid 98232) by mistachkin on 2005-03-02 13:53:53.

  10. Ticket change [fc9dfd8a18] (rid 108267) by dkf on 2005-03-02 16:58:59:

    1. icomment:
      
      
      File Deleted - 123374: 
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [e5b4a26fff] (rid 104173) by dkf on 2005-03-02 16:59:00:

    1. icomment:
      
      
      File Deleted - 123311: 
      
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  12. Ticket change [5d6f691306] (rid 115462) by dkf on 2005-06-01 19:14:56:

    1. closedate changed to: "2005-06-01T12:14:56"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      
      Implemented using the patch, thanks!
      
      I also added compilation of [switch -glob -nocase]; I'd have
      done it for -exact -nocase too, but I don't know what
      opcodes to issue (INST_STR_EQ doesn't take an immediate
      operand for nocaseness, unlike INST_STR_MATCH)
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"
  13. Ticket change [bccb4aa0bb] (rid 101814) by kchansen on 2005-11-15 01:31:45:

    1. icomment:
      Logged In: YES 
      user_id=614439
      
      A Tcl-only approach....
      
      I needed a -nocase option for the switch statement, scanned 
      the tips and found this one.  Here is the approach I took to 
      get effectively the same behavior:
      
      proc CreateCaselessRegExp {Text} {
        set TextUpper [split [string toupper $Text] {}]
        set TextLower [split [string tolower $Text] {}]
      
        foreach Upper $TextUpper Lower $TextLower {
          lappend TextResult "\[$TextUpper$TextLower\]"
          }
      
        set RegExp [join $TextResult {}]
      
        return $RegExp
        };# CreateCaselessRegExp
      
      With this proc, a "switch" with "-exact" and "-nocase" 
      replaces those options with "-regexp", and replaces the exact 
      strings with the result of calling CreateCaselessRegExp.  You 
      must also check to see if the test value is "default" and not 
      change it when it is encountered.
      
      For example:
      
      switch -exact -nocase -- $MyText {
        First {
          ...
          }
        Third {
          ...
          }
        "Another one here" {
          ...
          }
        "Test #9" {
          }
        default {
          }
        }
      
      becomes:
      
      switch -regexp -- $MyText {
        [Ff][Ii][Rr][Ss][Tt] {
          ...
          }
        [Tt][Hh][Ii][Rr][Dd] {
          ...
          }
        "[Aa][Nn][Oo][Tt][Hh][Ee][Rr][  ][Oo][Nn][Ee][  ][Hh][Ee][Rr]
      [Ee]" {
          ...
          }
        "[Tt][Ee][Ss][Tt][  ][##][99]" {
          }
        default {
          }
        }
      
      I actually ended up coding as:
      
      eval {switch -exact -nocase -- $MyText {
        [CreateCaselessRegExp First] {
          ...
          }
        [CreateCaselessRegExp Third] {
          ...
          }
        [CreateCaselessRegExp "Another one here"] {
          ...
          }
        [CreateCaselessRegExp "Test #9"] {
          }
        default {
          }
        }}
      
      As you can see, it could be made a little smarter because all 
      non-alphabet characters end up doubled.  A test could be put 
      in to not create a "one of list" selections for things which are 
      not alphabet, but I figured it was fine for a first cut....  I also 
      liked the fact that I was able to get the case insensitivity with 
      very little extra effort....
      <Karl C. Hansen>
      
      
      
    2. login: "kchansen"
    3. mimetype: "text/plain"
    4. username: "kchansen"
  14. Ticket change [c3a36b6a0b] (rid 111698) by kchansen on 2005-11-15 01:38:28:

    1. icomment:
      Logged In: YES 
      user_id=614439
      
      Typo in previous proc....
      
      proc CreateCaselessRegExp {Text} {
        set TextUpper [split [string toupper $Text] {}]
        set TextLower [split [string tolower $Text] {}]
      
        foreach Upper $TextUpper Lower $TextLower {
          lappend TextResult "\[$Upper$Lower\]"
      #                                   ^^^^^^^^^^^^^^^^
          }
      
        set RegExp [join $TextResult {}]
      
        return $RegExp
        };# CreateCaselessRegExp
      
      
      
    2. login: "kchansen"
    3. mimetype: "text/plain"
    4. username: "kchansen"
  15. Ticket change [ce55de083c] (rid 96036) by dkf on 2005-11-15 15:56:32:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      If you're going to do that, you should remember to anchor
      the generated REs. You might (assuming you're not stuck on
      Tcl 8.0 or before) also like to use the RE:
        (?i)^FooBar$
      instead of:
        ^[Ff][Oo][Oo][Bb][Aa][Rr]$
      if you see what I mean.
      
      None of which makes much odds. This is a closed issue.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"