octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58533] unexpected error of parseparams (case-


From: G.B.
Subject: [Octave-bug-tracker] [bug #58533] unexpected error of parseparams (case-sensitivity issue with lookup + toupper?)
Date: Tue, 9 Jun 2020 11:11:01 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0

URL:
  <https://savannah.gnu.org/bugs/?58533>

                 Summary: unexpected error of parseparams (case-sensitivity
issue with lookup + toupper?)
                 Project: GNU Octave
            Submitted by: gb65
            Submitted on: Tue 09 Jun 2020 03:10:59 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: Mac OS

    _______________________________________________________

Details:

First bug submission, sincere apologies if not appropriate or trivial.

Function parseparams does not appear to work as expected in documented second
call form:


octave:8> [foo, bar1, bar2] = parseparams({ 0, "model", 1, "N", 2},"model", 4,
"N", 5, "d", 6)
error: parseparams: unrecognized option: model
error: called from
    parseparams>error_as_caller at line 109 column 3
    parseparams at line 97 column 9


When changing all default parameters to the same case (the function is
supposed to be case-insensitive), it works:


octave:13> [foo, bar1, bar2] = parseparams({ 0, "model", 1, "N", 2},"MODEL",
4, "N", 5, "D", 6)
foo =
{
  [1,1] = 0
}

bar1 =  1
bar2 =  2
octave:14> [foo, bar1, bar2] = parseparams({ 0, "model", 1, "N", 2},"model",
4, "n", 5, "d", 6)
foo =
{
  [1,1] = 0
}

bar1 =  1
bar2 =  2


After looking into the code, problem seems to be located in unexpected
behavior of the function lookup used with toupper:


octave:35> names = {"model","d","N"};
octave:36> pnames={"model","N"};
octave:38> lookup(names,pnames,"m")
ans =

   1   3

octave:39> lookup(toupper(names),toupper(pnames),"m")
ans =

   0   3



Not really understanding the above behavior.

Octave version: 5.2.0 installed via Macports







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58533>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]