02.03.2014 Views

Tornado

Tornado

Tornado

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5<br />

Shell<br />

5.4.2 Automatic Name Demangling<br />

Many shell debugging and system information functions display addresses<br />

symbolically (for example, the l( ) routine). This might be confusing for C++,<br />

because compilers encode a function’s class membership (if any) and the type and<br />

number of the function’s arguments in the function’s linkage name. The encoding<br />

is meant to be efficient for development tools, but not necessarily convenient for<br />

human comprehension. This technique is commonly known as name mangling and<br />

can be a source of frustration when the mangled names are exposed to the<br />

developer.<br />

To avoid this confusion, the debugging and system information routines in<br />

WindSh print C++ function names in a demangled representation. Whenever the<br />

shell prints an address symbolically, it checks whether the name has been<br />

mangled. If it has, the name is demangled (complete with the function’s class<br />

name, if any, and the type of each of the function’s arguments) and printed.<br />

The following example shows the demangled output when lkup( ) displays the<br />

addresses of the xmin( ) functions mentioned in 5.4.1 Overloaded Function Names,<br />

p.191.<br />

5<br />

-> lkup "xmin"<br />

_xmin(double,double) 0x003fe710 text (templex.out)<br />

_xmin(long,long) 0x003fe754 text (templex.out)<br />

_xmin(int,int) 0x003fe73a text (templex.out)<br />

_xmin(float,float) 0x003fe6ee text (templex.out)<br />

value = 0 = 0x0<br />

5.5 Shell Line Editing<br />

The WindSh front end provides a history mechanism similar to the UNIX<br />

Korn-shell history facility, including a built-in vi-like line editor that allows you to<br />

scroll, search, and edit previously typed commands. Line editing is available<br />

regardless of which interpreter you are using (C or Tcl 6 ), and the command history<br />

spans both interpreters—you can switch from one to the other and back, and scroll<br />

through the history of both modes.<br />

You can control what characters to use for certain editing commands. The input<br />

keystrokes shown in Table 5-14 (5.3.13 Terminal Control Characters, p.186) are set by<br />

6. The WindSh Tcl-interpreter interface is described in 5.7 Tcl: Shell Interpretation, p.198.<br />

193

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!