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.

<strong>Tornado</strong> 2.0<br />

User’s Guide<br />

shell of its location; the shell then issues the requests to actually copy the string to<br />

that memory. This request reaches the agent on the target, and it writes the 14 bytes<br />

(including the terminating null) there.<br />

The shell’s C-expression interpreter must now determine what the name opendir<br />

represents. Because opendir( ) is not one of the shell’s own commands, the shell<br />

looks up the symbol (through the target server) in the symbol table.<br />

The C interpreter now needs to evaluate the function call to opendir( ) with the<br />

particular argument specified, now represented by a memory location on the<br />

target. It instructs the agent (through the server) to spawn a task on the target for<br />

that purpose, and awaits the result.<br />

As before, the C interpreter looks up a symbol name (dir) through the target server;<br />

when the name turns out to be undefined, it instructs the target server to allocate<br />

storage for a new int and to make an entry pointing to it with the name dir in the<br />

symbol table. Again these symbol-table manipulations take place entirely on the<br />

host.<br />

The interpreter now has an address (in target memory) corresponding to dir, on the<br />

left of the assignment statement; and it has the value returned by opendir( ), on the<br />

right of the assignment statement. It instructs the agent (again, through the server)<br />

to record the result at the dir address, and evaluation of the statement is complete.<br />

5.8.2 Shell Components<br />

The <strong>Tornado</strong> shell includes two interpreters, a common front end for command<br />

entry and history, and a back end that connects the shell to the global <strong>Tornado</strong><br />

environment to communicate with the target server. Figure 5-3 illustrates these<br />

components:<br />

Line Editing<br />

The line-editing and command history facilities are designed to be<br />

unobtrusive, and support your access to the interpreters. 5.5 Shell Line Editing,<br />

p.193 describes the vi-like editing and history front end.<br />

C-Expression Interpreter<br />

The most visible component is the C-expression interpreter, because it is the<br />

interface that most closely resembles the application programming<br />

environment. The bulk of this chapter describes that interpreter.<br />

Tcl Interpreter<br />

An interface for extending the shell or automating shell interactions, described<br />

in 5.7 Tcl: Shell Interpretation, p.198.<br />

204

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

Saved successfully!

Ooh no, something went wrong!