[Bug 833] New: variable declared twice

http://bugs.orocos.org/show_bug.cgi?id=833

Summary: variable declared twice
Product: Toolchain
Version: 2.3.0
Platform: Intel 64bit
OS/Version: Windows
Status: NEW
Severity: major
Priority: P3
Component: OCL
AssignedTo: orocos-dev [..] ...
ReportedBy: florian [dot] nouviale [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

I'm trying to use 2.2.1 examples on 2.3.0 and I foung a bug in TaskBrowser.cpp.
A variable is declared twice

790 #ifdef USE_SIGNALS
791 // Call readline wrapper :
792 ::signal( SIGINT, ctrl_c_catcher ); // catch ctrl_c only when editting
a line.
793 #endif
794 std::string command; // first declaration
795 // When using rxvt on windows, the process will receive signals when
the arrow keys are used
796 // during input. We compile with /EHa to catch these signals and don't
print anything.
797 try { // bad indentation starts from here
798 #ifdef USE_READLINE
799 const char* const commandStr = rl_gets();
800 // quit on EOF (Ctrl-D)
801 command = commandStr ? commandStr : "quit"; // copy over to string
802 #else
803 std::string command; // second declaration
804 cout << prompt;
805 getline(cin,command); // we fill the local variable here
806 if (!cin) // Ctrl-D
807 command = "quit";
808 #endif
809 } catch(std::exception& e) {
810 cerr << "The command line reader throwed a std::exception: '"<<
e.what()<<"'."<<endl;
811 } catch (...) {
812 cerr << "The command line reader throwed an exception."
< 813 } // local variable destroyed
814 str_trim( command, ' '); // this variable is empty

I also inform you that the display is kinda messy on windows. Here is an
example of a part of what I obtain with the hello world example and typing help
in the prompt :

0.203 [ Info ][main()] Entering Task Hello

?[01;31m This console reader allows you to browse and manipulate TaskContexts.
You can type in an operation, expression, create or change variables.
(type '?[4mhelp?[0m?[01;31m' for instructions and '?[4mls?[0m?[01;31m' for
con
text info)

TAB completion and history is NOT available (LGPL-version)?[0m

Hello [S]> help
help
?[0m?[0m
[?[01;31m?[4mTask Browsing?[0m]
To switch to another task, type '?[01;31m?[4mcd <path-to-taskname>?[0m'
and type '?[01;31m?[4mcd ..?[0m' to go back to the previous task (History
size
is 20).
Pressing <?[01;31m?[4mtab?[0m> multiple times helps you to complete your
comma
nd.
It is not mandatory to switch to a task to interact with it, you can type the
peer-path to the task (dot-separated) and then type command or expression :
PeerTask.OtherTask.FinalTask.countTo(3) [enter]
Where 'countTo' is a method of 'FinalTask'.
The TaskBrowser starts by default 'In' the current component. In order to
watc
h
the TaskBrowser itself, type '?[01;31m?[4mleave?[0m' You will notice that it
has connected to the data ports of the visited component. Use
'?[01;31m?[4ment
er?[0m' to enter
the visited component again. The '?[01;31m?[4mcd?[0m' command works
transparan
tly in both
modi.

--
Configure bugmail: http://bugs.orocos.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

[Bug 833] variable declared twice

http://bugs.orocos.org/show_bug.cgi?id=833

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |next-bugfix

--- Comment #1 from Peter Soetens <peter [..] ...> 2011-03-30 17:39:39 CEST ---
(In reply to comment #0)
> I'm trying to use 2.2.1 examples on 2.3.0 and I foung a bug in TaskBrowser.cpp.
> A variable is declared twice
>
> 790 #ifdef USE_SIGNALS
> 791 // Call readline wrapper :
> 792 ::signal( SIGINT, ctrl_c_catcher ); // catch ctrl_c only when editting a
> line.
> 793 #endif
> 794 std::string command; // first declaration
> 795 // When using rxvt on windows, the process will receive signals when the
> arrow keys are used
> 796 // during input. We compile with /EHa to catch these signals and don't
> print anything.
> 797 try { // bad indentation starts from here
> 798 #ifdef USE_READLINE
> 799 const char* const commandStr = rl_gets();
> 800 // quit on EOF (Ctrl-D)
> 801 command = commandStr ? commandStr : "quit"; // copy over to string
> 802 #else
> 803 std::string command; // second declaration
> 804 cout << prompt;
> 805 getline(cin,command); // we fill the local variable here
> 806 if (!cin) // Ctrl-D
> 807 command = "quit";
> 808 #endif
> 809 } catch(std::exception& e) {
> 810 cerr << "The command line reader throwed a std::exception: '"<<
> e.what()<<"'."<<endl;
> 811 } catch (...) {
> 812 cerr << "The command line reader throwed an exception." <<endlog();
> 813 } // local variable destroyed
> 814 str_trim( command, ' '); // this variable is empty

Thanks for pointing out. I've removed the latter one.

>
> I also inform you that the display is kinda messy on windows. Here is an example
> of a part of what I obtain with the hello world example and typing help in the
> prompt :
>
> 0.203 [ Info ][main()] Entering Task Hello
>
> ?[01;31m This console reader allows you to browse and manipulate TaskContexts.
> You can type in an operation, expression, create or change variables.
> (type '?[4mhelp?[0m?[01;31m' for instructions and '?[4mls?[0m?[01;31m' for con
> text info)
>
> TAB completion and history is NOT available (LGPL-version)?[0m
>
> Hello [S]> help
> help
> ?[0m?[0m
> [?[01;31m?[4mTask Browsing?[0m]
> To switch to another task, type '?[01;31m?[4mcd <path-to-taskname>?[0m'
> and type '?[01;31m?[4mcd ..?[0m' to go back to the previous task (History size
> is 20).
> Pressing <?[01;31m?[4mtab?[0m> multiple times helps you to complete your comma
> nd.
> It is not mandatory to switch to a task to interact with it, you can type the
> peer-path to the task (dot-separated) and then type command or expression :
> PeerTask.OtherTask.FinalTask.countTo(3) [enter]
> Where 'countTo' is a method of 'FinalTask'.
> The TaskBrowser starts by default 'In' the current component. In order to watc
> h
> the TaskBrowser itself, type '?[01;31m?[4mleave?[0m' You will notice that it
> has connected to the data ports of the visited component. Use '?[01;31m?[4ment
> er?[0m' to enter
> the visited component again. The '?[01;31m?[4mcd?[0m' command works transparan
> tly in both
> modi.

type .nocolors at the Taskbrowser prompt to turn this off.

Peter

--
Configure bugmail: http://bugs.orocos.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

Ruben Smits's picture

[Bug 833] New: variable declared twice

On Thursday 03 March 2011 14:02:29 Florian Nouviale wrote:
> http://bugs.orocos.org/show_bug.cgi?id=833
>
> Summary: variable declared twice
> Product: Toolchain
> Version: 2.3.0
> Platform: Intel 64bit
> OS/Version: Windows
> Status: NEW
> Severity: major
> Priority: P3
> Component: OCL
> AssignedTo: orocos-dev [..] ...
> ReportedBy: florian [dot] nouviale [..] ...
> CC: orocos-dev [..] ...
> Estimated Hours: 0.0
>
>
> I'm trying to use 2.2.1 examples on 2.3.0 and I foung a bug in
> TaskBrowser.cpp. A variable is declared twice
>
> 790 #ifdef USE_SIGNALS
> 791 // Call readline wrapper :
> 792 ::signal( SIGINT, ctrl_c_catcher ); // catch ctrl_c only when
> editting a line.
> 793 #endif
> 794 std::string command; // first declaration
> 795 // When using rxvt on windows, the process will receive signals when
> the arrow keys are used
> 796 // during input. We compile with /EHa to catch these signals and
> don't print anything.
> 797 try { // bad indentation starts from here
> 798 #ifdef USE_READLINE
> 799 const char* const commandStr = rl_gets();
> 800 // quit on EOF (Ctrl-D)
> 801 command = commandStr ? commandStr : "quit"; // copy over to string
> 802 #else
> 803 std::string command; // second declaration
> 804 cout << prompt;
> 805 getline(cin,command); // we fill the local variable here
> 806 if (!cin) // Ctrl-D
> 807 command = "quit";
> 808 #endif
> 809 } catch(std::exception& e) {
> 810 cerr << "The command line reader throwed a std::exception: '"<<
> e.what()<<"'."<<endl;
> 811 } catch (...) {
> 812 cerr << "The command line reader throwed an exception."
> <<endlog();
> 813 } // local variable destroyed
> 814 str_trim( command, ' '); // this variable is empty
>
> I also inform you that the display is kinda messy on windows. Here is an
> example of a part of what I obtain with the hello world example and typing
> help in the prompt :
>
> 0.203 [ Info ][main()] Entering Task Hello
>
> ?[01;31m This console reader allows you to browse and manipulate
> TaskContexts. You can type in an operation, expression, create or change
> variables. (type '?[4mhelp?[0m?[01;31m' for instructions and
> '?[4mls?[0m?[01;31m' for con
> text info)
>
> TAB completion and history is NOT available (LGPL-version)?[0m
>
> Hello [S]> help
> help
> ?[0m?[0m
> [?[01;31m?[4mTask Browsing?[0m]
> To switch to another task, type '?[01;31m?[4mcd <path-to-taskname>?[0m'
> and type '?[01;31m?[4mcd ..?[0m' to go back to the previous task (History
> size
> is 20).
> Pressing <?[01;31m?[4mtab?[0m> multiple times helps you to complete your
> comma
> nd.
> It is not mandatory to switch to a task to interact with it, you can type
> the peer-path to the task (dot-separated) and then type command or
> expression : PeerTask.OtherTask.FinalTask.countTo(3) [enter]
> Where 'countTo' is a method of 'FinalTask'.
> The TaskBrowser starts by default 'In' the current component. In order to
> watc
> h
> the TaskBrowser itself, type '?[01;31m?[4mleave?[0m' You will notice that
> it has connected to the data ports of the visited component. Use
> '?[01;31m?[4ment
> er?[0m' to enter
> the visited component again. The '?[01;31m?[4mcd?[0m' command works
> transparan
> tly in both
> modi.

I'm guessing that the coloring is messing stuff up. If you type ".nocolors" as
first command in the TaskBrowser, does this fix the output?

-- Ruben

--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev