02.03.2014 Views

Tornado

Tornado

Tornado

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5<br />

Shell<br />

-> ?shConfig SH_GET_TASK_IO off<br />

-><br />

-> printf("Hello World!\n")<br />

value = 13 = 0xd<br />

-><br />

The shell reports the printf( ) result, indicating that 13 characters have been<br />

printed. The output, however, goes to the target’s standard output, not to the shell.<br />

To determine the current configuration, use shConfig. If you issue the command<br />

without an argument, all parameters are listed. Use an argument to list only one<br />

parameter.<br />

5<br />

-> ?shConfig SH_GET_TASK_IO<br />

SH_GET_TASK_IO = off<br />

For more information, see on shConfig, see WindSh Environment Variables, p.155.<br />

The standard input and output are only redirected for the function called from<br />

WindSh. If this function spawns other tasks, the input and output of the spawned<br />

tasks are not redirected to WindSh. To have all I/O redirected to WindSh, you can<br />

start the target server with the options -C -redirectShell.<br />

5.3.2 Data Types<br />

The most significant difference between the shell C-expression interpreter and a C<br />

compiler lies in the way that they handle data types. The shell does not accept any<br />

C declaration statements, and no data-type information is available in the symbol<br />

table. Instead, an expression’s type is determined by the types of its terms.<br />

Unless you use explicit type-casting, the shell makes the following assumptions<br />

about data types:<br />

■<br />

■<br />

In an assignment statement, the type of the left hand side is determined by the<br />

type of the right hand side.<br />

If floating-point numbers and integers both appear in an arithmetic<br />

expression, the resulting type is a floating-point number.<br />

■<br />

Data types are assigned to various elements as shown in Table 5-9.<br />

A constant or variable can be treated as a different type than what the shell<br />

assumes by explicitly specifying the type with the syntax of C type-casting.<br />

Functions that return values other than integers require a slightly different typecasting;<br />

see Function Calls, p.179. Table 5-10 shows the various data types available<br />

in the shell C interpreter, with examples of how they can be set and referenced.<br />

175

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

Saved successfully!

Ooh no, something went wrong!