07.05.2014 Views

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

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.

3.10 Control Tokens<br />

• CHOOSE Function Control – <strong>The</strong> tAttrChoose Token<br />

This token always follows the first parameter of the CHOOSE function (containing the value which parameter to<br />

choose). It contains a relative offset that allows to skip all unused choices and to jump directly to the correct parameter.<br />

<strong>The</strong> token promises that the topmost operand on the formula stack (the last processed subexpression) is the first<br />

parameter of a CHOOSE function. This operand is popped from the stack, and processing continues at the specified<br />

position in the token array. At the end of the parameter, a tAttrSkip token (see below) will occur that jumps right behind<br />

the tFuncVar(CHOOSE) token (this has to be assured during creation of the formula). Thus, only one more parameter of<br />

the function is evaluated at all, all other parameters cannot cause an error code as final formula result, if they contain an<br />

error. If the choice from the first parameter is wrong, the tAttrChoose token causes to jump to the tFuncVar(CHOOSE)<br />

token, and an error is generated.<br />

Token tAttrChoose, BIFF2:<br />

Offset Size Contents<br />

0 1 19 H<br />

1 1 04 H (identifier for the tAttrChoose token)<br />

2 1 Number of choices in the CHOOSE function (nc, number of parameters decreased by 1)<br />

3 nc Jump table containing nc distances (8-bit values specifying numbers of bytes) from start<br />

of this jump table to start of first token of the respective parameter of the CHOOSE<br />

function.<br />

3+nc 1 Distance (numbers of bytes) from start of the jump table of this token to start of the<br />

tFuncVar(CHOOSE) token. Used in case of an error (wrong choice in first parameter).<br />

Token tAttrChoose, BIFF3-BIFF8:<br />

Offset Size Contents<br />

0 1 19 H<br />

1 1 04 H (identifier for the tAttrChoose token)<br />

2 2 Number of choices in the CHOOSE function (nc, number of parameters decreased by 1)<br />

4 2∙nc Jump table containing nc distances (16-bit values specifying numbers of bytes) from start<br />

of this jump table to start of first token of the respective parameter of the CHOOSE<br />

function.<br />

4+2∙nc 2 Distance (numbers of bytes) from start of the jump table of this token to start of the<br />

tFuncVar(CHOOSE) token (skipping all leading tAttrSpace tokens related to the tFuncVar<br />

token). Used in case of an error (wrong choice in first parameter).<br />

69

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

Saved successfully!

Ooh no, something went wrong!